Skip to content

Comments

Fix incorrect formatting in OpenAI responses API for tool#125

Merged
mattt merged 3 commits intomattt:mainfrom
noorbhatia:fix/openai-responses-api
Feb 17, 2026
Merged

Fix incorrect formatting in OpenAI responses API for tool#125
mattt merged 3 commits intomattt:mainfrom
noorbhatia:fix/openai-responses-api

Conversation

@noorbhatia
Copy link
Contributor

Fix #124

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes incorrect OpenAI Responses API request-body formatting for tool-call round trips in OpenAILanguageModel (Fix #124), aligning it with Responses API conventions rather than Chat Completions conventions.

Changes:

  • Formats function_call_output.output as a direct value (plain string for .text, JSON array for .blocks) instead of JSON-stringifying “content blocks”.
  • Flattens image_url in tool output blocks to a string URL (Responses format).
  • Converts Chat Completions-style raw assistant tool_calls messages into Responses function_call input items.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mattt
Copy link
Owner

mattt commented Feb 17, 2026

@noorbhatia Thanks for your work on this. This isn't the first regression we've had with OpenAI request formatting, so I spent some time attempting to contrive a failing test case. Problem is, the API appears to be too flexible in what it expects (or else, I'm not clever enough to find a counter-example). I added what I came up with in c7ee6be. Until we fold in Replay and test the exact shape of request objects, this will have to do, I suppose.

@mattt mattt merged commit 531eb67 into mattt:main Feb 17, 2026
3 checks passed
@mattt
Copy link
Owner

mattt commented Feb 17, 2026

This is now available in 0.7.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect formatting in OpenAI Responses API request body for tool calls

2 participants