Skip to content

Commit d67a07f

Browse files
committed
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.
1 parent 2a2dc85 commit d67a07f

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

pydantic-ai/cats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from pydantic_ai import Agent
33

44
agent = Agent(
5-
"google-gla:gemini-2.5-flash",
5+
"google:gemini-2.5-flash",
66
instructions="Help users with cat breeds. Be concise.",
77
)
88

pydantic-ai/city.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class CityInfo(BaseModel):
99
fun_fact: str
1010

1111

12-
agent = Agent("google-gla:gemini-2.5-flash", output_type=CityInfo)
12+
agent = Agent("google:gemini-2.5-flash", output_type=CityInfo)
1313

1414
result = agent.run_sync("Tell me about Tokyo")
1515
print(result.output)

pydantic-ai/first_agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from pydantic_ai import Agent
22

33
agent = Agent(
4-
"google-gla:gemini-2.5-flash",
4+
"google:gemini-2.5-flash",
55
instructions="You're a Python Expert. Reply in one sentence.",
66
)
77

pydantic-ai/users.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class UserSummary(BaseModel):
2121

2222

2323
agent = Agent(
24-
"google-gla:gemini-2.5-flash",
24+
"google:gemini-2.5-flash",
2525
output_type=UserSummary,
2626
deps_type=UserDatabase,
2727
instructions=(

0 commit comments

Comments
 (0)