본문으로 건너뛰기

Class: ChatHistory

A ChatHistory is used to keep the state of back and forth chat messages

Hierarchy

Constructors

constructor

new ChatHistory(): ChatHistory

Returns

ChatHistory

Accessors

messages

get messages(): ChatMessage[]

Returns

ChatMessage[]

Defined in

packages/core/src/ChatHistory.ts:11

Methods

addMessage

addMessage(message): void

Adds a message to the chat history.

Parameters

NameType
messageChatMessage

Returns

void

Defined in

packages/core/src/ChatHistory.ts:16


newMessages

newMessages(): ChatMessage[]

Returns the new messages since the last call to this function (or since calling the constructor)

Returns

ChatMessage[]

Defined in

packages/core/src/ChatHistory.ts:33


requestMessages

requestMessages(transientMessages?): Promise<ChatMessage[]>

Returns the messages that should be used as input to the LLM.

Parameters

NameType
transientMessages?ChatMessage[]

Returns

Promise<ChatMessage[]>

Defined in

packages/core/src/ChatHistory.ts:21


reset

reset(): void

Resets the chat history so that it's empty.

Returns

void

Defined in

packages/core/src/ChatHistory.ts:28