mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-15 04:19:08 +00:00
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:
parent
d7d186d1f7
commit
c84221cafb
1 changed files with 2 additions and 2 deletions
|
|
@ -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"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue