Update utils.py
Browse files
utils.py
CHANGED
@@ -385,9 +385,11 @@ def rag_chain(llm, prompt, retriever):
|
|
385 |
|
386 |
neu_prompt=prompt
|
387 |
if (len(filtered_docs)<2): #frage neu formulieren
|
|
|
388 |
neu_prompt = transform_query_direct(prompt)
|
389 |
relevant_docs = retriever.get_relevant_documents(neu_prompt)
|
390 |
-
|
|
|
391 |
|
392 |
if (len(filtered_docs)>0):
|
393 |
llm_chain = LLMChain(llm = llm, prompt = RAG_CHAIN_PROMPT)
|
|
|
385 |
|
386 |
neu_prompt=prompt
|
387 |
if (len(filtered_docs)<2): #frage neu formulieren
|
388 |
+
relevant_docs=[]
|
389 |
neu_prompt = transform_query_direct(prompt)
|
390 |
relevant_docs = retriever.get_relevant_documents(neu_prompt)
|
391 |
+
if (len(relevant_docs)>0):
|
392 |
+
filtered_docs = grade_documents_direct(relevant_docs)
|
393 |
|
394 |
if (len(filtered_docs)>0):
|
395 |
llm_chain = LLMChain(llm = llm, prompt = RAG_CHAIN_PROMPT)
|