Public
HTTP
nicoalbanese-tomatominnow.web.val.run
June 14, 2024
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" } });
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
June 14, 2024