@cascadeflow/n8n-nodes-cascadeflow 0.6.6 → 0.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -29
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
|
|
17
17
|
</div>
|
|
18
18
|
|
|
19
|
-
**Intelligent AI model cascading for n8n workflows.**
|
|
19
|
+
**Intelligent AI model cascading for n8n workflows with domain understanding.**
|
|
20
|
+
|
|
21
|
+

|
|
20
22
|
|
|
21
23
|
This is an n8n community node that brings cascadeflow's intelligent AI model cascading to n8n workflows.
|
|
22
24
|
|
|
@@ -26,9 +28,9 @@ This is an n8n community node that brings cascadeflow's intelligent AI model cas
|
|
|
26
28
|
|
|
27
29
|
## How It Works
|
|
28
30
|
|
|
29
|
-
The
|
|
31
|
+
The cascadeflow node is a **Language Model sub-node** that sits between your AI models and downstream n8n nodes (like Basic LLM Chain, Chain, or any node that accepts Language Model inputs):
|
|
30
32
|
|
|
31
|
-

|
|
32
34
|
|
|
33
35
|
**Architecture:**
|
|
34
36
|
|
|
@@ -39,7 +41,7 @@ The CascadeFlow node is a **Language Model sub-node** that sits between your AI
|
|
|
39
41
|
└──────┬──────┘
|
|
40
42
|
│
|
|
41
43
|
├──────► ┌──────────────┐
|
|
42
|
-
│ │
|
|
44
|
+
│ │ cascadeflow │
|
|
43
45
|
│ │ Node │ ────► ┌──────────────┐
|
|
44
46
|
│ └──────────────┘ │ Basic Chain │
|
|
45
47
|
├──────► Quality checks │ Chain │
|
|
@@ -53,13 +55,13 @@ The CascadeFlow node is a **Language Model sub-node** that sits between your AI
|
|
|
53
55
|
|
|
54
56
|
**Flow:**
|
|
55
57
|
1. Query goes to cheap drafter model first
|
|
56
|
-
2.
|
|
58
|
+
2. cascadeflow validates the response quality
|
|
57
59
|
3. If quality passes → return drafter response (fast + cheap ✅)
|
|
58
60
|
4. If quality fails → escalate to verifier model (slower but accurate ⚠️)
|
|
59
61
|
|
|
60
62
|
**Result:** 70-80% of queries accept the drafter, saving 40-85% on costs.
|
|
61
63
|
|
|
62
|
-
> **ℹ️ Note:**
|
|
64
|
+
> **ℹ️ Note:** cascadeflow works with n8n Chain nodes but **not with AI Agent nodes**, as n8n only allows whitelisted models for Agent inputs. Use with Basic LLM Chain, Chain, or other nodes that accept Language Model connections.
|
|
63
65
|
|
|
64
66
|
## Installation
|
|
65
67
|
|
|
@@ -94,13 +96,13 @@ RUN cd /usr/local/lib/node_modules/n8n && npm install @cascadeflow/n8n-nodes-cas
|
|
|
94
96
|
- Configure one as your **drafter** (cheap model like `gpt-4o-mini` or `claude-3-5-haiku-20241022`)
|
|
95
97
|
- Configure one as your **verifier** (powerful model like `gpt-4o` or `claude-3-5-sonnet-20241022`)
|
|
96
98
|
|
|
97
|
-
2. **Add the
|
|
99
|
+
2. **Add the cascadeflow node**
|
|
98
100
|
- Connect the drafter model to the **Drafter** input
|
|
99
101
|
- Connect the verifier model to the **Verifier** input
|
|
100
102
|
- Adjust the **Quality Threshold** (default: 0.7)
|
|
101
103
|
|
|
102
104
|
3. **Connect to a Chain node**
|
|
103
|
-
- The
|
|
105
|
+
- The cascadeflow node outputs a Language Model connection
|
|
104
106
|
- Connect it to nodes that accept AI models (Basic LLM Chain, Chain, etc.)
|
|
105
107
|
- **Note:** Does not work with AI Agent nodes (n8n limitation)
|
|
106
108
|
|
|
@@ -115,7 +117,7 @@ RUN cd /usr/local/lib/node_modules/n8n && npm install @cascadeflow/n8n-nodes-cas
|
|
|
115
117
|
v
|
|
116
118
|
┌──────────────────┐ ┌──────────────────┐
|
|
117
119
|
│ OpenAI Model │──────►│ │
|
|
118
|
-
│ gpt-4o-mini │ │
|
|
120
|
+
│ gpt-4o-mini │ │ cascadeflow │ ┌──────────────────┐
|
|
119
121
|
└──────────────────┘ │ Node │──────►│ Basic LLM Chain │
|
|
120
122
|
│ │ │ │
|
|
121
123
|
┌──────────────────┐ │ Threshold: 0.7 │ └──────────────────┘
|
|
@@ -138,20 +140,73 @@ Controls how aggressively to accept drafter responses:
|
|
|
138
140
|
|
|
139
141
|
Lower threshold = more cost savings, higher threshold = better quality assurance.
|
|
140
142
|
|
|
143
|
+
## Multi-Domain Cascading (Optional)
|
|
144
|
+
|
|
145
|
+
cascadeflow supports **intelligent domain-specific cascading** - automatically detecting the type of query and routing it to a specialized model for that domain.
|
|
146
|
+
|
|
147
|
+
### How It Works
|
|
148
|
+
|
|
149
|
+
1. **Enable Domain Cascading** in the node settings
|
|
150
|
+
2. **Toggle individual domains** you want to support
|
|
151
|
+
3. **Connect domain-specific models** to the new input ports that appear
|
|
152
|
+
|
|
153
|
+
When a query comes in, cascadeflow:
|
|
154
|
+
1. Detects the domain (e.g., "Write a Python function" → Code domain)
|
|
155
|
+
2. Routes to the specialized model for that domain (if connected)
|
|
156
|
+
3. Falls back to drafter → verifier cascade if no domain model is available
|
|
157
|
+
|
|
158
|
+
### Supported Domains
|
|
159
|
+
|
|
160
|
+
| Domain | Description | Example Queries |
|
|
161
|
+
|--------|-------------|-----------------|
|
|
162
|
+
| **Code** | Programming, debugging, code generation | "Write a Python function...", "Debug this code..." |
|
|
163
|
+
| **Math** | Mathematical reasoning, calculations, proofs | "Solve this equation...", "Prove that..." |
|
|
164
|
+
| **Data** | Data analysis, statistics, pandas/SQL | "Analyze this dataset...", "Write a SQL query..." |
|
|
165
|
+
| **Creative** | Creative writing, stories, poetry | "Write a short story...", "Compose a poem..." |
|
|
166
|
+
| **Legal** | Legal documents, contracts, regulations | "Draft a contract...", "Explain this law..." |
|
|
167
|
+
| **Medical** | Healthcare, medical knowledge, clinical | "What are the symptoms of...", "Explain this diagnosis..." |
|
|
168
|
+
| **Financial** | Finance, accounting, investment analysis | "Analyze this stock...", "Calculate ROI..." |
|
|
169
|
+
| **Science** | Scientific knowledge, research, experiments | "Explain quantum...", "How does photosynthesis..." |
|
|
170
|
+
|
|
171
|
+
### Setup Example
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
┌──────────────────┐
|
|
175
|
+
│ Claude Haiku │──► Drafter (default cheap model)
|
|
176
|
+
└──────────────────┘
|
|
177
|
+
┌──────────────────┐
|
|
178
|
+
│ GPT-4o │──► Verifier (default powerful model)
|
|
179
|
+
└──────────────────┘
|
|
180
|
+
┌──────────────────┐ ┌──────────────────┐
|
|
181
|
+
│ DeepSeek Coder │──► Code │ │
|
|
182
|
+
└──────────────────┘ │ │
|
|
183
|
+
┌──────────────────┐ │ cascadeflow │──► Chain
|
|
184
|
+
│ Qwen Math │──► Math │ Node │
|
|
185
|
+
└──────────────────┘ │ │
|
|
186
|
+
┌──────────────────┐ │ │
|
|
187
|
+
│ Claude Sonnet │──► Legal│ │
|
|
188
|
+
└──────────────────┘ └──────────────────┘
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### When to Use Domain Cascading
|
|
192
|
+
|
|
193
|
+
- **Use it when**: You have domain-specific models that excel in certain areas (e.g., DeepSeek for code, specialized medical models)
|
|
194
|
+
- **Skip it when**: Your drafter/verifier combination handles all domains well enough
|
|
195
|
+
|
|
141
196
|
## Flow Visualization
|
|
142
197
|
|
|
143
198
|
### Viewing Cascade Decisions in Real-Time
|
|
144
199
|
|
|
145
|
-
|
|
200
|
+
cascadeflow provides detailed logging of every cascade decision in n8n's UI:
|
|
146
201
|
|
|
147
|
-
1. **Execute your workflow** with the
|
|
148
|
-
2. **Click on the downstream Chain node** after execution (the node that receives
|
|
202
|
+
1. **Execute your workflow** with the cascadeflow node
|
|
203
|
+
2. **Click on the downstream Chain node** after execution (the node that receives cascadeflow output)
|
|
149
204
|
3. **Navigate to the "Logs" tab**
|
|
150
205
|
|
|
151
206
|
You'll see detailed flow information like:
|
|
152
207
|
|
|
153
208
|
```
|
|
154
|
-
🎯
|
|
209
|
+
🎯 cascadeflow: Trying drafter model...
|
|
155
210
|
📊 Quality validation: confidence=0.85, method=heuristic
|
|
156
211
|
🎯 Alignment: 0.82
|
|
157
212
|
|
|
@@ -170,7 +225,7 @@ You'll see detailed flow information like:
|
|
|
170
225
|
Or when escalating:
|
|
171
226
|
|
|
172
227
|
```
|
|
173
|
-
🎯
|
|
228
|
+
🎯 cascadeflow: Trying drafter model...
|
|
174
229
|
📊 Quality validation: confidence=0.62, method=heuristic
|
|
175
230
|
|
|
176
231
|
┌────────────────────────────────────────────────┐
|
|
@@ -241,7 +296,7 @@ Note: Requires Ollama installed locally
|
|
|
241
296
|
|
|
242
297
|
**Example: Claude Haiku + GPT-4o**
|
|
243
298
|
|
|
244
|
-
| Scenario | Traditional (GPT-4o only) |
|
|
299
|
+
| Scenario | Traditional (GPT-4o only) | cascadeflow (Haiku + GPT-4o) | Savings |
|
|
245
300
|
|----------|---------------------------|------------------------------|---------|
|
|
246
301
|
| Simple Q&A (75% acceptance) | $0.0025 | $0.0008 | 68% |
|
|
247
302
|
| Complex query (25% escalation) | $0.0025 | $0.0025 | 0% (correctly escalated) |
|
|
@@ -249,12 +304,12 @@ Note: Requires Ollama installed locally
|
|
|
249
304
|
|
|
250
305
|
**Monthly savings (10,000 queries):**
|
|
251
306
|
- Traditional (GPT-4o only): $25.00
|
|
252
|
-
-
|
|
307
|
+
- cascadeflow (Haiku + GPT-4o): $11.50
|
|
253
308
|
- **You save: $13.50/month** (54% savings)
|
|
254
309
|
|
|
255
310
|
**Monthly savings (100,000 queries):**
|
|
256
311
|
- Traditional (GPT-4o only): $250.00
|
|
257
|
-
-
|
|
312
|
+
- cascadeflow (Haiku + GPT-4o): $115.00
|
|
258
313
|
- **You save: $135.00/month** (54% savings)
|
|
259
314
|
|
|
260
315
|
## Example Workflows
|
|
@@ -270,7 +325,7 @@ Note: Requires Ollama installed locally
|
|
|
270
325
|
v
|
|
271
326
|
┌─────────────────────────────────────┐
|
|
272
327
|
│ Claude Haiku ────┐ │
|
|
273
|
-
│ │
|
|
328
|
+
│ │ cascadeflow │ ┌──────────────────┐
|
|
274
329
|
│ Claude Sonnet ───┴─► Node │──────►│ Basic Chain │
|
|
275
330
|
└─────────────────────────────────────┘ │ (responds) │
|
|
276
331
|
└──────┬───────────┘
|
|
@@ -292,7 +347,7 @@ Note: Requires Ollama installed locally
|
|
|
292
347
|
v
|
|
293
348
|
┌────────────────────────────────────────┐
|
|
294
349
|
│ GPT-4o-mini ─────┐ │
|
|
295
|
-
│ │
|
|
350
|
+
│ │ cascadeflow │ ┌──────────────────┐
|
|
296
351
|
│ GPT-4o ──────────┴─► Node │──────►│ Basic Chain │
|
|
297
352
|
└────────────────────────────────────────┘ │ (generates) │
|
|
298
353
|
└──────┬───────────┘
|
|
@@ -314,7 +369,7 @@ Note: Requires Ollama installed locally
|
|
|
314
369
|
v
|
|
315
370
|
┌─────────────────────────────────────┐
|
|
316
371
|
│ Ollama qwen2.5 ──┐ │
|
|
317
|
-
│ │
|
|
372
|
+
│ │ cascadeflow │ ┌──────────────────┐
|
|
318
373
|
│ GPT-4o ──────────┴─► Node │──────►│ Basic Chain │
|
|
319
374
|
└─────────────────────────────────────┘ │ (reviews code) │
|
|
320
375
|
└──────┬───────────┘
|
|
@@ -334,7 +389,7 @@ Note: Requires Ollama installed locally
|
|
|
334
389
|
**To see the actual cascade flow and which model was used:**
|
|
335
390
|
|
|
336
391
|
1. Execute your workflow
|
|
337
|
-
2. Click on the downstream Chain node after execution (the node that receives
|
|
392
|
+
2. Click on the downstream Chain node after execution (the node that receives cascadeflow output)
|
|
338
393
|
3. Navigate to the **"Logs"** tab
|
|
339
394
|
4. You'll see detailed flow information showing:
|
|
340
395
|
- Whether the drafter was accepted or escalated to verifier
|
|
@@ -345,7 +400,7 @@ Note: Requires Ollama installed locally
|
|
|
345
400
|
|
|
346
401
|
The logs provide complete visibility into the cascade decision-making process, showing exactly which path was taken for each request.
|
|
347
402
|
|
|
348
|
-
> **ℹ️ Important:**
|
|
403
|
+
> **ℹ️ Important:** cascadeflow does **not work with AI Agent nodes** in n8n, as n8n only allows whitelisted models for Agent inputs. Use with Basic LLM Chain, Chain, or other nodes that accept Language Model connections.
|
|
349
404
|
|
|
350
405
|
## Compatibility
|
|
351
406
|
|
|
@@ -372,13 +427,13 @@ The logs provide complete visibility into the cascade decision-making process, s
|
|
|
372
427
|
|
|
373
428
|
**Solution:**
|
|
374
429
|
1. Make sure your workflow has executed successfully
|
|
375
|
-
2. Click on the **Chain node that receives the
|
|
430
|
+
2. Click on the **Chain node that receives the cascadeflow output** (Basic LLM Chain, Chain, etc.)
|
|
376
431
|
3. Navigate to the **"Logs"** tab (not the "Output" tab)
|
|
377
|
-
4. The logs appear in the downstream node, not the
|
|
432
|
+
4. The logs appear in the downstream node, not the cascadeflow node itself
|
|
378
433
|
|
|
379
434
|
### Issue: "This node cannot be connected" when connecting to AI Agent
|
|
380
435
|
|
|
381
|
-
**Solution:** This is expected.
|
|
436
|
+
**Solution:** This is expected. cascadeflow does **not work with AI Agent nodes** because n8n only allows whitelisted models for Agent inputs. Use cascadeflow with:
|
|
382
437
|
- ✅ Basic LLM Chain
|
|
383
438
|
- ✅ Chain
|
|
384
439
|
- ✅ Other nodes that accept Language Model connections
|
|
@@ -404,11 +459,11 @@ The logs provide complete visibility into the cascade decision-making process, s
|
|
|
404
459
|
|
|
405
460
|
## Version History
|
|
406
461
|
|
|
407
|
-
### v0.6.
|
|
462
|
+
### v0.6.7 (Latest)
|
|
408
463
|
|
|
409
|
-
- **
|
|
410
|
-
- **
|
|
411
|
-
- **
|
|
464
|
+
- **Multi-domain cascading docs**: Added documentation for 8-domain intelligent cascading
|
|
465
|
+
- **Removed semantic validation**: Disabled ML-based semantic validation to prevent out-of-memory crashes
|
|
466
|
+
- **Shorter domain labels**: Domain input labels simplified (Code, Math, Data, etc.)
|
|
412
467
|
|
|
413
468
|
### v0.6.4
|
|
414
469
|
|