@@ -249,10 +249,15 @@ def test_chat_google_genai_invoke_with_image(backend_config: dict) -> None:
249249 break
250250 assert isinstance (result , AIMessage )
251251 assert isinstance (result .content , list )
252- assert isinstance (result .content [0 ], str )
252+ if isinstance (result .content [0 ], dict ):
253+ assert result .content [0 ].get ("type" ) == "text"
254+ assert not result .content [0 ].get ("text" , "" ).startswith (" " )
255+ else :
256+ assert isinstance (result .content [0 ], str )
257+ assert not result .content [0 ].startswith (" " )
258+
253259 assert isinstance (result .content [1 ], dict )
254260 assert result .content [1 ].get ("type" ) == "image_url"
255- assert not result .content [0 ].startswith (" " )
256261 _check_usage_metadata (result )
257262
258263 # Test we can pass back in
@@ -276,7 +281,6 @@ def test_chat_google_genai_invoke_with_audio(backend_config: dict) -> None:
276281 """Test generating audio."""
277282 # Skip on Vertex AI - having some issues possibly upstream
278283 # TODO: look later
279- # https://discuss.ai.google.dev/t/request-allowlist-access-for-audio-output-in-gemini-2-5-pro-flash-tts-vertex-ai/108067
280284 if backend_config .get ("vertexai" ):
281285 pytest .skip ("Gemini TTS on Vertex AI requires allowlist access" )
282286
@@ -644,15 +648,24 @@ def test_chat_google_genai_invoke_thinking_disabled(backend_config: dict) -> Non
644648 """Test invoking a thinking model with zero `thinking_budget`."""
645649 # Note certain models may not allow `thinking_budget=0`
646650 llm = ChatGoogleGenerativeAI (
647- model = "gemini-2.5 -flash" , thinking_budget = 0 , ** backend_config
651+ model = "gemini-3 -flash-preview " , thinking_budget = 0 , ** backend_config
648652 )
649653
650654 result = llm .invoke (
651655 "How many O's are in Google? Please tell me how you double checked the result" ,
652656 )
653657
654658 assert isinstance (result , AIMessage )
655- assert isinstance (result .content , str )
659+
660+ if isinstance (result .content , list ):
661+ text_content = "" .join (
662+ block .get ("text" , "" )
663+ for block in result .content
664+ if isinstance (block , dict ) and block .get ("type" ) == "text"
665+ )
666+ assert len (text_content ) > 0
667+ else :
668+ assert isinstance (result .content , str )
656669
657670 _check_usage_metadata (result )
658671
@@ -1470,7 +1483,7 @@ class SimpleModel(BaseModel):
14701483 # Initialize with thinking disabled
14711484 # Only certain models support disabling thinking
14721485 llm = ChatGoogleGenerativeAI (
1473- model = "gemini-2.5 -flash" ,
1486+ model = "gemini-3 -flash-preview " ,
14741487 thinking_budget = 0 ,
14751488 include_thoughts = False ,
14761489 ** backend_config ,
@@ -1786,7 +1799,9 @@ class MatchResult(BaseModel):
17861799
17871800def test_search_with_googletool (backend_config : dict ) -> None :
17881801 """Test using `GoogleTool` with Google Search."""
1789- llm = ChatGoogleGenerativeAI (model = "models/gemini-2.5-flash" , ** backend_config )
1802+ llm = ChatGoogleGenerativeAI (
1803+ model = "models/gemini-3-flash-preview" , ** backend_config
1804+ )
17901805 resp = llm .invoke (
17911806 "When is the next total solar eclipse in US?" ,
17921807 tools = [GoogleTool (google_search = {})],
@@ -1812,7 +1827,7 @@ def test_url_context_tool(backend_config: dict) -> None:
18121827
18131828def test_google_maps_grounding (backend_config : dict ) -> None :
18141829 """Test using Google Maps grounding for location-aware responses."""
1815- model = ChatGoogleGenerativeAI (model = "gemini-2.5 -flash" , ** backend_config )
1830+ model = ChatGoogleGenerativeAI (model = "gemini-3 -flash-preview " , ** backend_config )
18161831 model_with_maps = model .bind_tools ([{"google_maps" : {}}])
18171832
18181833 response = model_with_maps .invoke (
@@ -1876,7 +1891,7 @@ def test_google_maps_grounding(backend_config: dict) -> None:
18761891
18771892def test_google_maps_grounding_invoke_direct (backend_config : dict ) -> None :
18781893 """Test passing Maps grounding tool directly to invoke without binding."""
1879- model = ChatGoogleGenerativeAI (model = "gemini-2.5 -flash" , ** backend_config )
1894+ model = ChatGoogleGenerativeAI (model = "gemini-3 -flash-preview " , ** backend_config )
18801895
18811896 # Pass tools directly to invoke instead of binding
18821897 response = model .invoke (
@@ -1994,8 +2009,7 @@ def test_chat_google_genai_invoke_with_generation_params(backend_config: dict) -
19942009 Verifies that `max_output_tokens` (max_tokens) and `thinking_budget`
19952010 parameters passed directly to invoke() method override model defaults.
19962011 """
1997- # Use gemini-2.5-flash because it supports thinking_budget=0
1998- llm = ChatGoogleGenerativeAI (model = "gemini-2.5-flash" , ** backend_config )
2012+ llm = ChatGoogleGenerativeAI (model = "gemini-3-flash-preview" , ** backend_config )
19992013
20002014 # Test with max_output_tokens constraint
20012015 result_constrained = llm .invoke (
@@ -2519,6 +2533,7 @@ def test_context_caching(backend_config: dict) -> None:
25192533 response = chat .invoke ("What is the secret number?" )
25202534
25212535 assert isinstance (response , AIMessage )
2536+
25222537 text_blocks = [b for b in response .content_blocks if b ["type" ] == "text" ]
25232538 assert any ("747" in b ["text" ] for b in text_blocks )
25242539
0 commit comments