-
Notifications
You must be signed in to change notification settings - Fork 207
Closed
Description
If you generate an agent and dont give it any tools, it fails with result
Error code: 400 - {'error': {'message': "Invalid 'tools': empty array. Expected an array with minimum length 1, but got an empty array instead.", 'type': 'invalid_request_error', 'param': 'tools', 'code': 'empty_array'}}
This is because we are passing an empty array into the node
@agentstack.agent
def translator(self, state: State):
agent_config = agentstack.get_agent('translator')
messages = ChatPromptTemplate.from_messages([
("user", agent_config.prompt),
])
messages = messages.format_messages(**state['inputs'])
agent = ChatOpenAI(model=agent_config.model)
agent = agent.bind_tools([]) # <---------------------------
response = agent.invoke(
messages + state['messages'],
)
return {'messages': [response, ]}
We should comment this line out when no tools are present and uncomment when a tool is added
✅ At the moment you can solve this by commenting out or removing the
.bind_tools()line
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels