Skip to main content

Interface: ChatBotConfig

Defined in: chat/src/chat-bot.ts:157

Configuration for ChatBot

Properties

formatTimestamp?

optional formatTimestamp?: (date) => string

Defined in: chat/src/chat-bot.ts:215

Custom timestamp formatter for timestamped messages.

Parameters

date

Date

The message timestamp as a Date object

Returns

string

Formatted timestamp string to prefix the message content

Default

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

Example

const bot = ChatBot.create({
participants: [new UserInput(), 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/src/chat-bot.ts:165

Token handlers for streaming events


history?

optional history?: History

Defined in: chat/src/chat-bot.ts:171

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


includeTimestamps?

optional includeTimestamps?: boolean

Defined in: chat/src/chat-bot.ts:193

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 bot = ChatBot.create({
participants: [new UserInput(), myAgent],
includeTimestamps: true,
});

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

maxTurns?

optional maxTurns?: number

Defined in: chat/src/chat-bot.ts:162

Maximum number of turns before stopping (default: Infinity)


name?

optional name?: string

Defined in: chat/src/chat-bot.ts:168

Custom name for this chat


participants

participants: Processable<unknown, unknown>[]

Defined in: chat/src/chat-bot.ts:159

Participants in the conversation (UserInput, Agents, etc.)