Skip to content

Commit 3e34c5d

Browse files
jaycee-licopybara-github
authored andcommitted
chore: Maintain backward-compatible field ordering in generated data types
PiperOrigin-RevId: 882441110
1 parent 76a9558 commit 3e34c5d

3 files changed

Lines changed: 200 additions & 200 deletions

File tree

vertexai/_genai/evals.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -131,18 +131,18 @@ def _CustomCodeExecutionSpec_from_vertex(
131131
parent_object: Optional[dict[str, Any]] = None,
132132
) -> dict[str, Any]:
133133
to_object: dict[str, Any] = {}
134-
if getv(from_object, ["evaluation_function"]) is not None:
134+
if getv(from_object, ["evaluationFunction"]) is not None:
135135
setv(
136136
to_object,
137-
["remote_custom_function"],
138-
getv(from_object, ["evaluation_function"]),
137+
["evaluation_function"],
138+
getv(from_object, ["evaluationFunction"]),
139139
)
140140

141-
if getv(from_object, ["evaluationFunction"]) is not None:
141+
if getv(from_object, ["evaluation_function"]) is not None:
142142
setv(
143143
to_object,
144-
["evaluation_function"],
145-
getv(from_object, ["evaluationFunction"]),
144+
["remote_custom_function"],
145+
getv(from_object, ["evaluation_function"]),
146146
)
147147

148148
return to_object
@@ -153,18 +153,18 @@ def _CustomCodeExecutionSpec_to_vertex(
153153
parent_object: Optional[dict[str, Any]] = None,
154154
) -> dict[str, Any]:
155155
to_object: dict[str, Any] = {}
156-
if getv(from_object, ["remote_custom_function"]) is not None:
156+
if getv(from_object, ["evaluation_function"]) is not None:
157157
setv(
158158
to_object,
159-
["evaluation_function"],
160-
getv(from_object, ["remote_custom_function"]),
159+
["evaluationFunction"],
160+
getv(from_object, ["evaluation_function"]),
161161
)
162162

163-
if getv(from_object, ["evaluation_function"]) is not None:
163+
if getv(from_object, ["remote_custom_function"]) is not None:
164164
setv(
165165
to_object,
166-
["evaluationFunction"],
167-
getv(from_object, ["evaluation_function"]),
166+
["evaluation_function"],
167+
getv(from_object, ["remote_custom_function"]),
168168
)
169169

170170
return to_object
@@ -670,9 +670,6 @@ def _RubricGenerationSpec_to_vertex(
670670
if getv(from_object, ["prompt_template"]) is not None:
671671
setv(to_object, ["promptTemplate"], getv(from_object, ["prompt_template"]))
672672

673-
if getv(from_object, ["generator_model_config"]) is not None:
674-
setv(to_object, ["model_config"], getv(from_object, ["generator_model_config"]))
675-
676673
if getv(from_object, ["rubric_content_type"]) is not None:
677674
setv(
678675
to_object, ["rubricContentType"], getv(from_object, ["rubric_content_type"])
@@ -685,6 +682,9 @@ def _RubricGenerationSpec_to_vertex(
685682
getv(from_object, ["rubric_type_ontology"]),
686683
)
687684

685+
if getv(from_object, ["generator_model_config"]) is not None:
686+
setv(to_object, ["model_config"], getv(from_object, ["generator_model_config"]))
687+
688688
return to_object
689689

690690

vertexai/_genai/types/__init__.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,9 @@
11931193
"GetAgentEngineTaskConfig",
11941194
"GetAgentEngineTaskConfigDict",
11951195
"GetAgentEngineTaskConfigOrDict",
1196+
"PartMediaResolution",
1197+
"PartMediaResolutionDict",
1198+
"PartMediaResolutionOrDict",
11961199
"CodeExecutionResult",
11971200
"CodeExecutionResultDict",
11981201
"CodeExecutionResultOrDict",
@@ -1208,12 +1211,12 @@
12081211
"FunctionCall",
12091212
"FunctionCallDict",
12101213
"FunctionCallOrDict",
1211-
"FunctionResponseFileData",
1212-
"FunctionResponseFileDataDict",
1213-
"FunctionResponseFileDataOrDict",
12141214
"FunctionResponseBlob",
12151215
"FunctionResponseBlobDict",
12161216
"FunctionResponseBlobOrDict",
1217+
"FunctionResponseFileData",
1218+
"FunctionResponseFileDataDict",
1219+
"FunctionResponseFileDataOrDict",
12171220
"FunctionResponsePart",
12181221
"FunctionResponsePartDict",
12191222
"FunctionResponsePartOrDict",
@@ -1223,9 +1226,6 @@
12231226
"Blob",
12241227
"BlobDict",
12251228
"BlobOrDict",
1226-
"PartMediaResolution",
1227-
"PartMediaResolutionDict",
1228-
"PartMediaResolutionOrDict",
12291229
"VideoMetadata",
12301230
"VideoMetadataDict",
12311231
"VideoMetadataOrDict",
@@ -1385,12 +1385,12 @@
13851385
"EvalCase",
13861386
"EvalCaseDict",
13871387
"EvalCaseOrDict",
1388-
"GcsSource",
1389-
"GcsSourceDict",
1390-
"GcsSourceOrDict",
13911388
"BigQuerySource",
13921389
"BigQuerySourceDict",
13931390
"BigQuerySourceOrDict",
1391+
"GcsSource",
1392+
"GcsSourceDict",
1393+
"GcsSourceOrDict",
13941394
"EvaluationDataset",
13951395
"EvaluationDatasetDict",
13961396
"EvaluationDatasetOrDict",
@@ -2214,10 +2214,10 @@
22142214
"OptimizeJobConfigDict",
22152215
"OptimizeJobConfigOrDict",
22162216
"A2aTaskState",
2217+
"MediaResolution",
22172218
"Outcome",
22182219
"Language",
22192220
"FunctionResponseScheduling",
2220-
"MediaResolution",
22212221
"State",
22222222
"ComputationBasedMetricType",
22232223
"PairwiseChoice",

0 commit comments

Comments
 (0)