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.contextSystemPrompt?(__namedParameters: Object) => string
init.retrieverBaseRetriever

Defined in

ChatEngine.ts:135

Properties

chatHistory

chatHistory: ChatMessage[]

Defined in

ChatEngine.ts:132


chatModel

chatModel: OpenAI

Defined in

ChatEngine.ts:131


contextSystemPrompt

contextSystemPrompt: (__namedParameters: Object) => string

Type declaration

▸ («destructured»): string

Parameters
NameType
«destructured»Object
Returns

string

Defined in

ChatEngine.ts:133


retriever

retriever: BaseRetriever

Defined in

ChatEngine.ts:130

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:149


reset

reset(): void

Resets the chat history so that it's empty.

Returns

void

Implementation of

ChatEngine.reset

Defined in

ChatEngine.ts:187