Skip to content

Commit 656da78

Browse files
sararobcopybara-github
authored andcommitted
feat: Add enable_data_retention to ToolParallelAiSearch, Add step_count to ReinforcementTuningHyperParameters, Add BidiGenerateContentSetup
PiperOrigin-RevId: 964763884
1 parent c3bdb88 commit 656da78

5 files changed

Lines changed: 60 additions & 214 deletions

File tree

‎google/genai/_live_converters.py‎

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -90,26 +90,6 @@ def _Blob_to_mldev(
9090
return to_object
9191

9292

93-
def _CodeExecutionResult_to_vertex(
94-
from_object: Union[dict[str, Any], object],
95-
parent_object: Optional[dict[str, Any]] = None,
96-
) -> dict[str, Any]:
97-
to_object: dict[str, Any] = {}
98-
if getv(from_object, ['outcome']) is not None:
99-
setv(to_object, ['outcome'], getv(from_object, ['outcome']))
100-
101-
if getv(from_object, ['output']) is not None:
102-
setv(to_object, ['output'], getv(from_object, ['output']))
103-
104-
if getv(from_object, ['id']) is not None:
105-
raise ValueError(
106-
'id parameter is only supported in Gemini Developer API mode, not in'
107-
' Gemini Enterprise Agent Platform mode.'
108-
)
109-
110-
return to_object
111-
112-
11393
def _ComputerUse_to_vertex(
11494
from_object: Union[dict[str, Any], object],
11595
parent_object: Optional[dict[str, Any]] = None,
@@ -183,26 +163,6 @@ def _Content_to_vertex(
183163
return to_object
184164

185165

186-
def _ExecutableCode_to_vertex(
187-
from_object: Union[dict[str, Any], object],
188-
parent_object: Optional[dict[str, Any]] = None,
189-
) -> dict[str, Any]:
190-
to_object: dict[str, Any] = {}
191-
if getv(from_object, ['code']) is not None:
192-
setv(to_object, ['code'], getv(from_object, ['code']))
193-
194-
if getv(from_object, ['language']) is not None:
195-
setv(to_object, ['language'], getv(from_object, ['language']))
196-
197-
if getv(from_object, ['id']) is not None:
198-
raise ValueError(
199-
'id parameter is only supported in Gemini Developer API mode, not in'
200-
' Gemini Enterprise Agent Platform mode.'
201-
)
202-
203-
return to_object
204-
205-
206166
def _FileData_to_mldev(
207167
from_object: Union[dict[str, Any], object],
208168
parent_object: Optional[dict[str, Any]] = None,
@@ -1691,19 +1651,11 @@ def _Part_to_vertex(
16911651
setv(
16921652
to_object,
16931653
['codeExecutionResult'],
1694-
_CodeExecutionResult_to_vertex(
1695-
getv(from_object, ['code_execution_result']), to_object
1696-
),
1654+
getv(from_object, ['code_execution_result']),
16971655
)
16981656

16991657
if getv(from_object, ['executable_code']) is not None:
1700-
setv(
1701-
to_object,
1702-
['executableCode'],
1703-
_ExecutableCode_to_vertex(
1704-
getv(from_object, ['executable_code']), to_object
1705-
),
1706-
)
1658+
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
17071659

17081660
if getv(from_object, ['file_data']) is not None:
17091661
setv(to_object, ['fileData'], getv(from_object, ['file_data']))

‎google/genai/caches.py‎

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -99,26 +99,6 @@ def _Blob_to_mldev(
9999
return to_object
100100

101101

102-
def _CodeExecutionResult_to_vertex(
103-
from_object: Union[dict[str, Any], object],
104-
parent_object: Optional[dict[str, Any]] = None,
105-
) -> dict[str, Any]:
106-
to_object: dict[str, Any] = {}
107-
if getv(from_object, ['outcome']) is not None:
108-
setv(to_object, ['outcome'], getv(from_object, ['outcome']))
109-
110-
if getv(from_object, ['output']) is not None:
111-
setv(to_object, ['output'], getv(from_object, ['output']))
112-
113-
if getv(from_object, ['id']) is not None:
114-
raise ValueError(
115-
'id parameter is only supported in Gemini Developer API mode, not in'
116-
' Gemini Enterprise Agent Platform mode.'
117-
)
118-
119-
return to_object
120-
121-
122102
def _ComputerUse_to_vertex(
123103
from_object: Union[dict[str, Any], object],
124104
parent_object: Optional[dict[str, Any]] = None,
@@ -413,26 +393,6 @@ def _DeleteCachedContentResponse_from_vertex(
413393
return to_object
414394

415395

416-
def _ExecutableCode_to_vertex(
417-
from_object: Union[dict[str, Any], object],
418-
parent_object: Optional[dict[str, Any]] = None,
419-
) -> dict[str, Any]:
420-
to_object: dict[str, Any] = {}
421-
if getv(from_object, ['code']) is not None:
422-
setv(to_object, ['code'], getv(from_object, ['code']))
423-
424-
if getv(from_object, ['language']) is not None:
425-
setv(to_object, ['language'], getv(from_object, ['language']))
426-
427-
if getv(from_object, ['id']) is not None:
428-
raise ValueError(
429-
'id parameter is only supported in Gemini Developer API mode, not in'
430-
' Gemini Enterprise Agent Platform mode.'
431-
)
432-
433-
return to_object
434-
435-
436396
def _FileData_to_mldev(
437397
from_object: Union[dict[str, Any], object],
438398
parent_object: Optional[dict[str, Any]] = None,
@@ -819,19 +779,11 @@ def _Part_to_vertex(
819779
setv(
820780
to_object,
821781
['codeExecutionResult'],
822-
_CodeExecutionResult_to_vertex(
823-
getv(from_object, ['code_execution_result']), to_object
824-
),
782+
getv(from_object, ['code_execution_result']),
825783
)
826784

827785
if getv(from_object, ['executable_code']) is not None:
828-
setv(
829-
to_object,
830-
['executableCode'],
831-
_ExecutableCode_to_vertex(
832-
getv(from_object, ['executable_code']), to_object
833-
),
834-
)
786+
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
835787

836788
if getv(from_object, ['file_data']) is not None:
837789
setv(to_object, ['fileData'], getv(from_object, ['file_data']))

‎google/genai/models.py‎

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -207,27 +207,6 @@ def _CitationMetadata_from_mldev(
207207
return to_object
208208

209209

210-
def _CodeExecutionResult_to_vertex(
211-
from_object: Union[dict[str, Any], object],
212-
parent_object: Optional[dict[str, Any]] = None,
213-
root_object: Optional[Union[dict[str, Any], object]] = None,
214-
) -> dict[str, Any]:
215-
to_object: dict[str, Any] = {}
216-
if getv(from_object, ['outcome']) is not None:
217-
setv(to_object, ['outcome'], getv(from_object, ['outcome']))
218-
219-
if getv(from_object, ['output']) is not None:
220-
setv(to_object, ['output'], getv(from_object, ['output']))
221-
222-
if getv(from_object, ['id']) is not None:
223-
raise ValueError(
224-
'id parameter is only supported in Gemini Developer API mode, not in'
225-
' Gemini Enterprise Agent Platform mode.'
226-
)
227-
228-
return to_object
229-
230-
231210
def _ComputeTokensParameters_to_vertex(
232211
api_client: BaseApiClient,
233212
from_object: Union[dict[str, Any], object],
@@ -1172,27 +1151,6 @@ def _Endpoint_from_vertex(
11721151
return to_object
11731152

11741153

1175-
def _ExecutableCode_to_vertex(
1176-
from_object: Union[dict[str, Any], object],
1177-
parent_object: Optional[dict[str, Any]] = None,
1178-
root_object: Optional[Union[dict[str, Any], object]] = None,
1179-
) -> dict[str, Any]:
1180-
to_object: dict[str, Any] = {}
1181-
if getv(from_object, ['code']) is not None:
1182-
setv(to_object, ['code'], getv(from_object, ['code']))
1183-
1184-
if getv(from_object, ['language']) is not None:
1185-
setv(to_object, ['language'], getv(from_object, ['language']))
1186-
1187-
if getv(from_object, ['id']) is not None:
1188-
raise ValueError(
1189-
'id parameter is only supported in Gemini Developer API mode, not in'
1190-
' Gemini Enterprise Agent Platform mode.'
1191-
)
1192-
1193-
return to_object
1194-
1195-
11961154
def _FileData_to_mldev(
11971155
from_object: Union[dict[str, Any], object],
11981156
parent_object: Optional[dict[str, Any]] = None,
@@ -3726,19 +3684,11 @@ def _Part_to_vertex(
37263684
setv(
37273685
to_object,
37283686
['codeExecutionResult'],
3729-
_CodeExecutionResult_to_vertex(
3730-
getv(from_object, ['code_execution_result']), to_object, root_object
3731-
),
3687+
getv(from_object, ['code_execution_result']),
37323688
)
37333689

37343690
if getv(from_object, ['executable_code']) is not None:
3735-
setv(
3736-
to_object,
3737-
['executableCode'],
3738-
_ExecutableCode_to_vertex(
3739-
getv(from_object, ['executable_code']), to_object, root_object
3740-
),
3741-
)
3691+
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
37423692

37433693
if getv(from_object, ['file_data']) is not None:
37443694
setv(to_object, ['fileData'], getv(from_object, ['file_data']))

‎google/genai/tunings.py‎

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -138,27 +138,6 @@ def _CancelTuningJobResponse_from_vertex(
138138
return to_object
139139

140140

141-
def _CodeExecutionResult_to_vertex(
142-
from_object: Union[dict[str, Any], object],
143-
parent_object: Optional[dict[str, Any]] = None,
144-
root_object: Optional[Union[dict[str, Any], object]] = None,
145-
) -> dict[str, Any]:
146-
to_object: dict[str, Any] = {}
147-
if getv(from_object, ['outcome']) is not None:
148-
setv(to_object, ['outcome'], getv(from_object, ['outcome']))
149-
150-
if getv(from_object, ['output']) is not None:
151-
setv(to_object, ['output'], getv(from_object, ['output']))
152-
153-
if getv(from_object, ['id']) is not None:
154-
raise ValueError(
155-
'id parameter is only supported in Gemini Developer API mode, not in'
156-
' Gemini Enterprise Agent Platform mode.'
157-
)
158-
159-
return to_object
160-
161-
162141
def _CompositeReinforcementTuningRewardConfigWeightedRewardConfig_from_vertex(
163142
from_object: Union[dict[str, Any], object],
164143
parent_object: Optional[dict[str, Any]] = None,
@@ -1108,27 +1087,6 @@ def _EvaluationConfig_to_vertex(
11081087
return to_object
11091088

11101089

1111-
def _ExecutableCode_to_vertex(
1112-
from_object: Union[dict[str, Any], object],
1113-
parent_object: Optional[dict[str, Any]] = None,
1114-
root_object: Optional[Union[dict[str, Any], object]] = None,
1115-
) -> dict[str, Any]:
1116-
to_object: dict[str, Any] = {}
1117-
if getv(from_object, ['code']) is not None:
1118-
setv(to_object, ['code'], getv(from_object, ['code']))
1119-
1120-
if getv(from_object, ['language']) is not None:
1121-
setv(to_object, ['language'], getv(from_object, ['language']))
1122-
1123-
if getv(from_object, ['id']) is not None:
1124-
raise ValueError(
1125-
'id parameter is only supported in Gemini Developer API mode, not in'
1126-
' Gemini Enterprise Agent Platform mode.'
1127-
)
1128-
1129-
return to_object
1130-
1131-
11321090
def _GenerationConfig_from_vertex(
11331091
from_object: Union[dict[str, Any], object],
11341092
parent_object: Optional[dict[str, Any]] = None,
@@ -1517,19 +1475,11 @@ def _Part_to_vertex(
15171475
setv(
15181476
to_object,
15191477
['codeExecutionResult'],
1520-
_CodeExecutionResult_to_vertex(
1521-
getv(from_object, ['code_execution_result']), to_object, root_object
1522-
),
1478+
getv(from_object, ['code_execution_result']),
15231479
)
15241480

15251481
if getv(from_object, ['executable_code']) is not None:
1526-
setv(
1527-
to_object,
1528-
['executableCode'],
1529-
_ExecutableCode_to_vertex(
1530-
getv(from_object, ['executable_code']), to_object, root_object
1531-
),
1532-
)
1482+
setv(to_object, ['executableCode'], getv(from_object, ['executable_code']))
15331483

15341484
if getv(from_object, ['file_data']) is not None:
15351485
setv(to_object, ['fileData'], getv(from_object, ['file_data']))

0 commit comments

Comments
 (0)