mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-25 22:20:43 +00:00
* fix(vertex_ai): resolve correct default max_tokens for versioned claude ids two defects stacked on the vertex claude path so a request without max_tokens was silently capped at 4096 output tokens the fill in transform_request called AnthropicConfig.get_config directly so get_max_tokens_for_model on VertexAIAnthropicConfig never ran, and the bare versioned id like claude-haiku-4-5@20251001 is not a cost map key, so the fill fell back to the 4096 default now transform_request calls self.get_config and VertexAIAnthropicConfig resolves the vertex_ai prefixed key first, then falls back to the base lookup also the two vertex_ai claude haiku 4 5 map entries said 8192 max output while every sibling claude-haiku-4-5 key says 64000 and google documents 64000, the reporter verified 64000 live on vertex with a 200 and 15290 completion tokens, both entries and the runtime backup map now say 64000 Fixes #40363 * chore(anthropic): drop redundant mutable-ok suppressions the type discipline gate flags these two comments as LIT013, both suppress nothing because neither line has an LIT001 violation. no behavior change * fix(vertex_ai): look up the vertex max tokens without the partially unknown cost map the membership check on litellm.model_cost is a reportUnknownMemberType the basedpyright delta gate counts, and it adds exactly one over the merge-base. get_max_tokens already raises for a model that is not mapped, so catch that and fall back to the parent, same as the parent does for its own lookup. the focused vertex anthropic tests still pass * fix(vertex_ai): guard the model cost map lookup with a pyright ignore the try/except form added a blind except that the strict ruff gate counts as BLE001, one over the merge-base. keep the membership check and suppress only the reportUnknownMemberType on the dynamically typed registry, the same pattern the complexity router already uses. ruff strict is identical to the base, ruff format and ruff check clean, focused vertex anthropic tests 42 passed * fix(vertex_ai): read the unversioned Claude row before the Vertex row for a missing max_tokens A Vertex @version id now reads the cost-map row of its id without the version before the vertex_ai row, so claude-sonnet-4-6@default keeps the 128000 default that Vertex accepts while versioned Haiku, Opus, and Sonnet 4.5 ids still get 64000. * fix(anthropic): keep an explicit DEFAULT_ANTHROPIC_CHAT_MAX_TOKENS ahead of the unversioned and provider rows An operator who set DEFAULT_ANTHROPIC_CHAT_MAX_TOKENS, for example to 4096 as the v1.109.0 notes suggest, got that value for every Claude id with no own cost-map row. The new unversioned and provider-row steps ranked above it, so vertex_ai/claude-haiku-4-5@20251001 went from 4096 to 64000 and claude-sonnet-4-6@default from 4096 to 128000 for them. An explicit value now comes right after the model's own row, so only deployments on the built-in fallback change * fix(anthropic): keep DEFAULT_ANTHROPIC_CHAT_MAX_TOKENS as the last fallback after the unversioned and provider rows Reverts the previous commit. With DEFAULT_ANTHROPIC_CHAT_MAX_TOKENS set to any value, versioned Vertex Claude ids ignored their model's row again: at 4096 a Haiku 4.5 reply still stopped at 4096 tokens, the symptom the linked issue reports, and at 128000 Vertex still answered 400. The env var is documented as the default for models missing from the cost map, and a versioned id whose model has a row is not missing, so it now gets the same cap as its unversioned id * fix(anthropic): read the unversioned max_tokens row directly and test the lookup on other routes The unversioned lookup went through get_max_tokens, which prints the provider banner a second time when the id has no row, so SDK calls on ids like claude-3-5-haiku@20241022 printed it twice. Reading the row directly gives the same max_tokens for every cost-map Claude id on every route. New tests drive the provider and unversioned rows on the Anthropic, Azure AI and Claude Platform routes * ci: restart the required checks after their held runs failed at startup --------- Co-authored-by: hktitof <hktitof@users.noreply.github.com> Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| guardrail_translation | ||
| __init__.py | ||
| conftest.py | ||
| test_anthropic_chat_handler.py | ||
| test_anthropic_chat_transformation.py | ||
| test_code_interpreter_results_extraction.py | ||
| test_transformation.py | ||