litellm/tests/unit/llms/openai
Mateo Wang 386fb49dff
fix(responses): cache bridged system prompts on stored GPT-6.2 requests (#52906)
* fix(responses): cache bridged system prompts on stored GPT-6.2 requests

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(responses): skip a system prompt the stored chain already holds

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(responses): keep the stored chain lookup out of logging callbacks

The lookup that reads the start of a stored chain went through the logged
list_input_items entry points, so callbacks received the chain's stored
messages as a call of its own, even on a no-log request. It now runs as a
no-log subcall. Also narrows the lookup's error handling and drops two
mutable annotations so the strict lint and type discipline gates pass

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(responses): keep instructions on truncation auto and read Azure chains with AD credentials

A follow-up that sets truncation auto no longer reads the stored chain, since
truncation may cut the stored system message. The lookup also forwards the
deployment's Azure AD credentials, so token-only Azure deployments can read
the chain

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(responses): read the stored chain only from the provider of the request

A LiteLLM-encoded previous_response_id carries a provider that the listing call
follows, so an id naming another provider sent the request's credentials there.
The lookup now uses the provider's own id and is skipped, keeping instructions,
when the id names a different provider

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(responses): apply the request timeout to the stored chain lookup

Listing a response's input items dropped the timeout it was given, so the
lookup before a follow-up turn could wait past the caller's limit

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(responses): send the request's extra headers on the stored chain lookup

A gateway that authenticates by header rejected the lookup, so follow-up
turns kept sending the system prompt twice

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(responses): send only the caller's instructions on a follow-up whose chain holds the system prompt

A follow-up that carries both a system prompt and the caller's own instructions
sent them joined, so the stored system prompt was billed again. It now sends
only the caller's part, as the first turn did. The stored chain lookup also
uses the deployment's ssl_verify setting

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-19 14:03:43 -08:00
..
chat fix(guardrails): write rewritten tool_calls from the Generic Guardrail API back to the client (#50413) 2026-11-18 15:25:29 -08:00
completion fix(openai): keep the upstream error body on e.response for OpenAI and Azure errors (#49079) 2026-10-29 23:30:02 -07:00
decisions fix(decisions): match OpenAI format answers to questions by name (#52597) 2026-11-18 12:55:45 -08:00
embeddings test: add package initializers to migrated unit test directories 2026-09-20 11:52:07 +00:00
evals fix(llms): join api_base and route with one shared helper (#47535) 2026-10-21 06:59:32 +00:00
image_generation refactor(images): remove dall-e-2 and dall-e-3 code paths (#48703) 2026-10-28 17:48:09 -07:00
image_variations fix(openai): keep the upstream error body on e.response for OpenAI and Azure errors (#49079) 2026-10-29 23:30:02 -07:00
live refactor(router): delete the python router core, the rust core is the only core (#50178) 2026-11-05 10:40:46 -08:00
realtime feat(realtime)!: support latest OpenAI audio models (#35600) 2026-11-03 07:27:52 +00:00
responses fix(responses): cache bridged system prompts on stored GPT-6.2 requests (#52906) 2026-11-19 14:03:43 -08:00
speech test: add package initializers to migrated unit test directories 2026-09-20 11:52:07 +00:00
transcriptions fix(groq): restore Whisper transcription pricing (#52570) 2026-11-18 11:18:30 -08:00
vector_store_files fix(proxy)!: return provider-matching 4xx for the LIT-8062 status code follow-ups (#45537) 2026-10-13 11:42:39 -07:00
vector_stores test: add package initializers to migrated unit test directories 2026-09-20 11:52:07 +00:00
videos feat(videos): add first-class OpenRouter video request fields (#50319) 2026-11-06 16:50:48 -08:00
__init__.py test(unit): make every tests/unit directory a package so pytest collection is unique 2026-09-20 11:50:59 +00:00
test_cost_calculation.py feat(fal_ai): bill fal video clips by duration and resolution (#51679) 2026-11-13 12:55:55 -08:00
test_data_residency.py feat(openai): bill gov.api.openai.com FedRAMP endpoint with 1.1x uplift (#49951) 2026-11-04 08:57:42 -08:00
test_gpt_reasoning_transformation.py refactor(router): route the router family through RoutingContext and close the outside surface (#49118) 2026-10-30 19:18:54 -07:00
test_is_model_gpt_5_model.py refactor(llms): rename model-version transformation files to family names (#48509) 2026-10-26 18:53:16 -07:00
test_o_series_transformation.py fix(openai): stop stripping cache_control from the caller's own messages and tools (#35602) 2026-10-31 00:29:10 -07:00
test_openai.py fix(exceptions): map upstream 403 to PermissionDeniedError for OpenAI-style providers (#52179) 2026-11-17 03:14:09 +00:00
test_openai_audio_speech.py fix(openai): bill the audio output tokens OpenAI reports for gpt-4o-mini-tts speech (#52317) 2026-11-17 11:35:30 -08:00
test_openai_authentication_error.py test: migrate local_testing SDK and provider tests out of build_and_test (#45760) 2026-10-10 23:14:25 +00:00
test_openai_common_utils.py fix(logging): warn when drop_params drops a requested reasoning level on the remaining paths (#48933) 2026-10-30 08:48:43 -07:00
test_openai_empty_response.py fix(openai): send chat completions through client.post so the SDK's per-message param transform stops holding the event loop (#46967) 2026-10-16 18:06:01 -07:00
test_openai_file_content_streaming.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_openai_image_edit_transformation.py fix(cost): bill SVG authoring usage on OpenAI image responses (#52571) 2026-11-18 13:04:49 -08:00
test_openai_workload_identity.py refactor(router): route the router family through RoutingContext and close the outside surface (#49118) 2026-10-30 19:18:54 -07:00
test_organization_costs.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_use_chat_completions_api_no_leak.py fix(openai): send chat completions through client.post so the SDK's per-message param transform stops holding the event loop (#46967) 2026-10-16 18:06:01 -07:00