When running OpenAI Assistant with tools: AttributeError: 'RequiredActionFunctionToolCall' object has no attribute 'tool' #29224
Labels
🤖:bug
Related to a bug, vulnerability, unexpected error with an existing feature
investigate
Flagged for investigation.
Checked other resources
Example Code
When running an AgentExecutor with an assistant, some some return value is not handled by the agent code.
Here is the code of a Chat agent (runs) and an Assitant:
Error Message and Stack Trace (if applicable)
python assistant_test.py
The Chat output
The gnix is xing!
The assistant output
Traceback (most recent call last):
File "/Users/danielnebenzahl/code/tmp/langchain/assistant_test.py", line 61, in
output = agent_executor.invoke({"content": message})
File "/Users/danielnebenzahl/.pyenv/versions/langchain/lib/python3.10/site-packages/langchain/chains/base.py", line 170, in invoke
raise e
File "/Users/danielnebenzahl/.pyenv/versions/langchain/lib/python3.10/site-packages/langchain/chains/base.py", line 160, in invoke
self._call(inputs, run_manager=run_manager)
File "/Users/danielnebenzahl/.pyenv/versions/langchain/lib/python3.10/site-packages/langchain/agents/agent.py", line 1624, in _call
next_step_output = self._take_next_step(
File "/Users/danielnebenzahl/.pyenv/versions/langchain/lib/python3.10/site-packages/langchain/agents/agent.py", line 1330, in _take_next_step
[
File "/Users/danielnebenzahl/.pyenv/versions/langchain/lib/python3.10/site-packages/langchain/agents/agent.py", line 1330, in
[
File "/Users/danielnebenzahl/.pyenv/versions/langchain/lib/python3.10/site-packages/langchain/agents/agent.py", line 1415, in _iter_next_step
yield self._perform_agent_action(
File "/Users/danielnebenzahl/.pyenv/versions/langchain/lib/python3.10/site-packages/langchain/agents/agent.py", line 1429, in _perform_agent_action
if agent_action.tool in name_to_tool_map:
File "/Users/danielnebenzahl/.pyenv/versions/langchain/lib/python3.10/site-packages/pydantic/main.py", line 891, in getattr
raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}')
AttributeError: 'RequiredActionFunctionToolCall' object has no attribute 'tool'
Description
I expect AgentExecutor to work with assistants that use tools.
System Info
python -m langchain_core.sys_info
System Information
Package Information
Optional packages not installed
Other Dependencies
The text was updated successfully, but these errors were encountered: