Skip to main content

Class: ContextChatEngine

ContextChatEngine uses the Index to get the appropriate context for each query. The context is stored in the system prompt, and the chat history is preserved, ideally allowing the appropriate context to be surfaced for each query.

Implements

Constructors

constructor

new ContextChatEngine(init)

Parameters

NameType
initObject
init.chatHistory?ChatMessage[]
init.chatModel?OpenAI
init.retrieverBaseRetriever

Defined in

ChatEngine.ts:133

Properties

chatHistory

chatHistory: ChatMessage[]

Defined in

ChatEngine.ts:131


chatModel

chatModel: OpenAI

Defined in

ChatEngine.ts:130


retriever

retriever: BaseRetriever

Defined in

ChatEngine.ts:129

Methods

chat

chat(message, chatHistory?): Promise<Response>

Send message along with the class's current chat history to the LLM.

Parameters

NameTypeDescription
messagestring
chatHistory?ChatMessage[]optional chat history if you want to customize the chat history

Returns

Promise<Response>

Implementation of

ChatEngine.chat

Defined in

ChatEngine.ts:144


reset

reset(): void

Resets the chat history so that it's empty.

Returns

void

Implementation of

ChatEngine.reset

Defined in

ChatEngine.ts:182