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.
Implements
Constructors
constructor
• new CondenseQuestionChatEngine(init
)
Parameters
Name | Type |
---|---|
init | Object |
init.chatHistory | ChatMessage [] |
init.condenseMessagePrompt? | (__namedParameters : Object ) => string |
init.queryEngine | BaseQueryEngine |
init.serviceContext? | ServiceContext |
Defined in
packages/core/src/engines/chat/CondenseQuestionChatEngine.ts:38
Properties
chatHistory
• chatHistory: ChatHistory
Defined in
packages/core/src/engines/chat/CondenseQuestionChatEngine.ts:34
condenseMessagePrompt
• condenseMessagePrompt: (__namedParameters
: Object
) => string
Type declaration
▸ («destructured»
): string
Parameters
Name | Type |
---|---|
«destructured» | Object |
Returns
string
Defined in
packages/core/src/engines/chat/CondenseQuestionChatEngine.ts:36
llm
• llm: LLM
Defined in
packages/core/src/engines/chat/CondenseQuestionChatEngine.ts:35
queryEngine
• queryEngine: BaseQueryEngine
Defined in
packages/core/src/engines/chat/CondenseQuestionChatEngine.ts:33
Methods
chat
▸ chat(params
): Promise
<AsyncIterable
<Response
>>
Send message along with the class's current chat history to the LLM.
Parameters
Name | Type |
---|---|
params | ChatEngineParamsStreaming |
Returns
Promise
<AsyncIterable
<Response
>>
Implementation of
Defined in
packages/core/src/engines/chat/CondenseQuestionChatEngine.ts:64
▸ chat(params
): Promise
<Response
>
Parameters
Name | Type |
---|---|
params | ChatEngineParamsNonStreaming |
Returns
Promise
<Response
>
Implementation of
Defined in
packages/core/src/engines/chat/CondenseQuestionChatEngine.ts:65
condenseQuestion
▸ Private
condenseQuestion(chatHistory
, question
): Promise
<CompletionResponse
>
Parameters
Name | Type |
---|---|
chatHistory | ChatHistory |
question | string |
Returns
Promise
<CompletionResponse
>
Defined in
packages/core/src/engines/chat/CondenseQuestionChatEngine.ts:51
reset
▸ reset(): void
Resets the chat history so that it's empty.
Returns
void
Implementation of
Defined in
packages/core/src/engines/chat/CondenseQuestionChatEngine.ts:101