@valerypopoff/rivet2-core 2.1.0 → 2.1.1
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 +132 -16
- package/dist/cjs/bundle.cjs.map +3 -3
- 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/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 +60 -1
- package/dist/esm/model/nodes/LLMChatV2Node.js +4 -0
- package/dist/esm/model/nodes/NodePrefabInstanceNode.js +2 -2
- 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
|
@@ -189,6 +189,39 @@ export const RIVET_WEB_APP_RENDERER_CSS = `
|
|
|
189
189
|
color: var(--rivet-web-app-error-color);
|
|
190
190
|
font-weight: 700;
|
|
191
191
|
}
|
|
192
|
+
|
|
193
|
+
.rivet-web-app-modal-backdrop {
|
|
194
|
+
position: fixed;
|
|
195
|
+
inset: 0;
|
|
196
|
+
z-index: 1000;
|
|
197
|
+
display: grid;
|
|
198
|
+
place-items: center;
|
|
199
|
+
background: rgba(0, 0, 0, 0.46);
|
|
200
|
+
background: color-mix(in srgb, var(--rivet-web-app-background) 78%, transparent);
|
|
201
|
+
padding: 20px;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.rivet-web-app-modal {
|
|
205
|
+
display: grid;
|
|
206
|
+
gap: 18px;
|
|
207
|
+
width: min(420px, 100%);
|
|
208
|
+
border: 1px solid var(--rivet-web-app-card-border);
|
|
209
|
+
border-radius: 12px;
|
|
210
|
+
background: var(--rivet-web-app-card-background);
|
|
211
|
+
box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
|
|
212
|
+
color: var(--rivet-web-app-foreground);
|
|
213
|
+
padding: 22px;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.rivet-web-app-modal-message {
|
|
217
|
+
font-size: 18px;
|
|
218
|
+
font-weight: 700;
|
|
219
|
+
line-height: 1.3;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.rivet-web-app-modal-button {
|
|
223
|
+
justify-self: start;
|
|
224
|
+
}
|
|
192
225
|
`;
|
|
193
226
|
export const RIVET_WEB_APP_DOCUMENT_CSS = `
|
|
194
227
|
html,
|
|
@@ -3,7 +3,7 @@ export const LLM_CHAT_V2_TOOL_RESPONSE_FORMAT_CONFLICT_COPY = {
|
|
|
3
3
|
title: '"Tool use" conflicts with "Structured outputs"',
|
|
4
4
|
paragraphs: [
|
|
5
5
|
'"Tool use" and "Structured outputs" cannot be used at the same time.',
|
|
6
|
-
'Use "Tool use" with Default/Text response format, or turn "Tool use" off before choosing JSON/JSON schema.',
|
|
6
|
+
'Use "Tool use" with Default/Text response format, or turn "Tool use" off before choosing JSON object/JSON schema.',
|
|
7
7
|
],
|
|
8
8
|
};
|
|
9
9
|
export function isLLMChatV2StructuredResponseFormat(responseFormat) {
|
|
@@ -4,6 +4,7 @@ import { isChatV2StructuredResponseFormat } from './chatV2ResponseFormat.js';
|
|
|
4
4
|
import { calculateChatV2Cost } from './modelRegistry.js';
|
|
5
5
|
const CHAT_V2_REQUEST_STATUS_PORT_ID = 'requestStatus';
|
|
6
6
|
const CHAT_V2_REQUEST_ERROR_PORT_ID = 'requestError';
|
|
7
|
+
const CHAT_V2_REQUEST_BODY_PORT_ID = 'requestBody';
|
|
7
8
|
function toFunctionCallOutputValue(functionCall) {
|
|
8
9
|
let argumentsValue = functionCall.lastParsedArguments;
|
|
9
10
|
if (argumentsValue == null) {
|
|
@@ -77,6 +78,12 @@ function createChatV2ReasoningOutput(reasoning) {
|
|
|
77
78
|
}
|
|
78
79
|
: createControlFlowExcludedOutput();
|
|
79
80
|
}
|
|
81
|
+
function createChatV2RequestBodyOutput(requestBodies) {
|
|
82
|
+
if (requestBodies == null || requestBodies.length === 0) {
|
|
83
|
+
return createControlFlowExcludedOutput();
|
|
84
|
+
}
|
|
85
|
+
return inferType(requestBodies.length === 1 ? requestBodies[0] : requestBodies);
|
|
86
|
+
}
|
|
80
87
|
function createChatV2RetryAttemptOutput(type, values) {
|
|
81
88
|
return values.length > 0
|
|
82
89
|
? {
|
|
@@ -85,7 +92,7 @@ function createChatV2RetryAttemptOutput(type, values) {
|
|
|
85
92
|
}
|
|
86
93
|
: createControlFlowExcludedOutput();
|
|
87
94
|
}
|
|
88
|
-
export function createChatV2CommonOutputs({ requestMessages, response, structuredOutput, functionCalls, usage, reasoning, requestStatus, responseError, requestStatuses, requestErrors, outputUsage, outputReasoning, outputRequestStatus, includeFunctionCalls, functionCallMode, retryOnNon200, responseFormat, }) {
|
|
95
|
+
export function createChatV2CommonOutputs({ requestMessages, response, structuredOutput, functionCalls, usage, reasoning, requestStatus, responseError, requestStatuses, requestErrors, requestBodies, outputUsage, outputReasoning, outputRequestStatus, includeFunctionCalls, functionCallMode, retryOnNon200, responseFormat, }) {
|
|
89
96
|
const outputs = {
|
|
90
97
|
['response']: createChatV2ResponseOutput(response, structuredOutput, responseFormat),
|
|
91
98
|
['in-messages']: { type: 'chat-message[]', value: requestMessages },
|
|
@@ -137,10 +144,11 @@ export function createChatV2CommonOutputs({ requestMessages, response, structure
|
|
|
137
144
|
}
|
|
138
145
|
: createControlFlowExcludedOutput();
|
|
139
146
|
}
|
|
147
|
+
outputs[CHAT_V2_REQUEST_BODY_PORT_ID] = createChatV2RequestBodyOutput(requestBodies);
|
|
140
148
|
}
|
|
141
149
|
return outputs;
|
|
142
150
|
}
|
|
143
|
-
export function createChatV2ProviderFailureOutputs({ requestMessages, responseStatus, responseError, requestStatuses, requestErrors, outputUsage, outputReasoning, includeFunctionCalls, retryOnNon200, }) {
|
|
151
|
+
export function createChatV2ProviderFailureOutputs({ requestMessages, responseStatus, responseError, requestStatuses, requestErrors, requestBodies, outputUsage, outputReasoning, includeFunctionCalls, retryOnNon200, }) {
|
|
144
152
|
const outputs = {
|
|
145
153
|
[CHAT_V2_REQUEST_ERROR_PORT_ID]: retryOnNon200
|
|
146
154
|
? createChatV2RetryAttemptOutput('string[]', requestErrors)
|
|
@@ -170,6 +178,7 @@ export function createChatV2ProviderFailureOutputs({ requestMessages, responseSt
|
|
|
170
178
|
},
|
|
171
179
|
['responseTokens']: createControlFlowExcludedOutput(),
|
|
172
180
|
};
|
|
181
|
+
outputs[CHAT_V2_REQUEST_BODY_PORT_ID] = createChatV2RequestBodyOutput(requestBodies);
|
|
173
182
|
if (includeFunctionCalls) {
|
|
174
183
|
outputs['function-calls'] = createControlFlowExcludedOutput();
|
|
175
184
|
}
|
|
@@ -102,6 +102,7 @@ function buildProviderFailureResult(requestMessages, options, normalizedError, r
|
|
|
102
102
|
responseError,
|
|
103
103
|
requestStatuses: retryRequestStatuses,
|
|
104
104
|
requestErrors: retryRequestErrors,
|
|
105
|
+
requestBodies: options.requestBodies,
|
|
105
106
|
outputUsage: options.outputUsage,
|
|
106
107
|
outputReasoning: options.outputReasoning,
|
|
107
108
|
includeFunctionCalls: options.includeFunctionCalls,
|
|
@@ -172,6 +173,7 @@ export async function runChatV2Pipeline(options) {
|
|
|
172
173
|
responseError: undefined,
|
|
173
174
|
requestStatuses: [],
|
|
174
175
|
requestErrors: [],
|
|
176
|
+
requestBodies: undefined,
|
|
175
177
|
outputUsage: false,
|
|
176
178
|
outputReasoning: false,
|
|
177
179
|
outputRequestStatus: false,
|
|
@@ -217,6 +219,7 @@ export async function runChatV2Pipeline(options) {
|
|
|
217
219
|
responseError,
|
|
218
220
|
requestStatuses,
|
|
219
221
|
requestErrors,
|
|
222
|
+
requestBodies: options.requestBodies,
|
|
220
223
|
outputUsage: options.outputUsage,
|
|
221
224
|
outputReasoning: options.outputReasoning,
|
|
222
225
|
outputRequestStatus: options.outputRequestStatus,
|
|
@@ -73,7 +73,7 @@ export function resolveChatV2ResponseFormatParameters(data, inputs) {
|
|
|
73
73
|
schemaDescription,
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
-
export function createChatV2ResponseOutput(parameters) {
|
|
76
|
+
export function createChatV2ResponseOutput(parameters, provider) {
|
|
77
77
|
if (parameters == null) {
|
|
78
78
|
return undefined;
|
|
79
79
|
}
|
|
@@ -81,6 +81,9 @@ export function createChatV2ResponseOutput(parameters) {
|
|
|
81
81
|
return Output.text();
|
|
82
82
|
}
|
|
83
83
|
if (parameters.responseFormat === 'json') {
|
|
84
|
+
if (provider === 'custom') {
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
84
87
|
return Output.json({
|
|
85
88
|
name: parameters.schemaName,
|
|
86
89
|
description: parameters.schemaDescription,
|
|
@@ -295,7 +295,7 @@ function getResponseFormatEditors() {
|
|
|
295
295
|
options: [
|
|
296
296
|
{ value: '', label: 'Default' },
|
|
297
297
|
{ value: 'text', label: 'Text' },
|
|
298
|
-
{ value: 'json', label: 'JSON' },
|
|
298
|
+
{ value: 'json', label: 'JSON object' },
|
|
299
299
|
{ value: 'json_schema', label: 'JSON schema' },
|
|
300
300
|
],
|
|
301
301
|
defaultValue: '',
|
|
@@ -307,7 +307,7 @@ function getResponseFormatEditors() {
|
|
|
307
307
|
dataKey: 'responseSchemaName',
|
|
308
308
|
useInputToggleDataKey: 'useResponseSchemaNameInput',
|
|
309
309
|
placeholder: 'response_schema',
|
|
310
|
-
helperMessage: 'Optional name passed to the provider for JSON or JSON schema responses.',
|
|
310
|
+
helperMessage: 'Optional name passed to the provider for JSON object or JSON schema responses.',
|
|
311
311
|
hideIf: (data) => data.responseFormat !== 'json' && data.responseFormat !== 'json_schema',
|
|
312
312
|
},
|
|
313
313
|
{
|
|
@@ -315,7 +315,7 @@ function getResponseFormatEditors() {
|
|
|
315
315
|
label: 'Schema description',
|
|
316
316
|
dataKey: 'responseSchemaDescription',
|
|
317
317
|
useInputToggleDataKey: 'useResponseSchemaDescriptionInput',
|
|
318
|
-
helperMessage: 'Optional description passed to the provider for JSON or JSON schema responses.',
|
|
318
|
+
helperMessage: 'Optional description passed to the provider for JSON object or JSON schema responses.',
|
|
319
319
|
hideIf: (data) => data.responseFormat !== 'json' && data.responseFormat !== 'json_schema',
|
|
320
320
|
},
|
|
321
321
|
]);
|
|
@@ -454,9 +454,9 @@ function getTechnicalDetailsEditors() {
|
|
|
454
454
|
},
|
|
455
455
|
{
|
|
456
456
|
type: 'toggle',
|
|
457
|
-
label: 'Output request
|
|
457
|
+
label: 'Output request details',
|
|
458
458
|
dataKey: 'outputRequestStatus',
|
|
459
|
-
helperMessage: 'Adds Response Status
|
|
459
|
+
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.',
|
|
460
460
|
},
|
|
461
461
|
]);
|
|
462
462
|
}
|
|
@@ -24,11 +24,16 @@ export async function resolveLLMChatV2RuntimeConfig(params) {
|
|
|
24
24
|
const baseURL = resolveLLMChatV2BaseURL(data, inputs);
|
|
25
25
|
const nodeHeaders = resolveLLMChatV2Headers(data, inputs);
|
|
26
26
|
const apiKey = resolveLLMChatV2ApiKey(data, inputs, context);
|
|
27
|
+
const requestBodies = data.outputRequestStatus ? [] : undefined;
|
|
27
28
|
const providerConfig = await resolveChatV2ProviderConfig(provider, modelId, context, {
|
|
28
29
|
baseURL,
|
|
29
30
|
headers: nodeHeaders,
|
|
30
31
|
});
|
|
31
|
-
const model = createChatV2Model(provider, modelId, context, {
|
|
32
|
+
const model = createChatV2Model(provider, modelId, context, {
|
|
33
|
+
...providerConfig,
|
|
34
|
+
apiKey,
|
|
35
|
+
onRequestBody: requestBodies == null ? undefined : (body) => requestBodies.push(body),
|
|
36
|
+
});
|
|
32
37
|
const prompt = inputs['prompt'];
|
|
33
38
|
const systemPrompt = inputs['systemPrompt'];
|
|
34
39
|
const functions = data.useToolCalling && inputs['functions'] != null
|
|
@@ -47,7 +52,7 @@ export async function resolveLLMChatV2RuntimeConfig(params) {
|
|
|
47
52
|
functions,
|
|
48
53
|
additionalTools: resolveLLMChatV2BuiltInTools(data, context, providerConfig, apiKey),
|
|
49
54
|
...generationParameters,
|
|
50
|
-
responseOutput: createChatV2ResponseOutput(responseFormatParameters),
|
|
55
|
+
responseOutput: createChatV2ResponseOutput(responseFormatParameters, provider),
|
|
51
56
|
responseFormat: responseFormatParameters?.responseFormat,
|
|
52
57
|
outputUsage: data.outputUsage,
|
|
53
58
|
outputReasoning: data.outputReasoning,
|
|
@@ -57,6 +62,7 @@ export async function resolveLLMChatV2RuntimeConfig(params) {
|
|
|
57
62
|
providerOptions,
|
|
58
63
|
toolChoice,
|
|
59
64
|
anthropicCacheControlTtl: provider === 'anthropic' ? data.anthropicCacheControlTtl || undefined : undefined,
|
|
65
|
+
requestBodies,
|
|
60
66
|
retryOnNon200: data.retryOnNon200,
|
|
61
67
|
retryOnNon200RepeatTimes: data.retryOnNon200RepeatTimes,
|
|
62
68
|
retryOnNon200CooldownMs: data.retryOnNon200CooldownMs,
|
|
@@ -111,6 +111,61 @@ function openAIBaseURLToEndpoint(baseURL) {
|
|
|
111
111
|
return `${normalizedBaseURL}/chat/completions`;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
+
function parseBodyText(text) {
|
|
115
|
+
try {
|
|
116
|
+
return JSON.parse(text);
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
return text;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function parseFetchBody(body) {
|
|
123
|
+
if (body == null) {
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
if (typeof body === 'string') {
|
|
127
|
+
return parseBodyText(body);
|
|
128
|
+
}
|
|
129
|
+
if (body instanceof URLSearchParams) {
|
|
130
|
+
return Object.fromEntries(body.entries());
|
|
131
|
+
}
|
|
132
|
+
if (body instanceof ArrayBuffer) {
|
|
133
|
+
return parseBodyText(new TextDecoder().decode(body));
|
|
134
|
+
}
|
|
135
|
+
if (ArrayBuffer.isView(body)) {
|
|
136
|
+
return parseBodyText(new TextDecoder().decode(body));
|
|
137
|
+
}
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
function cloneCapturedRequestBody(body) {
|
|
141
|
+
if (typeof structuredClone === 'function') {
|
|
142
|
+
try {
|
|
143
|
+
return structuredClone(body);
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
// Fall through to JSON cloning below.
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
return JSON.parse(JSON.stringify(body));
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
return body;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function createRequestBodyCapturingFetch(onRequestBody) {
|
|
157
|
+
return async (input, init) => {
|
|
158
|
+
const body = parseFetchBody(init?.body);
|
|
159
|
+
if (body !== undefined) {
|
|
160
|
+
onRequestBody(cloneCapturedRequestBody(body));
|
|
161
|
+
}
|
|
162
|
+
const nativeFetch = globalThis.fetch;
|
|
163
|
+
return nativeFetch(input, init);
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function maybeCreateRequestBodyCapturingFetch(options) {
|
|
167
|
+
return options.onRequestBody == null ? undefined : createRequestBodyCapturingFetch(options.onRequestBody);
|
|
168
|
+
}
|
|
114
169
|
export async function resolveChatV2ProviderConfig(provider, modelId, context, options = {}) {
|
|
115
170
|
const headers = cleanHeaders({
|
|
116
171
|
...context.settings.chatNodeHeaders,
|
|
@@ -166,6 +221,7 @@ export function createChatV2Model(provider, modelId, context, options = {}) {
|
|
|
166
221
|
organization: context.settings.openAiOrganization || undefined,
|
|
167
222
|
baseURL: options.baseURL || undefined,
|
|
168
223
|
headers: options.headers,
|
|
224
|
+
fetch: maybeCreateRequestBodyCapturingFetch(options),
|
|
169
225
|
});
|
|
170
226
|
return providerInstance.responses(modelId);
|
|
171
227
|
}
|
|
@@ -174,6 +230,7 @@ export function createChatV2Model(provider, modelId, context, options = {}) {
|
|
|
174
230
|
apiKey: options.apiKey || context.getPluginConfig('anthropicApiKey') || undefined,
|
|
175
231
|
baseURL: options.baseURL || context.getPluginConfig('anthropicApiEndpoint') || undefined,
|
|
176
232
|
headers: options.headers,
|
|
233
|
+
fetch: maybeCreateRequestBodyCapturingFetch(options),
|
|
177
234
|
});
|
|
178
235
|
return providerInstance.messages(modelId);
|
|
179
236
|
}
|
|
@@ -182,6 +239,7 @@ export function createChatV2Model(provider, modelId, context, options = {}) {
|
|
|
182
239
|
apiKey: options.apiKey || context.getPluginConfig('googleApiKey') || undefined,
|
|
183
240
|
baseURL: options.baseURL || undefined,
|
|
184
241
|
headers: options.headers,
|
|
242
|
+
fetch: maybeCreateRequestBodyCapturingFetch(options),
|
|
185
243
|
});
|
|
186
244
|
return providerInstance.chat(modelId);
|
|
187
245
|
}
|
|
@@ -194,7 +252,8 @@ export function createChatV2Model(provider, modelId, context, options = {}) {
|
|
|
194
252
|
apiKey: options.apiKey,
|
|
195
253
|
baseURL: options.baseURL,
|
|
196
254
|
headers: options.headers,
|
|
197
|
-
includeUsage:
|
|
255
|
+
includeUsage: false,
|
|
256
|
+
fetch: maybeCreateRequestBodyCapturingFetch(options),
|
|
198
257
|
});
|
|
199
258
|
const model = providerInstance.chatModel(modelId);
|
|
200
259
|
// The installed OpenAI-compatible provider reads this from the model instance,
|
|
@@ -206,6 +206,10 @@ export class LLMChatV2NodeImpl extends NodeImpl {
|
|
|
206
206
|
id: 'requestError',
|
|
207
207
|
title: 'Response Error',
|
|
208
208
|
dataType: this.data.retryOnNon200 ? 'string[]' : 'string',
|
|
209
|
+
}, {
|
|
210
|
+
id: 'requestBody',
|
|
211
|
+
title: 'LLM request body',
|
|
212
|
+
dataType: ['object', 'object[]', 'string', 'string[]', 'any', 'any[]'],
|
|
209
213
|
});
|
|
210
214
|
}
|
|
211
215
|
return outputs;
|
|
@@ -25,13 +25,13 @@ export class NodePrefabInstanceNodeImpl extends NodeImpl {
|
|
|
25
25
|
return [];
|
|
26
26
|
}
|
|
27
27
|
async process(_inputData) {
|
|
28
|
-
throw new Error('Library node is missing. Open the Node
|
|
28
|
+
throw new Error('Library node is missing. Open the Node library and reconnect this linked node.');
|
|
29
29
|
}
|
|
30
30
|
static getUIData() {
|
|
31
31
|
return {
|
|
32
32
|
contextMenuTitle: 'Linked node',
|
|
33
33
|
infoBoxTitle: 'Linked node',
|
|
34
|
-
infoBoxBody: 'Runs a node from the project Node
|
|
34
|
+
infoBoxBody: 'Runs a node from the project Node library.',
|
|
35
35
|
group: 'Advanced',
|
|
36
36
|
};
|
|
37
37
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const RIVET_WEB_APP_RENDERER_CSS = "\n.rivet-web-app-root {\n --rivet-web-app-background: var(--grey-dark-colorish, #1c222b);\n --rivet-web-app-foreground: var(--foreground, #ffffff);\n --rivet-web-app-card-background: color-mix(in srgb, var(--modal-surface-bg, #252b34) 88%, var(--foreground, #ffffff) 4%);\n --rivet-web-app-card-border: var(--foldable-section-border, rgba(255, 255, 255, 0.04));\n --rivet-web-app-control-background: var(--form-control-bg, #20252d);\n --rivet-web-app-control-border: var(--form-control-border, rgba(255, 255, 255, 0.14));\n --rivet-web-app-button-radius: var(--rivet-web-app-host-button-radius, 6px);\n --rivet-web-app-button-background: var(--success, #3ba85b);\n --rivet-web-app-button-foreground: var(--grey-lightest, #ffffff);\n --rivet-web-app-output-title: var(--rivet-web-app-foreground, #ffffff);\n --rivet-web-app-error-color: var(--error, #ff6b5f);\n --rivet-web-app-font-size: var(--rivet-web-app-host-font-size, 15px);\n box-sizing: border-box;\n height: 100%;\n background: var(--rivet-web-app-background);\n color: var(--rivet-web-app-foreground);\n overflow: auto;\n font-family: Inter, system-ui, sans-serif;\n font-size: var(--rivet-web-app-font-size);\n line-height: 1.4;\n}\n\n.rivet-web-app-root *,\n.rivet-web-app-root *::before,\n.rivet-web-app-root *::after {\n box-sizing: border-box;\n}\n\n.rivet-web-app-surface {\n display: grid;\n gap: 16px;\n margin: 0 auto;\n max-width: 760px;\n padding: 48px 20px;\n}\n\n.rivet-web-app-card,\n.rivet-web-app-field {\n border: 1px solid var(--rivet-web-app-card-border);\n border-radius: 10px;\n background: var(--rivet-web-app-card-background);\n padding: 16px;\n}\n\n.rivet-web-app-component-frame {\n border-radius: 12px;\n margin: -5px;\n padding: 4px;\n}\n\n.rivet-web-app-component-frame.active {\n background: color-mix(in srgb, var(--modal-surface-bg, #252b34) 75%, var(--primary, #ff9e2c) 16%);\n}\n\n.rivet-web-app-field {\n display: grid;\n gap: 8px;\n color: var(--rivet-web-app-foreground);\n font-size: inherit;\n font-weight: 600;\n}\n\n.rivet-web-app-field input,\n.rivet-web-app-field textarea {\n appearance: none;\n width: 100%;\n box-sizing: border-box;\n border: 1px solid var(--rivet-web-app-control-border);\n border-radius: 8px;\n background: var(--rivet-web-app-control-background);\n color: var(--rivet-web-app-foreground);\n font: inherit;\n font-weight: 400;\n padding: 10px 12px;\n}\n\n.rivet-web-app-field textarea {\n min-height: 110px;\n resize: vertical;\n}\n\n.rivet-web-app-button {\n width: fit-content;\n border: 0;\n border-radius: var(--rivet-web-app-button-radius);\n background: var(--rivet-web-app-button-background);\n color: var(--rivet-web-app-button-foreground);\n cursor: pointer;\n font: inherit;\n font-weight: 700;\n padding: 10px 16px;\n}\n\n.rivet-web-app-button:disabled {\n cursor: wait;\n opacity: 0.72;\n}\n\n.rivet-web-app-output {\n display: grid;\n gap: 8px;\n}\n\n.rivet-web-app-output-title {\n color: var(--rivet-web-app-output-title);\n font-weight: 700;\n}\n\n.rivet-web-app-output pre {\n margin: 0;\n background: transparent;\n border-radius: 0;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n font-size: inherit;\n padding: 0;\n white-space: pre-wrap;\n word-break: break-word;\n}\n\n.rivet-web-app-markdown,\n.rivet-web-app-output-markdown {\n word-break: break-word;\n}\n\n.rivet-web-app-markdown.markdown-body {\n background: var(--rivet-web-app-card-background);\n font-family: inherit;\n min-width: 0;\n}\n\n.rivet-web-app-output-markdown.markdown-body {\n background: transparent;\n font-family: inherit;\n min-width: 0;\n}\n\n.rivet-web-app-markdown h1,\n.rivet-web-app-output-markdown h1 {\n margin: 0 0 12px;\n padding-bottom: 8px;\n border-bottom: 1px solid var(--rivet-web-app-card-border);\n font-size: 24px;\n line-height: 1.22;\n}\n\n.rivet-web-app-markdown h2,\n.rivet-web-app-output-markdown h2 {\n margin: 0 0 10px;\n font-size: 20px;\n line-height: 1.25;\n}\n\n.rivet-web-app-markdown p,\n.rivet-web-app-output-markdown p,\n.rivet-web-app-markdown ul,\n.rivet-web-app-output-markdown ul {\n margin: 0 0 12px;\n}\n\n.rivet-web-app-markdown.markdown-body code,\n.rivet-web-app-output-markdown.markdown-body code {\n border-radius: 4px;\n background: color-mix(in srgb, var(--rivet-web-app-control-background) 70%, var(--rivet-web-app-foreground) 6%);\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n padding: 1px 4px;\n}\n\n.rivet-web-app-markdown.markdown-body pre,\n.rivet-web-app-output-markdown.markdown-body pre {\n background: transparent;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n padding: 0;\n white-space: pre-wrap;\n}\n\n.rivet-web-app-markdown > :first-child,\n.rivet-web-app-output-markdown > :first-child {\n margin-top: 0;\n}\n\n.rivet-web-app-markdown > :last-child,\n.rivet-web-app-output-markdown > :last-child {\n margin-bottom: 0;\n}\n\n.rivet-web-app-error {\n color: var(--rivet-web-app-error-color);\n font-weight: 700;\n}\n";
|
|
1
|
+
export declare const RIVET_WEB_APP_RENDERER_CSS = "\n.rivet-web-app-root {\n --rivet-web-app-background: var(--grey-dark-colorish, #1c222b);\n --rivet-web-app-foreground: var(--foreground, #ffffff);\n --rivet-web-app-card-background: color-mix(in srgb, var(--modal-surface-bg, #252b34) 88%, var(--foreground, #ffffff) 4%);\n --rivet-web-app-card-border: var(--foldable-section-border, rgba(255, 255, 255, 0.04));\n --rivet-web-app-control-background: var(--form-control-bg, #20252d);\n --rivet-web-app-control-border: var(--form-control-border, rgba(255, 255, 255, 0.14));\n --rivet-web-app-button-radius: var(--rivet-web-app-host-button-radius, 6px);\n --rivet-web-app-button-background: var(--success, #3ba85b);\n --rivet-web-app-button-foreground: var(--grey-lightest, #ffffff);\n --rivet-web-app-output-title: var(--rivet-web-app-foreground, #ffffff);\n --rivet-web-app-error-color: var(--error, #ff6b5f);\n --rivet-web-app-font-size: var(--rivet-web-app-host-font-size, 15px);\n box-sizing: border-box;\n height: 100%;\n background: var(--rivet-web-app-background);\n color: var(--rivet-web-app-foreground);\n overflow: auto;\n font-family: Inter, system-ui, sans-serif;\n font-size: var(--rivet-web-app-font-size);\n line-height: 1.4;\n}\n\n.rivet-web-app-root *,\n.rivet-web-app-root *::before,\n.rivet-web-app-root *::after {\n box-sizing: border-box;\n}\n\n.rivet-web-app-surface {\n display: grid;\n gap: 16px;\n margin: 0 auto;\n max-width: 760px;\n padding: 48px 20px;\n}\n\n.rivet-web-app-card,\n.rivet-web-app-field {\n border: 1px solid var(--rivet-web-app-card-border);\n border-radius: 10px;\n background: var(--rivet-web-app-card-background);\n padding: 16px;\n}\n\n.rivet-web-app-component-frame {\n border-radius: 12px;\n margin: -5px;\n padding: 4px;\n}\n\n.rivet-web-app-component-frame.active {\n background: color-mix(in srgb, var(--modal-surface-bg, #252b34) 75%, var(--primary, #ff9e2c) 16%);\n}\n\n.rivet-web-app-field {\n display: grid;\n gap: 8px;\n color: var(--rivet-web-app-foreground);\n font-size: inherit;\n font-weight: 600;\n}\n\n.rivet-web-app-field input,\n.rivet-web-app-field textarea {\n appearance: none;\n width: 100%;\n box-sizing: border-box;\n border: 1px solid var(--rivet-web-app-control-border);\n border-radius: 8px;\n background: var(--rivet-web-app-control-background);\n color: var(--rivet-web-app-foreground);\n font: inherit;\n font-weight: 400;\n padding: 10px 12px;\n}\n\n.rivet-web-app-field textarea {\n min-height: 110px;\n resize: vertical;\n}\n\n.rivet-web-app-button {\n width: fit-content;\n border: 0;\n border-radius: var(--rivet-web-app-button-radius);\n background: var(--rivet-web-app-button-background);\n color: var(--rivet-web-app-button-foreground);\n cursor: pointer;\n font: inherit;\n font-weight: 700;\n padding: 10px 16px;\n}\n\n.rivet-web-app-button:disabled {\n cursor: wait;\n opacity: 0.72;\n}\n\n.rivet-web-app-output {\n display: grid;\n gap: 8px;\n}\n\n.rivet-web-app-output-title {\n color: var(--rivet-web-app-output-title);\n font-weight: 700;\n}\n\n.rivet-web-app-output pre {\n margin: 0;\n background: transparent;\n border-radius: 0;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n font-size: inherit;\n padding: 0;\n white-space: pre-wrap;\n word-break: break-word;\n}\n\n.rivet-web-app-markdown,\n.rivet-web-app-output-markdown {\n word-break: break-word;\n}\n\n.rivet-web-app-markdown.markdown-body {\n background: var(--rivet-web-app-card-background);\n font-family: inherit;\n min-width: 0;\n}\n\n.rivet-web-app-output-markdown.markdown-body {\n background: transparent;\n font-family: inherit;\n min-width: 0;\n}\n\n.rivet-web-app-markdown h1,\n.rivet-web-app-output-markdown h1 {\n margin: 0 0 12px;\n padding-bottom: 8px;\n border-bottom: 1px solid var(--rivet-web-app-card-border);\n font-size: 24px;\n line-height: 1.22;\n}\n\n.rivet-web-app-markdown h2,\n.rivet-web-app-output-markdown h2 {\n margin: 0 0 10px;\n font-size: 20px;\n line-height: 1.25;\n}\n\n.rivet-web-app-markdown p,\n.rivet-web-app-output-markdown p,\n.rivet-web-app-markdown ul,\n.rivet-web-app-output-markdown ul {\n margin: 0 0 12px;\n}\n\n.rivet-web-app-markdown.markdown-body code,\n.rivet-web-app-output-markdown.markdown-body code {\n border-radius: 4px;\n background: color-mix(in srgb, var(--rivet-web-app-control-background) 70%, var(--rivet-web-app-foreground) 6%);\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n padding: 1px 4px;\n}\n\n.rivet-web-app-markdown.markdown-body pre,\n.rivet-web-app-output-markdown.markdown-body pre {\n background: transparent;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n padding: 0;\n white-space: pre-wrap;\n}\n\n.rivet-web-app-markdown > :first-child,\n.rivet-web-app-output-markdown > :first-child {\n margin-top: 0;\n}\n\n.rivet-web-app-markdown > :last-child,\n.rivet-web-app-output-markdown > :last-child {\n margin-bottom: 0;\n}\n\n.rivet-web-app-error {\n color: var(--rivet-web-app-error-color);\n font-weight: 700;\n}\n\n.rivet-web-app-modal-backdrop {\n position: fixed;\n inset: 0;\n z-index: 1000;\n display: grid;\n place-items: center;\n background: rgba(0, 0, 0, 0.46);\n background: color-mix(in srgb, var(--rivet-web-app-background) 78%, transparent);\n padding: 20px;\n}\n\n.rivet-web-app-modal {\n display: grid;\n gap: 18px;\n width: min(420px, 100%);\n border: 1px solid var(--rivet-web-app-card-border);\n border-radius: 12px;\n background: var(--rivet-web-app-card-background);\n box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);\n color: var(--rivet-web-app-foreground);\n padding: 22px;\n}\n\n.rivet-web-app-modal-message {\n font-size: 18px;\n font-weight: 700;\n line-height: 1.3;\n}\n\n.rivet-web-app-modal-button {\n justify-self: start;\n}\n";
|
|
2
2
|
export declare const RIVET_WEB_APP_DOCUMENT_CSS = "\nhtml,\nbody {\n height: 100%;\n margin: 0;\n}\n\nbody {\n min-height: 100vh;\n background: #1c222b;\n}\n\n#app {\n min-height: 100vh;\n}\n";
|
|
@@ -3,7 +3,7 @@ import type { LLMChatV2NodeData } from './llmChatV2NodeData.js';
|
|
|
3
3
|
export type LLMChatV2StructuredResponseFormat = ChatV2StructuredResponseFormat;
|
|
4
4
|
export declare const LLM_CHAT_V2_TOOL_RESPONSE_FORMAT_CONFLICT_COPY: {
|
|
5
5
|
readonly title: "\"Tool use\" conflicts with \"Structured outputs\"";
|
|
6
|
-
readonly paragraphs: readonly ["\"Tool use\" and \"Structured outputs\" cannot be used at the same time.", "Use \"Tool use\" with Default/Text response format, or turn \"Tool use\" off before choosing JSON/JSON schema."];
|
|
6
|
+
readonly paragraphs: readonly ["\"Tool use\" and \"Structured outputs\" cannot be used at the same time.", "Use \"Tool use\" with Default/Text response format, or turn \"Tool use\" off before choosing JSON object/JSON schema."];
|
|
7
7
|
};
|
|
8
8
|
type LLMChatV2ToolResponseFormatData = Pick<LLMChatV2NodeData, 'useToolCalling' | 'responseFormat'>;
|
|
9
9
|
export declare function isLLMChatV2StructuredResponseFormat(responseFormat: unknown): responseFormat is LLMChatV2StructuredResponseFormat;
|
|
@@ -15,6 +15,7 @@ type CreateChatV2CommonOutputsOptions = ChatV2CommonOutputOptions & {
|
|
|
15
15
|
responseError: string | undefined;
|
|
16
16
|
requestStatuses: number[];
|
|
17
17
|
requestErrors: string[];
|
|
18
|
+
requestBodies?: unknown[] | undefined;
|
|
18
19
|
};
|
|
19
20
|
type CreateChatV2ProviderFailureOutputsOptions = Pick<RunChatV2PipelineOptions, 'outputUsage' | 'outputReasoning' | 'includeFunctionCalls' | 'retryOnNon200'> & {
|
|
20
21
|
requestMessages: ChatMessage[];
|
|
@@ -22,8 +23,9 @@ type CreateChatV2ProviderFailureOutputsOptions = Pick<RunChatV2PipelineOptions,
|
|
|
22
23
|
responseError: string;
|
|
23
24
|
requestStatuses: number[];
|
|
24
25
|
requestErrors: string[];
|
|
26
|
+
requestBodies?: unknown[] | undefined;
|
|
25
27
|
};
|
|
26
28
|
export declare function normalizeChatV2Usage(usage: LanguageModelUsage | undefined, options: Pick<RunChatV2PipelineOptions, 'provider' | 'modelId'>): ChatV2NormalizedUsage | undefined;
|
|
27
|
-
export declare function createChatV2CommonOutputs({ requestMessages, response, structuredOutput, functionCalls, usage, reasoning, requestStatus, responseError, requestStatuses, requestErrors, outputUsage, outputReasoning, outputRequestStatus, includeFunctionCalls, functionCallMode, retryOnNon200, responseFormat, }: CreateChatV2CommonOutputsOptions): Outputs;
|
|
28
|
-
export declare function createChatV2ProviderFailureOutputs({ requestMessages, responseStatus, responseError, requestStatuses, requestErrors, outputUsage, outputReasoning, includeFunctionCalls, retryOnNon200, }: CreateChatV2ProviderFailureOutputsOptions): Outputs;
|
|
29
|
+
export declare function createChatV2CommonOutputs({ requestMessages, response, structuredOutput, functionCalls, usage, reasoning, requestStatus, responseError, requestStatuses, requestErrors, requestBodies, outputUsage, outputReasoning, outputRequestStatus, includeFunctionCalls, functionCallMode, retryOnNon200, responseFormat, }: CreateChatV2CommonOutputsOptions): Outputs;
|
|
30
|
+
export declare function createChatV2ProviderFailureOutputs({ requestMessages, responseStatus, responseError, requestStatuses, requestErrors, requestBodies, outputUsage, outputReasoning, includeFunctionCalls, retryOnNon200, }: CreateChatV2ProviderFailureOutputsOptions): Outputs;
|
|
29
31
|
export {};
|
|
@@ -23,5 +23,5 @@ export type ChatV2ResponseFormatParameters = undefined | {
|
|
|
23
23
|
};
|
|
24
24
|
export declare function isChatV2StructuredResponseFormat(responseFormat: unknown): responseFormat is ChatV2StructuredResponseFormat;
|
|
25
25
|
export declare function resolveChatV2ResponseFormatParameters(data: ChatV2ResponseFormatData, inputs: Inputs): ChatV2ResponseFormatParameters;
|
|
26
|
-
export declare function createChatV2ResponseOutput(parameters: ChatV2ResponseFormatParameters): ChatV2ResponseOutput | undefined;
|
|
26
|
+
export declare function createChatV2ResponseOutput(parameters: ChatV2ResponseFormatParameters, provider?: ChatV2Provider): ChatV2ResponseOutput | undefined;
|
|
27
27
|
export declare function mergeCustomProviderResponseFormatOptions(provider: ChatV2Provider, providerOptions: ChatV2ProviderOptions | undefined, parameters: ChatV2ResponseFormatParameters): ChatV2ProviderOptions | undefined;
|
|
@@ -108,6 +108,7 @@ export type RunChatV2PipelineOptions = {
|
|
|
108
108
|
providerOptions?: ChatV2ProviderOptions | undefined;
|
|
109
109
|
toolChoice?: ChatV2ToolChoice | undefined;
|
|
110
110
|
anthropicCacheControlTtl?: '5m' | '1h' | undefined;
|
|
111
|
+
requestBodies?: unknown[] | undefined;
|
|
111
112
|
outputUsage?: boolean | undefined;
|
|
112
113
|
outputReasoning?: boolean | undefined;
|
|
113
114
|
outputRequestStatus?: boolean | undefined;
|
|
@@ -48,6 +48,7 @@ export type CreateChatV2ModelOptions = {
|
|
|
48
48
|
apiKey?: string | undefined;
|
|
49
49
|
baseURL?: string | undefined;
|
|
50
50
|
headers?: Record<string, string> | undefined;
|
|
51
|
+
onRequestBody?: ((body: unknown) => void) | undefined;
|
|
51
52
|
};
|
|
52
53
|
export type ResolveChatV2ProviderConfigContext = Pick<InternalProcessContext, 'getChatNodeEndpoint' | 'getPluginConfig' | 'settings'>;
|
|
53
54
|
export type ResolvedChatV2ProviderConfig = {
|