UNPKG

@visactor/vmind

Version:

<div align="center"> <a href="https://github.com/VisActor#gh-light-mode-only" target="_blank"> <img alt="VisActor Logo" width="200" src="https://github.com/VisActor/.github/blob/main/profile/logo_500_200_light.svg"/> </a> <a href="https://githu

31 lines (27 loc) 918 B
import { AtomName } from "../../types/atom"; import { BaseAtom } from "../base"; import { Factory } from "../../core/factory"; export class CustomPrompt extends BaseAtom { constructor(context, option) { super(context, option), this.name = AtomName.CUSTOM_PROMPT, this.isLLMAtom = !0; } getLLMMessages(query) { const {text: text} = this.context; return [ { role: "system", content: this.options.promptTemplate }, ...this.responses || [], { role: "user", content: query || text } ]; } parseLLMContent(resJson, toolJson) { return Object.assign(Object.assign(Object.assign({}, this.context), resJson), { toolRes: toolJson }); } } export const registerCustomPromptAtom = () => { Factory.registerAtom(AtomName.CUSTOM_PROMPT, CustomPrompt); }; //# sourceMappingURL=index.js.map