Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions vertexai/_genai/evals.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,18 @@ def _CustomCodeExecutionSpec_from_vertex(
parent_object: Optional[dict[str, Any]] = None,
) -> dict[str, Any]:
to_object: dict[str, Any] = {}
if getv(from_object, ["evaluation_function"]) is not None:
if getv(from_object, ["evaluationFunction"]) is not None:
setv(
to_object,
["remote_custom_function"],
getv(from_object, ["evaluation_function"]),
["evaluation_function"],
getv(from_object, ["evaluationFunction"]),
)

if getv(from_object, ["evaluationFunction"]) is not None:
if getv(from_object, ["evaluation_function"]) is not None:
setv(
to_object,
["evaluation_function"],
getv(from_object, ["evaluationFunction"]),
["remote_custom_function"],
getv(from_object, ["evaluation_function"]),
)

return to_object
Expand All @@ -153,18 +153,18 @@ def _CustomCodeExecutionSpec_to_vertex(
parent_object: Optional[dict[str, Any]] = None,
) -> dict[str, Any]:
to_object: dict[str, Any] = {}
if getv(from_object, ["remote_custom_function"]) is not None:
if getv(from_object, ["evaluation_function"]) is not None:
setv(
to_object,
["evaluation_function"],
getv(from_object, ["remote_custom_function"]),
["evaluationFunction"],
getv(from_object, ["evaluation_function"]),
)

if getv(from_object, ["evaluation_function"]) is not None:
if getv(from_object, ["remote_custom_function"]) is not None:
setv(
to_object,
["evaluationFunction"],
getv(from_object, ["evaluation_function"]),
["evaluation_function"],
getv(from_object, ["remote_custom_function"]),
)

