fix(backends): forward the standard service_tier param (litellm + anyllm)#2468
fix(backends): forward the standard service_tier param (litellm + anyllm)#2468chopratejas wants to merge 1 commit into
Conversation
…llm) The direct passthrough already forwards service_tier; the SDK-translation backends dropped it (fixed field whitelists). Forward it like temperature/top_p so a client's standard service_tier (OpenAI flex/priority, Anthropic auto/standard_only) reaches the provider through any backend. Test: anyllm forwards service_tier to the SDK completion call.
PR governanceThis PR does not yet satisfy the required template fields:
Please update the PR body, or move the PR back to draft while it is still in progress. |
JerrettDavis
left a comment
There was a problem hiding this comment.
This needs one more change before approval.
The LiteLLM Anthropic translation path now forwards service_tier in send_message, but the matching stream_message path still omits it. That leaves streamed Anthropic-format requests through --backend litellm with the same silent-drop behavior this PR is fixing for non-streaming requests.
Please add the same if "service_tier" in body: kwargs["service_tier"] = body["service_tier"] handling to LiteLLMBackend.stream_message, and add/extend a LiteLLM-focused test so both the send and stream Anthropic translation paths are covered. The any-llm coverage is useful, but it does not protect the LiteLLM path where the remaining omission is.
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Description
service_tieris a standard provider request field (OpenAIflex/default/priority, Anthropicauto/standard_only), but the SDK-translation backends rebuilt the upstream request from a fixed field whitelist and silently dropped it — so a client that setservice_tierhad it discarded on--backend litellm/anyllm. The direct passthrough already forwards it; this makes the translation backends do the same, alongsidetemperature/top_p/tools.Type of Change
Changes Made
backends/litellm.py(Anthropic path): forwardservice_tierwhen present (the OpenAI path already forwards unconsumed fields via_build_openai_extra_body).backends/anyllm.py: addservice_tierto the forwarded params (both the Anthropic whitelist and the OpenAI param list).Testing
pytest)ruff check)mypy)Test Output
Real Behavior Proof
acompletionkwargs.send_message({..., "service_tier": "standard_only"}).instance.calls[0]["service_tier"] == "standard_only"— the param reaches the SDK call (previously absent).Checklist
CHANGELOG.md