@alpic80/rivet-core 1.19.1-aidon.1 → 1.19.1-aidon.3
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 +284 -107
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/esm/model/GraphProcessor.js +34 -0
- package/dist/esm/model/Nodes.js +3 -0
- package/dist/esm/model/nodes/ChatNode.js +19 -2
- package/dist/esm/model/nodes/ImageToMDNode.js +116 -0
- package/dist/esm/plugins/aidon/nodes/ChatAidonNode.js +1 -1
- package/dist/esm/utils/openai.js +4 -0
- package/dist/types/model/Nodes.d.ts +3 -2
- package/dist/types/model/nodes/ImageToMDNode.d.ts +20 -0
- package/dist/types/utils/openai.d.ts +6 -0
- package/package.json +1 -1
package/dist/cjs/bundle.cjs
CHANGED
|
@@ -76,6 +76,7 @@ __export(src_exports, {
|
|
|
76
76
|
IfElseNodeImpl: () => IfElseNodeImpl,
|
|
77
77
|
IfNodeImpl: () => IfNodeImpl,
|
|
78
78
|
ImageNodeImpl: () => ImageNodeImpl,
|
|
79
|
+
ImageToMDNodeImpl: () => ImageToMDNodeImpl,
|
|
79
80
|
InMemoryDatasetProvider: () => InMemoryDatasetProvider,
|
|
80
81
|
JoinNodeImpl: () => JoinNodeImpl,
|
|
81
82
|
ListGraphsNodeImpl: () => ListGraphsNodeImpl,
|
|
@@ -199,6 +200,7 @@ __export(src_exports, {
|
|
|
199
200
|
ifElseNode: () => ifElseNode,
|
|
200
201
|
ifNode: () => ifNode,
|
|
201
202
|
imageNode: () => imageNode,
|
|
203
|
+
imageToMDNode: () => imageToMDNode,
|
|
202
204
|
inferType: () => inferType,
|
|
203
205
|
isArrayDataType: () => isArrayDataType,
|
|
204
206
|
isArrayDataValue: () => isArrayDataValue,
|
|
@@ -1437,7 +1439,7 @@ var DEFAULT_CHAT_NODE_TIMEOUT = 3e4;
|
|
|
1437
1439
|
var import_lodash_es13 = require("lodash");
|
|
1438
1440
|
var import_p_queue = __toESM(require("p-queue-6"), 1);
|
|
1439
1441
|
var import_emittery2 = __toESM(require("emittery-0-13"), 1);
|
|
1440
|
-
var
|
|
1442
|
+
var import_non_secure68 = require("nanoid/non-secure");
|
|
1441
1443
|
var import_ts_pattern10 = require("ts-pattern");
|
|
1442
1444
|
|
|
1443
1445
|
// src/model/NodeImpl.ts
|
|
@@ -2178,7 +2180,10 @@ async function* streamChatCompletions({
|
|
|
2178
2180
|
},
|
|
2179
2181
|
body: JSON.stringify({
|
|
2180
2182
|
...rest,
|
|
2181
|
-
stream: true
|
|
2183
|
+
stream: true,
|
|
2184
|
+
stream_options: {
|
|
2185
|
+
"include_usage": true
|
|
2186
|
+
}
|
|
2182
2187
|
}),
|
|
2183
2188
|
signal: abortSignal
|
|
2184
2189
|
},
|
|
@@ -2970,6 +2975,8 @@ var ChatNodeImpl = class extends NodeImpl {
|
|
|
2970
2975
|
}
|
|
2971
2976
|
}
|
|
2972
2977
|
const startTime = Date.now();
|
|
2978
|
+
let usagePromptTokens = -1;
|
|
2979
|
+
let usageCompletionTokens = -1;
|
|
2973
2980
|
const chunks = streamChatCompletions({
|
|
2974
2981
|
auth: {
|
|
2975
2982
|
apiKey: context.settings.openAiKey ?? "",
|
|
@@ -2986,6 +2993,10 @@ var ChatNodeImpl = class extends NodeImpl {
|
|
|
2986
2993
|
if (!chunk.choices) {
|
|
2987
2994
|
continue;
|
|
2988
2995
|
}
|
|
2996
|
+
if (chunk.choices.length == 0 && chunk.usage) {
|
|
2997
|
+
usagePromptTokens = chunk.usage.prompt_tokens;
|
|
2998
|
+
usageCompletionTokens = chunk.usage.completion_tokens;
|
|
2999
|
+
}
|
|
2989
3000
|
for (const { delta, index } of chunk.choices) {
|
|
2990
3001
|
if (delta.content != null) {
|
|
2991
3002
|
responseChoicesParts[index] ??= [];
|
|
@@ -3081,11 +3092,22 @@ var ChatNodeImpl = class extends NodeImpl {
|
|
|
3081
3092
|
throw new Error("No response from OpenAI");
|
|
3082
3093
|
}
|
|
3083
3094
|
output["in-messages"] = { type: "chat-message[]", value: messages };
|
|
3084
|
-
|
|
3095
|
+
let finalTokenCount = tokenCount * (numberOfChoices ?? 1);
|
|
3085
3096
|
let responseTokenCount = 0;
|
|
3086
3097
|
for (const choiceParts of responseChoicesParts) {
|
|
3087
|
-
responseTokenCount += await context.tokenizer.getTokenCountForString(choiceParts.join(), tokenizerInfo);
|
|
3098
|
+
responseTokenCount += await context.tokenizer.getTokenCountForString(choiceParts.join(""), tokenizerInfo);
|
|
3088
3099
|
}
|
|
3100
|
+
if (usagePromptTokens != -1 && usageCompletionTokens != -1) {
|
|
3101
|
+
if (finalTokenCount != usagePromptTokens) {
|
|
3102
|
+
console.log(`calculated token count:${finalTokenCount}, usage:${usagePromptTokens}`);
|
|
3103
|
+
finalTokenCount = usagePromptTokens;
|
|
3104
|
+
}
|
|
3105
|
+
if (responseTokenCount != usageCompletionTokens) {
|
|
3106
|
+
console.log(`calculated response token count:${responseTokenCount}, usage:${usageCompletionTokens}`);
|
|
3107
|
+
responseTokenCount = usageCompletionTokens;
|
|
3108
|
+
}
|
|
3109
|
+
}
|
|
3110
|
+
output["requestTokens"] = { type: "number", value: finalTokenCount };
|
|
3089
3111
|
output["responseTokens"] = { type: "number", value: responseTokenCount };
|
|
3090
3112
|
const promptCostPerThousand = model in openaiModels ? openaiModels[model].cost.prompt : 0;
|
|
3091
3113
|
const completionCostPerThousand = model in openaiModels ? openaiModels[model].cost.completion : 0;
|
|
@@ -8728,12 +8750,125 @@ var CommentNodeImpl = class extends NodeImpl {
|
|
|
8728
8750
|
};
|
|
8729
8751
|
var commentNode = nodeDefinition(CommentNodeImpl, "Comment");
|
|
8730
8752
|
|
|
8731
|
-
// src/model/nodes/
|
|
8753
|
+
// src/model/nodes/ImageToMDNode.ts
|
|
8732
8754
|
var import_non_secure53 = require("nanoid/non-secure");
|
|
8755
|
+
var import_ts_dedent52 = require("ts-dedent");
|
|
8756
|
+
var ImageToMDNodeImpl = class extends NodeImpl {
|
|
8757
|
+
static create() {
|
|
8758
|
+
const chartNode = {
|
|
8759
|
+
type: "imagetoMD",
|
|
8760
|
+
title: "Image To Markdown",
|
|
8761
|
+
id: (0, import_non_secure53.nanoid)(),
|
|
8762
|
+
visualData: {
|
|
8763
|
+
x: 0,
|
|
8764
|
+
y: 0,
|
|
8765
|
+
width: 175
|
|
8766
|
+
},
|
|
8767
|
+
data: {
|
|
8768
|
+
useDataInput: false,
|
|
8769
|
+
mediaType: "image/png",
|
|
8770
|
+
useMediaTypeInput: false
|
|
8771
|
+
}
|
|
8772
|
+
};
|
|
8773
|
+
return chartNode;
|
|
8774
|
+
}
|
|
8775
|
+
getInputDefinitions() {
|
|
8776
|
+
const inputDefinitions = [];
|
|
8777
|
+
if (this.chartNode.data.useDataInput) {
|
|
8778
|
+
inputDefinitions.push({
|
|
8779
|
+
id: "data",
|
|
8780
|
+
title: "Data",
|
|
8781
|
+
dataType: "image",
|
|
8782
|
+
coerced: false
|
|
8783
|
+
});
|
|
8784
|
+
}
|
|
8785
|
+
if (this.chartNode.data.useMediaTypeInput) {
|
|
8786
|
+
inputDefinitions.push({
|
|
8787
|
+
id: "mediaType",
|
|
8788
|
+
title: "Media Type",
|
|
8789
|
+
dataType: "string"
|
|
8790
|
+
});
|
|
8791
|
+
}
|
|
8792
|
+
return inputDefinitions;
|
|
8793
|
+
}
|
|
8794
|
+
getOutputDefinitions() {
|
|
8795
|
+
return [
|
|
8796
|
+
{
|
|
8797
|
+
id: "imageMarkdown",
|
|
8798
|
+
title: "Image",
|
|
8799
|
+
dataType: "string"
|
|
8800
|
+
}
|
|
8801
|
+
];
|
|
8802
|
+
}
|
|
8803
|
+
getEditors() {
|
|
8804
|
+
return [
|
|
8805
|
+
{
|
|
8806
|
+
type: "dropdown",
|
|
8807
|
+
label: "Media Type",
|
|
8808
|
+
dataKey: "mediaType",
|
|
8809
|
+
options: [
|
|
8810
|
+
{ value: "image/png", label: "PNG" },
|
|
8811
|
+
{ value: "image/jpeg", label: "JPEG" },
|
|
8812
|
+
{ value: "image/gif", label: "GIF" }
|
|
8813
|
+
],
|
|
8814
|
+
useInputToggleDataKey: "useMediaTypeInput"
|
|
8815
|
+
},
|
|
8816
|
+
{
|
|
8817
|
+
type: "imageBrowser",
|
|
8818
|
+
label: "Image",
|
|
8819
|
+
dataKey: "data",
|
|
8820
|
+
useInputToggleDataKey: "useDataInput",
|
|
8821
|
+
mediaTypeDataKey: "mediaType"
|
|
8822
|
+
}
|
|
8823
|
+
];
|
|
8824
|
+
}
|
|
8825
|
+
getBody() {
|
|
8826
|
+
return this.data.mediaType;
|
|
8827
|
+
}
|
|
8828
|
+
static getUIData() {
|
|
8829
|
+
return {
|
|
8830
|
+
infoBoxBody: import_ts_dedent52.dedent`
|
|
8831
|
+
Turns the input value (image byte array) into its Markdown equivalent.
|
|
8832
|
+
`,
|
|
8833
|
+
infoBoxTitle: "Image to Markdown Node",
|
|
8834
|
+
contextMenuTitle: "Image to Markdown",
|
|
8835
|
+
group: ["Data"]
|
|
8836
|
+
};
|
|
8837
|
+
}
|
|
8838
|
+
async process(inputData, context) {
|
|
8839
|
+
var _a, _b;
|
|
8840
|
+
let data;
|
|
8841
|
+
if (this.chartNode.data.useDataInput) {
|
|
8842
|
+
const imageData = expectType(inputData["data"], "image");
|
|
8843
|
+
data = await uint8ArrayToBase64(imageData.data);
|
|
8844
|
+
} else {
|
|
8845
|
+
const dataRef = (_a = this.data.data) == null ? void 0 : _a.refId;
|
|
8846
|
+
if (!dataRef) {
|
|
8847
|
+
throw new Error("No data ref");
|
|
8848
|
+
}
|
|
8849
|
+
const encodedData = (_b = context.project.data) == null ? void 0 : _b[dataRef];
|
|
8850
|
+
if (!encodedData) {
|
|
8851
|
+
throw new Error(`No data at ref ${dataRef}`);
|
|
8852
|
+
}
|
|
8853
|
+
data = encodedData;
|
|
8854
|
+
}
|
|
8855
|
+
data = ``;
|
|
8856
|
+
return {
|
|
8857
|
+
["imageMarkdown"]: {
|
|
8858
|
+
type: "string",
|
|
8859
|
+
value: data
|
|
8860
|
+
}
|
|
8861
|
+
};
|
|
8862
|
+
}
|
|
8863
|
+
};
|
|
8864
|
+
var imageToMDNode = nodeDefinition(ImageToMDNodeImpl, "Image To Markdown");
|
|
8865
|
+
|
|
8866
|
+
// src/model/nodes/ImageNode.ts
|
|
8867
|
+
var import_non_secure54 = require("nanoid/non-secure");
|
|
8733
8868
|
var ImageNodeImpl = class extends NodeImpl {
|
|
8734
8869
|
static create() {
|
|
8735
8870
|
return {
|
|
8736
|
-
id: (0,
|
|
8871
|
+
id: (0, import_non_secure54.nanoid)(),
|
|
8737
8872
|
type: "image",
|
|
8738
8873
|
title: "Image",
|
|
8739
8874
|
visualData: { x: 0, y: 0, width: 250 },
|
|
@@ -8830,11 +8965,11 @@ var ImageNodeImpl = class extends NodeImpl {
|
|
|
8830
8965
|
var imageNode = nodeDefinition(ImageNodeImpl, "Image");
|
|
8831
8966
|
|
|
8832
8967
|
// src/model/nodes/AudioNode.ts
|
|
8833
|
-
var
|
|
8968
|
+
var import_non_secure55 = require("nanoid/non-secure");
|
|
8834
8969
|
var AudioNodeImpl = class extends NodeImpl {
|
|
8835
8970
|
static create() {
|
|
8836
8971
|
return {
|
|
8837
|
-
id: (0,
|
|
8972
|
+
id: (0, import_non_secure55.nanoid)(),
|
|
8838
8973
|
type: "audio",
|
|
8839
8974
|
title: "Audio",
|
|
8840
8975
|
visualData: { x: 0, y: 0, width: 300 },
|
|
@@ -8927,13 +9062,13 @@ var AudioNodeImpl = class extends NodeImpl {
|
|
|
8927
9062
|
var audioNode = nodeDefinition(AudioNodeImpl, "Audio");
|
|
8928
9063
|
|
|
8929
9064
|
// src/model/nodes/HttpCallNode.ts
|
|
8930
|
-
var
|
|
9065
|
+
var import_non_secure56 = require("nanoid/non-secure");
|
|
8931
9066
|
var HttpCallNodeImpl = class extends NodeImpl {
|
|
8932
9067
|
static create() {
|
|
8933
9068
|
const chartNode = {
|
|
8934
9069
|
type: "httpCall",
|
|
8935
9070
|
title: "Http Call",
|
|
8936
|
-
id: (0,
|
|
9071
|
+
id: (0, import_non_secure56.nanoid)(),
|
|
8937
9072
|
visualData: {
|
|
8938
9073
|
x: 0,
|
|
8939
9074
|
y: 0,
|
|
@@ -9175,14 +9310,14 @@ Body: ${this.data.body}` : ""}${this.data.errorOnNon200 ? "\nError on non-200" :
|
|
|
9175
9310
|
var httpCallNode = nodeDefinition(HttpCallNodeImpl, "Http Call");
|
|
9176
9311
|
|
|
9177
9312
|
// src/model/nodes/DelayNode.ts
|
|
9178
|
-
var
|
|
9179
|
-
var
|
|
9313
|
+
var import_non_secure57 = require("nanoid/non-secure");
|
|
9314
|
+
var import_ts_dedent53 = require("ts-dedent");
|
|
9180
9315
|
var DelayNodeImpl = class extends NodeImpl {
|
|
9181
9316
|
static create() {
|
|
9182
9317
|
const chartNode = {
|
|
9183
9318
|
type: "delay",
|
|
9184
9319
|
title: "Delay",
|
|
9185
|
-
id: (0,
|
|
9320
|
+
id: (0, import_non_secure57.nanoid)(),
|
|
9186
9321
|
visualData: {
|
|
9187
9322
|
x: 0,
|
|
9188
9323
|
y: 0,
|
|
@@ -9227,7 +9362,7 @@ var DelayNodeImpl = class extends NodeImpl {
|
|
|
9227
9362
|
}
|
|
9228
9363
|
static getUIData() {
|
|
9229
9364
|
return {
|
|
9230
|
-
infoBoxBody:
|
|
9365
|
+
infoBoxBody: import_ts_dedent53.dedent`
|
|
9231
9366
|
Delays the execution and then passes the input value to the output without any modifications.
|
|
9232
9367
|
`,
|
|
9233
9368
|
infoBoxTitle: "Delay Node",
|
|
@@ -9278,12 +9413,12 @@ var DelayNodeImpl = class extends NodeImpl {
|
|
|
9278
9413
|
var delayNode = nodeDefinition(DelayNodeImpl, "Delay");
|
|
9279
9414
|
|
|
9280
9415
|
// src/model/nodes/AppendToDatasetNode.ts
|
|
9281
|
-
var
|
|
9282
|
-
var
|
|
9416
|
+
var import_non_secure58 = require("nanoid/non-secure");
|
|
9417
|
+
var import_ts_dedent54 = require("ts-dedent");
|
|
9283
9418
|
var AppendToDatasetNodeImpl = class extends NodeImpl {
|
|
9284
9419
|
static create() {
|
|
9285
9420
|
return {
|
|
9286
|
-
id: (0,
|
|
9421
|
+
id: (0, import_non_secure58.nanoid)(),
|
|
9287
9422
|
type: "appendToDataset",
|
|
9288
9423
|
title: "Append to Dataset",
|
|
9289
9424
|
visualData: { x: 0, y: 0, width: 250 },
|
|
@@ -9339,7 +9474,7 @@ var AppendToDatasetNodeImpl = class extends NodeImpl {
|
|
|
9339
9474
|
}
|
|
9340
9475
|
static getUIData() {
|
|
9341
9476
|
return {
|
|
9342
|
-
infoBoxBody:
|
|
9477
|
+
infoBoxBody: import_ts_dedent54.dedent`
|
|
9343
9478
|
Appends a row of data to the specified dataset.
|
|
9344
9479
|
`,
|
|
9345
9480
|
infoBoxTitle: "Append to Dataset Node",
|
|
@@ -9889,14 +10024,14 @@ var GetDatasetRowNodeImpl = class extends NodeImpl {
|
|
|
9889
10024
|
var getDatasetRowNode = nodeDefinition(GetDatasetRowNodeImpl, "Get Dataset Row");
|
|
9890
10025
|
|
|
9891
10026
|
// src/model/nodes/SliceNode.ts
|
|
9892
|
-
var
|
|
9893
|
-
var
|
|
10027
|
+
var import_non_secure59 = require("nanoid/non-secure");
|
|
10028
|
+
var import_ts_dedent55 = require("ts-dedent");
|
|
9894
10029
|
var SliceNodeImpl = class extends NodeImpl {
|
|
9895
10030
|
static create() {
|
|
9896
10031
|
const chartNode = {
|
|
9897
10032
|
type: "slice",
|
|
9898
10033
|
title: "Slice",
|
|
9899
|
-
id: (0,
|
|
10034
|
+
id: (0, import_non_secure59.nanoid)(),
|
|
9900
10035
|
visualData: {
|
|
9901
10036
|
x: 0,
|
|
9902
10037
|
y: 0,
|
|
@@ -9949,14 +10084,14 @@ var SliceNodeImpl = class extends NodeImpl {
|
|
|
9949
10084
|
];
|
|
9950
10085
|
}
|
|
9951
10086
|
getBody() {
|
|
9952
|
-
return
|
|
10087
|
+
return import_ts_dedent55.dedent`
|
|
9953
10088
|
Start: ${this.data.useStartInput ? "(Using Input)" : this.data.start == null ? "0" : this.data.start}
|
|
9954
10089
|
Count: ${this.data.useCountInput ? "(Using Input)" : this.data.count == null ? "All" : this.data.count}
|
|
9955
10090
|
`;
|
|
9956
10091
|
}
|
|
9957
10092
|
static getUIData() {
|
|
9958
10093
|
return {
|
|
9959
|
-
infoBoxBody:
|
|
10094
|
+
infoBoxBody: import_ts_dedent55.dedent`
|
|
9960
10095
|
Slices an array from the start index for the count number of elements.
|
|
9961
10096
|
|
|
9962
10097
|
Useful for extracting a portion of an array.
|
|
@@ -9982,14 +10117,14 @@ var SliceNodeImpl = class extends NodeImpl {
|
|
|
9982
10117
|
var sliceNode = nodeDefinition(SliceNodeImpl, "Slice");
|
|
9983
10118
|
|
|
9984
10119
|
// src/model/nodes/ExtractMarkdownCodeBlocksNode.ts
|
|
9985
|
-
var
|
|
9986
|
-
var
|
|
10120
|
+
var import_non_secure60 = require("nanoid/non-secure");
|
|
10121
|
+
var import_ts_dedent56 = require("ts-dedent");
|
|
9987
10122
|
var ExtractMarkdownCodeBlocksNodeImpl = class extends NodeImpl {
|
|
9988
10123
|
static create() {
|
|
9989
10124
|
const chartNode = {
|
|
9990
10125
|
type: "extractMarkdownCodeBlocks",
|
|
9991
10126
|
title: "Extract Markdown Code Blocks",
|
|
9992
|
-
id: (0,
|
|
10127
|
+
id: (0, import_non_secure60.nanoid)(),
|
|
9993
10128
|
visualData: {
|
|
9994
10129
|
x: 0,
|
|
9995
10130
|
y: 0,
|
|
@@ -10030,7 +10165,7 @@ var ExtractMarkdownCodeBlocksNodeImpl = class extends NodeImpl {
|
|
|
10030
10165
|
}
|
|
10031
10166
|
static getUIData() {
|
|
10032
10167
|
return {
|
|
10033
|
-
infoBoxBody:
|
|
10168
|
+
infoBoxBody: import_ts_dedent56.dedent`
|
|
10034
10169
|
Extracts the code blocks in the input Markdown text.
|
|
10035
10170
|
|
|
10036
10171
|
Outputs the first matched block, all matched blocks, and the languages specified for the blocks.
|
|
@@ -10081,7 +10216,7 @@ var extractMarkdownCodeBlocksNode = nodeDefinition(
|
|
|
10081
10216
|
);
|
|
10082
10217
|
|
|
10083
10218
|
// src/model/nodes/AssembleMessageNode.ts
|
|
10084
|
-
var
|
|
10219
|
+
var import_non_secure61 = require("nanoid/non-secure");
|
|
10085
10220
|
var import_lodash_es12 = require("lodash");
|
|
10086
10221
|
var import_ts_pattern9 = require("ts-pattern");
|
|
10087
10222
|
var messageTypeToTitle = {
|
|
@@ -10095,7 +10230,7 @@ var AssembleMessageNodeImpl = class extends NodeImpl {
|
|
|
10095
10230
|
const chartNode = {
|
|
10096
10231
|
type: "assembleMessage",
|
|
10097
10232
|
title: "Assemble Message",
|
|
10098
|
-
id: (0,
|
|
10233
|
+
id: (0, import_non_secure61.nanoid)(),
|
|
10099
10234
|
visualData: {
|
|
10100
10235
|
x: 0,
|
|
10101
10236
|
y: 0,
|
|
@@ -10283,13 +10418,13 @@ var AssembleMessageNodeImpl = class extends NodeImpl {
|
|
|
10283
10418
|
var assembleMessageNode = nodeDefinition(AssembleMessageNodeImpl, "Assemble Prompt");
|
|
10284
10419
|
|
|
10285
10420
|
// src/model/nodes/URLReferenceNode.ts
|
|
10286
|
-
var
|
|
10421
|
+
var import_non_secure62 = require("nanoid/non-secure");
|
|
10287
10422
|
var UrlReferenceNodeImpl = class extends NodeImpl {
|
|
10288
10423
|
static create() {
|
|
10289
10424
|
const chartNode = {
|
|
10290
10425
|
type: "urlReference",
|
|
10291
10426
|
title: "URL Reference",
|
|
10292
|
-
id: (0,
|
|
10427
|
+
id: (0, import_non_secure62.nanoid)(),
|
|
10293
10428
|
visualData: {
|
|
10294
10429
|
x: 0,
|
|
10295
10430
|
y: 0,
|
|
@@ -10358,15 +10493,15 @@ var UrlReferenceNodeImpl = class extends NodeImpl {
|
|
|
10358
10493
|
var urlReferenceNode = nodeDefinition(UrlReferenceNodeImpl, "URL Reference");
|
|
10359
10494
|
|
|
10360
10495
|
// src/model/nodes/DestructureNode.ts
|
|
10361
|
-
var
|
|
10496
|
+
var import_non_secure63 = require("nanoid/non-secure");
|
|
10362
10497
|
var import_jsonpath_plus3 = require("jsonpath-plus");
|
|
10363
|
-
var
|
|
10498
|
+
var import_ts_dedent57 = require("ts-dedent");
|
|
10364
10499
|
var DestructureNodeImpl = class extends NodeImpl {
|
|
10365
10500
|
static create() {
|
|
10366
10501
|
const chartNode = {
|
|
10367
10502
|
type: "destructure",
|
|
10368
10503
|
title: "Destructure",
|
|
10369
|
-
id: (0,
|
|
10504
|
+
id: (0, import_non_secure63.nanoid)(),
|
|
10370
10505
|
visualData: {
|
|
10371
10506
|
x: 0,
|
|
10372
10507
|
y: 0,
|
|
@@ -10410,7 +10545,7 @@ var DestructureNodeImpl = class extends NodeImpl {
|
|
|
10410
10545
|
}
|
|
10411
10546
|
static getUIData() {
|
|
10412
10547
|
return {
|
|
10413
|
-
infoBoxBody:
|
|
10548
|
+
infoBoxBody: import_ts_dedent57.dedent`
|
|
10414
10549
|
Destructures the input value by extracting values at the specified paths. The paths use JSONPath notation to navigate through the value.
|
|
10415
10550
|
`,
|
|
10416
10551
|
infoBoxTitle: "Destructure Node",
|
|
@@ -10439,12 +10574,12 @@ var DestructureNodeImpl = class extends NodeImpl {
|
|
|
10439
10574
|
var destructureNode = nodeDefinition(DestructureNodeImpl, "Destructure");
|
|
10440
10575
|
|
|
10441
10576
|
// src/model/nodes/ReplaceDatasetNode.ts
|
|
10442
|
-
var
|
|
10443
|
-
var
|
|
10577
|
+
var import_non_secure64 = require("nanoid/non-secure");
|
|
10578
|
+
var import_ts_dedent58 = require("ts-dedent");
|
|
10444
10579
|
var ReplaceDatasetNodeImpl = class extends NodeImpl {
|
|
10445
10580
|
static create() {
|
|
10446
10581
|
return {
|
|
10447
|
-
id: (0,
|
|
10582
|
+
id: (0, import_non_secure64.nanoid)(),
|
|
10448
10583
|
type: "replaceDataset",
|
|
10449
10584
|
title: "Replace Dataset",
|
|
10450
10585
|
visualData: { x: 0, y: 0, width: 250 },
|
|
@@ -10483,7 +10618,7 @@ var ReplaceDatasetNodeImpl = class extends NodeImpl {
|
|
|
10483
10618
|
}
|
|
10484
10619
|
static getUIData() {
|
|
10485
10620
|
return {
|
|
10486
|
-
infoBoxBody:
|
|
10621
|
+
infoBoxBody: import_ts_dedent58.dedent`
|
|
10487
10622
|
Replaces the data in a dataset with the given data. If no data is given, the dataset will be cleared instead.
|
|
10488
10623
|
`,
|
|
10489
10624
|
infoBoxTitle: "Replace Dataset Node",
|
|
@@ -10615,14 +10750,14 @@ var ListGraphsNodeImpl = class extends NodeImpl {
|
|
|
10615
10750
|
var listGraphsNode = nodeDefinition(ListGraphsNodeImpl, "List Graphs");
|
|
10616
10751
|
|
|
10617
10752
|
// src/model/nodes/GraphReferenceNode.ts
|
|
10618
|
-
var
|
|
10619
|
-
var
|
|
10753
|
+
var import_non_secure65 = require("nanoid/non-secure");
|
|
10754
|
+
var import_ts_dedent59 = require("ts-dedent");
|
|
10620
10755
|
var GraphReferenceNodeImpl = class extends NodeImpl {
|
|
10621
10756
|
static create() {
|
|
10622
10757
|
const chartNode = {
|
|
10623
10758
|
type: "graphReference",
|
|
10624
10759
|
title: "Graph Reference",
|
|
10625
|
-
id: (0,
|
|
10760
|
+
id: (0, import_non_secure65.nanoid)(),
|
|
10626
10761
|
visualData: {
|
|
10627
10762
|
x: 0,
|
|
10628
10763
|
y: 0,
|
|
@@ -10671,7 +10806,7 @@ var GraphReferenceNodeImpl = class extends NodeImpl {
|
|
|
10671
10806
|
}
|
|
10672
10807
|
static getUIData() {
|
|
10673
10808
|
return {
|
|
10674
|
-
infoBoxBody:
|
|
10809
|
+
infoBoxBody: import_ts_dedent59.dedent`
|
|
10675
10810
|
Gets a reference to another graph, that can be used to pass around graphs to call using a Call Graph node.
|
|
10676
10811
|
`,
|
|
10677
10812
|
infoBoxTitle: "Graph Reference Node",
|
|
@@ -10737,14 +10872,14 @@ var GraphReferenceNodeImpl = class extends NodeImpl {
|
|
|
10737
10872
|
var graphReferenceNode = nodeDefinition(GraphReferenceNodeImpl, "Graph Reference");
|
|
10738
10873
|
|
|
10739
10874
|
// src/model/nodes/CallGraphNode.ts
|
|
10740
|
-
var
|
|
10741
|
-
var
|
|
10875
|
+
var import_non_secure66 = require("nanoid/non-secure");
|
|
10876
|
+
var import_ts_dedent60 = require("ts-dedent");
|
|
10742
10877
|
var CallGraphNodeImpl = class extends NodeImpl {
|
|
10743
10878
|
static create() {
|
|
10744
10879
|
const chartNode = {
|
|
10745
10880
|
type: "callGraph",
|
|
10746
10881
|
title: "Call Graph",
|
|
10747
|
-
id: (0,
|
|
10882
|
+
id: (0, import_non_secure66.nanoid)(),
|
|
10748
10883
|
visualData: {
|
|
10749
10884
|
x: 0,
|
|
10750
10885
|
y: 0,
|
|
@@ -10794,7 +10929,7 @@ var CallGraphNodeImpl = class extends NodeImpl {
|
|
|
10794
10929
|
}
|
|
10795
10930
|
static getUIData() {
|
|
10796
10931
|
return {
|
|
10797
|
-
infoBoxBody:
|
|
10932
|
+
infoBoxBody: import_ts_dedent60.dedent`
|
|
10798
10933
|
Calls another graph and passes inputs to it. Use in combination with the Graph Reference node to call dynamic graphs.
|
|
10799
10934
|
`,
|
|
10800
10935
|
infoBoxTitle: "Call Graph Node",
|
|
@@ -10866,7 +11001,7 @@ var callGraphNode = nodeDefinition(CallGraphNodeImpl, "Call Graph");
|
|
|
10866
11001
|
|
|
10867
11002
|
// src/model/nodes/DelegateFunctionCallNode.ts
|
|
10868
11003
|
var import_nanoid = require("nanoid");
|
|
10869
|
-
var
|
|
11004
|
+
var import_ts_dedent61 = require("ts-dedent");
|
|
10870
11005
|
var DelegateFunctionCallNodeImpl = class extends NodeImpl {
|
|
10871
11006
|
static create() {
|
|
10872
11007
|
const chartNode = {
|
|
@@ -10915,7 +11050,7 @@ var DelegateFunctionCallNodeImpl = class extends NodeImpl {
|
|
|
10915
11050
|
}
|
|
10916
11051
|
static getUIData() {
|
|
10917
11052
|
return {
|
|
10918
|
-
infoBoxBody:
|
|
11053
|
+
infoBoxBody: import_ts_dedent61.dedent`
|
|
10919
11054
|
Handles a function call by delegating it to a different subgraph depending on the function call.
|
|
10920
11055
|
`,
|
|
10921
11056
|
infoBoxTitle: "Delegate Function Call Node",
|
|
@@ -11003,11 +11138,11 @@ var DelegateFunctionCallNodeImpl = class extends NodeImpl {
|
|
|
11003
11138
|
var delegateFunctionCallNode = nodeDefinition(DelegateFunctionCallNodeImpl, "Delegate Function Call");
|
|
11004
11139
|
|
|
11005
11140
|
// src/model/nodes/PlayAudioNode.ts
|
|
11006
|
-
var
|
|
11141
|
+
var import_non_secure67 = require("nanoid/non-secure");
|
|
11007
11142
|
var PlayAudioNodeImpl = class extends NodeImpl {
|
|
11008
11143
|
static create() {
|
|
11009
11144
|
return {
|
|
11010
|
-
id: (0,
|
|
11145
|
+
id: (0, import_non_secure67.nanoid)(),
|
|
11011
11146
|
type: "playAudio",
|
|
11012
11147
|
title: "Play Audio",
|
|
11013
11148
|
visualData: { x: 0, y: 0, width: 200 },
|
|
@@ -11062,7 +11197,7 @@ var playAudioNode = nodeDefinition(PlayAudioNodeImpl, "Play Audio");
|
|
|
11062
11197
|
|
|
11063
11198
|
// src/model/Nodes.ts
|
|
11064
11199
|
var registerBuiltInNodes = (registry2) => {
|
|
11065
|
-
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(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);
|
|
11200
|
+
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);
|
|
11066
11201
|
};
|
|
11067
11202
|
var globalRivetNodeRegistry = registerBuiltInNodes(new NodeRegistration());
|
|
11068
11203
|
function resetGlobalRivetNodeRegistry() {
|
|
@@ -11154,7 +11289,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
11154
11289
|
#isPaused = false;
|
|
11155
11290
|
#parent;
|
|
11156
11291
|
#registry;
|
|
11157
|
-
id = (0,
|
|
11292
|
+
id = (0, import_non_secure68.nanoid)();
|
|
11158
11293
|
executor;
|
|
11159
11294
|
/** If set, specifies the node(s) that the graph will run TO, instead of the nodes without any dependents. */
|
|
11160
11295
|
runToNodeIds;
|
|
@@ -11184,6 +11319,8 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
11184
11319
|
#aborted = false;
|
|
11185
11320
|
#abortSuccessfully = false;
|
|
11186
11321
|
#abortError = void 0;
|
|
11322
|
+
#totalRequestTokens = 0;
|
|
11323
|
+
#totalResponseTokens = 0;
|
|
11187
11324
|
#totalCost = 0;
|
|
11188
11325
|
#ignoreNodes = void 0;
|
|
11189
11326
|
#nodeAbortControllers = /* @__PURE__ */ new Map();
|
|
@@ -11575,6 +11712,18 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
11575
11712
|
}
|
|
11576
11713
|
throw error;
|
|
11577
11714
|
}
|
|
11715
|
+
if (this.#graphOutputs["requestTokens"] == null) {
|
|
11716
|
+
this.#graphOutputs["requestTokens"] = {
|
|
11717
|
+
type: "number",
|
|
11718
|
+
value: this.#totalRequestTokens
|
|
11719
|
+
};
|
|
11720
|
+
}
|
|
11721
|
+
if (this.#graphOutputs["responseTokens"] == null) {
|
|
11722
|
+
this.#graphOutputs["responseTokens"] = {
|
|
11723
|
+
type: "number",
|
|
11724
|
+
value: this.#totalResponseTokens
|
|
11725
|
+
};
|
|
11726
|
+
}
|
|
11578
11727
|
if (this.#graphOutputs["cost"] == null) {
|
|
11579
11728
|
this.#graphOutputs["cost"] = {
|
|
11580
11729
|
type: "number",
|
|
@@ -11688,7 +11837,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
11688
11837
|
return;
|
|
11689
11838
|
}
|
|
11690
11839
|
const inputValues = this.#getInputValuesForNode(node);
|
|
11691
|
-
if (this.#excludedDueToControlFlow(node, inputValues, (0,
|
|
11840
|
+
if (this.#excludedDueToControlFlow(node, inputValues, (0, import_non_secure68.nanoid)(), "loop-not-broken")) {
|
|
11692
11841
|
this.#emitter.emit("trace", `Node ${node.title} is excluded due to control flow`);
|
|
11693
11842
|
return;
|
|
11694
11843
|
}
|
|
@@ -11822,7 +11971,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
11822
11971
|
return nodeData;
|
|
11823
11972
|
}
|
|
11824
11973
|
async #processNode(node) {
|
|
11825
|
-
const processId = (0,
|
|
11974
|
+
const processId = (0, import_non_secure68.nanoid)();
|
|
11826
11975
|
if (this.#abortController.signal.aborted) {
|
|
11827
11976
|
this.#nodeErrored(node, new Error("Processing aborted"), processId);
|
|
11828
11977
|
return processId;
|
|
@@ -11886,7 +12035,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
11886
12035
|
}
|
|
11887
12036
|
}
|
|
11888
12037
|
async #processSplitRunNode(node, processId) {
|
|
11889
|
-
var _a;
|
|
12038
|
+
var _a, _b, _c;
|
|
11890
12039
|
const inputValues = this.#getInputValuesForNode(node);
|
|
11891
12040
|
if (this.#excludedDueToControlFlow(node, inputValues, processId)) {
|
|
11892
12041
|
return;
|
|
@@ -11917,7 +12066,13 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
11917
12066
|
processId,
|
|
11918
12067
|
(node2, partialOutputs, index) => this.#emitter.emit("partialOutput", { node: node2, outputs: partialOutputs, index, processId })
|
|
11919
12068
|
);
|
|
11920
|
-
if (((_a = output["
|
|
12069
|
+
if (((_a = output["requestTokens"]) == null ? void 0 : _a.type) === "number") {
|
|
12070
|
+
this.#totalRequestTokens += coerceTypeOptional(output["requestTokens"], "number") ?? 0;
|
|
12071
|
+
}
|
|
12072
|
+
if (((_b = output["responseTokens"]) == null ? void 0 : _b.type) === "number") {
|
|
12073
|
+
this.#totalResponseTokens += coerceTypeOptional(output["responseTokens"], "number") ?? 0;
|
|
12074
|
+
}
|
|
12075
|
+
if (((_c = output["cost"]) == null ? void 0 : _c.type) === "number") {
|
|
11921
12076
|
this.#totalCost += coerceTypeOptional(output["cost"], "number") ?? 0;
|
|
11922
12077
|
}
|
|
11923
12078
|
results.push({ type: "output", output });
|
|
@@ -11928,7 +12083,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
11928
12083
|
} else {
|
|
11929
12084
|
results = await Promise.all(
|
|
11930
12085
|
(0, import_lodash_es13.range)(0, splittingAmount).map(async (i) => {
|
|
11931
|
-
var _a2;
|
|
12086
|
+
var _a2, _b2, _c2;
|
|
11932
12087
|
const inputs = fromEntries(
|
|
11933
12088
|
entries(inputValues).map(([port, value]) => [
|
|
11934
12089
|
port,
|
|
@@ -11943,7 +12098,13 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
11943
12098
|
processId,
|
|
11944
12099
|
(node2, partialOutputs, index) => this.#emitter.emit("partialOutput", { node: node2, outputs: partialOutputs, index, processId })
|
|
11945
12100
|
);
|
|
11946
|
-
if (((_a2 = output["
|
|
12101
|
+
if (((_a2 = output["requestTokens"]) == null ? void 0 : _a2.type) === "number") {
|
|
12102
|
+
this.#totalRequestTokens += coerceTypeOptional(output["requestTokens"], "number") ?? 0;
|
|
12103
|
+
}
|
|
12104
|
+
if (((_b2 = output["responseTokens"]) == null ? void 0 : _b2.type) === "number") {
|
|
12105
|
+
this.#totalResponseTokens += coerceTypeOptional(output["responseTokens"], "number") ?? 0;
|
|
12106
|
+
}
|
|
12107
|
+
if (((_c2 = output["cost"]) == null ? void 0 : _c2.type) === "number") {
|
|
11947
12108
|
this.#totalCost += coerceTypeOptional(output["cost"], "number") ?? 0;
|
|
11948
12109
|
}
|
|
11949
12110
|
return { type: "output", output };
|
|
@@ -11969,6 +12130,14 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
11969
12130
|
}, {});
|
|
11970
12131
|
this.#nodeResults.set(node.id, aggregateResults);
|
|
11971
12132
|
this.#visitedNodes.add(node.id);
|
|
12133
|
+
this.#totalRequestTokens += (0, import_lodash_es13.sum)(results.map((r) => {
|
|
12134
|
+
var _a2;
|
|
12135
|
+
return coerceTypeOptional((_a2 = r.output) == null ? void 0 : _a2["requestTokens"], "number") ?? 0;
|
|
12136
|
+
}));
|
|
12137
|
+
this.#totalResponseTokens += (0, import_lodash_es13.sum)(results.map((r) => {
|
|
12138
|
+
var _a2;
|
|
12139
|
+
return coerceTypeOptional((_a2 = r.output) == null ? void 0 : _a2["responseTokens"], "number") ?? 0;
|
|
12140
|
+
}));
|
|
11972
12141
|
this.#totalCost += (0, import_lodash_es13.sum)(results.map((r) => {
|
|
11973
12142
|
var _a2;
|
|
11974
12143
|
return coerceTypeOptional((_a2 = r.output) == null ? void 0 : _a2["cost"], "number") ?? 0;
|
|
@@ -11979,7 +12148,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
11979
12148
|
}
|
|
11980
12149
|
}
|
|
11981
12150
|
async #processNormalNode(node, processId) {
|
|
11982
|
-
var _a;
|
|
12151
|
+
var _a, _b, _c;
|
|
11983
12152
|
const inputValues = this.#getInputValuesForNode(node);
|
|
11984
12153
|
if (this.#excludedDueToControlFlow(node, inputValues, processId)) {
|
|
11985
12154
|
return;
|
|
@@ -11995,7 +12164,13 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
11995
12164
|
);
|
|
11996
12165
|
this.#nodeResults.set(node.id, outputValues);
|
|
11997
12166
|
this.#visitedNodes.add(node.id);
|
|
11998
|
-
if (((_a = outputValues["
|
|
12167
|
+
if (((_a = outputValues["requestTokens"]) == null ? void 0 : _a.type) === "number") {
|
|
12168
|
+
this.#totalRequestTokens += coerceTypeOptional(outputValues["requestTokens"], "number") ?? 0;
|
|
12169
|
+
}
|
|
12170
|
+
if (((_b = outputValues["responseTokens"]) == null ? void 0 : _b.type) === "number") {
|
|
12171
|
+
this.#totalResponseTokens += coerceTypeOptional(outputValues["responseTokens"], "number") ?? 0;
|
|
12172
|
+
}
|
|
12173
|
+
if (((_c = outputValues["cost"]) == null ? void 0 : _c.type) === "number") {
|
|
11999
12174
|
this.#totalCost += coerceTypeOptional(outputValues["cost"], "number") ?? 0;
|
|
12000
12175
|
}
|
|
12001
12176
|
this.#emitter.emit("nodeFinish", { node, outputs: outputValues, processId });
|
|
@@ -12405,7 +12580,7 @@ var OpenAIEmbeddingGenerator = class {
|
|
|
12405
12580
|
registerIntegration("embeddingGenerator", "openai", (context) => new OpenAIEmbeddingGenerator(context.settings));
|
|
12406
12581
|
|
|
12407
12582
|
// src/recording/ExecutionRecorder.ts
|
|
12408
|
-
var
|
|
12583
|
+
var import_non_secure69 = require("nanoid/non-secure");
|
|
12409
12584
|
var import_emittery3 = __toESM(require("emittery-0-13"), 1);
|
|
12410
12585
|
var toRecordedEventMap = {
|
|
12411
12586
|
graphStart: ({ graph, inputs }) => ({ graphId: graph.metadata.id, inputs }),
|
|
@@ -12515,7 +12690,7 @@ var ExecutionRecorder = class _ExecutionRecorder {
|
|
|
12515
12690
|
once = void 0;
|
|
12516
12691
|
recordSocket(channel) {
|
|
12517
12692
|
return new Promise((resolve, reject) => {
|
|
12518
|
-
this.recordingId = (0,
|
|
12693
|
+
this.recordingId = (0, import_non_secure69.nanoid)();
|
|
12519
12694
|
const listener = (event) => {
|
|
12520
12695
|
const { message, data } = JSON.parse(event.data);
|
|
12521
12696
|
if (this.#includePartialOutputs === false && message === "partialOutput") {
|
|
@@ -12537,7 +12712,7 @@ var ExecutionRecorder = class _ExecutionRecorder {
|
|
|
12537
12712
|
});
|
|
12538
12713
|
}
|
|
12539
12714
|
record(processor) {
|
|
12540
|
-
this.recordingId = (0,
|
|
12715
|
+
this.recordingId = (0, import_non_secure69.nanoid)();
|
|
12541
12716
|
processor.onAny((event, data) => {
|
|
12542
12717
|
if (this.#includePartialOutputs === false && event === "partialOutput") {
|
|
12543
12718
|
return;
|
|
@@ -12586,7 +12761,7 @@ var ExecutionRecorder = class _ExecutionRecorder {
|
|
|
12586
12761
|
|
|
12587
12762
|
// src/plugins/aidon/nodes/ChatAidonNode.ts
|
|
12588
12763
|
var import_lodash_es14 = require("lodash");
|
|
12589
|
-
var
|
|
12764
|
+
var import_ts_dedent62 = require("ts-dedent");
|
|
12590
12765
|
var registry = globalRivetNodeRegistry;
|
|
12591
12766
|
var ChatAidonNodeImpl = class extends ChatNodeImpl {
|
|
12592
12767
|
create() {
|
|
@@ -12754,7 +12929,7 @@ var createPluginNodeImpl = (chatNode2) => {
|
|
|
12754
12929
|
impl.chartNode.data = data;
|
|
12755
12930
|
const outputs = impl.getOutputDefinitions();
|
|
12756
12931
|
return outputs.filter((output) => {
|
|
12757
|
-
return
|
|
12932
|
+
return output.id !== "function-calls";
|
|
12758
12933
|
});
|
|
12759
12934
|
},
|
|
12760
12935
|
getEditors(data) {
|
|
@@ -12767,7 +12942,7 @@ var createPluginNodeImpl = (chatNode2) => {
|
|
|
12767
12942
|
},
|
|
12768
12943
|
getUIData() {
|
|
12769
12944
|
return {
|
|
12770
|
-
infoBoxBody:
|
|
12945
|
+
infoBoxBody: import_ts_dedent62.dedent`
|
|
12771
12946
|
Makes a call to an Aidon chat model. The settings contains many options for tweaking the model's behavior.
|
|
12772
12947
|
`,
|
|
12773
12948
|
infoBoxTitle: "Chat (Aidon) Node",
|
|
@@ -13097,8 +13272,8 @@ var AnthropicError = class extends Error {
|
|
|
13097
13272
|
};
|
|
13098
13273
|
|
|
13099
13274
|
// src/plugins/anthropic/nodes/ChatAnthropicNode.ts
|
|
13100
|
-
var
|
|
13101
|
-
var
|
|
13275
|
+
var import_non_secure70 = require("nanoid/non-secure");
|
|
13276
|
+
var import_ts_dedent63 = require("ts-dedent");
|
|
13102
13277
|
var import_p_retry2 = __toESM(require("p-retry-4"), 1);
|
|
13103
13278
|
var import_ts_pattern11 = require("ts-pattern");
|
|
13104
13279
|
|
|
@@ -13114,7 +13289,7 @@ var ChatAnthropicNodeImpl = {
|
|
|
13114
13289
|
const chartNode = {
|
|
13115
13290
|
type: "chatAnthropic",
|
|
13116
13291
|
title: "Chat (Anthropic)",
|
|
13117
|
-
id: (0,
|
|
13292
|
+
id: (0, import_non_secure70.nanoid)(),
|
|
13118
13293
|
visualData: {
|
|
13119
13294
|
x: 0,
|
|
13120
13295
|
y: 0,
|
|
@@ -13237,7 +13412,7 @@ var ChatAnthropicNodeImpl = {
|
|
|
13237
13412
|
getBody(data) {
|
|
13238
13413
|
var _a;
|
|
13239
13414
|
const modelName = ((_a = anthropicModels[data.model]) == null ? void 0 : _a.displayName) ?? "Unknown Model";
|
|
13240
|
-
return
|
|
13415
|
+
return import_ts_dedent63.dedent`
|
|
13241
13416
|
${modelName}
|
|
13242
13417
|
${data.useTopP ? `Top P: ${data.useTopPInput ? "(Using Input)" : data.top_p}` : `Temperature: ${data.useTemperatureInput ? "(Using Input)" : data.temperature}`}
|
|
13243
13418
|
Max Tokens: ${data.maxTokens}
|
|
@@ -13311,7 +13486,7 @@ var ChatAnthropicNodeImpl = {
|
|
|
13311
13486
|
},
|
|
13312
13487
|
getUIData() {
|
|
13313
13488
|
return {
|
|
13314
|
-
infoBoxBody:
|
|
13489
|
+
infoBoxBody: import_ts_dedent63.dedent`
|
|
13315
13490
|
Makes a call to an Anthropic chat model. The settings contains many options for tweaking the model's behavior.
|
|
13316
13491
|
`,
|
|
13317
13492
|
infoBoxTitle: "Chat (Anthropic) Node",
|
|
@@ -13740,8 +13915,8 @@ var anthropicPlugin = {
|
|
|
13740
13915
|
var anthropic_default = anthropicPlugin;
|
|
13741
13916
|
|
|
13742
13917
|
// src/plugins/autoevals/AutoEvalsNode.ts
|
|
13743
|
-
var
|
|
13744
|
-
var
|
|
13918
|
+
var import_non_secure71 = require("nanoid/non-secure");
|
|
13919
|
+
var import_ts_dedent64 = require("ts-dedent");
|
|
13745
13920
|
var import_autoevals = require("autoevals");
|
|
13746
13921
|
var import_ts_pattern12 = require("ts-pattern");
|
|
13747
13922
|
var options = [
|
|
@@ -13760,7 +13935,7 @@ var AutoEvalsNodeImpl = {
|
|
|
13760
13935
|
const chartNode = {
|
|
13761
13936
|
type: "autoevals",
|
|
13762
13937
|
title: "Autoevals",
|
|
13763
|
-
id: (0,
|
|
13938
|
+
id: (0, import_non_secure71.nanoid)(),
|
|
13764
13939
|
visualData: {
|
|
13765
13940
|
x: 0,
|
|
13766
13941
|
y: 0,
|
|
@@ -13875,7 +14050,7 @@ var AutoEvalsNodeImpl = {
|
|
|
13875
14050
|
},
|
|
13876
14051
|
getUIData() {
|
|
13877
14052
|
return {
|
|
13878
|
-
infoBoxBody:
|
|
14053
|
+
infoBoxBody: import_ts_dedent64.dedent`
|
|
13879
14054
|
Evaluates the validity of a response using the autoevals library.
|
|
13880
14055
|
`,
|
|
13881
14056
|
infoBoxTitle: "Autoevals Node",
|
|
@@ -13955,8 +14130,8 @@ var autoevalsPlugin = {
|
|
|
13955
14130
|
var autoevals_default = autoevalsPlugin;
|
|
13956
14131
|
|
|
13957
14132
|
// src/plugins/assemblyAi/LemurQaNode.ts
|
|
13958
|
-
var
|
|
13959
|
-
var
|
|
14133
|
+
var import_non_secure72 = require("nanoid/non-secure");
|
|
14134
|
+
var import_ts_dedent65 = require("ts-dedent");
|
|
13960
14135
|
|
|
13961
14136
|
// src/plugins/assemblyAi/lemurHelpers.ts
|
|
13962
14137
|
var import_assemblyai = require("assemblyai");
|
|
@@ -14076,7 +14251,7 @@ var LemurQaNodeImpl = {
|
|
|
14076
14251
|
const chartNode = {
|
|
14077
14252
|
type: "assemblyAiLemurQa",
|
|
14078
14253
|
title: "LeMUR Question & Answers",
|
|
14079
|
-
id: (0,
|
|
14254
|
+
id: (0, import_non_secure72.nanoid)(),
|
|
14080
14255
|
visualData: {
|
|
14081
14256
|
x: 0,
|
|
14082
14257
|
y: 0,
|
|
@@ -14142,7 +14317,7 @@ var LemurQaNodeImpl = {
|
|
|
14142
14317
|
},
|
|
14143
14318
|
getUIData() {
|
|
14144
14319
|
return {
|
|
14145
|
-
infoBoxBody:
|
|
14320
|
+
infoBoxBody: import_ts_dedent65.dedent`Use AssemblyAI LeMUR to ask questions about transcripts`,
|
|
14146
14321
|
infoBoxTitle: "Use AssemblyAI LeMUR Question & Answer",
|
|
14147
14322
|
contextMenuTitle: "LeMUR Q&A",
|
|
14148
14323
|
group: ["AI", "AssemblyAI"]
|
|
@@ -14214,14 +14389,14 @@ function applyQuestionEditors(data, question) {
|
|
|
14214
14389
|
var lemurQaNode = pluginNodeDefinition(LemurQaNodeImpl, "LeMUR Q&A");
|
|
14215
14390
|
|
|
14216
14391
|
// src/plugins/assemblyAi/TranscribeAudioNode.ts
|
|
14217
|
-
var
|
|
14218
|
-
var
|
|
14392
|
+
var import_non_secure73 = require("nanoid/non-secure");
|
|
14393
|
+
var import_ts_dedent66 = require("ts-dedent");
|
|
14219
14394
|
var TranscribeAudioNodeImpl = {
|
|
14220
14395
|
create() {
|
|
14221
14396
|
const chartNode = {
|
|
14222
14397
|
type: "assemblyAiTranscribeAudio",
|
|
14223
14398
|
title: "Transcribe Audio",
|
|
14224
|
-
id: (0,
|
|
14399
|
+
id: (0, import_non_secure73.nanoid)(),
|
|
14225
14400
|
visualData: {
|
|
14226
14401
|
x: 0,
|
|
14227
14402
|
y: 0,
|
|
@@ -14276,7 +14451,7 @@ var TranscribeAudioNodeImpl = {
|
|
|
14276
14451
|
},
|
|
14277
14452
|
getUIData() {
|
|
14278
14453
|
return {
|
|
14279
|
-
infoBoxBody:
|
|
14454
|
+
infoBoxBody: import_ts_dedent66.dedent`Use AssemblyAI to transcribe audio`,
|
|
14280
14455
|
infoBoxTitle: "Transcribe Audio Node",
|
|
14281
14456
|
contextMenuTitle: "Transcribe Audio",
|
|
14282
14457
|
group: ["AI", "AssemblyAI"]
|
|
@@ -14335,15 +14510,15 @@ function getAdditionalParameters(data) {
|
|
|
14335
14510
|
}
|
|
14336
14511
|
|
|
14337
14512
|
// src/plugins/assemblyAi/LemurSummaryNode.ts
|
|
14338
|
-
var
|
|
14339
|
-
var
|
|
14513
|
+
var import_non_secure74 = require("nanoid/non-secure");
|
|
14514
|
+
var import_ts_dedent67 = require("ts-dedent");
|
|
14340
14515
|
var import_assemblyai3 = require("assemblyai");
|
|
14341
14516
|
var LemurSummaryNodeImpl = {
|
|
14342
14517
|
create() {
|
|
14343
14518
|
const chartNode = {
|
|
14344
14519
|
type: "assemblyAiLemurSummary",
|
|
14345
14520
|
title: "LeMUR Summary",
|
|
14346
|
-
id: (0,
|
|
14521
|
+
id: (0, import_non_secure74.nanoid)(),
|
|
14347
14522
|
visualData: {
|
|
14348
14523
|
x: 0,
|
|
14349
14524
|
y: 0,
|
|
@@ -14389,7 +14564,7 @@ var LemurSummaryNodeImpl = {
|
|
|
14389
14564
|
},
|
|
14390
14565
|
getUIData() {
|
|
14391
14566
|
return {
|
|
14392
|
-
infoBoxBody:
|
|
14567
|
+
infoBoxBody: import_ts_dedent67.dedent`Use AssemblyAI LeMUR Summary to summarize transcripts`,
|
|
14393
14568
|
infoBoxTitle: "Use AssemblyAI LeMUR Summary",
|
|
14394
14569
|
contextMenuTitle: "LeMUR Summary",
|
|
14395
14570
|
group: ["AI", "AssemblyAI"]
|
|
@@ -14413,15 +14588,15 @@ var LemurSummaryNodeImpl = {
|
|
|
14413
14588
|
var lemurSummaryNode = pluginNodeDefinition(LemurSummaryNodeImpl, "LeMUR Summary");
|
|
14414
14589
|
|
|
14415
14590
|
// src/plugins/assemblyAi/LemurTaskNode.ts
|
|
14416
|
-
var
|
|
14417
|
-
var
|
|
14591
|
+
var import_non_secure75 = require("nanoid/non-secure");
|
|
14592
|
+
var import_ts_dedent68 = require("ts-dedent");
|
|
14418
14593
|
var import_assemblyai4 = require("assemblyai");
|
|
14419
14594
|
var LemurTaskNodeImpl = {
|
|
14420
14595
|
create() {
|
|
14421
14596
|
const chartNode = {
|
|
14422
14597
|
type: "assemblyAiLemurTask",
|
|
14423
14598
|
title: "LeMUR Task",
|
|
14424
|
-
id: (0,
|
|
14599
|
+
id: (0, import_non_secure75.nanoid)(),
|
|
14425
14600
|
visualData: {
|
|
14426
14601
|
x: 0,
|
|
14427
14602
|
y: 0,
|
|
@@ -14467,7 +14642,7 @@ var LemurTaskNodeImpl = {
|
|
|
14467
14642
|
},
|
|
14468
14643
|
getUIData() {
|
|
14469
14644
|
return {
|
|
14470
|
-
infoBoxBody:
|
|
14645
|
+
infoBoxBody: import_ts_dedent68.dedent`Use AssemblyAI LeMUR Custom Task to ask anything.`,
|
|
14471
14646
|
infoBoxTitle: "Use AssemblyAI LeMUR Custom Task",
|
|
14472
14647
|
contextMenuTitle: "LeMUR Custom Task",
|
|
14473
14648
|
group: ["AI", "AssemblyAI"]
|
|
@@ -14493,14 +14668,14 @@ var LemurTaskNodeImpl = {
|
|
|
14493
14668
|
var lemurTaskNode = pluginNodeDefinition(LemurTaskNodeImpl, "LeMUR Task");
|
|
14494
14669
|
|
|
14495
14670
|
// src/plugins/assemblyAi/LemurActionItemsNode.ts
|
|
14496
|
-
var
|
|
14497
|
-
var
|
|
14671
|
+
var import_non_secure76 = require("nanoid/non-secure");
|
|
14672
|
+
var import_ts_dedent69 = require("ts-dedent");
|
|
14498
14673
|
var LemurActionItemsNodeImpl = {
|
|
14499
14674
|
create() {
|
|
14500
14675
|
const chartNode = {
|
|
14501
14676
|
type: "assemblyAiLemurActionItems",
|
|
14502
14677
|
title: "LeMUR Action Items",
|
|
14503
|
-
id: (0,
|
|
14678
|
+
id: (0, import_non_secure76.nanoid)(),
|
|
14504
14679
|
visualData: {
|
|
14505
14680
|
x: 0,
|
|
14506
14681
|
y: 0,
|
|
@@ -14546,7 +14721,7 @@ var LemurActionItemsNodeImpl = {
|
|
|
14546
14721
|
},
|
|
14547
14722
|
getUIData() {
|
|
14548
14723
|
return {
|
|
14549
|
-
infoBoxBody:
|
|
14724
|
+
infoBoxBody: import_ts_dedent69.dedent`Use AssemblyAI LeMUR Action Items to extract action items`,
|
|
14550
14725
|
infoBoxTitle: "Use AssemblyAI LeMUR Action Items",
|
|
14551
14726
|
contextMenuTitle: "LeMUR Action Items",
|
|
14552
14727
|
group: ["AI", "AssemblyAI"]
|
|
@@ -14598,12 +14773,12 @@ var assemblyAiPlugin = {
|
|
|
14598
14773
|
var assemblyAi_default = assemblyAiPlugin;
|
|
14599
14774
|
|
|
14600
14775
|
// src/plugins/huggingface/nodes/ChatHuggingFace.ts
|
|
14601
|
-
var
|
|
14776
|
+
var import_non_secure77 = require("nanoid/non-secure");
|
|
14602
14777
|
var import_inference = require("@huggingface/inference");
|
|
14603
14778
|
var ChatHuggingFaceNodeImpl = {
|
|
14604
14779
|
create() {
|
|
14605
14780
|
return {
|
|
14606
|
-
id: (0,
|
|
14781
|
+
id: (0, import_non_secure77.nanoid)(),
|
|
14607
14782
|
type: "chatHuggingFace",
|
|
14608
14783
|
data: {
|
|
14609
14784
|
model: "",
|
|
@@ -14833,13 +15008,13 @@ var ChatHuggingFaceNodeImpl = {
|
|
|
14833
15008
|
var chatHuggingFaceNode = pluginNodeDefinition(ChatHuggingFaceNodeImpl, "Chat (Hugging Face)");
|
|
14834
15009
|
|
|
14835
15010
|
// src/plugins/huggingface/nodes/TextToImageHuggingFace.ts
|
|
14836
|
-
var
|
|
15011
|
+
var import_non_secure78 = require("nanoid/non-secure");
|
|
14837
15012
|
var import_inference2 = require("@huggingface/inference");
|
|
14838
|
-
var
|
|
15013
|
+
var import_ts_dedent70 = require("ts-dedent");
|
|
14839
15014
|
var TextToImageHuggingFaceNodeImpl = {
|
|
14840
15015
|
create() {
|
|
14841
15016
|
return {
|
|
14842
|
-
id: (0,
|
|
15017
|
+
id: (0, import_non_secure78.nanoid)(),
|
|
14843
15018
|
type: "textToImageHuggingFace",
|
|
14844
15019
|
data: {
|
|
14845
15020
|
model: "",
|
|
@@ -14980,7 +15155,7 @@ var TextToImageHuggingFaceNodeImpl = {
|
|
|
14980
15155
|
];
|
|
14981
15156
|
},
|
|
14982
15157
|
getBody(data) {
|
|
14983
|
-
return
|
|
15158
|
+
return import_ts_dedent70.dedent`
|
|
14984
15159
|
Model: ${data.useModelInput ? "(Using Input)" : data.model}
|
|
14985
15160
|
`;
|
|
14986
15161
|
},
|
|
@@ -17960,8 +18135,8 @@ async function* streamChatCompletions3({
|
|
|
17960
18135
|
}
|
|
17961
18136
|
|
|
17962
18137
|
// src/plugins/google/nodes/ChatGoogleNode.ts
|
|
17963
|
-
var
|
|
17964
|
-
var
|
|
18138
|
+
var import_non_secure79 = require("nanoid/non-secure");
|
|
18139
|
+
var import_ts_dedent71 = require("ts-dedent");
|
|
17965
18140
|
var import_p_retry3 = __toESM(require("p-retry-4"), 1);
|
|
17966
18141
|
var import_ts_pattern14 = require("ts-pattern");
|
|
17967
18142
|
var cache3 = /* @__PURE__ */ new Map();
|
|
@@ -17970,7 +18145,7 @@ var ChatGoogleNodeImpl = {
|
|
|
17970
18145
|
const chartNode = {
|
|
17971
18146
|
type: "chatGoogle",
|
|
17972
18147
|
title: "Chat (Google)",
|
|
17973
|
-
id: (0,
|
|
18148
|
+
id: (0, import_non_secure79.nanoid)(),
|
|
17974
18149
|
visualData: {
|
|
17975
18150
|
x: 0,
|
|
17976
18151
|
y: 0,
|
|
@@ -18063,7 +18238,7 @@ var ChatGoogleNodeImpl = {
|
|
|
18063
18238
|
},
|
|
18064
18239
|
getBody(data) {
|
|
18065
18240
|
var _a;
|
|
18066
|
-
return
|
|
18241
|
+
return import_ts_dedent71.dedent`
|
|
18067
18242
|
${((_a = googleModels[data.model]) == null ? void 0 : _a.displayName) ?? `Google (${data.model})`}
|
|
18068
18243
|
${data.useTopP ? `Top P: ${data.useTopPInput ? "(Using Input)" : data.top_p}` : `Temperature: ${data.useTemperatureInput ? "(Using Input)" : data.temperature}`}
|
|
18069
18244
|
Max Tokens: ${data.maxTokens}
|
|
@@ -18125,7 +18300,7 @@ var ChatGoogleNodeImpl = {
|
|
|
18125
18300
|
},
|
|
18126
18301
|
getUIData() {
|
|
18127
18302
|
return {
|
|
18128
|
-
infoBoxBody:
|
|
18303
|
+
infoBoxBody: import_ts_dedent71.dedent`
|
|
18129
18304
|
Makes a call to an Google chat model. The settings contains many options for tweaking the model's behavior.
|
|
18130
18305
|
`,
|
|
18131
18306
|
infoBoxTitle: "Chat (Google) Node",
|
|
@@ -18726,6 +18901,7 @@ var Rivet2 = void 0;
|
|
|
18726
18901
|
IfElseNodeImpl,
|
|
18727
18902
|
IfNodeImpl,
|
|
18728
18903
|
ImageNodeImpl,
|
|
18904
|
+
ImageToMDNodeImpl,
|
|
18729
18905
|
InMemoryDatasetProvider,
|
|
18730
18906
|
JoinNodeImpl,
|
|
18731
18907
|
ListGraphsNodeImpl,
|
|
@@ -18849,6 +19025,7 @@ var Rivet2 = void 0;
|
|
|
18849
19025
|
ifElseNode,
|
|
18850
19026
|
ifNode,
|
|
18851
19027
|
imageNode,
|
|
19028
|
+
imageToMDNode,
|
|
18852
19029
|
inferType,
|
|
18853
19030
|
isArrayDataType,
|
|
18854
19031
|
isArrayDataValue,
|