8000 Any way to integrate with Vercel AI SDK? · Issue #6103 · trpc/trpc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to integrate with Vercel AI SDK? #6103

Open
1 task
Bartek532 opened this issue Oct 11, 2024 · 2 comments
Open
1 task

Any way to integrate with Vercel AI SDK? #6103

Bartek532 opened this issue Oct 11, 2024 · 2 comments

Comments

@Bartek532
Copy link
Bartek532 commented Oct 11, 2024

Describe the feature you'd like to request

I'd like to integrate my tRPC serverless backend (made in Next.js) with Vercel AI SDK.

Describe the solution you'd like to see

As I can see there is a pretty straightforward to integrate Next.js API Route handler with this SDK, so I wonder if we can just replace it with tRPC?

image

Seems like it only requires appropriate response to be returned, but is it possible to do it with tRPC, as it transforms all the outputs?

Describe alternate solutions

We can use tRPC streaming together with the ai package, but then there is no possibility to use it together with hooks like useChat or useCompletion

Additional information

No response

👨‍👧‍👦 Contributing

  • 🙋‍♂️ Yes, I'd be down to file a PR implementing this feature!

Funding

  • You can sponsor this specific effort via a Polar.sh pledge below
  • We receive the pledge once the issue is completed & verified
Fund with Polar
@BeBoRE
Copy link
Contributor
BeBoRE commented Oct 11, 2024

You can do this with async generators https://trpc.io/docs/client/links/httpBatchStreamLink#generators

On the client-side this can be consumed with useQuery an array.

@Bartek532
Copy link
Author

You can do this with async generators https://trpc.io/docs/client/links/httpBatchStreamLink#generators

On the client-side this can be consumed with useQuery an array.

Yes, but can I plug it into Vercel AI SDK hooks somehow? Or I'm limited to Tanstack Query API?

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

No branches or pull requests

2 participants
0