feat(RAG): Introduce SentenceTransformer Reranker (#1810)

This commit is contained in:
machatschek
2024-04-02 10:29:51 +02:00
committed by GitHub
parent f83abff8bc
commit 83adc12a8e
7 changed files with 198 additions and 8 deletions

View File

@@ -284,15 +284,31 @@ class UISettings(BaseModel):
)
class RerankSettings(BaseModel):
enabled: bool = Field(
False,
description="This value controls whether a reranker should be included in the RAG pipeline.",
)
model: str = Field(
"cross-encoder/ms-marco-MiniLM-L-2-v2",
description="Rerank model to use. Limited to SentenceTransformer cross-encoder models.",
)
top_n: int = Field(
2,
description="This value controls the number of documents returned by the RAG pipeline.",
)
class RagSettings(BaseModel):
similarity_top_k: int = Field(
2,
description="This value controls the number of documents returned by the RAG pipeline",
description="This value controls the number of documents returned by the RAG pipeline or considered for reranking if enabled.",
)
similarity_value: float = Field(
None,
description="If set, any documents retrieved from the RAG must meet a certain match score. Acceptable values are between 0 and 1.",
)
rerank: RerankSettings
class PostgresSettings(BaseModel):