@ai-sdk/xai 3.0.0-beta.47 → 3.0.0-beta.48

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,15 @@
1
1
  # @ai-sdk/xai
2
2
 
3
+ ## 3.0.0-beta.48
4
+
5
+ ### Patch Changes
6
+
7
+ - 544d4e8: chore(specification): rename v3 provider defined tool to provider tool
8
+ - Updated dependencies [544d4e8]
9
+ - @ai-sdk/openai-compatible@2.0.0-beta.41
10
+ - @ai-sdk/provider-utils@4.0.0-beta.40
11
+ - @ai-sdk/provider@3.0.0-beta.22
12
+
3
13
  ## 3.0.0-beta.47
4
14
 
5
15
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -73,7 +73,7 @@ type XaiResponsesProviderOptions = z.infer<typeof xaiResponsesProviderOptions>;
73
73
 
74
74
  type XaiImageModelId = 'grok-2-image' | (string & {});
75
75
 
76
- declare const codeExecutionToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<Record<string, never>, {
76
+ declare const codeExecutionToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
77
77
  output: string;
78
78
  error?: string | undefined;
79
79
  }, object>;
@@ -82,7 +82,7 @@ declare const codeExecution: (args?: Parameters<typeof codeExecutionToolFactory>
82
82
  error?: string | undefined;
83
83
  }>;
84
84
 
85
- declare const viewImageToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<Record<string, never>, {
85
+ declare const viewImageToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
86
86
  description: string;
87
87
  objects?: string[] | undefined;
88
88
  }, object>;
@@ -91,7 +91,7 @@ declare const viewImage: (args?: Parameters<typeof viewImageToolFactory>[0]) =>
91
91
  objects?: string[] | undefined;
92
92
  }>;
93
93
 
94
- declare const viewXVideoToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<Record<string, never>, {
94
+ declare const viewXVideoToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
95
95
  description: string;
96
96
  transcript?: string | undefined;
97
97
  duration?: number | undefined;
@@ -102,7 +102,7 @@ declare const viewXVideo: (args?: Parameters<typeof viewXVideoToolFactory>[0]) =
102
102
  duration?: number | undefined;
103
103
  }>;
104
104
 
105
- declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<Record<string, never>, {
105
+ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
106
106
  query: string;
107
107
  sources: Array<{
108
108
  title: string;
@@ -123,7 +123,7 @@ declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) =>
123
123
  }>;
124
124
  }>;
125
125
 
126
- declare const xSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<Record<string, never>, {
126
+ declare const xSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
127
127
  query: string;
128
128
  posts: Array<{
129
129
  author: string;
@@ -150,21 +150,21 @@ declare const xSearch: (args?: Parameters<typeof xSearchToolFactory>[0]) => _ai_
150
150
  }>;
151
151
 
152
152
  declare const xaiTools: {
153
- codeExecution: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<Record<string, never>, {
153
+ codeExecution: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
154
154
  output: string;
155
155
  error?: string | undefined;
156
156
  }, object>>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
157
157
  output: string;
158
158
  error?: string | undefined;
159
159
  }>;
160
- viewImage: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<Record<string, never>, {
160
+ viewImage: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
161
161
  description: string;
162
162
  objects?: string[] | undefined;
163
163
  }, object>>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
164
164
  description: string;
165
165
  objects?: string[] | undefined;
166
166
  }>;
