@alpic80/rivet-core 1.24.0-aidon.1 → 1.24.0-aidon.4
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/dist/cjs/bundle.cjs +703 -429
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/esm/api/streaming.js +59 -9
- package/dist/esm/integrations/DatasetProvider.js +1 -1
- package/dist/esm/model/GraphProcessor.js +1 -3
- package/dist/esm/model/Nodes.js +3 -0
- package/dist/esm/model/nodes/ChatNodeBase.js +10 -8
- package/dist/esm/model/nodes/CodeNode.js +0 -1
- package/dist/esm/model/nodes/CronNode.js +1 -1
- package/dist/esm/model/nodes/GetAllDatasetsNode.js +1 -1
- package/dist/esm/model/nodes/LoopControllerNode.js +1 -1
- package/dist/esm/model/nodes/ObjectNode.js +1 -1
- package/dist/esm/model/nodes/RaceInputsNode.js +1 -2
- package/dist/esm/model/nodes/ReplaceDatasetNode.js +1 -1
- package/dist/esm/model/nodes/SliceNode.js +0 -1
- package/dist/esm/model/nodes/SplitNode.js +1 -1
- package/dist/esm/model/nodes/SubGraphNode.js +0 -1
- package/dist/esm/model/nodes/WriteFileNode.js +147 -0
- package/dist/esm/native/BrowserNativeApi.js +16 -1
- package/dist/esm/plugins/aidon/nodes/ChatAidonNode.js +3 -3
- package/dist/esm/plugins/anthropic/anthropic.js +0 -4
- package/dist/esm/plugins/anthropic/nodes/ChatAnthropicNode.js +0 -3
- package/dist/esm/plugins/assemblyAi/LemurQaNode.js +1 -1
- package/dist/esm/plugins/assemblyAi/LemurSummaryNode.js +1 -1
- package/dist/esm/plugins/google/google.js +10 -4
- package/dist/esm/plugins/google/nodes/ChatGoogleNode.js +10 -4
- package/dist/esm/plugins/openai/nodes/ThreadMessageNode.js +1 -1
- package/dist/esm/recording/ExecutionRecorder.js +54 -3
- package/dist/esm/utils/base64.js +13 -0
- package/dist/esm/utils/coerceType.js +3 -0
- package/dist/types/api/streaming.d.ts +7 -0
- package/dist/types/integrations/DatasetProvider.d.ts +1 -1
- package/dist/types/model/Nodes.d.ts +3 -2
- package/dist/types/model/nodes/ChatNodeBase.d.ts +1 -1
- package/dist/types/model/nodes/GetAllDatasetsNode.d.ts +2 -2
- package/dist/types/model/nodes/ObjectNode.d.ts +2 -2
- package/dist/types/model/nodes/RaceInputsNode.d.ts +1 -2
- package/dist/types/model/nodes/SplitNode.d.ts +2 -2
- package/dist/types/model/nodes/WriteFileNode.d.ts +23 -0
- package/dist/types/native/BrowserNativeApi.d.ts +8 -5
- package/dist/types/native/NativeApi.d.ts +12 -1
- package/dist/types/plugins/google/google.d.ts +8 -0
- package/dist/types/recording/RecordedEvents.d.ts +1 -0
- package/dist/types/utils/base64.d.ts +1 -0
- package/dist/types/utils/serialization/serialization_v3.d.ts +1 -0
- package/package.json +3 -2
package/dist/cjs/bundle.cjs
CHANGED
|
@@ -108,7 +108,7 @@ __export(src_exports, {
|
|
|
108
108
|
ReadFileNodeImpl: () => ReadFileNodeImpl,
|
|
109
109
|
ReferencedGraphAliasNodeImpl: () => ReferencedGraphAliasNodeImpl,
|
|
110
110
|
ReplaceDatasetNodeImpl: () => ReplaceDatasetNodeImpl,
|
|
111
|
-
Rivet: () =>
|
|
111
|
+
Rivet: () => Rivet,
|
|
112
112
|
SetGlobalNodeImpl: () => SetGlobalNodeImpl,
|
|
113
113
|
ShuffleNodeImpl: () => ShuffleNodeImpl,
|
|
114
114
|
SliceNodeImpl: () => SliceNodeImpl,
|
|
@@ -125,6 +125,7 @@ __export(src_exports, {
|
|
|
125
125
|
VectorNearestNeighborsNodeImpl: () => VectorNearestNeighborsNodeImpl,
|
|
126
126
|
VectorStoreNodeImpl: () => VectorStoreNodeImpl,
|
|
127
127
|
WaitForEventNodeImpl: () => WaitForEventNodeImpl,
|
|
128
|
+
WriteFileNodeImpl: () => WriteFileNodeImpl,
|
|
128
129
|
abortGraphNode: () => abortGraphNode,
|
|
129
130
|
addWarning: () => addWarning,
|
|
130
131
|
aidonPlugin: () => aidon_default,
|
|
@@ -277,12 +278,14 @@ __export(src_exports, {
|
|
|
277
278
|
toYamlNode: () => toYamlNode,
|
|
278
279
|
trimChatMessagesNode: () => trimChatMessagesNode,
|
|
279
280
|
uint8ArrayToBase64: () => uint8ArrayToBase64,
|
|
281
|
+
uint8ArrayToBase64Sync: () => uint8ArrayToBase64Sync,
|
|
280
282
|
unwrapDataValue: () => unwrapDataValue,
|
|
281
283
|
urlReferenceNode: () => urlReferenceNode,
|
|
282
284
|
userInputNode: () => userInputNode,
|
|
283
285
|
vectorNearestNeighborsNode: () => vectorNearestNeighborsNode,
|
|
284
286
|
vectorStoreNode: () => vectorStoreNode,
|
|
285
287
|
waitForEventNode: () => waitForEventNode,
|
|
288
|
+
writeFileNode: () => writeFileNode,
|
|
286
289
|
yamlProblem: () => yamlProblem
|
|
287
290
|
});
|
|
288
291
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -384,6 +387,7 @@ __export(exports_exports, {
|
|
|
384
387
|
VectorNearestNeighborsNodeImpl: () => VectorNearestNeighborsNodeImpl,
|
|
385
388
|
VectorStoreNodeImpl: () => VectorStoreNodeImpl,
|
|
386
389
|
WaitForEventNodeImpl: () => WaitForEventNodeImpl,
|
|
390
|
+
WriteFileNodeImpl: () => WriteFileNodeImpl,
|
|
387
391
|
abortGraphNode: () => abortGraphNode,
|
|
388
392
|
addWarning: () => addWarning,
|
|
389
393
|
aidonPlugin: () => aidon_default,
|
|
@@ -536,12 +540,14 @@ __export(exports_exports, {
|
|
|
536
540
|
toYamlNode: () => toYamlNode,
|
|
537
541
|
trimChatMessagesNode: () => trimChatMessagesNode,
|
|
538
542
|
uint8ArrayToBase64: () => uint8ArrayToBase64,
|
|
543
|
+
uint8ArrayToBase64Sync: () => uint8ArrayToBase64Sync,
|
|
539
544
|
unwrapDataValue: () => unwrapDataValue,
|
|
540
545
|
urlReferenceNode: () => urlReferenceNode,
|
|
541
546
|
userInputNode: () => userInputNode,
|
|
542
547
|
vectorNearestNeighborsNode: () => vectorNearestNeighborsNode,
|
|
543
548
|
vectorStoreNode: () => vectorStoreNode,
|
|
544
549
|
waitForEventNode: () => waitForEventNode,
|
|
550
|
+
writeFileNode: () => writeFileNode,
|
|
545
551
|
yamlProblem: () => yamlProblem
|
|
546
552
|
});
|
|
547
553
|
|
|
@@ -1100,6 +1106,9 @@ function coerceToBinary(value) {
|
|
|
1100
1106
|
if (value.type === "number") {
|
|
1101
1107
|
return new Uint8Array([value.value]);
|
|
1102
1108
|
}
|
|
1109
|
+
if (value.type === "chat-message") {
|
|
1110
|
+
return new TextEncoder().encode(coerceToString(value));
|
|
1111
|
+
}
|
|
1103
1112
|
if (value.type === "audio" || value.type === "image" || value.type === "document") {
|
|
1104
1113
|
return value.value.data;
|
|
1105
1114
|
}
|
|
@@ -1670,6 +1679,14 @@ async function uint8ArrayToBase64(uint8Array) {
|
|
|
1670
1679
|
return dataUrl.split(",")[1];
|
|
1671
1680
|
}
|
|
1672
1681
|
}
|
|
1682
|
+
function uint8ArrayToBase64Sync(uint8Array) {
|
|
1683
|
+
if (typeof window === "undefined") {
|
|
1684
|
+
return Buffer.from(uint8Array).toString("base64");
|
|
1685
|
+
} else {
|
|
1686
|
+
const binary = Array.from(uint8Array).map((byte) => String.fromCharCode(byte)).join("");
|
|
1687
|
+
return btoa(binary);
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1673
1690
|
function base64ToUint8Array(base64) {
|
|
1674
1691
|
const binaryString = atob(base64);
|
|
1675
1692
|
const len = binaryString.length;
|
|
@@ -1768,8 +1785,8 @@ var DEFAULT_CHAT_NODE_TIMEOUT = 3e4;
|
|
|
1768
1785
|
var import_lodash_es15 = require("lodash");
|
|
1769
1786
|
var import_p_queue = __toESM(require("p-queue-6"), 1);
|
|
1770
1787
|
var import_emittery2 = __toESM(require("emittery-0-13"), 1);
|
|
1771
|
-
var
|
|
1772
|
-
var
|
|
1788
|
+
var import_non_secure76 = require("nanoid/non-secure");
|
|
1789
|
+
var import_ts_pattern9 = require("ts-pattern");
|
|
1773
1790
|
|
|
1774
1791
|
// src/model/NodeImpl.ts
|
|
1775
1792
|
var NodeImpl = class {
|
|
@@ -2169,10 +2186,10 @@ function applyProcessing(value, processingChain) {
|
|
|
2169
2186
|
return processingFunc(result, param);
|
|
2170
2187
|
}, value);
|
|
2171
2188
|
}
|
|
2172
|
-
function interpolate(baseString,
|
|
2189
|
+
function interpolate(baseString, values2) {
|
|
2173
2190
|
return baseString.replace(TOKEN_MATCH_REGEX, (_m, p1) => {
|
|
2174
2191
|
const [token, ...processing] = p1.split("|");
|
|
2175
|
-
const value =
|
|
2192
|
+
const value = values2[token.trim()];
|
|
2176
2193
|
if (value === void 0)
|
|
2177
2194
|
return "";
|
|
2178
2195
|
if (processing.length > 0) {
|
|
@@ -2186,8 +2203,8 @@ function interpolate(baseString, values3) {
|
|
|
2186
2203
|
function extractInterpolationVariables(template) {
|
|
2187
2204
|
const matches = template.matchAll(TOKEN_MATCH_REGEX);
|
|
2188
2205
|
const variables = /* @__PURE__ */ new Set();
|
|
2189
|
-
for (const
|
|
2190
|
-
const [token] =
|
|
2206
|
+
for (const match13 of matches) {
|
|
2207
|
+
const [token] = match13[1].split("|");
|
|
2191
2208
|
variables.add(token.trim());
|
|
2192
2209
|
}
|
|
2193
2210
|
return Array.from(variables);
|
|
@@ -3687,22 +3704,18 @@ var ChatNodeBase = {
|
|
|
3687
3704
|
const audioCompletionCostPerThousand = costs ? "audioCompletion" in costs ? costs.audioCompletion : 0 : 0;
|
|
3688
3705
|
const promptCost2 = getCostForTokens(
|
|
3689
3706
|
response.usage.prompt_tokens_details.text_tokens,
|
|
3690
|
-
"prompt",
|
|
3691
3707
|
promptCostPerThousand2
|
|
3692
3708
|
);
|
|
3693
3709
|
const completionCost2 = getCostForTokens(
|
|
3694
3710
|
response.usage.completion_tokens_details.text_tokens,
|
|
3695
|
-
"completion",
|
|
3696
3711
|
completionCostPerThousand2
|
|
3697
3712
|
);
|
|
3698
3713
|
const audioPromptCost = getCostForTokens(
|
|
3699
3714
|
response.usage.prompt_tokens_details.audio_tokens,
|
|
3700
|
-
"prompt",
|
|
3701
3715
|
audioPromptCostPerThousand
|
|
3702
3716
|
);
|
|
3703
3717
|
const audioCompletionCost = getCostForTokens(
|
|
3704
3718
|
response.usage.completion_tokens_details.audio_tokens,
|
|
3705
|
-
"completion",
|
|
3706
3719
|
audioCompletionCostPerThousand
|
|
3707
3720
|
);
|
|
3708
3721
|
output["cost"] = {
|
|
@@ -3870,12 +3883,8 @@ var ChatNodeBase = {
|
|
|
3870
3883
|
const outputTokensForCostCalculation = (usage == null ? void 0 : usage.completion_tokens_details) ? usage.completion_tokens_details.rejected_prediction_tokens > 0 ? usage.completion_tokens_details.rejected_prediction_tokens : usage.completion_tokens : outputTokenCount;
|
|
3871
3884
|
const promptCostPerThousand = model in openaiModels ? openaiModels[model].cost.prompt : 0;
|
|
3872
3885
|
const completionCostPerThousand = model in openaiModels ? openaiModels[model].cost.completion : 0;
|
|
3873
|
-
const promptCost = getCostForTokens(inputTokenCount,
|
|
3874
|
-
const completionCost = getCostForTokens(
|
|
3875
|
-
outputTokensForCostCalculation,
|
|
3876
|
-
"completion",
|
|
3877
|
-
completionCostPerThousand
|
|
3878
|
-
);
|
|
3886
|
+
const promptCost = getCostForTokens(inputTokenCount, promptCostPerThousand);
|
|
3887
|
+
const completionCost = getCostForTokens(outputTokensForCostCalculation, completionCostPerThousand);
|
|
3879
3888
|
const cost = promptCost + completionCost;
|
|
3880
3889
|
if (usage) {
|
|
3881
3890
|
output["usage"] = {
|
|
@@ -4002,7 +4011,7 @@ function getChatNodeMessages(inputs) {
|
|
|
4002
4011
|
}
|
|
4003
4012
|
return { messages, systemPrompt };
|
|
4004
4013
|
}
|
|
4005
|
-
function getCostForTokens(tokenCount,
|
|
4014
|
+
function getCostForTokens(tokenCount, costPerThousand) {
|
|
4006
4015
|
return tokenCount / 1e3 * costPerThousand;
|
|
4007
4016
|
}
|
|
4008
4017
|
function audioFormatToMediaType(format) {
|
|
@@ -4436,13 +4445,13 @@ var ExtractRegexNodeImpl = class extends NodeImpl {
|
|
|
4436
4445
|
const regex = expectTypeOptional(inputs["regex"], "string") ?? this.chartNode.data.regex;
|
|
4437
4446
|
const regExp = new RegExp(regex, this.data.multilineMode ? "gm" : "g");
|
|
4438
4447
|
let matches = [];
|
|
4439
|
-
let
|
|
4448
|
+
let match13;
|
|
4440
4449
|
let firstMatch;
|
|
4441
|
-
while ((
|
|
4450
|
+
while ((match13 = regExp.exec(inputString)) !== null) {
|
|
4442
4451
|
if (!firstMatch) {
|
|
4443
|
-
firstMatch =
|
|
4452
|
+
firstMatch = match13;
|
|
4444
4453
|
}
|
|
4445
|
-
matches.push(
|
|
4454
|
+
matches.push(match13[1]);
|
|
4446
4455
|
}
|
|
4447
4456
|
matches = matches.filter((m) => m);
|
|
4448
4457
|
if (matches.length === 0 && this.chartNode.data.errorOnFailed) {
|
|
@@ -4762,9 +4771,9 @@ var MatchNodeImpl = class extends NodeImpl {
|
|
|
4762
4771
|
const output = {};
|
|
4763
4772
|
for (let i = 0; i < cases.length; i++) {
|
|
4764
4773
|
const regExp = new RegExp(cases[i]);
|
|
4765
|
-
const
|
|
4774
|
+
const match13 = regExp.test(inputString);
|
|
4766
4775
|
const canMatch = !this.data.exclusive || !matched;
|
|
4767
|
-
if (
|
|
4776
|
+
if (match13 && canMatch) {
|
|
4768
4777
|
matched = true;
|
|
4769
4778
|
output[`case${i + 1}`] = {
|
|
4770
4779
|
type: outputType,
|
|
@@ -5255,15 +5264,154 @@ var ReadFileNodeImpl = class extends NodeImpl {
|
|
|
5255
5264
|
};
|
|
5256
5265
|
var readFileNode = nodeDefinition(ReadFileNodeImpl, "Read File");
|
|
5257
5266
|
|
|
5258
|
-
// src/model/nodes/
|
|
5267
|
+
// src/model/nodes/WriteFileNode.ts
|
|
5259
5268
|
var import_non_secure13 = require("nanoid/non-secure");
|
|
5260
5269
|
var import_ts_dedent12 = require("ts-dedent");
|
|
5270
|
+
var mimeToExtension = {
|
|
5271
|
+
"image/jpeg": "jpg",
|
|
5272
|
+
"image/png": "png",
|
|
5273
|
+
"image/gif": "gif",
|
|
5274
|
+
"audio/wav": "wav",
|
|
5275
|
+
"audio/mpeg ": "mp3",
|
|
5276
|
+
"audio/mp3": "mp3",
|
|
5277
|
+
"audio/ogg": "ogg"
|
|
5278
|
+
};
|
|
5279
|
+
var WriteFileNodeImpl = class extends NodeImpl {
|
|
5280
|
+
static create() {
|
|
5281
|
+
return {
|
|
5282
|
+
id: (0, import_non_secure13.nanoid)(),
|
|
5283
|
+
type: "writeFile",
|
|
5284
|
+
title: "Write File",
|
|
5285
|
+
visualData: { x: 0, y: 0, width: 250 },
|
|
5286
|
+
data: {
|
|
5287
|
+
path: "",
|
|
5288
|
+
asBinary: false,
|
|
5289
|
+
usePathOutput: true,
|
|
5290
|
+
overwriteExistingFile: false
|
|
5291
|
+
}
|
|
5292
|
+
};
|
|
5293
|
+
}
|
|
5294
|
+
getInputDefinitions() {
|
|
5295
|
+
const inputDefinitions = [
|
|
5296
|
+
{
|
|
5297
|
+
id: "content",
|
|
5298
|
+
title: "Content",
|
|
5299
|
+
dataType: this.data.asBinary ? "binary" : "string"
|
|
5300
|
+
}
|
|
5301
|
+
];
|
|
5302
|
+
if (this.chartNode.data.usePathOutput) {
|
|
5303
|
+
inputDefinitions.push({
|
|
5304
|
+
id: "path",
|
|
5305
|
+
title: "Path",
|
|
5306
|
+
dataType: "string",
|
|
5307
|
+
coerced: false
|
|
5308
|
+
});
|
|
5309
|
+
}
|
|
5310
|
+
return inputDefinitions;
|
|
5311
|
+
}
|
|
5312
|
+
getOutputDefinitions() {
|
|
5313
|
+
return [
|
|
5314
|
+
{
|
|
5315
|
+
id: "outputContent",
|
|
5316
|
+
title: "Content",
|
|
5317
|
+
dataType: this.data.asBinary ? "binary" : "string"
|
|
5318
|
+
}
|
|
5319
|
+
];
|
|
5320
|
+
}
|
|
5321
|
+
static getUIData() {
|
|
5322
|
+
return {
|
|
5323
|
+
infoBoxBody: import_ts_dedent12.dedent`
|
|
5324
|
+
Writes the contents of the specified file and outputs it as a string.
|
|
5325
|
+
`,
|
|
5326
|
+
infoBoxTitle: "Write File Node",
|
|
5327
|
+
contextMenuTitle: "Write File",
|
|
5328
|
+
group: ["Input/Output"]
|
|
5329
|
+
};
|
|
5330
|
+
}
|
|
5331
|
+
getEditors() {
|
|
5332
|
+
return [
|
|
5333
|
+
{
|
|
5334
|
+
type: "string",
|
|
5335
|
+
label: "Path",
|
|
5336
|
+
dataKey: "path",
|
|
5337
|
+
useInputToggleDataKey: "usePathOutput"
|
|
5338
|
+
},
|
|
5339
|
+
{
|
|
5340
|
+
type: "toggle",
|
|
5341
|
+
label: "Overwrite Existing File instead of making additional copy",
|
|
5342
|
+
dataKey: "overwriteExistingFile"
|
|
5343
|
+
},
|
|
5344
|
+
{
|
|
5345
|
+
type: "toggle",
|
|
5346
|
+
label: "Read as Binary",
|
|
5347
|
+
dataKey: "asBinary"
|
|
5348
|
+
}
|
|
5349
|
+
];
|
|
5350
|
+
}
|
|
5351
|
+
getBody() {
|
|
5352
|
+
return import_ts_dedent12.dedent`
|
|
5353
|
+
${this.data.asBinary ? "Write as Binary" : "Write as Text"}
|
|
5354
|
+
${this.data.usePathOutput ? "" : `Path: ${this.data.path}`}
|
|
5355
|
+
`;
|
|
5356
|
+
}
|
|
5357
|
+
async process(inputData, context) {
|
|
5358
|
+
var _a;
|
|
5359
|
+
const { nativeApi } = context;
|
|
5360
|
+
const inputContent = inputData["content"] ?? { type: "any", value: void 0 };
|
|
5361
|
+
if (nativeApi == null) {
|
|
5362
|
+
throw new Error("This node requires a native API to run.");
|
|
5363
|
+
}
|
|
5364
|
+
const currentPath = (_a = context.project.metadata) == null ? void 0 : _a.path;
|
|
5365
|
+
if (!currentPath) {
|
|
5366
|
+
throw new Error("Project metadata is missing path.");
|
|
5367
|
+
}
|
|
5368
|
+
const folderPath = currentPath.replace(".rivet-project", ".rivet-files");
|
|
5369
|
+
await nativeApi.createdir(folderPath, true);
|
|
5370
|
+
let path = getInputOrData(this.chartNode.data, inputData, "path");
|
|
5371
|
+
const interpolations = extractInterpolationVariables(path);
|
|
5372
|
+
if (interpolations.includes("ext")) {
|
|
5373
|
+
let extension = "txt";
|
|
5374
|
+
if (this.data.asBinary) {
|
|
5375
|
+
if (inputContent.type === "audio") {
|
|
5376
|
+
extension = mimeToExtension[inputContent.value.mediaType ?? ""] ?? "audio";
|
|
5377
|
+
} else if (inputContent.type === "image") {
|
|
5378
|
+
extension = mimeToExtension[inputContent.value.mediaType ?? ""] ?? "image";
|
|
5379
|
+
} else {
|
|
5380
|
+
extension = "binary";
|
|
5381
|
+
}
|
|
5382
|
+
}
|
|
5383
|
+
path = interpolate(path, { ext: extension });
|
|
5384
|
+
}
|
|
5385
|
+
let fileDestination = await nativeApi.join(folderPath, path);
|
|
5386
|
+
if (!this.data.overwriteExistingFile) {
|
|
5387
|
+
fileDestination = await nativeApi.uniqueFilename(fileDestination);
|
|
5388
|
+
}
|
|
5389
|
+
if (this.data.asBinary) {
|
|
5390
|
+
const content = coerceTypeOptional(inputContent, "binary") ?? new Uint8Array();
|
|
5391
|
+
await nativeApi.writeBinaryFile(fileDestination, content);
|
|
5392
|
+
return {
|
|
5393
|
+
["outputContent"]: { type: "binary", value: content }
|
|
5394
|
+
};
|
|
5395
|
+
} else {
|
|
5396
|
+
const content = coerceTypeOptional(inputContent, "string") ?? "";
|
|
5397
|
+
await nativeApi.writeTextFile(fileDestination, content);
|
|
5398
|
+
return {
|
|
5399
|
+
["outputContent"]: { type: "string", value: content }
|
|
5400
|
+
};
|
|
5401
|
+
}
|
|
5402
|
+
}
|
|
5403
|
+
};
|
|
5404
|
+
var writeFileNode = nodeDefinition(WriteFileNodeImpl, "Write File");
|
|
5405
|
+
|
|
5406
|
+
// src/model/nodes/IfElseNode.ts
|
|
5407
|
+
var import_non_secure14 = require("nanoid/non-secure");
|
|
5408
|
+
var import_ts_dedent13 = require("ts-dedent");
|
|
5261
5409
|
var IfElseNodeImpl = class extends NodeImpl {
|
|
5262
5410
|
static create = () => {
|
|
5263
5411
|
const chartNode = {
|
|
5264
5412
|
type: "ifElse",
|
|
5265
5413
|
title: "If/Else",
|
|
5266
|
-
id: (0,
|
|
5414
|
+
id: (0, import_non_secure14.nanoid)(),
|
|
5267
5415
|
data: {
|
|
5268
5416
|
// Legacy behavior is false
|
|
5269
5417
|
unconnectedControlFlowExcluded: true
|
|
@@ -5310,7 +5458,7 @@ var IfElseNodeImpl = class extends NodeImpl {
|
|
|
5310
5458
|
}
|
|
5311
5459
|
static getUIData() {
|
|
5312
5460
|
return {
|
|
5313
|
-
infoBoxBody:
|
|
5461
|
+
infoBoxBody: import_ts_dedent13.dedent`
|
|
5314
5462
|
Takes in three inputs: a condition, a true value, and a false value. If the condition is truthy, the true value is passed through the output port. If the condition is not truthy, the false value is passed through the output port.
|
|
5315
5463
|
|
|
5316
5464
|
This node can "consume" a \`Not Ran\` to continue a graph from that point.
|
|
@@ -5389,14 +5537,14 @@ var IfElseNodeImpl = class extends NodeImpl {
|
|
|
5389
5537
|
var ifElseNode = nodeDefinition(IfElseNodeImpl, "If/Else");
|
|
5390
5538
|
|
|
5391
5539
|
// src/model/nodes/ChunkNode.ts
|
|
5392
|
-
var
|
|
5393
|
-
var
|
|
5540
|
+
var import_non_secure15 = require("nanoid/non-secure");
|
|
5541
|
+
var import_ts_dedent14 = require("ts-dedent");
|
|
5394
5542
|
var ChunkNodeImpl = class extends NodeImpl {
|
|
5395
5543
|
static create() {
|
|
5396
5544
|
const chartNode = {
|
|
5397
5545
|
type: "chunk",
|
|
5398
5546
|
title: "Chunk",
|
|
5399
|
-
id: (0,
|
|
5547
|
+
id: (0, import_non_secure15.nanoid)(),
|
|
5400
5548
|
visualData: {
|
|
5401
5549
|
x: 0,
|
|
5402
5550
|
y: 0,
|
|
@@ -5485,7 +5633,7 @@ var ChunkNodeImpl = class extends NodeImpl {
|
|
|
5485
5633
|
];
|
|
5486
5634
|
}
|
|
5487
5635
|
getBody() {
|
|
5488
|
-
return
|
|
5636
|
+
return import_ts_dedent14.dedent`
|
|
5489
5637
|
Model: ${this.data.model}
|
|
5490
5638
|
Token Count: ${this.data.numTokensPerChunk.toLocaleString()}
|
|
5491
5639
|
${this.data.overlap ? `Overlap: ${this.data.overlap}%` : ""}
|
|
@@ -5493,7 +5641,7 @@ var ChunkNodeImpl = class extends NodeImpl {
|
|
|
5493
5641
|
}
|
|
5494
5642
|
static getUIData() {
|
|
5495
5643
|
return {
|
|
5496
|
-
infoBoxBody:
|
|
5644
|
+
infoBoxBody: import_ts_dedent14.dedent`
|
|
5497
5645
|
Splits the input text into an array of chunks based on an approximate GPT token count per chunk.
|
|
5498
5646
|
|
|
5499
5647
|
The "overlap" setting allows you to partially overlap the chunks for redundancy.
|
|
@@ -5559,14 +5707,14 @@ async function chunkStringByTokenCount(tokenizer, tokenizerInfo, input, targetTo
|
|
|
5559
5707
|
}
|
|
5560
5708
|
|
|
5561
5709
|
// src/model/nodes/GraphInputNode.ts
|
|
5562
|
-
var
|
|
5563
|
-
var
|
|
5710
|
+
var import_non_secure16 = require("nanoid/non-secure");
|
|
5711
|
+
var import_ts_dedent15 = require("ts-dedent");
|
|
5564
5712
|
var GraphInputNodeImpl = class extends NodeImpl {
|
|
5565
5713
|
static create() {
|
|
5566
5714
|
const chartNode = {
|
|
5567
5715
|
type: "graphInput",
|
|
5568
5716
|
title: "Graph Input",
|
|
5569
|
-
id: (0,
|
|
5717
|
+
id: (0, import_non_secure16.nanoid)(),
|
|
5570
5718
|
visualData: {
|
|
5571
5719
|
x: 0,
|
|
5572
5720
|
y: 0,
|
|
@@ -5641,7 +5789,7 @@ var GraphInputNodeImpl = class extends NodeImpl {
|
|
|
5641
5789
|
];
|
|
5642
5790
|
}
|
|
5643
5791
|
getBody() {
|
|
5644
|
-
return
|
|
5792
|
+
return import_ts_dedent15.dedent`
|
|
5645
5793
|
${this.data.id}
|
|
5646
5794
|
Type: ${this.data.dataType}
|
|
5647
5795
|
${this.data.defaultValue == null ? "" : `Default: ${this.data.defaultValue}`}
|
|
@@ -5649,7 +5797,7 @@ var GraphInputNodeImpl = class extends NodeImpl {
|
|
|
5649
5797
|
}
|
|
5650
5798
|
static getUIData() {
|
|
5651
5799
|
return {
|
|
5652
|
-
infoBoxBody:
|
|
5800
|
+
infoBoxBody: import_ts_dedent15.dedent`
|
|
5653
5801
|
Defines an input for the graph which can be passed in when the graph is called, or defines one of the input ports when the graph is a subgraph.
|
|
5654
5802
|
`,
|
|
5655
5803
|
infoBoxTitle: "Graph Input Node",
|
|
@@ -5678,14 +5826,14 @@ var GraphInputNodeImpl = class extends NodeImpl {
|
|
|
5678
5826
|
var graphInputNode = nodeDefinition(GraphInputNodeImpl, "Graph Input");
|
|
5679
5827
|
|
|
5680
5828
|
// src/model/nodes/GraphOutputNode.ts
|
|
5681
|
-
var
|
|
5682
|
-
var
|
|
5829
|
+
var import_non_secure17 = require("nanoid/non-secure");
|
|
5830
|
+
var import_ts_dedent16 = require("ts-dedent");
|
|
5683
5831
|
var GraphOutputNodeImpl = class extends NodeImpl {
|
|
5684
5832
|
static create() {
|
|
5685
5833
|
const chartNode = {
|
|
5686
5834
|
type: "graphOutput",
|
|
5687
5835
|
title: "Graph Output",
|
|
5688
|
-
id: (0,
|
|
5836
|
+
id: (0, import_non_secure17.nanoid)(),
|
|
5689
5837
|
visualData: {
|
|
5690
5838
|
x: 0,
|
|
5691
5839
|
y: 0,
|
|
@@ -5731,14 +5879,14 @@ var GraphOutputNodeImpl = class extends NodeImpl {
|
|
|
5731
5879
|
];
|
|
5732
5880
|
}
|
|
5733
5881
|
getBody() {
|
|
5734
|
-
return
|
|
5882
|
+
return import_ts_dedent16.dedent`
|
|
5735
5883
|
${this.data.id}
|
|
5736
5884
|
Type: ${this.data.dataType}
|
|
5737
5885
|
`;
|
|
5738
5886
|
}
|
|
5739
5887
|
static getUIData() {
|
|
5740
5888
|
return {
|
|
5741
|
-
infoBoxBody:
|
|
5889
|
+
infoBoxBody: import_ts_dedent16.dedent`
|
|
5742
5890
|
Each instance of this node represents an individual output of the graph. The value passed into this node becomes part of the overall output of the graph.
|
|
5743
5891
|
`,
|
|
5744
5892
|
infoBoxTitle: "Graph Output Node",
|
|
@@ -5774,15 +5922,14 @@ var GraphOutputNodeImpl = class extends NodeImpl {
|
|
|
5774
5922
|
var graphOutputNode = nodeDefinition(GraphOutputNodeImpl, "Graph Output");
|
|
5775
5923
|
|
|
5776
5924
|
// src/model/nodes/SubGraphNode.ts
|
|
5777
|
-
var
|
|
5778
|
-
var
|
|
5779
|
-
var import_ts_pattern5 = require("ts-pattern");
|
|
5925
|
+
var import_non_secure18 = require("nanoid/non-secure");
|
|
5926
|
+
var import_ts_dedent17 = require("ts-dedent");
|
|
5780
5927
|
var SubGraphNodeImpl = class extends NodeImpl {
|
|
5781
5928
|
static create() {
|
|
5782
5929
|
const chartNode = {
|
|
5783
5930
|
type: "subGraph",
|
|
5784
5931
|
title: "Subgraph",
|
|
5785
|
-
id: (0,
|
|
5932
|
+
id: (0, import_non_secure18.nanoid)(),
|
|
5786
5933
|
visualData: {
|
|
5787
5934
|
x: 0,
|
|
5788
5935
|
y: 0,
|
|
@@ -5874,7 +6021,7 @@ var SubGraphNodeImpl = class extends NodeImpl {
|
|
|
5874
6021
|
}
|
|
5875
6022
|
static getUIData() {
|
|
5876
6023
|
return {
|
|
5877
|
-
infoBoxBody:
|
|
6024
|
+
infoBoxBody: import_ts_dedent17.dedent`
|
|
5878
6025
|
Executes another graph. Inputs and outputs are defined by Graph Input and Graph Output nodes within the subgraph.
|
|
5879
6026
|
`,
|
|
5880
6027
|
infoBoxTitle: "Subgraph Node",
|
|
@@ -5956,15 +6103,15 @@ var SubGraphNodeImpl = class extends NodeImpl {
|
|
|
5956
6103
|
var subGraphNode = nodeDefinition(SubGraphNodeImpl, "Subgraph");
|
|
5957
6104
|
|
|
5958
6105
|
// src/model/nodes/ArrayNode.ts
|
|
5959
|
-
var
|
|
6106
|
+
var import_non_secure19 = require("nanoid/non-secure");
|
|
5960
6107
|
var import_lodash_es6 = require("lodash");
|
|
5961
|
-
var
|
|
6108
|
+
var import_ts_dedent18 = require("ts-dedent");
|
|
5962
6109
|
var ArrayNodeImpl = class extends NodeImpl {
|
|
5963
6110
|
static create() {
|
|
5964
6111
|
const chartNode = {
|
|
5965
6112
|
type: "array",
|
|
5966
6113
|
title: "Array",
|
|
5967
|
-
id: (0,
|
|
6114
|
+
id: (0, import_non_secure19.nanoid)(),
|
|
5968
6115
|
visualData: {
|
|
5969
6116
|
x: 0,
|
|
5970
6117
|
y: 0,
|
|
@@ -6038,7 +6185,7 @@ var ArrayNodeImpl = class extends NodeImpl {
|
|
|
6038
6185
|
}
|
|
6039
6186
|
static getUIData() {
|
|
6040
6187
|
return {
|
|
6041
|
-
infoBoxBody:
|
|
6188
|
+
infoBoxBody: import_ts_dedent18.dedent`
|
|
6042
6189
|
Creates an array from the input values. By default, flattens any arrays which are inputs into a single array. Can be configured to keep the arrays separate, or deeply flatten arrays.
|
|
6043
6190
|
|
|
6044
6191
|
Useful for both creating and merging arrays.
|
|
@@ -6051,7 +6198,7 @@ var ArrayNodeImpl = class extends NodeImpl {
|
|
|
6051
6198
|
};
|
|
6052
6199
|
}
|
|
6053
6200
|
getBody() {
|
|
6054
|
-
return
|
|
6201
|
+
return import_ts_dedent18.dedent`
|
|
6055
6202
|
${this.data.flatten ? this.data.flattenDeep ? "Flatten (Deep)" : "Flatten" : "No Flatten"}
|
|
6056
6203
|
`;
|
|
6057
6204
|
}
|
|
@@ -6095,14 +6242,14 @@ var ArrayNodeImpl = class extends NodeImpl {
|
|
|
6095
6242
|
var arrayNode = nodeDefinition(ArrayNodeImpl, "Array");
|
|
6096
6243
|
|
|
6097
6244
|
// src/model/nodes/ExtractJsonNode.ts
|
|
6098
|
-
var
|
|
6099
|
-
var
|
|
6245
|
+
var import_non_secure20 = require("nanoid/non-secure");
|
|
6246
|
+
var import_ts_dedent19 = require("ts-dedent");
|
|
6100
6247
|
var ExtractJsonNodeImpl = class extends NodeImpl {
|
|
6101
6248
|
static create() {
|
|
6102
6249
|
const chartNode = {
|
|
6103
6250
|
type: "extractJson",
|
|
6104
6251
|
title: "Extract JSON",
|
|
6105
|
-
id: (0,
|
|
6252
|
+
id: (0, import_non_secure20.nanoid)(),
|
|
6106
6253
|
visualData: {
|
|
6107
6254
|
x: 0,
|
|
6108
6255
|
y: 0,
|
|
@@ -6139,7 +6286,7 @@ var ExtractJsonNodeImpl = class extends NodeImpl {
|
|
|
6139
6286
|
}
|
|
6140
6287
|
static getUIData() {
|
|
6141
6288
|
return {
|
|
6142
|
-
infoBoxBody:
|
|
6289
|
+
infoBoxBody: import_ts_dedent19.dedent`
|
|
6143
6290
|
Finds and parses the first JSON object in the input text.
|
|
6144
6291
|
|
|
6145
6292
|
Outputs the parsed object.
|
|
@@ -6202,15 +6349,15 @@ var ExtractJsonNodeImpl = class extends NodeImpl {
|
|
|
6202
6349
|
var extractJsonNode = nodeDefinition(ExtractJsonNodeImpl, "Extract JSON");
|
|
6203
6350
|
|
|
6204
6351
|
// src/model/nodes/AssemblePromptNode.ts
|
|
6205
|
-
var
|
|
6352
|
+
var import_non_secure21 = require("nanoid/non-secure");
|
|
6206
6353
|
var import_lodash_es7 = require("lodash");
|
|
6207
|
-
var
|
|
6354
|
+
var import_ts_dedent20 = require("ts-dedent");
|
|
6208
6355
|
var AssemblePromptNodeImpl = class extends NodeImpl {
|
|
6209
6356
|
static create() {
|
|
6210
6357
|
const chartNode = {
|
|
6211
6358
|
type: "assemblePrompt",
|
|
6212
6359
|
title: "Assemble Prompt",
|
|
6213
|
-
id: (0,
|
|
6360
|
+
id: (0, import_non_secure21.nanoid)(),
|
|
6214
6361
|
visualData: {
|
|
6215
6362
|
x: 0,
|
|
6216
6363
|
y: 0,
|
|
@@ -6276,7 +6423,7 @@ var AssemblePromptNodeImpl = class extends NodeImpl {
|
|
|
6276
6423
|
}
|
|
6277
6424
|
static getUIData() {
|
|
6278
6425
|
return {
|
|
6279
|
-
infoBoxBody:
|
|
6426
|
+
infoBoxBody: import_ts_dedent20.dedent`
|
|
6280
6427
|
Assembles an array of chat messages for use with a Chat node. The inputs can be strings or chat messages.
|
|
6281
6428
|
|
|
6282
6429
|
The number of inputs is dynamic based on the number of connections.
|
|
@@ -6353,16 +6500,16 @@ var AssemblePromptNodeImpl = class extends NodeImpl {
|
|
|
6353
6500
|
var assemblePromptNode = nodeDefinition(AssemblePromptNodeImpl, "Assemble Prompt");
|
|
6354
6501
|
|
|
6355
6502
|
// src/model/nodes/ExtractYamlNode.ts
|
|
6356
|
-
var
|
|
6503
|
+
var import_non_secure22 = require("nanoid/non-secure");
|
|
6357
6504
|
var import_yaml = __toESM(require("yaml"), 1);
|
|
6358
6505
|
var import_jsonpath_plus = require("jsonpath-plus");
|
|
6359
|
-
var
|
|
6506
|
+
var import_ts_dedent21 = require("ts-dedent");
|
|
6360
6507
|
var ExtractYamlNodeImpl = class extends NodeImpl {
|
|
6361
6508
|
static create() {
|
|
6362
6509
|
const chartNode = {
|
|
6363
6510
|
type: "extractYaml",
|
|
6364
6511
|
title: "Extract YAML",
|
|
6365
|
-
id: (0,
|
|
6512
|
+
id: (0, import_non_secure22.nanoid)(),
|
|
6366
6513
|
visualData: {
|
|
6367
6514
|
x: 0,
|
|
6368
6515
|
y: 0,
|
|
@@ -6442,14 +6589,14 @@ var ExtractYamlNodeImpl = class extends NodeImpl {
|
|
|
6442
6589
|
];
|
|
6443
6590
|
}
|
|
6444
6591
|
getBody() {
|
|
6445
|
-
return
|
|
6592
|
+
return import_ts_dedent21.dedent`
|
|
6446
6593
|
Root: ${this.data.useRootPropertyNameInput ? "(Using Input)" : this.data.rootPropertyName}
|
|
6447
6594
|
${this.data.useObjectPathInput ? "Path: (Using Input)" : this.data.objectPath ? `Path: ${this.data.objectPath}` : ``}
|
|
6448
6595
|
`;
|
|
6449
6596
|
}
|
|
6450
6597
|
static getUIData() {
|
|
6451
6598
|
return {
|
|
6452
|
-
infoBoxBody:
|
|
6599
|
+
infoBoxBody: import_ts_dedent21.dedent`
|
|
6453
6600
|
Finds and parses a YAML object in the input text with a predefined root property name (configurable).
|
|
6454
6601
|
|
|
6455
6602
|
Defaults to \`yamlDocument\`, which means the input text must have a \`yamlDocument:\` root node somewhere in it. All indented text after that is considered part of the YAML.
|
|
@@ -6466,8 +6613,8 @@ var ExtractYamlNodeImpl = class extends NodeImpl {
|
|
|
6466
6613
|
const inputString = expectType(inputs["input"], "string");
|
|
6467
6614
|
const rootPropertyName = this.data.useRootPropertyNameInput ? coerceType(inputs["rootPropertyName"], "string") : this.data.rootPropertyName;
|
|
6468
6615
|
const objectPath = this.data.useObjectPathInput ? coerceType(inputs["objectPath"], "string") : this.data.objectPath;
|
|
6469
|
-
const
|
|
6470
|
-
const rootPropertyStart = (
|
|
6616
|
+
const match13 = new RegExp(`^${rootPropertyName}:`, "m").exec(inputString);
|
|
6617
|
+
const rootPropertyStart = (match13 == null ? void 0 : match13.index) ?? -1;
|
|
6471
6618
|
const nextLines = inputString.slice(rootPropertyStart).split("\n");
|
|
6472
6619
|
const yamlLines = [nextLines.shift()];
|
|
6473
6620
|
while (((_a = nextLines[0]) == null ? void 0 : _a.startsWith(" ")) || ((_b = nextLines[0]) == null ? void 0 : _b.startsWith(" ")) || nextLines[0] === "") {
|
|
@@ -6549,14 +6696,14 @@ var ExtractYamlNodeImpl = class extends NodeImpl {
|
|
|
6549
6696
|
var extractYamlNode = nodeDefinition(ExtractYamlNodeImpl, "Extract YAML");
|
|
6550
6697
|
|
|
6551
6698
|
// src/model/nodes/LoopControllerNode.ts
|
|
6552
|
-
var
|
|
6553
|
-
var
|
|
6699
|
+
var import_non_secure23 = require("nanoid/non-secure");
|
|
6700
|
+
var import_ts_dedent22 = require("ts-dedent");
|
|
6554
6701
|
var LoopControllerNodeImpl = class extends NodeImpl {
|
|
6555
6702
|
static create() {
|
|
6556
6703
|
const chartNode = {
|
|
6557
6704
|
type: "loopController",
|
|
6558
6705
|
title: "Loop Controller",
|
|
6559
|
-
id: (0,
|
|
6706
|
+
id: (0, import_non_secure23.nanoid)(),
|
|
6560
6707
|
visualData: {
|
|
6561
6708
|
x: 0,
|
|
6562
6709
|
y: 0,
|
|
@@ -6662,7 +6809,7 @@ var LoopControllerNodeImpl = class extends NodeImpl {
|
|
|
6662
6809
|
}
|
|
6663
6810
|
static getUIData() {
|
|
6664
6811
|
return {
|
|
6665
|
-
infoBoxBody:
|
|
6812
|
+
infoBoxBody: import_ts_dedent22.dedent`
|
|
6666
6813
|
Defines the entry point for a loop. Values from inside the loop should be passed back through the "Input" ports, and their corresponding "Default" values can be specified on the input ports as well.
|
|
6667
6814
|
|
|
6668
6815
|
If the "continue" input is falsey, then the "break" output will run.
|
|
@@ -6748,14 +6895,14 @@ var LoopControllerNodeImpl = class extends NodeImpl {
|
|
|
6748
6895
|
var loopControllerNode = nodeDefinition(LoopControllerNodeImpl, "Loop Controller");
|
|
6749
6896
|
|
|
6750
6897
|
// src/model/nodes/TrimChatMessagesNode.ts
|
|
6751
|
-
var
|
|
6752
|
-
var
|
|
6898
|
+
var import_non_secure24 = require("nanoid/non-secure");
|
|
6899
|
+
var import_ts_dedent23 = require("ts-dedent");
|
|
6753
6900
|
var TrimChatMessagesNodeImpl = class extends NodeImpl {
|
|
6754
6901
|
static create() {
|
|
6755
6902
|
const chartNode = {
|
|
6756
6903
|
type: "trimChatMessages",
|
|
6757
6904
|
title: "Trim Chat Messages",
|
|
6758
|
-
id: (0,
|
|
6905
|
+
id: (0, import_non_secure24.nanoid)(),
|
|
6759
6906
|
visualData: {
|
|
6760
6907
|
x: 0,
|
|
6761
6908
|
y: 0,
|
|
@@ -6818,14 +6965,14 @@ var TrimChatMessagesNodeImpl = class extends NodeImpl {
|
|
|
6818
6965
|
];
|
|
6819
6966
|
}
|
|
6820
6967
|
getBody() {
|
|
6821
|
-
return
|
|
6968
|
+
return import_ts_dedent23.dedent`
|
|
6822
6969
|
Max Token Count: ${this.data.useMaxTokenCountInput ? "(From Input)" : this.data.maxTokenCount}
|
|
6823
6970
|
Remove From Beginning: ${this.data.useRemoveFromBeginningInput ? "(From Input)" : this.data.removeFromBeginning ? "Yes" : "No"}
|
|
6824
6971
|
`;
|
|
6825
6972
|
}
|
|
6826
6973
|
static getUIData() {
|
|
6827
6974
|
return {
|
|
6828
|
-
infoBoxBody:
|
|
6975
|
+
infoBoxBody: import_ts_dedent23.dedent`
|
|
6829
6976
|
Takes an array of chat messages, and slices messages from the beginning or the end of the list until the total length of the messages is under the configured token length.
|
|
6830
6977
|
|
|
6831
6978
|
Useful for setting up infinite message chains that stay under the LLM context limit.
|
|
@@ -6863,13 +7010,13 @@ var TrimChatMessagesNodeImpl = class extends NodeImpl {
|
|
|
6863
7010
|
var trimChatMessagesNode = nodeDefinition(TrimChatMessagesNodeImpl, "Trim Chat Messages");
|
|
6864
7011
|
|
|
6865
7012
|
// src/model/nodes/ExternalCallNode.ts
|
|
6866
|
-
var
|
|
7013
|
+
var import_non_secure25 = require("nanoid/non-secure");
|
|
6867
7014
|
var import_lodash_es8 = require("lodash");
|
|
6868
|
-
var
|
|
7015
|
+
var import_ts_dedent24 = require("ts-dedent");
|
|
6869
7016
|
var ExternalCallNodeImpl = class extends NodeImpl {
|
|
6870
7017
|
static create() {
|
|
6871
7018
|
return {
|
|
6872
|
-
id: (0,
|
|
7019
|
+
id: (0, import_non_secure25.nanoid)(),
|
|
6873
7020
|
type: "externalCall",
|
|
6874
7021
|
title: "External Call",
|
|
6875
7022
|
visualData: { x: 0, y: 0, width: 150 },
|
|
@@ -6933,7 +7080,7 @@ var ExternalCallNodeImpl = class extends NodeImpl {
|
|
|
6933
7080
|
}
|
|
6934
7081
|
static getUIData() {
|
|
6935
7082
|
return {
|
|
6936
|
-
infoBoxBody:
|
|
7083
|
+
infoBoxBody: import_ts_dedent24.dedent`
|
|
6937
7084
|
Provides a way to call into the host project from inside a Rivet graph when Rivet graphs are integrated into another project.
|
|
6938
7085
|
`,
|
|
6939
7086
|
infoBoxTitle: "External Call Node",
|
|
@@ -7012,15 +7159,15 @@ var ExternalCallNodeImpl = class extends NodeImpl {
|
|
|
7012
7159
|
var externalCallNode = nodeDefinition(ExternalCallNodeImpl, "External Call");
|
|
7013
7160
|
|
|
7014
7161
|
// src/model/nodes/ExtractObjectPathNode.ts
|
|
7015
|
-
var
|
|
7162
|
+
var import_non_secure26 = require("nanoid/non-secure");
|
|
7016
7163
|
var import_jsonpath_plus2 = require("jsonpath-plus");
|
|
7017
|
-
var
|
|
7164
|
+
var import_ts_dedent25 = require("ts-dedent");
|
|
7018
7165
|
var ExtractObjectPathNodeImpl = class extends NodeImpl {
|
|
7019
7166
|
static create() {
|
|
7020
7167
|
const chartNode = {
|
|
7021
7168
|
type: "extractObjectPath",
|
|
7022
7169
|
title: "Extract Object Path",
|
|
7023
|
-
id: (0,
|
|
7170
|
+
id: (0, import_non_secure26.nanoid)(),
|
|
7024
7171
|
visualData: {
|
|
7025
7172
|
x: 0,
|
|
7026
7173
|
y: 0,
|
|
@@ -7083,7 +7230,7 @@ var ExtractObjectPathNodeImpl = class extends NodeImpl {
|
|
|
7083
7230
|
}
|
|
7084
7231
|
static getUIData() {
|
|
7085
7232
|
return {
|
|
7086
|
-
infoBoxBody:
|
|
7233
|
+
infoBoxBody: import_ts_dedent25.dedent`
|
|
7087
7234
|
Extracts the value at the specified path from the input value. The path uses JSONPath notation to navigate through the value.
|
|
7088
7235
|
`,
|
|
7089
7236
|
infoBoxTitle: "Extract Object Path Node",
|
|
@@ -7099,8 +7246,8 @@ var ExtractObjectPathNodeImpl = class extends NodeImpl {
|
|
|
7099
7246
|
}
|
|
7100
7247
|
let matches;
|
|
7101
7248
|
try {
|
|
7102
|
-
const
|
|
7103
|
-
matches =
|
|
7249
|
+
const match13 = (0, import_jsonpath_plus2.JSONPath)({ json: inputObject ?? null, path: inputPath.trim(), wrap: true });
|
|
7250
|
+
matches = match13 == null ? [] : match13;
|
|
7104
7251
|
} catch (err) {
|
|
7105
7252
|
matches = [];
|
|
7106
7253
|
}
|
|
@@ -7131,12 +7278,12 @@ var ExtractObjectPathNodeImpl = class extends NodeImpl {
|
|
|
7131
7278
|
var extractObjectPathNode = nodeDefinition(ExtractObjectPathNodeImpl, "Extract Object Path");
|
|
7132
7279
|
|
|
7133
7280
|
// src/model/nodes/RaiseEventNode.ts
|
|
7134
|
-
var
|
|
7135
|
-
var
|
|
7281
|
+
var import_non_secure27 = require("nanoid/non-secure");
|
|
7282
|
+
var import_ts_dedent26 = require("ts-dedent");
|
|
7136
7283
|
var RaiseEventNodeImpl = class extends NodeImpl {
|
|
7137
7284
|
static create() {
|
|
7138
7285
|
return {
|
|
7139
|
-
id: (0,
|
|
7286
|
+
id: (0, import_non_secure27.nanoid)(),
|
|
7140
7287
|
type: "raiseEvent",
|
|
7141
7288
|
title: "Raise Event",
|
|
7142
7289
|
visualData: { x: 0, y: 0, width: 150 },
|
|
@@ -7186,7 +7333,7 @@ var RaiseEventNodeImpl = class extends NodeImpl {
|
|
|
7186
7333
|
}
|
|
7187
7334
|
static getUIData() {
|
|
7188
7335
|
return {
|
|
7189
|
-
infoBoxBody:
|
|
7336
|
+
infoBoxBody: import_ts_dedent26.dedent`
|
|
7190
7337
|
Raises an event that the host project or a 'Wait For Event' node can listen for.
|
|
7191
7338
|
`,
|
|
7192
7339
|
infoBoxTitle: "Raise Event Node",
|
|
@@ -7206,14 +7353,14 @@ var RaiseEventNodeImpl = class extends NodeImpl {
|
|
|
7206
7353
|
var raiseEventNode = nodeDefinition(RaiseEventNodeImpl, "Raise Event");
|
|
7207
7354
|
|
|
7208
7355
|
// src/model/nodes/ContextNode.ts
|
|
7209
|
-
var
|
|
7210
|
-
var
|
|
7356
|
+
var import_non_secure28 = require("nanoid/non-secure");
|
|
7357
|
+
var import_ts_dedent27 = require("ts-dedent");
|
|
7211
7358
|
var ContextNodeImpl = class extends NodeImpl {
|
|
7212
7359
|
static create() {
|
|
7213
7360
|
const chartNode = {
|
|
7214
7361
|
type: "context",
|
|
7215
7362
|
title: "Context",
|
|
7216
|
-
id: (0,
|
|
7363
|
+
id: (0, import_non_secure28.nanoid)(),
|
|
7217
7364
|
visualData: {
|
|
7218
7365
|
x: 0,
|
|
7219
7366
|
y: 0,
|
|
@@ -7262,14 +7409,14 @@ var ContextNodeImpl = class extends NodeImpl {
|
|
|
7262
7409
|
];
|
|
7263
7410
|
}
|
|
7264
7411
|
getBody() {
|
|
7265
|
-
return
|
|
7412
|
+
return import_ts_dedent27.dedent`
|
|
7266
7413
|
${this.data.id}
|
|
7267
7414
|
Type: ${this.data.dataType}
|
|
7268
7415
|
`;
|
|
7269
7416
|
}
|
|
7270
7417
|
static getUIData() {
|
|
7271
7418
|
return {
|
|
7272
|
-
infoBoxBody:
|
|
7419
|
+
infoBoxBody: import_ts_dedent27.dedent`
|
|
7273
7420
|
Retrieves a value from the graph's context using a configured id. The context serves as a "global graph input", allowing the same values to be accessible from any graph or subgraph.
|
|
7274
7421
|
`,
|
|
7275
7422
|
infoBoxTitle: "Context Node",
|
|
@@ -7298,14 +7445,14 @@ var ContextNodeImpl = class extends NodeImpl {
|
|
|
7298
7445
|
var contextNode = nodeDefinition(ContextNodeImpl, "Context");
|
|
7299
7446
|
|
|
7300
7447
|
// src/model/nodes/CoalesceNode.ts
|
|
7301
|
-
var
|
|
7302
|
-
var
|
|
7448
|
+
var import_non_secure29 = require("nanoid/non-secure");
|
|
7449
|
+
var import_ts_dedent28 = require("ts-dedent");
|
|
7303
7450
|
var CoalesceNodeImpl = class extends NodeImpl {
|
|
7304
7451
|
static create = () => {
|
|
7305
7452
|
const chartNode = {
|
|
7306
7453
|
type: "coalesce",
|
|
7307
7454
|
title: "Coalesce",
|
|
7308
|
-
id: (0,
|
|
7455
|
+
id: (0, import_non_secure29.nanoid)(),
|
|
7309
7456
|
data: {},
|
|
7310
7457
|
visualData: {
|
|
7311
7458
|
x: 0,
|
|
@@ -7343,7 +7490,7 @@ var CoalesceNodeImpl = class extends NodeImpl {
|
|
|
7343
7490
|
}
|
|
7344
7491
|
static getUIData() {
|
|
7345
7492
|
return {
|
|
7346
|
-
infoBoxBody:
|
|
7493
|
+
infoBoxBody: import_ts_dedent28.dedent`
|
|
7347
7494
|
Takes in any number of inputs and outputs the first value that exists. Useful for consolidating branches after a Match node. This node can also "consume" the "Not Ran" value.
|
|
7348
7495
|
`,
|
|
7349
7496
|
infoBoxTitle: "Coalesce Node",
|
|
@@ -7399,14 +7546,14 @@ var CoalesceNodeImpl = class extends NodeImpl {
|
|
|
7399
7546
|
var coalesceNode = nodeDefinition(CoalesceNodeImpl, "Coalesce");
|
|
7400
7547
|
|
|
7401
7548
|
// src/model/nodes/PassthroughNode.ts
|
|
7402
|
-
var
|
|
7403
|
-
var
|
|
7549
|
+
var import_non_secure30 = require("nanoid/non-secure");
|
|
7550
|
+
var import_ts_dedent29 = require("ts-dedent");
|
|
7404
7551
|
var PassthroughNodeImpl = class extends NodeImpl {
|
|
7405
7552
|
static create = () => {
|
|
7406
7553
|
const chartNode = {
|
|
7407
7554
|
type: "passthrough",
|
|
7408
7555
|
title: "Passthrough",
|
|
7409
|
-
id: (0,
|
|
7556
|
+
id: (0, import_non_secure30.nanoid)(),
|
|
7410
7557
|
data: {},
|
|
7411
7558
|
visualData: {
|
|
7412
7559
|
x: 0,
|
|
@@ -7442,7 +7589,7 @@ var PassthroughNodeImpl = class extends NodeImpl {
|
|
|
7442
7589
|
}
|
|
7443
7590
|
static getUIData() {
|
|
7444
7591
|
return {
|
|
7445
|
-
infoBoxBody:
|
|
7592
|
+
infoBoxBody: import_ts_dedent29.dedent`
|
|
7446
7593
|
Simply passes the input value to the output without any modifications.
|
|
7447
7594
|
`,
|
|
7448
7595
|
infoBoxTitle: "Passthrough Node",
|
|
@@ -7477,14 +7624,14 @@ var PassthroughNodeImpl = class extends NodeImpl {
|
|
|
7477
7624
|
var passthroughNode = nodeDefinition(PassthroughNodeImpl, "Passthrough");
|
|
7478
7625
|
|
|
7479
7626
|
// src/model/nodes/PopNode.ts
|
|
7480
|
-
var
|
|
7481
|
-
var
|
|
7627
|
+
var import_non_secure31 = require("nanoid/non-secure");
|
|
7628
|
+
var import_ts_dedent30 = require("ts-dedent");
|
|
7482
7629
|
var PopNodeImpl = class extends NodeImpl {
|
|
7483
7630
|
static create() {
|
|
7484
7631
|
const baseNode = {
|
|
7485
7632
|
type: "pop",
|
|
7486
7633
|
title: "Pop",
|
|
7487
|
-
id: (0,
|
|
7634
|
+
id: (0, import_non_secure31.nanoid)(),
|
|
7488
7635
|
visualData: {
|
|
7489
7636
|
x: 0,
|
|
7490
7637
|
y: 0,
|
|
@@ -7529,7 +7676,7 @@ var PopNodeImpl = class extends NodeImpl {
|
|
|
7529
7676
|
}
|
|
7530
7677
|
static getUIData() {
|
|
7531
7678
|
return {
|
|
7532
|
-
infoBoxBody:
|
|
7679
|
+
infoBoxBody: import_ts_dedent30.dedent`
|
|
7533
7680
|
Pops the last value off the input array and outputs the new array and the popped value.
|
|
7534
7681
|
|
|
7535
7682
|
Can also be used to just extract the last value from an array.
|
|
@@ -7565,14 +7712,14 @@ var PopNodeImpl = class extends NodeImpl {
|
|
|
7565
7712
|
var popNode = nodeDefinition(PopNodeImpl, "Pop");
|
|
7566
7713
|
|
|
7567
7714
|
// src/model/nodes/SetGlobalNode.ts
|
|
7568
|
-
var
|
|
7569
|
-
var
|
|
7715
|
+
var import_non_secure32 = require("nanoid/non-secure");
|
|
7716
|
+
var import_ts_dedent31 = require("ts-dedent");
|
|
7570
7717
|
var SetGlobalNodeImpl = class extends NodeImpl {
|
|
7571
7718
|
static create() {
|
|
7572
7719
|
const chartNode = {
|
|
7573
7720
|
type: "setGlobal",
|
|
7574
7721
|
title: "Set Global",
|
|
7575
|
-
id: (0,
|
|
7722
|
+
id: (0, import_non_secure32.nanoid)(),
|
|
7576
7723
|
visualData: {
|
|
7577
7724
|
x: 0,
|
|
7578
7725
|
y: 0,
|
|
@@ -7639,14 +7786,14 @@ var SetGlobalNodeImpl = class extends NodeImpl {
|
|
|
7639
7786
|
];
|
|
7640
7787
|
}
|
|
7641
7788
|
getBody() {
|
|
7642
|
-
return
|
|
7789
|
+
return import_ts_dedent31.dedent`
|
|
7643
7790
|
${this.data.id}
|
|
7644
7791
|
Type: ${this.data.dataType}
|
|
7645
7792
|
`;
|
|
7646
7793
|
}
|
|
7647
7794
|
static getUIData() {
|
|
7648
7795
|
return {
|
|
7649
|
-
infoBoxBody:
|
|
7796
|
+
infoBoxBody: import_ts_dedent31.dedent`
|
|
7650
7797
|
Sets a global value that is shared across all graphs and subgraphs. The id of the global value and the value itself are configured in this node.
|
|
7651
7798
|
`,
|
|
7652
7799
|
infoBoxTitle: "Set Global Node",
|
|
@@ -7681,14 +7828,14 @@ var SetGlobalNodeImpl = class extends NodeImpl {
|
|
|
7681
7828
|
var setGlobalNode = nodeDefinition(SetGlobalNodeImpl, "Set Global");
|
|
7682
7829
|
|
|
7683
7830
|
// src/model/nodes/GetGlobalNode.ts
|
|
7684
|
-
var
|
|
7685
|
-
var
|
|
7831
|
+
var import_non_secure33 = require("nanoid/non-secure");
|
|
7832
|
+
var import_ts_dedent32 = require("ts-dedent");
|
|
7686
7833
|
var GetGlobalNodeImpl = class extends NodeImpl {
|
|
7687
7834
|
static create() {
|
|
7688
7835
|
const chartNode = {
|
|
7689
7836
|
type: "getGlobal",
|
|
7690
7837
|
title: "Get Global",
|
|
7691
|
-
id: (0,
|
|
7838
|
+
id: (0, import_non_secure33.nanoid)(),
|
|
7692
7839
|
visualData: {
|
|
7693
7840
|
x: 0,
|
|
7694
7841
|
y: 0,
|
|
@@ -7757,7 +7904,7 @@ var GetGlobalNodeImpl = class extends NodeImpl {
|
|
|
7757
7904
|
];
|
|
7758
7905
|
}
|
|
7759
7906
|
getBody() {
|
|
7760
|
-
return
|
|
7907
|
+
return import_ts_dedent32.dedent`
|
|
7761
7908
|
${this.data.useIdInput ? "(ID from input)" : this.data.id}
|
|
7762
7909
|
Type: ${this.data.dataType}
|
|
7763
7910
|
${this.data.wait ? "Waits for available data" : ""}
|
|
@@ -7765,7 +7912,7 @@ var GetGlobalNodeImpl = class extends NodeImpl {
|
|
|
7765
7912
|
}
|
|
7766
7913
|
static getUIData() {
|
|
7767
7914
|
return {
|
|
7768
|
-
infoBoxBody:
|
|
7915
|
+
infoBoxBody: import_ts_dedent32.dedent`
|
|
7769
7916
|
Retrieves a global value that is shared across all graphs and subgraphs. The id of the global value is configured in this node.
|
|
7770
7917
|
`,
|
|
7771
7918
|
infoBoxTitle: "Get Global Node",
|
|
@@ -7812,12 +7959,12 @@ var GetGlobalNodeImpl = class extends NodeImpl {
|
|
|
7812
7959
|
var getGlobalNode = nodeDefinition(GetGlobalNodeImpl, "Get Global");
|
|
7813
7960
|
|
|
7814
7961
|
// src/model/nodes/WaitForEventNode.ts
|
|
7815
|
-
var
|
|
7816
|
-
var
|
|
7962
|
+
var import_non_secure34 = require("nanoid/non-secure");
|
|
7963
|
+
var import_ts_dedent33 = require("ts-dedent");
|
|
7817
7964
|
var WaitForEventNodeImpl = class extends NodeImpl {
|
|
7818
7965
|
static create() {
|
|
7819
7966
|
return {
|
|
7820
|
-
id: (0,
|
|
7967
|
+
id: (0, import_non_secure34.nanoid)(),
|
|
7821
7968
|
type: "waitForEvent",
|
|
7822
7969
|
title: "Wait For Event",
|
|
7823
7970
|
visualData: { x: 0, y: 0, width: 150 },
|
|
@@ -7872,7 +8019,7 @@ var WaitForEventNodeImpl = class extends NodeImpl {
|
|
|
7872
8019
|
}
|
|
7873
8020
|
static getUIData() {
|
|
7874
8021
|
return {
|
|
7875
|
-
infoBoxBody:
|
|
8022
|
+
infoBoxBody: import_ts_dedent33.dedent`
|
|
7876
8023
|
Waits for a specific event to be raised by a 'Raise Event' node or the host project. The event name can be configured.
|
|
7877
8024
|
`,
|
|
7878
8025
|
infoBoxTitle: "Wait For Event Node",
|
|
@@ -7892,14 +8039,14 @@ var WaitForEventNodeImpl = class extends NodeImpl {
|
|
|
7892
8039
|
var waitForEventNode = nodeDefinition(WaitForEventNodeImpl, "Wait For Event");
|
|
7893
8040
|
|
|
7894
8041
|
// src/model/nodes/ToolNode.ts
|
|
7895
|
-
var
|
|
7896
|
-
var
|
|
8042
|
+
var import_non_secure35 = require("nanoid/non-secure");
|
|
8043
|
+
var import_ts_dedent34 = require("ts-dedent");
|
|
7897
8044
|
var GptFunctionNodeImpl = class extends NodeImpl {
|
|
7898
8045
|
static create() {
|
|
7899
8046
|
const chartNode = {
|
|
7900
8047
|
type: "gptFunction",
|
|
7901
8048
|
title: "Tool",
|
|
7902
|
-
id: (0,
|
|
8049
|
+
id: (0, import_non_secure35.nanoid)(),
|
|
7903
8050
|
visualData: {
|
|
7904
8051
|
x: 0,
|
|
7905
8052
|
y: 0,
|
|
@@ -7908,7 +8055,7 @@ var GptFunctionNodeImpl = class extends NodeImpl {
|
|
|
7908
8055
|
data: {
|
|
7909
8056
|
name: "newTool",
|
|
7910
8057
|
description: "No description provided",
|
|
7911
|
-
schema:
|
|
8058
|
+
schema: import_ts_dedent34.dedent`
|
|
7912
8059
|
{
|
|
7913
8060
|
"type": "object",
|
|
7914
8061
|
"properties": {}
|
|
@@ -8010,7 +8157,7 @@ var GptFunctionNodeImpl = class extends NodeImpl {
|
|
|
8010
8157
|
}
|
|
8011
8158
|
static getUIData() {
|
|
8012
8159
|
return {
|
|
8013
|
-
infoBoxBody:
|
|
8160
|
+
infoBoxBody: import_ts_dedent34.dedent`
|
|
8014
8161
|
Defines a tool, which is a method that the LLM can call in its responses.
|
|
8015
8162
|
`,
|
|
8016
8163
|
infoBoxTitle: "Tool Node",
|
|
@@ -8053,15 +8200,15 @@ var GptFunctionNodeImpl = class extends NodeImpl {
|
|
|
8053
8200
|
var gptFunctionNode = nodeDefinition(GptFunctionNodeImpl, "Tool");
|
|
8054
8201
|
|
|
8055
8202
|
// src/model/nodes/ToYamlNode.ts
|
|
8056
|
-
var
|
|
8203
|
+
var import_non_secure36 = require("nanoid/non-secure");
|
|
8057
8204
|
var import_yaml2 = __toESM(require("yaml"), 1);
|
|
8058
|
-
var
|
|
8205
|
+
var import_ts_dedent35 = require("ts-dedent");
|
|
8059
8206
|
var ToYamlNodeImpl = class extends NodeImpl {
|
|
8060
8207
|
static create() {
|
|
8061
8208
|
const chartNode = {
|
|
8062
8209
|
type: "toYaml",
|
|
8063
8210
|
title: "To YAML",
|
|
8064
|
-
id: (0,
|
|
8211
|
+
id: (0, import_non_secure36.nanoid)(),
|
|
8065
8212
|
visualData: {
|
|
8066
8213
|
x: 0,
|
|
8067
8214
|
y: 0,
|
|
@@ -8092,7 +8239,7 @@ var ToYamlNodeImpl = class extends NodeImpl {
|
|
|
8092
8239
|
}
|
|
8093
8240
|
static getUIData() {
|
|
8094
8241
|
return {
|
|
8095
|
-
infoBoxBody:
|
|
8242
|
+
infoBoxBody: import_ts_dedent35.dedent`
|
|
8096
8243
|
Turns the input object into YAML text.
|
|
8097
8244
|
`,
|
|
8098
8245
|
infoBoxTitle: "To YAML Node",
|
|
@@ -8117,8 +8264,8 @@ var ToYamlNodeImpl = class extends NodeImpl {
|
|
|
8117
8264
|
var toYamlNode = nodeDefinition(ToYamlNodeImpl, "To YAML");
|
|
8118
8265
|
|
|
8119
8266
|
// src/model/nodes/GetEmbeddingNode.ts
|
|
8120
|
-
var
|
|
8121
|
-
var
|
|
8267
|
+
var import_non_secure37 = require("nanoid/non-secure");
|
|
8268
|
+
var import_ts_dedent36 = require("ts-dedent");
|
|
8122
8269
|
|
|
8123
8270
|
// src/integrations/integrations.ts
|
|
8124
8271
|
var registeredIntegrations = {
|
|
@@ -8141,7 +8288,7 @@ function getIntegration(type, integrationKey, context) {
|
|
|
8141
8288
|
var GetEmbeddingNodeImpl = class extends NodeImpl {
|
|
8142
8289
|
static create() {
|
|
8143
8290
|
return {
|
|
8144
|
-
id: (0,
|
|
8291
|
+
id: (0, import_non_secure37.nanoid)(),
|
|
8145
8292
|
type: "getEmbedding",
|
|
8146
8293
|
title: "Get Embedding",
|
|
8147
8294
|
visualData: { x: 0, y: 0, width: 250 },
|
|
@@ -8225,7 +8372,7 @@ var GetEmbeddingNodeImpl = class extends NodeImpl {
|
|
|
8225
8372
|
}
|
|
8226
8373
|
static getUIData() {
|
|
8227
8374
|
return {
|
|
8228
|
-
infoBoxBody:
|
|
8375
|
+
infoBoxBody: import_ts_dedent36.dedent`
|
|
8229
8376
|
Gets a OpenAI vector embedding for the input text provided.
|
|
8230
8377
|
|
|
8231
8378
|
Can be used with the Vector Store and Vector KNN nodes.
|
|
@@ -8256,12 +8403,12 @@ var GetEmbeddingNodeImpl = class extends NodeImpl {
|
|
|
8256
8403
|
var getEmbeddingNode = nodeDefinition(GetEmbeddingNodeImpl, "Get Embedding");
|
|
8257
8404
|
|
|
8258
8405
|
// src/model/nodes/VectorStoreNode.ts
|
|
8259
|
-
var
|
|
8260
|
-
var
|
|
8406
|
+
var import_non_secure38 = require("nanoid/non-secure");
|
|
8407
|
+
var import_ts_dedent37 = require("ts-dedent");
|
|
8261
8408
|
var VectorStoreNodeImpl = class extends NodeImpl {
|
|
8262
8409
|
static create() {
|
|
8263
8410
|
return {
|
|
8264
|
-
id: (0,
|
|
8411
|
+
id: (0, import_non_secure38.nanoid)(),
|
|
8265
8412
|
type: "vectorStore",
|
|
8266
8413
|
title: "Vector Store",
|
|
8267
8414
|
visualData: { x: 0, y: 0, width: 200 },
|
|
@@ -8337,14 +8484,14 @@ var VectorStoreNodeImpl = class extends NodeImpl {
|
|
|
8337
8484
|
];
|
|
8338
8485
|
}
|
|
8339
8486
|
getBody() {
|
|
8340
|
-
return
|
|
8487
|
+
return import_ts_dedent37.dedent`
|
|
8341
8488
|
Integration: ${this.data.useIntegrationInput ? "(using input)" : this.data.integration}
|
|
8342
8489
|
Collection Id: ${this.data.useCollectionIdInput ? "(using input)" : this.data.collectionId}
|
|
8343
8490
|
`;
|
|
8344
8491
|
}
|
|
8345
8492
|
static getUIData() {
|
|
8346
8493
|
return {
|
|
8347
|
-
infoBoxBody:
|
|
8494
|
+
infoBoxBody: import_ts_dedent37.dedent`
|
|
8348
8495
|
Takes in a vector, as well as data to store with the vector. This data is stored in the configured vector DB integration for later retrieval.
|
|
8349
8496
|
`,
|
|
8350
8497
|
infoBoxTitle: "Vector Store Node",
|
|
@@ -8379,12 +8526,12 @@ var VectorStoreNodeImpl = class extends NodeImpl {
|
|
|
8379
8526
|
var vectorStoreNode = nodeDefinition(VectorStoreNodeImpl, "Vector Store");
|
|
8380
8527
|
|
|
8381
8528
|
// src/model/nodes/VectorNearestNeighborsNode.ts
|
|
8382
|
-
var
|
|
8383
|
-
var
|
|
8529
|
+
var import_non_secure39 = require("nanoid/non-secure");
|
|
8530
|
+
var import_ts_dedent38 = require("ts-dedent");
|
|
8384
8531
|
var VectorNearestNeighborsNodeImpl = class extends NodeImpl {
|
|
8385
8532
|
static create() {
|
|
8386
8533
|
return {
|
|
8387
|
-
id: (0,
|
|
8534
|
+
id: (0, import_non_secure39.nanoid)(),
|
|
8388
8535
|
type: "vectorNearestNeighbors",
|
|
8389
8536
|
title: "Vector KNN",
|
|
8390
8537
|
visualData: { x: 0, y: 0, width: 200 },
|
|
@@ -8467,7 +8614,7 @@ var VectorNearestNeighborsNodeImpl = class extends NodeImpl {
|
|
|
8467
8614
|
];
|
|
8468
8615
|
}
|
|
8469
8616
|
getBody() {
|
|
8470
|
-
return
|
|
8617
|
+
return import_ts_dedent38.dedent`
|
|
8471
8618
|
Integration: ${this.data.useIntegrationInput ? "(using input)" : this.data.integration}
|
|
8472
8619
|
K: ${this.data.useKInput ? "(using input)" : this.data.k}
|
|
8473
8620
|
Collection Id: ${this.data.useCollectionIdInput ? "(using input)" : this.data.collectionId}
|
|
@@ -8475,7 +8622,7 @@ var VectorNearestNeighborsNodeImpl = class extends NodeImpl {
|
|
|
8475
8622
|
}
|
|
8476
8623
|
static getUIData() {
|
|
8477
8624
|
return {
|
|
8478
|
-
infoBoxBody:
|
|
8625
|
+
infoBoxBody: import_ts_dedent38.dedent`
|
|
8479
8626
|
Performs a k-nearest neighbors search on the vectors stored in the configured vector DB integration. Takes in a vector and returns the k closest vectors and their corresponding data.
|
|
8480
8627
|
`,
|
|
8481
8628
|
infoBoxTitle: "Vector KNN Node",
|
|
@@ -8505,17 +8652,17 @@ var VectorNearestNeighborsNodeImpl = class extends NodeImpl {
|
|
|
8505
8652
|
var vectorNearestNeighborsNode = nodeDefinition(VectorNearestNeighborsNodeImpl, "Vector KNN");
|
|
8506
8653
|
|
|
8507
8654
|
// src/model/nodes/HashNode.ts
|
|
8508
|
-
var
|
|
8655
|
+
var import_non_secure40 = require("nanoid/non-secure");
|
|
8509
8656
|
var crypto = __toESM(require("crypto-js"), 1);
|
|
8510
|
-
var
|
|
8511
|
-
var
|
|
8657
|
+
var import_ts_pattern5 = require("ts-pattern");
|
|
8658
|
+
var import_ts_dedent39 = require("ts-dedent");
|
|
8512
8659
|
var { SHA256, SHA512, MD5, SHA1 } = crypto;
|
|
8513
8660
|
var HashNodeImpl = class extends NodeImpl {
|
|
8514
8661
|
static create() {
|
|
8515
8662
|
const chartNode = {
|
|
8516
8663
|
type: "hash",
|
|
8517
8664
|
title: "Hash",
|
|
8518
|
-
id: (0,
|
|
8665
|
+
id: (0, import_non_secure40.nanoid)(),
|
|
8519
8666
|
visualData: {
|
|
8520
8667
|
x: 0,
|
|
8521
8668
|
y: 0,
|
|
@@ -8566,7 +8713,7 @@ var HashNodeImpl = class extends NodeImpl {
|
|
|
8566
8713
|
}
|
|
8567
8714
|
static getUIData() {
|
|
8568
8715
|
return {
|
|
8569
|
-
infoBoxBody:
|
|
8716
|
+
infoBoxBody: import_ts_dedent39.dedent`
|
|
8570
8717
|
Computes a hash of the input value using the configured hash function.
|
|
8571
8718
|
`,
|
|
8572
8719
|
infoBoxTitle: "Hash Node",
|
|
@@ -8576,7 +8723,7 @@ var HashNodeImpl = class extends NodeImpl {
|
|
|
8576
8723
|
}
|
|
8577
8724
|
async process(inputs) {
|
|
8578
8725
|
const inputText = coerceType(inputs["input"], "string");
|
|
8579
|
-
const hash = (0,
|
|
8726
|
+
const hash = (0, import_ts_pattern5.match)(this.data.algorithm).with("md5", () => MD5(inputText).toString()).with("sha1", () => SHA1(inputText).toString()).with("sha256", () => SHA256(inputText).toString()).with("sha512", () => SHA512(inputText).toString()).exhaustive();
|
|
8580
8727
|
return {
|
|
8581
8728
|
["hash"]: {
|
|
8582
8729
|
type: "string",
|
|
@@ -8594,14 +8741,14 @@ var algorithmDisplayName = {
|
|
|
8594
8741
|
var hashNode = nodeDefinition(HashNodeImpl, "Hash");
|
|
8595
8742
|
|
|
8596
8743
|
// src/model/nodes/AbortGraphNode.ts
|
|
8597
|
-
var
|
|
8598
|
-
var
|
|
8744
|
+
var import_non_secure41 = require("nanoid/non-secure");
|
|
8745
|
+
var import_ts_dedent40 = require("ts-dedent");
|
|
8599
8746
|
var AbortGraphNodeImpl = class extends NodeImpl {
|
|
8600
8747
|
static create() {
|
|
8601
8748
|
const chartNode = {
|
|
8602
8749
|
type: "abortGraph",
|
|
8603
8750
|
title: "Abort Graph",
|
|
8604
|
-
id: (0,
|
|
8751
|
+
id: (0, import_non_secure41.nanoid)(),
|
|
8605
8752
|
visualData: {
|
|
8606
8753
|
x: 0,
|
|
8607
8754
|
y: 0,
|
|
@@ -8652,13 +8799,13 @@ var AbortGraphNodeImpl = class extends NodeImpl {
|
|
|
8652
8799
|
];
|
|
8653
8800
|
}
|
|
8654
8801
|
getBody() {
|
|
8655
|
-
return
|
|
8802
|
+
return import_ts_dedent40.dedent`
|
|
8656
8803
|
${this.data.useSuccessfullyInput ? "Success depends on input" : this.data.successfully ? "Successfully Abort" : this.data.errorMessage ? `Error Abort: ${this.data.errorMessage}` : "Error Abort"}
|
|
8657
8804
|
`;
|
|
8658
8805
|
}
|
|
8659
8806
|
static getUIData() {
|
|
8660
8807
|
return {
|
|
8661
|
-
infoBoxBody:
|
|
8808
|
+
infoBoxBody: import_ts_dedent40.dedent`
|
|
8662
8809
|
Aborts the execution of the entire graph immediately.
|
|
8663
8810
|
|
|
8664
8811
|
Can either "successfully" abort the graph (early-exit), or "error" abort the graph.
|
|
@@ -8683,14 +8830,14 @@ var AbortGraphNodeImpl = class extends NodeImpl {
|
|
|
8683
8830
|
var abortGraphNode = nodeDefinition(AbortGraphNodeImpl, "Abort Graph");
|
|
8684
8831
|
|
|
8685
8832
|
// src/model/nodes/RaceInputsNode.ts
|
|
8686
|
-
var
|
|
8687
|
-
var
|
|
8833
|
+
var import_non_secure42 = require("nanoid/non-secure");
|
|
8834
|
+
var import_ts_dedent41 = require("ts-dedent");
|
|
8688
8835
|
var RaceInputsNodeImpl = class extends NodeImpl {
|
|
8689
8836
|
static create() {
|
|
8690
8837
|
const chartNode = {
|
|
8691
8838
|
type: "raceInputs",
|
|
8692
8839
|
title: "Race Inputs",
|
|
8693
|
-
id: (0,
|
|
8840
|
+
id: (0, import_non_secure42.nanoid)(),
|
|
8694
8841
|
visualData: {
|
|
8695
8842
|
x: 0,
|
|
8696
8843
|
y: 0,
|
|
@@ -8740,7 +8887,7 @@ var RaceInputsNodeImpl = class extends NodeImpl {
|
|
|
8740
8887
|
}
|
|
8741
8888
|
static getUIData() {
|
|
8742
8889
|
return {
|
|
8743
|
-
infoBoxBody:
|
|
8890
|
+
infoBoxBody: import_ts_dedent41.dedent`
|
|
8744
8891
|
Takes in multiple inputs and outputs the value of the first one to finish. The other inputs are cancelled.
|
|
8745
8892
|
`,
|
|
8746
8893
|
infoBoxTitle: "Race Inputs Node",
|
|
@@ -8748,7 +8895,7 @@ var RaceInputsNodeImpl = class extends NodeImpl {
|
|
|
8748
8895
|
group: ["Logic"]
|
|
8749
8896
|
};
|
|
8750
8897
|
}
|
|
8751
|
-
async process(inputs
|
|
8898
|
+
async process(inputs) {
|
|
8752
8899
|
const value = Object.entries(inputs).find(
|
|
8753
8900
|
([key, value2]) => key.startsWith("input") && value2 !== void 0 && value2.type !== "control-flow-excluded"
|
|
8754
8901
|
);
|
|
@@ -8768,14 +8915,14 @@ var RaceInputsNodeImpl = class extends NodeImpl {
|
|
|
8768
8915
|
var raceInputsNode = nodeDefinition(RaceInputsNodeImpl, "Race Inputs");
|
|
8769
8916
|
|
|
8770
8917
|
// src/model/nodes/ToJsonNode.ts
|
|
8771
|
-
var
|
|
8772
|
-
var
|
|
8918
|
+
var import_non_secure43 = require("nanoid/non-secure");
|
|
8919
|
+
var import_ts_dedent42 = require("ts-dedent");
|
|
8773
8920
|
var ToJsonNodeImpl = class extends NodeImpl {
|
|
8774
8921
|
static create() {
|
|
8775
8922
|
const chartNode = {
|
|
8776
8923
|
type: "toJson",
|
|
8777
8924
|
title: "To JSON",
|
|
8778
|
-
id: (0,
|
|
8925
|
+
id: (0, import_non_secure43.nanoid)(),
|
|
8779
8926
|
visualData: {
|
|
8780
8927
|
x: 0,
|
|
8781
8928
|
y: 0,
|
|
@@ -8820,7 +8967,7 @@ var ToJsonNodeImpl = class extends NodeImpl {
|
|
|
8820
8967
|
}
|
|
8821
8968
|
static getUIData() {
|
|
8822
8969
|
return {
|
|
8823
|
-
infoBoxBody:
|
|
8970
|
+
infoBoxBody: import_ts_dedent42.dedent`
|
|
8824
8971
|
Turns the input value into its JSON equivalent (stringifies the value).
|
|
8825
8972
|
`,
|
|
8826
8973
|
infoBoxTitle: "To JSON Node",
|
|
@@ -8842,14 +8989,14 @@ var ToJsonNodeImpl = class extends NodeImpl {
|
|
|
8842
8989
|
var toJsonNode = nodeDefinition(ToJsonNodeImpl, "To JSON");
|
|
8843
8990
|
|
|
8844
8991
|
// src/model/nodes/JoinNode.ts
|
|
8845
|
-
var
|
|
8846
|
-
var
|
|
8992
|
+
var import_non_secure44 = require("nanoid/non-secure");
|
|
8993
|
+
var import_ts_dedent43 = require("ts-dedent");
|
|
8847
8994
|
var JoinNodeImpl = class extends NodeImpl {
|
|
8848
8995
|
static create = () => {
|
|
8849
8996
|
const chartNode = {
|
|
8850
8997
|
type: "join",
|
|
8851
8998
|
title: "Join",
|
|
8852
|
-
id: (0,
|
|
8999
|
+
id: (0, import_non_secure44.nanoid)(),
|
|
8853
9000
|
data: {
|
|
8854
9001
|
flatten: true,
|
|
8855
9002
|
joinString: "\n"
|
|
@@ -8925,7 +9072,7 @@ var JoinNodeImpl = class extends NodeImpl {
|
|
|
8925
9072
|
}
|
|
8926
9073
|
static getUIData() {
|
|
8927
9074
|
return {
|
|
8928
|
-
infoBoxBody:
|
|
9075
|
+
infoBoxBody: import_ts_dedent43.dedent`
|
|
8929
9076
|
Takes an array of strings, and joins them using the configured delimiter.
|
|
8930
9077
|
|
|
8931
9078
|
Defaults to a newline.
|
|
@@ -8962,15 +9109,15 @@ var JoinNodeImpl = class extends NodeImpl {
|
|
|
8962
9109
|
var joinNode = nodeDefinition(JoinNodeImpl, "Coalesce");
|
|
8963
9110
|
|
|
8964
9111
|
// src/model/nodes/FilterNode.ts
|
|
8965
|
-
var
|
|
9112
|
+
var import_non_secure45 = require("nanoid/non-secure");
|
|
8966
9113
|
var import_lodash_es9 = require("lodash");
|
|
8967
|
-
var
|
|
9114
|
+
var import_ts_dedent44 = require("ts-dedent");
|
|
8968
9115
|
var FilterNodeImpl = class extends NodeImpl {
|
|
8969
9116
|
static create() {
|
|
8970
9117
|
const chartNode = {
|
|
8971
9118
|
type: "filter",
|
|
8972
9119
|
title: "Filter",
|
|
8973
|
-
id: (0,
|
|
9120
|
+
id: (0, import_non_secure45.nanoid)(),
|
|
8974
9121
|
visualData: {
|
|
8975
9122
|
x: 0,
|
|
8976
9123
|
y: 0,
|
|
@@ -9007,7 +9154,7 @@ var FilterNodeImpl = class extends NodeImpl {
|
|
|
9007
9154
|
}
|
|
9008
9155
|
static getUIData() {
|
|
9009
9156
|
return {
|
|
9010
|
-
infoBoxBody:
|
|
9157
|
+
infoBoxBody: import_ts_dedent44.dedent`
|
|
9011
9158
|
Takes in both an array of values, and an array of booleans of the same length, and filters the array where the corresponding boolean is true.
|
|
9012
9159
|
`,
|
|
9013
9160
|
infoBoxTitle: "Filter Node",
|
|
@@ -9032,8 +9179,8 @@ var FilterNodeImpl = class extends NodeImpl {
|
|
|
9032
9179
|
var filterNode = nodeDefinition(FilterNodeImpl, "Filter");
|
|
9033
9180
|
|
|
9034
9181
|
// src/model/nodes/ObjectNode.ts
|
|
9035
|
-
var
|
|
9036
|
-
var
|
|
9182
|
+
var import_non_secure46 = require("nanoid/non-secure");
|
|
9183
|
+
var import_ts_dedent45 = require("ts-dedent");
|
|
9037
9184
|
var DEFAULT_JSON_TEMPLATE = `{
|
|
9038
9185
|
"key": "{{input}}"
|
|
9039
9186
|
}`;
|
|
@@ -9042,7 +9189,7 @@ var ObjectNodeImpl = class extends NodeImpl {
|
|
|
9042
9189
|
const chartNode = {
|
|
9043
9190
|
type: "object",
|
|
9044
9191
|
title: "Object",
|
|
9045
|
-
id: (0,
|
|
9192
|
+
id: (0, import_non_secure46.nanoid)(),
|
|
9046
9193
|
visualData: {
|
|
9047
9194
|
x: 0,
|
|
9048
9195
|
y: 0,
|
|
@@ -9054,7 +9201,7 @@ var ObjectNodeImpl = class extends NodeImpl {
|
|
|
9054
9201
|
};
|
|
9055
9202
|
return chartNode;
|
|
9056
9203
|
}
|
|
9057
|
-
getInputDefinitions(
|
|
9204
|
+
getInputDefinitions() {
|
|
9058
9205
|
const inputNames = [...new Set(this.chartNode.data.jsonTemplate.match(/\{\{([^}]+)\}\}/g))];
|
|
9059
9206
|
return (inputNames == null ? void 0 : inputNames.map((inputName) => {
|
|
9060
9207
|
return {
|
|
@@ -9093,7 +9240,7 @@ var ObjectNodeImpl = class extends NodeImpl {
|
|
|
9093
9240
|
}
|
|
9094
9241
|
static getUIData() {
|
|
9095
9242
|
return {
|
|
9096
|
-
infoBoxBody:
|
|
9243
|
+
infoBoxBody: import_ts_dedent45.dedent`
|
|
9097
9244
|
Creates an object from input values and a JSON template, escaping the input values and inserting them into the template.
|
|
9098
9245
|
|
|
9099
9246
|
Use double-quotes around the input values to escape them. String values are automatically escaped.
|
|
@@ -9105,10 +9252,10 @@ var ObjectNodeImpl = class extends NodeImpl {
|
|
|
9105
9252
|
group: ["Objects"]
|
|
9106
9253
|
};
|
|
9107
9254
|
}
|
|
9108
|
-
interpolate(baseString,
|
|
9255
|
+
interpolate(baseString, values2) {
|
|
9109
9256
|
return baseString.replace(/("?)\{\{([^}]+)\}\}("?)/g, (_m, openQuote, key, _closeQuote) => {
|
|
9110
9257
|
const isQuoted = Boolean(openQuote);
|
|
9111
|
-
const value =
|
|
9258
|
+
const value = values2[key];
|
|
9112
9259
|
if (value == null) {
|
|
9113
9260
|
return "null";
|
|
9114
9261
|
}
|
|
@@ -9150,14 +9297,14 @@ var ObjectNodeImpl = class extends NodeImpl {
|
|
|
9150
9297
|
var objectNode = nodeDefinition(ObjectNodeImpl, "Object");
|
|
9151
9298
|
|
|
9152
9299
|
// src/model/nodes/BooleanNode.ts
|
|
9153
|
-
var
|
|
9154
|
-
var
|
|
9300
|
+
var import_non_secure47 = require("nanoid/non-secure");
|
|
9301
|
+
var import_ts_dedent46 = require("ts-dedent");
|
|
9155
9302
|
var BooleanNodeImpl = class extends NodeImpl {
|
|
9156
9303
|
static create() {
|
|
9157
9304
|
const chartNode = {
|
|
9158
9305
|
type: "boolean",
|
|
9159
9306
|
title: "Bool",
|
|
9160
|
-
id: (0,
|
|
9307
|
+
id: (0, import_non_secure47.nanoid)(),
|
|
9161
9308
|
visualData: {
|
|
9162
9309
|
x: 0,
|
|
9163
9310
|
y: 0,
|
|
@@ -9195,7 +9342,7 @@ var BooleanNodeImpl = class extends NodeImpl {
|
|
|
9195
9342
|
}
|
|
9196
9343
|
static getUIData() {
|
|
9197
9344
|
return {
|
|
9198
|
-
infoBoxBody:
|
|
9345
|
+
infoBoxBody: import_ts_dedent46.dedent`
|
|
9199
9346
|
Outputs a boolean constant, or converts an input value into a boolean.
|
|
9200
9347
|
`,
|
|
9201
9348
|
infoBoxTitle: "Bool Node",
|
|
@@ -9216,16 +9363,16 @@ var BooleanNodeImpl = class extends NodeImpl {
|
|
|
9216
9363
|
var booleanNode = nodeDefinition(BooleanNodeImpl, "Boolean");
|
|
9217
9364
|
|
|
9218
9365
|
// src/model/nodes/CompareNode.ts
|
|
9219
|
-
var
|
|
9366
|
+
var import_non_secure48 = require("nanoid/non-secure");
|
|
9220
9367
|
var import_lodash_es10 = require("lodash");
|
|
9221
|
-
var
|
|
9222
|
-
var
|
|
9368
|
+
var import_ts_pattern6 = require("ts-pattern");
|
|
9369
|
+
var import_ts_dedent47 = require("ts-dedent");
|
|
9223
9370
|
var CompareNodeImpl = class extends NodeImpl {
|
|
9224
9371
|
static create() {
|
|
9225
9372
|
const chartNode = {
|
|
9226
9373
|
type: "compare",
|
|
9227
9374
|
title: "Compare",
|
|
9228
|
-
id: (0,
|
|
9375
|
+
id: (0, import_non_secure48.nanoid)(),
|
|
9229
9376
|
visualData: {
|
|
9230
9377
|
x: 0,
|
|
9231
9378
|
y: 0,
|
|
@@ -9297,7 +9444,7 @@ var CompareNodeImpl = class extends NodeImpl {
|
|
|
9297
9444
|
}
|
|
9298
9445
|
static getUIData() {
|
|
9299
9446
|
return {
|
|
9300
|
-
infoBoxBody:
|
|
9447
|
+
infoBoxBody: import_ts_dedent47.dedent`
|
|
9301
9448
|
Compares two values using the configured operator and outputs the result.
|
|
9302
9449
|
|
|
9303
9450
|
If the data types of the values do not match, then the B value is converted to the type of the A value.
|
|
@@ -9315,7 +9462,7 @@ var CompareNodeImpl = class extends NodeImpl {
|
|
|
9315
9462
|
return {
|
|
9316
9463
|
["output"]: {
|
|
9317
9464
|
type: "boolean",
|
|
9318
|
-
value: (0,
|
|
9465
|
+
value: (0, import_ts_pattern6.match)(comparisonFunction).with("==", () => !inputB).with("!=", () => !!inputB).otherwise(() => false)
|
|
9319
9466
|
}
|
|
9320
9467
|
};
|
|
9321
9468
|
}
|
|
@@ -9324,7 +9471,7 @@ var CompareNodeImpl = class extends NodeImpl {
|
|
|
9324
9471
|
return {
|
|
9325
9472
|
["output"]: {
|
|
9326
9473
|
type: "boolean",
|
|
9327
|
-
value: (0,
|
|
9474
|
+
value: (0, import_ts_pattern6.match)(comparisonFunction).with("==", () => (0, import_lodash_es10.isEqual)(value1, value2)).with("!=", () => !(0, import_lodash_es10.isEqual)(value1, value2)).with("<", () => value1 < value2).with(">", () => value1 > value2).with("<=", () => value1 <= value2).with(">=", () => value1 >= value2).with("and", () => !!(value1 && value2)).with("or", () => !!(value1 || value2)).with("xor", () => !!(value1 ? !value2 : value2)).with("nand", () => !(value1 && value2)).with("nor", () => !(value1 || value2)).with("xnor", () => !(value1 ? !value2 : value2)).exhaustive()
|
|
9328
9475
|
}
|
|
9329
9476
|
};
|
|
9330
9477
|
}
|
|
@@ -9332,9 +9479,9 @@ var CompareNodeImpl = class extends NodeImpl {
|
|
|
9332
9479
|
var compareNode = nodeDefinition(CompareNodeImpl, "Compare");
|
|
9333
9480
|
|
|
9334
9481
|
// src/model/nodes/EvaluateNode.ts
|
|
9335
|
-
var
|
|
9336
|
-
var
|
|
9337
|
-
var
|
|
9482
|
+
var import_non_secure49 = require("nanoid/non-secure");
|
|
9483
|
+
var import_ts_pattern7 = require("ts-pattern");
|
|
9484
|
+
var import_ts_dedent48 = require("ts-dedent");
|
|
9338
9485
|
var unaryOperation = ["abs", "negate"];
|
|
9339
9486
|
var isUnaryOp = (operation) => unaryOperation.includes(operation);
|
|
9340
9487
|
var EvaluateNodeImpl = class extends NodeImpl {
|
|
@@ -9342,7 +9489,7 @@ var EvaluateNodeImpl = class extends NodeImpl {
|
|
|
9342
9489
|
const chartNode = {
|
|
9343
9490
|
type: "evaluate",
|
|
9344
9491
|
title: "Evaluate",
|
|
9345
|
-
id: (0,
|
|
9492
|
+
id: (0, import_non_secure49.nanoid)(),
|
|
9346
9493
|
visualData: {
|
|
9347
9494
|
x: 0,
|
|
9348
9495
|
y: 0,
|
|
@@ -9411,7 +9558,7 @@ var EvaluateNodeImpl = class extends NodeImpl {
|
|
|
9411
9558
|
getBody() {
|
|
9412
9559
|
const isUnary = !this.data.useOperationInput && isUnaryOp(this.data.operation);
|
|
9413
9560
|
if (isUnary) {
|
|
9414
|
-
return (0,
|
|
9561
|
+
return (0, import_ts_pattern7.match)(this.data.operation).with("abs", () => "abs(A)").with("negate", () => "-A").exhaustive();
|
|
9415
9562
|
}
|
|
9416
9563
|
if (this.data.operation === "^") {
|
|
9417
9564
|
return "!markdownA<sup>B</sup>";
|
|
@@ -9420,7 +9567,7 @@ var EvaluateNodeImpl = class extends NodeImpl {
|
|
|
9420
9567
|
}
|
|
9421
9568
|
static getUIData() {
|
|
9422
9569
|
return {
|
|
9423
|
-
infoBoxBody:
|
|
9570
|
+
infoBoxBody: import_ts_dedent48.dedent`
|
|
9424
9571
|
Evaluates the configured mathematical operation on the input values and outputs the result.
|
|
9425
9572
|
|
|
9426
9573
|
For more complex operations, you should use the \`Code\` node.
|
|
@@ -9438,7 +9585,7 @@ var EvaluateNodeImpl = class extends NodeImpl {
|
|
|
9438
9585
|
return {
|
|
9439
9586
|
["output"]: {
|
|
9440
9587
|
type: "number",
|
|
9441
|
-
value: (0,
|
|
9588
|
+
value: (0, import_ts_pattern7.match)(operation).with("abs", () => Math.abs(inputA)).with("negate", () => -inputA).exhaustive()
|
|
9442
9589
|
}
|
|
9443
9590
|
};
|
|
9444
9591
|
}
|
|
@@ -9448,7 +9595,7 @@ var EvaluateNodeImpl = class extends NodeImpl {
|
|
|
9448
9595
|
return {
|
|
9449
9596
|
["output"]: {
|
|
9450
9597
|
type: "number",
|
|
9451
|
-
value: (0,
|
|
9598
|
+
value: (0, import_ts_pattern7.match)(operation).with("+", () => inputA + inputB).with("-", () => inputA - inputB).with("*", () => inputA * inputB).with("/", () => inputA / inputB).with("^", () => Math.pow(inputA, inputB)).with("%", () => inputA % inputB).exhaustive()
|
|
9452
9599
|
}
|
|
9453
9600
|
};
|
|
9454
9601
|
}
|
|
@@ -9456,14 +9603,14 @@ var EvaluateNodeImpl = class extends NodeImpl {
|
|
|
9456
9603
|
var evaluateNode = nodeDefinition(EvaluateNodeImpl, "Evaluate");
|
|
9457
9604
|
|
|
9458
9605
|
// src/model/nodes/NumberNode.ts
|
|
9459
|
-
var
|
|
9460
|
-
var
|
|
9606
|
+
var import_non_secure50 = require("nanoid/non-secure");
|
|
9607
|
+
var import_ts_dedent49 = require("ts-dedent");
|
|
9461
9608
|
var NumberNodeImpl = class extends NodeImpl {
|
|
9462
9609
|
static create() {
|
|
9463
9610
|
const chartNode = {
|
|
9464
9611
|
type: "number",
|
|
9465
9612
|
title: "Number",
|
|
9466
|
-
id: (0,
|
|
9613
|
+
id: (0, import_non_secure50.nanoid)(),
|
|
9467
9614
|
visualData: {
|
|
9468
9615
|
x: 0,
|
|
9469
9616
|
y: 0,
|
|
@@ -9507,7 +9654,7 @@ var NumberNodeImpl = class extends NodeImpl {
|
|
|
9507
9654
|
}
|
|
9508
9655
|
static getUIData() {
|
|
9509
9656
|
return {
|
|
9510
|
-
infoBoxBody:
|
|
9657
|
+
infoBoxBody: import_ts_dedent49.dedent`
|
|
9511
9658
|
Outputs a number constant, or converts an input value into a number.
|
|
9512
9659
|
|
|
9513
9660
|
Can be configured to round the number to a certain number of decimal places.
|
|
@@ -9534,14 +9681,14 @@ var NumberNodeImpl = class extends NodeImpl {
|
|
|
9534
9681
|
var numberNode = nodeDefinition(NumberNodeImpl, "Number");
|
|
9535
9682
|
|
|
9536
9683
|
// src/model/nodes/RandomNumberNode.ts
|
|
9537
|
-
var
|
|
9538
|
-
var
|
|
9684
|
+
var import_non_secure51 = require("nanoid/non-secure");
|
|
9685
|
+
var import_ts_dedent50 = require("ts-dedent");
|
|
9539
9686
|
var RandomNumberNodeImpl = class extends NodeImpl {
|
|
9540
9687
|
static create() {
|
|
9541
9688
|
const chartNode = {
|
|
9542
9689
|
type: "randomNumber",
|
|
9543
9690
|
title: "RNG",
|
|
9544
|
-
id: (0,
|
|
9691
|
+
id: (0, import_non_secure51.nanoid)(),
|
|
9545
9692
|
visualData: {
|
|
9546
9693
|
x: 0,
|
|
9547
9694
|
y: 0,
|
|
@@ -9592,7 +9739,7 @@ var RandomNumberNodeImpl = class extends NodeImpl {
|
|
|
9592
9739
|
];
|
|
9593
9740
|
}
|
|
9594
9741
|
getBody() {
|
|
9595
|
-
return
|
|
9742
|
+
return import_ts_dedent50.dedent`
|
|
9596
9743
|
Min: ${this.data.useMinInput ? "(Input)" : this.data.min ?? 0}
|
|
9597
9744
|
Max: ${this.data.useMaxInput ? "(Input)" : this.data.max ?? 1}
|
|
9598
9745
|
${this.data.integers ? "Integers" : "Floats"}
|
|
@@ -9601,7 +9748,7 @@ var RandomNumberNodeImpl = class extends NodeImpl {
|
|
|
9601
9748
|
}
|
|
9602
9749
|
static getUIData() {
|
|
9603
9750
|
return {
|
|
9604
|
-
infoBoxBody:
|
|
9751
|
+
infoBoxBody: import_ts_dedent50.dedent`
|
|
9605
9752
|
Outputs a random number between the configured min and max values.
|
|
9606
9753
|
|
|
9607
9754
|
Can be configured to output only integers, and whether the max value is inclusive or exclusive.
|
|
@@ -9632,15 +9779,15 @@ var RandomNumberNodeImpl = class extends NodeImpl {
|
|
|
9632
9779
|
var randomNumberNode = nodeDefinition(RandomNumberNodeImpl, "Random Number");
|
|
9633
9780
|
|
|
9634
9781
|
// src/model/nodes/ShuffleNode.ts
|
|
9635
|
-
var
|
|
9782
|
+
var import_non_secure52 = require("nanoid/non-secure");
|
|
9636
9783
|
var import_lodash_es11 = require("lodash");
|
|
9637
|
-
var
|
|
9784
|
+
var import_ts_dedent51 = require("ts-dedent");
|
|
9638
9785
|
var ShuffleNodeImpl = class extends NodeImpl {
|
|
9639
9786
|
static create() {
|
|
9640
9787
|
const chartNode = {
|
|
9641
9788
|
type: "shuffle",
|
|
9642
9789
|
title: "Shuffle",
|
|
9643
|
-
id: (0,
|
|
9790
|
+
id: (0, import_non_secure52.nanoid)(),
|
|
9644
9791
|
visualData: {
|
|
9645
9792
|
x: 0,
|
|
9646
9793
|
y: 0,
|
|
@@ -9670,7 +9817,7 @@ var ShuffleNodeImpl = class extends NodeImpl {
|
|
|
9670
9817
|
}
|
|
9671
9818
|
static getUIData() {
|
|
9672
9819
|
return {
|
|
9673
|
-
infoBoxBody:
|
|
9820
|
+
infoBoxBody: import_ts_dedent51.dedent`
|
|
9674
9821
|
Shuffles the input array. Outputs the shuffled array.
|
|
9675
9822
|
`,
|
|
9676
9823
|
infoBoxTitle: "Shuffle Node",
|
|
@@ -9694,14 +9841,14 @@ var ShuffleNodeImpl = class extends NodeImpl {
|
|
|
9694
9841
|
var shuffleNode = nodeDefinition(ShuffleNodeImpl, "Shuffle");
|
|
9695
9842
|
|
|
9696
9843
|
// src/model/nodes/CommentNode.ts
|
|
9697
|
-
var
|
|
9698
|
-
var
|
|
9844
|
+
var import_non_secure53 = require("nanoid/non-secure");
|
|
9845
|
+
var import_ts_dedent52 = require("ts-dedent");
|
|
9699
9846
|
var CommentNodeImpl = class extends NodeImpl {
|
|
9700
9847
|
static create() {
|
|
9701
9848
|
const chartNode = {
|
|
9702
9849
|
type: "comment",
|
|
9703
9850
|
title: "Comment",
|
|
9704
|
-
id: (0,
|
|
9851
|
+
id: (0, import_non_secure53.nanoid)(),
|
|
9705
9852
|
visualData: {
|
|
9706
9853
|
x: 0,
|
|
9707
9854
|
y: 0,
|
|
@@ -9745,7 +9892,7 @@ var CommentNodeImpl = class extends NodeImpl {
|
|
|
9745
9892
|
}
|
|
9746
9893
|
static getUIData() {
|
|
9747
9894
|
return {
|
|
9748
|
-
infoBoxBody:
|
|
9895
|
+
infoBoxBody: import_ts_dedent52.dedent`
|
|
9749
9896
|
A comment node is a node that does nothing. It is useful for adding notes to a graph.
|
|
9750
9897
|
`,
|
|
9751
9898
|
infoBoxTitle: "Comment Node",
|
|
@@ -9760,14 +9907,14 @@ var CommentNodeImpl = class extends NodeImpl {
|
|
|
9760
9907
|
var commentNode = nodeDefinition(CommentNodeImpl, "Comment");
|
|
9761
9908
|
|
|
9762
9909
|
// src/model/nodes/ImageToMDNode.ts
|
|
9763
|
-
var
|
|
9764
|
-
var
|
|
9910
|
+
var import_non_secure54 = require("nanoid/non-secure");
|
|
9911
|
+
var import_ts_dedent53 = require("ts-dedent");
|
|
9765
9912
|
var ImageToMDNodeImpl = class extends NodeImpl {
|
|
9766
9913
|
static create() {
|
|
9767
9914
|
const chartNode = {
|
|
9768
9915
|
type: "imagetoMD",
|
|
9769
9916
|
title: "Image To Markdown",
|
|
9770
|
-
id: (0,
|
|
9917
|
+
id: (0, import_non_secure54.nanoid)(),
|
|
9771
9918
|
visualData: {
|
|
9772
9919
|
x: 0,
|
|
9773
9920
|
y: 0,
|
|
@@ -9836,7 +9983,7 @@ var ImageToMDNodeImpl = class extends NodeImpl {
|
|
|
9836
9983
|
}
|
|
9837
9984
|
static getUIData() {
|
|
9838
9985
|
return {
|
|
9839
|
-
infoBoxBody:
|
|
9986
|
+
infoBoxBody: import_ts_dedent53.dedent`
|
|
9840
9987
|
Turns the input value (image byte array) into its Markdown equivalent.
|
|
9841
9988
|
`,
|
|
9842
9989
|
infoBoxTitle: "Image to Markdown Node",
|
|
@@ -9873,11 +10020,11 @@ var ImageToMDNodeImpl = class extends NodeImpl {
|
|
|
9873
10020
|
var imageToMDNode = nodeDefinition(ImageToMDNodeImpl, "Image To Markdown");
|
|
9874
10021
|
|
|
9875
10022
|
// src/model/nodes/ImageNode.ts
|
|
9876
|
-
var
|
|
10023
|
+
var import_non_secure55 = require("nanoid/non-secure");
|
|
9877
10024
|
var ImageNodeImpl = class extends NodeImpl {
|
|
9878
10025
|
static create() {
|
|
9879
10026
|
return {
|
|
9880
|
-
id: (0,
|
|
10027
|
+
id: (0, import_non_secure55.nanoid)(),
|
|
9881
10028
|
type: "image",
|
|
9882
10029
|
title: "Image",
|
|
9883
10030
|
visualData: { x: 0, y: 0, width: 250 },
|
|
@@ -9974,11 +10121,11 @@ var ImageNodeImpl = class extends NodeImpl {
|
|
|
9974
10121
|
var imageNode = nodeDefinition(ImageNodeImpl, "Image");
|
|
9975
10122
|
|
|
9976
10123
|
// src/model/nodes/AudioNode.ts
|
|
9977
|
-
var
|
|
10124
|
+
var import_non_secure56 = require("nanoid/non-secure");
|
|
9978
10125
|
var AudioNodeImpl = class extends NodeImpl {
|
|
9979
10126
|
static create() {
|
|
9980
10127
|
return {
|
|
9981
|
-
id: (0,
|
|
10128
|
+
id: (0, import_non_secure56.nanoid)(),
|
|
9982
10129
|
type: "audio",
|
|
9983
10130
|
title: "Audio",
|
|
9984
10131
|
visualData: { x: 0, y: 0, width: 300 },
|
|
@@ -10071,13 +10218,13 @@ var AudioNodeImpl = class extends NodeImpl {
|
|
|
10071
10218
|
var audioNode = nodeDefinition(AudioNodeImpl, "Audio");
|
|
10072
10219
|
|
|
10073
10220
|
// src/model/nodes/HttpCallNode.ts
|
|
10074
|
-
var
|
|
10221
|
+
var import_non_secure57 = require("nanoid/non-secure");
|
|
10075
10222
|
var HttpCallNodeImpl = class extends NodeImpl {
|
|
10076
10223
|
static create() {
|
|
10077
10224
|
const chartNode = {
|
|
10078
10225
|
type: "httpCall",
|
|
10079
10226
|
title: "Http Call",
|
|
10080
|
-
id: (0,
|
|
10227
|
+
id: (0, import_non_secure57.nanoid)(),
|
|
10081
10228
|
visualData: {
|
|
10082
10229
|
x: 0,
|
|
10083
10230
|
y: 0,
|
|
@@ -10320,14 +10467,14 @@ Body: ${this.data.body}` : ""}${this.data.errorOnNon200 ? "\nError on non-200" :
|
|
|
10320
10467
|
var httpCallNode = nodeDefinition(HttpCallNodeImpl, "Http Call");
|
|
10321
10468
|
|
|
10322
10469
|
// src/model/nodes/DelayNode.ts
|
|
10323
|
-
var
|
|
10324
|
-
var
|
|
10470
|
+
var import_non_secure58 = require("nanoid/non-secure");
|
|
10471
|
+
var import_ts_dedent54 = require("ts-dedent");
|
|
10325
10472
|
var DelayNodeImpl = class extends NodeImpl {
|
|
10326
10473
|
static create() {
|
|
10327
10474
|
const chartNode = {
|
|
10328
10475
|
type: "delay",
|
|
10329
10476
|
title: "Delay",
|
|
10330
|
-
id: (0,
|
|
10477
|
+
id: (0, import_non_secure58.nanoid)(),
|
|
10331
10478
|
visualData: {
|
|
10332
10479
|
x: 0,
|
|
10333
10480
|
y: 0,
|
|
@@ -10372,7 +10519,7 @@ var DelayNodeImpl = class extends NodeImpl {
|
|
|
10372
10519
|
}
|
|
10373
10520
|
static getUIData() {
|
|
10374
10521
|
return {
|
|
10375
|
-
infoBoxBody:
|
|
10522
|
+
infoBoxBody: import_ts_dedent54.dedent`
|
|
10376
10523
|
Delays the execution and then passes the input value to the output without any modifications.
|
|
10377
10524
|
`,
|
|
10378
10525
|
infoBoxTitle: "Delay Node",
|
|
@@ -10423,12 +10570,12 @@ var DelayNodeImpl = class extends NodeImpl {
|
|
|
10423
10570
|
var delayNode = nodeDefinition(DelayNodeImpl, "Delay");
|
|
10424
10571
|
|
|
10425
10572
|
// src/model/nodes/AppendToDatasetNode.ts
|
|
10426
|
-
var
|
|
10427
|
-
var
|
|
10573
|
+
var import_non_secure59 = require("nanoid/non-secure");
|
|
10574
|
+
var import_ts_dedent55 = require("ts-dedent");
|
|
10428
10575
|
var AppendToDatasetNodeImpl = class extends NodeImpl {
|
|
10429
10576
|
static create() {
|
|
10430
10577
|
return {
|
|
10431
|
-
id: (0,
|
|
10578
|
+
id: (0, import_non_secure59.nanoid)(),
|
|
10432
10579
|
type: "appendToDataset",
|
|
10433
10580
|
title: "Append to Dataset",
|
|
10434
10581
|
visualData: { x: 0, y: 0, width: 250 },
|
|
@@ -10484,7 +10631,7 @@ var AppendToDatasetNodeImpl = class extends NodeImpl {
|
|
|
10484
10631
|
}
|
|
10485
10632
|
static getUIData() {
|
|
10486
10633
|
return {
|
|
10487
|
-
infoBoxBody:
|
|
10634
|
+
infoBoxBody: import_ts_dedent55.dedent`
|
|
10488
10635
|
Appends a row of data to the specified dataset.
|
|
10489
10636
|
`,
|
|
10490
10637
|
infoBoxTitle: "Append to Dataset Node",
|
|
@@ -10724,7 +10871,7 @@ var GetAllDatasetsNodeImpl = class extends NodeImpl {
|
|
|
10724
10871
|
getEditors() {
|
|
10725
10872
|
return [];
|
|
10726
10873
|
}
|
|
10727
|
-
async process(
|
|
10874
|
+
async process(context) {
|
|
10728
10875
|
const { datasetProvider } = context;
|
|
10729
10876
|
if (datasetProvider == null) {
|
|
10730
10877
|
throw new Error("datasetProvider is required");
|
|
@@ -10825,7 +10972,7 @@ var SplitNodeImpl = class extends NodeImpl {
|
|
|
10825
10972
|
}
|
|
10826
10973
|
return normalized;
|
|
10827
10974
|
}
|
|
10828
|
-
async process(inputs
|
|
10975
|
+
async process(inputs) {
|
|
10829
10976
|
const delimiter = getInputOrData(this.data, inputs, "delimiter");
|
|
10830
10977
|
const normalizedDelimiter = this.data.regex ? new RegExp(delimiter) : handleEscapeCharacters(delimiter);
|
|
10831
10978
|
const stringToSplit = coerceType(inputs["string"], "string");
|
|
@@ -11033,15 +11180,15 @@ var GetDatasetRowNodeImpl = class extends NodeImpl {
|
|
|
11033
11180
|
};
|
|
11034
11181
|
var getDatasetRowNode = nodeDefinition(GetDatasetRowNodeImpl, "Get Dataset Row");
|
|
11035
11182
|
|
|
11036
|
-
// src/model/nodes/SliceNode.ts
|
|
11037
|
-
var
|
|
11038
|
-
var
|
|
11183
|
+
// src/model/nodes/SliceNode.ts
|
|
11184
|
+
var import_non_secure60 = require("nanoid/non-secure");
|
|
11185
|
+
var import_ts_dedent56 = require("ts-dedent");
|
|
11039
11186
|
var SliceNodeImpl = class extends NodeImpl {
|
|
11040
11187
|
static create() {
|
|
11041
11188
|
const chartNode = {
|
|
11042
11189
|
type: "slice",
|
|
11043
11190
|
title: "Slice",
|
|
11044
|
-
id: (0,
|
|
11191
|
+
id: (0, import_non_secure60.nanoid)(),
|
|
11045
11192
|
visualData: {
|
|
11046
11193
|
x: 0,
|
|
11047
11194
|
y: 0,
|
|
@@ -11094,14 +11241,14 @@ var SliceNodeImpl = class extends NodeImpl {
|
|
|
11094
11241
|
];
|
|
11095
11242
|
}
|
|
11096
11243
|
getBody() {
|
|
11097
|
-
return
|
|
11244
|
+
return import_ts_dedent56.dedent`
|
|
11098
11245
|
Start: ${this.data.useStartInput ? "(Using Input)" : this.data.start == null ? "0" : this.data.start}
|
|
11099
11246
|
Count: ${this.data.useCountInput ? "(Using Input)" : this.data.count == null ? "All" : this.data.count}
|
|
11100
11247
|
`;
|
|
11101
11248
|
}
|
|
11102
11249
|
static getUIData() {
|
|
11103
11250
|
return {
|
|
11104
|
-
infoBoxBody:
|
|
11251
|
+
infoBoxBody: import_ts_dedent56.dedent`
|
|
11105
11252
|
Slices an array from the start index for the count number of elements.
|
|
11106
11253
|
|
|
11107
11254
|
Useful for extracting a portion of an array.
|
|
@@ -11127,14 +11274,14 @@ var SliceNodeImpl = class extends NodeImpl {
|
|
|
11127
11274
|
var sliceNode = nodeDefinition(SliceNodeImpl, "Slice");
|
|
11128
11275
|
|
|
11129
11276
|
// src/model/nodes/ExtractMarkdownCodeBlocksNode.ts
|
|
11130
|
-
var
|
|
11131
|
-
var
|
|
11277
|
+
var import_non_secure61 = require("nanoid/non-secure");
|
|
11278
|
+
var import_ts_dedent57 = require("ts-dedent");
|
|
11132
11279
|
var ExtractMarkdownCodeBlocksNodeImpl = class extends NodeImpl {
|
|
11133
11280
|
static create() {
|
|
11134
11281
|
const chartNode = {
|
|
11135
11282
|
type: "extractMarkdownCodeBlocks",
|
|
11136
11283
|
title: "Extract Markdown Code Blocks",
|
|
11137
|
-
id: (0,
|
|
11284
|
+
id: (0, import_non_secure61.nanoid)(),
|
|
11138
11285
|
visualData: {
|
|
11139
11286
|
x: 0,
|
|
11140
11287
|
y: 0,
|
|
@@ -11175,7 +11322,7 @@ var ExtractMarkdownCodeBlocksNodeImpl = class extends NodeImpl {
|
|
|
11175
11322
|
}
|
|
11176
11323
|
static getUIData() {
|
|
11177
11324
|
return {
|
|
11178
|
-
infoBoxBody:
|
|
11325
|
+
infoBoxBody: import_ts_dedent57.dedent`
|
|
11179
11326
|
Extracts the code blocks in the input Markdown text.
|
|
11180
11327
|
|
|
11181
11328
|
Outputs the first matched block, all matched blocks, and the languages specified for the blocks.
|
|
@@ -11188,13 +11335,13 @@ var ExtractMarkdownCodeBlocksNodeImpl = class extends NodeImpl {
|
|
|
11188
11335
|
async process(inputs) {
|
|
11189
11336
|
const inputString = expectType(inputs["input"], "string");
|
|
11190
11337
|
const regex = /```(\w*)\n([\s\S]*?)```/g;
|
|
11191
|
-
let
|
|
11338
|
+
let match13;
|
|
11192
11339
|
let firstBlock;
|
|
11193
11340
|
const allBlocks = [];
|
|
11194
11341
|
const languages = [];
|
|
11195
|
-
while ((
|
|
11196
|
-
const language =
|
|
11197
|
-
const block =
|
|
11342
|
+
while ((match13 = regex.exec(inputString)) !== null) {
|
|
11343
|
+
const language = match13[1];
|
|
11344
|
+
const block = match13[2];
|
|
11198
11345
|
if (!firstBlock) {
|
|
11199
11346
|
firstBlock = block;
|
|
11200
11347
|
}
|
|
@@ -11226,9 +11373,9 @@ var extractMarkdownCodeBlocksNode = nodeDefinition(
|
|
|
11226
11373
|
);
|
|
11227
11374
|
|
|
11228
11375
|
// src/model/nodes/AssembleMessageNode.ts
|
|
11229
|
-
var
|
|
11376
|
+
var import_non_secure62 = require("nanoid/non-secure");
|
|
11230
11377
|
var import_lodash_es12 = require("lodash");
|
|
11231
|
-
var
|
|
11378
|
+
var import_ts_pattern8 = require("ts-pattern");
|
|
11232
11379
|
var messageTypeToTitle = {
|
|
11233
11380
|
assistant: "Assistant",
|
|
11234
11381
|
function: "Function Tool Call",
|
|
@@ -11240,7 +11387,7 @@ var AssembleMessageNodeImpl = class extends NodeImpl {
|
|
|
11240
11387
|
const chartNode = {
|
|
11241
11388
|
type: "assembleMessage",
|
|
11242
11389
|
title: "Assemble Message",
|
|
11243
|
-
id: (0,
|
|
11390
|
+
id: (0, import_non_secure62.nanoid)(),
|
|
11244
11391
|
visualData: {
|
|
11245
11392
|
x: 0,
|
|
11246
11393
|
y: 0,
|
|
@@ -11352,7 +11499,7 @@ var AssembleMessageNodeImpl = class extends NodeImpl {
|
|
|
11352
11499
|
async process(inputs) {
|
|
11353
11500
|
const output = {};
|
|
11354
11501
|
const type = getInputOrData(this.data, inputs, "type");
|
|
11355
|
-
const outMessage = (0,
|
|
11502
|
+
const outMessage = (0, import_ts_pattern8.match)(type).with(
|
|
11356
11503
|
"system",
|
|
11357
11504
|
(type2) => ({
|
|
11358
11505
|
type: type2,
|
|
@@ -11437,13 +11584,13 @@ var AssembleMessageNodeImpl = class extends NodeImpl {
|
|
|
11437
11584
|
var assembleMessageNode = nodeDefinition(AssembleMessageNodeImpl, "Assemble Prompt");
|
|
11438
11585
|
|
|
11439
11586
|
// src/model/nodes/URLReferenceNode.ts
|
|
11440
|
-
var
|
|
11587
|
+
var import_non_secure63 = require("nanoid/non-secure");
|
|
11441
11588
|
var UrlReferenceNodeImpl = class extends NodeImpl {
|
|
11442
11589
|
static create() {
|
|
11443
11590
|
const chartNode = {
|
|
11444
11591
|
type: "urlReference",
|
|
11445
11592
|
title: "URL Reference",
|
|
11446
|
-
id: (0,
|
|
11593
|
+
id: (0, import_non_secure63.nanoid)(),
|
|
11447
11594
|
visualData: {
|
|
11448
11595
|
x: 0,
|
|
11449
11596
|
y: 0,
|
|
@@ -11512,15 +11659,15 @@ var UrlReferenceNodeImpl = class extends NodeImpl {
|
|
|
11512
11659
|
var urlReferenceNode = nodeDefinition(UrlReferenceNodeImpl, "URL Reference");
|
|
11513
11660
|
|
|
11514
11661
|
// src/model/nodes/DestructureNode.ts
|
|
11515
|
-
var
|
|
11662
|
+
var import_non_secure64 = require("nanoid/non-secure");
|
|
11516
11663
|
var import_jsonpath_plus3 = require("jsonpath-plus");
|
|
11517
|
-
var
|
|
11664
|
+
var import_ts_dedent58 = require("ts-dedent");
|
|
11518
11665
|
var DestructureNodeImpl = class extends NodeImpl {
|
|
11519
11666
|
static create() {
|
|
11520
11667
|
const chartNode = {
|
|
11521
11668
|
type: "destructure",
|
|
11522
11669
|
title: "Destructure",
|
|
11523
|
-
id: (0,
|
|
11670
|
+
id: (0, import_non_secure64.nanoid)(),
|
|
11524
11671
|
visualData: {
|
|
11525
11672
|
x: 0,
|
|
11526
11673
|
y: 0,
|
|
@@ -11564,7 +11711,7 @@ var DestructureNodeImpl = class extends NodeImpl {
|
|
|
11564
11711
|
}
|
|
11565
11712
|
static getUIData() {
|
|
11566
11713
|
return {
|
|
11567
|
-
infoBoxBody:
|
|
11714
|
+
infoBoxBody: import_ts_dedent58.dedent`
|
|
11568
11715
|
Destructures the input value by extracting values at the specified paths. The paths use JSONPath notation to navigate through the value.
|
|
11569
11716
|
`,
|
|
11570
11717
|
infoBoxTitle: "Destructure Node",
|
|
@@ -11576,15 +11723,15 @@ var DestructureNodeImpl = class extends NodeImpl {
|
|
|
11576
11723
|
const inputObject = coerceTypeOptional(inputs["object"], "object");
|
|
11577
11724
|
const output = {};
|
|
11578
11725
|
this.data.paths.forEach((path, index) => {
|
|
11579
|
-
let
|
|
11726
|
+
let match13;
|
|
11580
11727
|
try {
|
|
11581
|
-
|
|
11728
|
+
match13 = (0, import_jsonpath_plus3.JSONPath)({ json: inputObject ?? null, path: path.trim(), wrap: false });
|
|
11582
11729
|
} catch (err) {
|
|
11583
|
-
|
|
11730
|
+
match13 = void 0;
|
|
11584
11731
|
}
|
|
11585
11732
|
output[`match_${index}`] = {
|
|
11586
11733
|
type: "any",
|
|
11587
|
-
value:
|
|
11734
|
+
value: match13
|
|
11588
11735
|
};
|
|
11589
11736
|
});
|
|
11590
11737
|
return output;
|
|
@@ -11593,12 +11740,12 @@ var DestructureNodeImpl = class extends NodeImpl {
|
|
|
11593
11740
|
var destructureNode = nodeDefinition(DestructureNodeImpl, "Destructure");
|
|
11594
11741
|
|
|
11595
11742
|
// src/model/nodes/ReplaceDatasetNode.ts
|
|
11596
|
-
var
|
|
11597
|
-
var
|
|
11743
|
+
var import_non_secure65 = require("nanoid/non-secure");
|
|
11744
|
+
var import_ts_dedent59 = require("ts-dedent");
|
|
11598
11745
|
var ReplaceDatasetNodeImpl = class extends NodeImpl {
|
|
11599
11746
|
static create() {
|
|
11600
11747
|
return {
|
|
11601
|
-
id: (0,
|
|
11748
|
+
id: (0, import_non_secure65.nanoid)(),
|
|
11602
11749
|
type: "replaceDataset",
|
|
11603
11750
|
title: "Replace Dataset",
|
|
11604
11751
|
visualData: { x: 0, y: 0, width: 250 },
|
|
@@ -11637,7 +11784,7 @@ var ReplaceDatasetNodeImpl = class extends NodeImpl {
|
|
|
11637
11784
|
}
|
|
11638
11785
|
static getUIData() {
|
|
11639
11786
|
return {
|
|
11640
|
-
infoBoxBody:
|
|
11787
|
+
infoBoxBody: import_ts_dedent59.dedent`
|
|
11641
11788
|
Replaces the data in a dataset with the given data. If no data is given, the dataset will be cleared instead.
|
|
11642
11789
|
`,
|
|
11643
11790
|
infoBoxTitle: "Replace Dataset Node",
|
|
@@ -11769,14 +11916,14 @@ var ListGraphsNodeImpl = class extends NodeImpl {
|
|
|
11769
11916
|
var listGraphsNode = nodeDefinition(ListGraphsNodeImpl, "List Graphs");
|
|
11770
11917
|
|
|
11771
11918
|
// src/model/nodes/GraphReferenceNode.ts
|
|
11772
|
-
var
|
|
11773
|
-
var
|
|
11919
|
+
var import_non_secure66 = require("nanoid/non-secure");
|
|
11920
|
+
var import_ts_dedent60 = require("ts-dedent");
|
|
11774
11921
|
var GraphReferenceNodeImpl = class extends NodeImpl {
|
|
11775
11922
|
static create() {
|
|
11776
11923
|
const chartNode = {
|
|
11777
11924
|
type: "graphReference",
|
|
11778
11925
|
title: "Graph Reference",
|
|
11779
|
-
id: (0,
|
|
11926
|
+
id: (0, import_non_secure66.nanoid)(),
|
|
11780
11927
|
visualData: {
|
|
11781
11928
|
x: 0,
|
|
11782
11929
|
y: 0,
|
|
@@ -11825,7 +11972,7 @@ var GraphReferenceNodeImpl = class extends NodeImpl {
|
|
|
11825
11972
|
}
|
|
11826
11973
|
static getUIData() {
|
|
11827
11974
|
return {
|
|
11828
|
-
infoBoxBody:
|
|
11975
|
+
infoBoxBody: import_ts_dedent60.dedent`
|
|
11829
11976
|
Gets a reference to another graph, that can be used to pass around graphs to call using a Call Graph node.
|
|
11830
11977
|
`,
|
|
11831
11978
|
infoBoxTitle: "Graph Reference Node",
|
|
@@ -11891,13 +12038,13 @@ var GraphReferenceNodeImpl = class extends NodeImpl {
|
|
|
11891
12038
|
var graphReferenceNode = nodeDefinition(GraphReferenceNodeImpl, "Graph Reference");
|
|
11892
12039
|
|
|
11893
12040
|
// src/model/nodes/CallGraphNode.ts
|
|
11894
|
-
var
|
|
11895
|
-
var
|
|
12041
|
+
var import_non_secure67 = require("nanoid/non-secure");
|
|
12042
|
+
var import_ts_dedent61 = require("ts-dedent");
|
|
11896
12043
|
|
|
11897
12044
|
// src/api/looseDataValue.ts
|
|
11898
12045
|
var import_lodash_es13 = require("lodash");
|
|
11899
|
-
function looseDataValuesToDataValues(
|
|
11900
|
-
return (0, import_lodash_es13.mapValues)(
|
|
12046
|
+
function looseDataValuesToDataValues(values2) {
|
|
12047
|
+
return (0, import_lodash_es13.mapValues)(values2, (val) => looseDataValueToDataValue(val));
|
|
11901
12048
|
}
|
|
11902
12049
|
function looseDataValueToDataValue(value) {
|
|
11903
12050
|
if (typeof value === "string") {
|
|
@@ -11918,7 +12065,7 @@ var CallGraphNodeImpl = class extends NodeImpl {
|
|
|
11918
12065
|
const chartNode = {
|
|
11919
12066
|
type: "callGraph",
|
|
11920
12067
|
title: "Call Graph",
|
|
11921
|
-
id: (0,
|
|
12068
|
+
id: (0, import_non_secure67.nanoid)(),
|
|
11922
12069
|
visualData: {
|
|
11923
12070
|
x: 0,
|
|
11924
12071
|
y: 0,
|
|
@@ -11968,7 +12115,7 @@ var CallGraphNodeImpl = class extends NodeImpl {
|
|
|
11968
12115
|
}
|
|
11969
12116
|
static getUIData() {
|
|
11970
12117
|
return {
|
|
11971
|
-
infoBoxBody:
|
|
12118
|
+
infoBoxBody: import_ts_dedent61.dedent`
|
|
11972
12119
|
Calls another graph and passes inputs to it. Use in combination with the Graph Reference node to call dynamic graphs.
|
|
11973
12120
|
`,
|
|
11974
12121
|
infoBoxTitle: "Call Graph Node",
|
|
@@ -12040,7 +12187,7 @@ var callGraphNode = nodeDefinition(CallGraphNodeImpl, "Call Graph");
|
|
|
12040
12187
|
|
|
12041
12188
|
// src/model/nodes/DelegateFunctionCallNode.ts
|
|
12042
12189
|
var import_nanoid = require("nanoid");
|
|
12043
|
-
var
|
|
12190
|
+
var import_ts_dedent62 = require("ts-dedent");
|
|
12044
12191
|
var DelegateFunctionCallNodeImpl = class extends NodeImpl {
|
|
12045
12192
|
static create() {
|
|
12046
12193
|
const chartNode = {
|
|
@@ -12090,7 +12237,7 @@ var DelegateFunctionCallNodeImpl = class extends NodeImpl {
|
|
|
12090
12237
|
}
|
|
12091
12238
|
static getUIData() {
|
|
12092
12239
|
return {
|
|
12093
|
-
infoBoxBody:
|
|
12240
|
+
infoBoxBody: import_ts_dedent62.dedent`
|
|
12094
12241
|
Handles a tool call by delegating it to a different subgraph depending on the tool call.
|
|
12095
12242
|
`,
|
|
12096
12243
|
infoBoxTitle: "Delegate Tool Call Node",
|
|
@@ -12207,11 +12354,11 @@ var DelegateFunctionCallNodeImpl = class extends NodeImpl {
|
|
|
12207
12354
|
var delegateFunctionCallNode = nodeDefinition(DelegateFunctionCallNodeImpl, "Delegate Tool Call");
|
|
12208
12355
|
|
|
12209
12356
|
// src/model/nodes/PlayAudioNode.ts
|
|
12210
|
-
var
|
|
12357
|
+
var import_non_secure68 = require("nanoid/non-secure");
|
|
12211
12358
|
var PlayAudioNodeImpl = class extends NodeImpl {
|
|
12212
12359
|
static create() {
|
|
12213
12360
|
return {
|
|
12214
|
-
id: (0,
|
|
12361
|
+
id: (0, import_non_secure68.nanoid)(),
|
|
12215
12362
|
type: "playAudio",
|
|
12216
12363
|
title: "Play Audio",
|
|
12217
12364
|
visualData: { x: 0, y: 0, width: 200 },
|
|
@@ -12265,11 +12412,11 @@ var PlayAudioNodeImpl = class extends NodeImpl {
|
|
|
12265
12412
|
var playAudioNode = nodeDefinition(PlayAudioNodeImpl, "Play Audio");
|
|
12266
12413
|
|
|
12267
12414
|
// src/model/nodes/DocumentNode.ts
|
|
12268
|
-
var
|
|
12415
|
+
var import_non_secure69 = require("nanoid/non-secure");
|
|
12269
12416
|
var DocumentNodeImpl = class extends NodeImpl {
|
|
12270
12417
|
static create() {
|
|
12271
12418
|
return {
|
|
12272
|
-
id: (0,
|
|
12419
|
+
id: (0, import_non_secure69.nanoid)(),
|
|
12273
12420
|
type: "document",
|
|
12274
12421
|
title: "Document",
|
|
12275
12422
|
visualData: { x: 0, y: 0, width: 300 },
|
|
@@ -12435,14 +12582,14 @@ var DocumentNodeImpl = class extends NodeImpl {
|
|
|
12435
12582
|
var documentNode = nodeDefinition(DocumentNodeImpl, "Document");
|
|
12436
12583
|
|
|
12437
12584
|
// src/model/nodes/ChatLoopNode.ts
|
|
12438
|
-
var
|
|
12439
|
-
var
|
|
12585
|
+
var import_non_secure70 = require("nanoid/non-secure");
|
|
12586
|
+
var import_ts_dedent63 = require("ts-dedent");
|
|
12440
12587
|
var ChatLoopNodeImpl = class extends NodeImpl {
|
|
12441
12588
|
static create() {
|
|
12442
12589
|
const chartNode = {
|
|
12443
12590
|
type: "chatLoop",
|
|
12444
12591
|
title: "Chat Loop",
|
|
12445
|
-
id: (0,
|
|
12592
|
+
id: (0, import_non_secure70.nanoid)(),
|
|
12446
12593
|
visualData: {
|
|
12447
12594
|
x: 0,
|
|
12448
12595
|
y: 0,
|
|
@@ -12475,7 +12622,7 @@ var ChatLoopNodeImpl = class extends NodeImpl {
|
|
|
12475
12622
|
}
|
|
12476
12623
|
static getUIData() {
|
|
12477
12624
|
return {
|
|
12478
|
-
infoBoxBody:
|
|
12625
|
+
infoBoxBody: import_ts_dedent63.dedent`
|
|
12479
12626
|
Creates an interactive chat loop with an AI model. The node will:
|
|
12480
12627
|
1. Send the initial prompt to the AI
|
|
12481
12628
|
2. Show the AI's response and prompt for user input
|
|
@@ -12575,12 +12722,12 @@ var ChatLoopNodeImpl = class extends NodeImpl {
|
|
|
12575
12722
|
var chatLoopNode = nodeDefinition(ChatLoopNodeImpl, "Chat Loop");
|
|
12576
12723
|
|
|
12577
12724
|
// src/model/nodes/ReadAllFilesNode.ts
|
|
12578
|
-
var
|
|
12579
|
-
var
|
|
12725
|
+
var import_non_secure71 = require("nanoid/non-secure");
|
|
12726
|
+
var import_ts_dedent64 = require("ts-dedent");
|
|
12580
12727
|
var ReadAllFilesNodeImpl = class extends NodeImpl {
|
|
12581
12728
|
static create() {
|
|
12582
12729
|
return {
|
|
12583
|
-
id: (0,
|
|
12730
|
+
id: (0, import_non_secure71.nanoid)(),
|
|
12584
12731
|
type: "readAllFiles",
|
|
12585
12732
|
title: "Read All Files",
|
|
12586
12733
|
visualData: { x: 0, y: 0, width: 250 },
|
|
@@ -12691,7 +12838,7 @@ var ReadAllFilesNodeImpl = class extends NodeImpl {
|
|
|
12691
12838
|
];
|
|
12692
12839
|
}
|
|
12693
12840
|
getBody() {
|
|
12694
|
-
return
|
|
12841
|
+
return import_ts_dedent64.dedent`
|
|
12695
12842
|
${this.data.asBinary ? "Read as Binary" : "Read as Text"}
|
|
12696
12843
|
Path: ${this.data.usePathInput ? "(Input)" : this.data.path}
|
|
12697
12844
|
Recursive: ${this.data.useRecursiveInput ? "(Input)" : this.data.recursive}
|
|
@@ -12700,7 +12847,7 @@ var ReadAllFilesNodeImpl = class extends NodeImpl {
|
|
|
12700
12847
|
}
|
|
12701
12848
|
static getUIData() {
|
|
12702
12849
|
return {
|
|
12703
|
-
infoBoxBody:
|
|
12850
|
+
infoBoxBody: import_ts_dedent64.dedent`
|
|
12704
12851
|
Reads all files in the specified directory and outputs an array of objects containing each file's path and contents.
|
|
12705
12852
|
Each object has a 'path' (string) and 'content' (string or binary) property.
|
|
12706
12853
|
`,
|
|
@@ -12773,14 +12920,14 @@ var ReadAllFilesNodeImpl = class extends NodeImpl {
|
|
|
12773
12920
|
var readAllFilesNode = nodeDefinition(ReadAllFilesNodeImpl, "Read All Files");
|
|
12774
12921
|
|
|
12775
12922
|
// src/model/nodes/ToMarkdownTableNode.ts
|
|
12776
|
-
var
|
|
12777
|
-
var
|
|
12923
|
+
var import_non_secure72 = require("nanoid/non-secure");
|
|
12924
|
+
var import_ts_dedent65 = require("ts-dedent");
|
|
12778
12925
|
var ToMarkdownTableNodeImpl = class extends NodeImpl {
|
|
12779
12926
|
static create() {
|
|
12780
12927
|
const chartNode = {
|
|
12781
12928
|
type: "toMarkdownTable",
|
|
12782
12929
|
title: "To Markdown Table",
|
|
12783
|
-
id: (0,
|
|
12930
|
+
id: (0, import_non_secure72.nanoid)(),
|
|
12784
12931
|
visualData: {
|
|
12785
12932
|
x: 0,
|
|
12786
12933
|
y: 0,
|
|
@@ -12836,7 +12983,7 @@ var ToMarkdownTableNodeImpl = class extends NodeImpl {
|
|
|
12836
12983
|
}
|
|
12837
12984
|
static getUIData() {
|
|
12838
12985
|
return {
|
|
12839
|
-
infoBoxBody:
|
|
12986
|
+
infoBoxBody: import_ts_dedent65.dedent`
|
|
12840
12987
|
Converts an array of objects into a markdown table format.
|
|
12841
12988
|
Input should be an array of objects with consistent keys.
|
|
12842
12989
|
`,
|
|
@@ -12888,7 +13035,7 @@ var toMarkdownTableNode = nodeDefinition(ToMarkdownTableNodeImpl, "To Markdown T
|
|
|
12888
13035
|
|
|
12889
13036
|
// src/model/nodes/CronNode.ts
|
|
12890
13037
|
var import_nanoid2 = require("nanoid");
|
|
12891
|
-
var
|
|
13038
|
+
var import_ts_dedent66 = require("ts-dedent");
|
|
12892
13039
|
var cronParser = __toESM(require("cron-parser"), 1);
|
|
12893
13040
|
var CronNodeImpl = class extends NodeImpl {
|
|
12894
13041
|
static create() {
|
|
@@ -12958,7 +13105,7 @@ var CronNodeImpl = class extends NodeImpl {
|
|
|
12958
13105
|
}
|
|
12959
13106
|
static getUIData() {
|
|
12960
13107
|
return {
|
|
12961
|
-
infoBoxBody:
|
|
13108
|
+
infoBoxBody: import_ts_dedent66.dedent`
|
|
12962
13109
|
Executes a subgraph on a schedule. Supports:
|
|
12963
13110
|
- Natural language (e.g., "every 5 minutes", "daily at 3pm")
|
|
12964
13111
|
- Cron expressions (e.g., "0 * * * *")
|
|
@@ -12998,7 +13145,7 @@ var CronNodeImpl = class extends NodeImpl {
|
|
|
12998
13145
|
type: "string",
|
|
12999
13146
|
dataKey: "schedule",
|
|
13000
13147
|
label: "Schedule",
|
|
13001
|
-
helperMessage:
|
|
13148
|
+
helperMessage: import_ts_dedent66.dedent`
|
|
13002
13149
|
Examples:
|
|
13003
13150
|
Cron: "*/5 * * * *", "0 15 * * *"
|
|
13004
13151
|
Interval: "5 minutes", "1 hour", "7 days"
|
|
@@ -13011,12 +13158,12 @@ var CronNodeImpl = class extends NodeImpl {
|
|
|
13011
13158
|
if (scheduleType === "cron") {
|
|
13012
13159
|
return { type: "cron", expression: schedule };
|
|
13013
13160
|
}
|
|
13014
|
-
const
|
|
13015
|
-
if (!
|
|
13161
|
+
const match13 = schedule.match(/^(\d+)\s*(second|seconds|minute|minutes|hour|hours|day|days|week|weeks)$/i);
|
|
13162
|
+
if (!match13) {
|
|
13016
13163
|
throw new Error('Invalid interval format. Expected: "number unit" (e.g., "5 minutes")');
|
|
13017
13164
|
}
|
|
13018
|
-
const value = parseInt(
|
|
13019
|
-
let unit =
|
|
13165
|
+
const value = parseInt(match13[1], 10);
|
|
13166
|
+
let unit = match13[2].toLowerCase();
|
|
13020
13167
|
if (unit.endsWith("s")) {
|
|
13021
13168
|
unit = unit;
|
|
13022
13169
|
} else {
|
|
@@ -13129,15 +13276,15 @@ ${this.data.schedule}`;
|
|
|
13129
13276
|
var cronNode = nodeDefinition(CronNodeImpl, "Cron");
|
|
13130
13277
|
|
|
13131
13278
|
// src/model/nodes/ToTreeNode.ts
|
|
13132
|
-
var
|
|
13133
|
-
var
|
|
13279
|
+
var import_non_secure73 = require("nanoid/non-secure");
|
|
13280
|
+
var import_ts_dedent67 = require("ts-dedent");
|
|
13134
13281
|
var import_lodash_es14 = require("lodash");
|
|
13135
13282
|
var ToTreeNodeImpl = class extends NodeImpl {
|
|
13136
13283
|
static create() {
|
|
13137
13284
|
const chartNode = {
|
|
13138
13285
|
type: "toTree",
|
|
13139
13286
|
title: "To Tree",
|
|
13140
|
-
id: (0,
|
|
13287
|
+
id: (0, import_non_secure73.nanoid)(),
|
|
13141
13288
|
visualData: {
|
|
13142
13289
|
x: 0,
|
|
13143
13290
|
y: 0,
|
|
@@ -13192,7 +13339,7 @@ var ToTreeNodeImpl = class extends NodeImpl {
|
|
|
13192
13339
|
];
|
|
13193
13340
|
}
|
|
13194
13341
|
getBody() {
|
|
13195
|
-
return
|
|
13342
|
+
return import_ts_dedent67.dedent`
|
|
13196
13343
|
Format: ${this.data.format}
|
|
13197
13344
|
Children: ${this.data.childrenProperty}
|
|
13198
13345
|
Sort: ${this.data.useSortAlphabetically ? "Yes" : "No"}
|
|
@@ -13200,7 +13347,7 @@ var ToTreeNodeImpl = class extends NodeImpl {
|
|
|
13200
13347
|
}
|
|
13201
13348
|
static getUIData() {
|
|
13202
13349
|
return {
|
|
13203
|
-
infoBoxBody:
|
|
13350
|
+
infoBoxBody: import_ts_dedent67.dedent`
|
|
13204
13351
|
Converts an array of objects into a tree structure and renders it as text.
|
|
13205
13352
|
|
|
13206
13353
|
The format field supports interpolation using {{property}} syntax to determine
|
|
@@ -13224,8 +13371,8 @@ var ToTreeNodeImpl = class extends NodeImpl {
|
|
|
13224
13371
|
const indent = level === 0 ? "" : " ".repeat(level - 1) + (isLast ? " " : "\u2502 ");
|
|
13225
13372
|
const matches = extractInterpolationVariables(this.data.format);
|
|
13226
13373
|
const interpolationVars = matches.reduce(
|
|
13227
|
-
(acc,
|
|
13228
|
-
const key =
|
|
13374
|
+
(acc, match13) => {
|
|
13375
|
+
const key = match13;
|
|
13229
13376
|
acc[key] = String((0, import_lodash_es14.get)(obj, key, ""));
|
|
13230
13377
|
return acc;
|
|
13231
13378
|
},
|
|
@@ -13255,14 +13402,14 @@ var ToTreeNodeImpl = class extends NodeImpl {
|
|
|
13255
13402
|
var toTreeNode = nodeDefinition(ToTreeNodeImpl, "To Tree");
|
|
13256
13403
|
|
|
13257
13404
|
// src/model/nodes/LoopUntilNode.ts
|
|
13258
|
-
var
|
|
13259
|
-
var
|
|
13405
|
+
var import_non_secure74 = require("nanoid/non-secure");
|
|
13406
|
+
var import_ts_dedent68 = require("ts-dedent");
|
|
13260
13407
|
var LoopUntilNodeImpl = class extends NodeImpl {
|
|
13261
13408
|
static create() {
|
|
13262
13409
|
const chartNode = {
|
|
13263
13410
|
type: "loopUntil",
|
|
13264
13411
|
title: "Loop Until",
|
|
13265
|
-
id: (0,
|
|
13412
|
+
id: (0, import_non_secure74.nanoid)(),
|
|
13266
13413
|
visualData: {
|
|
13267
13414
|
x: 0,
|
|
13268
13415
|
y: 0,
|
|
@@ -13386,7 +13533,7 @@ var LoopUntilNodeImpl = class extends NodeImpl {
|
|
|
13386
13533
|
}
|
|
13387
13534
|
static getUIData() {
|
|
13388
13535
|
return {
|
|
13389
|
-
infoBoxBody:
|
|
13536
|
+
infoBoxBody: import_ts_dedent68.dedent`
|
|
13390
13537
|
Executes a subgraph in a loop until a condition is met. Each iteration's outputs become
|
|
13391
13538
|
the inputs for the next iteration. Supports different stopping conditions and optional
|
|
13392
13539
|
maximum iterations.
|
|
@@ -13461,15 +13608,15 @@ until ${condition}${maxIterations}`;
|
|
|
13461
13608
|
var loopUntilNode = nodeDefinition(LoopUntilNodeImpl, "Loop Until");
|
|
13462
13609
|
|
|
13463
13610
|
// src/model/nodes/ReferencedGraphAliasNode.ts
|
|
13464
|
-
var
|
|
13465
|
-
var
|
|
13611
|
+
var import_non_secure75 = require("nanoid/non-secure");
|
|
13612
|
+
var import_ts_dedent69 = require("ts-dedent");
|
|
13466
13613
|
var ReferencedGraphAliasNodeImpl = class extends NodeImpl {
|
|
13467
13614
|
static create() {
|
|
13468
13615
|
const chartNode = {
|
|
13469
13616
|
type: "referencedGraphAlias",
|
|
13470
13617
|
title: "",
|
|
13471
13618
|
// Always set initially by the editor
|
|
13472
|
-
id: (0,
|
|
13619
|
+
id: (0, import_non_secure75.nanoid)(),
|
|
13473
13620
|
visualData: {
|
|
13474
13621
|
x: 0,
|
|
13475
13622
|
y: 0,
|
|
@@ -13576,7 +13723,7 @@ var ReferencedGraphAliasNodeImpl = class extends NodeImpl {
|
|
|
13576
13723
|
}
|
|
13577
13724
|
static getUIData() {
|
|
13578
13725
|
return {
|
|
13579
|
-
infoBoxBody:
|
|
13726
|
+
infoBoxBody: import_ts_dedent69.dedent`
|
|
13580
13727
|
References a graph from another project. Inputs and outputs are defined by Graph Input and Graph Output nodes within the referenced graph.
|
|
13581
13728
|
`,
|
|
13582
13729
|
infoBoxTitle: "Referenced Graph Alias Node",
|
|
@@ -13670,7 +13817,7 @@ var referencedGraphAliasNode = nodeDefinition(ReferencedGraphAliasNodeImpl, "Ref
|
|
|
13670
13817
|
|
|
13671
13818
|
// src/model/Nodes.ts
|
|
13672
13819
|
var registerBuiltInNodes = (registry2) => {
|
|
13673
|
-
return registry2.register(toYamlNode).register(userInputNode).register(textNode).register(chatNode).register(promptNode).register(extractRegexNode).register(codeNode).register(matchNode).register(ifNode).register(readDirectoryNode).register(readFileNode).register(ifElseNode).register(chunkNode).register(graphInputNode).register(graphOutputNode).register(subGraphNode).register(arrayNode).register(extractJsonNode).register(assemblePromptNode).register(loopControllerNode).register(trimChatMessagesNode).register(extractYamlNode).register(externalCallNode).register(extractObjectPathNode).register(raiseEventNode).register(contextNode).register(coalesceNode).register(passthroughNode).register(popNode).register(setGlobalNode).register(getGlobalNode).register(waitForEventNode).register(gptFunctionNode).register(getEmbeddingNode).register(vectorStoreNode).register(vectorNearestNeighborsNode).register(hashNode).register(abortGraphNode).register(raceInputsNode).register(toJsonNode).register(joinNode).register(filterNode).register(objectNode).register(booleanNode).register(compareNode).register(evaluateNode).register(numberNode).register(randomNumberNode).register(shuffleNode).register(commentNode).register(imageToMDNode).register(imageNode).register(audioNode).register(httpCallNode).register(delayNode).register(appendToDatasetNode).register(createDatasetNode).register(loadDatasetNode).register(getAllDatasetsNode).register(splitNode).register(datasetNearestNeighborsNode).register(getDatasetRowNode).register(sliceNode).register(extractMarkdownCodeBlocksNode).register(assembleMessageNode).register(urlReferenceNode).register(destructureNode).register(replaceDatasetNode).register(listGraphsNode).register(graphReferenceNode).register(callGraphNode).register(delegateFunctionCallNode).register(playAudioNode).register(documentNode).register(chatLoopNode).register(readAllFilesNode).register(toMarkdownTableNode).register(cronNode).register(toTreeNode).register(loopUntilNode).register(referencedGraphAliasNode);
|
|
13820
|
+
return registry2.register(toYamlNode).register(userInputNode).register(textNode).register(chatNode).register(promptNode).register(extractRegexNode).register(codeNode).register(matchNode).register(ifNode).register(readDirectoryNode).register(readFileNode).register(writeFileNode).register(ifElseNode).register(chunkNode).register(graphInputNode).register(graphOutputNode).register(subGraphNode).register(arrayNode).register(extractJsonNode).register(assemblePromptNode).register(loopControllerNode).register(trimChatMessagesNode).register(extractYamlNode).register(externalCallNode).register(extractObjectPathNode).register(raiseEventNode).register(contextNode).register(coalesceNode).register(passthroughNode).register(popNode).register(setGlobalNode).register(getGlobalNode).register(waitForEventNode).register(gptFunctionNode).register(getEmbeddingNode).register(vectorStoreNode).register(vectorNearestNeighborsNode).register(hashNode).register(abortGraphNode).register(raceInputsNode).register(toJsonNode).register(joinNode).register(filterNode).register(objectNode).register(booleanNode).register(compareNode).register(evaluateNode).register(numberNode).register(randomNumberNode).register(shuffleNode).register(commentNode).register(imageToMDNode).register(imageNode).register(audioNode).register(httpCallNode).register(delayNode).register(appendToDatasetNode).register(createDatasetNode).register(loadDatasetNode).register(getAllDatasetsNode).register(splitNode).register(datasetNearestNeighborsNode).register(getDatasetRowNode).register(sliceNode).register(extractMarkdownCodeBlocksNode).register(assembleMessageNode).register(urlReferenceNode).register(destructureNode).register(replaceDatasetNode).register(listGraphsNode).register(graphReferenceNode).register(callGraphNode).register(delegateFunctionCallNode).register(playAudioNode).register(documentNode).register(chatLoopNode).register(readAllFilesNode).register(toMarkdownTableNode).register(cronNode).register(toTreeNode).register(loopUntilNode).register(referencedGraphAliasNode);
|
|
13674
13821
|
};
|
|
13675
13822
|
var globalRivetNodeRegistry = registerBuiltInNodes(new NodeRegistration());
|
|
13676
13823
|
function resetGlobalRivetNodeRegistry() {
|
|
@@ -13799,7 +13946,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
13799
13946
|
#isPaused = false;
|
|
13800
13947
|
#parent;
|
|
13801
13948
|
#registry;
|
|
13802
|
-
id = (0,
|
|
13949
|
+
id = (0, import_non_secure76.nanoid)();
|
|
13803
13950
|
#includeTrace = true;
|
|
13804
13951
|
executor;
|
|
13805
13952
|
/** If set, specifies the node(s) that the graph will run TO, instead of the nodes without any dependents. */
|
|
@@ -13841,6 +13988,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
13841
13988
|
#loadedProjects = void 0;
|
|
13842
13989
|
#definitions = void 0;
|
|
13843
13990
|
#scc = void 0;
|
|
13991
|
+
// @ts-expect-error
|
|
13844
13992
|
#nodesNotInCycle = void 0;
|
|
13845
13993
|
#nodeAbortControllers = /* @__PURE__ */ new Map();
|
|
13846
13994
|
/** User input nodes that are pending user input. */
|
|
@@ -13973,14 +14121,14 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
13973
14121
|
const internalHandler = this.#onUserEventHandlers.get(listener);
|
|
13974
14122
|
this.#emitter.offAny(internalHandler);
|
|
13975
14123
|
}
|
|
13976
|
-
userInput(nodeId,
|
|
14124
|
+
userInput(nodeId, values2) {
|
|
13977
14125
|
const pending = this.#pendingUserInputs[nodeId];
|
|
13978
14126
|
if (pending) {
|
|
13979
|
-
pending.resolve(
|
|
14127
|
+
pending.resolve(values2);
|
|
13980
14128
|
delete this.#pendingUserInputs[nodeId];
|
|
13981
14129
|
}
|
|
13982
14130
|
for (const processor of this.#subprocessors) {
|
|
13983
|
-
processor.userInput(nodeId,
|
|
14131
|
+
processor.userInput(nodeId, values2);
|
|
13984
14132
|
}
|
|
13985
14133
|
}
|
|
13986
14134
|
setExternalFunction(name, fn) {
|
|
@@ -14087,7 +14235,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
14087
14235
|
break;
|
|
14088
14236
|
}
|
|
14089
14237
|
await this.#waitUntilUnpaused();
|
|
14090
|
-
await (0,
|
|
14238
|
+
await (0, import_ts_pattern9.match)(event).with({ type: "start" }, ({ data }) => {
|
|
14091
14239
|
this.#emitter.emit("start", {
|
|
14092
14240
|
project: this.#project,
|
|
14093
14241
|
contextValues: data.contextValues,
|
|
@@ -14178,14 +14326,14 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
14178
14326
|
processId: data.processId,
|
|
14179
14327
|
renderingType: data.renderingType
|
|
14180
14328
|
});
|
|
14181
|
-
}).with({ type:
|
|
14329
|
+
}).with({ type: import_ts_pattern9.P.string.startsWith("globalSet:") }, ({ type, data }) => {
|
|
14182
14330
|
this.#emitter.emit(type, data);
|
|
14183
|
-
}).with({ type:
|
|
14331
|
+
}).with({ type: import_ts_pattern9.P.string.startsWith("userEvent:") }, ({ type, data }) => {
|
|
14184
14332
|
this.#emitter.emit(type, data);
|
|
14185
14333
|
}).with({ type: "newAbortController" }, () => {
|
|
14186
14334
|
}).with({ type: "finish" }, () => {
|
|
14187
14335
|
this.#emitter.emit("finish", void 0);
|
|
14188
|
-
}).with(
|
|
14336
|
+
}).with(import_ts_pattern9.P.nullish, () => {
|
|
14189
14337
|
}).exhaustive();
|
|
14190
14338
|
}
|
|
14191
14339
|
} catch (err) {
|
|
@@ -14298,7 +14446,10 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
14298
14446
|
const [, nodeError] = erroredNodes[0];
|
|
14299
14447
|
error = new Error(message, { cause: nodeError });
|
|
14300
14448
|
} else {
|
|
14301
|
-
error = new AggregateError(
|
|
14449
|
+
error = new AggregateError(
|
|
14450
|
+
erroredNodes.map(([, nodeError]) => nodeError),
|
|
14451
|
+
message
|
|
14452
|
+
);
|
|
14302
14453
|
}
|
|
14303
14454
|
}
|
|
14304
14455
|
await this.#emitter.emit("graphError", { graph: this.#graph, error });
|
|
@@ -14460,7 +14611,7 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
14460
14611
|
return;
|
|
14461
14612
|
}
|
|
14462
14613
|
const inputValues = this.#getInputValuesForNode(node);
|
|
14463
|
-
if (this.#excludedDueToControlFlow(node, inputValues, (0,
|
|
14614
|
+
if (this.#excludedDueToControlFlow(node, inputValues, (0, import_non_secure76.nanoid)(), "loop-not-broken")) {
|
|
14464
14615
|
this.#emitTraceEvent(`Node ${node.title} is excluded due to control flow`);
|
|
14465
14616
|
return;
|
|
14466
14617
|
}
|
|
@@ -14594,7 +14745,7 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
14594
14745
|
return nodeData;
|
|
14595
14746
|
}
|
|
14596
14747
|
async #processNode(node) {
|
|
14597
|
-
const processId = (0,
|
|
14748
|
+
const processId = (0, import_non_secure76.nanoid)();
|
|
14598
14749
|
if (this.#abortController.signal.aborted) {
|
|
14599
14750
|
this.#nodeErrored(node, new Error("Processing aborted"), processId);
|
|
14600
14751
|
return processId;
|
|
@@ -15023,18 +15174,18 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
15023
15174
|
#getInputValuesForNode(node) {
|
|
15024
15175
|
const connections = this.#connections[node.id];
|
|
15025
15176
|
return this.#definitions[node.id].inputs.reduce(
|
|
15026
|
-
(
|
|
15177
|
+
(values2, input) => {
|
|
15027
15178
|
if (!connections) {
|
|
15028
|
-
return
|
|
15179
|
+
return values2;
|
|
15029
15180
|
}
|
|
15030
15181
|
const connection = connections.find((conn) => conn.inputId === input.id && conn.inputNodeId === node.id);
|
|
15031
15182
|
if (connection) {
|
|
15032
15183
|
const outputNode = this.#nodeInstances[connection.outputNodeId].chartNode;
|
|
15033
15184
|
const outputNodeOutputs = this.#nodeResults.get(outputNode.id);
|
|
15034
15185
|
const outputResult = outputNodeOutputs == null ? void 0 : outputNodeOutputs[connection.outputId];
|
|
15035
|
-
|
|
15186
|
+
values2[input.id] = outputResult;
|
|
15036
15187
|
}
|
|
15037
|
-
return
|
|
15188
|
+
return values2;
|
|
15038
15189
|
},
|
|
15039
15190
|
{}
|
|
15040
15191
|
);
|
|
@@ -15119,9 +15270,6 @@ ${erroredNodes.map(([nodeId]) => `- ${this.#nodesById[nodeId].title} (${nodeId})
|
|
|
15119
15270
|
}
|
|
15120
15271
|
return sccs;
|
|
15121
15272
|
}
|
|
15122
|
-
#nodeIsInCycle(nodeId) {
|
|
15123
|
-
return this.#nodesNotInCycle.find((node) => node.id === nodeId) == null;
|
|
15124
|
-
}
|
|
15125
15273
|
#nodesAreInSameCycle(a, b) {
|
|
15126
15274
|
return this.#scc.find((cycle) => cycle.find((node) => node.id === a) && cycle.find((node) => node.id === b));
|
|
15127
15275
|
}
|
|
@@ -15163,6 +15311,9 @@ function assertBaseDir(baseDir) {
|
|
|
15163
15311
|
|
|
15164
15312
|
// src/native/BrowserNativeApi.ts
|
|
15165
15313
|
var BrowserNativeApi = class {
|
|
15314
|
+
createdir(_path, _recursive, _baseDir) {
|
|
15315
|
+
throw new Error("Method not implemented.");
|
|
15316
|
+
}
|
|
15166
15317
|
readdir(_path, _baseDir) {
|
|
15167
15318
|
throw new Error("Method not implemented.");
|
|
15168
15319
|
}
|
|
@@ -15175,7 +15326,19 @@ var BrowserNativeApi = class {
|
|
|
15175
15326
|
writeTextFile(_path, _data, _baseDir) {
|
|
15176
15327
|
throw new Error("Method not implemented.");
|
|
15177
15328
|
}
|
|
15178
|
-
|
|
15329
|
+
writeBinaryFile(_path, _data, _baseDir) {
|
|
15330
|
+
throw new Error("Method not implemented.");
|
|
15331
|
+
}
|
|
15332
|
+
exists(_path, _baseDir) {
|
|
15333
|
+
throw new Error("Method not implemented.");
|
|
15334
|
+
}
|
|
15335
|
+
join(..._paths) {
|
|
15336
|
+
throw new Error("Method not implemented.");
|
|
15337
|
+
}
|
|
15338
|
+
uniqueFilename(_path, _baseDir) {
|
|
15339
|
+
throw new Error("Method not implemented.");
|
|
15340
|
+
}
|
|
15341
|
+
exec() {
|
|
15179
15342
|
throw new Error("Method not supported.");
|
|
15180
15343
|
}
|
|
15181
15344
|
};
|
|
@@ -15208,8 +15371,9 @@ var OpenAIEmbeddingGenerator = class {
|
|
|
15208
15371
|
registerIntegration("embeddingGenerator", "openai", (context) => new OpenAIEmbeddingGenerator(context.settings));
|
|
15209
15372
|
|
|
15210
15373
|
// src/recording/ExecutionRecorder.ts
|
|
15211
|
-
var
|
|
15374
|
+
var import_non_secure77 = require("nanoid/non-secure");
|
|
15212
15375
|
var import_emittery3 = __toESM(require("emittery-0-13"), 1);
|
|
15376
|
+
var import_lodash_es16 = require("lodash");
|
|
15213
15377
|
var toRecordedEventMap = {
|
|
15214
15378
|
graphStart: ({ graph, inputs }) => ({ graphId: graph.metadata.id, inputs }),
|
|
15215
15379
|
graphFinish: ({ graph, outputs }) => ({ graphId: graph.metadata.id, outputs }),
|
|
@@ -15303,6 +15467,27 @@ function toRecordedEvent(event, data) {
|
|
|
15303
15467
|
ts: Date.now()
|
|
15304
15468
|
};
|
|
15305
15469
|
}
|
|
15470
|
+
function mapValuesDeep(obj, fn) {
|
|
15471
|
+
if (Array.isArray(obj)) {
|
|
15472
|
+
return obj.map((value) => {
|
|
15473
|
+
if ((0, import_lodash_es16.isPlainObject)(value) || Array.isArray(value)) {
|
|
15474
|
+
return mapValuesDeep(value, fn);
|
|
15475
|
+
}
|
|
15476
|
+
return fn(value);
|
|
15477
|
+
});
|
|
15478
|
+
}
|
|
15479
|
+
if ((0, import_lodash_es16.isPlainObject)(obj)) {
|
|
15480
|
+
return Object.fromEntries(
|
|
15481
|
+
Object.entries(obj).map(([key, value]) => {
|
|
15482
|
+
if ((0, import_lodash_es16.isPlainObject)(value) || Array.isArray(value)) {
|
|
15483
|
+
return [key, mapValuesDeep(value, fn)];
|
|
15484
|
+
}
|
|
15485
|
+
return [key, fn(value)];
|
|
15486
|
+
})
|
|
15487
|
+
);
|
|
15488
|
+
}
|
|
15489
|
+
return fn(obj);
|
|
15490
|
+
}
|
|
15306
15491
|
var ExecutionRecorder = class _ExecutionRecorder {
|
|
15307
15492
|
#events = [];
|
|
15308
15493
|
recordingId;
|
|
@@ -15319,8 +15504,8 @@ var ExecutionRecorder = class _ExecutionRecorder {
|
|
|
15319
15504
|
off = void 0;
|
|
15320
15505
|
once = void 0;
|
|
15321
15506
|
recordSocket(channel) {
|
|
15322
|
-
return new Promise((resolve
|
|
15323
|
-
this.recordingId = (0,
|
|
15507
|
+
return new Promise((resolve) => {
|
|
15508
|
+
this.recordingId = (0, import_non_secure77.nanoid)();
|
|
15324
15509
|
const listener = (event) => {
|
|
15325
15510
|
const { message, data } = JSON.parse(event.data);
|
|
15326
15511
|
if (this.#includePartialOutputs === false && message === "partialOutput") {
|
|
@@ -15342,7 +15527,7 @@ var ExecutionRecorder = class _ExecutionRecorder {
|
|
|
15342
15527
|
});
|
|
15343
15528
|
}
|
|
15344
15529
|
record(processor) {
|
|
15345
|
-
this.recordingId = (0,
|
|
15530
|
+
this.recordingId = (0, import_non_secure77.nanoid)();
|
|
15346
15531
|
processor.onAny((event, data) => {
|
|
15347
15532
|
if (this.#includePartialOutputs === false && event === "partialOutput") {
|
|
15348
15533
|
return;
|
|
@@ -15376,22 +15561,51 @@ var ExecutionRecorder = class _ExecutionRecorder {
|
|
|
15376
15561
|
if (serializedRecording.version !== 1) {
|
|
15377
15562
|
throw new Error("Unsupported serialized events version");
|
|
15378
15563
|
}
|
|
15379
|
-
|
|
15380
|
-
|
|
15564
|
+
const recording = mapValuesDeep(serializedRecording.recording, (val) => {
|
|
15565
|
+
var _a;
|
|
15566
|
+
if (typeof val === "string" && val.startsWith("$ASSET:")) {
|
|
15567
|
+
const id = val.slice("$ASSET:".length);
|
|
15568
|
+
const asset = (_a = serializedRecording.assets) == null ? void 0 : _a[id];
|
|
15569
|
+
if (asset) {
|
|
15570
|
+
return new Uint8Array(base64ToUint8Array(asset));
|
|
15571
|
+
} else {
|
|
15572
|
+
return val;
|
|
15573
|
+
}
|
|
15574
|
+
}
|
|
15575
|
+
return val;
|
|
15576
|
+
});
|
|
15577
|
+
recorder.recordingId = recording.recordingId;
|
|
15578
|
+
recorder.#events = recording.events;
|
|
15381
15579
|
return recorder;
|
|
15382
15580
|
}
|
|
15383
15581
|
serialize() {
|
|
15384
15582
|
const serialized = {
|
|
15385
15583
|
version: 1,
|
|
15386
|
-
recording: this.getRecording()
|
|
15387
|
-
|
|
15584
|
+
recording: this.getRecording(),
|
|
15585
|
+
assets: {}
|
|
15586
|
+
};
|
|
15587
|
+
serialized.recording = mapValuesDeep(serialized.recording, (val) => {
|
|
15588
|
+
if (val instanceof Uint8Array) {
|
|
15589
|
+
const asString = uint8ArrayToBase64Sync(val);
|
|
15590
|
+
const existingAsset = Object.entries(serialized.assets).find(([, asset]) => asset === asString);
|
|
15591
|
+
if (!existingAsset) {
|
|
15592
|
+
const id = (0, import_non_secure77.nanoid)();
|
|
15593
|
+
serialized.assets[id] = asString;
|
|
15594
|
+
return `$ASSET:${id}`;
|
|
15595
|
+
} else {
|
|
15596
|
+
const [id] = existingAsset;
|
|
15597
|
+
return `$ASSET:${id}`;
|
|
15598
|
+
}
|
|
15599
|
+
}
|
|
15600
|
+
return val;
|
|
15601
|
+
});
|
|
15388
15602
|
return JSON.stringify(serialized);
|
|
15389
15603
|
}
|
|
15390
15604
|
};
|
|
15391
15605
|
|
|
15392
15606
|
// src/plugins/aidon/nodes/ChatAidonNode.ts
|
|
15393
|
-
var
|
|
15394
|
-
var
|
|
15607
|
+
var import_lodash_es17 = require("lodash");
|
|
15608
|
+
var import_ts_dedent70 = require("ts-dedent");
|
|
15395
15609
|
var registry = globalRivetNodeRegistry;
|
|
15396
15610
|
var ChatAidonNodeImpl = class extends ChatNodeImpl {
|
|
15397
15611
|
create() {
|
|
@@ -15478,7 +15692,7 @@ var ChatAidonNodeImpl = class extends ChatNodeImpl {
|
|
|
15478
15692
|
};
|
|
15479
15693
|
}
|
|
15480
15694
|
const fullUrl = schemaDetail.url + path;
|
|
15481
|
-
const bodyContent = parsedArgs.requestBody
|
|
15695
|
+
const bodyContent = parsedArgs.requestBody ?? parsedArgs;
|
|
15482
15696
|
const requestInit = {
|
|
15483
15697
|
method: "POST",
|
|
15484
15698
|
headers,
|
|
@@ -15528,7 +15742,7 @@ var ChatAidonNodeImpl = class extends ChatNodeImpl {
|
|
|
15528
15742
|
message: JSON.stringify(data)
|
|
15529
15743
|
});
|
|
15530
15744
|
}
|
|
15531
|
-
inputs = (0,
|
|
15745
|
+
inputs = (0, import_lodash_es17.omit)(inputs, ["functions", "prompt"]);
|
|
15532
15746
|
inputs["prompt"] = messages;
|
|
15533
15747
|
outputs = await super.process(inputs, context);
|
|
15534
15748
|
}
|
|
@@ -15572,7 +15786,7 @@ var createPluginNodeImpl = (chatNode2) => {
|
|
|
15572
15786
|
},
|
|
15573
15787
|
getUIData() {
|
|
15574
15788
|
return {
|
|
15575
|
-
infoBoxBody:
|
|
15789
|
+
infoBoxBody: import_ts_dedent70.dedent`
|
|
15576
15790
|
Makes a call to an Aidon chat model. The settings contains many options for tweaking the model's behavior.
|
|
15577
15791
|
`,
|
|
15578
15792
|
infoBoxTitle: "Chat (Aidon) Node",
|
|
@@ -15815,13 +16029,11 @@ async function* streamChatCompletions2({
|
|
|
15815
16029
|
signal: signal ?? defaultSignal
|
|
15816
16030
|
});
|
|
15817
16031
|
let hadChunks = false;
|
|
15818
|
-
let nextDataType;
|
|
15819
16032
|
for await (const chunk of response.events()) {
|
|
15820
16033
|
hadChunks = true;
|
|
15821
16034
|
if (chunk === "[DONE]") {
|
|
15822
16035
|
return;
|
|
15823
16036
|
} else if (/\[\w+\]/.test(chunk)) {
|
|
15824
|
-
nextDataType = chunk.slice(1, -1);
|
|
15825
16037
|
continue;
|
|
15826
16038
|
}
|
|
15827
16039
|
let data;
|
|
@@ -15862,13 +16074,11 @@ async function* streamMessageApi({
|
|
|
15862
16074
|
signal: signal ?? defaultSignal
|
|
15863
16075
|
});
|
|
15864
16076
|
let hadChunks = false;
|
|
15865
|
-
let nextDataType;
|
|
15866
16077
|
for await (const chunk of response.events()) {
|
|
15867
16078
|
hadChunks = true;
|
|
15868
16079
|
if (chunk === "[message_stop]") {
|
|
15869
16080
|
return;
|
|
15870
16081
|
} else if (/^\[\w+\]$/.test(chunk)) {
|
|
15871
|
-
nextDataType = chunk.slice(1, -1);
|
|
15872
16082
|
continue;
|
|
15873
16083
|
}
|
|
15874
16084
|
let data;
|
|
@@ -15894,10 +16104,10 @@ var AnthropicError = class extends Error {
|
|
|
15894
16104
|
};
|
|
15895
16105
|
|
|
15896
16106
|
// src/plugins/anthropic/nodes/ChatAnthropicNode.ts
|
|
15897
|
-
var
|
|
15898
|
-
var
|
|
16107
|
+
var import_non_secure78 = require("nanoid/non-secure");
|
|
16108
|
+
var import_ts_dedent71 = require("ts-dedent");
|
|
15899
16109
|
var import_p_retry2 = __toESM(require("p-retry-4"), 1);
|
|
15900
|
-
var
|
|
16110
|
+
var import_ts_pattern10 = require("ts-pattern");
|
|
15901
16111
|
|
|
15902
16112
|
// src/utils/assertNever.ts
|
|
15903
16113
|
function assertNever(x) {
|
|
@@ -15911,7 +16121,7 @@ var ChatAnthropicNodeImpl = {
|
|
|
15911
16121
|
const chartNode = {
|
|
15912
16122
|
type: "chatAnthropic",
|
|
15913
16123
|
title: "Chat (Anthropic)",
|
|
15914
|
-
id: (0,
|
|
16124
|
+
id: (0, import_non_secure78.nanoid)(),
|
|
15915
16125
|
visualData: {
|
|
15916
16126
|
x: 0,
|
|
15917
16127
|
y: 0,
|
|
@@ -16047,7 +16257,7 @@ var ChatAnthropicNodeImpl = {
|
|
|
16047
16257
|
getBody(data) {
|
|
16048
16258
|
var _a;
|
|
16049
16259
|
const modelName = data.overrideModel ? data.overrideModel : ((_a = anthropicModels[data.model]) == null ? void 0 : _a.displayName) ?? "Unknown Model";
|
|
16050
|
-
return
|
|
16260
|
+
return import_ts_dedent71.dedent`
|
|
16051
16261
|
${modelName}
|
|
16052
16262
|
${data.useTopP ? `Top P: ${data.useTopPInput ? "(Using Input)" : data.top_p}` : `Temperature: ${data.useTemperatureInput ? "(Using Input)" : data.temperature}`}
|
|
16053
16263
|
Max Tokens: ${data.maxTokens}
|
|
@@ -16164,7 +16374,7 @@ var ChatAnthropicNodeImpl = {
|
|
|
16164
16374
|
},
|
|
16165
16375
|
getUIData() {
|
|
16166
16376
|
return {
|
|
16167
|
-
infoBoxBody:
|
|
16377
|
+
infoBoxBody: import_ts_dedent71.dedent`
|
|
16168
16378
|
Makes a call to an Anthropic chat model. The settings contains many options for tweaking the model's behavior.
|
|
16169
16379
|
`,
|
|
16170
16380
|
infoBoxTitle: "Chat (Anthropic) Node",
|
|
@@ -16199,8 +16409,6 @@ Assistant: ${content}`;
|
|
|
16199
16409
|
}, "");
|
|
16200
16410
|
prompt += "\n\nAssistant:";
|
|
16201
16411
|
const system = data.model.startsWith("claude-3") ? getSystemPrompt(inputs) : void 0;
|
|
16202
|
-
const systemInput = inputs["system"];
|
|
16203
|
-
const includesCacheBreakpoint = rivetChatMessages.some((m) => m.isCacheBreakpoint) || (systemInput == null ? void 0 : systemInput.type) === "chat-message" && systemInput.value.isCacheBreakpoint;
|
|
16204
16412
|
let { maxTokens } = data;
|
|
16205
16413
|
const tokenizerInfo = {
|
|
16206
16414
|
node: context.node,
|
|
@@ -16497,7 +16705,7 @@ function getChatMessages(inputs) {
|
|
|
16497
16705
|
if (!prompt) {
|
|
16498
16706
|
throw new Error("Prompt is required");
|
|
16499
16707
|
}
|
|
16500
|
-
const chatMessages = (0,
|
|
16708
|
+
const chatMessages = (0, import_ts_pattern10.match)(prompt).with({ type: "chat-message" }, (p) => [p.value]).with({ type: "chat-message[]" }, (p) => p.value).with({ type: "string" }, (p) => [{ type: "user", message: p.value }]).with({ type: "string[]" }, (p) => p.value.map((v) => ({ type: "user", message: v }))).otherwise((p) => {
|
|
16501
16709
|
if (isArrayDataValue(p)) {
|
|
16502
16710
|
const stringValues = p.value.map(
|
|
16503
16711
|
(v) => coerceType(
|
|
@@ -16661,10 +16869,10 @@ var anthropicPlugin = {
|
|
|
16661
16869
|
var anthropic_default = anthropicPlugin;
|
|
16662
16870
|
|
|
16663
16871
|
// src/plugins/autoevals/AutoEvalsNode.ts
|
|
16664
|
-
var
|
|
16665
|
-
var
|
|
16872
|
+
var import_non_secure79 = require("nanoid/non-secure");
|
|
16873
|
+
var import_ts_dedent72 = require("ts-dedent");
|
|
16666
16874
|
var import_autoevals = require("autoevals");
|
|
16667
|
-
var
|
|
16875
|
+
var import_ts_pattern11 = require("ts-pattern");
|
|
16668
16876
|
var options = [
|
|
16669
16877
|
{ label: "Factuality", value: "factuality" },
|
|
16670
16878
|
{ label: "Humor", value: "humor" },
|
|
@@ -16681,7 +16889,7 @@ var AutoEvalsNodeImpl = {
|
|
|
16681
16889
|
const chartNode = {
|
|
16682
16890
|
type: "autoevals",
|
|
16683
16891
|
title: "Autoevals",
|
|
16684
|
-
id: (0,
|
|
16892
|
+
id: (0, import_non_secure79.nanoid)(),
|
|
16685
16893
|
visualData: {
|
|
16686
16894
|
x: 0,
|
|
16687
16895
|
y: 0,
|
|
@@ -16706,7 +16914,7 @@ var AutoEvalsNodeImpl = {
|
|
|
16706
16914
|
title: "Expected"
|
|
16707
16915
|
}
|
|
16708
16916
|
];
|
|
16709
|
-
const forEvaluator = (0,
|
|
16917
|
+
const forEvaluator = (0, import_ts_pattern11.match)(data.evaluatorName).with("factuality", () => [
|
|
16710
16918
|
{
|
|
16711
16919
|
id: "input",
|
|
16712
16920
|
dataType: "string",
|
|
@@ -16796,7 +17004,7 @@ var AutoEvalsNodeImpl = {
|
|
|
16796
17004
|
},
|
|
16797
17005
|
getUIData() {
|
|
16798
17006
|
return {
|
|
16799
|
-
infoBoxBody:
|
|
17007
|
+
infoBoxBody: import_ts_dedent72.dedent`
|
|
16800
17008
|
Evaluates the validity of a response using the autoevals library.
|
|
16801
17009
|
`,
|
|
16802
17010
|
infoBoxTitle: "Autoevals Node",
|
|
@@ -16815,7 +17023,7 @@ var AutoEvalsNodeImpl = {
|
|
|
16815
17023
|
openAiApiKey: context.settings.openAiKey,
|
|
16816
17024
|
openAiOrganizationId: context.settings.openAiOrganization
|
|
16817
17025
|
};
|
|
16818
|
-
const result = await (0,
|
|
17026
|
+
const result = await (0, import_ts_pattern11.match)(evaluatorName).with("factuality", () => {
|
|
16819
17027
|
const input = coerceType(inputs["input"], "string");
|
|
16820
17028
|
return (0, import_autoevals.Factuality)({ ...baseArgs, input });
|
|
16821
17029
|
}).with("battle", () => {
|
|
@@ -16876,8 +17084,8 @@ var autoevalsPlugin = {
|
|
|
16876
17084
|
var autoevals_default = autoevalsPlugin;
|
|
16877
17085
|
|
|
16878
17086
|
// src/plugins/assemblyAi/LemurQaNode.ts
|
|
16879
|
-
var
|
|
16880
|
-
var
|
|
17087
|
+
var import_non_secure80 = require("nanoid/non-secure");
|
|
17088
|
+
var import_ts_dedent73 = require("ts-dedent");
|
|
16881
17089
|
|
|
16882
17090
|
// src/plugins/assemblyAi/lemurHelpers.ts
|
|
16883
17091
|
var import_assemblyai = require("assemblyai");
|
|
@@ -16997,7 +17205,7 @@ var LemurQaNodeImpl = {
|
|
|
16997
17205
|
const chartNode = {
|
|
16998
17206
|
type: "assemblyAiLemurQa",
|
|
16999
17207
|
title: "LeMUR Question & Answers",
|
|
17000
|
-
id: (0,
|
|
17208
|
+
id: (0, import_non_secure80.nanoid)(),
|
|
17001
17209
|
visualData: {
|
|
17002
17210
|
x: 0,
|
|
17003
17211
|
y: 0,
|
|
@@ -17063,7 +17271,7 @@ var LemurQaNodeImpl = {
|
|
|
17063
17271
|
},
|
|
17064
17272
|
getUIData() {
|
|
17065
17273
|
return {
|
|
17066
|
-
infoBoxBody:
|
|
17274
|
+
infoBoxBody: import_ts_dedent73.dedent`Use AssemblyAI LeMUR to ask questions about transcripts`,
|
|
17067
17275
|
infoBoxTitle: "Use AssemblyAI LeMUR Question & Answer",
|
|
17068
17276
|
contextMenuTitle: "LeMUR Q&A",
|
|
17069
17277
|
group: ["AI", "AssemblyAI"]
|
|
@@ -17135,14 +17343,14 @@ function applyQuestionEditors(data, question) {
|
|
|
17135
17343
|
var lemurQaNode = pluginNodeDefinition(LemurQaNodeImpl, "LeMUR Q&A");
|
|
17136
17344
|
|
|
17137
17345
|
// src/plugins/assemblyAi/TranscribeAudioNode.ts
|
|
17138
|
-
var
|
|
17139
|
-
var
|
|
17346
|
+
var import_non_secure81 = require("nanoid/non-secure");
|
|
17347
|
+
var import_ts_dedent74 = require("ts-dedent");
|
|
17140
17348
|
var TranscribeAudioNodeImpl = {
|
|
17141
17349
|
create() {
|
|
17142
17350
|
const chartNode = {
|
|
17143
17351
|
type: "assemblyAiTranscribeAudio",
|
|
17144
17352
|
title: "Transcribe Audio",
|
|
17145
|
-
id: (0,
|
|
17353
|
+
id: (0, import_non_secure81.nanoid)(),
|
|
17146
17354
|
visualData: {
|
|
17147
17355
|
x: 0,
|
|
17148
17356
|
y: 0,
|
|
@@ -17197,7 +17405,7 @@ var TranscribeAudioNodeImpl = {
|
|
|
17197
17405
|
},
|
|
17198
17406
|
getUIData() {
|
|
17199
17407
|
return {
|
|
17200
|
-
infoBoxBody:
|
|
17408
|
+
infoBoxBody: import_ts_dedent74.dedent`Use AssemblyAI to transcribe audio`,
|
|
17201
17409
|
infoBoxTitle: "Transcribe Audio Node",
|
|
17202
17410
|
contextMenuTitle: "Transcribe Audio",
|
|
17203
17411
|
group: ["AI", "AssemblyAI"]
|
|
@@ -17256,15 +17464,15 @@ function getAdditionalParameters(data) {
|
|
|
17256
17464
|
}
|
|
17257
17465
|
|
|
17258
17466
|
// src/plugins/assemblyAi/LemurSummaryNode.ts
|
|
17259
|
-
var
|
|
17260
|
-
var
|
|
17467
|
+
var import_non_secure82 = require("nanoid/non-secure");
|
|
17468
|
+
var import_ts_dedent75 = require("ts-dedent");
|
|
17261
17469
|
var import_assemblyai3 = require("assemblyai");
|
|
17262
17470
|
var LemurSummaryNodeImpl = {
|
|
17263
17471
|
create() {
|
|
17264
17472
|
const chartNode = {
|
|
17265
17473
|
type: "assemblyAiLemurSummary",
|
|
17266
17474
|
title: "LeMUR Summary",
|
|
17267
|
-
id: (0,
|
|
17475
|
+
id: (0, import_non_secure82.nanoid)(),
|
|
17268
17476
|
visualData: {
|
|
17269
17477
|
x: 0,
|
|
17270
17478
|
y: 0,
|
|
@@ -17310,7 +17518,7 @@ var LemurSummaryNodeImpl = {
|
|
|
17310
17518
|
},
|
|
17311
17519
|
getUIData() {
|
|
17312
17520
|
return {
|
|
17313
|
-
infoBoxBody:
|
|
17521
|
+
infoBoxBody: import_ts_dedent75.dedent`Use AssemblyAI LeMUR Summary to summarize transcripts`,
|
|
17314
17522
|
infoBoxTitle: "Use AssemblyAI LeMUR Summary",
|
|
17315
17523
|
contextMenuTitle: "LeMUR Summary",
|
|
17316
17524
|
group: ["AI", "AssemblyAI"]
|
|
@@ -17334,15 +17542,15 @@ var LemurSummaryNodeImpl = {
|
|
|
17334
17542
|
var lemurSummaryNode = pluginNodeDefinition(LemurSummaryNodeImpl, "LeMUR Summary");
|
|
17335
17543
|
|
|
17336
17544
|
// src/plugins/assemblyAi/LemurTaskNode.ts
|
|
17337
|
-
var
|
|
17338
|
-
var
|
|
17545
|
+
var import_non_secure83 = require("nanoid/non-secure");
|
|
17546
|
+
var import_ts_dedent76 = require("ts-dedent");
|
|
17339
17547
|
var import_assemblyai4 = require("assemblyai");
|
|
17340
17548
|
var LemurTaskNodeImpl = {
|
|
17341
17549
|
create() {
|
|
17342
17550
|
const chartNode = {
|
|
17343
17551
|
type: "assemblyAiLemurTask",
|
|
17344
17552
|
title: "LeMUR Task",
|
|
17345
|
-
id: (0,
|
|
17553
|
+
id: (0, import_non_secure83.nanoid)(),
|
|
17346
17554
|
visualData: {
|
|
17347
17555
|
x: 0,
|
|
17348
17556
|
y: 0,
|
|
@@ -17388,7 +17596,7 @@ var LemurTaskNodeImpl = {
|
|
|
17388
17596
|
},
|
|
17389
17597
|
getUIData() {
|
|
17390
17598
|
return {
|
|
17391
|
-
infoBoxBody:
|
|
17599
|
+
infoBoxBody: import_ts_dedent76.dedent`Use AssemblyAI LeMUR Custom Task to ask anything.`,
|
|
17392
17600
|
infoBoxTitle: "Use AssemblyAI LeMUR Custom Task",
|
|
17393
17601
|
contextMenuTitle: "LeMUR Custom Task",
|
|
17394
17602
|
group: ["AI", "AssemblyAI"]
|
|
@@ -17414,14 +17622,14 @@ var LemurTaskNodeImpl = {
|
|
|
17414
17622
|
var lemurTaskNode = pluginNodeDefinition(LemurTaskNodeImpl, "LeMUR Task");
|
|
17415
17623
|
|
|
17416
17624
|
// src/plugins/assemblyAi/LemurActionItemsNode.ts
|
|
17417
|
-
var
|
|
17418
|
-
var
|
|
17625
|
+
var import_non_secure84 = require("nanoid/non-secure");
|
|
17626
|
+
var import_ts_dedent77 = require("ts-dedent");
|
|
17419
17627
|
var LemurActionItemsNodeImpl = {
|
|
17420
17628
|
create() {
|
|
17421
17629
|
const chartNode = {
|
|
17422
17630
|
type: "assemblyAiLemurActionItems",
|
|
17423
17631
|
title: "LeMUR Action Items",
|
|
17424
|
-
id: (0,
|
|
17632
|
+
id: (0, import_non_secure84.nanoid)(),
|
|
17425
17633
|
visualData: {
|
|
17426
17634
|
x: 0,
|
|
17427
17635
|
y: 0,
|
|
@@ -17467,7 +17675,7 @@ var LemurActionItemsNodeImpl = {
|
|
|
17467
17675
|
},
|
|
17468
17676
|
getUIData() {
|
|
17469
17677
|
return {
|
|
17470
|
-
infoBoxBody:
|
|
17678
|
+
infoBoxBody: import_ts_dedent77.dedent`Use AssemblyAI LeMUR Action Items to extract action items`,
|
|
17471
17679
|
infoBoxTitle: "Use AssemblyAI LeMUR Action Items",
|
|
17472
17680
|
contextMenuTitle: "LeMUR Action Items",
|
|
17473
17681
|
group: ["AI", "AssemblyAI"]
|
|
@@ -17519,12 +17727,12 @@ var assemblyAiPlugin = {
|
|
|
17519
17727
|
var assemblyAi_default = assemblyAiPlugin;
|
|
17520
17728
|
|
|
17521
17729
|
// src/plugins/huggingface/nodes/ChatHuggingFace.ts
|
|
17522
|
-
var
|
|
17730
|
+
var import_non_secure85 = require("nanoid/non-secure");
|
|
17523
17731
|
var import_inference = require("@huggingface/inference");
|
|
17524
17732
|
var ChatHuggingFaceNodeImpl = {
|
|
17525
17733
|
create() {
|
|
17526
17734
|
return {
|
|
17527
|
-
id: (0,
|
|
17735
|
+
id: (0, import_non_secure85.nanoid)(),
|
|
17528
17736
|
type: "chatHuggingFace",
|
|
17529
17737
|
data: {
|
|
17530
17738
|
model: "",
|
|
@@ -17754,13 +17962,13 @@ var ChatHuggingFaceNodeImpl = {
|
|
|
17754
17962
|
var chatHuggingFaceNode = pluginNodeDefinition(ChatHuggingFaceNodeImpl, "Chat (Hugging Face)");
|
|
17755
17963
|
|
|
17756
17964
|
// src/plugins/huggingface/nodes/TextToImageHuggingFace.ts
|
|
17757
|
-
var
|
|
17965
|
+
var import_non_secure86 = require("nanoid/non-secure");
|
|
17758
17966
|
var import_inference2 = require("@huggingface/inference");
|
|
17759
|
-
var
|
|
17967
|
+
var import_ts_dedent78 = require("ts-dedent");
|
|
17760
17968
|
var TextToImageHuggingFaceNodeImpl = {
|
|
17761
17969
|
create() {
|
|
17762
17970
|
return {
|
|
17763
|
-
id: (0,
|
|
17971
|
+
id: (0, import_non_secure86.nanoid)(),
|
|
17764
17972
|
type: "textToImageHuggingFace",
|
|
17765
17973
|
data: {
|
|
17766
17974
|
model: "",
|
|
@@ -17901,7 +18109,7 @@ var TextToImageHuggingFaceNodeImpl = {
|
|
|
17901
18109
|
];
|
|
17902
18110
|
},
|
|
17903
18111
|
getBody(data) {
|
|
17904
|
-
return
|
|
18112
|
+
return import_ts_dedent78.dedent`
|
|
17905
18113
|
Model: ${data.useModelInput ? "(Using Input)" : data.model}
|
|
17906
18114
|
`;
|
|
17907
18115
|
},
|
|
@@ -18077,7 +18285,7 @@ var pinecone_default = pineconePlugin;
|
|
|
18077
18285
|
|
|
18078
18286
|
// src/plugins/gentrace/plugin.ts
|
|
18079
18287
|
var import_core = require("@gentrace/core");
|
|
18080
|
-
var
|
|
18288
|
+
var import_lodash_es18 = require("lodash");
|
|
18081
18289
|
var apiKeyConfigSpec = {
|
|
18082
18290
|
type: "secret",
|
|
18083
18291
|
label: "Gentrace API Key",
|
|
@@ -20636,7 +20844,7 @@ ${additional.join("\n")}`;
|
|
|
20636
20844
|
var runThreadNode = pluginNodeDefinition(RunThreadNodeImpl, "Run Thread");
|
|
20637
20845
|
|
|
20638
20846
|
// src/plugins/openai/nodes/ThreadMessageNode.ts
|
|
20639
|
-
var
|
|
20847
|
+
var import_lodash_es19 = require("lodash");
|
|
20640
20848
|
var ThreadMessageNodeImpl = {
|
|
20641
20849
|
create() {
|
|
20642
20850
|
return {
|
|
@@ -20761,7 +20969,7 @@ var ThreadMessageNodeImpl = {
|
|
|
20761
20969
|
if (data.useMetadataInput && inputData["metadata"]) {
|
|
20762
20970
|
metadata = coerceTypeOptional(inputData["metadata"], "object");
|
|
20763
20971
|
}
|
|
20764
|
-
const inputMap = (0,
|
|
20972
|
+
const inputMap = (0, import_lodash_es19.mapValues)(inputData, (input) => coerceType(input, "string"));
|
|
20765
20973
|
const interpolated = interpolate(text, inputMap);
|
|
20766
20974
|
return {
|
|
20767
20975
|
["message"]: {
|
|
@@ -20810,7 +21018,6 @@ var openAIPlugin = {
|
|
|
20810
21018
|
|
|
20811
21019
|
// src/plugins/google/google.ts
|
|
20812
21020
|
var import_generative_ai = require("@google/generative-ai");
|
|
20813
|
-
var import_ts_pattern13 = require("ts-pattern");
|
|
20814
21021
|
var googleModelsDeprecated = {
|
|
20815
21022
|
"gemini-pro": {
|
|
20816
21023
|
maxTokens: 32760,
|
|
@@ -20848,6 +21055,16 @@ var generativeAiGoogleModels = {
|
|
|
20848
21055
|
},
|
|
20849
21056
|
displayName: "Gemini 2.0 Pro"
|
|
20850
21057
|
},
|
|
21058
|
+
"gemini-2.5-pro-exp-03-25": {
|
|
21059
|
+
maxTokens: 1e6,
|
|
21060
|
+
cost: {
|
|
21061
|
+
prompt: 0,
|
|
21062
|
+
// Unknown
|
|
21063
|
+
completion: 0
|
|
21064
|
+
// Unknown
|
|
21065
|
+
},
|
|
21066
|
+
displayName: "Gemini 2.5 Pro Experimental"
|
|
21067
|
+
},
|
|
20851
21068
|
"gemini-2.0-flash-lite-preview-02-05": {
|
|
20852
21069
|
maxTokens: 1048576,
|
|
20853
21070
|
cost: {
|
|
@@ -20927,7 +21144,7 @@ async function* streamGenerativeAi({
|
|
|
20927
21144
|
signal,
|
|
20928
21145
|
tools
|
|
20929
21146
|
}) {
|
|
20930
|
-
var _a, _b, _c, _d;
|
|
21147
|
+
var _a, _b, _c, _d, _e;
|
|
20931
21148
|
const { GoogleGenerativeAI } = await import("@google/generative-ai");
|
|
20932
21149
|
const genAi = new GoogleGenerativeAI(apiKey);
|
|
20933
21150
|
const genaiModel = genAi.getGenerativeModel({
|
|
@@ -20959,8 +21176,8 @@ async function* streamGenerativeAi({
|
|
|
20959
21176
|
outChunk.function_calls = functionCalls;
|
|
20960
21177
|
}
|
|
20961
21178
|
if (chunk.candidates) {
|
|
20962
|
-
outChunk.completion = (_c = (_b = (_a = chunk.candidates[0]) == null ? void 0 : _a.content) == null ? void 0 : _b.parts[0]) == null ? void 0 :
|
|
20963
|
-
outChunk.finish_reason = (
|
|
21179
|
+
outChunk.completion = (_d = (_c = (_b = (_a = chunk.candidates[0]) == null ? void 0 : _a.content) == null ? void 0 : _b.parts) == null ? void 0 : _c[0]) == null ? void 0 : _d.text;
|
|
21180
|
+
outChunk.finish_reason = (_e = chunk.candidates[0]) == null ? void 0 : _e.finishReason;
|
|
20964
21181
|
}
|
|
20965
21182
|
if (outChunk.completion || outChunk.function_calls) {
|
|
20966
21183
|
yield outChunk;
|
|
@@ -20980,7 +21197,6 @@ async function* streamChatCompletions3({
|
|
|
20980
21197
|
prompt
|
|
20981
21198
|
}) {
|
|
20982
21199
|
var _a, _b, _c, _d, _e;
|
|
20983
|
-
const defaultSignal = new AbortController().signal;
|
|
20984
21200
|
const { VertexAI } = await import("@google-cloud/vertexai");
|
|
20985
21201
|
process.env.GOOGLE_APPLICATION_CREDENTIALS = applicationCredentials;
|
|
20986
21202
|
const vertexAi = new VertexAI({ project, location });
|
|
@@ -21016,19 +21232,19 @@ async function* streamChatCompletions3({
|
|
|
21016
21232
|
}
|
|
21017
21233
|
|
|
21018
21234
|
// src/plugins/google/nodes/ChatGoogleNode.ts
|
|
21019
|
-
var
|
|
21020
|
-
var
|
|
21235
|
+
var import_non_secure87 = require("nanoid/non-secure");
|
|
21236
|
+
var import_ts_dedent79 = require("ts-dedent");
|
|
21021
21237
|
var import_p_retry3 = __toESM(require("p-retry-4"), 1);
|
|
21022
|
-
var
|
|
21238
|
+
var import_ts_pattern12 = require("ts-pattern");
|
|
21023
21239
|
var import_generative_ai2 = require("@google/generative-ai");
|
|
21024
|
-
var
|
|
21240
|
+
var import_lodash_es20 = require("lodash");
|
|
21025
21241
|
var cache3 = /* @__PURE__ */ new Map();
|
|
21026
21242
|
var ChatGoogleNodeImpl = {
|
|
21027
21243
|
create() {
|
|
21028
21244
|
const chartNode = {
|
|
21029
21245
|
type: "chatGoogle",
|
|
21030
21246
|
title: "Chat (Google)",
|
|
21031
|
-
id: (0,
|
|
21247
|
+
id: (0, import_non_secure87.nanoid)(),
|
|
21032
21248
|
visualData: {
|
|
21033
21249
|
x: 0,
|
|
21034
21250
|
y: 0,
|
|
@@ -21145,7 +21361,7 @@ var ChatGoogleNodeImpl = {
|
|
|
21145
21361
|
},
|
|
21146
21362
|
getBody(data) {
|
|
21147
21363
|
var _a;
|
|
21148
|
-
return
|
|
21364
|
+
return import_ts_dedent79.dedent`
|
|
21149
21365
|
${((_a = generativeAiGoogleModels[data.model]) == null ? void 0 : _a.displayName) ?? `Google (${data.model})`}
|
|
21150
21366
|
${data.useTopP ? `Top P: ${data.useTopPInput ? "(Using Input)" : data.top_p}` : `Temperature: ${data.useTemperatureInput ? "(Using Input)" : data.temperature}`}
|
|
21151
21367
|
Max Tokens: ${data.maxTokens}
|
|
@@ -21212,7 +21428,7 @@ var ChatGoogleNodeImpl = {
|
|
|
21212
21428
|
},
|
|
21213
21429
|
getUIData() {
|
|
21214
21430
|
return {
|
|
21215
|
-
infoBoxBody:
|
|
21431
|
+
infoBoxBody: import_ts_dedent79.dedent`
|
|
21216
21432
|
Makes a call to an Google chat model. The settings contains many options for tweaking the model's behavior.
|
|
21217
21433
|
`,
|
|
21218
21434
|
infoBoxTitle: "Chat (Google) Node",
|
|
@@ -21263,7 +21479,7 @@ var ChatGoogleNodeImpl = {
|
|
|
21263
21479
|
}
|
|
21264
21480
|
}
|
|
21265
21481
|
return {
|
|
21266
|
-
role: message.type,
|
|
21482
|
+
role: (0, import_ts_pattern12.match)(message.type).with("user", () => "user").with("assistant", () => "model").exhaustive(),
|
|
21267
21483
|
parts
|
|
21268
21484
|
};
|
|
21269
21485
|
}
|
|
@@ -21327,7 +21543,7 @@ var ChatGoogleNodeImpl = {
|
|
|
21327
21543
|
description: tool.description,
|
|
21328
21544
|
parameters: Object.keys(tool.parameters.properties).length === 0 ? void 0 : {
|
|
21329
21545
|
type: import_generative_ai2.SchemaType.OBJECT,
|
|
21330
|
-
properties: (0,
|
|
21546
|
+
properties: (0, import_lodash_es20.mapValues)(tool.parameters.properties, (p) => ({
|
|
21331
21547
|
// gemini doesn't support union property types, it uses openapi style not jsonschema, what a mess
|
|
21332
21548
|
type: Array.isArray(p.type) ? p.type.filter((t) => t !== "null")[0] : p.type,
|
|
21333
21549
|
description: p.description
|
|
@@ -21488,8 +21704,11 @@ var ChatGoogleNodeImpl = {
|
|
|
21488
21704
|
}
|
|
21489
21705
|
);
|
|
21490
21706
|
} catch (error) {
|
|
21491
|
-
|
|
21492
|
-
|
|
21707
|
+
const raisedError = getError(error);
|
|
21708
|
+
context.trace(raisedError.stack ?? "Missing stack");
|
|
21709
|
+
const err = new Error(`Error processing ChatGoogleNode: ${raisedError.message}`);
|
|
21710
|
+
err.cause = raisedError;
|
|
21711
|
+
throw err;
|
|
21493
21712
|
}
|
|
21494
21713
|
}
|
|
21495
21714
|
};
|
|
@@ -21499,7 +21718,7 @@ function getChatGoogleNodeMessages(inputs) {
|
|
|
21499
21718
|
if (!prompt) {
|
|
21500
21719
|
throw new Error("Prompt is required");
|
|
21501
21720
|
}
|
|
21502
|
-
const messages = (0,
|
|
21721
|
+
const messages = (0, import_ts_pattern12.match)(prompt).with({ type: "chat-message" }, (p) => [p.value]).with({ type: "chat-message[]" }, (p) => p.value).with({ type: "string" }, (p) => [{ type: "user", message: p.value }]).with({ type: "string[]" }, (p) => p.value.map((v) => ({ type: "user", message: v }))).otherwise((p) => {
|
|
21503
21722
|
if (isArrayDataValue(p)) {
|
|
21504
21723
|
const stringValues = p.value.map(
|
|
21505
21724
|
(v) => coerceType(
|
|
@@ -21575,7 +21794,7 @@ var plugins = {
|
|
|
21575
21794
|
};
|
|
21576
21795
|
|
|
21577
21796
|
// src/integrations/DatasetProvider.ts
|
|
21578
|
-
var
|
|
21797
|
+
var import_lodash_es21 = require("lodash");
|
|
21579
21798
|
var InMemoryDatasetProvider = class {
|
|
21580
21799
|
#datasets;
|
|
21581
21800
|
constructor(datasets) {
|
|
@@ -21585,7 +21804,7 @@ var InMemoryDatasetProvider = class {
|
|
|
21585
21804
|
const dataset = this.#datasets.find((d) => d.meta.id === id);
|
|
21586
21805
|
return dataset == null ? void 0 : dataset.meta;
|
|
21587
21806
|
}
|
|
21588
|
-
async getDatasetsForProject(
|
|
21807
|
+
async getDatasetsForProject() {
|
|
21589
21808
|
return this.#datasets.map((d) => d.meta);
|
|
21590
21809
|
}
|
|
21591
21810
|
async getDatasetData(id) {
|
|
@@ -21655,7 +21874,7 @@ var InMemoryDatasetProvider = class {
|
|
|
21655
21874
|
return sorted.slice(0, k).map((r) => ({ ...r.row, distance: r.similarity }));
|
|
21656
21875
|
}
|
|
21657
21876
|
async exportDatasetsForProject(_projectId) {
|
|
21658
|
-
return (0,
|
|
21877
|
+
return (0, import_lodash_es21.cloneDeep)(this.#datasets);
|
|
21659
21878
|
}
|
|
21660
21879
|
};
|
|
21661
21880
|
var dotProductSimilarity = (a, b) => {
|
|
@@ -21666,6 +21885,7 @@ var dotProductSimilarity = (a, b) => {
|
|
|
21666
21885
|
async function* getProcessorEvents(processor, spec) {
|
|
21667
21886
|
var _a, _b, _c, _d, _e, _f;
|
|
21668
21887
|
const previousIndexes = /* @__PURE__ */ new Map();
|
|
21888
|
+
const usages = [];
|
|
21669
21889
|
for await (const event of processor.events()) {
|
|
21670
21890
|
if (event.type === "partialOutput") {
|
|
21671
21891
|
if (spec.partialOutputs === true || ((_a = spec.partialOutputs) == null ? void 0 : _a.includes(event.node.id)) || ((_b = spec.partialOutputs) == null ? void 0 : _b.includes(event.node.title))) {
|
|
@@ -21681,9 +21901,26 @@ async function* getProcessorEvents(processor, spec) {
|
|
|
21681
21901
|
}
|
|
21682
21902
|
} else if (event.type === "done") {
|
|
21683
21903
|
if (spec.done) {
|
|
21904
|
+
const results = event.results;
|
|
21905
|
+
if (!spec.exposeCost) {
|
|
21906
|
+
delete results.cost;
|
|
21907
|
+
}
|
|
21908
|
+
if (!spec.exposeUsage) {
|
|
21909
|
+
delete results.requestTokens;
|
|
21910
|
+
delete results.responseTokens;
|
|
21911
|
+
} else if (usages.length) {
|
|
21912
|
+
const usageOutput = {
|
|
21913
|
+
type: "any[]",
|
|
21914
|
+
value: usages
|
|
21915
|
+
};
|
|
21916
|
+
results["usages"] = usageOutput;
|
|
21917
|
+
}
|
|
21918
|
+
if (spec.removeFinalOutput) {
|
|
21919
|
+
delete results.output;
|
|
21920
|
+
}
|
|
21684
21921
|
yield {
|
|
21685
21922
|
type: "done",
|
|
21686
|
-
graphOutput:
|
|
21923
|
+
graphOutput: results
|
|
21687
21924
|
};
|
|
21688
21925
|
}
|
|
21689
21926
|
} else if (event.type === "error") {
|
|
@@ -21703,6 +21940,12 @@ async function* getProcessorEvents(processor, spec) {
|
|
|
21703
21940
|
};
|
|
21704
21941
|
}
|
|
21705
21942
|
} else if (event.type === "nodeFinish") {
|
|
21943
|
+
if (spec.exposeUsage) {
|
|
21944
|
+
const usage = event.outputs["usage"];
|
|
21945
|
+
if (usage !== void 0) {
|
|
21946
|
+
usages.push(usage);
|
|
21947
|
+
}
|
|
21948
|
+
}
|
|
21706
21949
|
if (spec.nodeFinish === true || ((_e = spec.nodeFinish) == null ? void 0 : _e.includes(event.node.id)) || ((_f = spec.nodeFinish) == null ? void 0 : _f.includes(event.node.title))) {
|
|
21707
21950
|
yield {
|
|
21708
21951
|
type: "nodeFinish",
|
|
@@ -21736,19 +21979,47 @@ data: ${JSON.stringify(data)}
|
|
|
21736
21979
|
}
|
|
21737
21980
|
});
|
|
21738
21981
|
}
|
|
21739
|
-
function getSingleNodeStream(processor,
|
|
21982
|
+
function getSingleNodeStream(processor, arg) {
|
|
21983
|
+
let spec;
|
|
21984
|
+
if (typeof arg === "string") {
|
|
21985
|
+
const nodeIdOrTitle = arg;
|
|
21986
|
+
spec = {
|
|
21987
|
+
partialOutputs: [nodeIdOrTitle],
|
|
21988
|
+
nodeFinish: [nodeIdOrTitle]
|
|
21989
|
+
};
|
|
21990
|
+
} else {
|
|
21991
|
+
spec = arg;
|
|
21992
|
+
}
|
|
21740
21993
|
return new ReadableStream({
|
|
21741
21994
|
async start(controller) {
|
|
21742
21995
|
try {
|
|
21743
|
-
for await (const event of getProcessorEvents(processor, {
|
|
21744
|
-
|
|
21745
|
-
nodeFinish: [nodeIdOrTitle]
|
|
21746
|
-
})) {
|
|
21747
|
-
if (event.type === "partialOutput" && (event.nodeId === nodeIdOrTitle || event.nodeTitle === nodeIdOrTitle)) {
|
|
21996
|
+
for await (const event of getProcessorEvents(processor, spec)) {
|
|
21997
|
+
if (event.type === "partialOutput") {
|
|
21748
21998
|
controller.enqueue(`data: ${JSON.stringify(event.delta)}
|
|
21749
21999
|
|
|
21750
22000
|
`);
|
|
21751
|
-
} else if (event.type === "
|
|
22001
|
+
} else if (event.type === "error") {
|
|
22002
|
+
controller.enqueue(`error: ${JSON.stringify(event.error)}
|
|
22003
|
+
|
|
22004
|
+
`);
|
|
22005
|
+
} else if (event.type === "done") {
|
|
22006
|
+
if (spec.done) {
|
|
22007
|
+
const results = event.graphOutput;
|
|
22008
|
+
if (!spec.exposeCost) {
|
|
22009
|
+
delete results.cost;
|
|
22010
|
+
}
|
|
22011
|
+
if (!spec.exposeUsage) {
|
|
22012
|
+
delete results.requestTokens;
|
|
22013
|
+
delete results.responseTokens;
|
|
22014
|
+
delete results.usages;
|
|
22015
|
+
}
|
|
22016
|
+
if (spec.removeFinalOutput) {
|
|
22017
|
+
delete results.output;
|
|
22018
|
+
}
|
|
22019
|
+
controller.enqueue(`graphOutput: ${JSON.stringify(results)}
|
|
22020
|
+
|
|
22021
|
+
`);
|
|
22022
|
+
}
|
|
21752
22023
|
controller.close();
|
|
21753
22024
|
}
|
|
21754
22025
|
}
|
|
@@ -21881,7 +22152,7 @@ function loadProjectAndAttachedDataFromString(content) {
|
|
|
21881
22152
|
}
|
|
21882
22153
|
|
|
21883
22154
|
// src/index.ts
|
|
21884
|
-
var
|
|
22155
|
+
var Rivet = void 0;
|
|
21885
22156
|
// Annotate the CommonJS export names for ESM import in node:
|
|
21886
22157
|
0 && (module.exports = {
|
|
21887
22158
|
AbortGraphNodeImpl,
|
|
@@ -21979,6 +22250,7 @@ var Rivet2 = void 0;
|
|
|
21979
22250
|
VectorNearestNeighborsNodeImpl,
|
|
21980
22251
|
VectorStoreNodeImpl,
|
|
21981
22252
|
WaitForEventNodeImpl,
|
|
22253
|
+
WriteFileNodeImpl,
|
|
21982
22254
|
abortGraphNode,
|
|
21983
22255
|
addWarning,
|
|
21984
22256
|
aidonPlugin,
|
|
@@ -22131,12 +22403,14 @@ var Rivet2 = void 0;
|
|
|
22131
22403
|
toYamlNode,
|
|
22132
22404
|
trimChatMessagesNode,
|
|
22133
22405
|
uint8ArrayToBase64,
|
|
22406
|
+
uint8ArrayToBase64Sync,
|
|
22134
22407
|
unwrapDataValue,
|
|
22135
22408
|
urlReferenceNode,
|
|
22136
22409
|
userInputNode,
|
|
22137
22410
|
vectorNearestNeighborsNode,
|
|
22138
22411
|
vectorStoreNode,
|
|
22139
22412
|
waitForEventNode,
|
|
22413
|
+
writeFileNode,
|
|
22140
22414
|
yamlProblem
|
|
22141
22415
|
});
|
|
22142
22416
|
//# sourceMappingURL=bundle.cjs.map
|