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.
Hierarchy
-
↳
CondenseQuestionChatEngine
Implements
Constructors
constructor
• new CondenseQuestionChatEngine(init
): CondenseQuestionChatEngine
Parameters
Name | Type |
---|---|
init | Object |
init.chatHistory | ChatMessage [] |
init.condenseMessagePrompt? | (__namedParameters : { chatHistory : undefined | string = ""; question : undefined | string = "" }) => string |
init.queryEngine | BaseQueryEngine |
init.serviceContext? | ServiceContext |
Returns
Overrides
Defined in
packages/core/src/engines/chat/CondenseQuestionChatEngine.ts:41
Properties
chatHistory
• chatHistory: ChatHistory
Defined in
packages/core/src/engines/chat/CondenseQuestionChatEngine.ts:37
condenseMessagePrompt
• condenseMessagePrompt: (__namedParameters
: { chatHistory
: undefined
| string
= ""; question
: undefined
| string
= "" }) => string
Type declaration
▸ («destructured»
): string
Parameters
Name | Type | Default value |
---|---|---|
«destructured» | Object | undefined |
› chatHistory | undefined | string | "" |
› question | undefined | string | "" |
Returns
string
Defined in
packages/core/src/engines/chat/CondenseQuestionChatEngine.ts:39
llm
• llm: LLM
<Record
<string
, unknown
>>
Defined in
packages/core/src/engines/chat/CondenseQuestionChatEngine.ts:38
queryEngine
• queryEngine: BaseQueryEngine
Defined in
packages/core/src/engines/chat/CondenseQuestionChatEngine.ts:36
Methods
_getPromptModules
▸ _getPromptModules(): Record
<string
, any
>
Returns
Record
<string
, any
>
Inherited from
Defined in
packages/core/src/prompts/Mixin.ts:82
_getPrompts
▸ _getPrompts(): Object
Returns
Object
Name | Type |
---|---|
condenseMessagePrompt | (__namedParameters : { chatHistory : undefined | string = ""; question : undefined | string = "" }) => string |
Overrides
Defined in
packages/core/src/engines/chat/CondenseQuestionChatEngine.ts:56
_updatePrompts
▸ _updatePrompts(promptsDict
): void
Parameters
Name | Type |
---|---|
promptsDict | Object |
promptsDict.condenseMessagePrompt | (__namedParameters : { chatHistory : undefined | string = ""; question : undefined | string = "" }) => string |
Returns
void
Overrides
Defined in
packages/core/src/engines/chat/CondenseQuestionChatEngine.ts:62