When I use the tool in Agent, it returns OPEN AI 400 Bad Request. #20457
Replies: 4 comments 2 replies
-
The error you're encountering, To resolve this issue, ensure that for every Here's a quick example to illustrate how to format a tool call and its response correctly: msgs: List = [
HumanMessage("Example question?"),
AIMessage(
content="",
tool_calls=[
ToolCall(
name="ExampleTool",
args={"key": "value"},
id="unique_id",
)
],
),
ToolMessage("Example response", tool_call_id="unique_id"),
] In this example, a Make sure to implement logic that tracks these IDs and correctly associates responses with their calls, especially if you're dynamically generating tool calls and responses. This should help in resolving the Sources
|
Beta Was this translation helpful? Give feedback.
-
Any update on it? |
Beta Was this translation helpful? Give feedback.
-
any solution??? |
Beta Was this translation helpful? Give feedback.
-
Any update? |
Beta Was this translation helpful? Give feedback.
-
Checked other resources
Commit to Help
Example Code
Description
I want to integrate Google search into my chatbot and use streaming output. It returned the following error:
openai.BadRequestError: Error code: 400
.I searched on both Google and Github but did not find any relevant information.
The complete return information is:
System Info
System Information
Package Information
Beta Was this translation helpful? Give feedback.
All reactions