From 00af60327636e77d211069d9bc155e859f8fe4f5 Mon Sep 17 00:00:00 2001 From: Jennifer Davis Date: Sat, 24 Oct 2026 17:47:44 +0000 Subject: [PATCH 1/2] fix(genai): update 5 samples to gemini-3.8-flash and remove deprecated temperature=0 Update five Google GenAI SDK samples (`ctrlgen_with_class_schema.py`, `counttoken_with_txt.py`, `textgen_chat_with_txt.py`, `textgen_with_txt.py`, and `tools_func_def_with_txt.py`) to use the latest `gemini-3.8-flash` model. In `genai/tools/tools_func_def_with_txt.py`, remove `temperature=0` from `GenerateContentConfig`, as setting temperature below 1.0 is deprecated for Gemini 3.x models. Also update `genai/tools/test_tools_examples.py` to use `GOOGLE_CLOUD_LOCATION = "global"` and `genai/tools/requirements.txt` to `google-genai==2.29.0` for consistency with the other `genai/` test suites. --- genai/controlled_generation/ctrlgen_with_class_schema.py | 2 +- genai/count_tokens/counttoken_with_txt.py | 2 +- genai/text_generation/textgen_chat_with_txt.py | 2 +- genai/text_generation/textgen_with_txt.py | 2 +- genai/tools/requirements.txt | 2 +- genai/tools/test_tools_examples.py | 3 +-- genai/tools/tools_func_def_with_txt.py | 3 +-- 7 files changed, 7 insertions(+), 9 deletions(-) diff --git a/genai/controlled_generation/ctrlgen_with_class_schema.py b/genai/controlled_generation/ctrlgen_with_class_schema.py index 51effae1c57..3ed506a91a7 100644 --- a/genai/controlled_generation/ctrlgen_with_class_schema.py +++ b/genai/controlled_generation/ctrlgen_with_class_schema.py @@ -25,7 +25,7 @@ class Recipe(BaseModel): client = genai.Client(http_options=HttpOptions(api_version="v1")) response = client.models.generate_content( - model="gemini-3.5-flash", + model="gemini-3.8-flash", contents="List a few popular cookie recipes.", config=GenerateContentConfig( response_mime_type="application/json", diff --git a/genai/count_tokens/counttoken_with_txt.py b/genai/count_tokens/counttoken_with_txt.py index 7eb37a8d2ab..f3a885314cc 100644 --- a/genai/count_tokens/counttoken_with_txt.py +++ b/genai/count_tokens/counttoken_with_txt.py @@ -20,7 +20,7 @@ def count_tokens() -> int: client = genai.Client(http_options=HttpOptions(api_version="v1")) response = client.models.count_tokens( - model="gemini-3.5-flash", + model="gemini-3.8-flash", contents="What's the highest mountain in Africa?", ) print(response) diff --git a/genai/text_generation/textgen_chat_with_txt.py b/genai/text_generation/textgen_chat_with_txt.py index 36e13e81e56..6e8859b7662 100644 --- a/genai/text_generation/textgen_chat_with_txt.py +++ b/genai/text_generation/textgen_chat_with_txt.py @@ -20,7 +20,7 @@ def generate_content() -> str: client = genai.Client(http_options=HttpOptions(api_version="v1")) chat_session = client.chats.create( - model="gemini-3.5-flash", + model="gemini-3.8-flash", history=[ UserContent(parts=[Part(text="Hello")]), ModelContent( diff --git a/genai/text_generation/textgen_with_txt.py b/genai/text_generation/textgen_with_txt.py index 4825aac9212..3273635f086 100644 --- a/genai/text_generation/textgen_with_txt.py +++ b/genai/text_generation/textgen_with_txt.py @@ -20,7 +20,7 @@ def generate_content() -> str: client = genai.Client(http_options=HttpOptions(api_version="v1")) response = client.models.generate_content( - model="gemini-3.5-flash", + model="gemini-3.8-flash", contents="How does AI work?", ) print(response.text) diff --git a/genai/tools/requirements.txt b/genai/tools/requirements.txt index b82955a5518..c1de7bb1963 100644 --- a/genai/tools/requirements.txt +++ b/genai/tools/requirements.txt @@ -1,3 +1,3 @@ -google-genai==1.45.0 +google-genai==2.29.0 # PIl is required for tools_code_execution_with_txt_img.py pillow==12.3.0; python_version >= "3.10" diff --git a/genai/tools/test_tools_examples.py b/genai/tools/test_tools_examples.py index c368dba92bf..26dd3e5d31e 100644 --- a/genai/tools/test_tools_examples.py +++ b/genai/tools/test_tools_examples.py @@ -43,7 +43,7 @@ import tools_vais_with_txt os.environ["GOOGLE_GENAI_USE_ENTERPRISE"] = "True" -os.environ["GOOGLE_CLOUD_LOCATION"] = "us-central1" +os.environ["GOOGLE_CLOUD_LOCATION"] = "global" # The project name is included in the CICD pipeline # os.environ['GOOGLE_CLOUD_PROJECT'] = "add-your-project-name" @@ -144,4 +144,3 @@ def test_tools_interactions_urlcontext_with_txt() -> None: def test_tools_interactions_google_search_and_urlcontext_with_txt() -> None: assert tools_interactions_google_search_and_urlcontext_with_txt.create_interaction() - diff --git a/genai/tools/tools_func_def_with_txt.py b/genai/tools/tools_func_def_with_txt.py index 98581a43fcc..90a0dda58cd 100644 --- a/genai/tools/tools_func_def_with_txt.py +++ b/genai/tools/tools_func_def_with_txt.py @@ -34,14 +34,13 @@ def get_current_weather(location: str) -> str: return weather_map.get(location, "unknown") client = genai.Client(http_options=HttpOptions(api_version="v1")) - model_id = "gemini-3.5-flash" + model_id = "gemini-3.8-flash" response = client.models.generate_content( model=model_id, contents="What is the weather like in Boston?", config=GenerateContentConfig( tools=[get_current_weather], - temperature=0, ), ) From 59825241682cbeb68cda236800c29125e671b242 Mon Sep 17 00:00:00 2001 From: Jennifer Davis Date: Mon, 26 Oct 2026 22:36:27 +0000 Subject: [PATCH 2/2] chore(genai): bump pytest-asyncio to 1.4.0 across genai requirements-test.txt Problem: Several genai/*/requirements-test.txt files pinned pytest==9.0.3 alongside pytest-asyncio==0.23.6. Because pytest-asyncio==0.23.6 specifies an upper bound of pytest<9,>=7.0.0, installing requirements-test.txt fails with a dependency resolution conflict. Solution: Update pytest-asyncio from 0.23.6 to 1.4.0 across all six affected genai/*/requirements-test.txt files (controlled_generation, count_tokens, model_optimizer, template_folder, thinking, and tools) to support pytest>=9. --- genai/controlled_generation/requirements-test.txt | 2 +- genai/count_tokens/requirements-test.txt | 2 +- genai/model_optimizer/requirements-test.txt | 2 +- genai/template_folder/requirements-test.txt | 2 +- genai/thinking/requirements-test.txt | 2 +- genai/tools/requirements-test.txt | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/genai/controlled_generation/requirements-test.txt b/genai/controlled_generation/requirements-test.txt index baa23bf9c3e..63dd92c4969 100644 --- a/genai/controlled_generation/requirements-test.txt +++ b/genai/controlled_generation/requirements-test.txt @@ -1,4 +1,4 @@ backoff==2.2.1 google-api-core==2.19.0 pytest==9.0.3; python_version >= "3.10" -pytest-asyncio==0.23.6 +pytest-asyncio==1.4.0 diff --git a/genai/count_tokens/requirements-test.txt b/genai/count_tokens/requirements-test.txt index baa23bf9c3e..63dd92c4969 100644 --- a/genai/count_tokens/requirements-test.txt +++ b/genai/count_tokens/requirements-test.txt @@ -1,4 +1,4 @@ backoff==2.2.1 google-api-core==2.19.0 pytest==9.0.3; python_version >= "3.10" -pytest-asyncio==0.23.6 +pytest-asyncio==1.4.0 diff --git a/genai/model_optimizer/requirements-test.txt b/genai/model_optimizer/requirements-test.txt index baa23bf9c3e..63dd92c4969 100644 --- a/genai/model_optimizer/requirements-test.txt +++ b/genai/model_optimizer/requirements-test.txt @@ -1,4 +1,4 @@ backoff==2.2.1 google-api-core==2.19.0 pytest==9.0.3; python_version >= "3.10" -pytest-asyncio==0.23.6 +pytest-asyncio==1.4.0 diff --git a/genai/template_folder/requirements-test.txt b/genai/template_folder/requirements-test.txt index baa23bf9c3e..63dd92c4969 100644 --- a/genai/template_folder/requirements-test.txt +++ b/genai/template_folder/requirements-test.txt @@ -1,4 +1,4 @@ backoff==2.2.1 google-api-core==2.19.0 pytest==9.0.3; python_version >= "3.10" -pytest-asyncio==0.23.6 +pytest-asyncio==1.4.0 diff --git a/genai/thinking/requirements-test.txt b/genai/thinking/requirements-test.txt index baa23bf9c3e..63dd92c4969 100644 --- a/genai/thinking/requirements-test.txt +++ b/genai/thinking/requirements-test.txt @@ -1,4 +1,4 @@ backoff==2.2.1 google-api-core==2.19.0 pytest==9.0.3; python_version >= "3.10" -pytest-asyncio==0.23.6 +pytest-asyncio==1.4.0 diff --git a/genai/tools/requirements-test.txt b/genai/tools/requirements-test.txt index baa23bf9c3e..63dd92c4969 100644 --- a/genai/tools/requirements-test.txt +++ b/genai/tools/requirements-test.txt @@ -1,4 +1,4 @@ backoff==2.2.1 google-api-core==2.19.0 pytest==9.0.3; python_version >= "3.10" -pytest-asyncio==0.23.6 +pytest-asyncio==1.4.0