@ai-sdk/xai 4.0.0-beta.13 → 4.0.0-beta.15

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,22 @@
1
1
  # @ai-sdk/xai
2
2
 
3
+ ## 4.0.0-beta.15
4
+
5
+ ### Patch Changes
6
+
7
+ - 74d520f: feat: migrate providers to support new top-level `reasoning` parameter
8
+ - Updated dependencies [74d520f]
9
+ - @ai-sdk/openai-compatible@3.0.0-beta.9
10
+
11
+ ## 4.0.0-beta.14
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [3887c70]
16
+ - @ai-sdk/provider-utils@5.0.0-beta.6
17
+ - @ai-sdk/provider@4.0.0-beta.4
18
+ - @ai-sdk/openai-compatible@3.0.0-beta.8
19
+
3
20
  ## 4.0.0-beta.13
4
21
 
5
22
  ### Major Changes
@@ -609,13 +626,13 @@
609
626
  Before
610
627
 
611
628
  ```ts
612
- model.textEmbeddingModel('my-model-id');
629
+ model.textEmbeddingModel("my-model-id");
613
630
  ```
614
631
 
615
632
  After
616
633
 
617
634
  ```ts
618
- model.embeddingModel('my-model-id');
635
+ model.embeddingModel("my-model-id");
619
636
  ```
620
637
 
621
638
  - 2625a04: feat(openai); update spec for mcp approval
@@ -873,13 +890,13 @@
873
890
  Before
874
891
 
875
892
  ```ts
876
- model.textEmbeddingModel('my-model-id');
893
+ model.textEmbeddingModel("my-model-id");
877
894
  ```
878
895
 
879
896
  After
880
897
 
881
898
  ```ts
882
- model.embeddingModel('my-model-id');
899
+ model.embeddingModel("my-model-id");
883
900
  ```
884
901
 
885
902
  - 8514146: add grok-4-1 model IDs
@@ -1422,7 +1439,7 @@
1422
1439
 
1423
1440
  ```js
1424
1441
  await generateImage({
1425
- model: luma.image('photon-flash-1', {
1442
+ model: luma.image("photon-flash-1", {
1426
1443
  maxImagesPerCall: 5,
1427
1444
  pollIntervalMillis: 500,
1428
1445
  }),
@@ -1435,7 +1452,7 @@
1435
1452
 
1436
1453
  ```js
