@ai-sdk/provider-utils 3.0.0-beta.1 → 3.0.0-beta.10
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/CHANGELOG.md +58 -0
- package/dist/index.d.mts +89 -61
- package/dist/index.d.ts +89 -61
- package/dist/index.js +119 -87
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +94 -63
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
@@ -49,6 +49,7 @@ __export(src_exports, {
|
|
49
49
|
createProviderDefinedToolFactoryWithOutputSchema: () => createProviderDefinedToolFactoryWithOutputSchema,
|
50
50
|
createStatusCodeErrorResponseHandler: () => createStatusCodeErrorResponseHandler,
|
51
51
|
delay: () => delay,
|
52
|
+
dynamicTool: () => dynamicTool,
|
52
53
|
extractResponseHeaders: () => extractResponseHeaders,
|
53
54
|
generateId: () => generateId,
|
54
55
|
getErrorMessage: () => getErrorMessage,
|
@@ -122,8 +123,33 @@ function convertAsyncIteratorToReadableStream(iterator) {
|
|
122
123
|
}
|
123
124
|
|
124
125
|
// src/delay.ts
|
125
|
-
async function delay(delayInMs) {
|
126
|
-
|
126
|
+
async function delay(delayInMs, options) {
|
127
|
+
if (delayInMs == null) {
|
128
|
+
return Promise.resolve();
|
129
|
+
}
|
130
|
+
const signal = options == null ? void 0 : options.abortSignal;
|
131
|
+
return new Promise((resolve2, reject) => {
|
132
|
+
if (signal == null ? void 0 : signal.aborted) {
|
133
|
+
reject(createAbortError());
|
134
|
+
return;
|
135
|
+
}
|
136
|
+
const timeoutId = setTimeout(() => {
|
137
|
+
cleanup();
|
138
|
+
resolve2();
|
139
|
+
}, delayInMs);
|
140
|
+
const cleanup = () => {
|
141
|
+
clearTimeout(timeoutId);
|
142
|
+
signal == null ? void 0 : signal.removeEventListener("abort", onAbort);
|
143
|
+
};
|
144
|
+
const onAbort = () => {
|
145
|
+
cleanup();
|
146
|
+
reject(createAbortError());
|
147
|
+
};
|
148
|
+
signal == null ? void 0 : signal.addEventListener("abort", onAbort);
|
149
|
+
});
|
150
|
+
}
|
151
|
+
function createAbortError() {
|
152
|
+
return new DOMException("Delay was aborted", "AbortError");
|
127
153
|
}
|
128
154
|
|
129
155
|
// src/extract-response-headers.ts
|
@@ -175,8 +201,43 @@ function getErrorMessage(error) {
|
|
175
201
|
}
|
176
202
|
|
177
203
|
// src/get-from-api.ts
|
204
|
+
var import_provider3 = require("@ai-sdk/provider");
|
205
|
+
|
206
|
+
// src/handle-fetch-error.ts
|
178
207
|
var import_provider2 = require("@ai-sdk/provider");
|
179
208
|
|
209
|
+
// src/is-abort-error.ts
|
210
|
+
function isAbortError(error) {
|
211
|
+
return (error instanceof Error || error instanceof DOMException) && (error.name === "AbortError" || error.name === "ResponseAborted" || // Next.js
|
212
|
+
error.name === "TimeoutError");
|
213
|
+
}
|
214
|
+
|
215
|
+
// src/handle-fetch-error.ts
|
216
|
+
var FETCH_FAILED_ERROR_MESSAGES = ["fetch failed", "failed to fetch"];
|
217
|
+
function handleFetchError({
|
218
|
+
error,
|
219
|
+
url,
|
220
|
+
requestBodyValues
|
221
|
+
}) {
|
222
|
+
if (isAbortError(error)) {
|
223
|
+
return error;
|
224
|
+
}
|
225
|
+
if (error instanceof TypeError && FETCH_FAILED_ERROR_MESSAGES.includes(error.message.toLowerCase())) {
|
226
|
+
const cause = error.cause;
|
227
|
+
if (cause != null) {
|
228
|
+
return new import_provider2.APICallError({
|
229
|
+
message: `Cannot connect to API: ${cause.message}`,
|
230
|
+
cause,
|
231
|
+
url,
|
232
|
+
requestBodyValues,
|
233
|
+
isRetryable: true
|
234
|
+
// retry when network error
|
235
|
+
});
|
236
|
+
}
|
237
|
+
}
|
238
|
+
return error;
|
239
|
+
}
|
240
|
+
|
180
241
|
// src/remove-undefined-entries.ts
|
181
242
|
function removeUndefinedEntries(record) {
|
182
243
|
return Object.fromEntries(
|
@@ -184,11 +245,6 @@ function removeUndefinedEntries(record) {
|
|
184
245
|
);
|
185
246
|
}
|
186
247
|
|
187
|
-
// src/is-abort-error.ts
|
188
|
-
function isAbortError(error) {
|
189
|
-
return error instanceof Error && (error.name === "AbortError" || error.name === "TimeoutError");
|
190
|
-
}
|
191
|
-
|
192
248
|
// src/get-from-api.ts
|
193
249
|
var getOriginalFetch = () => globalThis.fetch;
|
194
250
|
var getFromApi = async ({
|
@@ -215,10 +271,10 @@ var getFromApi = async ({
|
|
215
271
|
requestBodyValues: {}
|
216
272
|
});
|
217
273
|
} catch (error) {
|
218
|
-
if (isAbortError(error) ||
|
274
|
+
if (isAbortError(error) || import_provider3.APICallError.isInstance(error)) {
|
219
275
|
throw error;
|
220
276
|
}
|
221
|
-
throw new
|
277
|
+
throw new import_provider3.APICallError({
|
222
278
|
message: "Failed to process error response",
|
223
279
|
cause: error,
|
224
280
|
statusCode: response.status,
|
@@ -237,11 +293,11 @@ var getFromApi = async ({
|
|
237
293
|
});
|
238
294
|
} catch (error) {
|
239
295
|
if (error instanceof Error) {
|
240
|
-
if (isAbortError(error) ||
|
296
|
+
if (isAbortError(error) || import_provider3.APICallError.isInstance(error)) {
|
241
297
|
throw error;
|
242
298
|
}
|
243
299
|
}
|
244
|
-
throw new
|
300
|
+
throw new import_provider3.APICallError({
|
245
301
|
message: "Failed to process successful response",
|
246
302
|
cause: error,
|
247
303
|
statusCode: response.status,
|
@@ -251,22 +307,7 @@ var getFromApi = async ({
|
|
251
307
|
});
|
252
308
|
}
|
253
309
|
} catch (error) {
|
254
|
-
|
255
|
-
throw error;
|
256
|
-
}
|
257
|
-
if (error instanceof TypeError && error.message === "fetch failed") {
|
258
|
-
const cause = error.cause;
|
259
|
-
if (cause != null) {
|
260
|
-
throw new import_provider2.APICallError({
|
261
|
-
message: `Cannot connect to API: ${cause.message}`,
|
262
|
-
cause,
|
263
|
-
url,
|
264
|
-
isRetryable: true,
|
265
|
-
requestBodyValues: {}
|
266
|
-
});
|
267
|
-
}
|
268
|
-
}
|
269
|
-
throw error;
|
310
|
+
throw handleFetchError({ error, url, requestBodyValues: {} });
|
270
311
|
}
|
271
312
|
};
|
272
313
|
|
@@ -285,7 +326,7 @@ function isUrlSupported({
|
|
285
326
|
}
|
286
327
|
|
287
328
|
// src/load-api-key.ts
|
288
|
-
var
|
329
|
+
var import_provider4 = require("@ai-sdk/provider");
|
289
330
|
function loadApiKey({
|
290
331
|
apiKey,
|
291
332
|
environmentVariableName,
|
@@ -296,23 +337,23 @@ function loadApiKey({
|
|
296
337
|
return apiKey;
|
297
338
|
}
|
298
339
|
if (apiKey != null) {
|
299
|
-
throw new
|
340
|
+
throw new import_provider4.LoadAPIKeyError({
|
300
341
|
message: `${description} API key must be a string.`
|
301
342
|
});
|
302
343
|
}
|
303
344
|
if (typeof process === "undefined") {
|
304
|
-
throw new
|
345
|
+
throw new import_provider4.LoadAPIKeyError({
|
305
346
|
message: `${description} API key is missing. Pass it using the '${apiKeyParameterName}' parameter. Environment variables is not supported in this environment.`
|
306
347
|
});
|
307
348
|
}
|
308
349
|
apiKey = process.env[environmentVariableName];
|
309
350
|
if (apiKey == null) {
|
310
|
-
throw new
|
351
|
+
throw new import_provider4.LoadAPIKeyError({
|
311
352
|
message: `${description} API key is missing. Pass it using the '${apiKeyParameterName}' parameter or the ${environmentVariableName} environment variable.`
|
312
353
|
});
|
313
354
|
}
|
314
355
|
if (typeof apiKey !== "string") {
|
315
|
-
throw new
|
356
|
+
throw new import_provider4.LoadAPIKeyError({
|
316
357
|
message: `${description} API key must be a string. The value of the ${environmentVariableName} environment variable is not a string.`
|
317
358
|
});
|
318
359
|
}
|
@@ -338,7 +379,7 @@ function loadOptionalSetting({
|
|
338
379
|
}
|
339
380
|
|
340
381
|
// src/load-setting.ts
|
341
|
-
var
|
382
|
+
var import_provider5 = require("@ai-sdk/provider");
|
342
383
|
function loadSetting({
|
343
384
|
settingValue,
|
344
385
|
environmentVariableName,
|
@@ -349,23 +390,23 @@ function loadSetting({
|
|
349
390
|
return settingValue;
|
350
391
|
}
|
351
392
|
if (settingValue != null) {
|
352
|
-
throw new
|
393
|
+
throw new import_provider5.LoadSettingError({
|
353
394
|
message: `${description} setting must be a string.`
|
354
395
|
});
|
355
396
|
}
|
356
397
|
if (typeof process === "undefined") {
|
357
|
-
throw new
|
398
|
+
throw new import_provider5.LoadSettingError({
|
358
399
|
message: `${description} setting is missing. Pass it using the '${settingName}' parameter. Environment variables is not supported in this environment.`
|
359
400
|
});
|
360
401
|
}
|
361
402
|
settingValue = process.env[environmentVariableName];
|
362
403
|
if (settingValue == null) {
|
363
|
-
throw new
|
404
|
+
throw new import_provider5.LoadSettingError({
|
364
405
|
message: `${description} setting is missing. Pass it using the '${settingName}' parameter or the ${environmentVariableName} environment variable.`
|
365
406
|
});
|
366
407
|
}
|
367
408
|
if (typeof settingValue !== "string") {
|
368
|
-
throw new
|
409
|
+
throw new import_provider5.LoadSettingError({
|
369
410
|
message: `${description} setting must be a string. The value of the ${environmentVariableName} environment variable is not a string.`
|
370
411
|
});
|
371
412
|
}
|
@@ -373,7 +414,7 @@ function loadSetting({
|
|
373
414
|
}
|
374
415
|
|
375
416
|
// src/parse-json.ts
|
376
|
-
var
|
417
|
+
var import_provider8 = require("@ai-sdk/provider");
|
377
418
|
|
378
419
|
// src/secure-json-parse.ts
|
379
420
|
var suspectProtoRx = /"__proto__"\s*:/;
|
@@ -421,10 +462,10 @@ function secureJsonParse(text) {
|
|
421
462
|
}
|
422
463
|
|
423
464
|
// src/validate-types.ts
|
424
|
-
var
|
465
|
+
var import_provider7 = require("@ai-sdk/provider");
|
425
466
|
|
426
467
|
// src/validator.ts
|
427
|
-
var
|
468
|
+
var import_provider6 = require("@ai-sdk/provider");
|
428
469
|
var validatorSymbol = Symbol.for("vercel.ai.validator");
|
429
470
|
function validator(validate) {
|
430
471
|
return { [validatorSymbol]: true, validate };
|
@@ -440,7 +481,7 @@ function standardSchemaValidator(standardSchema) {
|
|
440
481
|
const result = await standardSchema["~standard"].validate(value);
|
441
482
|
return result.issues == null ? { success: true, value: result.value } : {
|
442
483
|
success: false,
|
443
|
-
error: new
|
484
|
+
error: new import_provider6.TypeValidationError({
|
444
485
|
value,
|
445
486
|
cause: result.issues
|
446
487
|
})
|
@@ -455,7 +496,7 @@ async function validateTypes({
|
|
455
496
|
}) {
|
456
497
|
const result = await safeValidateTypes({ value, schema });
|
457
498
|
if (!result.success) {
|
458
|
-
throw
|
499
|
+
throw import_provider7.TypeValidationError.wrap({ value, cause: result.error });
|
459
500
|
}
|
460
501
|
return result.value;
|
461
502
|
}
|
@@ -474,20 +515,23 @@ async function safeValidateTypes({
|
|
474
515
|
}
|
475
516
|
return {
|
476
517
|
success: false,
|
477
|
-
error:
|
518
|
+
error: import_provider7.TypeValidationError.wrap({ value, cause: result.error }),
|
478
519
|
rawValue: value
|
479
520
|
};
|
480
521
|
} catch (error) {
|
481
522
|
return {
|
482
523
|
success: false,
|
483
|
-
error:
|
524
|
+
error: import_provider7.TypeValidationError.wrap({ value, cause: error }),
|
484
525
|
rawValue: value
|
485
526
|
};
|
486
527
|
}
|
487
528
|
}
|
488
529
|
|
489
530
|
// src/parse-json.ts
|
490
|
-
async function parseJSON({
|
531
|
+
async function parseJSON({
|
532
|
+
text,
|
533
|
+
schema
|
534
|
+
}) {
|
491
535
|
try {
|
492
536
|
const value = secureJsonParse(text);
|
493
537
|
if (schema == null) {
|
@@ -495,10 +539,10 @@ async function parseJSON({ text, schema }) {
|
|
495
539
|
}
|
496
540
|
return validateTypes({ value, schema });
|
497
541
|
} catch (error) {
|
498
|
-
if (
|
542
|
+
if (import_provider8.JSONParseError.isInstance(error) || import_provider8.TypeValidationError.isInstance(error)) {
|
499
543
|
throw error;
|
500
544
|
}
|
501
|
-
throw new
|
545
|
+
throw new import_provider8.JSONParseError({ text, cause: error });
|
502
546
|
}
|
503
547
|
}
|
504
548
|
async function safeParseJSON({
|
@@ -514,7 +558,7 @@ async function safeParseJSON({
|
|
514
558
|
} catch (error) {
|
515
559
|
return {
|
516
560
|
success: false,
|
517
|
-
error:
|
561
|
+
error: import_provider8.JSONParseError.isInstance(error) ? error : new import_provider8.JSONParseError({ text, cause: error }),
|
518
562
|
rawValue: void 0
|
519
563
|
};
|
520
564
|
}
|
@@ -547,7 +591,7 @@ function parseJsonEventStream({
|
|
547
591
|
}
|
548
592
|
|
549
593
|
// src/parse-provider-options.ts
|
550
|
-
var
|
594
|
+
var import_provider9 = require("@ai-sdk/provider");
|
551
595
|
async function parseProviderOptions({
|
552
596
|
provider,
|
553
597
|
providerOptions,
|
@@ -561,7 +605,7 @@ async function parseProviderOptions({
|
|
561
605
|
schema
|
562
606
|
});
|
563
607
|
if (!parsedProviderOptions.success) {
|
564
|
-
throw new
|
608
|
+
throw new import_provider9.InvalidArgumentError({
|
565
609
|
argument: "providerOptions",
|
566
610
|
message: `invalid ${provider} provider options`,
|
567
611
|
cause: parsedProviderOptions.error
|
@@ -571,7 +615,7 @@ async function parseProviderOptions({
|
|
571
615
|
}
|
572
616
|
|
573
617
|
// src/post-to-api.ts
|
574
|
-
var
|
618
|
+
var import_provider10 = require("@ai-sdk/provider");
|
575
619
|
var getOriginalFetch2 = () => globalThis.fetch;
|
576
620
|
var postJsonToApi = async ({
|
577
621
|
url,
|
@@ -642,10 +686,10 @@ var postToApi = async ({
|
|
642
686
|
requestBodyValues: body.values
|
643
687
|
});
|
644
688
|
} catch (error) {
|
645
|
-
if (isAbortError(error) ||
|
689
|
+
if (isAbortError(error) || import_provider10.APICallError.isInstance(error)) {
|
646
690
|
throw error;
|
647
691
|
}
|
648
|
-
throw new
|
692
|
+
throw new import_provider10.APICallError({
|
649
693
|
message: "Failed to process error response",
|
650
694
|
cause: error,
|
651
695
|
statusCode: response.status,
|
@@ -664,11 +708,11 @@ var postToApi = async ({
|
|
664
708
|
});
|
665
709
|
} catch (error) {
|
666
710
|
if (error instanceof Error) {
|
667
|
-
if (isAbortError(error) ||
|
711
|
+
if (isAbortError(error) || import_provider10.APICallError.isInstance(error)) {
|
668
712
|
throw error;
|
669
713
|
}
|
670
714
|
}
|
671
|
-
throw new
|
715
|
+
throw new import_provider10.APICallError({
|
672
716
|
message: "Failed to process successful response",
|
673
717
|
cause: error,
|
674
718
|
statusCode: response.status,
|
@@ -678,23 +722,7 @@ var postToApi = async ({
|
|
678
722
|
});
|
679
723
|
}
|
680
724
|
} catch (error) {
|
681
|
-
|
682
|
-
throw error;
|
683
|
-
}
|
684
|
-
if (error instanceof TypeError && error.message === "fetch failed") {
|
685
|
-
const cause = error.cause;
|
686
|
-
if (cause != null) {
|
687
|
-
throw new import_provider9.APICallError({
|
688
|
-
message: `Cannot connect to API: ${cause.message}`,
|
689
|
-
cause,
|
690
|
-
url,
|
691
|
-
requestBodyValues: body.values,
|
692
|
-
isRetryable: true
|
693
|
-
// retry when network error
|
694
|
-
});
|
695
|
-
}
|
696
|
-
}
|
697
|
-
throw error;
|
725
|
+
throw handleFetchError({ error, url, requestBodyValues: body.values });
|
698
726
|
}
|
699
727
|
};
|
700
728
|
|
@@ -702,6 +730,9 @@ var postToApi = async ({
|
|
702
730
|
function tool(tool2) {
|
703
731
|
return tool2;
|
704
732
|
}
|
733
|
+
function dynamicTool(tool2) {
|
734
|
+
return { ...tool2, type: "dynamic" };
|
735
|
+
}
|
705
736
|
|
706
737
|
// src/provider-defined-tool-factory.ts
|
707
738
|
function createProviderDefinedToolFactory({
|
@@ -768,7 +799,7 @@ async function resolve(value) {
|
|
768
799
|
}
|
769
800
|
|
770
801
|
// src/response-handler.ts
|
771
|
-
var
|
802
|
+
var import_provider11 = require("@ai-sdk/provider");
|
772
803
|
var createJsonErrorResponseHandler = ({
|
773
804
|
errorSchema,
|
774
805
|
errorToMessage,
|
@@ -779,7 +810,7 @@ var createJsonErrorResponseHandler = ({
|
|
779
810
|
if (responseBody.trim() === "") {
|
780
811
|
return {
|
781
812
|
responseHeaders,
|
782
|
-
value: new
|
813
|
+
value: new import_provider11.APICallError({
|
783
814
|
message: response.statusText,
|
784
815
|
url,
|
785
816
|
requestBodyValues,
|
@@ -797,7 +828,7 @@ var createJsonErrorResponseHandler = ({
|
|
797
828
|
});
|
798
829
|
return {
|
799
830
|
responseHeaders,
|
800
|
-
value: new
|
831
|
+
value: new import_provider11.APICallError({
|
801
832
|
message: errorToMessage(parsedError),
|
802
833
|
url,
|
803
834
|
requestBodyValues,
|
@@ -811,7 +842,7 @@ var createJsonErrorResponseHandler = ({
|
|
811
842
|
} catch (parseError) {
|
812
843
|
return {
|
813
844
|
responseHeaders,
|
814
|
-
value: new
|
845
|
+
value: new import_provider11.APICallError({
|
815
846
|
message: response.statusText,
|
816
847
|
url,
|
817
848
|
requestBodyValues,
|
@@ -826,7 +857,7 @@ var createJsonErrorResponseHandler = ({
|
|
826
857
|
var createEventSourceResponseHandler = (chunkSchema) => async ({ response }) => {
|
827
858
|
const responseHeaders = extractResponseHeaders(response);
|
828
859
|
if (response.body == null) {
|
829
|
-
throw new
|
860
|
+
throw new import_provider11.EmptyResponseBodyError({});
|
830
861
|
}
|
831
862
|
return {
|
832
863
|
responseHeaders,
|
@@ -839,7 +870,7 @@ var createEventSourceResponseHandler = (chunkSchema) => async ({ response }) =>
|
|
839
870
|
var createJsonStreamResponseHandler = (chunkSchema) => async ({ response }) => {
|
840
871
|
const responseHeaders = extractResponseHeaders(response);
|
841
872
|
if (response.body == null) {
|
842
|
-
throw new
|
873
|
+
throw new import_provider11.EmptyResponseBodyError({});
|
843
874
|
}
|
844
875
|
let buffer = "";
|
845
876
|
return {
|
@@ -871,7 +902,7 @@ var createJsonResponseHandler = (responseSchema) => async ({ response, url, requ
|
|
871
902
|
});
|
872
903
|
const responseHeaders = extractResponseHeaders(response);
|
873
904
|
if (!parsedResult.success) {
|
874
|
-
throw new
|
905
|
+
throw new import_provider11.APICallError({
|
875
906
|
message: "Invalid JSON response",
|
876
907
|
cause: parsedResult.error,
|
877
908
|
statusCode: response.status,
|
@@ -890,7 +921,7 @@ var createJsonResponseHandler = (responseSchema) => async ({ response, url, requ
|
|
890
921
|
var createBinaryResponseHandler = () => async ({ response, url, requestBodyValues }) => {
|
891
922
|
const responseHeaders = extractResponseHeaders(response);
|
892
923
|
if (!response.body) {
|
893
|
-
throw new
|
924
|
+
throw new import_provider11.APICallError({
|
894
925
|
message: "Response body is empty",
|
895
926
|
url,
|
896
927
|
requestBodyValues,
|
@@ -906,7 +937,7 @@ var createBinaryResponseHandler = () => async ({ response, url, requestBodyValue
|
|
906
937
|
value: new Uint8Array(buffer)
|
907
938
|
};
|
908
939
|
} catch (error) {
|
909
|
-
throw new
|
940
|
+
throw new import_provider11.APICallError({
|
910
941
|
message: "Failed to read response as array buffer",
|
911
942
|
url,
|
912
943
|
requestBodyValues,
|
@@ -922,7 +953,7 @@ var createStatusCodeErrorResponseHandler = () => async ({ response, url, request
|
|
922
953
|
const responseBody = await response.text();
|
923
954
|
return {
|
924
955
|
responseHeaders,
|
925
|
-
value: new
|
956
|
+
value: new import_provider11.APICallError({
|
926
957
|
message: response.statusText,
|
927
958
|
url,
|
928
959
|
requestBodyValues,
|
@@ -934,7 +965,7 @@ var createStatusCodeErrorResponseHandler = () => async ({ response, url, request
|
|
934
965
|
};
|
935
966
|
|
936
967
|
// src/zod-schema.ts
|
937
|
-
var z4 = __toESM(require("zod/v4
|
968
|
+
var z4 = __toESM(require("zod/v4"));
|
938
969
|
var import_zod_to_json_schema = __toESM(require("zod-to-json-schema"));
|
939
970
|
function zod3Schema(zodSchema2, options) {
|
940
971
|
var _a;
|
@@ -946,8 +977,8 @@ function zod3Schema(zodSchema2, options) {
|
|
946
977
|
// note: openai mode breaks various gemini conversions
|
947
978
|
}),
|
948
979
|
{
|
949
|
-
validate: (value) => {
|
950
|
-
const result = zodSchema2.
|
980
|
+
validate: async (value) => {
|
981
|
+
const result = await zodSchema2.safeParseAsync(value);
|
951
982
|
return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
|
952
983
|
}
|
953
984
|
}
|
@@ -962,8 +993,8 @@ function zod4Schema(zodSchema2, options) {
|
|
962
993
|
reused: useReferences ? "ref" : "inline"
|
963
994
|
});
|
964
995
|
return jsonSchema(z4JSONSchema, {
|
965
|
-
validate: (value) => {
|
966
|
-
const result = z4.
|
996
|
+
validate: async (value) => {
|
997
|
+
const result = await z4.safeParseAsync(zodSchema2, value);
|
967
998
|
return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
|
968
999
|
}
|
969
1000
|
});
|
@@ -1049,6 +1080,7 @@ var import_stream2 = require("eventsource-parser/stream");
|
|
1049
1080
|
createProviderDefinedToolFactoryWithOutputSchema,
|
1050
1081
|
createStatusCodeErrorResponseHandler,
|
1051
1082
|
delay,
|
1083
|
+
dynamicTool,
|
1052
1084
|
extractResponseHeaders,
|
1053
1085
|
generateId,
|
1054
1086
|
getErrorMessage,
|