GenkitG
Genkit12mo ago
3 replies
nursing-lime

NextJS streaming

Post request is giving error for genkit streaming in nextjs
import { MessageData } from "genkit";
import { ai } from "./flows/init";

export async function POST(req: Request) {
  const { messages } = (await req.json()) as {
    messages: MessageData[] | undefined;
  };
  
  const { response, stream } = await ai.generateStream({
    prompt: 'You are friendly bot',
    messages,
  });
  console.log(response, stream);
  console.log('hey')

  return stream;
}
Was this page helpful?