MAINT: Consolidate OpenAI response handling - #2381
Merged
Roman Lutz (romanlutz) merged 4 commits intoAug 14, 2026
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
|
should we also include OpenAI video ? |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7b3a8d42-bfe2-4b5e-90ae-fc211028c2ad
Contributor
Author
|
On including OpenAI video: I kept it out of this consolidation because video uses a distinct asynchronous job/status response model, while this PR is specifically aligning Chat Completions, Completions, and Responses text formats. Video currently only shares the base request wrapper and has its own content-filter/status construction semantics; forcing it into this adapter set would broaden the PR without meaningful shared validation, truncation, partial-content, or metadata behavior. The concrete base adapter still lets video retain its existing protected hook behavior, and the video target tests pass unchanged. |
hannahwestra25
approved these changes
Aug 14, 2026
hannahwestra25
left a comment
Contributor
There was a problem hiding this comment.
small nit related to docstring :)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7b3a8d42-bfe2-4b5e-90ae-fc211028c2ad
Roman Lutz (romanlutz)
enabled auto-merge
August 14, 2026 22:53
Roman Lutz (romanlutz)
deleted the
romanlutz-consolidate-openai-responses
branch
August 14, 2026 23:26
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.
Description
OpenAI Chat Completions, Completions, and Responses targets previously implemented response validation, filtering, truncation detection, partial-content extraction, and metadata capture across multiple target classes. This made behavior harder to compare and maintain as the API formats evolved.
This change introduces a small typed response-adapter seam with dedicated adapters for each wire format and a no-op default for other OpenAI targets. Existing protected target hooks remain compatibility delegates, including subclass truncation overrides. The consolidation preserves each format's existing behavior, including legacy Completions semantics, content-filter handling, partial output, stop reasons, token usage, and graceful truncated responses.
Tests and Documentation
git diff --check.