return to_object
Expand Down Expand Up @@ -392,18 +392,18 @@ def _EvaluationRunMetric_from_vertex(
if getv(from_object, ["metric"]) is not None:
setv(to_object, ["metric"], getv(from_object, ["metric"]))

if getv(from_object, ["metricResourceName"]) is not None:
if getv(from_object, ["metricConfig"]) is not None:
setv(
to_object,
["metric_resource_name"],
getv(from_object, ["metricResourceName"]),
["metric_config"],
_UnifiedMetric_from_vertex(getv(from_object, ["metricConfig"]), to_object),
)

if getv(from_object, ["metricConfig"]) is not None:
if getv(from_object, ["metricResourceName"]) is not None:
setv(
to_object,
["metric_config"],
_UnifiedMetric_from_vertex(getv(from_object, ["metricConfig"]), to_object),
["metric_resource_name"],
getv(from_object, ["metricResourceName"]),
)

return to_object
Expand All @@ -417,18 +417,18 @@ def _EvaluationRunMetric_to_vertex(
if getv(from_object, ["metric"]) is not None:
setv(to_object, ["metric"], getv(from_object, ["metric"]))

if getv(from_object, ["metric_resource_name"]) is not None:
if getv(from_object, ["metric_config"]) is not None:
setv(
to_object,
["metricResourceName"],
getv(from_object, ["metric_resource_name"]),
["metricConfig"],
_UnifiedMetric_to_vertex(getv(from_object, ["metric_config"]), to_object),
)

if getv(from_object, ["metric_config"]) is not None:
if getv(from_object, ["metric_resource_name"]) is not None:
setv(
to_object,
["metricConfig"],
_UnifiedMetric_to_vertex(getv(from_object, ["metric_config"]), to_object),
["metricResourceName"],
getv(from_object, ["metric_resource_name"]),
)

return to_object
Expand Down Expand Up @@ -526,16 +526,16 @@ def _GenerateInstanceRubricsRequest_to_vertex(
),
)

if getv(from_object, ["config"]) is not None:
setv(to_object, ["config"], getv(from_object, ["config"]))

if getv(from_object, ["metric_resource_name"]) is not None:
setv(
to_object,
["metricResourceName"],
getv(from_object, ["metric_resource_name"]),
)

if getv(from_object, ["config"]) is not None:
setv(to_object, ["config"], getv(from_object, ["config"]))

return to_object


Expand Down Expand Up @@ -677,9 +677,6 @@ def _RubricGenerationSpec_to_vertex(
if getv(from_object, ["prompt_template"]) is not None:
setv(to_object, ["promptTemplate"], getv(from_object, ["prompt_template"]))

if getv(from_object, ["generator_model_config"]) is not None:
setv(to_object, ["model_config"], getv(from_object, ["generator_model_config"]))

if getv(from_object, ["rubric_content_type"]) is not None:
setv(
to_object, ["rubricContentType"], getv(from_object, ["rubric_content_type"])
Expand All @@ -692,6 +689,9 @@ def _RubricGenerationSpec_to_vertex(
getv(from_object, ["rubric_type_ontology"]),
)

if getv(from_object, ["generator_model_config"]) is not None:
setv(to_object, ["model_config"], getv(from_object, ["generator_model_config"]))

return to_object


Expand Down Expand Up @@ -1070,8 +1070,8 @@ def _generate_rubrics(
types.PredefinedMetricSpecOrDict
] = None,
rubric_generation_spec: Optional[types.RubricGenerationSpecOrDict] = None,
metric_resource_name: Optional[str] = None,
config: Optional[types.RubricGenerationConfigOrDict] = None,
metric_resource_name: Optional[str] = None,
) -> types.GenerateInstanceRubricsResponse:
"""
Generates rubrics for a given prompt.
Expand All @@ -1081,8 +1081,8 @@ def _generate_rubrics(
contents=contents,
predefined_rubric_generation_spec=predefined_rubric_generation_spec,
rubric_generation_spec=rubric_generation_spec,
metric_resource_name=metric_resource_name,
config=config,
metric_resource_name=metric_resource_name,
)

request_url_dict: Optional[dict[str, str]]
Expand Down Expand Up @@ -2360,8 +2360,8 @@ async def _generate_rubrics(
types.PredefinedMetricSpecOrDict
] = None,
rubric_generation_spec: Optional[types.RubricGenerationSpecOrDict] = None,
metric_resource_name: Optional[str] = None,
config: Optional[types.RubricGenerationConfigOrDict] = None,
metric_resource_name: Optional[str] = None,
) -> types.GenerateInstanceRubricsResponse:
"""
Generates rubrics for a given prompt.
Expand All @@ -2371,8 +2371,8 @@ async def _generate_rubrics(
contents=contents,
predefined_rubric_generation_spec=predefined_rubric_generation_spec,
rubric_generation_spec=rubric_generation_spec,
metric_resource_name=metric_resource_name,
config=config,
metric_resource_name=metric_resource_name,
)

request_url_dict: Optional[dict[str, str]]
Expand Down
20 changes: 10 additions & 10 deletions vertexai/_genai/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,9 @@
"GetAgentEngineTaskConfig",
"GetAgentEngineTaskConfigDict",
"GetAgentEngineTaskConfigOrDict",
"PartMediaResolution",
"PartMediaResolutionDict",
"PartMediaResolutionOrDict",
"CodeExecutionResult",
"CodeExecutionResultDict",
"CodeExecutionResultOrDict",
Expand All @@ -1208,12 +1211,12 @@
"FunctionCall",
"FunctionCallDict",
"FunctionCallOrDict",
"FunctionResponseFileData",
"FunctionResponseFileDataDict",
"FunctionResponseFileDataOrDict",
"FunctionResponseBlob",
"FunctionResponseBlobDict",
"FunctionResponseBlobOrDict",
"FunctionResponseFileData",
"FunctionResponseFileDataDict",
"FunctionResponseFileDataOrDict",
"FunctionResponsePart",
"FunctionResponsePartDict",
"FunctionResponsePartOrDict",
Expand All @@ -1223,9 +1226,6 @@
"Blob",
"BlobDict",
"BlobOrDict",
"PartMediaResolution",
"PartMediaResolutionDict",
"PartMediaResolutionOrDict",
"VideoMetadata",
"VideoMetadataDict",
"VideoMetadataOrDict",
Expand Down Expand Up @@ -1385,12 +1385,12 @@
"EvalCase",
"EvalCaseDict",
"EvalCaseOrDict",
"GcsSource",
"GcsSourceDict",
"GcsSourceOrDict",
"BigQuerySource",
"BigQuerySourceDict",
"BigQuerySourceOrDict",
"GcsSource",
"GcsSourceDict",
"GcsSourceOrDict",
"EvaluationDataset",
"EvaluationDatasetDict",
"EvaluationDatasetOrDict",
Expand Down Expand Up @@ -2214,10 +2214,10 @@
"OptimizeJobConfigDict",
"OptimizeJobConfigOrDict",
"A2aTaskState",
"MediaResolution",
"Outcome",
"Language",
"FunctionResponseScheduling",
"MediaResolution",
"State",
"ComputationBasedMetricType",
"PairwiseChoice",
Expand Down
Loading
Loading