createChat
Next.js-aware chat runtime factory
Overview
Creates a chat runtime that automatically injects the searchIndexStore resolved by withPeam. It pairs with the route handler export.
Type Definition
import type { ChatRuntimeOptions, DefaultChatRuntime } from 'peam/server';
export declare function createChat(options?: ChatRuntimeOptions): DefaultChatRuntime;Usage
import { createChat } from '@peam-ai/next/route';
import { openai } from '@ai-sdk/openai';
export const POST = createChat({
model: openai('gpt-4o-mini'),
}).handler;Notes
- withPeam must run during build so
searchIndexStorecan be resolved. - You can override
searchIndexStoreby passing it inoptions.