-
Notifications
You must be signed in to change notification settings - Fork 321
Open
Labels
Description
Describe the bug
When using tool calls with OpenAI the tool call ID is not passed properly in the messages.
Sample error message:
failed to create completion: POST "https://api.openai.com/v1/chat/completions": 400 Bad Request { "error": { "message": "Invalid parameter: messages with role 'tool' must be a response to a preceeding message with 'tool_calls'.", "type": "invalid_request_error", "param": "messages.[5].role", "code": null } }
To Reproduce
Define any tool with Go and attempt to generate using an OpenAI model that supports tool calling. (ie. openai/gpt-4.1
).
Expected behavior
Tool call succeeds.
Runtime (please complete the following information):
- OS: MacOS
** Go version
go1.24.1 darwin/arm64
Additional context
I have a fix. Opening PR.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status