feat(rag): expose similarity_top_k and similarity_score to settings (#1771)

* Added RAG settings to settings.py, vector_store and chat_service to add similarity_top_k and similarity_score

* Updated settings in vector and chat service per Ivans request

* Updated code for mypy
This commit is contained in:
icsy7867 2024-03-20 17:25:26 -04:00 committed by GitHub
parent 774e256052
commit 087cb0b7b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 33 additions and 1 deletions

View file

@ -284,6 +284,17 @@ class UISettings(BaseModel):
)
class RagSettings(BaseModel):
similarity_top_k: int = Field(
2,
description="This value controls the number of documents returned by the RAG pipeline",
)
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.",
)
class PostgresSettings(BaseModel):
host: str = Field(
"localhost",
@ -379,6 +390,7 @@ class Settings(BaseModel):
azopenai: AzureOpenAISettings
vectorstore: VectorstoreSettings
nodestore: NodeStoreSettings
rag: RagSettings
qdrant: QdrantSettings | None = None
postgres: PostgresSettings | None = None