fix(api): strip padded tool_choice/function_call none/auto; Completions modalities text no-op - #562
Conversation
… effort as omit
Buyer SDKs often send stream_options with only false flags, tool_choice:{},
and reasoning_effort:"" as optional defaults. Accept them as omit no-ops
while still fail-closing true stream_options flags without stream=true and
non-empty reasoning_effort. Tip honesty substrate re-ship; 849 unit pass.
SDK clients send user:null as an optional default. Treat null as omit on chat Completions, legacy Completions, Responses, embeddings, and batch embeddings. Empty/whitespace/non-string user still fail closed with invalid_user. Local full unit: 857 passed.
…l/response_format/endpoint as omit SDK clients and stringified optional controls may send empty or whitespace strings. Treat as omit no-ops on embeddings encoding_format, chat/Responses tool_choice and function_call, response_format, and batch embeddings endpoint. Non-empty unsupported values still fail closed. Local full unit: 865 passed.
SDK stringified empty controls for reasoning, Responses text, and include are treat-as-omit on chat Completions, legacy Completions, and Responses. Non-empty unsupported values still fail closed with named errors. Local full unit: 872 passed.
… as omit Legacy Completions has no tools surface. Treat SDK defaults tool_choice none/auto/empty-string/empty-object and function_call none/auto/empty-string as omit no-ops (parity with chat). Non-default controls and non-empty tools still fail closed with a chat migration path. Local full unit: 877 passed.
SDK clients may send top_logprobs:0 (no top alternatives). Treat 0 and null as omit on chat Completions and legacy Completions. Non-zero values still fail closed with invalid_top_logprobs. Local full unit: 881 passed.
…format float
Incidental whitespace around honest no-op values (" auto ", " float ")
is stripped before validation so SDK-padded strings match. Unsupported
values (flex, base64) still fail closed after strip. Local full unit:
886 passed.
…ll named honesty Treat empty-string response_format/prediction/reasoning_effort as omit on legacy Completions. Accept audio/web_search_options keys with null/empty as omit and non-empty as named invalid_* (not unknown_fields). Local full unit: 894 passed.
…ns modalities text no-op Whitespace-padded none/auto on tool_choice and function_call are omit no-ops on chat, Completions, and Responses. Completions modalities ["text"] is an honest text-only no-op; non-text modalities still fail closed. Local full unit: 901 passed.
|
Important Review skippedToo many files! This PR contains 125 files, which is 25 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (125)
You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Pull request was closed
Summary
tool_choice/function_callso" none "/" auto "are omit no-ops (chat, Completions, Responses).modalities: ["text"](and padded" text ") is an honest text-only no-op; non-text modalities still fail closed withinvalid_chat_era_field.Test plan
pytest tests/test_tool_choice_strip_modalities_text_noop_http_honesty.py(+ related)pytest tests -q(901 passed)Product gates only: Full unit + Semgrep (Strix ignored). Independent non-author APPROVE still required.