167
- viewXVideo: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<Record<string, never>, {
167
+ viewXVideo: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
168
168
  description: string;
169
169
  transcript?: string | undefined;
170
170
  duration?: number | undefined;
@@ -173,7 +173,7 @@ declare const xaiTools: {
173
173
  transcript?: string | undefined;
174
174
  duration?: number | undefined;
175
175
  }>;
176
- webSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<Record<string, never>, {
176
+ webSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
177
177
  query: string;
178
178
  sources: Array<{
179
179
  title: string;
@@ -192,7 +192,7 @@ declare const xaiTools: {
192
192
  snippet: string;
193
193
  }>;
194
194
  }>;
195
- xSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<Record<string, never>, {
195
+ xSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
196
196
  query: string;
197
197
  posts: Array<{
198
198
  author: string;
package/dist/index.d.ts CHANGED
@@ -73,7 +73,7 @@ type XaiResponsesProviderOptions = z.infer<typeof xaiResponsesProviderOptions>;
73
73
 
74
74
  type XaiImageModelId = 'grok-2-image' | (string & {});
75
75
 
76
- declare const codeExecutionToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<Record<string, never>, {
76
+ declare const codeExecutionToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
77
77
  output: string;
78
78
  error?: string | undefined;
79
79
  }, object>;
@@ -82,7 +82,7 @@ declare const codeExecution: (args?: Parameters<typeof codeExecutionToolFactory>
82
82
  error?: string | undefined;
83
83
  }>;
84
84
 
85
- declare const viewImageToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<Record<string, never>, {
85
+ declare const viewImageToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
86
86
  description: string;
87
87
  objects?: string[] | undefined;
88
88
  }, object>;
@@ -91,7 +91,7 @@ declare const viewImage: (args?: Parameters<typeof viewImageToolFactory>[0]) =>
91
91
  objects?: string[] | undefined;
92
92
  }>;
93
93
 
94
- declare const viewXVideoToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<Record<string, never>, {
94
+ declare const viewXVideoToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
95
95
  description: string;
96
96
  transcript?: string | undefined;
97
97
  duration?: number | undefined;
@@ -102,7 +102,7 @@ declare const viewXVideo: (args?: Parameters<typeof viewXVideoToolFactory>[0]) =
102
102
  duration?: number | undefined;
103
103
  }>;
104
104
 
105
- declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<Record<string, never>, {
105
+ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
106
106
  query: string;
107
107
  sources: Array<{
108
108
  title: string;
@@ -123,7 +123,7 @@ declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) =>
123
123
  }>;
124
124
  }>;
125
125
 
126
- declare const xSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<Record<string, never>, {
126
+ declare const xSearchToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
127
127
  query: string;
128
128
  posts: Array<{
129
129
  author: string;
@@ -150,21 +150,21 @@ declare const xSearch: (args?: Parameters<typeof xSearchToolFactory>[0]) => _ai_
150
150
  }>;
151
151
 
152
152
  declare const xaiTools: {
153
- codeExecution: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<Record<string, never>, {
153
+ codeExecution: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
154
154
  output: string;
155
155
  error?: string | undefined;
156
156
  }, object>>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
157
157
  output: string;
158
158
  error?: string | undefined;
159
159
  }>;
160
- viewImage: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<Record<string, never>, {
160
+ viewImage: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
161
161
  description: string;
162
162
  objects?: string[] | undefined;
163
163
  }, object>>[0]) => _ai_sdk_provider_utils.Tool<Record<string, never>, {
164
164
  description: string;
165
165
  objects?: string[] | undefined;
166
166
  }>;
167
- viewXVideo: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<Record<string, never>, {
167
+ viewXVideo: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
168
168
  description: string;
169
169
  transcript?: string | undefined;
170
170
  duration?: number | undefined;
@@ -173,7 +173,7 @@ declare const xaiTools: {
173
173
  transcript?: string | undefined;
174
174
  duration?: number | undefined;
175
175
  }>;
176
- webSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<Record<string, never>, {
176
+ webSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
177
177
  query: string;
178
178
  sources: Array<{
179
179
  title: string;
@@ -192,7 +192,7 @@ declare const xaiTools: {
192
192
  snippet: string;
193
193
  }>;
194
194
  }>;
195
- xSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<Record<string, never>, {
195
+ xSearch: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
196
196
  query: string;
197
197
  posts: Array<{
198
198
  author: string;
package/dist/index.js CHANGED
@@ -291,7 +291,7 @@ function prepareTools({
291
291
  }
292
292
  const xaiTools2 = [];
293
293
  for (const tool of tools) {
294
- if (tool.type === "provider-defined") {
294
+ if (tool.type === "provider") {
295
295
  toolWarnings.push({
296
296
  type: "unsupported",
297
297
  feature: `provider-defined tool ${tool.name}`
@@ -1242,7 +1242,7 @@ var webSearchOutputSchema = (0, import_provider_utils4.lazySchema)(
1242
1242
  })
1243
1243
  )
1244
1244
  );
1245
- var webSearchToolFactory = (0, import_provider_utils4.createProviderDefinedToolFactoryWithOutputSchema)({
1245
+ var webSearchToolFactory = (0, import_provider_utils4.createProviderToolFactoryWithOutputSchema)({
1246
1246
  id: "xai.web_search",
1247
1247
  inputSchema: (0, import_provider_utils4.lazySchema)(() => (0, import_provider_utils4.zodSchema)(import_v46.z.object({}))),
1248
1248
  outputSchema: webSearchOutputSchema
@@ -1279,7 +1279,7 @@ var xSearchOutputSchema = (0, import_provider_utils5.lazySchema)(
1279
1279
  })
1280
1280
  )
1281
1281
  );
1282
- var xSearchToolFactory = (0, import_provider_utils5.createProviderDefinedToolFactoryWithOutputSchema)({
1282
+ var xSearchToolFactory = (0, import_provider_utils5.createProviderToolFactoryWithOutputSchema)({
1283
1283
  id: "xai.x_search",
1284
1284
  inputSchema: (0, import_provider_utils5.lazySchema)(() => (0, import_provider_utils5.zodSchema)(import_v47.z.object({}))),
1285
1285
  outputSchema: xSearchOutputSchema
@@ -1300,7 +1300,7 @@ async function prepareResponsesTools({
1300
1300
  const toolByName = /* @__PURE__ */ new Map();
1301
1301
  for (const tool of normalizedTools) {
1302
1302
  toolByName.set(tool.name, tool);
1303
- if (tool.type === "provider-defined") {
1303
+ if (tool.type === "provider") {
1304
1304
  switch (tool.id) {
1305
1305
  case "xai.web_search": {
1306
1306
  const args = await (0, import_provider_utils6.validateTypes)({
@@ -1399,7 +1399,7 @@ async function prepareResponsesTools({
1399
1399
  toolWarnings
1400
1400
  };
1401
1401
  }
1402
- if (selectedTool.type === "provider-defined") {
1402
+ if (selectedTool.type === "provider") {
1403
1403
  switch (selectedTool.id) {
1404
1404
  case "xai.web_search":
1405
1405
  return {
@@ -1501,13 +1501,13 @@ var XaiResponsesLanguageModel = class {
1501
1501
  warnings.push({ type: "unsupported", feature: "stopSequences" });
1502
1502
  }
1503
1503
  const webSearchToolName = (_b = tools == null ? void 0 : tools.find(
1504
- (tool) => tool.type === "provider-defined" && tool.id === "xai.web_search"
1504
+ (tool) => tool.type === "provider" && tool.id === "xai.web_search"
1505
1505
  )) == null ? void 0 : _b.name;
1506
1506
  const xSearchToolName = (_c = tools == null ? void 0 : tools.find(
1507
- (tool) => tool.type === "provider-defined" && tool.id === "xai.x_search"
1507
+ (tool) => tool.type === "provider" && tool.id === "xai.x_search"
1508
1508
  )) == null ? void 0 : _c.name;
1509
1509
  const codeExecutionToolName = (_d = tools == null ? void 0 : tools.find(
1510
- (tool) => tool.type === "provider-defined" && tool.id === "xai.code_execution"
1510
+ (tool) => tool.type === "provider" && tool.id === "xai.code_execution"
1511
1511
  )) == null ? void 0 : _d.name;
1512
1512
  const { input, inputWarnings } = await convertToXaiResponsesInput({
1513
1513
  prompt,
@@ -1942,7 +1942,7 @@ var codeExecutionOutputSchema = import_v48.z.object({
1942
1942
  output: import_v48.z.string().describe("the output of the code execution"),
1943
1943
  error: import_v48.z.string().optional().describe("any error that occurred")
1944
1944
  });
1945
- var codeExecutionToolFactory = (0, import_provider_utils8.createProviderDefinedToolFactoryWithOutputSchema)({
1945
+ var codeExecutionToolFactory = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
1946
1946
  id: "xai.code_execution",
1947
1947
  inputSchema: import_v48.z.object({}).describe("no input parameters"),
1948
1948
  outputSchema: codeExecutionOutputSchema
@@ -1956,7 +1956,7 @@ var viewImageOutputSchema = import_v49.z.object({
1956
1956
  description: import_v49.z.string().describe("description of the image"),
1957
1957
  objects: import_v49.z.array(import_v49.z.string()).optional().describe("objects detected in the image")
1958
1958
  });
1959
- var viewImageToolFactory = (0, import_provider_utils9.createProviderDefinedToolFactoryWithOutputSchema)({
1959
+ var viewImageToolFactory = (0, import_provider_utils9.createProviderToolFactoryWithOutputSchema)({
1960
1960
  id: "xai.view_image",
1961
1961
  inputSchema: import_v49.z.object({}).describe("no input parameters"),
1962
1962
  outputSchema: viewImageOutputSchema
@@ -1971,7 +1971,7 @@ var viewXVideoOutputSchema = import_v410.z.object({
1971
1971
  description: import_v410.z.string().describe("description of the video content"),
1972
1972
  duration: import_v410.z.number().optional().describe("duration in seconds")
1973
1973
  });
1974
- var viewXVideoToolFactory = (0, import_provider_utils10.createProviderDefinedToolFactoryWithOutputSchema)({
1974
+ var viewXVideoToolFactory = (0, import_provider_utils10.createProviderToolFactoryWithOutputSchema)({
1975
1975
  id: "xai.view_x_video",
1976
1976
  inputSchema: import_v410.z.object({}).describe("no input parameters"),
1977
1977
  outputSchema: viewXVideoOutputSchema
@@ -1988,7 +1988,7 @@ var xaiTools = {
1988
1988
  };
1989
1989
 
1990
1990
  // src/version.ts
1991
- var VERSION = true ? "3.0.0-beta.47" : "0.0.0-test";
1991
+ var VERSION = true ? "3.0.0-beta.48" : "0.0.0-test";
1992
1992
 
1993
1993
  // src/xai-provider.ts
1994
1994
  var xaiErrorStructure = {