系统提示调谐器
初级
这是一个Engineering, AI领域的自动化工作流,包含 5 个节点。主要使用 Gmail, FormTrigger, Agent, LmChatOpenAi, OutputParserStructured 等节点,结合人工智能技术实现智能自动化。 通过GPT-4o反馈分析和邮件发送优化AI代理系统提示
前置要求
- •Google 账号和 Gmail API 凭证
- •OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "rx7v6helgDYENRs2",
"meta": {
"instanceId": "25cd9c9e1e996c71452f1ab7a15c1f1aa174615661f703590b37f8d95476bb1b",
"templateCredsSetupCompleted": true
},
"name": "系统提示调谐器",
"tags": [],
"nodes": [
{
"id": "62a0e2bc-7c17-4546-b627-bbedc863a3a0",
"name": "用户输入",
"type": "n8n-nodes-base.formTrigger",
"position": [
-460,
-80
],
"webhookId": "cb20401c-ade4-45ce-912e-15956449ca3d",
"parameters": {
"options": {
"buttonLabel": "Send For Evaluation"
},
"formTitle": "Agent Prompt Tuner",
"formFields": {
"values": [
{
"fieldLabel": "Agent Name",
"requiredField": true
},
{
"fieldType": "textarea",
"fieldLabel": "Agent Purpose",
"requiredField": true
},
{
"fieldType": "textarea",
"fieldLabel": "What's Working?",
"requiredField": true
},
{
"fieldType": "textarea",
"fieldLabel": "What's Not Working?",
"requiredField": true
},
{
"fieldType": "textarea",
"fieldLabel": "Current System Prompt",
"requiredField": true
},
{
"fieldType": "textarea",
"fieldLabel": "Sample Input (Prompt)"
},
{
"fieldType": "textarea",
"fieldLabel": "Example Output"
}
]
},
"formDescription": "Enhances autonomous agent system prompts based on user provided descriptions of behavior and examples "
},
"typeVersion": 2.2
},
{
"id": "355883e9-05c4-47a1-a9f1-37aec5e3a550",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-240,
-80
],
"parameters": {
"text": "=Here is the information for your analysis:\n\nAgent Name: {{ $json['Agent Name'] }}\n\nAgent Purpose: {{ $json['Agent Purpose'] }}\n\nCurrent System Prompt: {{ $json['Current System Prompt'] }}\n\nHere is how I would evaluate its current performance.\n\nThis is working well: {{ $json['What\\'s Working?'] }}\n\nThis is what's going wrong: {{ $json['What\\'s Not Working?'] }}\n\nHere's an examlple of a prompt I wrote and the output I received. If the following section is blank, please disregard it. Otherwise, consider it in your evaluation:\n\nSample prompt: {{ $json['Sample Input (Prompt)'] }}\n\nThe prompt generated the following output:\n\n{{ $json['Example Output'] }}\n\n\nPlease generate the improved system prompt ensuring that your response adheres to the JSON formatting instruction.",
"options": {
"systemMessage": "You are an expert AI prompt engineer. \n\nYour task is to receive a set of observations about how a specific AI agent is performing. These observations include:\n\n* The name of the AI agent\n* A short description of the agent's intended purpose\n* A description of what *is* working well\n* A description of what *is not* working as expected\n* (Optionally) An example output from the current version of the agent\n\nUsing this information, your task is to analyze the shortcomings or gaps in the agent's behavior and generate a revised, full **system prompt** intended to improve its performance and address the identified issues.\n\nYour response should be in **JSON** format with the following fields:\n\n```json\n{\n \"updated_system_prompt\": \"The full improved system prompt, rewritten from scratch or as a modification of the implied original\",\n \"summary_of_improvements\": \"A short explanation of what was changed or improved and why\"\n}\n```\n\nYou must:\n\n* Use clear and specific instructions in the new system prompt.\n* Preserve functionality that is working well.\n* Directly address behaviors that need correction.\n* Avoid vague language and ensure the new prompt is actionable and well-structured.\n\nDo not include any commentary outside the JSON response."
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.9
},
{
"id": "b869ffde-2392-4465-8092-9fbbbc9853b0",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-380,
120
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "gpt-4o"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "***",
"name": "OpenAI Chat"
}
},
"typeVersion": 1.2
},
{
"id": "315ef666-e3cc-4b75-9ec3-4a0c8f4938a0",
"name": "结构化输出解析器",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
-80,
140
],
"parameters": {
"jsonSchemaExample": "{\n \"updated_system_prompt\": \"The full improved system prompt, rewritten from scratch or as a modification of the implied original\",\n \"summary_of_improvements\": \"A short explanation of what was changed or improved and why\"\n}"
},
"typeVersion": 1.2
},
{
"id": "9143224c-c6ab-4e58-8b0c-e95b1f2f00a7",
"name": "Gmail",
"type": "n8n-nodes-base.gmail",
"position": [
120,
-100
],
"webhookId": "aa0e272c-96f6-465d-9f3c-555851974937",
"parameters": {
"sendTo": "user@example.com",
"message": "=<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <title>AI System Prompt Improvement Notification</title>\n <style>\n body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; background-color: #f9f9f9; padding: 20px; }\n .container { background-color: #ffffff; border-radius: 8px; padding: 24px; max-width: 700px; margin: auto; box-shadow: 0 0 10px rgba(0,0,0,0.05); }\n h2 { color: #2c3e50; border-bottom: 1px solid #ddd; padding-bottom: 4px; }\n pre { background-color: #f4f4f4; padding: 12px; border-radius: 4px; overflow-x: auto; font-family: monospace; }\n .footer { margin-top: 30px; font-size: 0.9em; color: #777; }\n </style>\n</head>\n<body>\n <div class=\"container\">\n <p>Hi there!</p>\n <p>You asked the <strong>AI System Prompt Improvement Agent</strong> to review the system prompt for <strong>{{ $('User inputs').item.json['Agent Name'] }}</strong>.</p>\n <h2>✅ Recommended Updated System Prompt</h2>\n <pre>{{ $json.output.updated_system_prompt }}</pre>\n <h2>📄 Original System Prompt</h2>\n <pre>{{ $('User inputs').item.json['Current System Prompt'] }}</pre>\n <h2>✏️ Summary of Improvements</h2>\n <p>{{ $json.output.summary_of_improvements }}</p>\n <div class=\"footer\">\n Regards,<br>\n <strong>AI Improvement Agent</strong>\n </div>\n </div>\n</body>\n</html>",
"subject": "=Improved prompt for: {{ $('User inputs').item.json['Agent Name'] }}"
},
"credentials": {
"gmailOAuth2": {
"id": "***",
"name": "Redacted Gmail OAuth"
}
},
"typeVersion": 2.1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "447d5b7f-6409-4470-aac7-be8e36c9e34d",
"connections": {
"AI Agent": {
"main": [
[
{
"node": "Gmail",
"type": "main",
"index": 0
}
]
]
},
"User inputs": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "AI Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
初级 - 工程, 人工智能
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
Facebook广告竞品创意分析与自动邮件报告
使用AI(GPT-4和Gemini)分析竞争对手Facebook广告并生成邮件报告
Set
Wait
Gmail
+13
31 节点SamirLiu
人工智能
自动化PDF发票处理与审批流程,使用OpenAI和Google表格
自动化PDF发票处理与审批流程,使用OpenAI和Google表格
If
Gmail
Form Trigger
+9
17 节点Billy Christi
财务
播客笔记记录器
使用GPT和Gemini结合性能数据创建高转化率Meta广告脚本
If
S3
Code
+9
24 节点Daniel Rosehill
发票处理
使用GPT-4、Airtable和Google Drive筛选和评估求职者
使用GPT-4、Airtable和Google Drive筛选和评估求职者
If
Set
Gmail
+9
22 节点Billy Christi
人力资源
✨🤖 自动化AI驱动的社交媒体内容工厂,适用于X + Facebook + Instagram + LinkedIn
✨🤖 使用AI自动化多平台社交媒体内容创建
If
Set
Code
+17
57 节点Joseph LePage
人工智能
基于 Github 的自动单元测试生成器
为 GitHub PR 自动生成 Jest 测试,支持双 AI 审查
Code
Merge
Github
+7
24 节点Cristiano Varriale
工程