@@ -94,16 +94,14 @@ def _get_bytes_from_file(relative_path: str) -> bytes:
9494 exception_if_mldev = 'parameter is not supported' ,
9595 ),
9696 pytest_helper .TestTableItem (
97- name = 'test_vertex_new_api_text_only ' ,
97+ name = 'test_new_api_text_only ' ,
9898 parameters = types .EmbedContentParameters (
99- model = 'gemini-embedding-2-exp-11-2025 ' ,
99+ model = 'gemini-embedding-2-preview ' ,
100100 contents = t .t_contents ('What is your name?' ),
101101 config = {
102102 'output_dimensionality' : 100 ,
103103 },
104104 ),
105- # Model not exposed on MLDev.
106- exception_if_mldev = '404' ,
107105 ),
108106 pytest_helper .TestTableItem (
109107 name = 'test_vertex_new_api_maas' ,
@@ -120,9 +118,9 @@ def _get_bytes_from_file(relative_path: str) -> bytes:
120118 exception_if_mldev = '404' ,
121119 ),
122120 pytest_helper .TestTableItem (
123- name = 'test_vertex_new_api_gcs_image_and_config ' ,
121+ name = 'test_new_api_gcs_image_and_config ' ,
124122 parameters = types .EmbedContentParameters (
125- model = 'gemini-embedding-2-exp-11-2025 ' ,
123+ model = 'gemini-embedding-2-preview ' ,
126124 contents = [
127125 types .Content (
128126 parts = [
@@ -145,13 +143,11 @@ def _get_bytes_from_file(relative_path: str) -> bytes:
145143 },
146144 },
147145 ),
148- # Model not exposed on MLDev.
149- exception_if_mldev = '404' ,
150146 ),
151147 pytest_helper .TestTableItem (
152- name = 'test_vertex_new_api_inline_pdf ' ,
148+ name = 'test_new_api_inline_pdf ' ,
153149 parameters = types .EmbedContentParameters (
154- model = 'gemini-embedding-2-exp-11-2025 ' ,
150+ model = 'gemini-embedding-2-preview ' ,
155151 contents = [
156152 types .Content (
157153 parts = [
@@ -166,8 +162,6 @@ def _get_bytes_from_file(relative_path: str) -> bytes:
166162 'output_dimensionality' : 100 ,
167163 },
168164 ),
169- # Model not exposed on MLDev.
170- exception_if_mldev = '404' ,
171165 ),
172166 pytest_helper .TestTableItem (
173167 name = 'test_vertex_new_api_list_of_contents_error' ,
@@ -191,6 +185,28 @@ def _get_bytes_from_file(relative_path: str) -> bytes:
191185)
192186
193187
188+ def test_gemini_embedding_2_content_combination (client ):
189+ response = client .models .embed_content (
190+ model = 'gemini-embedding-2-preview' ,
191+ contents = [
192+ 'The jetpack is cool' ,
193+ types .Part .from_bytes (
194+ data = _get_bytes_from_file ('../data/checkerboard.png' ),
195+ mime_type = 'image/png' ,
196+ ),
197+ types .Part .from_uri (
198+ file_uri = 'gs://generativeai-downloads/images/scones.jpg' ,
199+ mime_type = 'image/jpeg' ,
200+ ),
201+ ],
202+ config = {'output_dimensionality' : 100 },
203+ )
204+ # assert has one total embedding
205+ assert response .embeddings is not None
206+ assert len (response .embeddings ) == 1
207+ assert len (response .embeddings [0 ].values ) == 100
208+
209+
194210@pytest .mark .asyncio
195211async def test_async (client ):
196212 response = await client .aio .models .embed_content (
@@ -203,10 +219,8 @@ async def test_async(client):
203219
204220@pytest .mark .asyncio
205221async def test_async_new_api (client ):
206- if not client .vertexai :
207- return
208222 response = await client .aio .models .embed_content (
209- model = 'gemini-embedding-2-exp-11-2025 ' ,
223+ model = 'gemini-embedding-2-preview ' ,
210224 contents = t .t_contents ('What is your name?' ),
211225 config = {'output_dimensionality' : 10 },
212226 )
0 commit comments