llama-flow
Version:
The Typescript-first prompt engineering toolkit for working with chat based LLMs.
19 lines (18 loc) • 569 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildMessage = void 0;
function getPersonaPrompt(persona) {
if (typeof persona.prompt === 'function') {
return persona.prompt();
}
else {
return persona.prompt;
}
}
function buildMessage(persona) {
if (!persona.qualifiers || persona.qualifiers.length === 0) {
return getPersonaPrompt(persona);
}
return `${getPersonaPrompt(persona).trim()}\n\nYou will:\n- ${persona.qualifiers.join('\n- ')}`;
}
exports.buildMessage = buildMessage;
;