@n8n-plus/n8n-plus
Version:
n8n Workflow Automation Tool (plus edition)
47 lines (37 loc) • 2.72 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLlmSelectionPrompt = getLlmSelectionPrompt;
function getLlmSelectionPrompt(modelRecommendationsSection) {
const recommendationGuidance = modelRecommendationsSection
? `\n\n${modelRecommendationsSection}`
: '\n\nNo Recommended LLM models section is available; do not recommend or name current, best, latest, or fallback model IDs from memory. Call ask_llm when the user needs model guidance or choice.';
return `\
## LLM Selection Guidance
### Purpose
Use this to resolve the target agent's main \`model\` and \`credential\`.
### Workflow
1. Use \`resolve_llm\` before \`ask_llm\` when the request contains enough provider/model detail.
2. If \`resolve_llm\` succeeds, persist \`model = "{provider}/{model}"\` and \`credential = credentialId\`.
3. If the user asks to pick, change, confirm, or configure a model or main credential, call \`ask_llm\`; do not ask in prose.
4. If \`resolve_llm\` reports missing or ambiguous credentials/provider, call \`ask_llm\`.
5. If \`resolve_llm\` reports \`unknown_model\`, retry with a plausible returned model value or call \`ask_llm\`.
### Rules
- Fresh agents need a resolved \`model\` and \`credential\` before config is written.
- Explicit provider/model requests go to \`resolve_llm\` first.
- If the user asks to pick, change, confirm, or configure a model or main credential, call \`ask_llm\`; do not ask in prose.
- If \`resolve_llm\` succeeds, persist \`model = "{provider}/{model}"\` and \`credential = credentialId\`.
- If \`resolve_llm\` reports missing or ambiguous credentials/provider, call \`ask_llm\`.
- If it reports \`unknown_model\`, retry with a plausible returned model value or call \`ask_llm\`.
- For "Anthropic via OpenRouter", pass \`provider: "openrouter"\`; if the user names a routed model, pass the routed id without adding another provider prefix.
- Prefer a provider the user already has credentials for when choosing from recommendations.
- Never copy main LLM credential IDs from \`list_credentials\`.
### Gotchas
- Use \`resolve_llm\` or \`ask_llm\` only for the target agent's main model credential.
- Use \`ask_credential\` for node tools, integrations, and Episodic Memory.
- For OpenRouter, \`provider\` is \`"openrouter"\`; the model can be a routed id such as \`anthropic/...\`.
- Do not recommend current, best, latest, or fallback model IDs from memory when the recommendation catalog is unavailable.
### Verify
- The persisted \`model\` is in \`provider/model\` form.
- The persisted \`credential\` came from \`resolve_llm\` or \`ask_llm\`.${recommendationGuidance}`;
}
//# sourceMappingURL=llm-selection.prompt.js.map