Spaces:
Runtime error
Runtime error
Update ragchain.py
Browse files- 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,
|
| 67 |
"""
|
| 68 |
Retrieve relevant documents and source code based on the query and library usage prediction.
|
| 69 |
"""
|
| 70 |
-
|
| 71 |
-
|
| 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 = []
|