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 |
Parameters
Name | Type | Description |
---|---|---|
message | MessageContent | |
chatHistory? | ChatMessage [] | optional chat history if you want to customize the chat history |
streaming? | T | optional streaming flag, which auto-sets the return value if True. |
Returns
Promise
<R
>
Implementation of
Defined in
packages/core/src/ChatEngine.ts:259
reset
▸ reset(): void
Resets the chat history so that it's empty.