fed8b2eed7
Backend release / release (push) Waiting to run
Bandit Security Scan / bandit_scan (push) Waiting to run
Build and push multi-arch DocsGPT Docker image / build (linux/amd64, ubuntu-latest, amd64) (push) Waiting to run
Build and push multi-arch DocsGPT Docker image / build (linux/arm64, ubuntu-24.04-arm, arm64) (push) Waiting to run
Build and push multi-arch DocsGPT Docker image / manifest (push) Blocked by required conditions
Build and push DocsGPT FE Docker image for development / build (linux/amd64, ubuntu-latest, amd64) (push) Waiting to run
Build and push DocsGPT FE Docker image for development / build (linux/arm64, ubuntu-24.04-arm, arm64) (push) Waiting to run
Build and push DocsGPT FE Docker image for development / manifest (push) Blocked by required conditions
Python linting / ruff (push) Waiting to run
Run python tests with pytest / Run tests and count coverage (3.12) (push) Waiting to run
React Widget Build / build (push) Waiting to run
26 lines
884 B
Python
26 lines
884 B
Python
from application.retriever.classic_rag import ClassicRAG
|
|
from application.retriever.graph_rag import GraphRAGRetriever
|
|
from application.retriever.hybrid_rag import HybridRetriever
|
|
|
|
|
|
class RetrieverCreator:
|
|
retrievers = {
|
|
"classic": ClassicRAG,
|
|
"default": ClassicRAG,
|
|
"hybrid": HybridRetriever,
|
|
"graphrag": GraphRAGRetriever,
|
|
}
|
|
|
|
@classmethod
|
|
def create_retriever(cls, type, *args, **kwargs):
|
|
retriever_type = (type or "default").lower()
|
|
retiever_class = cls.retrievers.get(retriever_type)
|
|
if not retiever_class:
|
|
raise ValueError(f"No retievers class found for type {type}")
|
|
return retiever_class(*args, **kwargs)
|
|
|
|
@classmethod
|
|
def register(cls, key, retriever_class):
|
|
"""Register ``retriever_class`` under ``key`` (idempotent)."""
|
|
cls.retrievers[key] = retriever_class
|