Ga naar hoofdinhoud

Class: abstract ChatHistory<AdditionalMessageOptions>

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

Extended by

Type parameters

AdditionalMessageOptions extends object = object

Constructors

new ChatHistory()

new ChatHistory<AdditionalMessageOptions>(): ChatHistory<AdditionalMessageOptions>

Returns

ChatHistory<AdditionalMessageOptions>

Accessors

messages

get abstract messages(): ChatMessage<AdditionalMessageOptions>[]

Returns

ChatMessage<AdditionalMessageOptions>[]

Source

packages/llamaindex/src/ChatHistory.ts:14

Methods

addMessage()

abstract addMessage(message): void

Adds a message to the chat history.

Parameters

message: ChatMessage<AdditionalMessageOptions>

Returns

void

Source

packages/llamaindex/src/ChatHistory.ts:19


newMessages()

abstract newMessages(): ChatMessage<AdditionalMessageOptions>[]

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

Returns

ChatMessage<AdditionalMessageOptions>[]

Source

packages/llamaindex/src/ChatHistory.ts:36


requestMessages()

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

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

Parameters

transientMessages?: ChatMessage<AdditionalMessageOptions>[]

Returns

Promise <ChatMessage<AdditionalMessageOptions>[]>

Source

packages/llamaindex/src/ChatHistory.ts:24


reset()

abstract reset(): void

Resets the chat history so that it's empty.

Returns

void

Source

packages/llamaindex/src/ChatHistory.ts:31