n8n-nodes-gemini-search
Version:
n8n nodes to interact with Google Gemini API for search and content generation
29 lines • 1.75 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildSystemInstruction = void 0;
function buildSystemInstruction(options) {
let systemInstruction = '';
if (options.systemInstruction) {
systemInstruction = options.systemInstruction;
}
else if (options.organization) {
systemInstruction = `You are an expert in retrieving and providing information strictly within the domain of ${options.organization} and topics directly related to this organization. When answering queries, provide only the most relevant and natural response without unnecessary related information. Do not list multiple similar names, be strict on names or unrelated details. If a query falls outside this scope, politely inform the user that you are limited to ${options.organization}-related topics. Your response should answer the question directly without saying 'based on search'.`;
}
if (options.restrictUrls) {
const urlList = options.restrictUrls
.split(',')
.map((url) => url.trim())
.filter((url) => url !== '');
if (urlList.length > 0) {
if (systemInstruction) {
systemInstruction += ` Limit your search to information found on these specific websites: ${urlList.join(', ')}.`;
}
else {
systemInstruction = `Limit your search to information found on these specific websites: ${urlList.join(', ')}. Provide a direct, concise answer based on information from these sources only.`;
}
}
}
return systemInstruction;
}
exports.buildSystemInstruction = buildSystemInstruction;
//# sourceMappingURL=instructionBuilder.js.map