@ai-sdk/xai 2.0.55 → 2.0.57
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 +14 -0
- package/dist/index.js +55 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @ai-sdk/xai
|
|
2
2
|
|
|
3
|
+
## 2.0.57
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b5e7a31: fix (provider/xai): handle new reasoning text chunk parts
|
|
8
|
+
|
|
9
|
+
## 2.0.56
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [8479fe8]
|
|
14
|
+
- Updated dependencies [7aadb9b]
|
|
15
|
+
- @ai-sdk/openai-compatible@1.0.32
|
|
16
|
+
|
|
3
17
|
## 2.0.55
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1054,6 +1054,20 @@ var xaiResponsesChunkSchema = import_v44.z.union([
|
|
|
1054
1054
|
summary_index: import_v44.z.number(),
|
|
1055
1055
|
text: import_v44.z.string()
|
|
1056
1056
|
}),
|
|
1057
|
+
import_v44.z.object({
|
|
1058
|
+
type: import_v44.z.literal("response.reasoning_text.delta"),
|
|
1059
|
+
item_id: import_v44.z.string(),
|
|
1060
|
+
output_index: import_v44.z.number(),
|
|
1061
|
+
content_index: import_v44.z.number(),
|
|
1062
|
+
delta: import_v44.z.string()
|
|
1063
|
+
}),
|
|
1064
|
+
import_v44.z.object({
|
|
1065
|
+
type: import_v44.z.literal("response.reasoning_text.done"),
|
|
1066
|
+
item_id: import_v44.z.string(),
|
|
1067
|
+
output_index: import_v44.z.number(),
|
|
1068
|
+
content_index: import_v44.z.number(),
|
|
1069
|
+
text: import_v44.z.string()
|
|
1070
|
+
}),
|
|
1057
1071
|
import_v44.z.object({
|
|
1058
1072
|
type: import_v44.z.literal("response.web_search_call.in_progress"),
|
|
1059
1073
|
item_id: import_v44.z.string(),
|
|
@@ -1923,6 +1937,35 @@ var XaiResponsesLanguageModel = class {
|
|
|
1923
1937
|
if (event.type === "response.reasoning_summary_text.done") {
|
|
1924
1938
|
return;
|
|
1925
1939
|
}
|
|
1940
|
+
if (event.type === "response.reasoning_text.delta") {
|
|
1941
|
+
const blockId = `reasoning-${event.item_id}`;
|
|
1942
|
+
if (activeReasoning[event.item_id] == null) {
|
|
1943
|
+
activeReasoning[event.item_id] = {};
|
|
1944
|
+
controller.enqueue({
|
|
1945
|
+
type: "reasoning-start",
|
|
1946
|
+
id: blockId,
|
|
1947
|
+
providerMetadata: {
|
|
1948
|
+
xai: {
|
|
1949
|
+
itemId: event.item_id
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
});
|
|
1953
|
+
}
|
|
1954
|
+
controller.enqueue({
|
|
1955
|
+
type: "reasoning-delta",
|
|
1956
|
+
id: blockId,
|
|
1957
|
+
delta: event.delta,
|
|
1958
|
+
providerMetadata: {
|
|
1959
|
+
xai: {
|
|
1960
|
+
itemId: event.item_id
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
});
|
|
1964
|
+
return;
|
|
1965
|
+
}
|
|
1966
|
+
if (event.type === "response.reasoning_text.done") {
|
|
1967
|
+
return;
|
|
1968
|
+
}
|
|
1926
1969
|
if (event.type === "response.output_text.delta") {
|
|
1927
1970
|
const blockId = `text-${event.item_id}`;
|
|
1928
1971
|
if (contentBlocks[blockId] == null) {
|
|
@@ -1986,6 +2029,17 @@ var XaiResponsesLanguageModel = class {
|
|
|
1986
2029
|
const part = event.item;
|
|
1987
2030
|
if (part.type === "reasoning") {
|
|
1988
2031
|
if (event.type === "response.output_item.done") {
|
|
2032
|
+
if (activeReasoning[part.id] == null) {
|
|
2033
|
+
controller.enqueue({
|
|
2034
|
+
type: "reasoning-start",
|
|
2035
|
+
id: `reasoning-${part.id}`,
|
|
2036
|
+
providerMetadata: {
|
|
2037
|
+
xai: {
|
|
2038
|
+
itemId: part.id
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
});
|
|
2042
|
+
}
|
|
1989
2043
|
controller.enqueue({
|
|
1990
2044
|
type: "reasoning-end",
|
|
1991
2045
|
id: `reasoning-${part.id}`,
|
|
@@ -2183,7 +2237,7 @@ var xaiTools = {
|
|
|
2183
2237
|
};
|
|
2184
2238
|
|
|
2185
2239
|
// src/version.ts
|
|
2186
|
-
var VERSION = true ? "2.0.
|
|
2240
|
+
var VERSION = true ? "2.0.57" : "0.0.0-test";
|
|
2187
2241
|
|
|
2188
2242
|
// src/xai-provider.ts
|
|
2189
2243
|
var xaiErrorStructure = {
|