fix(vertex): guard embedding response 'predictions' without redundant isinstance

basedpyright flags `isinstance(response, dict)` as reportUnnecessaryIsInstance
because `transform_vertex_response_to_openai` already annotates `response:
dict`; two new calls pushed that rule past its committed budget in CI.
Keep the defensive contract (raise ValueError when the response body lacks
the 'predictions' key) but drop the redundant isinstance narrow.

Signed-off-by: apex-mochen <2756823972@qq.com>
This commit is contained in:
apex-mochen 2026-10-10 12:40:00 +00:00
parent d7d186d1f7
commit c84221cafb

View file

@ -229,7 +229,7 @@ class VertexAITextEmbeddingConfig(LiteLLMBaseModel):
if VertexBGEConfig.is_bge_model(model):
return VertexBGEConfig.transform_response(response=response, model=model, model_response=model_response)
if not isinstance(response, dict) or "predictions" not in response:
if "predictions" not in response:
raise ValueError("Vertex embedding response missing 'predictions' field")
_predictions: Final = response["predictions"]
@ -260,7 +260,7 @@ class VertexAITextEmbeddingConfig(LiteLLMBaseModel):
"""
Transforms a vertex fine-tuned model embedding response to an openai response format.
"""
if not isinstance(response, dict) or "predictions" not in response:
if "predictions" not in response:
raise ValueError("Vertex embedding response missing 'predictions' field")
_predictions: Final = response["predictions"]