@ai-sdk/provider-utils 5.0.0-beta.24 → 5.0.0-beta.26
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 +12 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/test/index.js +1 -1
- package/dist/test/index.js.map +1 -1
- package/package.json +1 -1
- package/src/filter-nullable.ts +11 -0
- package/src/index.ts +1 -0
- package/src/parse-json.ts +1 -1
- package/src/post-to-api.ts +2 -2
- package/src/test/convert-response-stream-to-array.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/provider-utils
|
|
2
2
|
|
|
3
|
+
## 5.0.0-beta.26
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2e98477: fix: retain stack traces on async errors
|
|
8
|
+
|
|
9
|
+
## 5.0.0-beta.25
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- eea8d98: refactoring: rename tool execution events
|
|
14
|
+
|
|
3
15
|
## 5.0.0-beta.24
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -184,6 +184,14 @@ declare function extractResponseHeaders(response: Response): {
|
|
|
184
184
|
*/
|
|
185
185
|
type FetchFunction = typeof globalThis.fetch;
|
|
186
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Filters `null` and `undefined` values out of a list of values.
|
|
189
|
+
*
|
|
190
|
+
* @param values - The values to filter.
|
|
191
|
+
* @returns A new array containing only non-nullish values.
|
|
192
|
+
*/
|
|
193
|
+
declare function filterNullable<T>(...values: Array<T | undefined | null>): Array<T>;
|
|
194
|
+
|
|
187
195
|
/**
|
|
188
196
|
* Creates an ID generator.
|
|
189
197
|
* The total length of the ID is the sum of the prefix, separator, and random part length.
|
|
@@ -1754,4 +1762,4 @@ interface ToolResult<NAME extends string, INPUT, OUTPUT> {
|
|
|
1754
1762
|
dynamic?: boolean;
|
|
1755
1763
|
}
|
|
1756
1764
|
|
|
1757
|
-
export { type Arrayable, type AssistantContent, type AssistantModelMessage, type Context, type CustomPart, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type ExecutableTool, type FetchFunction, type FilePart, type FlexibleSchema, type HasRequiredKey, type IdGenerator, type ImagePart, type InferSchema, type InferToolContext, type InferToolInput, type InferToolOutput, type InferToolSetContext, type LazySchema, type MaybePromiseLike, type ModelMessage, type ParseResult, type ProviderOptions, type ProviderReference, type ProviderToolFactory, type ProviderToolFactoryWithOutputSchema, type ReasoningFilePart, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type StreamingToolCallDelta, StreamingToolCallTracker, type StreamingToolCallTrackerOptions, type SystemModelMessage, type TextPart, type Tool, type ToolApprovalRequest, type ToolApprovalResponse, type ToolCall, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolExecutionOptions, type ToolModelMessage, type ToolNameMapping, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type ToolSet, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asArray, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertImageModelFileToDataUri, convertToBase64, convertToFormData, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createProviderToolFactory, createProviderToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, createToolNameMapping, delay, downloadBlob, dynamicTool, executeTool, extractResponseHeaders, generateId, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isCustomReasoning, isExecutableTool, isNonNullable, isParsableJson, isProviderReference, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mapReasoningToProviderBudget, mapReasoningToProviderEffort, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, resolveProviderReference, safeParseJSON, safeValidateTypes, serializeModelOptions, stripFileExtension, tool, validateDownloadUrl, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
|
|
1765
|
+
export { type Arrayable, type AssistantContent, type AssistantModelMessage, type Context, type CustomPart, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type ExecutableTool, type FetchFunction, type FilePart, type FlexibleSchema, type HasRequiredKey, type IdGenerator, type ImagePart, type InferSchema, type InferToolContext, type InferToolInput, type InferToolOutput, type InferToolSetContext, type LazySchema, type MaybePromiseLike, type ModelMessage, type ParseResult, type ProviderOptions, type ProviderReference, type ProviderToolFactory, type ProviderToolFactoryWithOutputSchema, type ReasoningFilePart, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type StreamingToolCallDelta, StreamingToolCallTracker, type StreamingToolCallTrackerOptions, type SystemModelMessage, type TextPart, type Tool, type ToolApprovalRequest, type ToolApprovalResponse, type ToolCall, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolExecutionOptions, type ToolModelMessage, type ToolNameMapping, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type ToolSet, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asArray, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertImageModelFileToDataUri, convertToBase64, convertToFormData, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createProviderToolFactory, createProviderToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, createToolNameMapping, delay, downloadBlob, dynamicTool, executeTool, extractResponseHeaders, filterNullable, generateId, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isCustomReasoning, isExecutableTool, isNonNullable, isParsableJson, isProviderReference, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mapReasoningToProviderBudget, mapReasoningToProviderEffort, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, resolveProviderReference, safeParseJSON, safeValidateTypes, serializeModelOptions, stripFileExtension, tool, validateDownloadUrl, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
|
package/dist/index.js
CHANGED
|
@@ -420,6 +420,11 @@ function extractResponseHeaders(response) {
|
|
|
420
420
|
return Object.fromEntries([...response.headers]);
|
|
421
421
|
}
|
|
422
422
|
|
|
423
|
+
// src/filter-nullable.ts
|
|
424
|
+
function filterNullable(...values) {
|
|
425
|
+
return values.filter((value) => value != null);
|
|
426
|
+
}
|
|
427
|
+
|
|
423
428
|
// src/generate-id.ts
|
|
424
429
|
import { InvalidArgumentError } from "@ai-sdk/provider";
|
|
425
430
|
var createIdGenerator = ({
|
|
@@ -571,7 +576,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
571
576
|
}
|
|
572
577
|
|
|
573
578
|
// src/version.ts
|
|
574
|
-
var VERSION = true ? "5.0.0-beta.
|
|
579
|
+
var VERSION = true ? "5.0.0-beta.26" : "0.0.0-test";
|
|
575
580
|
|
|
576
581
|
// src/get-from-api.ts
|
|
577
582
|
var getOriginalFetch = () => globalThis.fetch;
|
|
@@ -2293,7 +2298,7 @@ async function parseJSON({
|
|
|
2293
2298
|
if (schema == null) {
|
|
2294
2299
|
return value;
|
|
2295
2300
|
}
|
|
2296
|
-
return validateTypes({ value, schema });
|
|
2301
|
+
return await validateTypes({ value, schema });
|
|
2297
2302
|
} catch (error) {
|
|
2298
2303
|
if (JSONParseError.isInstance(error) || TypeValidationError3.isInstance(error)) {
|
|
2299
2304
|
throw error;
|
|
@@ -2383,7 +2388,7 @@ var postJsonToApi = async ({
|
|
|
2383
2388
|
successfulResponseHandler,
|
|
2384
2389
|
abortSignal,
|
|
2385
2390
|
fetch: fetch2
|
|
2386
|
-
}) => postToApi({
|
|
2391
|
+
}) => await postToApi({
|
|
2387
2392
|
url,
|
|
2388
2393
|
headers: {
|
|
2389
2394
|
"Content-Type": "application/json",
|
|
@@ -2406,7 +2411,7 @@ var postFormDataToApi = async ({
|
|
|
2406
2411
|
successfulResponseHandler,
|
|
2407
2412
|
abortSignal,
|
|
2408
2413
|
fetch: fetch2
|
|
2409
|
-
}) => postToApi({
|
|
2414
|
+
}) => await postToApi({
|
|
2410
2415
|
url,
|
|
2411
2416
|
headers,
|
|
2412
2417
|
body: {
|
|
@@ -2981,6 +2986,7 @@ export {
|
|
|
2981
2986
|
dynamicTool,
|
|
2982
2987
|
executeTool,
|
|
2983
2988
|
extractResponseHeaders,
|
|
2989
|
+
filterNullable,
|
|
2984
2990
|
generateId,
|
|
2985
2991
|
getErrorMessage,
|
|
2986
2992
|
getFromApi,
|