Skip to main content

Class: CondenseQuestionChatEngine

CondenseQuestionChatEngine is used in conjunction with a Index (for example VectorStoreIndex). It does two steps on taking a user's chat message: first, it condenses the chat message with the previous chat history into a question with more context. Then, it queries the underlying Index using the new question with context and returns the response. CondenseQuestionChatEngine performs well when the input is primarily questions about the underlying data. It performs less well when the chat messages are not questions about the data, or are very referential to previous context.

Extends

Constructors

new CondenseQuestionChatEngine()

new CondenseQuestionChatEngine(init): CondenseQuestionChatEngine

Parameters

init

init.chatHistory: ChatMessage[]

init.condenseMessagePrompt?: CondenseQuestionPrompt

init.queryEngine: BaseQueryEngine

init.serviceContext?: ServiceContext

Returns

CondenseQuestionChatEngine

Overrides

BaseChatEngine.constructor

Defined in

packages/llamaindex/src/engines/chat/CondenseQuestionChatEngine.ts:44

Properties

condenseMessagePrompt

condenseMessagePrompt: CondenseQuestionPrompt

Defined in

packages/llamaindex/src/engines/chat/CondenseQuestionChatEngine.ts:38


llm

llm: LLM<object, object>

Defined in

packages/llamaindex/src/engines/chat/CondenseQuestionChatEngine.ts:37


memory

memory: BaseMemory<object>

Defined in

packages/llamaindex/src/engines/chat/CondenseQuestionChatEngine.ts:36


queryEngine

queryEngine: BaseQueryEngine

Defined in

packages/llamaindex/src/engines/chat/CondenseQuestionChatEngine.ts:35

Accessors

chatHistory

get chatHistory(): ChatMessage<object>[] | Promise<ChatMessage<object>[]>

Returns

ChatMessage<object>[] | Promise<ChatMessage<object>[]>

Overrides

BaseChatEngine.chatHistory

Defined in

packages/llamaindex/src/engines/chat/CondenseQuestionChatEngine.ts:40

Methods

_getPromptModules()

protected _getPromptModules(): ModuleRecord

Returns

ModuleRecord

Defined in

packages/llamaindex/src/engines/chat/CondenseQuestionChatEngine.ts:61


_getPrompts()

protected _getPrompts(): object

Returns

object

condenseMessagePrompt

condenseMessagePrompt: CondenseQuestionPrompt

Defined in

packages/llamaindex/src/engines/chat/CondenseQuestionChatEngine.ts:65


_updatePrompts()

protected _updatePrompts(promptsDict): void

Parameters

promptsDict

promptsDict.condenseMessagePrompt: CondenseQuestionPrompt

Returns

void

Defined in

packages/llamaindex/src/engines/chat/CondenseQuestionChatEngine.ts:71


chat()

chat(params)

chat(params): Promise<EngineResponse>

Parameters

params: NonStreamingChatEngineParams<object>

Returns

Promise<EngineResponse>

Overrides

BaseChatEngine.chat

Defined in

packages/llamaindex/src/engines/chat/CondenseQuestionChatEngine.ts:90

chat(params)

chat(params): Promise<AsyncIterable<EngineResponse, any, any>>

Parameters

params: StreamingChatEngineParams<object>

Returns

Promise<AsyncIterable<EngineResponse, any, any>>

Overrides

BaseChatEngine.chat

Defined in

packages/llamaindex/src/engines/chat/CondenseQuestionChatEngine.ts:91


reset()

reset(): void

Returns

void

Defined in

packages/llamaindex/src/engines/chat/CondenseQuestionChatEngine.ts:139