n8n-nodes-caedral 0.1.0 → 0.2.0
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 +92 -46
- package/dist/nodes/Caedral/Caedral.node.d.ts +0 -31
- package/dist/nodes/Caedral/Caedral.node.js +280 -98
- package/dist/nodes/Caedral/Caedral.node.js.map +1 -1
- package/dist/nodes/Caedral/Caedral.node.json +5 -2
- package/dist/nodes/Caedral/helpers.d.ts +1 -0
- package/dist/nodes/Caedral/helpers.js +3 -0
- package/dist/nodes/Caedral/helpers.js.map +1 -1
- package/dist/nodes/CaedralChatModel/CaedralChatModel.node.d.ts +10 -0
- package/dist/nodes/CaedralChatModel/CaedralChatModel.node.js +182 -0
- package/dist/nodes/CaedralChatModel/CaedralChatModel.node.js.map +1 -0
- package/dist/nodes/CaedralChatModel/CaedralChatModel.node.json +16 -0
- package/dist/nodes/CaedralTrigger/CaedralTrigger.node.d.ts +9 -0
- package/dist/nodes/CaedralTrigger/CaedralTrigger.node.js +145 -0
- package/dist/nodes/CaedralTrigger/CaedralTrigger.node.js.map +1 -0
- package/dist/nodes/CaedralTrigger/CaedralTrigger.node.json +13 -0
- package/package.json +10 -4
package/README.md
CHANGED
|
@@ -1,92 +1,138 @@
|
|
|
1
1
|
# n8n-nodes-caedral
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Community node for [n8n](https://n8n.io/) that integrates with [Caedral AI](https://caedral.com) — unified access to frontier and proprietary AI models through one API.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
In your n8n instance:
|
|
8
|
+
|
|
9
|
+
1. Go to **Settings → Community Nodes**
|
|
10
|
+
2. Enter `n8n-nodes-caedral`
|
|
11
|
+
3. Click **Install**
|
|
12
|
+
|
|
13
|
+
Or via CLI:
|
|
8
14
|
|
|
9
15
|
```bash
|
|
10
|
-
cd ~/.n8n
|
|
16
|
+
cd ~/.n8n
|
|
11
17
|
npm install n8n-nodes-caedral
|
|
12
|
-
# Restart n8n
|
|
13
18
|
```
|
|
14
19
|
|
|
15
|
-
|
|
20
|
+
## Nodes
|
|
16
21
|
|
|
17
|
-
|
|
18
|
-
cd n8n-nodes-caedral
|
|
19
|
-
npm install && npm run build
|
|
20
|
-
npm link
|
|
21
|
-
cd ~/.n8n/custom && npm link n8n-nodes-caedral
|
|
22
|
-
```
|
|
22
|
+
### Caedral (Main Node)
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Full-featured node with 8 operations covering all Caedral API capabilities:
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
| Operation | Description |
|
|
27
|
+
|-----------|-------------|
|
|
28
|
+
| **Chat Completion** | Send messages to any Caedral model tier (Base, Titan, Olympus, Primordial) with system prompts, temperature, and max tokens |
|
|
29
|
+
| **Generate Image** | Create images from text prompts using Caedral Vision (1024×1024, 1792×1024, 1024×1792) |
|
|
30
|
+
| **Create Embedding** | Generate vector embeddings for text or arrays of texts using Caedral Embed |
|
|
31
|
+
| **Generate Audio** | Convert text to speech with voice selection (alloy, echo, fable, onyx, nova, shimmer) |
|
|
32
|
+
| **Rerank** | Semantically rerank documents by relevance to a query using Caedral Rerank |
|
|
33
|
+
| **List Models** | Retrieve all available models (chat + specialized) |
|
|
34
|
+
| **Get Usage** | Check pool balance, weekly usage, and overage status |
|
|
35
|
+
| **Get Account Info** | View account status, plan details, and billing information |
|
|
27
36
|
|
|
28
|
-
|
|
29
|
-
|-------|-------------|
|
|
30
|
-
| API Key | Your `cd_live_...` key from [Dashboard → API Keys](https://caedral.com/dashboard/api-keys) |
|
|
31
|
-
| Base URL | `https://api.caedral.com` (production) or `http://localhost:5001` (local gateway) |
|
|
37
|
+
### Caedral Chat Model (AI Sub-Node)
|
|
32
38
|
|
|
33
|
-
|
|
39
|
+
An AI Language Model node that plugs directly into n8n's native **AI Agent** and **Chain** nodes. Connect it as the language model input to instantly power your AI workflows with Caedral.
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
- Select model tier (Base/Titan/Olympus/Primordial)
|
|
42
|
+
- Configure temperature and max tokens
|
|
43
|
+
- Compatible with all n8n AI Agent patterns
|
|
36
44
|
|
|
37
|
-
###
|
|
45
|
+
### Caedral Trigger (Polling)
|
|
38
46
|
|
|
39
|
-
|
|
47
|
+
Automatically trigger workflows based on account conditions:
|
|
40
48
|
|
|
41
|
-
|
|
49
|
+
- **Balance Below Threshold** — fires when your balance in cents drops below a configured amount
|
|
50
|
+
- **Pool Usage Above Percentage** — fires when weekly pool usage exceeds a percentage threshold
|
|
42
51
|
|
|
43
|
-
|
|
44
|
-
- **Messages** — JSON array or individual role/content fields
|
|
45
|
-
- **Temperature**, **Max Tokens** — optional generation parameters
|
|
52
|
+
Polling interval configurable in n8n's trigger settings.
|
|
46
53
|
|
|
47
|
-
|
|
54
|
+
## Credentials
|
|
48
55
|
|
|
49
|
-
|
|
56
|
+
Create a **Caedral API** credential with:
|
|
50
57
|
|
|
51
|
-
|
|
58
|
+
| Field | Description |
|
|
59
|
+
|-------|-------------|
|
|
60
|
+
| **API Key** | Your `cd_live_...` key from the [Caedral dashboard](https://caedral.com/dashboard/api-keys) |
|
|
61
|
+
| **Base URL** | Default: `https://api.caedral.com`. Use `http://localhost:5001` for local development |
|
|
52
62
|
|
|
53
|
-
|
|
63
|
+
The credential is validated by calling `GET /v1/usage` on save.
|
|
54
64
|
|
|
55
|
-
|
|
56
|
-
2. **IF** — continue only if balance is sufficient
|
|
57
|
-
3. **Chat Completion** — run inference with `caedral-olympus`
|
|
58
|
-
4. Send output to Slack, email, or downstream nodes
|
|
65
|
+
## Models
|
|
59
66
|
|
|
60
|
-
|
|
67
|
+
### Chat Models (for Chat Completion & AI Agent)
|
|
61
68
|
|
|
62
|
-
|
|
69
|
+
| Model ID | Tier | Use Case |
|
|
70
|
+
|----------|------|----------|
|
|
71
|
+
| `caedral-base` | Free | Prototyping, everyday tasks |
|
|
72
|
+
| `caedral-titan` | Efficient | High-volume production |
|
|
73
|
+
| `caedral-olympus` | Balanced | Complex agentic applications |
|
|
74
|
+
| `caedral-primordial` | Frontier | Research, mission-critical |
|
|
63
75
|
|
|
64
|
-
|
|
76
|
+
### Specialized Models
|
|
65
77
|
|
|
66
|
-
|
|
67
|
-
|
|
78
|
+
| Model ID | Modality | Pricing |
|
|
79
|
+
|----------|----------|---------|
|
|
80
|
+
| `caedral-vision` | Image generation | ~$3.50/M tokens |
|
|
81
|
+
| `caedral-embed` | Text embeddings | ~$0.18/M tokens |
|
|
82
|
+
| `caedral-voice` | Audio/speech | ~$0.84/M tokens |
|
|
83
|
+
| `caedral-rerank` | Semantic reranking | ~$0.35/request |
|
|
68
84
|
|
|
69
|
-
|
|
85
|
+
## Example Workflows
|
|
86
|
+
|
|
87
|
+
### AI Agent with Caedral
|
|
88
|
+
|
|
89
|
+
1. Add an **AI Agent** node
|
|
90
|
+
2. Connect a **Caedral Chat Model** node as the Language Model input
|
|
91
|
+
3. Select your preferred model tier (e.g., Olympus for balanced performance)
|
|
92
|
+
4. Add tools (HTTP Request, Code, etc.) to the agent
|
|
93
|
+
|
|
94
|
+
### Low Balance Alert
|
|
95
|
+
|
|
96
|
+
1. Add a **Caedral Trigger** node
|
|
97
|
+
2. Set condition to "Balance Below Threshold"
|
|
98
|
+
3. Set threshold to 1000 (= $10.00)
|
|
99
|
+
4. Connect to a Slack/Email notification node
|
|
100
|
+
|
|
101
|
+
### Document Embedding Pipeline
|
|
102
|
+
|
|
103
|
+
1. Trigger: new documents arrive
|
|
104
|
+
2. **Caedral** node → Create Embedding operation
|
|
105
|
+
3. Store embeddings in your vector database
|
|
70
106
|
|
|
71
107
|
## Development
|
|
72
108
|
|
|
73
109
|
```bash
|
|
110
|
+
git clone https://github.com/caedral/n8n-nodes-caedral.git
|
|
111
|
+
cd n8n-nodes-caedral
|
|
74
112
|
npm install
|
|
75
113
|
npm run build
|
|
76
114
|
npm test
|
|
77
115
|
```
|
|
78
116
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
## Publishing
|
|
117
|
+
### Project Structure
|
|
82
118
|
|
|
83
|
-
|
|
119
|
+
```
|
|
120
|
+
├── credentials/ # API credential type
|
|
121
|
+
├── nodes/
|
|
122
|
+
│ ├── Caedral/ # Main multi-operation node
|
|
123
|
+
│ ├── CaedralChatModel/ # AI Agent sub-node
|
|
124
|
+
│ └── CaedralTrigger/ # Polling trigger node
|
|
125
|
+
├── shared/ # Constants and utilities
|
|
126
|
+
├── tests/ # Integration tests
|
|
127
|
+
└── icons/ # Node icons (light + dark)
|
|
128
|
+
```
|
|
84
129
|
|
|
85
130
|
## Links
|
|
86
131
|
|
|
87
|
-
- [Caedral
|
|
88
|
-
- [
|
|
89
|
-
- [
|
|
132
|
+
- [Caedral Documentation](https://caedral.com/docs)
|
|
133
|
+
- [API Reference](https://caedral.com/docs/api-reference)
|
|
134
|
+
- [n8n Integration Guide](https://caedral.com/docs/n8n-overview)
|
|
135
|
+
- [Report Issues](https://github.com/caedral/n8n-nodes-caedral/issues)
|
|
90
136
|
|
|
91
137
|
## License
|
|
92
138
|
|
|
@@ -1,36 +1,5 @@
|
|
|
1
1
|
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from "n8n-workflow";
|
|
2
|
-
/**
|
|
3
|
-
* n8n node exposing the Caedral API.
|
|
4
|
-
*
|
|
5
|
-
* Supports two operations:
|
|
6
|
-
* - `chatCompletion` — send a chat completion request to a Caedral
|
|
7
|
-
* model, either with a single simple message or a full JSON
|
|
8
|
-
* messages array.
|
|
9
|
-
* - `getUsage` — fetch the account's current pool, balance, and
|
|
10
|
-
* overage status.
|
|
11
|
-
*
|
|
12
|
-
* Requests are authenticated using the `caedralApi` credentials
|
|
13
|
-
* (API key + optional base URL override).
|
|
14
|
-
*/
|
|
15
2
|
export declare class Caedral implements INodeType {
|
|
16
3
|
description: INodeTypeDescription;
|
|
17
|
-
/**
|
|
18
|
-
* Execute the node for every input item.
|
|
19
|
-
*
|
|
20
|
-
* For each item, resolves the selected `operation` and dispatches
|
|
21
|
-
* the corresponding Caedral API call. On success, the response is
|
|
22
|
-
* normalized into a flat JSON object and pushed to the output.
|
|
23
|
-
*
|
|
24
|
-
* When "Continue On Fail" is enabled, per-item errors are captured
|
|
25
|
-
* as `{ error: string }` entries in the output; otherwise the
|
|
26
|
-
* error is re-thrown (wrapped in `NodeOperationError` if it is not
|
|
27
|
-
* already a node error).
|
|
28
|
-
*
|
|
29
|
-
* @returns A single-branch array of output items, one per input.
|
|
30
|
-
* @throws {NodeApiError} If the Caedral API returns a non-2xx
|
|
31
|
-
* status and "Continue On Fail" is disabled.
|
|
32
|
-
* @throws {NodeOperationError} For validation or unknown-operation
|
|
33
|
-
* errors, or when wrapping an unexpected runtime error.
|
|
34
|
-
*/
|
|
35
4
|
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
36
5
|
}
|
|
@@ -3,19 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Caedral = void 0;
|
|
4
4
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
5
|
const helpers_1 = require("./helpers");
|
|
6
|
-
/**
|
|
7
|
-
* n8n node exposing the Caedral API.
|
|
8
|
-
*
|
|
9
|
-
* Supports two operations:
|
|
10
|
-
* - `chatCompletion` — send a chat completion request to a Caedral
|
|
11
|
-
* model, either with a single simple message or a full JSON
|
|
12
|
-
* messages array.
|
|
13
|
-
* - `getUsage` — fetch the account's current pool, balance, and
|
|
14
|
-
* overage status.
|
|
15
|
-
*
|
|
16
|
-
* Requests are authenticated using the `caedralApi` credentials
|
|
17
|
-
* (API key + optional base URL override).
|
|
18
|
-
*/
|
|
19
6
|
class Caedral {
|
|
20
7
|
constructor() {
|
|
21
8
|
this.description = {
|
|
@@ -26,9 +13,9 @@ class Caedral {
|
|
|
26
13
|
dark: "file:../../icons/caedral.dark.svg",
|
|
27
14
|
},
|
|
28
15
|
group: ["transform"],
|
|
29
|
-
version:
|
|
16
|
+
version: 2,
|
|
30
17
|
subtitle: '={{$parameter["operation"]}}',
|
|
31
|
-
description: "Call Caedral AI models
|
|
18
|
+
description: "Call Caedral AI models — chat, images, embeddings, audio, rerank, and account management",
|
|
32
19
|
defaults: {
|
|
33
20
|
name: "Caedral",
|
|
34
21
|
},
|
|
@@ -54,24 +41,57 @@ class Caedral {
|
|
|
54
41
|
description: "Send a chat completion request to a Caedral model",
|
|
55
42
|
action: "Send a chat completion",
|
|
56
43
|
},
|
|
44
|
+
{
|
|
45
|
+
name: "Generate Image",
|
|
46
|
+
value: "imageGeneration",
|
|
47
|
+
description: "Generate an image from a text prompt",
|
|
48
|
+
action: "Generate an image",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "Create Embedding",
|
|
52
|
+
value: "createEmbedding",
|
|
53
|
+
description: "Create vector embeddings for text",
|
|
54
|
+
action: "Create an embedding",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "Generate Audio",
|
|
58
|
+
value: "audioGeneration",
|
|
59
|
+
description: "Generate speech audio from text",
|
|
60
|
+
action: "Generate audio",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "Rerank",
|
|
64
|
+
value: "rerank",
|
|
65
|
+
description: "Rerank documents by relevance to a query",
|
|
66
|
+
action: "Rerank documents",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "List Models",
|
|
70
|
+
value: "listModels",
|
|
71
|
+
description: "List all available Caedral models",
|
|
72
|
+
action: "List models",
|
|
73
|
+
},
|
|
57
74
|
{
|
|
58
75
|
name: "Get Usage",
|
|
59
76
|
value: "getUsage",
|
|
60
77
|
description: "Get current pool, balance, and overage status",
|
|
61
78
|
action: "Get usage",
|
|
62
79
|
},
|
|
80
|
+
{
|
|
81
|
+
name: "Get Account Info",
|
|
82
|
+
value: "getAccountInfo",
|
|
83
|
+
description: "Get account status, plan, and balance details",
|
|
84
|
+
action: "Get account info",
|
|
85
|
+
},
|
|
63
86
|
],
|
|
64
87
|
default: "chatCompletion",
|
|
65
88
|
},
|
|
89
|
+
// --- Chat Completion params ---
|
|
66
90
|
{
|
|
67
91
|
displayName: "Model",
|
|
68
92
|
name: "model",
|
|
69
93
|
type: "options",
|
|
70
|
-
displayOptions: {
|
|
71
|
-
show: {
|
|
72
|
-
operation: ["chatCompletion"],
|
|
73
|
-
},
|
|
74
|
-
},
|
|
94
|
+
displayOptions: { show: { operation: ["chatCompletion"] } },
|
|
75
95
|
options: [...helpers_1.MODEL_OPTIONS],
|
|
76
96
|
default: "caedral-base",
|
|
77
97
|
description: "The Caedral model tier to use",
|
|
@@ -80,22 +100,10 @@ class Caedral {
|
|
|
80
100
|
displayName: "Message Input Mode",
|
|
81
101
|
name: "messageMode",
|
|
82
102
|
type: "options",
|
|
83
|
-
displayOptions: {
|
|
84
|
-
show: {
|
|
85
|
-
operation: ["chatCompletion"],
|
|
86
|
-
},
|
|
87
|
-
},
|
|
103
|
+
displayOptions: { show: { operation: ["chatCompletion"] } },
|
|
88
104
|
options: [
|
|
89
|
-
{
|
|
90
|
-
|
|
91
|
-
value: "simple",
|
|
92
|
-
description: "Single user message text",
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
name: "JSON",
|
|
96
|
-
value: "json",
|
|
97
|
-
description: "Full messages array as JSON",
|
|
98
|
-
},
|
|
105
|
+
{ name: "Simple", value: "simple", description: "Single user message text" },
|
|
106
|
+
{ name: "JSON", value: "json", description: "Full messages array as JSON" },
|
|
99
107
|
],
|
|
100
108
|
default: "simple",
|
|
101
109
|
},
|
|
@@ -103,15 +111,8 @@ class Caedral {
|
|
|
103
111
|
displayName: "Message",
|
|
104
112
|
name: "message",
|
|
105
113
|
type: "string",
|
|
106
|
-
typeOptions: {
|
|
107
|
-
|
|
108
|
-
},
|
|
109
|
-
displayOptions: {
|
|
110
|
-
show: {
|
|
111
|
-
operation: ["chatCompletion"],
|
|
112
|
-
messageMode: ["simple"],
|
|
113
|
-
},
|
|
114
|
-
},
|
|
114
|
+
typeOptions: { rows: 4 },
|
|
115
|
+
displayOptions: { show: { operation: ["chatCompletion"], messageMode: ["simple"] } },
|
|
115
116
|
default: "",
|
|
116
117
|
placeholder: "Explain quantum computing in one sentence.",
|
|
117
118
|
description: "The user message sent to the model",
|
|
@@ -120,12 +121,7 @@ class Caedral {
|
|
|
120
121
|
displayName: "Messages JSON",
|
|
121
122
|
name: "messagesJson",
|
|
122
123
|
type: "json",
|
|
123
|
-
displayOptions: {
|
|
124
|
-
show: {
|
|
125
|
-
operation: ["chatCompletion"],
|
|
126
|
-
messageMode: ["json"],
|
|
127
|
-
},
|
|
128
|
-
},
|
|
124
|
+
displayOptions: { show: { operation: ["chatCompletion"], messageMode: ["json"] } },
|
|
129
125
|
default: '[{"role":"user","content":"Hello!"}]',
|
|
130
126
|
description: 'Array of message objects, e.g. [{"role":"user","content":"Hello"}]',
|
|
131
127
|
},
|
|
@@ -133,16 +129,8 @@ class Caedral {
|
|
|
133
129
|
displayName: "Temperature",
|
|
134
130
|
name: "temperature",
|
|
135
131
|
type: "number",
|
|
136
|
-
typeOptions: {
|
|
137
|
-
|
|
138
|
-
maxValue: 2,
|
|
139
|
-
numberStepSize: 0.1,
|
|
140
|
-
},
|
|
141
|
-
displayOptions: {
|
|
142
|
-
show: {
|
|
143
|
-
operation: ["chatCompletion"],
|
|
144
|
-
},
|
|
145
|
-
},
|
|
132
|
+
typeOptions: { minValue: 0, maxValue: 2, numberStepSize: 0.1 },
|
|
133
|
+
displayOptions: { show: { operation: ["chatCompletion"] } },
|
|
146
134
|
default: 1,
|
|
147
135
|
description: "Sampling temperature (0–2). Leave default to omit from request.",
|
|
148
136
|
},
|
|
@@ -150,38 +138,127 @@ class Caedral {
|
|
|
150
138
|
displayName: "Max Tokens",
|
|
151
139
|
name: "maxTokens",
|
|
152
140
|
type: "number",
|
|
153
|
-
typeOptions: {
|
|
154
|
-
|
|
155
|
-
},
|
|
156
|
-
displayOptions: {
|
|
157
|
-
show: {
|
|
158
|
-
operation: ["chatCompletion"],
|
|
159
|
-
},
|
|
160
|
-
},
|
|
141
|
+
typeOptions: { minValue: 1 },
|
|
142
|
+
displayOptions: { show: { operation: ["chatCompletion"] } },
|
|
161
143
|
default: 0,
|
|
162
144
|
description: "Maximum tokens to generate. Set to 0 to omit from request.",
|
|
163
145
|
},
|
|
146
|
+
{
|
|
147
|
+
displayName: "System Prompt",
|
|
148
|
+
name: "systemPrompt",
|
|
149
|
+
type: "string",
|
|
150
|
+
typeOptions: { rows: 3 },
|
|
151
|
+
displayOptions: { show: { operation: ["chatCompletion"], messageMode: ["simple"] } },
|
|
152
|
+
default: "",
|
|
153
|
+
description: "Optional system message prepended before the user message",
|
|
154
|
+
},
|
|
155
|
+
// --- Image Generation params ---
|
|
156
|
+
{
|
|
157
|
+
displayName: "Prompt",
|
|
158
|
+
name: "imagePrompt",
|
|
159
|
+
type: "string",
|
|
160
|
+
typeOptions: { rows: 4 },
|
|
161
|
+
displayOptions: { show: { operation: ["imageGeneration"] } },
|
|
162
|
+
default: "",
|
|
163
|
+
required: true,
|
|
164
|
+
placeholder: "A futuristic city skyline at sunset, digital art",
|
|
165
|
+
description: "Text description of the image to generate",
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
displayName: "Size",
|
|
169
|
+
name: "imageSize",
|
|
170
|
+
type: "options",
|
|
171
|
+
displayOptions: { show: { operation: ["imageGeneration"] } },
|
|
172
|
+
options: [
|
|
173
|
+
{ name: "1024x1024", value: "1024x1024" },
|
|
174
|
+
{ name: "1792x1024", value: "1792x1024" },
|
|
175
|
+
{ name: "1024x1792", value: "1024x1792" },
|
|
176
|
+
],
|
|
177
|
+
default: "1024x1024",
|
|
178
|
+
description: "Dimensions of the generated image",
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
displayName: "Number of Images",
|
|
182
|
+
name: "imageN",
|
|
183
|
+
type: "number",
|
|
184
|
+
typeOptions: { minValue: 1, maxValue: 4 },
|
|
185
|
+
displayOptions: { show: { operation: ["imageGeneration"] } },
|
|
186
|
+
default: 1,
|
|
187
|
+
description: "Number of images to generate (1–4)",
|
|
188
|
+
},
|
|
189
|
+
// --- Embedding params ---
|
|
190
|
+
{
|
|
191
|
+
displayName: "Input",
|
|
192
|
+
name: "embeddingInput",
|
|
193
|
+
type: "string",
|
|
194
|
+
typeOptions: { rows: 4 },
|
|
195
|
+
displayOptions: { show: { operation: ["createEmbedding"] } },
|
|
196
|
+
default: "",
|
|
197
|
+
required: true,
|
|
198
|
+
placeholder: "The quick brown fox jumps over the lazy dog.",
|
|
199
|
+
description: "Text to embed. For multiple texts, provide a JSON array of strings.",
|
|
200
|
+
},
|
|
201
|
+
// --- Audio params ---
|
|
202
|
+
{
|
|
203
|
+
displayName: "Input Text",
|
|
204
|
+
name: "audioInput",
|
|
205
|
+
type: "string",
|
|
206
|
+
typeOptions: { rows: 4 },
|
|
207
|
+
displayOptions: { show: { operation: ["audioGeneration"] } },
|
|
208
|
+
default: "",
|
|
209
|
+
required: true,
|
|
210
|
+
placeholder: "Welcome to Caedral, the unified AI platform.",
|
|
211
|
+
description: "Text to convert to speech",
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
displayName: "Voice",
|
|
215
|
+
name: "audioVoice",
|
|
216
|
+
type: "options",
|
|
217
|
+
displayOptions: { show: { operation: ["audioGeneration"] } },
|
|
218
|
+
options: [
|
|
219
|
+
{ name: "Alloy", value: "alloy" },
|
|
220
|
+
{ name: "Echo", value: "echo" },
|
|
221
|
+
{ name: "Fable", value: "fable" },
|
|
222
|
+
{ name: "Onyx", value: "onyx" },
|
|
223
|
+
{ name: "Nova", value: "nova" },
|
|
224
|
+
{ name: "Shimmer", value: "shimmer" },
|
|
225
|
+
],
|
|
226
|
+
default: "alloy",
|
|
227
|
+
description: "Voice style for speech generation",
|
|
228
|
+
},
|
|
229
|
+
// --- Rerank params ---
|
|
230
|
+
{
|
|
231
|
+
displayName: "Query",
|
|
232
|
+
name: "rerankQuery",
|
|
233
|
+
type: "string",
|
|
234
|
+
typeOptions: { rows: 2 },
|
|
235
|
+
displayOptions: { show: { operation: ["rerank"] } },
|
|
236
|
+
default: "",
|
|
237
|
+
required: true,
|
|
238
|
+
placeholder: "What is the capital of France?",
|
|
239
|
+
description: "The search query to rank documents against",
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
displayName: "Documents",
|
|
243
|
+
name: "rerankDocuments",
|
|
244
|
+
type: "json",
|
|
245
|
+
displayOptions: { show: { operation: ["rerank"] } },
|
|
246
|
+
default: '["Paris is the capital of France.", "Berlin is in Germany."]',
|
|
247
|
+
required: true,
|
|
248
|
+
description: "JSON array of document strings to rerank",
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
displayName: "Top N",
|
|
252
|
+
name: "rerankTopN",
|
|
253
|
+
type: "number",
|
|
254
|
+
typeOptions: { minValue: 1 },
|
|
255
|
+
displayOptions: { show: { operation: ["rerank"] } },
|
|
256
|
+
default: 0,
|
|
257
|
+
description: "Number of top results to return. 0 = return all.",
|
|
258
|
+
},
|
|
164
259
|
],
|
|
165
260
|
};
|
|
166
261
|
}
|
|
167
|
-
/**
|
|
168
|
-
* Execute the node for every input item.
|
|
169
|
-
*
|
|
170
|
-
* For each item, resolves the selected `operation` and dispatches
|
|
171
|
-
* the corresponding Caedral API call. On success, the response is
|
|
172
|
-
* normalized into a flat JSON object and pushed to the output.
|
|
173
|
-
*
|
|
174
|
-
* When "Continue On Fail" is enabled, per-item errors are captured
|
|
175
|
-
* as `{ error: string }` entries in the output; otherwise the
|
|
176
|
-
* error is re-thrown (wrapped in `NodeOperationError` if it is not
|
|
177
|
-
* already a node error).
|
|
178
|
-
*
|
|
179
|
-
* @returns A single-branch array of output items, one per input.
|
|
180
|
-
* @throws {NodeApiError} If the Caedral API returns a non-2xx
|
|
181
|
-
* status and "Continue On Fail" is disabled.
|
|
182
|
-
* @throws {NodeOperationError} For validation or unknown-operation
|
|
183
|
-
* errors, or when wrapping an unexpected runtime error.
|
|
184
|
-
*/
|
|
185
262
|
async execute() {
|
|
186
263
|
const items = this.getInputData();
|
|
187
264
|
const returnData = [];
|
|
@@ -191,7 +268,15 @@ class Caedral {
|
|
|
191
268
|
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
192
269
|
try {
|
|
193
270
|
const operation = this.getNodeParameter("operation", itemIndex);
|
|
194
|
-
if (operation === "
|
|
271
|
+
if (operation === "listModels") {
|
|
272
|
+
const response = await caedralRequest(this, baseUrl, apiKey, "GET", "/v1/models");
|
|
273
|
+
returnData.push({
|
|
274
|
+
json: { models: response.data },
|
|
275
|
+
pairedItem: { item: itemIndex },
|
|
276
|
+
});
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
if (operation === "getUsage" || operation === "getAccountInfo") {
|
|
195
280
|
const usage = await caedralRequest(this, baseUrl, apiKey, "GET", "/v1/usage");
|
|
196
281
|
returnData.push({
|
|
197
282
|
json: (0, helpers_1.formatUsageForOutput)(usage),
|
|
@@ -206,6 +291,7 @@ class Caedral {
|
|
|
206
291
|
const messagesJson = this.getNodeParameter("messagesJson", itemIndex);
|
|
207
292
|
const temperature = this.getNodeParameter("temperature", itemIndex);
|
|
208
293
|
const maxTokens = this.getNodeParameter("maxTokens", itemIndex);
|
|
294
|
+
const systemPrompt = this.getNodeParameter("systemPrompt", itemIndex, "");
|
|
209
295
|
const body = (0, helpers_1.buildChatCompletionBody)({
|
|
210
296
|
model,
|
|
211
297
|
messageMode,
|
|
@@ -213,6 +299,7 @@ class Caedral {
|
|
|
213
299
|
messagesJson: messagesJson,
|
|
214
300
|
temperature: temperature === 1 ? undefined : temperature,
|
|
215
301
|
maxTokens: maxTokens > 0 ? maxTokens : undefined,
|
|
302
|
+
systemPrompt: (systemPrompt === null || systemPrompt === void 0 ? void 0 : systemPrompt.trim()) || undefined,
|
|
216
303
|
});
|
|
217
304
|
const response = await caedralRequest(this, baseUrl, apiKey, "POST", "/v1/chat/completions", body);
|
|
218
305
|
const parsed = (0, helpers_1.parseChatCompletionResponse)(response);
|
|
@@ -228,6 +315,108 @@ class Caedral {
|
|
|
228
315
|
});
|
|
229
316
|
continue;
|
|
230
317
|
}
|
|
318
|
+
if (operation === "imageGeneration") {
|
|
319
|
+
const prompt = this.getNodeParameter("imagePrompt", itemIndex);
|
|
320
|
+
const size = this.getNodeParameter("imageSize", itemIndex);
|
|
321
|
+
const n = this.getNodeParameter("imageN", itemIndex);
|
|
322
|
+
if (!prompt.trim()) {
|
|
323
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Prompt is required.", { itemIndex });
|
|
324
|
+
}
|
|
325
|
+
const body = {
|
|
326
|
+
model: "caedral-vision",
|
|
327
|
+
prompt: prompt.trim(),
|
|
328
|
+
size,
|
|
329
|
+
};
|
|
330
|
+
if (n > 1)
|
|
331
|
+
body.n = n;
|
|
332
|
+
const response = await caedralRequest(this, baseUrl, apiKey, "POST", "/v1/images/generations", body);
|
|
333
|
+
returnData.push({
|
|
334
|
+
json: response,
|
|
335
|
+
pairedItem: { item: itemIndex },
|
|
336
|
+
});
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
339
|
+
if (operation === "createEmbedding") {
|
|
340
|
+
const inputRaw = this.getNodeParameter("embeddingInput", itemIndex);
|
|
341
|
+
if (!inputRaw.trim()) {
|
|
342
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Input is required.", { itemIndex });
|
|
343
|
+
}
|
|
344
|
+
let input;
|
|
345
|
+
try {
|
|
346
|
+
const parsed = JSON.parse(inputRaw);
|
|
347
|
+
if (Array.isArray(parsed) && parsed.every((i) => typeof i === "string")) {
|
|
348
|
+
input = parsed;
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
input = inputRaw;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
catch {
|
|
355
|
+
input = inputRaw;
|
|
356
|
+
}
|
|
357
|
+
const body = {
|
|
358
|
+
model: "caedral-embed",
|
|
359
|
+
input,
|
|
360
|
+
};
|
|
361
|
+
const response = await caedralRequest(this, baseUrl, apiKey, "POST", "/v1/embeddings", body);
|
|
362
|
+
returnData.push({
|
|
363
|
+
json: response,
|
|
364
|
+
pairedItem: { item: itemIndex },
|
|
365
|
+
});
|
|
366
|
+
continue;
|
|
367
|
+
}
|
|
368
|
+
if (operation === "audioGeneration") {
|
|
369
|
+
const inputText = this.getNodeParameter("audioInput", itemIndex);
|
|
370
|
+
const voice = this.getNodeParameter("audioVoice", itemIndex);
|
|
371
|
+
if (!inputText.trim()) {
|
|
372
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Input text is required.", { itemIndex });
|
|
373
|
+
}
|
|
374
|
+
const body = {
|
|
375
|
+
model: "caedral-voice",
|
|
376
|
+
input: inputText.trim(),
|
|
377
|
+
voice,
|
|
378
|
+
};
|
|
379
|
+
const response = await caedralRequest(this, baseUrl, apiKey, "POST", "/v1/audio/speech", body);
|
|
380
|
+
returnData.push({
|
|
381
|
+
json: response,
|
|
382
|
+
pairedItem: { item: itemIndex },
|
|
383
|
+
});
|
|
384
|
+
continue;
|
|
385
|
+
}
|
|
386
|
+
if (operation === "rerank") {
|
|
387
|
+
const query = this.getNodeParameter("rerankQuery", itemIndex);
|
|
388
|
+
const docsRaw = this.getNodeParameter("rerankDocuments", itemIndex);
|
|
389
|
+
const topN = this.getNodeParameter("rerankTopN", itemIndex);
|
|
390
|
+
if (!query.trim()) {
|
|
391
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Query is required.", { itemIndex });
|
|
392
|
+
}
|
|
393
|
+
let documents;
|
|
394
|
+
try {
|
|
395
|
+
const parsed = typeof docsRaw === "string" ? JSON.parse(docsRaw) : docsRaw;
|
|
396
|
+
if (!Array.isArray(parsed))
|
|
397
|
+
throw new Error("not array");
|
|
398
|
+
documents = parsed;
|
|
399
|
+
}
|
|
400
|
+
catch {
|
|
401
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Documents must be a valid JSON array of strings.", { itemIndex });
|
|
402
|
+
}
|
|
403
|
+
if (documents.length === 0) {
|
|
404
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), "At least one document is required.", { itemIndex });
|
|
405
|
+
}
|
|
406
|
+
const body = {
|
|
407
|
+
model: "caedral-rerank",
|
|
408
|
+
query: query.trim(),
|
|
409
|
+
documents,
|
|
410
|
+
};
|
|
411
|
+
if (topN > 0)
|
|
412
|
+
body.top_n = topN;
|
|
413
|
+
const response = await caedralRequest(this, baseUrl, apiKey, "POST", "/v1/rerank", body);
|
|
414
|
+
returnData.push({
|
|
415
|
+
json: response,
|
|
416
|
+
pairedItem: { item: itemIndex },
|
|
417
|
+
});
|
|
418
|
+
continue;
|
|
419
|
+
}
|
|
231
420
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`, {
|
|
232
421
|
itemIndex,
|
|
233
422
|
});
|
|
@@ -235,9 +424,7 @@ class Caedral {
|
|
|
235
424
|
catch (error) {
|
|
236
425
|
if (this.continueOnFail()) {
|
|
237
426
|
returnData.push({
|
|
238
|
-
json: {
|
|
239
|
-
error: error instanceof Error ? error.message : String(error),
|
|
240
|
-
},
|
|
427
|
+
json: { error: error instanceof Error ? error.message : String(error) },
|
|
241
428
|
pairedItem: { item: itemIndex },
|
|
242
429
|
});
|
|
243
430
|
continue;
|
|
@@ -245,9 +432,7 @@ class Caedral {
|
|
|
245
432
|
if (error instanceof n8n_workflow_1.NodeApiError || error instanceof n8n_workflow_1.NodeOperationError) {
|
|
246
433
|
throw error;
|
|
247
434
|
}
|
|
248
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, {
|
|
249
|
-
itemIndex,
|
|
250
|
-
});
|
|
435
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex });
|
|
251
436
|
}
|
|
252
437
|
}
|
|
253
438
|
return [returnData];
|
|
@@ -285,13 +470,10 @@ async function caedralRequest(context, baseUrl, apiKey, method, path, body) {
|
|
|
285
470
|
return responseBody;
|
|
286
471
|
}
|
|
287
472
|
catch (error) {
|
|
288
|
-
if (error instanceof n8n_workflow_1.NodeApiError)
|
|
473
|
+
if (error instanceof n8n_workflow_1.NodeApiError)
|
|
289
474
|
throw error;
|
|
290
|
-
}
|
|
291
475
|
throw new n8n_workflow_1.NodeApiError(context.getNode(), {
|
|
292
|
-
message: error instanceof Error
|
|
293
|
-
? error.message
|
|
294
|
-
: "Unexpected error calling Caedral API",
|
|
476
|
+
message: error instanceof Error ? error.message : "Unexpected error calling Caedral API",
|
|
295
477
|
});
|
|
296
478
|
}
|
|
297
479
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Caedral.node.js","sourceRoot":"","sources":["../../../nodes/Caedral/Caedral.node.ts"],"names":[],"mappings":";;;AAOA,+CAAqF;AAErF,uCAYmB;AAOnB;;;;;;;;;;;;GAYG;AACH,MAAa,OAAO;IAApB;QACE,gBAAW,GAAyB;YAClC,WAAW,EAAE,SAAS;YACtB,IAAI,EAAE,SAAS;YACf,IAAI,EAAE;gBACJ,KAAK,EAAE,8BAA8B;gBACrC,IAAI,EAAE,mCAAmC;aAC1C;YACD,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8BAA8B;YACxC,WAAW,EAAE,4DAA4D;YACzE,QAAQ,EAAE;gBACR,IAAI,EAAE,SAAS;aAChB;YACD,MAAM,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YAClC,OAAO,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YACnC,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE;gBACX;oBACE,IAAI,EAAE,YAAY;oBAClB,QAAQ,EAAE,IAAI;iBACf;aACF;YACD,UAAU,EAAE;gBACV;oBACE,WAAW,EAAE,WAAW;oBACxB,IAAI,EAAE,WAAW;oBACjB,IAAI,EAAE,SAAS;oBACf,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,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 @@
|
|
|
1
1
|
{
|
|
2
2
|
"node": "n8n-nodes-caedral",
|
|
3
|
-
"nodeVersion": "
|
|
3
|
+
"nodeVersion": "2.0",
|
|
4
4
|
"codexVersion": "1.0",
|
|
5
5
|
"categories": ["Development", "AI"],
|
|
6
|
+
"subcategories": {
|
|
7
|
+
"AI": ["Agents", "Miscellaneous"]
|
|
8
|
+
},
|
|
6
9
|
"resources": {
|
|
7
10
|
"primaryDocumentation": [
|
|
8
11
|
{
|
|
9
|
-
"url": "https://caedral.com/docs"
|
|
12
|
+
"url": "https://caedral.com/docs/n8n-overview"
|
|
10
13
|
}
|
|
11
14
|
],
|
|
12
15
|
"credentialDocumentation": [
|
|
@@ -98,6 +98,7 @@ export declare function buildChatCompletionBody(params: {
|
|
|
98
98
|
messagesJson?: string | ChatMessage[];
|
|
99
99
|
temperature?: number;
|
|
100
100
|
maxTokens?: number;
|
|
101
|
+
systemPrompt?: string;
|
|
101
102
|
}): ChatCompletionRequestBody;
|
|
102
103
|
/**
|
|
103
104
|
* Resolve the effective chat messages array for a request.
|
|
@@ -46,6 +46,9 @@ function normalizeBaseUrl(baseUrl) {
|
|
|
46
46
|
*/
|
|
47
47
|
function buildChatCompletionBody(params) {
|
|
48
48
|
const messages = resolveMessages(params.messageMode, params.message, params.messagesJson);
|
|
49
|
+
if (params.systemPrompt && params.messageMode === "simple") {
|
|
50
|
+
messages.unshift({ role: "system", content: params.systemPrompt });
|
|
51
|
+
}
|
|
49
52
|
const body = {
|
|
50
53
|
model: params.model,
|
|
51
54
|
messages,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../nodes/Caedral/helpers.ts"],"names":[],"mappings":";;;AA8EA,4CAGC;AAeD,
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../nodes/Caedral/helpers.ts"],"names":[],"mappings":";;;AA8EA,4CAGC;AAeD,0DAiCC;AAgBD,0CAkBC;AAeD,8CA+C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,CAAC;YACxC,cAAc,EAAE,MAAA,MAAA,KAAK,CAAC,OAAO,0CAAE,cAAc,mCAAI,IAAI;SACtD;QACD,8BAA8B,EAC5B,MAAA,KAAK,CAAC,8BAA8B,mCAAI,CAAC;KAC5C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAgB,qBAAqB,CACnC,UAAkB,EAClB,IAAkC;IAElC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,sBAAsB,UAAU,MAAM,IAAI,EAAE,CAAC;IACtD,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC;IACvB,IAAI,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,EAAE,CAAC;QACjB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9C,OAAO,GAAG,IAAI,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IACjC,CAAC;IAED,OAAO,sBAAsB,UAAU,GAAG,CAAC;AAC7C,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,eAAe,CAAC,OAAe,EAAE,IAAY;IAC3D,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;AACnF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { INodeType, INodeTypeDescription, ISupplyDataFunctions, SupplyData } from "n8n-workflow";
|
|
2
|
+
/**
|
|
3
|
+
* Caedral Chat Model — an AI Language Model sub-node compatible with
|
|
4
|
+
* n8n's AI Agent and Chain nodes. Implements the supplyData pattern
|
|
5
|
+
* to provide a LangChain-compatible chat model interface.
|
|
6
|
+
*/
|
|
7
|
+
export declare class CaedralChatModel implements INodeType {
|
|
8
|
+
description: INodeTypeDescription;
|
|
9
|
+
supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CaedralChatModel = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const helpers_1 = require("../Caedral/helpers");
|
|
6
|
+
/**
|
|
7
|
+
* Caedral Chat Model — an AI Language Model sub-node compatible with
|
|
8
|
+
* n8n's AI Agent and Chain nodes. Implements the supplyData pattern
|
|
9
|
+
* to provide a LangChain-compatible chat model interface.
|
|
10
|
+
*/
|
|
11
|
+
class CaedralChatModel {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.description = {
|
|
14
|
+
displayName: "Caedral Chat Model",
|
|
15
|
+
name: "caedralChatModel",
|
|
16
|
+
icon: {
|
|
17
|
+
light: "file:../../icons/caedral.svg",
|
|
18
|
+
dark: "file:../../icons/caedral.dark.svg",
|
|
19
|
+
},
|
|
20
|
+
group: ["transform"],
|
|
21
|
+
version: 1,
|
|
22
|
+
description: "Use Caedral models with AI Agent and Chain nodes",
|
|
23
|
+
defaults: {
|
|
24
|
+
name: "Caedral Chat Model",
|
|
25
|
+
},
|
|
26
|
+
codex: {
|
|
27
|
+
categories: ["AI"],
|
|
28
|
+
subcategories: {
|
|
29
|
+
AI: ["Language Models", "Chat Models"],
|
|
30
|
+
},
|
|
31
|
+
resources: {
|
|
32
|
+
primaryDocumentation: [
|
|
33
|
+
{ url: "https://caedral.com/docs/n8n-overview" },
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
inputs: [],
|
|
38
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.AiLanguageModel],
|
|
39
|
+
outputNames: ["Model"],
|
|
40
|
+
credentials: [
|
|
41
|
+
{
|
|
42
|
+
name: "caedralApi",
|
|
43
|
+
required: true,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
properties: [
|
|
47
|
+
{
|
|
48
|
+
displayName: "Model Tier",
|
|
49
|
+
name: "model",
|
|
50
|
+
type: "options",
|
|
51
|
+
options: [...helpers_1.MODEL_OPTIONS],
|
|
52
|
+
default: "caedral-olympus",
|
|
53
|
+
description: "Which Caedral model tier to use for AI Agent completions",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
displayName: "Temperature",
|
|
57
|
+
name: "temperature",
|
|
58
|
+
type: "number",
|
|
59
|
+
typeOptions: { minValue: 0, maxValue: 2, numberStepSize: 0.1 },
|
|
60
|
+
default: 0.7,
|
|
61
|
+
description: "Sampling temperature for responses",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
displayName: "Max Tokens",
|
|
65
|
+
name: "maxTokens",
|
|
66
|
+
type: "number",
|
|
67
|
+
typeOptions: { minValue: 1 },
|
|
68
|
+
default: 4096,
|
|
69
|
+
description: "Maximum tokens in the response",
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
async supplyData(itemIndex) {
|
|
75
|
+
const credentials = (await this.getCredentials("caedralApi"));
|
|
76
|
+
const baseUrl = (0, helpers_1.normalizeBaseUrl)(credentials.baseUrl);
|
|
77
|
+
const apiKey = credentials.apiKey;
|
|
78
|
+
const model = this.getNodeParameter("model", itemIndex);
|
|
79
|
+
const temperature = this.getNodeParameter("temperature", itemIndex);
|
|
80
|
+
const maxTokens = this.getNodeParameter("maxTokens", itemIndex);
|
|
81
|
+
const helpers = this.helpers;
|
|
82
|
+
const chatModel = {
|
|
83
|
+
lc_namespace: ["langchain", "chat_models", "caedral"],
|
|
84
|
+
async invoke(messages) {
|
|
85
|
+
var _a, _b, _c, _d;
|
|
86
|
+
const url = (0, helpers_1.buildRequestUrl)(baseUrl, "/v1/chat/completions");
|
|
87
|
+
const body = {
|
|
88
|
+
model,
|
|
89
|
+
messages: messages,
|
|
90
|
+
temperature,
|
|
91
|
+
max_tokens: maxTokens,
|
|
92
|
+
};
|
|
93
|
+
const response = (await helpers.httpRequest({
|
|
94
|
+
method: "POST",
|
|
95
|
+
url,
|
|
96
|
+
headers: {
|
|
97
|
+
Authorization: `Bearer ${apiKey}`,
|
|
98
|
+
"Content-Type": "application/json",
|
|
99
|
+
Accept: "application/json",
|
|
100
|
+
},
|
|
101
|
+
body,
|
|
102
|
+
json: true,
|
|
103
|
+
}));
|
|
104
|
+
const content = (_d = (_c = (_b = (_a = response.choices) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.message) === null || _c === void 0 ? void 0 : _c.content) !== null && _d !== void 0 ? _d : "";
|
|
105
|
+
return { content };
|
|
106
|
+
},
|
|
107
|
+
async _generate(messages, _options) {
|
|
108
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
109
|
+
const formatted = messages.map((m) => {
|
|
110
|
+
var _a;
|
|
111
|
+
let role = "user";
|
|
112
|
+
if (typeof m._getType === "function") {
|
|
113
|
+
const type = m._getType();
|
|
114
|
+
if (type === "system" || type === "SystemMessage")
|
|
115
|
+
role = "system";
|
|
116
|
+
else if (type === "ai" || type === "AIMessage")
|
|
117
|
+
role = "assistant";
|
|
118
|
+
else if (type === "human" || type === "HumanMessage")
|
|
119
|
+
role = "user";
|
|
120
|
+
else
|
|
121
|
+
role = type;
|
|
122
|
+
}
|
|
123
|
+
else if (m.role) {
|
|
124
|
+
role = m.role;
|
|
125
|
+
}
|
|
126
|
+
return { role, content: String((_a = m.content) !== null && _a !== void 0 ? _a : "") };
|
|
127
|
+
});
|
|
128
|
+
const url = (0, helpers_1.buildRequestUrl)(baseUrl, "/v1/chat/completions");
|
|
129
|
+
const body = {
|
|
130
|
+
model,
|
|
131
|
+
messages: formatted,
|
|
132
|
+
temperature,
|
|
133
|
+
max_tokens: maxTokens,
|
|
134
|
+
};
|
|
135
|
+
const response = (await helpers.httpRequest({
|
|
136
|
+
method: "POST",
|
|
137
|
+
url,
|
|
138
|
+
headers: {
|
|
139
|
+
Authorization: `Bearer ${apiKey}`,
|
|
140
|
+
"Content-Type": "application/json",
|
|
141
|
+
Accept: "application/json",
|
|
142
|
+
},
|
|
143
|
+
body,
|
|
144
|
+
json: true,
|
|
145
|
+
}));
|
|
146
|
+
const content = (_d = (_c = (_b = (_a = response.choices) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.message) === null || _c === void 0 ? void 0 : _c.content) !== null && _d !== void 0 ? _d : "";
|
|
147
|
+
const usage = response.usage;
|
|
148
|
+
return {
|
|
149
|
+
generations: [
|
|
150
|
+
[
|
|
151
|
+
{
|
|
152
|
+
text: content,
|
|
153
|
+
message: { content, role: "assistant" },
|
|
154
|
+
generationInfo: {
|
|
155
|
+
finishReason: (_g = (_f = (_e = response.choices) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.finish_reason) !== null && _g !== void 0 ? _g : "stop",
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
],
|
|
160
|
+
llmOutput: {
|
|
161
|
+
tokenUsage: {
|
|
162
|
+
completionTokens: (_h = usage === null || usage === void 0 ? void 0 : usage.completion_tokens) !== null && _h !== void 0 ? _h : 0,
|
|
163
|
+
promptTokens: (_j = usage === null || usage === void 0 ? void 0 : usage.prompt_tokens) !== null && _j !== void 0 ? _j : 0,
|
|
164
|
+
totalTokens: (_k = usage === null || usage === void 0 ? void 0 : usage.total_tokens) !== null && _k !== void 0 ? _k : 0,
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
},
|
|
169
|
+
_llmType() {
|
|
170
|
+
return "caedral";
|
|
171
|
+
},
|
|
172
|
+
_modelType() {
|
|
173
|
+
return "base_chat_model";
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
return {
|
|
177
|
+
response: chatModel,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
exports.CaedralChatModel = CaedralChatModel;
|
|
182
|
+
//# sourceMappingURL=CaedralChatModel.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CaedralChatModel.node.js","sourceRoot":"","sources":["../../../nodes/CaedralChatModel/CaedralChatModel.node.ts"],"names":[],"mappings":";;;AAMA,+CAAmD;AAEnD,gDAM4B;AAO5B;;;;GAIG;AACH,MAAa,gBAAgB;IAA7B;QACE,gBAAW,GAAyB;YAClC,WAAW,EAAE,oBAAoB;YACjC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE;gBACJ,KAAK,EAAE,8BAA8B;gBACrC,IAAI,EAAE,mCAAmC;aAC1C;YACD,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,kDAAkD;YAC/D,QAAQ,EAAE;gBACR,IAAI,EAAE,oBAAoB;aAC3B;YACD,KAAK,EAAE;gBACL,UAAU,EAAE,CAAC,IAAI,CAAC;gBAClB,aAAa,EAAE;oBACb,EAAE,EAAE,CAAC,iBAAiB,EAAE,aAAa,CAAC;iBACvC;gBACD,SAAS,EAAE;oBACT,oBAAoB,EAAE;wBACpB,EAAE,GAAG,EAAE,uCAAuC,EAAE;qBACjD;iBACF;aACF;YACD,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,CAAC,kCAAmB,CAAC,eAAe,CAAC;YAC9C,WAAW,EAAE,CAAC,OAAO,CAAC;YACtB,WAAW,EAAE;gBACX;oBACE,IAAI,EAAE,YAAY;oBAClB,QAAQ,EAAE,IAAI;iBACf;aACF;YACD,UAAU,EAAE;gBACV;oBACE,WAAW,EAAE,YAAY;oBACzB,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE,CAAC,GAAG,uBAAa,CAAC;oBAC3B,OAAO,EAAE,iBAAiB;oBAC1B,WAAW,EAAE,0DAA0D;i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Y,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,aAAa,mCAAI,CAAC;4BACvC,WAAW,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,YAAY,mCAAI,CAAC;yBACtC;qBACF;iBACF,CAAC;YACJ,CAAC;YAED,QAAQ;gBACN,OAAO,SAAS,CAAC;YACnB,CAAC;YAED,UAAU;gBACR,OAAO,iBAAiB,CAAC;YAC3B,CAAC;SACF,CAAC;QAEF,OAAO;YACL,QAAQ,EAAE,SAAS;SACpB,CAAC;IACJ,CAAC;CACF;AAhLD,4CAgLC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-caedral",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["AI"],
|
|
6
|
+
"subcategories": {
|
|
7
|
+
"AI": ["Language Models", "Chat Models"]
|
|
8
|
+
},
|
|
9
|
+
"resources": {
|
|
10
|
+
"primaryDocumentation": [
|
|
11
|
+
{
|
|
12
|
+
"url": "https://caedral.com/docs/n8n-overview"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { INodeExecutionData, INodeType, INodeTypeDescription, IPollFunctions } from "n8n-workflow";
|
|
2
|
+
/**
|
|
3
|
+
* Caedral Trigger — a polling trigger node that fires when the
|
|
4
|
+
* account balance drops below a user-defined threshold.
|
|
5
|
+
*/
|
|
6
|
+
export declare class CaedralTrigger implements INodeType {
|
|
7
|
+
description: INodeTypeDescription;
|
|
8
|
+
poll(this: IPollFunctions): Promise<INodeExecutionData[][] | null>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CaedralTrigger = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const helpers_1 = require("../Caedral/helpers");
|
|
6
|
+
/**
|
|
7
|
+
* Caedral Trigger — a polling trigger node that fires when the
|
|
8
|
+
* account balance drops below a user-defined threshold.
|
|
9
|
+
*/
|
|
10
|
+
class CaedralTrigger {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.description = {
|
|
13
|
+
displayName: "Caedral Trigger",
|
|
14
|
+
name: "caedralTrigger",
|
|
15
|
+
icon: {
|
|
16
|
+
light: "file:../../icons/caedral.svg",
|
|
17
|
+
dark: "file:../../icons/caedral.dark.svg",
|
|
18
|
+
},
|
|
19
|
+
group: ["trigger"],
|
|
20
|
+
version: 1,
|
|
21
|
+
subtitle: "Balance below threshold",
|
|
22
|
+
description: "Triggers when your Caedral balance drops below a specified amount",
|
|
23
|
+
defaults: {
|
|
24
|
+
name: "Caedral Trigger",
|
|
25
|
+
},
|
|
26
|
+
polling: true,
|
|
27
|
+
inputs: [],
|
|
28
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
29
|
+
credentials: [
|
|
30
|
+
{
|
|
31
|
+
name: "caedralApi",
|
|
32
|
+
required: true,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
properties: [
|
|
36
|
+
{
|
|
37
|
+
displayName: "Trigger When",
|
|
38
|
+
name: "triggerCondition",
|
|
39
|
+
type: "options",
|
|
40
|
+
options: [
|
|
41
|
+
{
|
|
42
|
+
name: "Balance Below Threshold",
|
|
43
|
+
value: "balanceBelow",
|
|
44
|
+
description: "Trigger when account balance in cents falls below the threshold",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "Pool Usage Above Percentage",
|
|
48
|
+
value: "poolAbove",
|
|
49
|
+
description: "Trigger when weekly pool usage exceeds a percentage",
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
default: "balanceBelow",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
displayName: "Balance Threshold (cents)",
|
|
56
|
+
name: "balanceThreshold",
|
|
57
|
+
type: "number",
|
|
58
|
+
typeOptions: { minValue: 0 },
|
|
59
|
+
displayOptions: { show: { triggerCondition: ["balanceBelow"] } },
|
|
60
|
+
default: 500,
|
|
61
|
+
description: "Trigger when balance drops below this amount in cents (e.g. 500 = $5.00)",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
displayName: "Pool Usage Threshold (%)",
|
|
65
|
+
name: "poolPercentage",
|
|
66
|
+
type: "number",
|
|
67
|
+
typeOptions: { minValue: 1, maxValue: 100 },
|
|
68
|
+
displayOptions: { show: { triggerCondition: ["poolAbove"] } },
|
|
69
|
+
default: 80,
|
|
70
|
+
description: "Trigger when pool usage exceeds this percentage",
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
async poll() {
|
|
76
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
77
|
+
const credentials = (await this.getCredentials("caedralApi"));
|
|
78
|
+
const baseUrl = (0, helpers_1.normalizeBaseUrl)(credentials.baseUrl);
|
|
79
|
+
const apiKey = credentials.apiKey;
|
|
80
|
+
const triggerCondition = this.getNodeParameter("triggerCondition");
|
|
81
|
+
const url = (0, helpers_1.buildRequestUrl)(baseUrl, "/v1/usage");
|
|
82
|
+
const response = (await this.helpers.httpRequest({
|
|
83
|
+
method: "GET",
|
|
84
|
+
url,
|
|
85
|
+
headers: {
|
|
86
|
+
Authorization: `Bearer ${apiKey}`,
|
|
87
|
+
Accept: "application/json",
|
|
88
|
+
},
|
|
89
|
+
json: true,
|
|
90
|
+
}));
|
|
91
|
+
if (triggerCondition === "balanceBelow") {
|
|
92
|
+
const threshold = this.getNodeParameter("balanceThreshold");
|
|
93
|
+
const balance = (_a = response.balanceCents) !== null && _a !== void 0 ? _a : 0;
|
|
94
|
+
if (balance < threshold) {
|
|
95
|
+
return [
|
|
96
|
+
[
|
|
97
|
+
{
|
|
98
|
+
json: {
|
|
99
|
+
triggered: true,
|
|
100
|
+
condition: "balanceBelow",
|
|
101
|
+
balanceCents: balance,
|
|
102
|
+
thresholdCents: threshold,
|
|
103
|
+
balanceFormatted: `$${(balance / 100).toFixed(2)}`,
|
|
104
|
+
thresholdFormatted: `$${(threshold / 100).toFixed(2)}`,
|
|
105
|
+
plan: (_b = response.plan) !== null && _b !== void 0 ? _b : "unknown",
|
|
106
|
+
accountStatus: (_c = response.accountStatus) !== null && _c !== void 0 ? _c : "unknown",
|
|
107
|
+
timestamp: new Date().toISOString(),
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
];
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (triggerCondition === "poolAbove") {
|
|
115
|
+
const poolPercentage = this.getNodeParameter("poolPercentage");
|
|
116
|
+
const poolLimit = (_e = (_d = response.weeklyPool) === null || _d === void 0 ? void 0 : _d.limit) !== null && _e !== void 0 ? _e : 0;
|
|
117
|
+
const poolUsed = (_g = (_f = response.weeklyPool) === null || _f === void 0 ? void 0 : _f.used) !== null && _g !== void 0 ? _g : 0;
|
|
118
|
+
if (poolLimit > 0) {
|
|
119
|
+
const usagePercent = Math.round((poolUsed / poolLimit) * 100);
|
|
120
|
+
if (usagePercent >= poolPercentage) {
|
|
121
|
+
return [
|
|
122
|
+
[
|
|
123
|
+
{
|
|
124
|
+
json: {
|
|
125
|
+
triggered: true,
|
|
126
|
+
condition: "poolAbove",
|
|
127
|
+
poolUsed,
|
|
128
|
+
poolLimit,
|
|
129
|
+
poolRemaining: (_j = (_h = response.weeklyPool) === null || _h === void 0 ? void 0 : _h.remaining) !== null && _j !== void 0 ? _j : 0,
|
|
130
|
+
usagePercent,
|
|
131
|
+
thresholdPercent: poolPercentage,
|
|
132
|
+
plan: (_k = response.plan) !== null && _k !== void 0 ? _k : "unknown",
|
|
133
|
+
timestamp: new Date().toISOString(),
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.CaedralTrigger = CaedralTrigger;
|
|
145
|
+
//# sourceMappingURL=CaedralTrigger.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CaedralTrigger.node.js","sourceRoot":"","sources":["../../../nodes/CaedralTrigger/CaedralTrigger.node.ts"],"names":[],"mappings":";;;AAOA,+CAAmD;AAEnD,gDAA2F;AAO3F;;;GAGG;AACH,MAAa,cAAc;IAA3B;QACE,gBAAW,GAAyB;YAClC,WAAW,EAAE,iBAAiB;YAC9B,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE;gBACJ,KAAK,EAAE,8BAA8B;gBACrC,IAAI,EAAE,mCAAmC;aAC1C;YACD,KAAK,EAAE,CAAC,SAAS,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,yBAAyB;YACnC,WAAW,EAAE,mEAAmE;YAChF,QAAQ,EAAE;gBACR,IAAI,EAAE,iBAAiB;aACxB;YACD,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YACnC,WAAW,EAAE;gBACX;oBACE,IAAI,EAAE,YAAY;oBAClB,QAAQ,EAAE,IAAI;iBACf;aACF;YACD,UAAU,EAAE;gBACV;oBACE,WAAW,EAAE,cAAc;oBAC3B,IAAI,EAAE,kBAAkB;oBACxB,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,yBAAyB;4BAC/B,KAAK,EAAE,cAAc;4BACrB,WAAW,EAAE,iEAAiE;yBAC/E;wBACD;4BACE,IAAI,EAAE,6BAA6B;4BACnC,KAAK,EAAE,WAAW;4BAClB,WAAW,EAAE,qDAAqD;yBACnE;qBACF;oBACD,OAAO,EAAE,cAAc;iBACxB;gBACD;oBACE,WAAW,EA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IAAI,YAAY,IAAI,cAAc,EAAE,CAAC;oBACnC,OAAO;wBACL;4BACE;gCACE,IAAI,EAAE;oCACJ,SAAS,EAAE,IAAI;oCACf,SAAS,EAAE,WAAW;oCACtB,QAAQ;oCACR,SAAS;oCACT,aAAa,EAAE,MAAA,MAAA,QAAQ,CAAC,UAAU,0CAAE,SAAS,mCAAI,CAAC;oCAClD,YAAY;oCACZ,gBAAgB,EAAE,cAAc;oCAChC,IAAI,EAAE,MAAA,QAAQ,CAAC,IAAI,mCAAI,SAAS;oCAChC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;iCACrB;6BACjB;yBACF;qBACF,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAzID,wCAyIC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-caedral",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "n8n community node for Caedral AI — chat
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "n8n community node for Caedral AI — chat, images, embeddings, audio, rerank, AI agents, and triggers",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"n8n-community-node-package",
|
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
"ai",
|
|
11
11
|
"llm",
|
|
12
12
|
"chatgpt",
|
|
13
|
-
"openai"
|
|
13
|
+
"openai",
|
|
14
|
+
"embeddings",
|
|
15
|
+
"image-generation",
|
|
16
|
+
"rerank",
|
|
17
|
+
"ai-agent"
|
|
14
18
|
],
|
|
15
19
|
"author": {
|
|
16
20
|
"name": "Caedral",
|
|
@@ -42,7 +46,9 @@
|
|
|
42
46
|
"dist/credentials/CaedralApi.credentials.js"
|
|
43
47
|
],
|
|
44
48
|
"nodes": [
|
|
45
|
-
"dist/nodes/Caedral/Caedral.node.js"
|
|
49
|
+
"dist/nodes/Caedral/Caedral.node.js",
|
|
50
|
+
"dist/nodes/CaedralChatModel/CaedralChatModel.node.js",
|
|
51
|
+
"dist/nodes/CaedralTrigger/CaedralTrigger.node.js"
|
|
46
52
|
]
|
|
47
53
|
},
|
|
48
54
|
"devDependencies": {
|