본문으로 건너뛰기

Class: SimpleChatHistory

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

Hierarchy

Constructors

constructor

new SimpleChatHistory(init?): SimpleChatHistory

Parameters

NameType
init?Partial<SimpleChatHistory>

Returns

SimpleChatHistory

Overrides

ChatHistory.constructor

Defined in

packages/core/src/ChatHistory.ts:43

Properties

messages

messages: ChatMessage[]

Overrides

ChatHistory.messages

Defined in

packages/core/src/ChatHistory.ts:40


messagesBefore

Private messagesBefore: number

Defined in

packages/core/src/ChatHistory.ts:41

Methods

addMessage

addMessage(message): void

Adds a message to the chat history.

Parameters

NameType
messageChatMessage

Returns

void

Overrides

ChatHistory.addMessage

Defined in

packages/core/src/ChatHistory.ts:49


newMessages

newMessages(): ChatMessage[]

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

Returns

ChatMessage[]

Overrides

ChatHistory.newMessages

Defined in

packages/core/src/ChatHistory.ts:61


requestMessages

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

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

Parameters

NameType
transientMessages?ChatMessage[]

Returns

Promise<ChatMessage[]>

Overrides

ChatHistory.requestMessages

Defined in

packages/core/src/ChatHistory.ts:53


reset

reset(): void

Resets the chat history so that it's empty.

Returns

void

Overrides

ChatHistory.reset

Defined in

packages/core/src/ChatHistory.ts:57