Skip to content

Conversation

@jakobhoeg
Copy link
Contributor

@jakobhoeg jakobhoeg commented Jan 18, 2026

This PR adds a Next.js example application of how to use Transformers.js models that support tool-calling with the Vercel AI SDK v6 (I also renamed the old next-vercel-ai-sdk to next-vercel-ai-sdk-v5).
It uses @browser-ai that acts as a Transformers.js model provider for the Vercel AI SDK, enabling seamless tool-call management.

The internals of the provider handles incremental streaming that detects which tool is being called before the model finishes generating arguments, which is like how native cloud-based API's handle tool-call streaming.
It also automatically handles different model tool-call outputs, such as XML tags (<tool_call>) and Python-style ([functionName(args)]) syntax, which enhances the Developer Experience dramatically. Easily switch between Qwen3, LFM2, Granite models without introducing a bunch of boilerplate code.

On the UI side, it also allows for HITL (human in the loop) tool-calls by just setting a simple needsApproval flag in the tool-call schema.

@xenova let me know if anything needs to be changed :)

Demo:

demooo.mp4

@xenova
Copy link
Collaborator

xenova commented Jan 23, 2026

Wow that's really cool! I'm sure @nico-martin will be interested too.

@jakobhoeg
Copy link
Contributor Author

Thank you, @xenova!

Hopefully I can get the internals updated to use Transformers.js v4 too when it's released :)

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.

3 participants