Support Vercel AI Data Stream Protocol

Merged
SA
1y ago
+8328-1301

To do:


This adds support for Vercel AI Elements streams to Pydantic AI.

There's an example frontend in a separate repo github.com/pydantic/pydantic-ai-chat the plan is to either make that into a more complete template, or release a pydantic-ai-chat python library which contains a pre-built react frontend.

@DouweM we should rename this to use the proper terminology of the "Vercel AI Data Stream Protocol"

Here's a demo of basic usage:

https://github.com/user-attachments/assets/284b72bb-2303-4faf-8a5b-e041603c4bc7