Patrick Walukagga commited on
Commit
8b6877e
1 Parent(s): f15a2a3

Correct documents returned

Browse files
Files changed (1) hide show
  1. rag/rag_pipeline.py +5 -1
rag/rag_pipeline.py CHANGED
@@ -172,9 +172,13 @@ class RAGPipeline:
172
  self.extract_page_number_from_query(context) if self.is_pdf else None
173
  )
174
 
 
 
 
 
175
  query_engine = self.index.as_query_engine(
176
  text_qa_template=prompt_template,
177
- similarity_top_k=5,
178
  response_mode="tree_summarize",
179
  llm=OpenAI(model="gpt-4o-mini"),
180
  )
 
172
  self.extract_page_number_from_query(context) if self.is_pdf else None
173
  )
174
 
175
+
176
+ # This is a hack to index all the documents in the store :)
177
+ n_documents = len(self.index.docstore.docs)
178
+ print(f"n_documents: {n_documents}")
179
  query_engine = self.index.as_query_engine(
180
  text_qa_template=prompt_template,
181
+ similarity_top_k=n_documents if n_documents <= 17 else 15,
182
  response_mode="tree_summarize",
183
  llm=OpenAI(model="gpt-4o-mini"),
184
  )