@ai-sdk/xai 2.0.45 → 2.0.46
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.js +25 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1015,11 +1015,29 @@ var xaiResponsesChunkSchema = z4.union([
|
|
|
1015
1015
|
item_id: z4.string(),
|
|
1016
1016
|
output_index: z4.number()
|
|
1017
1017
|
}),
|
|
1018
|
+
z4.object({
|
|
1019
|
+
type: z4.literal("response.code_interpreter_call.interpreting"),
|
|
1020
|
+
item_id: z4.string(),
|
|
1021
|
+
output_index: z4.number()
|
|
1022
|
+
}),
|
|
1018
1023
|
z4.object({
|
|
1019
1024
|
type: z4.literal("response.code_interpreter_call.completed"),
|
|
1020
1025
|
item_id: z4.string(),
|
|
1021
1026
|
output_index: z4.number()
|
|
1022
1027
|
}),
|
|
1028
|
+
// Code interpreter code streaming events
|
|
1029
|
+
z4.object({
|
|
1030
|
+
type: z4.literal("response.code_interpreter_call_code.delta"),
|
|
1031
|
+
item_id: z4.string(),
|
|
1032
|
+
output_index: z4.number(),
|
|
1033
|
+
delta: z4.string()
|
|
1034
|
+
}),
|
|
1035
|
+
z4.object({
|
|
1036
|
+
type: z4.literal("response.code_interpreter_call_code.done"),
|
|
1037
|
+
item_id: z4.string(),
|
|
1038
|
+
output_index: z4.number(),
|
|
1039
|
+
code: z4.string()
|
|
1040
|
+
}),
|
|
1023
1041
|
z4.object({
|
|
1024
1042
|
type: z4.literal("response.done"),
|
|
1025
1043
|
response: xaiResponsesResponseSchema
|
|
@@ -1597,11 +1615,11 @@ var XaiResponsesLanguageModel = class {
|
|
|
1597
1615
|
for (const part of response.output) {
|
|
1598
1616
|
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
1617
|
let toolName = (_b = part.name) != null ? _b : "";
|
|
1600
|
-
if (webSearchSubTools.includes((_c = part.name) != null ? _c : "")) {
|
|
1618
|
+
if (webSearchSubTools.includes((_c = part.name) != null ? _c : "") || part.type === "web_search_call") {
|
|
1601
1619
|
toolName = webSearchToolName != null ? webSearchToolName : "web_search";
|
|
1602
|
-
} else if (xSearchSubTools.includes((_d = part.name) != null ? _d : "")) {
|
|
1620
|
+
} else if (xSearchSubTools.includes((_d = part.name) != null ? _d : "") || part.type === "x_search_call") {
|
|
1603
1621
|
toolName = xSearchToolName != null ? xSearchToolName : "x_search";
|
|
1604
|
-
} else if (part.name === "code_execution") {
|
|
1622
|
+
} else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
|
|
1605
1623
|
toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
|
|
1606
1624
|
}
|
|
1607
1625
|
const toolInput = part.type === "custom_tool_call" ? (_e = part.input) != null ? _e : "" : (_f = part.arguments) != null ? _f : "";
|
|
@@ -1831,11 +1849,11 @@ var XaiResponsesLanguageModel = class {
|
|
|
1831
1849
|
"x_thread_fetch"
|
|
1832
1850
|
];
|
|
1833
1851
|
let toolName = (_e = part.name) != null ? _e : "";
|
|
1834
|
-
if (webSearchSubTools.includes((_f = part.name) != null ? _f : "")) {
|
|
1852
|
+
if (webSearchSubTools.includes((_f = part.name) != null ? _f : "") || part.type === "web_search_call") {
|
|
1835
1853
|
toolName = webSearchToolName != null ? webSearchToolName : "web_search";
|
|
1836
|
-
} else if (xSearchSubTools.includes((_g = part.name) != null ? _g : "")) {
|
|
1854
|
+
} else if (xSearchSubTools.includes((_g = part.name) != null ? _g : "") || part.type === "x_search_call") {
|
|
1837
1855
|
toolName = xSearchToolName != null ? xSearchToolName : "x_search";
|
|
1838
|
-
} else if (part.name === "code_execution") {
|
|
1856
|
+
} else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
|
|
1839
1857
|
toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
|
|
1840
1858
|
}
|
|
1841
1859
|
const toolInput = part.type === "custom_tool_call" ? (_h = part.input) != null ? _h : "" : (_i = part.arguments) != null ? _i : "";
|
|
@@ -1996,7 +2014,7 @@ var xaiTools = {
|
|
|
1996
2014
|
};
|
|
1997
2015
|
|
|
1998
2016
|
// src/version.ts
|
|
1999
|
-
var VERSION = true ? "2.0.
|
|
2017
|
+
var VERSION = true ? "2.0.46" : "0.0.0-test";
|
|
2000
2018
|
|
|
2001
2019
|
// src/xai-provider.ts
|
|
2002
2020
|
var xaiErrorStructure = {
|