diff --git a/google/genai/models.py b/google/genai/models.py index 0f3c2008..41e29c7a 100644 --- a/google/genai/models.py +++ b/google/genai/models.py @@ -23,7 +23,7 @@ from . import _extra_utils from . import _transformers as t from . import types -from ._api_client import ApiClient, HttpOptionsDict +from ._api_client import ApiClient from ._common import get_value_by_path as getv from ._common import set_value_by_path as setv from .pagers import AsyncPager, Pager @@ -5739,13 +5739,7 @@ async def list( ) if self._api_client.vertexai: config = config.copy() - if config.query_base: - http_options = ( - config.http_options if config.http_options else HttpOptionsDict() - ) - http_options['skip_project_and_location_in_path'] = True - config.http_options = http_options - else: + if not config.query_base: # Filter for tuning jobs artifacts by labels. filter_value = config.filter config.filter = ( diff --git a/google/genai/tests/models/test_list.py b/google/genai/tests/models/test_list.py index 6e16a262..03cb2d40 100644 --- a/google/genai/tests/models/test_list.py +++ b/google/genai/tests/models/test_list.py @@ -124,3 +124,18 @@ async def test_async_pager(client): pass with pytest.raises(IndexError, match='No more pages to fetch.'): await pager.next_page() + + +@pytest.mark.asyncio +async def test_base_models_async_pager(client): + pager = await client.aio.models.list(config={'page_size': 10, 'query_base': True}) + + assert pager.name == 'models' + assert pager.page_size == 10 + assert len(pager) <= 10 + + # Iterate through all the pages. Then next_page() should raise an exception. + async for _ in pager: + pass + with pytest.raises(IndexError, match='No more pages to fetch.'): + await pager.next_page()