@valerypopoff/rivet2-core 2.1.1 → 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 +42 -20
- package/dist/cjs/bundle.cjs.map +2 -2
- package/dist/esm/api/processSettings.js +6 -1
- package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +19 -14
- package/dist/esm/model/chat-v2/providerOptions.js +3 -3
- 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/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;
|
|
@@ -10139,7 +10151,7 @@ function createChatV2Model(provider, modelId, context, options2 = {}) {
|
|
|
10139
10151
|
switch (provider) {
|
|
10140
10152
|
case "openai": {
|
|
10141
10153
|
const providerInstance = (0, import_openai3.createOpenAI)({
|
|
10142
|
-
apiKey: options2.apiKey || context.settings.openAiKey || void 0,
|
|
10154
|
+
apiKey: options2.apiKey || context.settings.openAiApiKey || context.settings.openAiKey || void 0,
|
|
10143
10155
|
organization: context.settings.openAiOrganization || void 0,
|
|
10144
10156
|
baseURL: options2.baseURL || void 0,
|
|
10145
10157
|
headers: options2.headers,
|
|
@@ -10149,7 +10161,7 @@ function createChatV2Model(provider, modelId, context, options2 = {}) {
|
|
|
10149
10161
|
}
|
|
10150
10162
|
case "anthropic": {
|
|
10151
10163
|
const providerInstance = (0, import_anthropic2.createAnthropic)({
|
|
10152
|
-
apiKey: options2.apiKey || context.getPluginConfig("anthropicApiKey") || void 0,
|
|
10164
|
+
apiKey: options2.apiKey || context.settings.anthropicApiKey || context.getPluginConfig("anthropicApiKey") || void 0,
|
|
10153
10165
|
baseURL: options2.baseURL || context.getPluginConfig("anthropicApiEndpoint") || void 0,
|
|
10154
10166
|
headers: options2.headers,
|
|
10155
10167
|
fetch: maybeCreateRequestBodyCapturingFetch(options2)
|
|
@@ -10158,7 +10170,7 @@ function createChatV2Model(provider, modelId, context, options2 = {}) {
|
|
|
10158
10170
|
}
|
|
10159
10171
|
case "google": {
|
|
10160
10172
|
const providerInstance = (0, import_google2.createGoogleGenerativeAI)({
|
|
10161
|
-
apiKey: options2.apiKey || context.getPluginConfig("googleApiKey") || void 0,
|
|
10173
|
+
apiKey: options2.apiKey || context.settings.googleApiKey || context.getPluginConfig("googleApiKey") || void 0,
|
|
10162
10174
|
baseURL: options2.baseURL || void 0,
|
|
10163
10175
|
headers: options2.headers,
|
|
10164
10176
|
fetch: maybeCreateRequestBodyCapturingFetch(options2)
|
|
@@ -10993,25 +11005,30 @@ function resolveConfiguredProviderApiKey(data, context) {
|
|
|
10993
11005
|
var _a, _b, _c;
|
|
10994
11006
|
switch (data.provider) {
|
|
10995
11007
|
case "openai":
|
|
10996
|
-
return context.settings.openAiKey || void 0;
|
|
11008
|
+
return context.settings.openAiApiKey || context.settings.openAiKey || void 0;
|
|
10997
11009
|
case "anthropic":
|
|
10998
|
-
return context.getPluginConfig("anthropicApiKey") || void 0;
|
|
11010
|
+
return context.settings.anthropicApiKey || context.getPluginConfig("anthropicApiKey") || void 0;
|
|
10999
11011
|
case "google":
|
|
11000
|
-
return context.getPluginConfig("googleApiKey") || void 0;
|
|
11012
|
+
return context.settings.googleApiKey || context.getPluginConfig("googleApiKey") || void 0;
|
|
11001
11013
|
case "custom": {
|
|
11002
11014
|
const envVarName = (_a = data.customProviderApiKeyEnvVarName) == null ? void 0 : _a.trim();
|
|
11003
|
-
if (
|
|
11004
|
-
|
|
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
|
+
}
|
|
11022
|
+
}
|
|
11023
|
+
if (context.settings.customAiApiKey) {
|
|
11024
|
+
return context.settings.customAiApiKey;
|
|
11005
11025
|
}
|
|
11006
|
-
|
|
11007
|
-
const processEnv = (_c = globalThis.process) == null ? void 0 : _c.env;
|
|
11008
|
-
const apiKey = pluginEnvValue || (processEnv == null ? void 0 : processEnv[envVarName]);
|
|
11009
|
-
if (!apiKey) {
|
|
11026
|
+
if (envVarName) {
|
|
11010
11027
|
throw new Error(
|
|
11011
|
-
`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.`
|
|
11012
11029
|
);
|
|
11013
11030
|
}
|
|
11014
|
-
return
|
|
11031
|
+
return void 0;
|
|
11015
11032
|
}
|
|
11016
11033
|
}
|
|
11017
11034
|
}
|
|
@@ -11169,7 +11186,7 @@ function resolveLLMChatV2BuiltInTools(data, context, config, apiKey) {
|
|
|
11169
11186
|
return void 0;
|
|
11170
11187
|
}
|
|
11171
11188
|
const provider = (0, import_openai4.createOpenAI)({
|
|
11172
|
-
apiKey: apiKey || context.settings.openAiKey || void 0,
|
|
11189
|
+
apiKey: apiKey || context.settings.openAiApiKey || context.settings.openAiKey || void 0,
|
|
11173
11190
|
organization: context.settings.openAiOrganization || void 0,
|
|
11174
11191
|
baseURL: config.baseURL,
|
|
11175
11192
|
headers: config.headers
|
|
@@ -11190,7 +11207,7 @@ function resolveLLMChatV2BuiltInTools(data, context, config, apiKey) {
|
|
|
11190
11207
|
return void 0;
|
|
11191
11208
|
}
|
|
11192
11209
|
const provider = (0, import_google3.createGoogleGenerativeAI)({
|
|
11193
|
-
apiKey: apiKey || context.getPluginConfig("googleApiKey") || void 0,
|
|
11210
|
+
apiKey: apiKey || context.settings.googleApiKey || context.getPluginConfig("googleApiKey") || void 0,
|
|
11194
11211
|
baseURL: config.baseURL,
|
|
11195
11212
|
headers: config.headers
|
|
11196
11213
|
});
|
|
@@ -31560,8 +31577,13 @@ function getSingleNodeStream(processor, nodeIdOrTitle) {
|
|
|
31560
31577
|
|
|
31561
31578
|
// src/api/processSettings.ts
|
|
31562
31579
|
function resolveProcessSettings(settings = {}, fallbacks = {}) {
|
|
31580
|
+
const openAiApiKey = settings.openAiApiKey || settings.openAiKey || fallbacks.openAiApiKey || fallbacks.openAiKey || "";
|
|
31563
31581
|
return {
|
|
31564
|
-
|
|
31582
|
+
openAiApiKey,
|
|
31583
|
+
openAiKey: openAiApiKey,
|
|
31584
|
+
anthropicApiKey: settings.anthropicApiKey || fallbacks.anthropicApiKey || "",
|
|
31585
|
+
googleApiKey: settings.googleApiKey || fallbacks.googleApiKey || "",
|
|
31586
|
+
customAiApiKey: settings.customAiApiKey || fallbacks.customAiApiKey || "",
|
|
31565
31587
|
openAiOrganization: settings.openAiOrganization ?? fallbacks.openAiOrganization ?? "",
|
|
31566
31588
|
openAiEndpoint: settings.openAiEndpoint ?? fallbacks.openAiEndpoint ?? "",
|
|
31567
31589
|
pluginEnv: settings.pluginEnv ?? fallbacks.pluginEnv ?? {},
|