Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -302,11 +302,17 @@ def query_chroma(vectorstore, query, k):
|
|
| 302 |
return chunks_with_references
|
| 303 |
|
| 304 |
def rag_workflow(query):
|
| 305 |
-
retrieved_doc_chunks = query_chroma(vectorstore, query, k=
|
| 306 |
-
|
| 307 |
-
|
|
|
|
|
|
|
|
|
|
| 308 |
references = "\n".join([f"[{i+1}] {ref}" for i, (_, ref) in enumerate(docs)])
|
| 309 |
-
|
|
|
|
|
|
|
|
|
|
| 310 |
print(f"References for the query:\n{references}\n")
|
| 311 |
|
| 312 |
prompt = f"""You are an expert python developer. Provide a clear and consice answer based only on the information in the retrieved context.
|
|
@@ -314,7 +320,7 @@ def rag_workflow(query):
|
|
| 314 |
If no related Information is found from the context to answer the query, reply that you do not know.
|
| 315 |
|
| 316 |
Context:
|
| 317 |
-
{
|
| 318 |
|
| 319 |
Query:
|
| 320 |
{query}
|
|
|
|
| 302 |
return chunks_with_references
|
| 303 |
|
| 304 |
def rag_workflow(query):
|
| 305 |
+
retrieved_doc_chunks = query_chroma(vectorstore, query, k=5)
|
| 306 |
+
#retrieved_code_chunks = query_chroma(codestore, query, k=5)
|
| 307 |
+
|
| 308 |
+
doc_context = "\n\n".join([doc_chunk for doc_chunk, _ in retrieved_doc_chunks])
|
| 309 |
+
#code_context = "\n\n".join([code_chunk for code_chunk, _ in retrieved_code_chunks])
|
| 310 |
+
|
| 311 |
references = "\n".join([f"[{i+1}] {ref}" for i, (_, ref) in enumerate(docs)])
|
| 312 |
+
|
| 313 |
+
|
| 314 |
+
print(f"Context for the query:\n{doc_context}\n")
|
| 315 |
+
|
| 316 |
print(f"References for the query:\n{references}\n")
|
| 317 |
|
| 318 |
prompt = f"""You are an expert python developer. Provide a clear and consice answer based only on the information in the retrieved context.
|
|
|
|
| 320 |
If no related Information is found from the context to answer the query, reply that you do not know.
|
| 321 |
|
| 322 |
Context:
|
| 323 |
+
{doc_context}
|
| 324 |
|
| 325 |
Query:
|
| 326 |
{query}
|