n8n
Version:
n8n Workflow Automation Tool
27 lines • 1.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildAskLlmTool = buildAskLlmTool;
const agents_1 = require("@n8n/agents");
const api_types_1 = require("@n8n/api-types");
function buildAskLlmTool() {
return new agents_1.Tool(api_types_1.ASK_LLM_TOOL_NAME)
.description('Show a model + credential picker card in the chat UI and suspend until the user ' +
'selects a provider, model and credential. Use only when resolve_llm returns an ' +
'ambiguous result, when credentials are missing and the user must choose/configure one, ' +
'or when the user explicitly asks to pick/change the model. ' +
'After resume: set model = "{provider}/{model}" and credential = credentialName ' +
'via write_config or patch_config.')
.systemInstruction('Never ask the user in plain text to choose, confirm, configure, or change the agent ' +
'main LLM, provider, model, or main LLM credential. If the user needs to make that ' +
'choice, call ask_llm so the picker card is shown.')
.input(api_types_1.askLlmInputSchema)
.suspend(api_types_1.askLlmInputSchema)
.resume(api_types_1.askLlmResumeSchema)
.handler(async (input, ctx) => {
if (ctx.resumeData !== undefined)
return ctx.resumeData;
return await ctx.suspend(input);
})
.build();
}
//# sourceMappingURL=ask-llm.tool.js.map