ContextChatEngine
定义于:.build/typescript/packages/core/src/chat-engine/context-chat-engine.ts:38
ContextChatEngine 使用索引为每个查询获取合适的上下文。 上下文存储在系统提示中,聊天历史记录被分块, 使得每个查询都能呈现合适的上下文。
new ContextChatEngine(
init):ContextChatEngine
定义于:.build/typescript/packages/core/src/chat-engine/context-chat-engine.ts:48
ContextChatEngine
chatModel
Section titled “chatModel”聊天模型:
LLM
定义于:.build/typescript/packages/core/src/chat-engine/context-chat-engine.ts:39
记忆:
Memory
定义于:.build/typescript/packages/core/src/chat-engine/context-chat-engine.ts:40
contextGenerator
Section titled “contextGenerator”上下文生成器:
ContextGenerator&PromptMixin
定义于:.build/typescript/packages/core/src/chat-engine/context-chat-engine.ts:41
optional系统提示:string
定义于:.build/typescript/packages/core/src/chat-engine/context-chat-engine.ts:42
chatHistory
Section titled “chatHistory”获取 聊天历史记录():
Promise<ChatMessage[]>
定义于:.build/typescript/packages/core/src/chat-engine/context-chat-engine.ts:44
Promise<ChatMessage[]>
_getPrompts()
Section titled “_getPrompts()”
protected_getPrompts():PromptsRecord
定义于:.build/typescript/packages/core/src/chat-engine/context-chat-engine.ts:65
_updatePrompts()
Section titled “_updatePrompts()”
protected_updatePrompts(prompts):void
定义于:.build/typescript/packages/core/src/chat-engine/context-chat-engine.ts:71
contextSystemPrompt
Section titled “contextSystemPrompt”void
_getPromptModules()
Section titled “_getPromptModules()”
protected_getPromptModules():ModuleRecord
定义于:.build/typescript/packages/core/src/chat-engine/context-chat-engine.ts:77
返回当前模块中同样实现了 PromptMixin 的子模块字典(以便也能获取/设置它们的提示)。
如果没有子模块,可以为空。
chat()
Section titled “chat()”chat(
params):Promise<EngineResponse>
定义于:.build/typescript/packages/core/src/chat-engine/context-chat-engine.ts:83
Promise<EngineResponse>
chat(
params):Promise<AsyncIterable<EngineResponse,any,any>>
定义于:.build/typescript/packages/core/src/chat-engine/context-chat-engine.ts:84
Promise<AsyncIterable<EngineResponse, any, any>>
reset()
Section titled “reset()”reset():
Promise<void>
定义于:.build/typescript/packages/core/src/chat-engine/context-chat-engine.ts:127
Promise<void>
validatePrompts()
Section titled “validatePrompts()”validatePrompts(
promptsDict,moduleDict):void
Defined in: .build/typescript/packages/core/src/prompts/mixin.ts:8
promptsDict
Section titled “promptsDict”moduleDict
Section titled “moduleDict”void
getPrompts()
Section titled “getPrompts()”getPrompts():
PromptsRecord
Defined in: .build/typescript/packages/core/src/prompts/mixin.ts:22
updatePrompts()
Section titled “updatePrompts()”updatePrompts(
prompts):void
Defined in: .build/typescript/packages/core/src/prompts/mixin.ts:39
void