ai 6.0.0-beta.147 → 6.0.0-beta.149

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/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.147" : "0.0.0-test";
869
+ var VERSION = true ? "6.0.0-beta.149" : "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) || GatewayModelNotFoundError.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: "Unauthenticated. Configure AI_GATEWAY_API_KEY or configure and use a provider module. Learn more: https://vercel.link/unauthenticated-ai-gateway-v6",
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 error;
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