🐛 fix(custom.py): add handle_parsing_errors=True to VectorStoreAgent, SQLAgent, and VectorStoreRouterAgent classes to handle parsing errors during execution
🐛 fix(loading.py): add handle_parsing_errors=True to instantiate_agent and load_agent_executor functions to handle parsing errors during agent instantiation and loading
This commit is contained in:
parent
3de654c8df
commit
77ba780d0e
2 changed files with 6 additions and 4 deletions
|
|
@ -157,7 +157,7 @@ class VectorStoreAgent(CustomAgentExecutor):
|
|||
llm_chain=llm_chain, allowed_tools=tool_names, **kwargs # type: ignore
|
||||
)
|
||||
return AgentExecutor.from_agent_and_tools(
|
||||
agent=agent, tools=tools, verbose=True
|
||||
agent=agent, tools=tools, verbose=True, handle_parsing_errors=True
|
||||
)
|
||||
|
||||
def run(self, *args, **kwargs):
|
||||
|
|
@ -232,6 +232,7 @@ class SQLAgent(CustomAgentExecutor):
|
|||
verbose=True,
|
||||
max_iterations=15,
|
||||
early_stopping_method="force",
|
||||
handle_parsing_errors=True,
|
||||
)
|
||||
|
||||
def run(self, *args, **kwargs):
|
||||
|
|
@ -276,7 +277,7 @@ class VectorStoreRouterAgent(CustomAgentExecutor):
|
|||
llm_chain=llm_chain, allowed_tools=tool_names, **kwargs # type: ignore
|
||||
)
|
||||
return AgentExecutor.from_agent_and_tools(
|
||||
agent=agent, tools=tools, verbose=True
|
||||
agent=agent, tools=tools, verbose=True, handle_parsing_errors=True
|
||||
)
|
||||
|
||||
def run(self, *args, **kwargs):
|
||||
|
|
@ -308,6 +309,7 @@ class InitializeAgent(CustomAgentExecutor):
|
|||
agent=agent, # type: ignore
|
||||
memory=memory,
|
||||
return_intermediate_steps=True,
|
||||
handle_parsing_errors=True,
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
|
|||
|
|
@ -193,8 +193,7 @@ def instantiate_agent(node_type, class_object: Type[agent_module.Agent], params:
|
|||
agent = class_method(**params)
|
||||
tools = params.get("tools", [])
|
||||
return AgentExecutor.from_agent_and_tools(
|
||||
agent=agent,
|
||||
tools=tools,
|
||||
agent=agent, tools=tools, handle_parsing_errors=True
|
||||
)
|
||||
return load_agent_executor(class_object, params)
|
||||
|
||||
|
|
@ -432,6 +431,7 @@ def load_agent_executor(agent_class: type[agent_module.Agent], params, **kwargs)
|
|||
return AgentExecutor.from_agent_and_tools(
|
||||
agent=agent,
|
||||
tools=allowed_tools,
|
||||
handle_parsing_errors=True,
|
||||
# memory=memory,
|
||||
**kwargs,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue