@ai-sdk/xai 3.0.0-beta.65 → 3.0.0-beta.66
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 +9 -0
- package/dist/index.js +22 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -133,6 +133,27 @@ function convertToXaiChatMessages(prompt) {
|
|
|
133
133
|
return { messages, warnings };
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
// src/convert-xai-chat-usage.ts
|
|
137
|
+
function convertXaiChatUsage(usage) {
|
|
138
|
+
var _a, _b, _c, _d;
|
|
139
|
+
const cacheReadTokens = (_b = (_a = usage.prompt_tokens_details) == null ? void 0 : _a.cached_tokens) != null ? _b : 0;
|
|
140
|
+
const reasoningTokens = (_d = (_c = usage.completion_tokens_details) == null ? void 0 : _c.reasoning_tokens) != null ? _d : 0;
|
|
141
|
+
return {
|
|
142
|
+
inputTokens: {
|
|
143
|
+
total: usage.prompt_tokens,
|
|
144
|
+
noCache: usage.prompt_tokens - cacheReadTokens,
|
|
145
|
+
cacheRead: cacheReadTokens,
|
|
146
|
+
cacheWrite: void 0
|
|
147
|
+
},
|
|
148
|
+
outputTokens: {
|
|
149
|
+
total: usage.completion_tokens,
|
|
150
|
+
text: usage.completion_tokens - reasoningTokens,
|
|
151
|
+
reasoning: reasoningTokens
|
|
152
|
+
},
|
|
153
|
+
raw: usage
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
136
157
|
// src/get-response-metadata.ts
|
|
137
158
|
function getResponseMetadata({
|
|
138
159
|
id,
|
|
@@ -323,27 +344,6 @@ function prepareTools({
|
|
|
323
344
|
}
|
|
324
345
|
}
|
|
325
346
|
|
|
326
|
-
// src/convert-xai-chat-usage.ts
|
|
327
|
-
function convertXaiChatUsage(usage) {
|
|
328
|
-
var _a, _b, _c, _d;
|
|
329
|
-
const cacheReadTokens = (_b = (_a = usage.prompt_tokens_details) == null ? void 0 : _a.cached_tokens) != null ? _b : 0;
|
|
330
|
-
const reasoningTokens = (_d = (_c = usage.completion_tokens_details) == null ? void 0 : _c.reasoning_tokens) != null ? _d : 0;
|
|
331
|
-
return {
|
|
332
|
-
inputTokens: {
|
|
333
|
-
total: usage.prompt_tokens,
|
|
334
|
-
noCache: usage.prompt_tokens - cacheReadTokens,
|
|
335
|
-
cacheRead: cacheReadTokens,
|
|
336
|
-
cacheWrite: void 0
|
|
337
|
-
},
|
|
338
|
-
outputTokens: {
|
|
339
|
-
total: usage.completion_tokens,
|
|
340
|
-
text: usage.completion_tokens - reasoningTokens,
|
|
341
|
-
reasoning: reasoningTokens
|
|
342
|
-
},
|
|
343
|
-
raw: usage
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
|
|
347
347
|
// src/xai-chat-language-model.ts
|
|
348
348
|
var XaiChatLanguageModel = class {
|
|
349
349
|
constructor(modelId, config) {
|
|
@@ -2005,7 +2005,7 @@ var xaiTools = {
|
|
|
2005
2005
|
};
|
|
2006
2006
|
|
|
2007
2007
|
// src/version.ts
|
|
2008
|
-
var VERSION = true ? "3.0.0-beta.
|
|
2008
|
+
var VERSION = true ? "3.0.0-beta.66" : "0.0.0-test";
|
|
2009
2009
|
|
|
2010
2010
|
// src/xai-provider.ts
|
|
2011
2011
|
var xaiErrorStructure = {
|