Update utils.py
Browse files
utils.py
CHANGED
@@ -309,16 +309,7 @@ def rag_chain(llm, prompt, retriever):
|
|
309 |
filtered_docs=[]
|
310 |
relevant_docs = retriever.get_relevant_documents(prompt)
|
311 |
print("releant docs1......................")
|
312 |
-
print(relevant_docs)
|
313 |
if (len(relevant_docs)>0):
|
314 |
-
filtered_docs = grade_documents_direct(prompt, relevant_docs)
|
315 |
-
|
316 |
-
neu_prompt=prompt
|
317 |
-
if (len(filtered_docs)<2): #frage neu formulieren
|
318 |
-
relevant_docs=[]
|
319 |
-
neu_prompt = transform_query_direct(prompt)
|
320 |
-
relevant_docs = retriever.get_relevant_documents(neu_prompt)
|
321 |
-
if (len(relevant_docs)>0):
|
322 |
print("releant docs2......................")
|
323 |
print(relevant_docs)
|
324 |
llm_chain = LLMChain(llm = llm, prompt = RAG_CHAIN_PROMPT)
|
@@ -326,6 +317,7 @@ def rag_chain(llm, prompt, retriever):
|
|
326 |
else:
|
327 |
# keine relevanten Dokumente gefunden
|
328 |
result = "Keine relevanten Dokumente gefunden"
|
|
|
329 |
return result
|
330 |
|
331 |
|
|
|
309 |
filtered_docs=[]
|
310 |
relevant_docs = retriever.get_relevant_documents(prompt)
|
311 |
print("releant docs1......................")
|
|
|
312 |
if (len(relevant_docs)>0):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
313 |
print("releant docs2......................")
|
314 |
print(relevant_docs)
|
315 |
llm_chain = LLMChain(llm = llm, prompt = RAG_CHAIN_PROMPT)
|
|
|
317 |
else:
|
318 |
# keine relevanten Dokumente gefunden
|
319 |
result = "Keine relevanten Dokumente gefunden"
|
320 |
+
|
321 |
return result
|
322 |
|
323 |
|