Skip to content

Commit d788626

Browse files
hkt74copybara-github
authored andcommitted
feat!: Remove skip_project_and_location_in_path from async models.list
PiperOrigin-RevId: 720592971
1 parent c7dba47 commit d788626

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

google/genai/models.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from . import _extra_utils
2424
from . import _transformers as t
2525
from . import types
26-
from ._api_client import ApiClient, HttpOptionsDict
26+
from ._api_client import ApiClient
2727
from ._common import get_value_by_path as getv
2828
from ._common import set_value_by_path as setv
2929
from .pagers import AsyncPager, Pager
@@ -5739,13 +5739,7 @@ async def list(
57395739
)
57405740
if self._api_client.vertexai:
57415741
config = config.copy()
5742-
if config.query_base:
5743-
http_options = (
5744-
config.http_options if config.http_options else HttpOptionsDict()
5745-
)
5746-
http_options['skip_project_and_location_in_path'] = True
5747-
config.http_options = http_options
5748-
else:
5742+
if not config.query_base:
57495743
# Filter for tuning jobs artifacts by labels.
57505744
filter_value = config.filter
57515745
config.filter = (

google/genai/tests/models/test_list.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,18 @@ async def test_async_pager(client):
124124
pass
125125
with pytest.raises(IndexError, match='No more pages to fetch.'):
126126
await pager.next_page()
127+
128+
129+
@pytest.mark.asyncio
130+
async def test_base_models_async_pager(client):
131+
pager = await client.aio.models.list(config={'page_size': 10, 'query_base': True})
132+
133+
assert pager.name == 'models'
134+
assert pager.page_size == 10
135+
assert len(pager) <= 10
136+
137+
# Iterate through all the pages. Then next_page() should raise an exception.
138+
async for _ in pager:
139+
pass
140+
with pytest.raises(IndexError, match='No more pages to fetch.'):
141+
await pager.next_page()

0 commit comments

Comments
 (0)