Skip to content

Update Pydantic AI samples to non-deprecated google: model prefix#785

Merged
martin-martin merged 1 commit into
masterfrom
update-pydantic-ai-google-prefix
Jun 17, 2026
Merged

Update Pydantic AI samples to non-deprecated google: model prefix#785
martin-martin merged 1 commit into
masterfrom
update-pydantic-ai-google-prefix

Conversation

@lpozo

@lpozo lpozo commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

What

Update the Pydantic AI sample code to use the non-deprecated google: model prefix instead of google-gla:.

Pydantic AI renamed the Gemini API provider prefix. google-gla: still works in 1.x but now emits a PydanticAIDeprecationWarning and is removed in v2.0. The replacement for the free-tier Gemini API-key flow is google: (the google-cloud: prefix is the Vertex AI one, which these samples don't use). The gemini-2.5-flash model id is unchanged and still current on the Gemini API.

Per the Pydantic AI docs:

The 'google-gla:' and 'google-vertex:' prefixes still work in 1.x but emit a DeprecationWarning. Use 'google:' and 'google-cloud:' instead.

Files changed

  • pydantic-ai/first_agent.py
  • pydantic-ai/cats.py
  • pydantic-ai/city.py
  • pydantic-ai/users.py

(README.md has no model references.)

Context

This matches the corresponding fix applied to the Pydantic AI: Build Type-Safe LLM Agents in Python tutorial, and was flagged by a reader comment reporting the deprecation warning.

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.
@martin-martin martin-martin merged commit a568540 into master Jun 17, 2026
1 check passed
@martin-martin martin-martin deleted the update-pydantic-ai-google-prefix branch June 17, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants