litellm/tests/unit/llms/openai/completion
ryan-crabbe-berri fc90ec5a0e
fix(completions): send fields the OpenAI SDK has no keyword for in the request body (#55158)
* fix(completions): send fields the OpenAI SDK has no keyword for in the request body

A /v1/completions request carrying response_format, tools, tool_choice, functions, function_call or
top_logprobs failed with a 500 TypeError before anything was sent, because every request field was passed
to the SDK's completions.create() as a keyword. Those fields now travel in extra_body, so the provider
receives them and its own answer comes back.

Fixes #47951

* test(completions): type the monkeypatch fixture parameter

* fix(completions): send body-only fields on Azure text completions and clear the lint gates

Azure text completions called the SDK the same way, so response_format, tools and tool_choice hit the same TypeError there. They now go in the request body too.

The helper returns an Any-valued dict because that is the only thing the SDK's typed keywords accept from a splatted dict, which clears the reportArgumentType and LIT001 gate failures.

* fix(completions): give the Any import its lint suppression reason
2026-11-30 23:49:09 +00:00
..
__init__.py
test_completion_handler.py fix(completions): send fields the OpenAI SDK has no keyword for in the request body (#55158) 2026-11-30 23:49:09 +00:00
test_handler.py feat(openai)!: honor per-deployment workload identity on non-chat routes (#39966) 2026-10-16 22:25:15 +00:00
test_text_completion_guardrail_handler.py fix(guardrails): scan and rewrite streamed /v1/completions under post_call guardrails (#49035) 2026-10-29 08:46:49 -07:00
test_text_completion_token_ids.py