DefaultChatRuntime
Default chat runtime implementation
Overview
The default implementation of ChatRuntime. It powers the server-side chat behavior, including streaming responses and request handling. For most cases, use createChat to configure it.
Type Definition
import type { ChatExecutionContext, ChatRuntime, ChatRuntimeOptions, ChatStreamInput } from 'peam/server';
import type { InferUIMessageChunk, UIMessage } from 'ai';
export declare class DefaultChatRuntime implements ChatRuntime {
constructor(options?: ChatRuntimeOptions);
stream(input: ChatStreamInput, context: ChatExecutionContext): ReadableStream<InferUIMessageChunk<UIMessage>>;
handler(request: Request): Promise<Response>;
}Usage
import { DefaultChatRuntime } from 'peam/server';
const runtime = new DefaultChatRuntime();
export const POST = runtime.handler;Notes
- If
searchIndexStoreis not provided, it uses a file-based store at.peam/index.json. - The handler expects the
ChatRequestBodypayload (see createChat). - Summarization defaults to WindowedConversationSummarizer.