@ai-sdk/xai 2.0.50 → 2.0.51

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,11 @@
1
1
  # @ai-sdk/xai
2
2
 
3
+ ## 2.0.51
4
+
5
+ ### Patch Changes
6
+
7
+ - c635580: fix (provider/xai): set response format to allow object generation
8
+
3
9
  ## 2.0.50
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1597,11 +1597,12 @@ var XaiResponsesLanguageModel = class {
1597
1597
  topP,
1598
1598
  stopSequences,
1599
1599
  seed,
1600
+ responseFormat,
1600
1601
  providerOptions,
1601
1602
  tools,
1602
1603
  toolChoice
1603
1604
  }) {
1604
- var _a, _b, _c, _d;
1605
+ var _a, _b, _c, _d, _e;
1605
1606
  const warnings = [];
1606
1607
  const options = (_a = await (0, import_provider_utils7.parseProviderOptions)({
1607
1608
  provider: "xai",
@@ -1644,6 +1645,17 @@ var XaiResponsesLanguageModel = class {
1644
1645
  temperature,
1645
1646
  top_p: topP,
1646
1647
  seed,
1648
+ ...(responseFormat == null ? void 0 : responseFormat.type) === "json" && {
1649
+ text: {
1650
+ format: responseFormat.schema != null ? {
1651
+ type: "json_schema",
1652
+ strict: true,
1653
+ name: (_e = responseFormat.name) != null ? _e : "response",
1654
+ description: responseFormat.description,
1655
+ schema: responseFormat.schema
1656
+ } : { type: "json_object" }
1657
+ }
1658
+ },
1647
1659
  ...options.reasoningEffort != null && {
1648
1660
  reasoning: { effort: options.reasoningEffort }
1649
1661
  },
@@ -2108,7 +2120,7 @@ var xaiTools = {
2108
2120
  };
2109
2121
 
2110
2122
  // src/version.ts
2111
- var VERSION = true ? "2.0.50" : "0.0.0-test";
2123
+ var VERSION = true ? "2.0.51" : "0.0.0-test";
2112
2124
 
2113
2125
  // src/xai-provider.ts
2114
2126
  var xaiErrorStructure = {