1
2
3
4
5
6
7
8
9
10
import { openai } from "npm:@ai-sdk/openai";
import { StreamingTextResponse, streamText } from "npm:ai";
export default async function(req: Request): Promise<Response> {
const result = await streamText({
model: openai("gpt-4o"),
prompt: "Generate a fast recipe for Lasagna.",
});
return result.toTextStreamResponse({ headers: { "Content-Type": "text/event-stream" } });
}