@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/dist/index.mjs
CHANGED
|
@@ -990,6 +990,16 @@ var xaiResponsesChunkSchema = z4.union([
|
|
|
990
990
|
item_id: z4.string(),
|
|
991
991
|
output_index: z4.number()
|
|
992
992
|
}),
|
|
993
|
+
z4.object({
|
|
994
|
+
type: z4.literal("response.custom_tool_call_input.done"),
|
|
995
|
+
item_id: z4.string(),
|
|
996
|
+
output_index: z4.number()
|
|
997
|
+
}),
|
|
998
|
+
z4.object({
|
|
999
|
+
type: z4.literal("response.custom_tool_call_input.delta"),
|
|
1000
|
+
item_id: z4.string(),
|
|
1001
|
+
output_index: z4.number()
|
|
1002
|
+
}),
|
|
993
1003
|
z4.object({
|
|
994
1004
|
type: z4.literal("response.code_execution_call.in_progress"),
|
|
995
1005
|
item_id: z4.string(),
|
|
@@ -1015,11 +1025,29 @@ var xaiResponsesChunkSchema = z4.union([
|
|
|
1015
1025
|
item_id: z4.string(),
|
|
1016
1026
|
output_index: z4.number()
|
|
1017
1027
|
}),
|
|
1028
|
+
z4.object({
|
|
1029
|
+
type: z4.literal("response.code_interpreter_call.interpreting"),
|
|
1030
|
+
item_id: z4.string(),
|
|
1031
|
+
output_index: z4.number()
|
|
1032
|
+
}),
|
|
1018
1033
|
z4.object({
|
|
1019
1034
|
type: z4.literal("response.code_interpreter_call.completed"),
|
|
1020
1035
|
item_id: z4.string(),
|
|
1021
1036
|
output_index: z4.number()
|
|
1022
1037
|
}),
|
|
1038
|
+
// Code interpreter code streaming events
|
|
1039
|
+
z4.object({
|
|
1040
|
+
type: z4.literal("response.code_interpreter_call_code.delta"),
|
|
1041
|
+
item_id: z4.string(),
|
|
1042
|
+
output_index: z4.number(),
|
|
1043
|
+
delta: z4.string()
|
|
1044
|
+
}),
|
|
1045
|
+
z4.object({
|
|
1046
|
+
type: z4.literal("response.code_interpreter_call_code.done"),
|
|
1047
|
+
item_id: z4.string(),
|
|
1048
|
+
output_index: z4.number(),
|
|
1049
|
+
code: z4.string()
|
|
1050
|
+
}),
|
|
1023
1051
|
z4.object({
|
|
1024
1052
|
type: z4.literal("response.done"),
|
|
1025
1053
|
response: xaiResponsesResponseSchema
|
|
@@ -1597,11 +1625,11 @@ var XaiResponsesLanguageModel = class {
|
|
|
1597
1625
|
for (const part of response.output) {
|
|
1598
1626
|
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") {
|
|
1599
1627
|
let toolName = (_b = part.name) != null ? _b : "";
|
|
1600
|
-
if (webSearchSubTools.includes((_c = part.name) != null ? _c : "")) {
|
|
1628
|
+
if (webSearchSubTools.includes((_c = part.name) != null ? _c : "") || part.type === "web_search_call") {
|
|
1601
1629
|
toolName = webSearchToolName != null ? webSearchToolName : "web_search";
|
|
1602
|
-
} else if (xSearchSubTools.includes((_d = part.name) != null ? _d : "")) {
|
|
1630
|
+
} else if (xSearchSubTools.includes((_d = part.name) != null ? _d : "") || part.type === "x_search_call") {
|
|
1603
1631
|
toolName = xSearchToolName != null ? xSearchToolName : "x_search";
|
|
1604
|
-
} else if (part.name === "code_execution") {
|
|
1632
|
+
} else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
|
|
1605
1633
|
toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
|
|
1606
1634
|
}
|
|
1607
1635
|
const toolInput = part.type === "custom_tool_call" ? (_e = part.input) != null ? _e : "" : (_f = part.arguments) != null ? _f : "";
|
|
@@ -1831,11 +1859,11 @@ var XaiResponsesLanguageModel = class {
|
|
|
1831
1859
|
"x_thread_fetch"
|
|
1832
1860
|
];
|
|
1833
1861
|
let toolName = (_e = part.name) != null ? _e : "";
|
|
1834
|
-
if (webSearchSubTools.includes((_f = part.name) != null ? _f : "")) {
|
|
1862
|
+
if (webSearchSubTools.includes((_f = part.name) != null ? _f : "") || part.type === "web_search_call") {
|
|
1835
1863
|
toolName = webSearchToolName != null ? webSearchToolName : "web_search";
|
|
1836
|
-
} else if (xSearchSubTools.includes((_g = part.name) != null ? _g : "")) {
|
|
1864
|
+
} else if (xSearchSubTools.includes((_g = part.name) != null ? _g : "") || part.type === "x_search_call") {
|
|
1837
1865
|
toolName = xSearchToolName != null ? xSearchToolName : "x_search";
|
|
1838
|
-
} else if (part.name === "code_execution") {
|
|
1866
|
+
} else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
|
|
1839
1867
|
toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
|
|
1840
1868
|
}
|
|
1841
1869
|
const toolInput = part.type === "custom_tool_call" ? (_h = part.input) != null ? _h : "" : (_i = part.arguments) != null ? _i : "";
|
|
@@ -1996,7 +2024,7 @@ var xaiTools = {
|
|
|
1996
2024
|
};
|
|
1997
2025
|
|
|
1998
2026
|
// src/version.ts
|
|
1999
|
-
var VERSION = true ? "2.0.
|
|
2027
|
+
var VERSION = true ? "2.0.47" : "0.0.0-test";
|
|
2000
2028
|
|
|
2001
2029
|
// src/xai-provider.ts
|
|
2002
2030
|
var xaiErrorStructure = {
|