mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-31 06:56:59 +00:00
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
This commit is contained in:
parent
c88718915f
commit
757f7991bf
1 changed files with 3 additions and 4 deletions
|
|
@ -66,12 +66,11 @@ class VertexAIAnthropicConfig(AnthropicConfig):
|
|||
@staticmethod
|
||||
def get_max_tokens_for_model(model: str | None = None) -> int:
|
||||
if model is not None:
|
||||
try:
|
||||
vertex_max: Final = get_max_tokens(f"vertex_ai/{model}")
|
||||
vertex_key: Final = f"vertex_ai/{model}"
|
||||
if vertex_key in litellm.model_cost: # pyright: ignore[reportUnknownMemberType] # registry is dynamically typed
|
||||
vertex_max: Final = get_max_tokens(vertex_key)
|
||||
if vertex_max is not None:
|
||||
return vertex_max
|
||||
except Exception:
|
||||
return AnthropicConfig.get_max_tokens_for_model(model)
|
||||
return AnthropicConfig.get_max_tokens_for_model(model)
|
||||
|
||||
def _add_context_management_beta_headers(self, beta_set: set, context_management: dict) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue