bupa1018 commited on
Commit
d7cd739
·
1 Parent(s): f458872

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
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=10)
306
- docs = query_chroma(vectorstore, query, k=10)
307
- context = "\n\n".join([doc_chunk for doc_chunk, _ in retrieved_doc_chunks])
 
 
 
308
  references = "\n".join([f"[{i+1}] {ref}" for i, (_, ref) in enumerate(docs)])
309
- print(f"Context for the query:\n{context}\n")
 
 
 
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
- {context}
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}