1437
1454
  await generateImage({
1438
- model: luma.image('photon-flash-1'),
1455
+ model: luma.image("photon-flash-1"),
1439
1456
  prompt,
1440
1457
  n: 10,
1441
1458
  maxImagesPerCall: 5,
@@ -1751,7 +1768,7 @@
1751
1768
 
1752
1769
  ```js
1753
1770
  await generateImage({
1754
- model: luma.image('photon-flash-1', {
1771
+ model: luma.image("photon-flash-1", {
1755
1772
  maxImagesPerCall: 5,
1756
1773
  pollIntervalMillis: 500,
1757
1774
  }),
@@ -1764,7 +1781,7 @@
1764
1781
 
1765
1782
  ```js
1766
1783
  await generateImage({
1767
- model: luma.image('photon-flash-1'),
1784
+ model: luma.image("photon-flash-1"),
1768
1785
  prompt,
1769
1786
  n: 10,
1770
1787
  maxImagesPerCall: 5,
package/dist/index.js CHANGED
@@ -390,12 +390,13 @@ var XaiChatLanguageModel = class {
390
390
  presencePenalty,
391
391
  stopSequences,
392
392
  seed,
393
+ reasoning,
393
394
  responseFormat,
394
395
  providerOptions,
395
396
  tools,
396
397
  toolChoice
397
398
  }) {
398
- var _a, _b, _c;
399
+ var _a, _b, _c, _d;
399
400
  const warnings = [];
400
401
  const options = (_a = await (0, import_provider_utils3.parseProviderOptions)({
401
402
  provider: "xai",
@@ -435,14 +436,24 @@ var XaiChatLanguageModel = class {
435
436
  temperature,
436
437
  top_p: topP,
437
438
  seed,
438
- reasoning_effort: options.reasoningEffort,
439
+ reasoning_effort: (_b = options.reasoningEffort) != null ? _b : (0, import_provider_utils3.isCustomReasoning)(reasoning) ? reasoning === "none" ? void 0 : (0, import_provider_utils3.mapReasoningToProviderEffort)({
440
+ reasoning,
441
+ effortMap: {
442
+ minimal: "low",
443
+ low: "low",
444
+ medium: "low",
445
+ high: "high",
446
+ xhigh: "high"
447
+ },
448
+ warnings
449
+ }) : void 0,
439
450
  // parallel function calling
440
451
  parallel_function_calling: options.parallel_function_calling,
441
452
  // response format
442
453
  response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ? responseFormat.schema != null ? {
443
454
  type: "json_schema",
444
455
  json_schema: {
445
- name: (_b = responseFormat.name) != null ? _b : "response",
456
+ name: (_c = responseFormat.name) != null ? _c : "response",
446
457
  schema: responseFormat.schema,
447
458
  strict: true
448
459
  }
@@ -454,7 +465,7 @@ var XaiChatLanguageModel = class {
454
465
  from_date: options.searchParameters.fromDate,
455
466
  to_date: options.searchParameters.toDate,
456
467
  max_search_results: options.searchParameters.maxSearchResults,
457
- sources: (_c = options.searchParameters.sources) == null ? void 0 : _c.map((source) => {
468
+ sources: (_d = options.searchParameters.sources) == null ? void 0 : _d.map((source) => {
458
469
  var _a2;
459
470
  return {
460
471
  type: source.type,
@@ -1984,9 +1995,10 @@ var XaiResponsesLanguageModel = class {
1984
1995
  responseFormat,
1985
1996
  providerOptions,
1986
1997
  tools,
1987
- toolChoice
1998
+ toolChoice,
1999
+ reasoning
1988
2000
  }) {
1989
- var _a, _b, _c, _d, _e, _f, _g;
2001
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1990
2002
  const warnings = [];
1991
2003
  const options = (_a = await (0, import_provider_utils11.parseProviderOptions)({
1992
2004
  provider: "xai",
@@ -2033,6 +2045,17 @@ var XaiResponsesLanguageModel = class {
2033
2045
  include = [...include, "reasoning.encrypted_content"];
2034
2046
  }
2035
2047
  }
2048
+ const resolvedReasoningEffort = (_g = options.reasoningEffort) != null ? _g : (0, import_provider_utils11.isCustomReasoning)(reasoning) ? reasoning === "none" ? void 0 : (0, import_provider_utils11.mapReasoningToProviderEffort)({
2049
+ reasoning,
2050
+ effortMap: {
2051
+ minimal: "low",
2052
+ low: "low",
2053
+ medium: "medium",
2054
+ high: "high",
2055
+ xhigh: "high"
2056
+ },
2057
+ warnings
2058
+ }) : void 0;
2036
2059
  const baseArgs = {
2037
2060
  model: this.modelId,
2038
2061
  input,
@@ -2047,16 +2070,16 @@ var XaiResponsesLanguageModel = class {
2047
2070
  format: responseFormat.schema != null ? {
2048
2071
  type: "json_schema",
2049
2072
  strict: true,
2050
- name: (_g = responseFormat.name) != null ? _g : "response",
2073
+ name: (_h = responseFormat.name) != null ? _h : "response",
2051
2074
  description: responseFormat.description,
2052
2075
  schema: responseFormat.schema
2053
2076
  } : { type: "json_object" }
2054
2077
  }
2055
2078
  },
2056
- ...(options.reasoningEffort != null || options.reasoningSummary != null) && {
2079
+ ...(resolvedReasoningEffort != null || options.reasoningSummary != null) && {
2057
2080
  reasoning: {
2058
- ...options.reasoningEffort != null && {
2059
- effort: options.reasoningEffort
2081
+ ...resolvedReasoningEffort != null && {
2082
+ effort: resolvedReasoningEffort
2060
2083
  },
2061
2084
  ...options.reasoningSummary != null && {
2062
2085
  summary: options.reasoningSummary
@@ -2726,7 +2749,7 @@ var xaiTools = {
2726
2749
  };
2727
2750
 
2728
2751
  // src/version.ts
2729
- var VERSION = true ? "4.0.0-beta.13" : "0.0.0-test";
2752
+ var VERSION = true ? "4.0.0-beta.15" : "0.0.0-test";
2730
2753
 
2731
2754
  // src/xai-video-model.ts
2732
2755
  var import_provider6 = require("@ai-sdk/provider");