@ai-sdk/xai 2.0.47 → 2.0.48
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 +7 -0
- package/dist/index.js +28 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @ai-sdk/xai
|
|
2
2
|
|
|
3
|
+
## 2.0.48
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c7d45b4: fixed streaming tool input for custom_tool_call types (x_search, view_x_video) which were incorrectly returning empty input values
|
|
8
|
+
- 547e0c2: fix (provider/xai): no duplicate text delta in responses api
|
|
9
|
+
|
|
3
10
|
## 2.0.47
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1844,28 +1844,29 @@ var XaiResponsesLanguageModel = class {
|
|
|
1844
1844
|
if (event.type === "response.output_item.added" || event.type === "response.output_item.done") {
|
|
1845
1845
|
const part = event.item;
|
|
1846
1846
|
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") {
|
|
1847
|
-
|
|
1847
|
+
const webSearchSubTools = [
|
|
1848
|
+
"web_search",
|
|
1849
|
+
"web_search_with_snippets",
|
|
1850
|
+
"browse_page"
|
|
1851
|
+
];
|
|
1852
|
+
const xSearchSubTools = [
|
|
1853
|
+
"x_user_search",
|
|
1854
|
+
"x_keyword_search",
|
|
1855
|
+
"x_semantic_search",
|
|
1856
|
+
"x_thread_fetch"
|
|
1857
|
+
];
|
|
1858
|
+
let toolName = (_e = part.name) != null ? _e : "";
|
|
1859
|
+
if (webSearchSubTools.includes((_f = part.name) != null ? _f : "") || part.type === "web_search_call") {
|
|
1860
|
+
toolName = webSearchToolName != null ? webSearchToolName : "web_search";
|
|
1861
|
+
} else if (xSearchSubTools.includes((_g = part.name) != null ? _g : "") || part.type === "x_search_call") {
|
|
1862
|
+
toolName = xSearchToolName != null ? xSearchToolName : "x_search";
|
|
1863
|
+
} else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
|
|
1864
|
+
toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
|
|
1865
|
+
}
|
|
1866
|
+
const toolInput = part.type === "custom_tool_call" ? (_h = part.input) != null ? _h : "" : (_i = part.arguments) != null ? _i : "";
|
|
1867
|
+
const shouldEmit = part.type === "custom_tool_call" ? event.type === "response.output_item.done" : !seenToolCalls.has(part.id);
|
|
1868
|
+
if (shouldEmit && !seenToolCalls.has(part.id)) {
|
|
1848
1869
|
seenToolCalls.add(part.id);
|
|
1849
|
-
const webSearchSubTools = [
|
|
1850
|
-
"web_search",
|
|
1851
|
-
"web_search_with_snippets",
|
|
1852
|
-
"browse_page"
|
|
1853
|
-
];
|
|
1854
|
-
const xSearchSubTools = [
|
|
1855
|
-
"x_user_search",
|
|
1856
|
-
"x_keyword_search",
|
|
1857
|
-
"x_semantic_search",
|
|
1858
|
-
"x_thread_fetch"
|
|
1859
|
-
];
|
|
1860
|
-
let toolName = (_e = part.name) != null ? _e : "";
|
|
1861
|
-
if (webSearchSubTools.includes((_f = part.name) != null ? _f : "") || part.type === "web_search_call") {
|
|
1862
|
-
toolName = webSearchToolName != null ? webSearchToolName : "web_search";
|
|
1863
|
-
} else if (xSearchSubTools.includes((_g = part.name) != null ? _g : "") || part.type === "x_search_call") {
|
|
1864
|
-
toolName = xSearchToolName != null ? xSearchToolName : "x_search";
|
|
1865
|
-
} else if (part.name === "code_execution" || part.type === "code_interpreter_call" || part.type === "code_execution_call") {
|
|
1866
|
-
toolName = codeExecutionToolName != null ? codeExecutionToolName : "code_execution";
|
|
1867
|
-
}
|
|
1868
|
-
const toolInput = part.type === "custom_tool_call" ? (_h = part.input) != null ? _h : "" : (_i = part.arguments) != null ? _i : "";
|
|
1869
1870
|
controller.enqueue({
|
|
1870
1871
|
type: "tool-input-start",
|
|
1871
1872
|
id: part.id,
|
|
@@ -1900,12 +1901,12 @@ var XaiResponsesLanguageModel = class {
|
|
|
1900
1901
|
type: "text-start",
|
|
1901
1902
|
id: blockId
|
|
1902
1903
|
});
|
|
1904
|
+
controller.enqueue({
|
|
1905
|
+
type: "text-delta",
|
|
1906
|
+
id: blockId,
|
|
1907
|
+
delta: contentPart.text
|
|
1908
|
+
});
|
|
1903
1909
|
}
|
|
1904
|
-
controller.enqueue({
|
|
1905
|
-
type: "text-delta",
|
|
1906
|
-
id: blockId,
|
|
1907
|
-
delta: contentPart.text
|
|
1908
|
-
});
|
|
1909
1910
|
}
|
|
1910
1911
|
if (contentPart.annotations) {
|
|
1911
1912
|
for (const annotation of contentPart.annotations) {
|
|
@@ -2023,7 +2024,7 @@ var xaiTools = {
|
|
|
2023
2024
|
};
|
|
2024
2025
|
|
|
2025
2026
|
// src/version.ts
|
|
2026
|
-
var VERSION = true ? "2.0.
|
|
2027
|
+
var VERSION = true ? "2.0.48" : "0.0.0-test";
|
|
2027
2028
|
|
|
2028
2029
|
// src/xai-provider.ts
|
|
2029
2030
|
var xaiErrorStructure = {
|