Skip to content

update fastapi example and documentation #7496

@0x4bs3nt

Description

@0x4bs3nt

Description

The data streaming option when working with the V5 AI SDK seems to not work at all.

I have tried a lot of things and could not get anything working with a FastAPI backend and using useChat with the V5 on the frontend.

It seems to work well when using the text protocol, but the data protocol does not work at all.

From what I found there are 2 examples of how to implement it using FastAPI.
One of those; https://github.com/vercel-labs/ai-sdk-preview-python-streaming, is using the V4, and the other; https://github.com/vercel/ai/tree/main/examples/next-fastapi just doesn't work.

I pulled and tested locally the https://github.com/vercel/ai/tree/main/examples/next-fastapi repository and not only do the Pydantic models not reflect the V5 changes, but when fixing those issues and trying the data protocol, it just doesn't work.

Is this not supported yet, is the documentation lacking, is there any working example of V5 and FastAPI?

AI SDK Version

  • ai: "^5.0.0-beta.25"
  • @ai-sdk/openai: "^2.0.0-beta.11",
  • @ai-sdk/react: "^2.0.0-beta.25",

Metadata

Metadata

Labels

ai/providerrelated to a provider package. Must be assigned together with at least one `provider/*` labelai/uianything UI relatedprovider/openaiIssues related to the @ai-sdk/openai providersupport

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions