Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -310,18 +310,37 @@ def rag_workflow(query):
|
|
| 310 |
|
| 311 |
doc_references = "\n".join([f"[{i+1}] {ref}" for i, (_, ref) in enumerate(retrieved_doc_chunks)])
|
| 312 |
code_references = "\n".join([f"[{i+1}] {ref}" for i, (_, ref) in enumerate(retrieved_code_chunks)])
|
|
|
|
| 313 |
|
| 314 |
-
print(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 315 |
|
| 316 |
-
|
| 317 |
|
| 318 |
-
prompt = f"""You are an expert python developer.
|
| 319 |
-
|
| 320 |
-
|
|
|
|
|
|
|
| 321 |
|
| 322 |
-
|
| 323 |
{doc_context}
|
| 324 |
|
|
|
|
|
|
|
|
|
|
| 325 |
Query:
|
| 326 |
{query}
|
| 327 |
"""
|
|
|
|
| 310 |
|
| 311 |
doc_references = "\n".join([f"[{i+1}] {ref}" for i, (_, ref) in enumerate(retrieved_doc_chunks)])
|
| 312 |
code_references = "\n".join([f"[{i+1}] {ref}" for i, (_, ref) in enumerate(retrieved_code_chunks)])
|
| 313 |
+
|
| 314 |
|
| 315 |
+
print("Document Chunks:\n")
|
| 316 |
+
print("\n\n".join(["="*80 + "\n" + doc_chunk for doc_chunk, _ in retrieved_doc_chunks]))
|
| 317 |
+
print("\nDocument References:\n")
|
| 318 |
+
print(doc_references)
|
| 319 |
+
|
| 320 |
+
print("\n" + "="*80 + "\n") # Separator between doc and code
|
| 321 |
+
|
| 322 |
+
print("Code Chunks:\n")
|
| 323 |
+
print("\n\n".join(["="*80 + "\n" + code_chunk for code_chunk, _ in retrieved_code_chunks]))
|
| 324 |
+
print("\nCode References:\n")
|
| 325 |
+
print(code_references)
|
| 326 |
+
|
| 327 |
+
|
| 328 |
+
# print(f"Context for the query:\n{doc_context}\n")
|
| 329 |
|
| 330 |
+
# print(f"References for the query:\n{references}\n")
|
| 331 |
|
| 332 |
+
prompt = f"""You are an expert python developer. You are assisting in generating code for users who wants to make use of "kadi-apy", an API library.
|
| 333 |
+
"Doc-context:" provides you with information how to use this API library by givnig code examples and code documentation.
|
| 334 |
+
"Code-context:" provides you information of API methods and classes from the "kadi-apy" library.
|
| 335 |
+
Based on the retrieved contexts answer the query.
|
| 336 |
+
If no related Information is found from the contexts to answer the query, reply that you do not know.
|
| 337 |
|
| 338 |
+
Doc-context:
|
| 339 |
{doc_context}
|
| 340 |
|
| 341 |
+
Code-context:
|
| 342 |
+
{code_context}
|
| 343 |
+
|
| 344 |
Query:
|
| 345 |
{query}
|
| 346 |
"""
|