@valerypopoff/rivet2-core 2.1.0 → 2.1.2
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 +174 -36
- package/dist/cjs/bundle.cjs.map +3 -3
- package/dist/esm/api/processSettings.js +6 -1
- package/dist/esm/model/UiGraphRendererStyles.js +33 -0
- package/dist/esm/model/chat-v2/chatV2FeatureCompatibility.js +1 -1
- package/dist/esm/model/chat-v2/chatV2Outputs.js +11 -2
- package/dist/esm/model/chat-v2/chatV2Pipeline.js +3 -0
- package/dist/esm/model/chat-v2/chatV2ResponseFormat.js +4 -1
- package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +19 -14
- package/dist/esm/model/chat-v2/chatV2Shared.js +1 -1
- package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +5 -5
- package/dist/esm/model/chat-v2/llmChatV2NodeRuntime.js +8 -2
- package/dist/esm/model/chat-v2/providerOptions.js +63 -4
- package/dist/esm/model/nodes/LLMChatV2Node.js +4 -0
- package/dist/esm/model/nodes/NodePrefabInstanceNode.js +2 -2
- package/dist/esm/utils/getPluginConfig.js +15 -3
- package/dist/types/api/processSettings.d.ts +1 -1
- package/dist/types/model/Settings.d.ts +4 -0
- package/dist/types/model/UiGraphRendererStyles.d.ts +1 -1
- package/dist/types/model/chat-v2/chatV2FeatureCompatibility.d.ts +1 -1
- package/dist/types/model/chat-v2/chatV2Outputs.d.ts +4 -2
- package/dist/types/model/chat-v2/chatV2ResponseFormat.d.ts +1 -1
- package/dist/types/model/chat-v2/chatV2Types.d.ts +1 -0
- package/dist/types/model/chat-v2/providerOptions.d.ts +1 -0
- package/package.json +1 -1
package/dist/cjs/bundle.cjs
CHANGED
|
@@ -2129,6 +2129,15 @@ function cleanHeaders(headers) {
|
|
|
2129
2129
|
var import_ts_dedent = require("ts-dedent");
|
|
2130
2130
|
|
|
2131
2131
|
// src/utils/getPluginConfig.ts
|
|
2132
|
+
function getSharedLlmPluginConfig(plugin, settings, name) {
|
|
2133
|
+
if (plugin.id === "anthropic" && name === "anthropicApiKey") {
|
|
2134
|
+
return settings.anthropicApiKey;
|
|
2135
|
+
}
|
|
2136
|
+
if (plugin.id === "google" && name === "googleApiKey") {
|
|
2137
|
+
return settings.googleApiKey;
|
|
2138
|
+
}
|
|
2139
|
+
return void 0;
|
|
2140
|
+
}
|
|
2132
2141
|
function getPluginConfig(plugin, settings, name) {
|
|
2133
2142
|
var _a, _b, _c;
|
|
2134
2143
|
if (!plugin) {
|
|
@@ -2141,10 +2150,13 @@ function getPluginConfig(plugin, settings, name) {
|
|
|
2141
2150
|
const pluginSettings = (_b = settings.pluginSettings) == null ? void 0 : _b[plugin.id];
|
|
2142
2151
|
if (pluginSettings) {
|
|
2143
2152
|
const value = pluginSettings[name];
|
|
2144
|
-
if (
|
|
2145
|
-
return
|
|
2153
|
+
if (value && typeof value === "string") {
|
|
2154
|
+
return value;
|
|
2146
2155
|
}
|
|
2147
|
-
|
|
2156
|
+
}
|
|
2157
|
+
const sharedLlmValue = getSharedLlmPluginConfig(plugin, settings, name);
|
|
2158
|
+
if (sharedLlmValue) {
|
|
2159
|
+
return sharedLlmValue;
|
|
2148
2160
|
}
|
|
2149
2161
|
const envFallback = configSpec.pullEnvironmentVariable;
|
|
2150
2162
|
const envFallbackName = envFallback === true ? name : envFallback;
|
|
@@ -6342,6 +6354,39 @@ var RIVET_WEB_APP_RENDERER_CSS = `
|
|
|
6342
6354
|
color: var(--rivet-web-app-error-color);
|
|
6343
6355
|
font-weight: 700;
|
|
6344
6356
|
}
|
|
6357
|
+
|
|
6358
|
+
.rivet-web-app-modal-backdrop {
|
|
6359
|
+
position: fixed;
|
|
6360
|
+
inset: 0;
|
|
6361
|
+
z-index: 1000;
|
|
6362
|
+
display: grid;
|
|
6363
|
+
place-items: center;
|
|
6364
|
+
background: rgba(0, 0, 0, 0.46);
|
|
6365
|
+
background: color-mix(in srgb, var(--rivet-web-app-background) 78%, transparent);
|
|
6366
|
+
padding: 20px;
|
|
6367
|
+
}
|
|
6368
|
+
|
|
6369
|
+
.rivet-web-app-modal {
|
|
6370
|
+
display: grid;
|
|
6371
|
+
gap: 18px;
|
|
6372
|
+
width: min(420px, 100%);
|
|
6373
|
+
border: 1px solid var(--rivet-web-app-card-border);
|
|
6374
|
+
border-radius: 12px;
|
|
6375
|
+
background: var(--rivet-web-app-card-background);
|
|
6376
|
+
box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
|
|
6377
|
+
color: var(--rivet-web-app-foreground);
|
|
6378
|
+
padding: 22px;
|
|
6379
|
+
}
|
|
6380
|
+
|
|
6381
|
+
.rivet-web-app-modal-message {
|
|
6382
|
+
font-size: 18px;
|
|
6383
|
+
font-weight: 700;
|
|
6384
|
+
line-height: 1.3;
|
|
6385
|
+
}
|
|
6386
|
+
|
|
6387
|
+
.rivet-web-app-modal-button {
|
|
6388
|
+
justify-self: start;
|
|
6389
|
+
}
|
|
6345
6390
|
`;
|
|
6346
6391
|
var RIVET_WEB_APP_DOCUMENT_CSS = `
|
|
6347
6392
|
html,
|
|
@@ -9043,7 +9088,7 @@ function createChatV2CommonNodeData(overrides = {}) {
|
|
|
9043
9088
|
useModelInput: false,
|
|
9044
9089
|
temperature: 0.5,
|
|
9045
9090
|
useTemperatureInput: false,
|
|
9046
|
-
topP:
|
|
9091
|
+
topP: void 0,
|
|
9047
9092
|
useTopPInput: false,
|
|
9048
9093
|
topK: void 0,
|
|
9049
9094
|
useTopKInput: false,
|
|
@@ -10005,6 +10050,57 @@ function openAIBaseURLToEndpoint(baseURL) {
|
|
|
10005
10050
|
return `${normalizedBaseURL}/chat/completions`;
|
|
10006
10051
|
}
|
|
10007
10052
|
}
|
|
10053
|
+
function parseBodyText(text) {
|
|
10054
|
+
try {
|
|
10055
|
+
return JSON.parse(text);
|
|
10056
|
+
} catch {
|
|
10057
|
+
return text;
|
|
10058
|
+
}
|
|
10059
|
+
}
|
|
10060
|
+
function parseFetchBody(body) {
|
|
10061
|
+
if (body == null) {
|
|
10062
|
+
return void 0;
|
|
10063
|
+
}
|
|
10064
|
+
if (typeof body === "string") {
|
|
10065
|
+
return parseBodyText(body);
|
|
10066
|
+
}
|
|
10067
|
+
if (body instanceof URLSearchParams) {
|
|
10068
|
+
return Object.fromEntries(body.entries());
|
|
10069
|
+
}
|
|
10070
|
+
if (body instanceof ArrayBuffer) {
|
|
10071
|
+
return parseBodyText(new TextDecoder().decode(body));
|
|
10072
|
+
}
|
|
10073
|
+
if (ArrayBuffer.isView(body)) {
|
|
10074
|
+
return parseBodyText(new TextDecoder().decode(body));
|
|
10075
|
+
}
|
|
10076
|
+
return void 0;
|
|
10077
|
+
}
|
|
10078
|
+
function cloneCapturedRequestBody(body) {
|
|
10079
|
+
if (typeof structuredClone === "function") {
|
|
10080
|
+
try {
|
|
10081
|
+
return structuredClone(body);
|
|
10082
|
+
} catch {
|
|
10083
|
+
}
|
|
10084
|
+
}
|
|
10085
|
+
try {
|
|
10086
|
+
return JSON.parse(JSON.stringify(body));
|
|
10087
|
+
} catch {
|
|
10088
|
+
return body;
|
|
10089
|
+
}
|
|
10090
|
+
}
|
|
10091
|
+
function createRequestBodyCapturingFetch(onRequestBody) {
|
|
10092
|
+
return async (input, init2) => {
|
|
10093
|
+
const body = parseFetchBody(init2 == null ? void 0 : init2.body);
|
|
10094
|
+
if (body !== void 0) {
|
|
10095
|
+
onRequestBody(cloneCapturedRequestBody(body));
|
|
10096
|
+
}
|
|
10097
|
+
const nativeFetch = globalThis.fetch;
|
|
10098
|
+
return nativeFetch(input, init2);
|
|
10099
|
+
};
|
|
10100
|
+
}
|
|
10101
|
+
function maybeCreateRequestBodyCapturingFetch(options2) {
|
|
10102
|
+
return options2.onRequestBody == null ? void 0 : createRequestBodyCapturingFetch(options2.onRequestBody);
|
|
10103
|
+
}
|
|
10008
10104
|
async function resolveChatV2ProviderConfig(provider, modelId, context, options2 = {}) {
|
|
10009
10105
|
var _a;
|
|
10010
10106
|
const headers = cleanHeaders({
|
|
@@ -10055,26 +10151,29 @@ function createChatV2Model(provider, modelId, context, options2 = {}) {
|
|
|
10055
10151
|
switch (provider) {
|
|
10056
10152
|
case "openai": {
|
|
10057
10153
|
const providerInstance = (0, import_openai3.createOpenAI)({
|
|
10058
|
-
apiKey: options2.apiKey || context.settings.openAiKey || void 0,
|
|
10154
|
+
apiKey: options2.apiKey || context.settings.openAiApiKey || context.settings.openAiKey || void 0,
|
|
10059
10155
|
organization: context.settings.openAiOrganization || void 0,
|
|
10060
10156
|
baseURL: options2.baseURL || void 0,
|
|
10061
|
-
headers: options2.headers
|
|
10157
|
+
headers: options2.headers,
|
|
10158
|
+
fetch: maybeCreateRequestBodyCapturingFetch(options2)
|
|
10062
10159
|
});
|
|
10063
10160
|
return providerInstance.responses(modelId);
|
|
10064
10161
|
}
|
|
10065
10162
|
case "anthropic": {
|
|
10066
10163
|
const providerInstance = (0, import_anthropic2.createAnthropic)({
|
|
10067
|
-
apiKey: options2.apiKey || context.getPluginConfig("anthropicApiKey") || void 0,
|
|
10164
|
+
apiKey: options2.apiKey || context.settings.anthropicApiKey || context.getPluginConfig("anthropicApiKey") || void 0,
|
|
10068
10165
|
baseURL: options2.baseURL || context.getPluginConfig("anthropicApiEndpoint") || void 0,
|
|
10069
|
-
headers: options2.headers
|
|
10166
|
+
headers: options2.headers,
|
|
10167
|
+
fetch: maybeCreateRequestBodyCapturingFetch(options2)
|
|
10070
10168
|
});
|
|
10071
10169
|
return providerInstance.messages(modelId);
|
|
10072
10170
|
}
|
|
10073
10171
|
case "google": {
|
|
10074
10172
|
const providerInstance = (0, import_google2.createGoogleGenerativeAI)({
|
|
10075
|
-
apiKey: options2.apiKey || context.getPluginConfig("googleApiKey") || void 0,
|
|
10173
|
+
apiKey: options2.apiKey || context.settings.googleApiKey || context.getPluginConfig("googleApiKey") || void 0,
|
|
10076
10174
|
baseURL: options2.baseURL || void 0,
|
|
10077
|
-
headers: options2.headers
|
|
10175
|
+
headers: options2.headers,
|
|
10176
|
+
fetch: maybeCreateRequestBodyCapturingFetch(options2)
|
|
10078
10177
|
});
|
|
10079
10178
|
return providerInstance.chat(modelId);
|
|
10080
10179
|
}
|
|
@@ -10087,7 +10186,8 @@ function createChatV2Model(provider, modelId, context, options2 = {}) {
|
|
|
10087
10186
|
apiKey: options2.apiKey,
|
|
10088
10187
|
baseURL: options2.baseURL,
|
|
10089
10188
|
headers: options2.headers,
|
|
10090
|
-
includeUsage:
|
|
10189
|
+
includeUsage: false,
|
|
10190
|
+
fetch: maybeCreateRequestBodyCapturingFetch(options2)
|
|
10091
10191
|
});
|
|
10092
10192
|
const model = providerInstance.chatModel(modelId);
|
|
10093
10193
|
model.supportsStructuredOutputs = true;
|
|
@@ -10399,7 +10499,7 @@ function getResponseFormatEditors() {
|
|
|
10399
10499
|
options: [
|
|
10400
10500
|
{ value: "", label: "Default" },
|
|
10401
10501
|
{ value: "text", label: "Text" },
|
|
10402
|
-
{ value: "json", label: "JSON" },
|
|
10502
|
+
{ value: "json", label: "JSON object" },
|
|
10403
10503
|
{ value: "json_schema", label: "JSON schema" }
|
|
10404
10504
|
],
|
|
10405
10505
|
defaultValue: "",
|
|
@@ -10411,7 +10511,7 @@ function getResponseFormatEditors() {
|
|
|
10411
10511
|
dataKey: "responseSchemaName",
|
|
10412
10512
|
useInputToggleDataKey: "useResponseSchemaNameInput",
|
|
10413
10513
|
placeholder: "response_schema",
|
|
10414
|
-
helperMessage: "Optional name passed to the provider for JSON or JSON schema responses.",
|
|
10514
|
+
helperMessage: "Optional name passed to the provider for JSON object or JSON schema responses.",
|
|
10415
10515
|
hideIf: (data) => data.responseFormat !== "json" && data.responseFormat !== "json_schema"
|
|
10416
10516
|
},
|
|
10417
10517
|
{
|
|
@@ -10419,7 +10519,7 @@ function getResponseFormatEditors() {
|
|
|
10419
10519
|
label: "Schema description",
|
|
10420
10520
|
dataKey: "responseSchemaDescription",
|
|
10421
10521
|
useInputToggleDataKey: "useResponseSchemaDescriptionInput",
|
|
10422
|
-
helperMessage: "Optional description passed to the provider for JSON or JSON schema responses.",
|
|
10522
|
+
helperMessage: "Optional description passed to the provider for JSON object or JSON schema responses.",
|
|
10423
10523
|
hideIf: (data) => data.responseFormat !== "json" && data.responseFormat !== "json_schema"
|
|
10424
10524
|
}
|
|
10425
10525
|
]);
|
|
@@ -10558,9 +10658,9 @@ function getTechnicalDetailsEditors() {
|
|
|
10558
10658
|
},
|
|
10559
10659
|
{
|
|
10560
10660
|
type: "toggle",
|
|
10561
|
-
label: "Output request
|
|
10661
|
+
label: "Output request details",
|
|
10562
10662
|
dataKey: "outputRequestStatus",
|
|
10563
|
-
helperMessage: "Adds Response Status
|
|
10663
|
+
helperMessage: "Adds Response Status, Response Error, and LLM request body outputs. Retry mode changes status/error to per-attempt arrays, and LLM request body becomes an array when multiple provider calls are made."
|
|
10564
10664
|
}
|
|
10565
10665
|
]);
|
|
10566
10666
|
}
|
|
@@ -10709,7 +10809,7 @@ function resolveChatV2ResponseFormatParameters(data, inputs) {
|
|
|
10709
10809
|
schemaDescription
|
|
10710
10810
|
};
|
|
10711
10811
|
}
|
|
10712
|
-
function createChatV2ResponseOutput(parameters) {
|
|
10812
|
+
function createChatV2ResponseOutput(parameters, provider) {
|
|
10713
10813
|
if (parameters == null) {
|
|
10714
10814
|
return void 0;
|
|
10715
10815
|
}
|
|
@@ -10717,6 +10817,9 @@ function createChatV2ResponseOutput(parameters) {
|
|
|
10717
10817
|
return import_ai.Output.text();
|
|
10718
10818
|
}
|
|
10719
10819
|
if (parameters.responseFormat === "json") {
|
|
10820
|
+
if (provider === "custom") {
|
|
10821
|
+
return void 0;
|
|
10822
|
+
}
|
|
10720
10823
|
return import_ai.Output.json({
|
|
10721
10824
|
name: parameters.schemaName,
|
|
10722
10825
|
description: parameters.schemaDescription
|
|
@@ -10770,7 +10873,7 @@ var LLM_CHAT_V2_TOOL_RESPONSE_FORMAT_CONFLICT_COPY = {
|
|
|
10770
10873
|
title: '"Tool use" conflicts with "Structured outputs"',
|
|
10771
10874
|
paragraphs: [
|
|
10772
10875
|
'"Tool use" and "Structured outputs" cannot be used at the same time.',
|
|
10773
|
-
'Use "Tool use" with Default/Text response format, or turn "Tool use" off before choosing JSON/JSON schema.'
|
|
10876
|
+
'Use "Tool use" with Default/Text response format, or turn "Tool use" off before choosing JSON object/JSON schema.'
|
|
10774
10877
|
]
|
|
10775
10878
|
};
|
|
10776
10879
|
function isLLMChatV2StructuredResponseFormat(responseFormat) {
|
|
@@ -10902,25 +11005,30 @@ function resolveConfiguredProviderApiKey(data, context) {
|
|
|
10902
11005
|
var _a, _b, _c;
|
|
10903
11006
|
switch (data.provider) {
|
|
10904
11007
|
case "openai":
|
|
10905
|
-
return context.settings.openAiKey || void 0;
|
|
11008
|
+
return context.settings.openAiApiKey || context.settings.openAiKey || void 0;
|
|
10906
11009
|
case "anthropic":
|
|
10907
|
-
return context.getPluginConfig("anthropicApiKey") || void 0;
|
|
11010
|
+
return context.settings.anthropicApiKey || context.getPluginConfig("anthropicApiKey") || void 0;
|
|
10908
11011
|
case "google":
|
|
10909
|
-
return context.getPluginConfig("googleApiKey") || void 0;
|
|
11012
|
+
return context.settings.googleApiKey || context.getPluginConfig("googleApiKey") || void 0;
|
|
10910
11013
|
case "custom": {
|
|
10911
11014
|
const envVarName = (_a = data.customProviderApiKeyEnvVarName) == null ? void 0 : _a.trim();
|
|
10912
|
-
if (
|
|
10913
|
-
|
|
11015
|
+
if (envVarName) {
|
|
11016
|
+
const pluginEnvValue = (_b = context.settings.pluginEnv) == null ? void 0 : _b[envVarName];
|
|
11017
|
+
const processEnv = (_c = globalThis.process) == null ? void 0 : _c.env;
|
|
11018
|
+
const apiKey = pluginEnvValue || (processEnv == null ? void 0 : processEnv[envVarName]);
|
|
11019
|
+
if (apiKey) {
|
|
11020
|
+
return apiKey;
|
|
11021
|
+
}
|
|
10914
11022
|
}
|
|
10915
|
-
|
|
10916
|
-
|
|
10917
|
-
|
|
10918
|
-
if (
|
|
11023
|
+
if (context.settings.customAiApiKey) {
|
|
11024
|
+
return context.settings.customAiApiKey;
|
|
11025
|
+
}
|
|
11026
|
+
if (envVarName) {
|
|
10919
11027
|
throw new Error(
|
|
10920
|
-
`Custom provider API key env var ${envVarName} is not set. Use Input port or configure the environment variable.`
|
|
11028
|
+
`Custom provider API key env var ${envVarName} is not set. Use Input port, configure Settings > LLM, or configure the environment variable.`
|
|
10921
11029
|
);
|
|
10922
11030
|
}
|
|
10923
|
-
return
|
|
11031
|
+
return void 0;
|
|
10924
11032
|
}
|
|
10925
11033
|
}
|
|
10926
11034
|
}
|
|
@@ -11078,7 +11186,7 @@ function resolveLLMChatV2BuiltInTools(data, context, config, apiKey) {
|
|
|
11078
11186
|
return void 0;
|
|
11079
11187
|
}
|
|
11080
11188
|
const provider = (0, import_openai4.createOpenAI)({
|
|
11081
|
-
apiKey: apiKey || context.settings.openAiKey || void 0,
|
|
11189
|
+
apiKey: apiKey || context.settings.openAiApiKey || context.settings.openAiKey || void 0,
|
|
11082
11190
|
organization: context.settings.openAiOrganization || void 0,
|
|
11083
11191
|
baseURL: config.baseURL,
|
|
11084
11192
|
headers: config.headers
|
|
@@ -11099,7 +11207,7 @@ function resolveLLMChatV2BuiltInTools(data, context, config, apiKey) {
|
|
|
11099
11207
|
return void 0;
|
|
11100
11208
|
}
|
|
11101
11209
|
const provider = (0, import_google3.createGoogleGenerativeAI)({
|
|
11102
|
-
apiKey: apiKey || context.getPluginConfig("googleApiKey") || void 0,
|
|
11210
|
+
apiKey: apiKey || context.settings.googleApiKey || context.getPluginConfig("googleApiKey") || void 0,
|
|
11103
11211
|
baseURL: config.baseURL,
|
|
11104
11212
|
headers: config.headers
|
|
11105
11213
|
});
|
|
@@ -11134,11 +11242,16 @@ async function resolveLLMChatV2RuntimeConfig(params) {
|
|
|
11134
11242
|
const baseURL = resolveLLMChatV2BaseURL(data, inputs);
|
|
11135
11243
|
const nodeHeaders = resolveLLMChatV2Headers(data, inputs);
|
|
11136
11244
|
const apiKey = resolveLLMChatV2ApiKey(data, inputs, context);
|
|
11245
|
+
const requestBodies = data.outputRequestStatus ? [] : void 0;
|
|
11137
11246
|
const providerConfig = await resolveChatV2ProviderConfig(provider, modelId, context, {
|
|
11138
11247
|
baseURL,
|
|
11139
11248
|
headers: nodeHeaders
|
|
11140
11249
|
});
|
|
11141
|
-
const model = createChatV2Model(provider, modelId, context, {
|
|
11250
|
+
const model = createChatV2Model(provider, modelId, context, {
|
|
11251
|
+
...providerConfig,
|
|
11252
|
+
apiKey,
|
|
11253
|
+
onRequestBody: requestBodies == null ? void 0 : (body) => requestBodies.push(body)
|
|
11254
|
+
});
|
|
11142
11255
|
const prompt = inputs["prompt"];
|
|
11143
11256
|
const systemPrompt = inputs["systemPrompt"];
|
|
11144
11257
|
const functions = data.useToolCalling && inputs["functions"] != null ? coerceTypeOptional(inputs["functions"], "gpt-function[]") : void 0;
|
|
@@ -11159,7 +11272,7 @@ async function resolveLLMChatV2RuntimeConfig(params) {
|
|
|
11159
11272
|
functions,
|
|
11160
11273
|
additionalTools: resolveLLMChatV2BuiltInTools(data, context, providerConfig, apiKey),
|
|
11161
11274
|
...generationParameters,
|
|
11162
|
-
responseOutput: createChatV2ResponseOutput(responseFormatParameters),
|
|
11275
|
+
responseOutput: createChatV2ResponseOutput(responseFormatParameters, provider),
|
|
11163
11276
|
responseFormat: responseFormatParameters == null ? void 0 : responseFormatParameters.responseFormat,
|
|
11164
11277
|
outputUsage: data.outputUsage,
|
|
11165
11278
|
outputReasoning: data.outputReasoning,
|
|
@@ -11169,6 +11282,7 @@ async function resolveLLMChatV2RuntimeConfig(params) {
|
|
|
11169
11282
|
providerOptions,
|
|
11170
11283
|
toolChoice,
|
|
11171
11284
|
anthropicCacheControlTtl: provider === "anthropic" ? data.anthropicCacheControlTtl || void 0 : void 0,
|
|
11285
|
+
requestBodies,
|
|
11172
11286
|
retryOnNon200: data.retryOnNon200,
|
|
11173
11287
|
retryOnNon200RepeatTimes: data.retryOnNon200RepeatTimes,
|
|
11174
11288
|
retryOnNon200CooldownMs: data.retryOnNon200CooldownMs,
|
|
@@ -11938,6 +12052,7 @@ function normalizeChatV2ProviderError(error, context) {
|
|
|
11938
12052
|
// src/model/chat-v2/chatV2Outputs.ts
|
|
11939
12053
|
var CHAT_V2_REQUEST_STATUS_PORT_ID = "requestStatus";
|
|
11940
12054
|
var CHAT_V2_REQUEST_ERROR_PORT_ID = "requestError";
|
|
12055
|
+
var CHAT_V2_REQUEST_BODY_PORT_ID = "requestBody";
|
|
11941
12056
|
function toFunctionCallOutputValue(functionCall) {
|
|
11942
12057
|
let argumentsValue = functionCall.lastParsedArguments;
|
|
11943
12058
|
if (argumentsValue == null) {
|
|
@@ -12006,6 +12121,12 @@ function createChatV2ReasoningOutput(reasoning) {
|
|
|
12006
12121
|
value: reasoningText
|
|
12007
12122
|
} : createControlFlowExcludedOutput();
|
|
12008
12123
|
}
|
|
12124
|
+
function createChatV2RequestBodyOutput(requestBodies) {
|
|
12125
|
+
if (requestBodies == null || requestBodies.length === 0) {
|
|
12126
|
+
return createControlFlowExcludedOutput();
|
|
12127
|
+
}
|
|
12128
|
+
return inferType(requestBodies.length === 1 ? requestBodies[0] : requestBodies);
|
|
12129
|
+
}
|
|
12009
12130
|
function createChatV2RetryAttemptOutput(type, values2) {
|
|
12010
12131
|
return values2.length > 0 ? {
|
|
12011
12132
|
type,
|
|
@@ -12023,6 +12144,7 @@ function createChatV2CommonOutputs({
|
|
|
12023
12144
|
responseError,
|
|
12024
12145
|
requestStatuses,
|
|
12025
12146
|
requestErrors,
|
|
12147
|
+
requestBodies,
|
|
12026
12148
|
outputUsage,
|
|
12027
12149
|
outputReasoning,
|
|
12028
12150
|
outputRequestStatus,
|
|
@@ -12080,6 +12202,7 @@ function createChatV2CommonOutputs({
|
|
|
12080
12202
|
value: responseError
|
|
12081
12203
|
} : createControlFlowExcludedOutput();
|
|
12082
12204
|
}
|
|
12205
|
+
outputs[CHAT_V2_REQUEST_BODY_PORT_ID] = createChatV2RequestBodyOutput(requestBodies);
|
|
12083
12206
|
}
|
|
12084
12207
|
return outputs;
|
|
12085
12208
|
}
|
|
@@ -12089,6 +12212,7 @@ function createChatV2ProviderFailureOutputs({
|
|
|
12089
12212
|
responseError,
|
|
12090
12213
|
requestStatuses,
|
|
12091
12214
|
requestErrors,
|
|
12215
|
+
requestBodies,
|
|
12092
12216
|
outputUsage,
|
|
12093
12217
|
outputReasoning,
|
|
12094
12218
|
includeFunctionCalls,
|
|
@@ -12117,6 +12241,7 @@ function createChatV2ProviderFailureOutputs({
|
|
|
12117
12241
|
},
|
|
12118
12242
|
["responseTokens"]: createControlFlowExcludedOutput()
|
|
12119
12243
|
};
|
|
12244
|
+
outputs[CHAT_V2_REQUEST_BODY_PORT_ID] = createChatV2RequestBodyOutput(requestBodies);
|
|
12120
12245
|
if (includeFunctionCalls) {
|
|
12121
12246
|
outputs["function-calls"] = createControlFlowExcludedOutput();
|
|
12122
12247
|
}
|
|
@@ -12217,6 +12342,7 @@ function buildProviderFailureResult(requestMessages, options2, normalizedError,
|
|
|
12217
12342
|
responseError,
|
|
12218
12343
|
requestStatuses: retryRequestStatuses,
|
|
12219
12344
|
requestErrors: retryRequestErrors,
|
|
12345
|
+
requestBodies: options2.requestBodies,
|
|
12220
12346
|
outputUsage: options2.outputUsage,
|
|
12221
12347
|
outputReasoning: options2.outputReasoning,
|
|
12222
12348
|
includeFunctionCalls: options2.includeFunctionCalls,
|
|
@@ -12288,6 +12414,7 @@ async function runChatV2Pipeline(options2) {
|
|
|
12288
12414
|
responseError: void 0,
|
|
12289
12415
|
requestStatuses: [],
|
|
12290
12416
|
requestErrors: [],
|
|
12417
|
+
requestBodies: void 0,
|
|
12291
12418
|
outputUsage: false,
|
|
12292
12419
|
outputReasoning: false,
|
|
12293
12420
|
outputRequestStatus: false,
|
|
@@ -12342,6 +12469,7 @@ async function runChatV2Pipeline(options2) {
|
|
|
12342
12469
|
responseError,
|
|
12343
12470
|
requestStatuses,
|
|
12344
12471
|
requestErrors,
|
|
12472
|
+
requestBodies: options2.requestBodies,
|
|
12345
12473
|
outputUsage: options2.outputUsage,
|
|
12346
12474
|
outputReasoning: options2.outputReasoning,
|
|
12347
12475
|
outputRequestStatus: options2.outputRequestStatus,
|
|
@@ -12812,6 +12940,11 @@ var LLMChatV2NodeImpl = class extends NodeImpl {
|
|
|
12812
12940
|
id: "requestError",
|
|
12813
12941
|
title: "Response Error",
|
|
12814
12942
|
dataType: this.data.retryOnNon200 ? "string[]" : "string"
|
|
12943
|
+
},
|
|
12944
|
+
{
|
|
12945
|
+
id: "requestBody",
|
|
12946
|
+
title: "LLM request body",
|
|
12947
|
+
dataType: ["object", "object[]", "string", "string[]", "any", "any[]"]
|
|
12815
12948
|
}
|
|
12816
12949
|
);
|
|
12817
12950
|
}
|
|
@@ -24894,13 +25027,13 @@ var NodePrefabInstanceNodeImpl = class extends NodeImpl {
|
|
|
24894
25027
|
return [];
|
|
24895
25028
|
}
|
|
24896
25029
|
async process(_inputData) {
|
|
24897
|
-
throw new Error("Library node is missing. Open the Node
|
|
25030
|
+
throw new Error("Library node is missing. Open the Node library and reconnect this linked node.");
|
|
24898
25031
|
}
|
|
24899
25032
|
static getUIData() {
|
|
24900
25033
|
return {
|
|
24901
25034
|
contextMenuTitle: "Linked node",
|
|
24902
25035
|
infoBoxTitle: "Linked node",
|
|
24903
|
-
infoBoxBody: "Runs a node from the project Node
|
|
25036
|
+
infoBoxBody: "Runs a node from the project Node library.",
|
|
24904
25037
|
group: "Advanced"
|
|
24905
25038
|
};
|
|
24906
25039
|
}
|
|
@@ -31444,8 +31577,13 @@ function getSingleNodeStream(processor, nodeIdOrTitle) {
|
|
|
31444
31577
|
|
|
31445
31578
|
// src/api/processSettings.ts
|
|
31446
31579
|
function resolveProcessSettings(settings = {}, fallbacks = {}) {
|
|
31580
|
+
const openAiApiKey = settings.openAiApiKey || settings.openAiKey || fallbacks.openAiApiKey || fallbacks.openAiKey || "";
|
|
31447
31581
|
return {
|
|
31448
|
-
|
|
31582
|
+
openAiApiKey,
|
|
31583
|
+
openAiKey: openAiApiKey,
|
|
31584
|
+
anthropicApiKey: settings.anthropicApiKey || fallbacks.anthropicApiKey || "",
|
|
31585
|
+
googleApiKey: settings.googleApiKey || fallbacks.googleApiKey || "",
|
|
31586
|
+
customAiApiKey: settings.customAiApiKey || fallbacks.customAiApiKey || "",
|
|
31449
31587
|
openAiOrganization: settings.openAiOrganization ?? fallbacks.openAiOrganization ?? "",
|
|
31450
31588
|
openAiEndpoint: settings.openAiEndpoint ?? fallbacks.openAiEndpoint ?? "",
|
|
31451
31589
|
pluginEnv: settings.pluginEnv ?? fallbacks.pluginEnv ?? {},
|