Spaces:
Sleeping
Sleeping
Added retrieval timings logs
Browse files
rag.py
CHANGED
@@ -85,9 +85,16 @@ class RAG:
|
|
85 |
"""Retrieve the most relevant contexts for a given instruction."""
|
86 |
|
87 |
logging.info("RETRIEVE DOCUMENTS")
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
89 |
logging.info(f"Documents retrieved: {len(documents_retrieved)}")
|
90 |
|
|
|
|
|
91 |
if self.rerank_model:
|
92 |
logging.info("RERANK DOCUMENTS")
|
93 |
documents_reranked = self.rerank_contexts(instruction, documents_retrieved, number_of_contexts=number_of_contexts)
|
|
|
85 |
"""Retrieve the most relevant contexts for a given instruction."""
|
86 |
|
87 |
logging.info("RETRIEVE DOCUMENTS")
|
88 |
+
logging.info(f"Instruction: {instruction}")
|
89 |
+
embedding = self.vectore_store._embed_query(instruction)
|
90 |
+
logging.info(f"Query embedding generated: {len(embedding)}")
|
91 |
+
documents_retrieved = self.vectore_store.similarity_search_with_score_by_vector(
|
92 |
+
embedding,
|
93 |
+
k=self.rerank_number_contexts)
|
94 |
logging.info(f"Documents retrieved: {len(documents_retrieved)}")
|
95 |
|
96 |
+
# documents_retrieved = self.vectore_store.similarity_search_with_score(instruction, k=self.rerank_number_contexts)
|
97 |
+
|
98 |
if self.rerank_model:
|
99 |
logging.info("RERANK DOCUMENTS")
|
100 |
documents_reranked = self.rerank_contexts(instruction, documents_retrieved, number_of_contexts=number_of_contexts)
|