From d67a07f8a5ad431eaab4f9c24329fd67411cb306 Mon Sep 17 00:00:00 2001 From: Leodanis Pozo Ramos Date: Wed, 17 Jun 2026 16:19:07 +0200 Subject: [PATCH] Update Pydantic AI samples to the non-deprecated google: model prefix Pydantic AI renamed the Gemini API provider prefix. google-gla: now emits a PydanticAIDeprecationWarning and is removed in v2.0, so switch the sample agents to the google: prefix (same free-tier Gemini API-key flow). The gemini-2.5-flash model id is unchanged and still current. Matches the corresponding fix in the Pydantic AI tutorial and was flagged by a reader comment. --- pydantic-ai/cats.py | 2 +- pydantic-ai/city.py | 2 +- pydantic-ai/first_agent.py | 2 +- pydantic-ai/users.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pydantic-ai/cats.py b/pydantic-ai/cats.py index f19de978be..c25fdd5c93 100644 --- a/pydantic-ai/cats.py +++ b/pydantic-ai/cats.py @@ -2,7 +2,7 @@ from pydantic_ai import Agent agent = Agent( - "google-gla:gemini-2.5-flash", + "google:gemini-2.5-flash", instructions="Help users with cat breeds. Be concise.", ) diff --git a/pydantic-ai/city.py b/pydantic-ai/city.py index 7b343cb275..1e43f99e56 100644 --- a/pydantic-ai/city.py +++ b/pydantic-ai/city.py @@ -9,7 +9,7 @@ class CityInfo(BaseModel): fun_fact: str -agent = Agent("google-gla:gemini-2.5-flash", output_type=CityInfo) +agent = Agent("google:gemini-2.5-flash", output_type=CityInfo) result = agent.run_sync("Tell me about Tokyo") print(result.output) diff --git a/pydantic-ai/first_agent.py b/pydantic-ai/first_agent.py index 32018fa766..499b923086 100644 --- a/pydantic-ai/first_agent.py +++ b/pydantic-ai/first_agent.py @@ -1,7 +1,7 @@ from pydantic_ai import Agent agent = Agent( - "google-gla:gemini-2.5-flash", + "google:gemini-2.5-flash", instructions="You're a Python Expert. Reply in one sentence.", ) diff --git a/pydantic-ai/users.py b/pydantic-ai/users.py index 81efb67c5a..85475ad99c 100644 --- a/pydantic-ai/users.py +++ b/pydantic-ai/users.py @@ -21,7 +21,7 @@ class UserSummary(BaseModel): agent = Agent( - "google-gla:gemini-2.5-flash", + "google:gemini-2.5-flash", output_type=UserSummary, deps_type=UserDatabase, instructions=(