Spaces:
Sleeping
Sleeping
Zeggai Abdellah commited on
Commit ·
11ba922
1
Parent(s): c0e5c04
add cach message for max iterations
Browse files- rag_pipeline.py +4 -1
rag_pipeline.py
CHANGED
|
@@ -322,7 +322,10 @@ def process_question_with_sequential_citations(agent, question: str, chunks_dire
|
|
| 322 |
# Get the response from the agent
|
| 323 |
response = agent.chat(question)
|
| 324 |
response_text = response.response
|
| 325 |
-
|
|
|
|
|
|
|
|
|
|
| 326 |
# Extract source IDs from the response (preserving order)
|
| 327 |
unique_ids = extract_source_ids(response_text)
|
| 328 |
|
|
|
|
| 322 |
# Get the response from the agent
|
| 323 |
response = agent.chat(question)
|
| 324 |
response_text = response.response
|
| 325 |
+
# Check if the response indicates max iterations was reached
|
| 326 |
+
if "max iterations" in response_text.lower() or len(response_text.strip()) == 0:
|
| 327 |
+
# Provide a more helpful fallback response
|
| 328 |
+
response_text = ("I apologize, but I encountered difficulties processing your comparative question ")
|
| 329 |
# Extract source IDs from the response (preserving order)
|
| 330 |
unique_ids = extract_source_ids(response_text)
|
| 331 |
|