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
Name | Type |
---|---|
init | Object |
init.chatHistory? | ChatMessage [] |
init.chatModel? | LLM |
init.contextSystemPrompt? | (__namedParameters : Object ) => string |
init.nodePostprocessors? | BaseNodePostprocessor [] |
init.retriever | BaseRetriever |
Defined in
packages/core/src/ChatEngine.ts:243
Properties
chatHistory
• chatHistory: ChatMessage
[]
Defined in
packages/core/src/ChatEngine.ts:240
chatModel
• chatModel: LLM
Defined in
packages/core/src/ChatEngine.ts:239
contextGenerator
• contextGenerator: ContextGenerator
Defined in
packages/core/src/ChatEngine.ts:241
Methods
chat
▸ chat<T
, R
>(message
, chatHistory?
, streaming?
): Promise
<R
>
Send message along with the class's current chat history to the LLM.
Type parameters
Name | Type |
---|---|
T | extends undefined | boolean = undefined |
R | T extends true ? AsyncGenerator <string , void , unknown > : Response |