Affineur de prompts système
Ceci est unEngineering, AIworkflow d'automatisation du domainecontenant 5 nœuds.Utilise principalement des nœuds comme Gmail, FormTrigger, Agent, LmChatOpenAi, OutputParserStructured, combinant la technologie d'intelligence artificielle pour une automatisation intelligente. Optimiser les invites de systèmes d'agents IA avec analyse de feedback GPT-4o et envoi d'e-mails
- •Compte Google et informations d'identification Gmail API
- •Clé API OpenAI
Nœuds utilisés (5)
Catégorie
{
"id": "rx7v6helgDYENRs2",
"meta": {
"instanceId": "25cd9c9e1e996c71452f1ab7a15c1f1aa174615661f703590b37f8d95476bb1b",
"templateCredsSetupCompleted": true
},
"name": "System Prompt Tuner",
"tags": [],
"nodes": [
{
"id": "62a0e2bc-7c17-4546-b627-bbedc863a3a0",
"name": "Entrées utilisateur",
"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": "Agent IA",
"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 Modèle de chat",
"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": "Analyseur de sortie structurée",
"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": {
"355883e9-05c4-47a1-a9f1-37aec5e3a550": {
"main": [
[
{
"node": "9143224c-c6ab-4e58-8b0c-e95b1f2f00a7",
"type": "main",
"index": 0
}
]
]
},
"62a0e2bc-7c17-4546-b627-bbedc863a3a0": {
"main": [
[
{
"node": "355883e9-05c4-47a1-a9f1-37aec5e3a550",
"type": "main",
"index": 0
}
]
]
},
"b869ffde-2392-4465-8092-9fbbbc9853b0": {
"ai_languageModel": [
[
{
"node": "355883e9-05c4-47a1-a9f1-37aec5e3a550",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"315ef666-e3cc-4b75-9ec3-4a0c8f4938a0": {
"ai_outputParser": [
[
{
"node": "355883e9-05c4-47a1-a9f1-37aec5e3a550",
"type": "ai_outputParser",
"index": 0
}
]
]
}
}
}Comment utiliser ce workflow ?
Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.
Dans quelles scénarios ce workflow est-il adapté ?
Débutant - Ingénierie, Intelligence Artificielle
Est-ce payant ?
Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.
Workflows recommandés
Daniel Rosehill
@danielrosehillPartager ce workflow