@@ -451,24 +451,36 @@ def _get_stream():
451451
452452 except GraphRecursionError as e :
453453 # TODO handle recursion limit error
454- logger .exception (f"[LANGGRAPH] Recursion Limit reached: { e } " )
455- response = session_state ["_" ](
456- "I'm sorry, but I couldn't find enough information to fully answer your question. Could you please try rephrasing your query and ask again?"
454+ logger .warning (
455+ f"[NOT-ANSWERED] Recursion Limit reached. Query: { user_input } . Sources used. Documents: { graph ._visited_docs ()} , Urls: { graph ._visited_links } "
456+ )
457+ response = (
458+ session_state ["_" ](
459+ "I'm sorry, but I couldn't find enough information to fully answer your question. Could you please try rephrasing your query and ask again?"
460+ )
461+ + f"\n \n { further_help_msg } "
457462 )
458- st . markdown ( f" { response } \n \n { further_help_msg } " )
463+
459464 # clear the docs references
465+ st .markdown (response )
460466 graph ._visited_docs .clear ()
461467
462468 except ProgrammableSearchException as e :
463- response = session_state ["_" ](
464- "I'm sorry, something went wrong while connecting to the data provided. If the error persists, please reach out to the administrators for assistance."
469+ response = (
470+ session_state ["_" ](
471+ "I'm sorry, something went wrong while connecting to the data provided. If the error persists, please reach out to the administrators for assistance."
472+ )
473+ + f"\n { further_help_msg } "
465474 )
466- st .markdown (f"{ response } \n { further_help_msg } " )
475+
476+ st .markdown (response )
467477 # clear the docs references
468478 graph ._visited_docs .clear ()
469479
470480 except Exception as e :
471- logger .exception (f"Error while processing the user's query: { e } " )
481+ logger .exception (
482+ f"[STREAMLIT] Error while processing the user's query: { e } "
483+ )
472484 response = session_state ["_" ](
473485 "I'm sorry, but I am unable to process your request right now. Please try again later or consider rephrasing your question."
474486 )
@@ -484,7 +496,15 @@ def _get_stream():
484496 start_time = time .time ()
485497 settings .time_request_sent = start_time
486498
487- response , to_stream = stream_graph_updates (prompt )
499+ try :
500+ response , to_stream = stream_graph_updates (prompt )
501+ except Exception as e :
502+ logger .error (f"[STREAMLIT] Error in streaming graph updates: { e } " )
503+ response = session_state ["_" ](
504+ "I'm sorry, but I am unable to process your request right now. Please try again later or consider rephrasing your question."
505+ )
506+ to_stream = ""
507+ st .markdown (response )
488508 # if there is content left, stream it
489509 if to_stream :
490510 st .markdown (to_stream )
0 commit comments