Repository navigation
fix(gateway): serialize tool choice modes as objects - #364
Merged
anbuzin merged 2 commits intoNov 17, 2026
Merged
Conversation
|
Someone is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
Keep the 16 cases. Drop the checks that other tests in this file already cover.
franklbh
force-pushed
the
codex/gateway-tool-choice-clean
branch
from
November 17, 2026 17:59
03a9ab7 to
b77ff4e
Compare
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.
Gateway requests currently serialize
ToolChoiceMode.AUTO,NONE, andREQUIREDas strings, for example"toolChoice": "auto". Both V3 and V4 require an object such as"toolChoice": {"type": "auto"}. This corrects the shared serializer for direct modes andToolSelectionmodes, preserving named-tool requests, omitted settings, and existingactiveToolsoutput.Adds 16 parametrized cases to the existing Gateway stream tests. They exercise the real
ai.streamrequest path with a mocked HTTP transport and synthetic tools, covering both protocols, all three modes, named tools, omission, and tool subsets without a structured-text output schema. Literal expectations reference the official V3 and V4 definitions. TheactiveToolsassertion checks compatibility with existing SDK behavior, not Gateway protocol support.Validation on Python 3.14.8:
uv run pytest -q tests/providers/ai_gateway: 208 passed.uv run pytest -q: 1,029 passed.uv run ruff format --check src tests examples,uv run ruff check src tests examples,uv run mypy src tests, anduv run ty check: passed.uv run examples/.test_scripts/check-examples.py: all example mypy/ty checks passed in their own environments.uv run mypystill reports the same 35 existing diagnostics in three example files when checked from the root environment; no new diagnostics.No live provider requests were made. These tests verify outgoing request serialization; live Gateway acceptance remains unverified.