Skip to content

Auto-route /chat/completions to /responses for unsupported chat completion features#233

Merged
Erin McNulty (erin2722) merged 3 commits into
mainfrom
chat-completions-to-responses-upgrade
May 11, 2026
Merged

Auto-route /chat/completions to /responses for unsupported chat completion features#233
Erin McNulty (erin2722) merged 3 commits into
mainfrom
chat-completions-to-responses-upgrade

Conversation

@erin2722
Copy link
Copy Markdown
Contributor

This fix addresses an issue where the /chat/completions endpoint doesn't support reasoning with tool calls, as part of OpenAI's push to get every to migrate to the /responses endpoint. Lingua was passing these requests straight through to the configured /chat/completions endpoint and we were encountering a failure because of this.

Like we were chatting about in standup last week, there are 2 potential resolutions to this:

  • Fix the UI to let people delete the reasoning fields, and then return a clearer error message explaining to unset the reasoning field here
  • Automatically forward these requests to /responses based on additional specific format detection logic in the router.

I've gone with the second option here-- from my reading, I'd expect us to run into this flavor of problem again as openai pushes everyone to responses. Its not too janky :), and I think will come in handy in the future too.

Some(openai::OutputItemType::Message) => {
// Extract text content from message output items
// Extract text content from message output items.
// `phase` is a message-level field (not content-level); it is stored in
Copy link
Copy Markdown
Contributor Author

@erin2722 Erin McNulty (erin2722) May 11, 2026

Choose a reason for hiding this comment

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

This was a bit of a seperate change that I found because of the additional payload tests. We were stripping the phase parameter from messages when going through the universal format, and while this doesn't cause an error, it can negatively impact the chat responses-- https://developers.openai.com/api/docs/guides/reasoning#phase-parameter

These changes stick it in provider_options for the universal round trip

@erin2722 Erin McNulty (erin2722) merged commit e26b151 into main May 11, 2026
7 checks passed
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.

2 participants