Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -340,8 +340,8 @@ def rag_workflow(query):
|
|
340 |
rewritten_query_response = llm.invoke(rewrite_prompt)
|
341 |
rewritten_query = rewritten_query_response.content.strip()
|
342 |
|
343 |
-
print("
|
344 |
-
print(rewritten_query)
|
345 |
|
346 |
kadi_apy_docs = vector_store.similarity_search(query, k=5, filter={"usage": "doc"})
|
347 |
kadi_apy_sourcecode = vector_store.similarity_search(query, k=5, filter={"usage": library_usage_prediction})
|
@@ -352,11 +352,16 @@ def rag_workflow(query):
|
|
352 |
|
353 |
print("H")
|
354 |
print("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
print("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
|
359 |
|
|
|
|
|
|
|
|
|
|
|
360 |
|
361 |
|
362 |
|
@@ -421,8 +426,6 @@ def initialize():
|
|
421 |
print(f"Total number of code_chunks: {len(code_chunks)}")
|
422 |
print(f"Total number of doc_chunks: {len(doc_chunks)}")
|
423 |
|
424 |
-
#docstore = embed_documents_into_vectorstore(kadiAPY_code_chunks, EMBEDDING_MODEL_NAME, PERSIST_DOC_DIRECTORY)
|
425 |
-
#codestore = embed_documents_into_vectorstore(kadiAPY_doc_chunks, EMBEDDING_MODEL_NAME, PERSIST_CODE_DIRECTORY)
|
426 |
filename = "test"
|
427 |
vector_store = embed_documents_into_vectorstore(doc_chunks + code_chunks, EMBEDDING_MODEL_NAME, f"{DATA_DIR}/{filename}")
|
428 |
llm = setup_llm(LLM_MODEL_NAME, LLM_TEMPERATURE, GROQ_API_KEY)
|
|
|
340 |
rewritten_query_response = llm.invoke(rewrite_prompt)
|
341 |
rewritten_query = rewritten_query_response.content.strip()
|
342 |
|
343 |
+
print("Predicted library to search in", library_usage_prediction)
|
344 |
+
print("Rewritten query:", rewritten_query)
|
345 |
|
346 |
kadi_apy_docs = vector_store.similarity_search(query, k=5, filter={"usage": "doc"})
|
347 |
kadi_apy_sourcecode = vector_store.similarity_search(query, k=5, filter={"usage": library_usage_prediction})
|
|
|
352 |
|
353 |
print("H")
|
354 |
print("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
|
355 |
+
for doc in kadi_apy_sourcecode:
|
356 |
+
print(doc.metadata.get("source", "Unknown Type"))
|
357 |
+
print("\n")
|
358 |
print("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
|
359 |
|
360 |
+
print("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
|
361 |
+
for doc in kadi_apy_docs:
|
362 |
+
print(doc.metadata.get("source", "Unknown Type"))
|
363 |
+
print("\n")
|
364 |
+
print("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
|
365 |
|
366 |
|
367 |
|
|
|
426 |
print(f"Total number of code_chunks: {len(code_chunks)}")
|
427 |
print(f"Total number of doc_chunks: {len(doc_chunks)}")
|
428 |
|
|
|
|
|
429 |
filename = "test"
|
430 |
vector_store = embed_documents_into_vectorstore(doc_chunks + code_chunks, EMBEDDING_MODEL_NAME, f"{DATA_DIR}/{filename}")
|
431 |
llm = setup_llm(LLM_MODEL_NAME, LLM_TEMPERATURE, GROQ_API_KEY)
|