ai 6.0.0-beta.148 → 6.0.0-beta.150
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.mts +54 -4
- package/dist/index.d.ts +54 -4
- package/dist/index.js +44 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -17
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -866,7 +866,7 @@ import {
|
|
|
866
866
|
} from "@ai-sdk/provider-utils";
|
|
867
867
|
|
|
868
868
|
// src/version.ts
|
|
869
|
-
var VERSION = true ? "6.0.0-beta.
|
|
869
|
+
var VERSION = true ? "6.0.0-beta.150" : "0.0.0-test";
|
|
870
870
|
|
|
871
871
|
// src/util/download/download.ts
|
|
872
872
|
var download = async ({ url }) => {
|
|
@@ -1723,20 +1723,31 @@ async function standardizePrompt(prompt) {
|
|
|
1723
1723
|
}
|
|
1724
1724
|
|
|
1725
1725
|
// src/prompt/wrap-gateway-error.ts
|
|
1726
|
-
import {
|
|
1727
|
-
GatewayAuthenticationError,
|
|
1728
|
-
GatewayModelNotFoundError
|
|
1729
|
-
} from "@ai-sdk/gateway";
|
|
1726
|
+
import { GatewayAuthenticationError } from "@ai-sdk/gateway";
|
|
1730
1727
|
import { AISDKError as AISDKError18 } from "@ai-sdk/provider";
|
|
1731
1728
|
function wrapGatewayError(error) {
|
|
1732
|
-
if (GatewayAuthenticationError.isInstance(error)
|
|
1729
|
+
if (!GatewayAuthenticationError.isInstance(error))
|
|
1730
|
+
return error;
|
|
1731
|
+
const isProductionEnv = (process == null ? void 0 : process.env.NODE_ENV) === "production";
|
|
1732
|
+
const moreInfoURL = "https://v6.ai-sdk.dev/unauthenticated-ai-gateway";
|
|
1733
|
+
if (isProductionEnv) {
|
|
1733
1734
|
return new AISDKError18({
|
|
1734
1735
|
name: "GatewayError",
|
|
1735
|
-
message:
|
|
1736
|
-
cause: error
|
|
1736
|
+
message: `Unauthenticated. Configure AI_GATEWAY_API_KEY or use a provider module. Learn more: ${moreInfoURL}`
|
|
1737
1737
|
});
|
|
1738
1738
|
}
|
|
1739
|
-
return
|
|
1739
|
+
return Object.assign(
|
|
1740
|
+
new Error(`\x1B[1m\x1B[31mUnauthenticated request to AI Gateway.\x1B[0m
|
|
1741
|
+
|
|
1742
|
+
To authenticate, set the \x1B[33mAI_GATEWAY_API_KEY\x1B[0m environment variable with your API key.
|
|
1743
|
+
|
|
1744
|
+
Alternatively, you can use a provider module instead of the AI Gateway.
|
|
1745
|
+
|
|
1746
|
+
Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
1747
|
+
|
|
1748
|
+
`),
|
|
1749
|
+
{ name: "GatewayAuthenticationError" }
|
|
1750
|
+
);
|
|
1740
1751
|
}
|
|
1741
1752
|
|
|
1742
1753
|
// src/telemetry/assemble-operation-name.ts
|
|
@@ -2777,13 +2788,17 @@ var text = () => ({
|
|
|
2777
2788
|
}
|
|
2778
2789
|
});
|
|
2779
2790
|
var object = ({
|
|
2780
|
-
schema: inputSchema
|
|
2791
|
+
schema: inputSchema,
|
|
2792
|
+
name: name15,
|
|
2793
|
+
description
|
|
2781
2794
|
}) => {
|
|
2782
2795
|
const schema = asSchema2(inputSchema);
|
|
2783
2796
|
return {
|
|
2784
2797
|
responseFormat: resolve(schema.jsonSchema).then((jsonSchema2) => ({
|
|
2785
2798
|
type: "json",
|
|
2786
|
-
schema: jsonSchema2
|
|
2799
|
+
schema: jsonSchema2,
|
|
2800
|
+
...name15 != null && { name: name15 },
|
|
2801
|
+
...description != null && { description }
|
|
2787
2802
|
})),
|
|
2788
2803
|
async parseCompleteOutput({ text: text2 }, context) {
|
|
2789
2804
|
const parseResult = await safeParseJSON2({ text: text2 });
|
|
@@ -2832,7 +2847,9 @@ var object = ({
|
|
|
2832
2847
|
};
|
|
2833
2848
|
};
|
|
2834
2849
|
var array = ({
|
|
2835
|
-
element: inputElementSchema
|
|
2850
|
+
element: inputElementSchema,
|
|
2851
|
+
name: name15,
|
|
2852
|
+
description
|
|
2836
2853
|
}) => {
|
|
2837
2854
|
const elementSchema = asSchema2(inputElementSchema);
|
|
2838
2855
|
return {
|
|
@@ -2849,7 +2866,9 @@ var array = ({
|
|
|
2849
2866
|
},
|
|
2850
2867
|
required: ["elements"],
|
|
2851
2868
|
additionalProperties: false
|
|
2852
|
-
}
|
|
2869
|
+
},
|
|
2870
|
+
...name15 != null && { name: name15 },
|
|
2871
|
+
...description != null && { description }
|
|
2853
2872
|
};
|
|
2854
2873
|
}),
|
|
2855
2874
|
async parseCompleteOutput({ text: text2 }, context) {
|
|
@@ -2927,7 +2946,9 @@ var array = ({
|
|
|
2927
2946
|
};
|
|
2928
2947
|
};
|
|
2929
2948
|
var choice = ({
|
|
2930
|
-
options: choiceOptions
|
|
2949
|
+
options: choiceOptions,
|
|
2950
|
+
name: name15,
|
|
2951
|
+
description
|
|
2931
2952
|
}) => {
|
|
2932
2953
|
return {
|
|
2933
2954
|
// JSON schema that describes an enumeration:
|
|
@@ -2941,7 +2962,9 @@ var choice = ({
|
|
|
2941
2962
|
},
|
|
2942
2963
|
required: ["result"],
|
|
2943
2964
|
additionalProperties: false
|
|
2944
|
-
}
|
|
2965
|
+
},
|
|
2966
|
+
...name15 != null && { name: name15 },
|
|
2967
|
+
...description != null && { description }
|
|
2945
2968
|
}),
|
|
2946
2969
|
async parseCompleteOutput({ text: text2 }, context) {
|
|
2947
2970
|
const parseResult = await safeParseJSON2({ text: text2 });
|
|
@@ -2997,10 +3020,15 @@ var choice = ({
|
|
|
2997
3020
|
}
|
|
2998
3021
|
};
|
|
2999
3022
|
};
|
|
3000
|
-
var json = (
|
|
3023
|
+
var json = ({
|
|
3024
|
+
name: name15,
|
|
3025
|
+
description
|
|
3026
|
+
} = {}) => {
|
|
3001
3027
|
return {
|
|
3002
3028
|
responseFormat: Promise.resolve({
|
|
3003
|
-
type: "json"
|
|
3029
|
+
type: "json",
|
|
3030
|
+
...name15 != null && { name: name15 },
|
|
3031
|
+
...description != null && { description }
|
|
3004
3032
|
}),
|
|
3005
3033
|
async parseCompleteOutput({ text: text2 }, context) {
|
|
3006
3034
|
const parseResult = await safeParseJSON2({ text: text2 });
|