Replies: 1 comment
-
I think just returning it as normal to use app.get("/ai", () => {
const result = await streamObject({
schema: vacationSchema,
output: "array",
model: openai("gpt-4o-mini"),
prompt: "Generate 3 vacation destinations",
});
return result.toTextStreamResponse();
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there 👋,
I'm trying to use the "streamObject" in a Hono API from a React App.
Most examples (express, Next.js) make use of the "toTextStreamResponse()" that directly works along the "useObject" React hook.
Any guidance on how to make this work?
Docs:
https://sdk.vercel.ai/examples/next/basics/streaming-object-generation
Here's a working repo in Next.js:
https://github.com/vercel-labs/ai-sdk-preview-array-output-mode/blob/main/app/(preview)/api/array/route.ts
Thanks so much in advance ❤️
Beta Was this translation helpful? Give feedback.
All reactions