litellm/tests/unit/llms/openai
quietjules 801976e707
fix(llms): send later system messages as user turns for models declared system-first (#54347)
* fix(llms): send later system items as user turns for models declared system-first

* fix(llms): keep a system-first flag on its own deployment and apply it to openai/ Responses on other hosts

* fix(responses): treat a continued turn's system items as later ones on system-first openai/ deployments

A previous_response_id turn counts system and developer items from the first input item, so a
reminder that opens a continued turn folds into instructions instead of answering 400

Removing the last deployment that sets supports_mid_conversation_system true now restores the
catalog's value on the shared row, and leaves the row as it is when the catalog declares nothing,
so unmarked same-model deployments never become system-first

* fix(responses): send a continued turn's system items as user turns on system-first openai/ deployments

Fireworks keeps the first turn's system item in the stored response, so folding a continued turn's reminder into instructions still answered 400 there. On the openai/ route a previous_response_id turn now sends every system and developer item as a user turn with the operator note, in place

hosted_vllm and native fireworks_ai keep folding, since they fold the first turn's system prompt too and the stored response holds no system item

* fix(responses): keep a first turn's system prompt in stored input on system-first openai/ deployments

On an openai/ deployment flagged supports_mid_conversation_system false, a first turn without caller instructions now sends the leading system block as one system input item, so a provider that stores input keeps it on previous_response_id turns. With caller instructions the leading block still folds into instructions

The flag is no longer enrolled in the shared-only-when-true capability fields, so a deployment's false is shared with same-model deployments that declare nothing, as on main

* fix(responses): keep later developer reminders in place on system-first openai/ deployments

On a first openai/ turn to a system-first deployment only the leading system block folds into
instructions or one leading system item now. Later developer items go out in place as user turns
with the operator note, so a resent history keeps a stable prefix for the prompt cache. A lone
leading system item next to caller instructions now folds too, since vLLM sends instructions as
its own first system message

hosted_vllm keeps folding later text developer items into instructions as on main, and the flag
readers in utils share one helper

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-25 11:48:27 +00:00
..
chat fix(llms): send later system messages as user turns for models declared system-first (#54347) 2026-11-25 11:48:27 +00:00
completion fix(openai): relay param and plain message from OpenAI-compatible backend errors (#53217) 2026-11-20 15:53:54 -08:00
decisions fix(decisions): match OpenAI format answers to questions by name (#52597) 2026-11-18 12:55:45 -08:00
embeddings fix(gemini): support explicit text in embedding inputs (#53135) 2026-11-20 11:05:11 -08: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 feat(realtime)!: serve GPT-Live over WebRTC with sideband attach, and bill WebRTC calls from a proxy sideband (#53282) 2026-11-21 22:49:26 -08:00
realtime feat(realtime)!: support latest OpenAI audio models (#35600) 2026-11-03 07:27:52 +00:00
responses fix(llms): send later system messages as user turns for models declared system-first (#54347) 2026-11-25 11:48:27 +00:00
speech test: add package initializers to migrated unit test directories 2026-09-20 11:52:07 +00:00
transcriptions test(groq): tell cost lookups the Whisper row changed in the catalog rate test (#54252) 2026-11-24 21:10:12 +00: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 fix(llms): treat chat-latest and gpt-chat-latest as gpt-5 family models (#51151) 2026-11-24 04:02:51 -08:00
test_is_model_gpt_5_model.py fix(llms): treat chat-latest and gpt-chat-latest as gpt-5 family models (#51151) 2026-11-24 04:02:51 -08:00
test_o_series_transformation.py fix(openai): drop or refuse an o-series reasoning_effort level the model map turns off (#54066) 2026-11-24 06:42:03 -08:00
test_openai.py fix(openai): preserve omitted headers for chat and embeddings (#53132) 2026-11-20 10:29:22 -08:00
test_openai_audio_speech.py fix(cost): bill OpenAI token-priced aac and flac speech on the length of the returned audio (#53308) 2026-11-21 19:53:23 +00: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(router,files,batches)!: never resend a file or batch create the provider may already have (#51315) 2026-11-25 07:20:51 +00: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(images): send image_edit markup as a multipart file part (#53815) 2026-11-25 04:14:57 +00: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