Repository navigation
Python: Pass extra declarative model options through as regular options - #10005
Open
ni (nniiovoo) wants to merge 2 commits into
Open
ni (nniiovoo) wants to merge 2 commits into
ni (nniiovoo) wants to merge 2 commits into
Conversation
Signed-off-by: NNIIOVO <haimingni44@gmail.com>
ni (nniiovoo)
requested review from
SergeyMenshykh,
Eduard van Valkenburg (eavanvalkenburg) and
Roger Barreto (rogerbarreto)
as code owners
November 3, 2026 03:43
ni (nniiovoo)
temporarily deployed
to
github-app-auth
November 3, 2026 03:43 — with
GitHub Actions
Inactive
ni (nniiovoo)
requested review from
Darren Cohen (dargilco),
Jose Alvarez (jpalvarezl),
sophia-ramsey and
westey (westey-m)
as code owners
November 3, 2026 03:43
ni (nniiovoo)
temporarily deployed
to
github-app-auth
November 3, 2026 03:44 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the change aligning declarative model options with regular option handling.
No open issues 🎉
What changed in this PR
Fixes #10004 by aligning declarative model options with the framework’s regular options handling, preventing extra provider options from causing agent.run() failures with OpenAI clients.
Changes:
- Passes extra model options through as top-level options rather than nesting them under
additional_chat_options. - Gives named fields precedence on conflicts while preserving
chatToolModemapping. - Updates existing assertions and adds mocked-request regression coverage for OpenAI Chat and Responses.
| File | Description |
|---|---|
python/packages/declarative/tests/test_declarative_loader.py |
Verifies flattened options, named-field precedence, and provider request payloads. |
python/packages/declarative/agent_framework_declarative/_loader.py |
Merges extra properties into regular chat options without overriding named fields. |
Review effort: Balanced
…test Signed-off-by: NNIIOVO <haimingni44@gmail.com>
ni (nniiovoo)
temporarily deployed
to
github-app-auth
November 3, 2026 08:25 — with
GitHub Actions
Inactive
This branch was previously deployed
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.
Motivation & Context
Extra provider options under
model.optionsin a declarative agent end up underdefault_options["additional_chat_options"]. Nothing reads that key since #3140, so the OpenAI Chat and Responses clients get it as a kwarg andagent.run()fails with a TypeError. Repro is in #10004.Description & Review Guide
_parse_chat_optionsnow merges the leftoveradditionalPropertiesinto the top-level options instead of nesting them.chatToolModestill maps totool_choiceas before.user: alicereaches the provider the same way asagent.run(..., options={"user": "alice"}). Nothing else in the repo readsadditional_chat_options.Tests: I updated the 2 tests that checked
additional_chat_optionsand added one that runs the agent through the OpenAI Chat and Responses clients with a mocked transport and checks the request body. The new test fails on main and passes here.Related Issue
Fixes #10004
AI Assistance
AI assistance details: issue analysis, implementation, tests, and this description.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.