Views
No views yet
| Category | Score | Tests |
|---|---|---|
| Simple Webhook | 92.2% | 3 |
| Conditional Routing | 93.3% | 3 |
| Scheduled Tasks | 95.6% | 3 |
| Form Processing | 93.3% | 2 |
| Multi-Service Integration | 83.3% | 3 |
| Data Processing | 93.3% | 3 |
| Error Handling | 88.9% | 3 |
| Complex Multi-Step | 91.7% | 2 |
| Manual & Email Triggers | 96.7% | 2 |
1const workflow = new Workflow('Webhook to Slack');
2const webhook = workflow.add('n8n-nodes-base.webhook', {{
3 path: '/data',
4 method: 'POST'
5}});
6const slack = workflow.add('n8n-nodes-base.slack', {{
7 channel: '#general',
8 text: '={{{{ $json.message }}}}'
9}});
10webhook.to(slack);1from transformers import AutoModelForCausalLM, AutoTokenizer
2from peft import PeftModel
3import torch
4
5# Load base model
6base_model = AutoModelForCausalLM.from_pretrained(
7 "Qwen/Qwen2.5-Coder-1.5B-Instruct",
8 torch_dtype=torch.float16,
9 device_map="auto"
10)
11
12# Load fine-tuned adapter
13model = PeftModel.from_pretrained(base_model, "Nishan30/n8n-workflow-generator")
14tokenizer = AutoTokenizer.from_pretrained("Nishan30/n8n-workflow-generator")
15
16# System prompt
17system_prompt = """You are an expert n8n workflow generator. Given a user's request, you generate clean, functional TypeScript code using the @n8n-generator/core DSL.
18
19Your output should:
20- Only contain the code, no explanations
21- Use the Workflow class from @n8n-generator/core
22- Use workflow.add() to create nodes
23- Use .to() or workflow.connect() for connections
24- Be ready to compile directly to n8n JSON"""
25
26# Generate
27user_request = "Create a webhook that sends data to Slack"
28messages = [
29 {{"role": "system", "content": system_prompt}},
30 {{"role": "user", "content": user_request}}
31]
32
33text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
34inputs = tokenizer(text, return_tensors="pt").to(model.device)
35
36outputs = model.generate(
37 **inputs,
38 max_new_tokens=512,
39 temperature=0.3,
40 do_sample=True,
41 top_p=0.9,
42 repetition_penalty=1.1
43)
44
45result = tokenizer.decode(outputs[0], skip_special_tokens=True)
46print(result)1from transformers import pipeline
2
3generator = pipeline(
4 "text-generation",
5 model="Nishan30/n8n-workflow-generator",
6 device_map="auto"
7)
8
9prompt = "Create a scheduled workflow that fetches data daily and sends to Slack"
10result = generator(prompt, max_new_tokens=512, temperature=0.3)
11print(result[0]['generated_text'])webhook - HTTP endpointsscheduleTrigger - Cron-based schedulingmanualTrigger - Manual executionformTrigger - Form submissionsemailTrigger - Email-based triggersslack, discord, telegram - Messaginggmail, email - Email sendinghttpRequest - API callsgoogleSheets, airtable, notion - Databasesif, switch - Conditional logicset, filter, merge - Data transformationcode - Custom JavaScript/PythonstopAndError - Error handlingUser: "Create a webhook that posts to Slack"
Model: [Generates complete TypeScript DSL code]User: "Daily workflow that fetches API data and stores in database"
Model: [Generates schedule trigger + HTTP request + database storage]User: "Contact form that validates and sends email"
Model: [Generates form trigger + validation + email sending]User: "Route high-priority items to #urgent, others to #general"
Model: [Generates webhook + if condition + dual Slack outputs]| Model | Size | Accuracy | Speed | Use Case |
|---|---|---|---|---|
| n8n-workflow-generator | 1.5B | 91.8% | Fast | Production-ready |
| GPT-3.5 (baseline) | 175B | ~85% | Slow | General purpose |
| CodeLlama-7B | 7B | ~88% | Medium | Code generation |
1custom_prompt = """You are a workflow expert. Generate n8n workflows with:
2- Error handling for all HTTP requests
3- Descriptive node names
4- Production-ready configurations
5"""1requests = [
2 "webhook to slack",
3 "daily email report",
4 "form to database"
5]
6
7for req in requests:
8 workflow = generate_workflow(req)
9 print(workflow)1import json
2from n8n_generator import compile_to_json
3
4# Generate DSL
5dsl_code = model.generate(prompt)
6
7# Compile to n8n JSON
8workflow_json = compile_to_json(dsl_code)
9
10# Import to n8n
11# POST to http://your-n8n-instance/api/v1/workflows