v2.47.0

pydantic/pydantic-aiv2.47.0Sep 22, 2026by DouweM

Upgrading?

AI Summary

This release focuses on enhancing `TypeSafeModel` capabilities by expanding the field types it can answer, improving type safety for `UserPromptPart`, and fixing crashes related to tuple fields and rubric scoring.

Key Highlights

  • Enhanced `TypeSafeModel` to answer three more field types and handle `None` routes.
  • Fixed crashes by refusing tuple output fields and rubrics with more levels than scores.
  • Changed behavior to raise errors when `UserPromptPart.content` is not a string or sequence.
  • Updated dependency `ag-ui-protocol` to version `<1`.

Breaking Changes

  • Raises an error when `UserPromptPart.content` is not a `str` or sequence, instead of silently sending a `dict`'s keys.

New Features

  • Added support for `TypeSafeModel` to answer three more field types.
  • Enabled `TypeSafeModel` to pick `None` as a route.
  • Allowed `Choices` sets to describe themselves as `TypeSafeModel` routes.
  • Added recognition for `None` routes and options that carry a description.
  • Added naming of the picked route in the `TypeSafeModel` request.

Full Release Notes

<!-- Release notes generated using configuration in .github/release.yml at main -->

## What's Changed
### ⚠️ Compatibility Notes
* Name a `None` output route `None` rather than `NoneType` by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8590
* Raise when `UserPromptPart.content` is not a `str` or a sequence, instead of silently sending a `dict`'s keys by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8595
### 🚀 Features
* Ask three more field types `TypeSafeModel` can already answer by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8544
### 🐛 Bug Fixes
* Refuse a `tuple` output field and a self-contained model instead of crashing by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8537
* Refuse a rubric with more levels than Jev scores against by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8583
* Let `None` be a route `TypeSafeModel` can pick by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8540
* Let a `Choices` set describe itself as a `TypeSafeModel` route by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8541
* Recognise a `None` route and a `None` option that carry a description by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8598
* Name the picked route in the `TypeSafeModel` request that fills it by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8589
### 📦 Dependencies
* Pin `ag-ui-protocol` to `<1` by @adtyavrdhn in https://github.com/pydantic/pydantic-ai/pull/8579

## New Contributors
* @huynguyengl99 made their first contribution in https://github.com/pydantic/pydantic-ai/pull/8554
* @xyi74976-del made their first contribution in https://github.com/pydantic/pydantic-ai/pull/8560

**Full Changelog**: https://github.com/pydantic/pydantic-ai/compare/v2.46.0...v2.47.0

Related Repositories