Skip to main content

Interface: ChatBotConfig

Defined in: chat-bot.ts:34

How a ChatBot keeps and shows its conversation.

Properties​

formatTimestamp?​

optional formatTimestamp?: (date) => string

Defined in: chat-bot.ts:79

Custom timestamp formatter for timestamped messages.

Parameters​

date​

Date

Returns​

string

Default​

(date) => [${date.toISOString()}]

Example​

const chat = ChatBot.forUser(myAgent, {
includeTimestamps: true,
formatTimestamp: (date) => `(${date.toLocaleTimeString()})`,
});

// Messages will look like:
// (10:30:00 AM) Hello, how can I help?

handlers?​

optional handlers?: TokenHandlers

Defined in: chat-bot.ts:36

Token handlers for every turn's events, called before a call's own onToken.


history?​

optional history?: History

Defined in: chat-bot.ts:42

History instance (defaults to in-memory history if not provided)


includeTimestamps?​

optional includeTimestamps?: boolean

Defined in: chat-bot.ts:61

When true, prefixes user and assistant message content with ISO 8601 timestamps.

Timestamps are applied when messages are retrieved for API calls, not when stored. Tool messages are never timestamped. Only the first assistant message per turn receives a timestamp (prevents duplicate timestamps in multi-message turns).

Default​

undefined (no timestamps)

Example​

const chat = ChatBot.forUser(myAgent, { includeTimestamps: true });

// Messages sent to LLM will look like:
// [2024-01-15T10:30:00.000Z] Hello, how can I help?

name?​

optional name?: string

Defined in: chat-bot.ts:39

Name for this chat. Default 'chat'.