bupa1018 commited on
Commit
9575a3a
·
1 Parent(s): 2f8bffe

Update ragchain.py

Browse files
Files changed (1) hide show
  1. ragchain.py +3 -5
ragchain.py CHANGED
@@ -63,14 +63,12 @@ class RAGChain:
63
  )
64
  return self.llm.predict(prompt)
65
 
66
- def retrieve_contexts(self, query, library_usage_prediction):
67
  """
68
  Retrieve relevant documents and source code based on the query and library usage prediction.
69
  """
70
- doc_contexts = self.vector_store.similarity_search(query, k=5, filter={"usage": "doc"})
71
- code_contexts = self.vector_store.similarity_search(query, k=5, filter={"usage": library_usage_prediction})
72
-
73
- return doc_contexts, code_contexts
74
 
75
  def format_documents(self, documents):
76
  formatted_docs = []
 
63
  )
64
  return self.llm.predict(prompt)
65
 
66
+ def retrieve_contexts(self, query, k, filter = None):
67
  """
68
  Retrieve relevant documents and source code based on the query and library usage prediction.
69
  """
70
+ context = self.vector_store.similarity_search(query = query, k=k, filter=filter)
71
+ return context
 
 
72
 
73
  def format_documents(self, documents):
74
  formatted_docs = []