@ai-sdk/xai 2.0.45 → 2.0.47
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 +12 -0
- package/dist/index.js +35 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/xai
|
|
2
2
|
|
|
3
|
+
## 2.0.47
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6e3beb1: added support for streaming custom tool input chunks in xAI
|
|
8
|
+
|
|
9
|
+
## 2.0.46
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- eed2ef1: fix(xai): add missing stream response schema and provider tool name parsing
|
|
14
|
+
|
|
3
15
|
## 2.0.45
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -999,6 +999,16 @@ var xaiResponsesChunkSchema = import_v44.z.union([
|
|
|
999
999
|
item_id: import_v44.z.string(),
|
|
1000
1000
|
output_index: import_v44.z.number()
|
|
1001
1001
|
}),
|
|
1002
|
+
import_v44.z.object({
|
|
1003
|
+
type: import_v44.z.literal("response.custom_tool_call_input.done"),
|
|
1004
|
+
item_id: import_v44.z.string(),
|
|
1005
|
+
output_index: import_v44.z.number()
|
|
1006
|
+
}),
|
|
1007
|
+
import_v44.z.object({
|
|
1008
|
+
type: import_v44.z.literal("response.custom_tool_call_input.delta"),
|
|
1009
|
+
item_id: import_v44.z.string(),
|
|
1010
|
+
output_index: import_v44.z.number()
|
|
1011
|
+
}),
|
|
1002
1012
|
import_v44.z.object({
|
|
1003
1013
|
type: import_v44.z.literal("response.code_execution_call.in_progress"),
|
|
1004
1014
|
item_id: import_v44.z.string(),
|
|
@@ -1024,11 +1034,29 @@ var xaiResponsesChunkSchema = import_v44.z.union([
|
|
|
1024
1034
|
item_id: import_v44.z.string(),
|
|
1025
1035
|
output_index: import_v44.z.number()
|
|
1026
1036
|
}),
|
|
1037
|
+
import_v44.z.object({
|
|
1038
|
+
type: import_v44.z.literal("response.code_interpreter_call.interpreting"),
|
|
1039
|
+
item_id: import_v44.z.string(),
|
|
1040
|
+
output_index: import_v44.z.number()
|
|
1041
|
+
}),
|
|
1027
1042
|
import_v44.z.object({
|
|
1028
1043
|
type: import_v44.z.literal("response.code_interpreter_call.completed"),
|
|
1029
1044
|
item_id: import_v44.z.string(),
|
|
1030
1045
|
output_index: import_v44.z.number()
|
|
1031
1046
|
}),
|
|
1047
|
+
// Code interpreter code streaming events
|
|
1048
|
+
import_v44.z.object({
|
|
1049
|
+
type: import_v44.z.literal("response.code_interpreter_call_code.delta"),
|
|
1050
|
+
item_id: import_v44.z.string(),
|
|
1051
|
+
output_index: import_v44.z.number(),
|
|
1052
|
+
delta: import_v44.z.string()
|
|
1053
|
+
}),
|
|
1054
|
+
import_v44.z.object({
|
|
1055
|
+
type: import_v44.z.literal("response.code_interpreter_call_code.done"),
|
|
1056
|
+
item_id: import_v44.z.string(),
|
|
1057
|
+
output_index: import_v44.z.number(),
|
|
1058
|
+
code: import_v44.z.string()
|
|
1059
|
+
}),
|
|
1032
1060
|
import_v44.z.object({
|
|
1033
1061
|
type: import_v44.z.literal("response.done"),
|
|
1034
1062
|
response: xaiResponsesResponseSchema
|
|
@@ -1596,11 +1624,11 @@ var XaiResponsesLanguageModel = class {
|
|
|
1596
1624
|
for (const part of response.output) {
|
|
1597
1625
|
if (part.type === "web_search_call" || part.type === "x_search_call" || part.type === "code_interpreter_call" || part.type === "code_execution_call" || part.type === "view_image_call" || part.type === "view_x_video_call" || part.type === "custom_tool_call") {
|
|
1598
1626
|
let toolName = (_b = part.name) != null ? _b : "";
|
|
1599
|
-
if (webSearchSubTools.includes((_c = part.name) != null ? _c : "")) {
|
|
1627
|
+
if (webSearchSubTools.includes((_c = part.name) != null ? _c : "") || part.type === "web_search_call") {
|
|
1600
1628
|
toolName = webSearchToolName != null ? webSearchToolName : "web_search";
|
|
1601
|
-
} else if (xSearchSubTools.includes((_d = part.name) != null ? _d : "")) {
|
|
1629
|
+
} else if (xSearchSubTools.includes((_d = part.name) != null ? _d : "") || part.type === "x_search_call") {
|
|
1602
1630
|
toolName = xSearchToolName != null ? xSearchToolName : "x_search";
|
|
1603
|
-
} else if (part.name === "code_execution") {
|
|
1631
|
+
} else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
|
|
1604
1632
|
toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
|
|
1605
1633
|
}
|
|
1606
1634
|
const toolInput = part.type === "custom_tool_call" ? (_e = part.input) != null ? _e : "" : (_f = part.arguments) != null ? _f : "";
|
|
@@ -1830,11 +1858,11 @@ var XaiResponsesLanguageModel = class {
|
|
|
1830
1858
|
"x_thread_fetch"
|
|
1831
1859
|
];
|
|
1832
1860
|
let toolName = (_e = part.name) != null ? _e : "";
|
|
1833
|
-
if (webSearchSubTools.includes((_f = part.name) != null ? _f : "")) {
|
|
1861
|
+
if (webSearchSubTools.includes((_f = part.name) != null ? _f : "") || part.type === "web_search_call") {
|
|
1834
1862
|
toolName = webSearchToolName != null ? webSearchToolName : "web_search";
|
|
1835
|
-
} else if (xSearchSubTools.includes((_g = part.name) != null ? _g : "")) {
|
|
1863
|
+
} else if (xSearchSubTools.includes((_g = part.name) != null ? _g : "") || part.type === "x_search_call") {
|
|
1836
1864
|
toolName = xSearchToolName != null ? xSearchToolName : "x_search";
|
|
1837
|
-
} else if (part.name === "code_execution") {
|
|
1865
|
+
} else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
|
|
1838
1866
|
toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
|
|
1839
1867
|
}
|
|
1840
1868
|
const toolInput = part.type === "custom_tool_call" ? (_h = part.input) != null ? _h : "" : (_i = part.arguments) != null ? _i : "";
|
|
@@ -1995,7 +2023,7 @@ var xaiTools = {
|
|
|
1995
2023
|
};
|
|
1996
2024
|
|
|
1997
2025
|
// src/version.ts
|
|
1998
|
-
var VERSION = true ? "2.0.
|
|
2026
|
+
var VERSION = true ? "2.0.47" : "0.0.0-test";
|
|
1999
2027
|
|
|
2000
2028
|
// src/xai-provider.ts
|
|
2001
2029
|
var xaiErrorStructure = {
|