🔧 fix(base.py): add exception handling when formatting intermediate steps to prevent crashes and log the exception
This commit is contained in:
parent
ba6cf77fe9
commit
6c17949d21
1 changed files with 5 additions and 1 deletions
|
|
@ -39,7 +39,11 @@ async def get_result_and_steps(langchain_object, inputs: Union[dict, str], **kwa
|
|||
if isinstance(output, dict)
|
||||
else output
|
||||
)
|
||||
thought = format_actions(intermediate_steps) if intermediate_steps else ""
|
||||
try:
|
||||
thought = format_actions(intermediate_steps) if intermediate_steps else ""
|
||||
except Exception as exc:
|
||||
logger.exception(exc)
|
||||
thought = ""
|
||||
except Exception as exc:
|
||||
logger.exception(exc)
|
||||
raise ValueError(f"Error: {str(exc)}") from exc
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue