Skip to content

Commit d8cdc89

Browse files
wanlin31copybara-github
authored andcommitted
test: add table_test and sample for lat/long field support.
PiperOrigin-RevId: 750384492
1 parent e277d3e commit d8cdc89

File tree

4 files changed

+98
-175
lines changed

4 files changed

+98
-175
lines changed

google/genai/caches.py

Lines changed: 3 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -283,33 +283,6 @@ def _FunctionCallingConfig_to_mldev(
283283
return to_object
284284

285285

286-
def _LatLng_to_mldev(
287-
api_client: BaseApiClient,
288-
from_object: Union[dict[str, Any], object],
289-
parent_object: Optional[dict[str, Any]] = None,
290-
) -> dict[str, Any]:
291-
to_object: dict[str, Any] = {}
292-
if getv(from_object, ['latitude']) is not None:
293-
raise ValueError('latitude parameter is not supported in Gemini API.')
294-
295-
if getv(from_object, ['longitude']) is not None:
296-
raise ValueError('longitude parameter is not supported in Gemini API.')
297-
298-
return to_object
299-
300-
301-
def _RetrievalConfig_to_mldev(
302-
api_client: BaseApiClient,
303-
from_object: Union[dict[str, Any], object],
304-
parent_object: Optional[dict[str, Any]] = None,
305-
) -> dict[str, Any]:
306-
to_object: dict[str, Any] = {}
307-
if getv(from_object, ['lat_lng']) is not None:
308-
raise ValueError('lat_lng parameter is not supported in Gemini API.')
309-
310-
return to_object
311-
312-
313286
def _ToolConfig_to_mldev(
314287
api_client: BaseApiClient,
315288
from_object: Union[dict[str, Any], object],
@@ -328,8 +301,8 @@ def _ToolConfig_to_mldev(
328301
)
329302

330303
if getv(from_object, ['retrieval_config']) is not None:
331-
raise ValueError(
332-
'retrieval_config parameter is not supported in Gemini API.'
304+
setv(
305+
to_object, ['retrievalConfig'], getv(from_object, ['retrieval_config'])
333306
)
334307

335308
return to_object
@@ -815,39 +788,6 @@ def _FunctionCallingConfig_to_vertex(
815788
return to_object
816789

817790

818-
def _LatLng_to_vertex(
819-
api_client: BaseApiClient,
820-
from_object: Union[dict[str, Any], object],
821-
parent_object: Optional[dict[str, Any]] = None,
822-
) -> dict[str, Any]:
823-
to_object: dict[str, Any] = {}
824-
if getv(from_object, ['latitude']) is not None:
825-
setv(to_object, ['latitude'], getv(from_object, ['latitude']))
826-
827-
if getv(from_object, ['longitude']) is not None:
828-
setv(to_object, ['longitude'], getv(from_object, ['longitude']))
829-
830-
return to_object
831-
832-
833-
def _RetrievalConfig_to_vertex(
834-
api_client: BaseApiClient,
835-
from_object: Union[dict[str, Any], object],
836-
parent_object: Optional[dict[str, Any]] = None,
837-
) -> dict[str, Any]:
838-
to_object: dict[str, Any] = {}
839-
if getv(from_object, ['lat_lng']) is not None:
840-
setv(
841-
to_object,
842-
['latLng'],
843-
_LatLng_to_vertex(
844-
api_client, getv(from_object, ['lat_lng']), to_object
845-
),
846-
)
847-
848-
return to_object
849-
850-
851791
def _ToolConfig_to_vertex(
852792
api_client: BaseApiClient,
853793
from_object: Union[dict[str, Any], object],
@@ -867,11 +807,7 @@ def _ToolConfig_to_vertex(
867807

868808
if getv(from_object, ['retrieval_config']) is not None:
869809
setv(
870-
to_object,
871-
['retrievalConfig'],
872-
_RetrievalConfig_to_vertex(
873-
api_client, getv(from_object, ['retrieval_config']), to_object
874-
),
810+
to_object, ['retrievalConfig'], getv(from_object, ['retrieval_config'])
875811
)
876812

877813
return to_object

google/genai/models.py

Lines changed: 3 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -316,33 +316,6 @@ def _FunctionCallingConfig_to_mldev(
316316
return to_object
317317

318318

319-
def _LatLng_to_mldev(
320-
api_client: BaseApiClient,
321-
from_object: Union[dict[str, Any], object],
322-
parent_object: Optional[dict[str, Any]] = None,
323-
) -> dict[str, Any]:
324-
to_object: dict[str, Any] = {}
325-
if getv(from_object, ['latitude']) is not None:
326-
raise ValueError('latitude parameter is not supported in Gemini API.')
327-
328-
if getv(from_object, ['longitude']) is not None:
329-
raise ValueError('longitude parameter is not supported in Gemini API.')
330-
331-
return to_object
332-
333-
334-
def _RetrievalConfig_to_mldev(
335-
api_client: BaseApiClient,
336-
from_object: Union[dict[str, Any], object],
337-
parent_object: Optional[dict[str, Any]] = None,
338-
) -> dict[str, Any]:
339-
to_object: dict[str, Any] = {}
340-
if getv(from_object, ['lat_lng']) is not None:
341-
raise ValueError('lat_lng parameter is not supported in Gemini API.')
342-
343-
return to_object
344-
345-
346319
def _ToolConfig_to_mldev(
347320
api_client: BaseApiClient,
348321
from_object: Union[dict[str, Any], object],
@@ -361,8 +334,8 @@ def _ToolConfig_to_mldev(
361334
)
362335

363336
if getv(from_object, ['retrieval_config']) is not None:
364-
raise ValueError(
365-
'retrieval_config parameter is not supported in Gemini API.'
337+
setv(
338+
to_object, ['retrievalConfig'], getv(from_object, ['retrieval_config'])
366339
)
367340

368341
return to_object
@@ -1458,39 +1431,6 @@ def _FunctionCallingConfig_to_vertex(
14581431
return to_object
14591432

14601433

1461-
def _LatLng_to_vertex(
1462-
api_client: BaseApiClient,
1463-
from_object: Union[dict[str, Any], object],
1464-
parent_object: Optional[dict[str, Any]] = None,
1465-
) -> dict[str, Any]:
1466-
to_object: dict[str, Any] = {}
1467-
if getv(from_object, ['latitude']) is not None:
1468-
setv(to_object, ['latitude'], getv(from_object, ['latitude']))
1469-
1470-
if getv(from_object, ['longitude']) is not None:
1471-
setv(to_object, ['longitude'], getv(from_object, ['longitude']))
1472-
1473-
return to_object
1474-
1475-
1476-
def _RetrievalConfig_to_vertex(
1477-
api_client: BaseApiClient,
1478-
from_object: Union[dict[str, Any], object],
1479-
parent_object: Optional[dict[str, Any]] = None,
1480-
) -> dict[str, Any]:
1481-
to_object: dict[str, Any] = {}
1482-
if getv(from_object, ['lat_lng']) is not None:
1483-
setv(
1484-
to_object,
1485-
['latLng'],
1486-
_LatLng_to_vertex(
1487-
api_client, getv(from_object, ['lat_lng']), to_object
1488-
),
1489-
)
1490-
1491-
return to_object
1492-
1493-
14941434
def _ToolConfig_to_vertex(
14951435
api_client: BaseApiClient,
14961436
from_object: Union[dict[str, Any], object],
@@ -1510,11 +1450,7 @@ def _ToolConfig_to_vertex(
15101450

15111451
if getv(from_object, ['retrieval_config']) is not None:
15121452
setv(
1513-
to_object,
1514-
['retrievalConfig'],
1515-
_RetrievalConfig_to_vertex(
1516-
api_client, getv(from_object, ['retrieval_config']), to_object
1517-
),
1453+
to_object, ['retrievalConfig'], getv(from_object, ['retrieval_config'])
15181454
)
15191455

15201456
return to_object

0 commit comments

Comments
 (0)