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 chunk: ChatResponseChunk, nodes?: NodeWithScore<import("/Users/marcus/code/llamaindex/LlamaIndexTS/packages/core/src/Node").Metadata>[], nodes?: NodeWithScore<import("/Users/marcus/code/llamaindex/LlamaIndexTS/packages/core/src/Node").Metadata>[]lowing the appropriate context to be surfaced for each query.
Extends
Implements
Constructors
new ContextChatEngine()
new ContextChatEngine(
init
):ContextChatEngine
Parameters
• init
• init.chatHistory?: ChatMessage
[]
• init.chatModel?: LLM
<object
, object
>
• init.contextRole?: MessageType
• init.contextSystemPrompt?: ContextSystemPrompt
• init.nodePostprocessors?: BaseNodePostprocessor
[]
• init.retriever: BaseRetriever
• init.systemPrompt?: string
Returns
Overrides
Defined in
packages/core/chat-engine/dist/index.d.ts:51
Properties
chatModel
chatModel:
LLM
<object
,object
>
Defined in
packages/core/chat-engine/dist/index.d.ts:46
contextGenerator
contextGenerator:
ContextGenerator
&PromptMixin
Defined in
packages/core/chat-engine/dist/index.d.ts:48
memory
memory:
BaseMemory
<object
>
Defined in
packages/core/chat-engine/dist/index.d.ts:47
systemPrompt?
optional
systemPrompt:string
Defined in
packages/core/chat-engine/dist/index.d.ts:49
Accessors
chatHistory
Get Signature
get chatHistory():
ChatMessage
<object
>[] |Promise
<ChatMessage
<object
>[]>
Returns
ChatMessage
<object
>[] | Promise
<ChatMessage
<object
>[]>
Implementation of
Defined in
packages/core/chat-engine/dist/index.d.ts:50
Methods
_getPromptModules()
protected
_getPromptModules():ModuleRecord
Return a dictionary of sub-modules within the current module that also implement PromptMixin (so that their prompts can also be get/set).
Can be blank if no sub-modules.
Returns
Overrides
Defined in
packages/core/chat-engine/dist/index.d.ts:64
_getPrompts()
protected
_getPrompts():PromptsRecord
Returns
Overrides
Defined in
packages/core/chat-engine/dist/index.d.ts:60
_updatePrompts()
protected
_updatePrompts(prompts
):void
Parameters
• prompts
• prompts.contextSystemPrompt: ContextSystemPrompt
Returns
void
Overrides
Defined in
packages/core/chat-engine/dist/index.d.ts:61
chat()
chat(params)
chat(
params
):Promise
<EngineResponse
>
Parameters
• params: NonStreamingChatEngineParams
<object
, object
>
Returns
Promise
<EngineResponse
>
Implementation of
Defined in
packages/core/chat-engine/dist/index.d.ts:65
chat(params)
chat(
params
):Promise
<AsyncIterable
<EngineResponse
,any
,any
>>
Parameters
• params: StreamingChatEngineParams
<object
, object
>
Returns
Promise
<AsyncIterable
<EngineResponse
, any
, any
>>
Implementation of
Defined in
packages/core/chat-engine/dist/index.d.ts:66
getPrompts()
getPrompts():
PromptsRecord
Returns
Inherited from
Defined in
packages/core/prompts/dist/index.d.ts:66
reset()
reset():
void
Returns
void
Defined in
packages/core/chat-engine/dist/index.d.ts:67
updatePrompts()
updatePrompts(
prompts
):void
Parameters
• prompts: PromptsRecord
Returns
void
Inherited from
Defined in
packages/core/prompts/dist/index.d.ts:67
validatePrompts()
validatePrompts(
promptsDict
,moduleDict
):void
Parameters
• promptsDict: PromptsRecord
• moduleDict: ModuleRecord
Returns
void
Inherited from
Defined in
packages/core/prompts/dist/index.d.ts:65