@ai-sdk/xai 4.0.0-beta.7 → 4.0.0-beta.8
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 +6 -0
- package/dist/index.d.mts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/convert-to-xai-chat-messages.ts +5 -5
- package/src/convert-xai-chat-usage.ts +2 -2
- package/src/map-xai-finish-reason.ts +2 -2
- package/src/responses/convert-to-xai-responses-input.ts +5 -5
- package/src/responses/convert-xai-responses-usage.ts +2 -2
- package/src/responses/map-xai-responses-finish-reason.ts +2 -2
- package/src/responses/xai-responses-language-model.ts +21 -21
- package/src/responses/xai-responses-prepare-tools.ts +6 -6
- package/src/xai-chat-language-model.ts +21 -21
- package/src/xai-image-model.ts +6 -6
- package/src/xai-prepare-tools.ts +6 -6
- package/src/xai-provider.ts +14 -14
- package/src/xai-video-model.ts +7 -7
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
|
-
import {
|
|
2
|
+
import { ProviderV4, LanguageModelV4, ImageModelV4, Experimental_VideoModelV4 } from '@ai-sdk/provider';
|
|
3
3
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
4
4
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
5
5
|
|
|
@@ -311,36 +311,36 @@ declare const xaiTools: {
|
|
|
311
311
|
}>;
|
|
312
312
|
};
|
|
313
313
|
|
|
314
|
-
interface XaiProvider extends
|
|
315
|
-
(modelId: XaiResponsesModelId):
|
|
314
|
+
interface XaiProvider extends ProviderV4 {
|
|
315
|
+
(modelId: XaiResponsesModelId): LanguageModelV4;
|
|
316
316
|
/**
|
|
317
317
|
* Creates an Xai language model for text generation.
|
|
318
318
|
*/
|
|
319
|
-
languageModel(modelId: XaiResponsesModelId):
|
|
319
|
+
languageModel(modelId: XaiResponsesModelId): LanguageModelV4;
|
|
320
320
|
/**
|
|
321
321
|
* Creates an Xai chat model for text generation.
|
|
322
322
|
*/
|
|
323
|
-
chat: (modelId: XaiChatModelId) =>
|
|
323
|
+
chat: (modelId: XaiChatModelId) => LanguageModelV4;
|
|
324
324
|
/**
|
|
325
325
|
* Creates an Xai responses model for text generation.
|
|
326
326
|
*/
|
|
327
|
-
responses: (modelId: XaiResponsesModelId) =>
|
|
327
|
+
responses: (modelId: XaiResponsesModelId) => LanguageModelV4;
|
|
328
328
|
/**
|
|
329
329
|
* Creates an Xai image model for image generation.
|
|
330
330
|
*/
|
|
331
|
-
image(modelId: XaiImageModelId):
|
|
331
|
+
image(modelId: XaiImageModelId): ImageModelV4;
|
|
332
332
|
/**
|
|
333
333
|
* Creates an Xai image model for image generation.
|
|
334
334
|
*/
|
|
335
|
-
imageModel(modelId: XaiImageModelId):
|
|
335
|
+
imageModel(modelId: XaiImageModelId): ImageModelV4;
|
|
336
336
|
/**
|
|
337
337
|
* Creates an Xai video model for video generation.
|
|
338
338
|
*/
|
|
339
|
-
video(modelId: XaiVideoModelId):
|
|
339
|
+
video(modelId: XaiVideoModelId): Experimental_VideoModelV4;
|
|
340
340
|
/**
|
|
341
341
|
* Creates an Xai video model for video generation.
|
|
342
342
|
*/
|
|
343
|
-
videoModel(modelId: XaiVideoModelId):
|
|
343
|
+
videoModel(modelId: XaiVideoModelId): Experimental_VideoModelV4;
|
|
344
344
|
/**
|
|
345
345
|
* Server-side agentic tools for use with the responses API.
|
|
346
346
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
|
-
import {
|
|
2
|
+
import { ProviderV4, LanguageModelV4, ImageModelV4, Experimental_VideoModelV4 } from '@ai-sdk/provider';
|
|
3
3
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
4
4
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
5
5
|
|
|
@@ -311,36 +311,36 @@ declare const xaiTools: {
|
|
|
311
311
|
}>;
|
|
312
312
|
};
|
|
313
313
|
|
|
314
|
-
interface XaiProvider extends
|
|
315
|
-
(modelId: XaiResponsesModelId):
|
|
314
|
+
interface XaiProvider extends ProviderV4 {
|
|
315
|
+
(modelId: XaiResponsesModelId): LanguageModelV4;
|
|
316
316
|
/**
|
|
317
317
|
* Creates an Xai language model for text generation.
|
|
318
318
|
*/
|
|
319
|
-
languageModel(modelId: XaiResponsesModelId):
|
|
319
|
+
languageModel(modelId: XaiResponsesModelId): LanguageModelV4;
|
|
320
320
|
/**
|
|
321
321
|
* Creates an Xai chat model for text generation.
|
|
322
322
|
*/
|
|
323
|
-
chat: (modelId: XaiChatModelId) =>
|
|
323
|
+
chat: (modelId: XaiChatModelId) => LanguageModelV4;
|
|
324
324
|
/**
|
|
325
325
|
* Creates an Xai responses model for text generation.
|
|
326
326
|
*/
|
|
327
|
-
responses: (modelId: XaiResponsesModelId) =>
|
|
327
|
+
responses: (modelId: XaiResponsesModelId) => LanguageModelV4;
|
|
328
328
|
/**
|
|
329
329
|
* Creates an Xai image model for image generation.
|
|
330
330
|
*/
|
|
331
|
-
image(modelId: XaiImageModelId):
|
|
331
|
+
image(modelId: XaiImageModelId): ImageModelV4;
|
|
332
332
|
/**
|
|
333
333
|
* Creates an Xai image model for image generation.
|
|
334
334
|
*/
|
|
335
|
-
imageModel(modelId: XaiImageModelId):
|
|
335
|
+
imageModel(modelId: XaiImageModelId): ImageModelV4;
|
|
336
336
|
/**
|
|
337
337
|
* Creates an Xai video model for video generation.
|
|
338
338
|
*/
|
|
339
|
-
video(modelId: XaiVideoModelId):
|
|
339
|
+
video(modelId: XaiVideoModelId): Experimental_VideoModelV4;
|
|
340
340
|
/**
|
|
341
341
|
* Creates an Xai video model for video generation.
|
|
342
342
|
*/
|
|
343
|
-
videoModel(modelId: XaiVideoModelId):
|
|
343
|
+
videoModel(modelId: XaiVideoModelId): Experimental_VideoModelV4;
|
|
344
344
|
/**
|
|
345
345
|
* Server-side agentic tools for use with the responses API.
|
|
346
346
|
*/
|
package/dist/index.js
CHANGED
|
@@ -18,8 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
VERSION: () => VERSION,
|
|
24
24
|
codeExecution: () => codeExecution,
|
|
25
25
|
createXai: () => createXai,
|
|
@@ -31,7 +31,7 @@ __export(src_exports, {
|
|
|
31
31
|
xai: () => xai,
|
|
32
32
|
xaiTools: () => xaiTools
|
|
33
33
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
34
|
+
module.exports = __toCommonJS(index_exports);
|
|
35
35
|
|
|
36
36
|
// src/xai-provider.ts
|
|
37
37
|
var import_provider7 = require("@ai-sdk/provider");
|
|
@@ -370,7 +370,7 @@ function prepareTools({
|
|
|
370
370
|
// src/xai-chat-language-model.ts
|
|
371
371
|
var XaiChatLanguageModel = class {
|
|
372
372
|
constructor(modelId, config) {
|
|
373
|
-
this.specificationVersion = "
|
|
373
|
+
this.specificationVersion = "v4";
|
|
374
374
|
this.supportedUrls = {
|
|
375
375
|
"image/*": [/^https?:\/\/.*$/]
|
|
376
376
|
};
|
|
@@ -903,7 +903,7 @@ var XaiImageModel = class {
|
|
|
903
903
|
constructor(modelId, config) {
|
|
904
904
|
this.modelId = modelId;
|
|
905
905
|
this.config = config;
|
|
906
|
-
this.specificationVersion = "
|
|
906
|
+
this.specificationVersion = "v4";
|
|
907
907
|
this.maxImagesPerCall = 3;
|
|
908
908
|
}
|
|
909
909
|
get provider() {
|
|
@@ -1962,7 +1962,7 @@ async function prepareResponsesTools({
|
|
|
1962
1962
|
// src/responses/xai-responses-language-model.ts
|
|
1963
1963
|
var XaiResponsesLanguageModel = class {
|
|
1964
1964
|
constructor(modelId, config) {
|
|
1965
|
-
this.specificationVersion = "
|
|
1965
|
+
this.specificationVersion = "v4";
|
|
1966
1966
|
this.supportedUrls = {
|
|
1967
1967
|
"image/*": [/^https?:\/\/.*$/]
|
|
1968
1968
|
};
|
|
@@ -2724,7 +2724,7 @@ var xaiTools = {
|
|
|
2724
2724
|
};
|
|
2725
2725
|
|
|
2726
2726
|
// src/version.ts
|
|
2727
|
-
var VERSION = true ? "4.0.0-beta.
|
|
2727
|
+
var VERSION = true ? "4.0.0-beta.8" : "0.0.0-test";
|
|
2728
2728
|
|
|
2729
2729
|
// src/xai-video-model.ts
|
|
2730
2730
|
var import_provider6 = require("@ai-sdk/provider");
|
|
@@ -2755,7 +2755,7 @@ var XaiVideoModel = class {
|
|
|
2755
2755
|
constructor(modelId, config) {
|
|
2756
2756
|
this.modelId = modelId;
|
|
2757
2757
|
this.config = config;
|
|
2758
|
-
this.specificationVersion = "
|
|
2758
|
+
this.specificationVersion = "v4";
|
|
2759
2759
|
this.maxVideosPerCall = 1;
|
|
2760
2760
|
}
|
|
2761
2761
|
get provider() {
|
|
@@ -3008,7 +3008,7 @@ function createXai(options = {}) {
|
|
|
3008
3008
|
});
|
|
3009
3009
|
};
|
|
3010
3010
|
const provider = (modelId) => createResponsesLanguageModel(modelId);
|
|
3011
|
-
provider.specificationVersion = "
|
|
3011
|
+
provider.specificationVersion = "v4";
|
|
3012
3012
|
provider.languageModel = createResponsesLanguageModel;
|
|
3013
3013
|
provider.chat = createChatLanguageModel;
|
|
3014
3014
|
provider.responses = createResponsesLanguageModel;
|