@ai-sdk/xai 4.0.58 → 4.0.59

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/xai",
3
- "version": "4.0.58",
3
+ "version": "4.0.59",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -29,8 +29,8 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@ai-sdk/provider": "4.0.14",
33
- "@ai-sdk/provider-utils": "5.0.40"
32
+ "@ai-sdk/provider": "4.0.15",
33
+ "@ai-sdk/provider-utils": "5.0.41"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@ai-sdk/test-server": "2.0.1",
@@ -4,7 +4,6 @@ import {
4
4
  type SharedV4Warning,
5
5
  } from '@ai-sdk/provider';
6
6
  import { validateTypes } from '@ai-sdk/provider-utils';
7
- import { removeAdditionalPropertiesFalse } from '../remove-additional-properties';
8
7
  import { fileSearchArgsSchema } from '../tool/file-search';
9
8
  import { imageGenerationArgsSchema } from '../tool/image-generation';
10
9
  import { mcpServerArgsSchema } from '../tool/mcp-server';
@@ -158,7 +157,7 @@ export async function prepareResponsesTools({
158
157
  type: 'function',
159
158
  name: tool.name,
160
159
  description: tool.description,
161
- parameters: removeAdditionalPropertiesFalse(tool.inputSchema),
160
+ parameters: tool.inputSchema,
162
161
  ...(tool.strict != null ? { strict: tool.strict } : {}),
163
162
  });
164
163
  }
@@ -3,7 +3,6 @@ import {
3
3
  type LanguageModelV4CallOptions,
4
4
  type SharedV4Warning,
5
5
  } from '@ai-sdk/provider';
6
- import { removeAdditionalPropertiesFalse } from './remove-additional-properties';
7
6
  import type { XaiToolChoice } from './xai-chat-prompt';
8
7
 
9
8
  export function prepareTools({
@@ -59,7 +58,7 @@ export function prepareTools({
59
58
  function: {
60
59
  name: tool.name,
61
60
  description: tool.description,
62
- parameters: removeAdditionalPropertiesFalse(tool.inputSchema),
61
+ parameters: tool.inputSchema,
63
62
  ...(tool.strict != null ? { strict: tool.strict } : {}),
64
63
  },
65
64
  });
@@ -1,24 +0,0 @@
1
- /**
2
- * Recursively removes `additionalProperties: false` entries from a JSON
3
- * schema.
4
- * Used to sanitize tool input schemas before sending them to the xAI API.
5
- * https://docs.x.ai/developers/model-capabilities/text/structured-outputs#supported-types
6
- */
7
- export function removeAdditionalPropertiesFalse(value: unknown): unknown {
8
- if (Array.isArray(value)) {
9
- return value.map(removeAdditionalPropertiesFalse);
10
- }
11
-
12
- if (value == null || typeof value !== 'object') {
13
- return value;
14
- }
15
-
16
- const result: Record<string, unknown> = {};
17
- for (const [key, propertyValue] of Object.entries(value)) {
18
- if (key === 'additionalProperties' && propertyValue === false) {
19
- continue;
20
- }
21
- result[key] = removeAdditionalPropertiesFalse(propertyValue);
22
- }
23
- return result;
24
- }