Update app.py
Browse files
app.py
CHANGED
@@ -258,7 +258,7 @@ def setup_llm(model_name, temperature, api_key):
|
|
258 |
|
259 |
|
260 |
|
261 |
-
def retrieve_from_vectorstore(vectorstore =
|
262 |
return vectorstore.similarity_search(query, k=k, filter=filter)
|
263 |
|
264 |
def format_kadi_apy_library_context(docs):
|
@@ -306,7 +306,7 @@ def rag_workflow(query):
|
|
306 |
Respond with only the exact corresponding option and do not include any additional comments, explanations, or text."
|
307 |
"""
|
308 |
)
|
309 |
-
|
310 |
|
311 |
print("METADATA PREDICTION -------------------------:", metadata_prediction)
|
312 |
print(metadata_prediction)
|
@@ -348,18 +348,8 @@ def rag_workflow(query):
|
|
348 |
print("A", metadata_prediction)
|
349 |
print(rewritten_query)
|
350 |
|
351 |
-
|
352 |
-
kadi_apy_docs =
|
353 |
-
query,
|
354 |
-
k=4,
|
355 |
-
filter={"usage": "doc"}
|
356 |
-
)
|
357 |
-
|
358 |
-
kadi_apy_sourcecode = retrieve_from_vectorstore(
|
359 |
-
query,
|
360 |
-
k=6,
|
361 |
-
filter={"usage": metadata_prediction}
|
362 |
-
)
|
363 |
|
364 |
doc_context = format_kadi_api_doc_context(kadi_apy_docs)
|
365 |
code_context = format_kadi_apy_library_context(kadi_apy_sourcecode)
|
|
|
258 |
|
259 |
|
260 |
|
261 |
+
def retrieve_from_vectorstore(vectorstore = vectorstore, query = query, k = k, filter=None):
|
262 |
return vectorstore.similarity_search(query, k=k, filter=filter)
|
263 |
|
264 |
def format_kadi_apy_library_context(docs):
|
|
|
306 |
Respond with only the exact corresponding option and do not include any additional comments, explanations, or text."
|
307 |
"""
|
308 |
)
|
309 |
+
library_usage_prediction = llm.predict(prompt)
|
310 |
|
311 |
print("METADATA PREDICTION -------------------------:", metadata_prediction)
|
312 |
print(metadata_prediction)
|
|
|
348 |
print("A", metadata_prediction)
|
349 |
print(rewritten_query)
|
350 |
|
351 |
+
kadi_apy_docs = vector_store.similarity_search(query, k=5, filter={"usage": "doc"})
|
352 |
+
kadi_apy_docs = vector_store.similarity_search(query, k=5, filter={"usage": library_usage_prediction})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
|
354 |
doc_context = format_kadi_api_doc_context(kadi_apy_docs)
|
355 |
code_context = format_kadi_apy_library_context(kadi_apy_sourcecode)
|