@ai-sdk/gateway 3.0.192 → 3.0.193

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @ai-sdk/gateway
2
2
 
3
+ ## 3.0.193
4
+
5
+ ### Patch Changes
6
+
7
+ - e4ff9e7: fix(gateway): forward server-returned warnings on language model doGenerate
8
+
9
+ `generateText(...).warnings` through the gateway provider was always an empty
10
+ array: `doGenerate` spread the gateway response body and then overwrote the
11
+ server's `warnings` with a locally constructed empty array. The warnings the
12
+ gateway relays from the upstream provider (and gateway-originated warnings)
13
+ are now forwarded, matching the streaming path and every other modality.
14
+
3
15
  ## 3.0.192
4
16
 
5
17
  ### Patch Changes
package/dist/index.js CHANGED
@@ -904,6 +904,7 @@ var GatewayLanguageModel = class {
904
904
  };
905
905
  }
906
906
  async doGenerate(options) {
907
+ var _a11;
907
908
  const { args, warnings } = await this.getArgs(options);
908
909
  const { abortSignal } = options;
909
910
  const resolvedHeaders = await (0, import_provider_utils9.resolve)(this.config.headers());
@@ -925,8 +926,8 @@ var GatewayLanguageModel = class {
925
926
  failedResponseHandler: (0, import_provider_utils9.createJsonErrorResponseHandler)({
926
927
  errorSchema: import_v48.z.any(),
927
928
  errorToMessage: (data) => {
928
- var _a11;
929
- return (_a11 = (0, import_provider_utils9.getErrorMessage)(data)) != null ? _a11 : "unknown error";
929
+ var _a12;
930
+ return (_a12 = (0, import_provider_utils9.getErrorMessage)(data)) != null ? _a12 : "unknown error";
930
931
  }
931
932
  }),
932
933
  ...abortSignal && { abortSignal },
@@ -936,7 +937,7 @@ var GatewayLanguageModel = class {
936
937
  ...responseBody,
937
938
  request: { body: args },
938
939
  response: { headers: responseHeaders, body: rawResponse },
939
- warnings
940
+ warnings: [...(_a11 = responseBody.warnings) != null ? _a11 : [], ...warnings]
940
941
  };
941
942
  } catch (error) {
942
943
  throw await asGatewayError(error, await parseAuthMethod(resolvedHeaders));
@@ -2408,7 +2409,7 @@ async function getVercelRequestId() {
2408
2409
  }
2409
2410
 
2410
2411
  // src/version.ts
2411
- var VERSION = true ? "3.0.192" : "0.0.0-test";
2412
+ var VERSION = true ? "3.0.193" : "0.0.0-test";
2412
2413
 
2413
2414
  // src/gateway-provider.ts
2414
2415
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";