You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: GenAI Client(evals) - normalize inference model names in create_evaluation_run
The Evaluation Service routes server-side inference by parsing the
EvaluationRunInferenceConfig.model string into a publisher-model or
endpoint resource name, from which it extracts the serving location.
Names that are not fully qualified fail server-side in two ways:
- A short name (e.g. `gemini-2.5-flash`) is rejected by API validation
with a clear 400 INVALID_ARGUMENT error.
- A location-less path (e.g. `publishers/google/models/gemini-2.5-flash`)
passes validation but has no location for the server to route on, so it
fails later with an opaque `INTERNAL: Internal error occurred.` that is
impossible to debug from the client.
The SDK previously passed `model` through verbatim. This change makes the
SDK guard the input: model names in inference_configs are normalized to a
fully-qualified `projects/{project}/locations/{location}/...` resource
name using the client's project and location before the request is sent.
Short Gemini names, location-less publisher/endpoint/tuned-model paths,
and `models/{id}` are expanded; already fully-qualified names pass
through. Unrecognized inputs and a client missing project/location raise
a clear client-side ValueError.
Also corrects the create_evaluation_run docstring and the
EvaluationRunInferenceConfig.model field doc, which incorrectly showed a
short model name as a working example.
PiperOrigin-RevId: 926248584
Copy file name to clipboardExpand all lines: agentplatform/_genai/types/common.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -2586,7 +2586,7 @@ class EvaluationRunInferenceConfig(_common.BaseModel):
2586
2586
)
2587
2587
model: Optional[str] = Field(
2588
2588
default=None,
2589
-
description="""The fully qualified name of the publisher model or endpoint to use for inference.""",
2589
+
description="""The model to use for inference. Accepts a short Gemini model name (e.g. `gemini-2.5-flash`), which is automatically expanded to a fully-qualified resource name using the client's project and location, or an already fully-qualified publisher-model or endpoint resource name (e.g. `projects/{project}/locations/{location}/publishers/google/models/gemini-2.5-flash`).""",
default=None, description="""The prompt template used for inference."""
@@ -2611,7 +2611,7 @@ class EvaluationRunInferenceConfigDict(TypedDict, total=False):
2611
2611
"""The agent config."""
2612
2612
2613
2613
model: Optional[str]
2614
-
"""The fully qualified name of the publisher model or endpoint to use for inference."""
2614
+
"""The model to use for inference. Accepts a short Gemini model name (e.g. `gemini-2.5-flash`), which is automatically expanded to a fully-qualified resource name using the client's project and location, or an already fully-qualified publisher-model or endpoint resource name (e.g. `projects/{project}/locations/{location}/publishers/google/models/gemini-2.5-flash`)."""
Copy file name to clipboardExpand all lines: vertexai/_genai/types/common.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -2549,7 +2549,7 @@ class EvaluationRunInferenceConfig(_common.BaseModel):
2549
2549
)
2550
2550
model: Optional[str] = Field(
2551
2551
default=None,
2552
-
description="""The fully qualified name of the publisher model or endpoint to use for inference.""",
2552
+
description="""The model to use for inference. Accepts a short Gemini model name (e.g. `gemini-2.5-flash`), which is automatically expanded to a fully-qualified resource name using the client's project and location, or an already fully-qualified publisher-model or endpoint resource name (e.g. `projects/{project}/locations/{location}/publishers/google/models/gemini-2.5-flash`).""",
default=None, description="""The prompt template used for inference."""
@@ -2574,7 +2574,7 @@ class EvaluationRunInferenceConfigDict(TypedDict, total=False):
2574
2574
"""The agent config."""
2575
2575
2576
2576
model: Optional[str]
2577
-
"""The fully qualified name of the publisher model or endpoint to use for inference."""
2577
+
"""The model to use for inference. Accepts a short Gemini model name (e.g. `gemini-2.5-flash`), which is automatically expanded to a fully-qualified resource name using the client's project and location, or an already fully-qualified publisher-model or endpoint resource name (e.g. `projects/{project}/locations/{location}/publishers/google/models/gemini-2.5-flash`)."""
0 commit comments