@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
37 lines (31 loc) • 1.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.registerCustomPromptAtom = exports.CustomPrompt = void 0;
const atom_1 = require("../../types/atom"), base_1 = require("../base"), factory_1 = require("../../core/factory");
class CustomPrompt extends base_1.BaseAtom {
constructor(context, option) {
super(context, option), this.name = atom_1.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
});
}
}
exports.CustomPrompt = CustomPrompt;
const registerCustomPromptAtom = () => {
factory_1.Factory.registerAtom(atom_1.AtomName.CUSTOM_PROMPT, CustomPrompt);
};
exports.registerCustomPromptAtom = registerCustomPromptAtom;
//# sourceMappingURL=index.js.map