@ai-sdk/gateway 4.0.79 → 4.0.80

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
+ ## 4.0.80
4
+
5
+ ### Patch Changes
6
+
7
+ - 7f76d83: 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
  ## 4.0.79
4
16
 
5
17
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1410,6 +1410,7 @@ var GatewayLanguageModel = class _GatewayLanguageModel {
1410
1410
  };
1411
1411
  }
1412
1412
  async doGenerate(options) {
1413
+ var _a12;
1413
1414
  const { args, warnings } = await this.getArgs(options);
1414
1415
  const { abortSignal } = options;
1415
1416
  const resolvedHeaders = this.config.headers ? await resolve5(this.config.headers) : void 0;
@@ -1431,8 +1432,8 @@ var GatewayLanguageModel = class _GatewayLanguageModel {
1431
1432
  failedResponseHandler: createJsonErrorResponseHandler5({
1432
1433
  errorSchema: z.any(),
1433
1434
  errorToMessage: (data) => {
1434
- var _a12;
1435
- return (_a12 = getErrorMessage5(data)) != null ? _a12 : "unknown error";
1435
+ var _a13;
1436
+ return (_a13 = getErrorMessage5(data)) != null ? _a13 : "unknown error";
1436
1437
  }
1437
1438
  }),
1438
1439
  ...abortSignal && { abortSignal },
@@ -1442,7 +1443,7 @@ var GatewayLanguageModel = class _GatewayLanguageModel {
1442
1443
  ...responseBody,
1443
1444
  request: { body: args },
1444
1445
  response: { headers: responseHeaders, body: rawResponse },
1445
- warnings
1446
+ warnings: [...(_a12 = responseBody.warnings) != null ? _a12 : [], ...warnings]
1446
1447
  };
1447
1448
  } catch (error) {
1448
1449
  throw await asGatewayError(
@@ -3471,7 +3472,7 @@ async function getVercelRequestId() {
3471
3472
  }
3472
3473
 
3473
3474
  // src/version.ts
3474
- var VERSION = true ? "4.0.79" : "0.0.0-test";
3475
+ var VERSION = true ? "4.0.80" : "0.0.0-test";
3475
3476
 
3476
3477
  // src/gateway-provider.ts
3477
3478
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";