Added second variable for the rag

This commit is contained in:
Wesley Stewart 2024-03-15 19:21:39 +00:00
parent f945d18a6f
commit e65d47fad5
2 changed files with 6 additions and 2 deletions

View File

@ -130,12 +130,12 @@ class VectorStoreComponent:
self, self,
index: VectorStoreIndex, index: VectorStoreIndex,
context_filter: ContextFilter | None = None, context_filter: ContextFilter | None = None,
similarity_top_k: int = 2, sim_top_k = settings.rag.similarity_top_k,
) -> VectorIndexRetriever: ) -> VectorIndexRetriever:
# This way we support qdrant (using doc_ids) and the rest (using filters) # This way we support qdrant (using doc_ids) and the rest (using filters)
return VectorIndexRetriever( return VectorIndexRetriever(
index=index, index=index,
similarity_top_k=similarity_top_k, similarity_top_k=sim_top_k,
doc_ids=context_filter.docs_ids if context_filter else None, doc_ids=context_filter.docs_ids if context_filter else None,
filters=( filters=(
_doc_id_metadata_filter(context_filter) _doc_id_metadata_filter(context_filter)

View File

@ -108,6 +108,10 @@ class RagSettings(BaseModel):
None, None,
description="If set, any documents retrieved from the RAG must meet a certain score. Acceptable values are between 0 and 1.", description="If set, any documents retrieved from the RAG must meet a certain score. Acceptable values are between 0 and 1.",
) )
similarity_top_k: int = Field(
2,
description="An integer that specifies the number of documents to use when searching the RAG database",
)
class VectorstoreSettings(BaseModel): class VectorstoreSettings(BaseModel):