Skip to content

feat(api): accept typed references in Realtime response inputs - #4189

Merged
markstuart-oai merged 1 commit into
mainfrom
castiron/promotions/pr-349
Oct 27, 2026
Merged

markstuart-oai merged 1 commit into
mainfrom
castiron/promotions/pr-349

Conversation

@markstuart-oai

@markstuart-oai markstuart-oai commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Pass existing Realtime item IDs as typed response input, alone or mixed with messages. Existing response parameter and model types keep their input fields, including reads and list mutations.

Changes

  • Accept existing items, item references, and mixed input in response.create and raw response.create events.
  • Keep references out of typed conversation item creation.
  • Add RealtimeResponseCreateParamsWithReferencesParam and ResponseCreateEventWithReferencesParam for requests that use references.

Typed subclass migration

If you override a sync or async Realtime connection or manager's send method, widen its event annotation to also accept ResponseCreateEventWithReferencesParam. Keep its existing RealtimeClientEvent and RealtimeClientEventParam cases.

If you override a Realtime response.create method, also accept RealtimeResponseCreateParamsWithReferencesParam for response. Keep the existing parameter type and omit default. Handle or forward the added inputs in each override. Existing callers do not need this migration.

This static typing change follows the SDK's minor-release versioning policy.

Validation

Compatibility controls passed for existing reads, mutations, parameter and event types, new references and mixed inputs. Three typing files produced exactly 14 intended rejections; strict model validation passed 30/30, and local WebSocket controls passed 74/74. All six subclass overrides passed strict Pyright after the documented annotation update. The local controls did not use a live server.

Earlier validation passed 173 query, upload, and Chat Completions parsing and streaming tests; this fix does not change those REST paths.

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Castiron custom code

Evaluated main: a3f430241c4a2e3e25bf79cc7d0148e51795a292.

Trusted main policy: a3f430241c4a2e3e25bf79cc7d0148e51795a292.

✅ No new custom-code files detected.

0 mixed files remain; 0 existing customizations changed.

Compared a3f430241c4a → 39ce401fed96. Generated baselines verified.

A changed generated baseline means this report cannot reliably identify which handwritten lines changed.

Inspect the custom-code diff

Download the exact patch produced by this run (requires repository access):

gh run download 40442437522 --repo openai/openai-python \
  --name castiron-custom-code-40442437522-1 --dir /tmp/castiron-custom-code-40442437522-1
git apply --stat /tmp/castiron-custom-code-40442437522-1/custom-code.patch
cat /tmp/castiron-custom-code-40442437522-1/custom-code.patch

Or reproduce it from an SDK checkout containing the vendored reporter:

git fetch --no-tags origin a3f430241c4a2e3e25bf79cc7d0148e51795a292 39ce401fed964166a9ab5b0fb9505c5a2a5ec125
python3 scripts/castiron/custom_code_report.py report \
  --base a3f430241c4a2e3e25bf79cc7d0148e51795a292 \
  --head 39ce401fed964166a9ab5b0fb9505c5a2a5ec125 --target-branch main --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-39ce401fed96
cat /tmp/castiron-custom-code-39ce401fed96/custom-code.patch

This is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR.

Full report and patch

@markstuart-oai
markstuart-oai marked this pull request as ready for review October 27, 2026 03:05
@markstuart-oai
markstuart-oai requested a review from a team as a code owner October 27, 2026 03:05
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T20:04:56.473145Z 33ab924 Draft marked ready
🔒 Security Review ✅ Completed 2026-10-27T20:05:37.494344Z 33ab924 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 39ce401fed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread api_reference/openapi.transformed.yml
@markstuart-oai

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 39ce401fed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 39ce401fed

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@markstuart-oai
markstuart-oai marked this pull request as draft October 27, 2026 16:59
Comment thread src/openai/types/realtime/realtime_response_create_params.py Outdated
Castiron-Internal-PR: openai/openai-python-internal#349
Castiron-Source-SHA: 35d1417de7d2de0a22bd04c6226c703ca62e9f4e
Castiron-Public-Base-SHA: 1b37b9a
@markstuart-oai
markstuart-oai force-pushed the castiron/promotions/pr-349 branch from 39ce401 to 33ab924 Compare October 27, 2026 20:01
@markstuart-oai
markstuart-oai marked this pull request as ready for review October 27, 2026 20:03

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved after full static review and an independent second review. No actionable findings. The prior mutation-compatibility issue is fixed: original model, parameter and event input types are preserved, with separate reference-capable request types accepted consistently by all four send paths and both response helpers. Conversation-item creation remains narrow. The complete repository contents match the reviewed internal candidate. The PR documents the subclass annotation migration and minor-release requirement.

Hosted Python 3.10 and OkTest are still running; other reported checks passed or skipped. No candidate code or tests were run locally.

@markstuart-oai
markstuart-oai added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit 8ecb487 Oct 27, 2026
26 checks passed
@markstuart-oai
markstuart-oai deleted the castiron/promotions/pr-349 branch October 27, 2026 20:39
@openai-sdks openai-sdks Bot mentioned this pull request Oct 27, 2026
gh-actions-shared Bot pushed a commit to xf-qubit/openai-python that referenced this pull request Oct 28, 2026
Automated Release PR
---


##
[3.41.0](openai/openai-python@v3.40.0...v3.41.0)
(2026-10-28)


### Features

* **api:** accept typed references in Realtime response inputs
([openai#4189](openai#4189))
([8ecb487](openai@8ecb487))
* **api:** add response tool usage models
([openai#4201](openai#4201))
([55fc500](openai@55fc500))
* **api:** filter agent sessions by metadata
([openai#4200](openai#4200))
([77fd116](openai@77fd116))
* **websocket:** recover queued binary frames after reconnect
([openai#4191](openai#4191))
([f079868](openai@f079868))


### Bug Fixes

* **examples:** detect incomplete WebSocket responses
([openai#4187](openai#4187))
([8559299](openai@8559299))
* **examples:** handle interruptions and disconnects in push-to-talk
([openai#4192](openai#4192))
([35fc9f3](openai@35fc9f3))
* keep consumer fixtures clean under strict Pyright
([openai#4204](openai#4204))
([5012565](openai@5012565))


### Chores

* **api:** document upcoming model shutdowns
([openai#4199](openai#4199))
([5b43cce](openai@5b43cce))
* **api:** update image-model documentation
([openai#4198](openai#4198))
([fa67521](openai@fa67521))
* enforce generated-file ownership
([openai#4193](openai#4193))
([1b37b9a](openai@1b37b9a))
* migrate development type checking to ty
([openai#4202](openai#4202))
([45b9531](openai@45b9531))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: openai-sdks[bot] <284451331+openai-sdks[bot]@users.noreply.github.com>
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.

3 participants