Skip to content

Conversation

@MAiKo26
Copy link

@MAiKo26 MAiKo26 commented Nov 2, 2025

Background

  • The example still used the old data stream protocol on the backend despite changing the package on the frontend so it's a missmatch
  • The example didn't show all possible ways of using the AI SDK with the new SSE Stream Protocol to do Tool Calls etc
  • The example still used the old openAI legacy API of completions instead of the new typesafe response API

Summary

  • On the Frontend I created a new Latest Next.js 16 project and used Vercel's AI Elements with shadcn and most importantly defined how we should declare the types for MessageUI for it to be typesafe for Custom Metadata, Tool Calls and Custom Data streamed in from the backend.
  • On the backend defined the MessageUI types then created an engine example to parse incoming openAI responses and stream them using the Stream Protocol SSE with typesafety in mind.

Manual Verification

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

Future Work

Related Issues

#7496 #6465

…V5 typesafety with the new data stream protocol in FastAPI
@gr2m gr2m added ai/provider documentation Improvements or additions to documentation provider/openai labels Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/provider documentation Improvements or additions to documentation provider/openai

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants