@cascadeflow/n8n-nodes-cascadeflow 0.6.5 → 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 +101 -52
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,19 +16,9 @@
|
|
|
16
16
|
|
|
17
17
|
</div>
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
>
|
|
21
|
-
> If you previously installed versions **5.0.1** through **5.0.7**, you need to **manually reinstall** to get v0.5.0:
|
|
22
|
-
>
|
|
23
|
-
> 1. Go to **Settings** > **Community Nodes** in n8n
|
|
24
|
-
> 2. **Uninstall** `@cascadeflow/n8n-nodes-cascadeflow`
|
|
25
|
-
> 3. **Reinstall** by searching for `@cascadeflow/n8n-nodes-cascadeflow`
|
|
26
|
-
>
|
|
27
|
-
> **Why?** Versions 5.0.x were published with incorrect version numbering. We've corrected this to align with the main cascadeflow release (v0.5.0). npm will not auto-upgrade from 5.0.x to 0.5.0 as it treats it as a downgrade.
|
|
19
|
+
**Intelligent AI model cascading for n8n workflows with domain understanding.**
|
|
28
20
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
**Intelligent AI model cascading for n8n workflows.**
|
|
21
|
+

|
|
32
22
|
|
|
33
23
|
This is an n8n community node that brings cascadeflow's intelligent AI model cascading to n8n workflows.
|
|
34
24
|
|
|
@@ -38,9 +28,9 @@ This is an n8n community node that brings cascadeflow's intelligent AI model cas
|
|
|
38
28
|
|
|
39
29
|
## How It Works
|
|
40
30
|
|
|
41
|
-
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):
|
|
42
32
|
|
|
43
|
-

|
|
44
34
|
|
|
45
35
|
**Architecture:**
|
|
46
36
|
|
|
@@ -51,7 +41,7 @@ The CascadeFlow node is a **Language Model sub-node** that sits between your AI
|
|
|
51
41
|
└──────┬──────┘
|
|
52
42
|
│
|
|
53
43
|
├──────► ┌──────────────┐
|
|
54
|
-
│ │
|
|
44
|
+
│ │ cascadeflow │
|
|
55
45
|
│ │ Node │ ────► ┌──────────────┐
|
|
56
46
|
│ └──────────────┘ │ Basic Chain │
|
|
57
47
|
├──────► Quality checks │ Chain │
|
|
@@ -65,13 +55,13 @@ The CascadeFlow node is a **Language Model sub-node** that sits between your AI
|
|
|
65
55
|
|
|
66
56
|
**Flow:**
|
|
67
57
|
1. Query goes to cheap drafter model first
|
|
68
|
-
2.
|
|
58
|
+
2. cascadeflow validates the response quality
|
|
69
59
|
3. If quality passes → return drafter response (fast + cheap ✅)
|
|
70
60
|
4. If quality fails → escalate to verifier model (slower but accurate ⚠️)
|
|
71
61
|
|
|
72
62
|
**Result:** 70-80% of queries accept the drafter, saving 40-85% on costs.
|
|
73
63
|
|
|
74
|
-
> **ℹ️ 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.
|
|
75
65
|
|
|
76
66
|
## Installation
|
|
77
67
|
|
|
@@ -106,13 +96,13 @@ RUN cd /usr/local/lib/node_modules/n8n && npm install @cascadeflow/n8n-nodes-cas
|
|
|
106
96
|
- Configure one as your **drafter** (cheap model like `gpt-4o-mini` or `claude-3-5-haiku-20241022`)
|
|
107
97
|
- Configure one as your **verifier** (powerful model like `gpt-4o` or `claude-3-5-sonnet-20241022`)
|
|
108
98
|
|
|
109
|
-
2. **Add the
|
|
99
|
+
2. **Add the cascadeflow node**
|
|
110
100
|
- Connect the drafter model to the **Drafter** input
|
|
111
101
|
- Connect the verifier model to the **Verifier** input
|
|
112
102
|
- Adjust the **Quality Threshold** (default: 0.7)
|
|
113
103
|
|
|
114
104
|
3. **Connect to a Chain node**
|
|
115
|
-
- The
|
|
105
|
+
- The cascadeflow node outputs a Language Model connection
|
|
116
106
|
- Connect it to nodes that accept AI models (Basic LLM Chain, Chain, etc.)
|
|
117
107
|
- **Note:** Does not work with AI Agent nodes (n8n limitation)
|
|
118
108
|
|
|
@@ -127,7 +117,7 @@ RUN cd /usr/local/lib/node_modules/n8n && npm install @cascadeflow/n8n-nodes-cas
|
|
|
127
117
|
v
|
|
128
118
|
┌──────────────────┐ ┌──────────────────┐
|
|
129
119
|
│ OpenAI Model │──────►│ │
|
|
130
|
-
│ gpt-4o-mini │ │
|
|
120
|
+
│ gpt-4o-mini │ │ cascadeflow │ ┌──────────────────┐
|
|
131
121
|
└──────────────────┘ │ Node │──────►│ Basic LLM Chain │
|
|
132
122
|
│ │ │ │
|
|
133
123
|
┌──────────────────┐ │ Threshold: 0.7 │ └──────────────────┘
|
|
@@ -150,20 +140,73 @@ Controls how aggressively to accept drafter responses:
|
|
|
150
140
|
|
|
151
141
|
Lower threshold = more cost savings, higher threshold = better quality assurance.
|
|
152
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
|
+
|
|
153
196
|
## Flow Visualization
|
|
154
197
|
|
|
155
198
|
### Viewing Cascade Decisions in Real-Time
|
|
156
199
|
|
|
157
|
-
|
|
200
|
+
cascadeflow provides detailed logging of every cascade decision in n8n's UI:
|
|
158
201
|
|
|
159
|
-
1. **Execute your workflow** with the
|
|
160
|
-
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)
|
|
161
204
|
3. **Navigate to the "Logs" tab**
|
|
162
205
|
|
|
163
206
|
You'll see detailed flow information like:
|
|
164
207
|
|
|
165
208
|
```
|
|
166
|
-
🎯
|
|
209
|
+
🎯 cascadeflow: Trying drafter model...
|
|
167
210
|
📊 Quality validation: confidence=0.85, method=heuristic
|
|
168
211
|
🎯 Alignment: 0.82
|
|
169
212
|
|
|
@@ -182,7 +225,7 @@ You'll see detailed flow information like:
|
|
|
182
225
|
Or when escalating:
|
|
183
226
|
|
|
184
227
|
```
|
|
185
|
-
🎯
|
|
228
|
+
🎯 cascadeflow: Trying drafter model...
|
|
186
229
|
📊 Quality validation: confidence=0.62, method=heuristic
|
|
187
230
|
|
|
188
231
|
┌────────────────────────────────────────────────┐
|
|
@@ -253,7 +296,7 @@ Note: Requires Ollama installed locally
|
|
|
253
296
|
|
|
254
297
|
**Example: Claude Haiku + GPT-4o**
|
|
255
298
|
|
|
256
|
-
| Scenario | Traditional (GPT-4o only) |
|
|
299
|
+
| Scenario | Traditional (GPT-4o only) | cascadeflow (Haiku + GPT-4o) | Savings |
|
|
257
300
|
|----------|---------------------------|------------------------------|---------|
|
|
258
301
|
| Simple Q&A (75% acceptance) | $0.0025 | $0.0008 | 68% |
|
|
259
302
|
| Complex query (25% escalation) | $0.0025 | $0.0025 | 0% (correctly escalated) |
|
|
@@ -261,12 +304,12 @@ Note: Requires Ollama installed locally
|
|
|
261
304
|
|
|
262
305
|
**Monthly savings (10,000 queries):**
|
|
263
306
|
- Traditional (GPT-4o only): $25.00
|
|
264
|
-
-
|
|
307
|
+
- cascadeflow (Haiku + GPT-4o): $11.50
|
|
265
308
|
- **You save: $13.50/month** (54% savings)
|
|
266
309
|
|
|
267
310
|
**Monthly savings (100,000 queries):**
|
|
268
311
|
- Traditional (GPT-4o only): $250.00
|
|
269
|
-
-
|
|
312
|
+
- cascadeflow (Haiku + GPT-4o): $115.00
|
|
270
313
|
- **You save: $135.00/month** (54% savings)
|
|
271
314
|
|
|
272
315
|
## Example Workflows
|
|
@@ -282,7 +325,7 @@ Note: Requires Ollama installed locally
|
|
|
282
325
|
v
|
|
283
326
|
┌─────────────────────────────────────┐
|
|
284
327
|
│ Claude Haiku ────┐ │
|
|
285
|
-
│ │
|
|
328
|
+
│ │ cascadeflow │ ┌──────────────────┐
|
|
286
329
|
│ Claude Sonnet ───┴─► Node │──────►│ Basic Chain │
|
|
287
330
|
└─────────────────────────────────────┘ │ (responds) │
|
|
288
331
|
└──────┬───────────┘
|
|
@@ -304,7 +347,7 @@ Note: Requires Ollama installed locally
|
|
|
304
347
|
v
|
|
305
348
|
┌────────────────────────────────────────┐
|
|
306
349
|
│ GPT-4o-mini ─────┐ │
|
|
307
|
-
│ │
|
|
350
|
+
│ │ cascadeflow │ ┌──────────────────┐
|
|
308
351
|
│ GPT-4o ──────────┴─► Node │──────►│ Basic Chain │
|
|
309
352
|
└────────────────────────────────────────┘ │ (generates) │
|
|
310
353
|
└──────┬───────────┘
|
|
@@ -326,7 +369,7 @@ Note: Requires Ollama installed locally
|
|
|
326
369
|
v
|
|
327
370
|
┌─────────────────────────────────────┐
|
|
328
371
|
│ Ollama qwen2.5 ──┐ │
|
|
329
|
-
│ │
|
|
372
|
+
│ │ cascadeflow │ ┌──────────────────┐
|
|
330
373
|
│ GPT-4o ──────────┴─► Node │──────►│ Basic Chain │
|
|
331
374
|
└─────────────────────────────────────┘ │ (reviews code) │
|
|
332
375
|
└──────┬───────────┘
|
|
@@ -346,7 +389,7 @@ Note: Requires Ollama installed locally
|
|
|
346
389
|
**To see the actual cascade flow and which model was used:**
|
|
347
390
|
|
|
348
391
|
1. Execute your workflow
|
|
349
|
-
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)
|
|
350
393
|
3. Navigate to the **"Logs"** tab
|
|
351
394
|
4. You'll see detailed flow information showing:
|
|
352
395
|
- Whether the drafter was accepted or escalated to verifier
|
|
@@ -357,7 +400,7 @@ Note: Requires Ollama installed locally
|
|
|
357
400
|
|
|
358
401
|
The logs provide complete visibility into the cascade decision-making process, showing exactly which path was taken for each request.
|
|
359
402
|
|
|
360
|
-
> **ℹ️ 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.
|
|
361
404
|
|
|
362
405
|
## Compatibility
|
|
363
406
|
|
|
@@ -384,13 +427,13 @@ The logs provide complete visibility into the cascade decision-making process, s
|
|
|
384
427
|
|
|
385
428
|
**Solution:**
|
|
386
429
|
1. Make sure your workflow has executed successfully
|
|
387
|
-
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.)
|
|
388
431
|
3. Navigate to the **"Logs"** tab (not the "Output" tab)
|
|
389
|
-
4. The logs appear in the downstream node, not the
|
|
432
|
+
4. The logs appear in the downstream node, not the cascadeflow node itself
|
|
390
433
|
|
|
391
434
|
### Issue: "This node cannot be connected" when connecting to AI Agent
|
|
392
435
|
|
|
393
|
-
**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:
|
|
394
437
|
- ✅ Basic LLM Chain
|
|
395
438
|
- ✅ Chain
|
|
396
439
|
- ✅ Other nodes that accept Language Model connections
|
|
@@ -416,27 +459,33 @@ The logs provide complete visibility into the cascade decision-making process, s
|
|
|
416
459
|
|
|
417
460
|
## Version History
|
|
418
461
|
|
|
419
|
-
### v0.
|
|
462
|
+
### v0.6.7 (Latest)
|
|
463
|
+
|
|
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.)
|
|
467
|
+
|
|
468
|
+
### v0.6.4
|
|
469
|
+
|
|
470
|
+
- **Individual domain toggles**: Replaced multi-select with individual boolean toggles for each domain
|
|
471
|
+
- **Dynamic input ports**: Domain model inputs appear dynamically as each domain is enabled
|
|
472
|
+
|
|
473
|
+
### v0.6.3
|
|
420
474
|
|
|
421
|
-
**
|
|
475
|
+
- **16-domain routing**: Support for intelligent routing across 16 specialized domains (code, math, data, creative, legal, medical, financial, science, and more)
|
|
476
|
+
- **Circuit breaker**: Added circuit breaker pattern for improved reliability
|
|
477
|
+
- **Domain-specific models**: Connect specialized models for different query types
|
|
422
478
|
|
|
423
|
-
|
|
424
|
-
- **Real-time quality metrics**: Logs show confidence scores, alignment scores, latency breakdown, and cost savings for each request
|
|
425
|
-
- **Running statistics**: Track acceptance rates across multiple executions
|
|
426
|
-
- **Fixed UI visualization**: Swapped input order to match n8n's highlighting convention (Drafter now highlights as active)
|
|
427
|
-
- **Auto-dependency installation**: Moved @cascadeflow/core from optionalDependencies to regular dependencies
|
|
428
|
-
- **Crash fix**: Fixed n8n crashes caused by @cascadeflow/core static imports loading ML dependencies
|
|
429
|
-
- **Dynamic imports**: SemanticQualityChecker now uses dynamic imports to avoid loading @xenova/transformers at module initialization
|
|
430
|
-
- **Quality validator integration**: Integrated QualityValidator from @cascadeflow/core for improved quality scoring
|
|
431
|
-
- **Better cascade decisions**: Replaced naive length-based quality check with proper complexity-aware validation
|
|
432
|
-
- **Graceful degradation**: Added CASCADE_QUALITY_CONFIG with useSemanticValidation: false for stable operation
|
|
479
|
+
### v0.5.0
|
|
433
480
|
|
|
434
|
-
|
|
481
|
+
- **Flow visualization in n8n Logs tab**: Detailed cascade flow logging with visual boxes
|
|
482
|
+
- **Real-time quality metrics**: Confidence scores, alignment scores, latency breakdown, and cost savings
|
|
483
|
+
- **Quality validator integration**: Integrated QualityValidator from @cascadeflow/core
|
|
484
|
+
- **Better cascade decisions**: Complexity-aware validation replacing naive length-based checks
|
|
435
485
|
|
|
436
|
-
### v0.4.
|
|
486
|
+
### v0.4.x and earlier
|
|
437
487
|
|
|
438
488
|
- Initial releases as LangChain sub-node
|
|
439
489
|
- Support for any AI Chat Model in n8n
|
|
440
|
-
- Lazy verifier loading
|
|
490
|
+
- Lazy verifier loading
|
|
441
491
|
- Quality threshold configuration
|
|
442
|
-
- Console logging for cascade flow
|