Files
LlamaIndexTS/apps/docs/docs/api/classes/ContextChatEngine.md
T
2023-07-21 09:33:00 -07:00

2.6 KiB

id, title, sidebar_label, sidebar_position, custom_edit_url
id title sidebar_label sidebar_position custom_edit_url
ContextChatEngine Class: ContextChatEngine ContextChatEngine 0 null

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? OpenAI
init.retriever BaseRetriever

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

Name Type Description
message string
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