BoundedChatTransport
Chat transport that keeps the context window bounded
Overview
A custom chat transport that sends only recent messages since the last summary, keeping the context window bounded. It pairs with AskAI via the chatTransport prop.
Type Definition
import type { UIMessage } from 'ai';
import { DefaultChatTransport } from 'ai';
export interface BoundedChatTransportOptions {
endpoint: string;
}
export declare class BoundedChatTransport extends DefaultChatTransport<UIMessage> {
constructor(options: BoundedChatTransportOptions);
}Usage
import { AskAI, BoundedChatTransport } from 'peam/client';
export default function Page() {
return (
<AskAI
chatTransport={
new BoundedChatTransport({
endpoint: '/api/peam',
})
}
/>
);
}Notes
- This is the default transport used by AskAI when
chatTransportis not provided. - It reads the summary markers in the request body to limit the message window.