Skip to main content

Class: SimpleChatHistory

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

Extends

Constructors

new SimpleChatHistory()

new SimpleChatHistory(init?): SimpleChatHistory

Parameters

init?

init.messages?: ChatMessage[]

Returns

SimpleChatHistory

Overrides

ChatHistory.constructor

Defined in

packages/llamaindex/src/ChatHistory.ts:45

Properties

messages

messages: ChatMessage[]

Overrides

ChatHistory.messages

Defined in

packages/llamaindex/src/ChatHistory.ts:42

Methods

addMessage()

addMessage(message): void

Adds a message to the chat history.

Parameters

message: ChatMessage

Returns

void

Overrides

ChatHistory.addMessage

Defined in

packages/llamaindex/src/ChatHistory.ts:51


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/llamaindex/src/ChatHistory.ts:63


requestMessages()

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

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

Parameters

transientMessages?: ChatMessage[]

Returns

Promise<ChatMessage[]>

Overrides

ChatHistory.requestMessages

Defined in

packages/llamaindex/src/ChatHistory.ts:55


reset()

reset(): void

Resets the chat history so that it's empty.

Returns

void

Overrides

ChatHistory.reset

Defined in

packages/llamaindex/src/ChatHistory.ts:59