Repository navigation
Add explicit Python Responses API support - #523
Merged
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the addition of explicitly selected Python Responses API support.
No open issues 🎉
What changed in this PR
Adds explicitly selected Python Responses API support alongside the existing Chat Completions integration, addressing #518 while preserving default behavior. Automatic Responses-to-Chat fallback remains deferred.
Changes:
- Adds keyword-only Responses selection to all four model factories and exports a dependency-free
ResponsesClientprotocol. - Shares canonical output validation across HTTP and configured-client paths while retaining transport safeguards, client ownership, and translator validation/repair.
- Adds deterministic regression coverage, API documentation, and a minimal HTTP/client example.
| File | Description |
|---|---|
site/src/docs/python/basic-usage.md |
Documents selection, endpoints, client ownership, output validation, and limits. |
python/tests/test_responses_model.py |
Covers Responses requests, parsing, failures, compatibility, safeguards, and repair. |
python/src/typechat/_internal/model.py |
Implements explicit Responses mode, client adaptation, and shared parsing. |
python/src/typechat/__init__.py |
Exports the structural ResponsesClient protocol. |
python/README.md |
Introduces Responses support and links to usage guidance. |
python/examples/responses/demo.py |
Adds a sentiment example for HTTP and application-owned clients. |
python/examples/README.md |
Lists the example and documents OpenAI/Azure configuration. |
Review effort: Balanced
Tal Zaccai (TalZaccai)
approved these changes
Nov 6, 2026
Integrate merged PR #524 with the explicit Responses API work. Preserve shared prompt validation, image references, repair context, and Chat Completions temperature settings. Map Responses assistant text to output_text, with deterministic and live regression verification. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Tal Zaccai (TalZaccai)
approved these changes
Nov 6, 2026
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.
Summary
Add backward-compatible, explicitly selected Python Responses API support through the built-in HTTP factories and application-owned asynchronous clients.
use_responses_api=Trueselection across all four model factories, complete HTTP destination validation, and explicit model/deployment pass-through.ResponsesClientprotocol without adding SDK dependencies; keep Chat-only clients and existing Chat Completions defaults usable unchanged.Relates to #518. Builds on the merged authentication/client work in #516, with #305 and #519 as TypeScript prior art.
Owner-directed scope
The owner chose to deliver explicit Responses support now and defer automatic Responses-to-Chat fallback. This PR adds no fallback flag, capability inference, endpoint rewriting, or failover requests. It does not claim to satisfy the original P4 fallback discovery/evidence criteria or rewrite the existing acceptance record.
Integration with merged #524
Merged approved
mainatc2215edinto this branch, preserving both histories, in commit38a9aa5.input_text, assistant text tooutput_text, and image references to flatinput_imageparts. Exact references, optional detail, ordering, and caller-owned data are preserved.0.0by default,Noneto omit). Responses continues omitting temperature regardless of that option; no new provider-specific options or SDK dependencies are added.Verification of the integrated revision
git diff --check: passed.{"color":"red"}from a synthetic 32x32 PNG supplied as data URLs. Covered mixed text/image ordering, omitted and high image detail, tagged system/assistant text, prompt immutability, and client ownership/cleanup.output_text, notinput_text. The correction is now covered by explicit role-specific offline regressions. Integration testing used five dispatches total: three rejected diagnostic requests and two successful final requests. Retries and translator repair were disabled, with a 120-second timeout.Initial verification (before integrating #524)
git diff --checkpassed.{"ok": true}.{"ok": true}; caller-owned client remained open.Live verification used synthetic input only. No credentials, identity/account details, or private resource addresses are included in this PR.