feat: chat to responses convert filds#600
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the Chat Completions → Responses API conversion to cover additional request fields (tools/function-call compatibility, response_format/json_schema, logprobs, parallel tool calls, and multimodal image content), and updates the stream-fake plugin to correctly preserve multiple streamed choices when converting back to a non-streaming Chat Completions response.
Changes:
- Update
stream-fakestreaming aggregation to track per-choice state (bychoice.index) and emit multiple finalchoicesin the non-stream response. - Enhance OpenAI chat→responses request conversion to support legacy
functions/function_call, named tool choices,response_format→text.format, logprobs include flags, and image content parts. - Extend relay model structs to represent the newly supported request/response fields (schema text format and input_image fields, plus
n,modalities,parallel_tool_calls).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| core/relay/plugin/streamfake/fake.go | Track streaming deltas per choice.index and rebuild non-stream responses with multiple choices plus prompt-level filter fields. |
| core/relay/plugin/streamfake/fake_test.go | Add/adjust tests for multi-choice preservation and updated choice-state handling in streamfake. |
| core/relay/model/response.go | Expand Responses API structs (text format schema fields; input_image fields on input content). |
| core/relay/model/completions.go | Add Chat Completions request fields needed for conversion (modalities, n, parallel_tool_calls). |
| core/relay/adaptor/openai/chat.go | Convert more Chat Completions fields into Responses API shape (legacy functions/tool_choice flattening, image parts, response_format, logprobs, parallel tool calls). |
| core/relay/adaptor/openai/chat_test.go | Add coverage for new conversions (named tool choice, legacy functions, images, response_format flattening, logprobs include, parallel_tool_calls, and n handling). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.