@ai-sdk/xai 3.0.59 → 3.0.61
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 +14 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -1
- package/dist/index.mjs.map +1 -1
- package/docs/01-xai.mdx +16 -0
- package/package.json +3 -3
- package/src/responses/xai-responses-language-model.ts +5 -0
- package/src/responses/xai-responses-options.ts +2 -0
- package/src/xai-chat-language-model.ts +5 -0
- package/src/xai-chat-options.ts +2 -0
package/docs/01-xai.mdx
CHANGED
|
@@ -125,6 +125,14 @@ The following optional provider options are available for xAI chat models:
|
|
|
125
125
|
|
|
126
126
|
Reasoning effort for reasoning models.
|
|
127
127
|
|
|
128
|
+
- **logprobs** _boolean_
|
|
129
|
+
|
|
130
|
+
Return log probabilities for output tokens.
|
|
131
|
+
|
|
132
|
+
- **topLogprobs** _number_
|
|
133
|
+
|
|
134
|
+
Number of most likely tokens to return per token position (0-8). When set, `logprobs` is automatically enabled.
|
|
135
|
+
|
|
128
136
|
- **parallel_function_calling** _boolean_
|
|
129
137
|
|
|
130
138
|
Whether to enable parallel function calling during tool use. When true, the model can call multiple functions in parallel. When false, the model will call functions sequentially. Defaults to `true`.
|
|
@@ -446,6 +454,14 @@ The following provider options are available:
|
|
|
446
454
|
|
|
447
455
|
Control the reasoning effort for the model. Higher effort may produce more thorough results at the cost of increased latency and token usage.
|
|
448
456
|
|
|
457
|
+
- **logprobs** _boolean_
|
|
458
|
+
|
|
459
|
+
Return log probabilities for output tokens.
|
|
460
|
+
|
|
461
|
+
- **topLogprobs** _number_
|
|
462
|
+
|
|
463
|
+
Number of most likely tokens to return per token position (0-8). When set, `logprobs` is automatically enabled.
|
|
464
|
+
|
|
449
465
|
- **include** _Array<'file_search_call.results'>_
|
|
450
466
|
|
|
451
467
|
Specify additional output data to include in the model response. Use `['file_search_call.results']` to include file search results with scores and content.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/xai",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.61",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@ai-sdk/openai-compatible": "2.0.
|
|
33
|
-
"@ai-sdk/provider-utils": "4.0.
|
|
32
|
+
"@ai-sdk/openai-compatible": "2.0.31",
|
|
33
|
+
"@ai-sdk/provider-utils": "4.0.16",
|
|
34
34
|
"@ai-sdk/provider": "3.0.8"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
@@ -142,6 +142,11 @@ export class XaiResponsesLanguageModel implements LanguageModelV3 {
|
|
|
142
142
|
const baseArgs: Record<string, unknown> = {
|
|
143
143
|
model: this.modelId,
|
|
144
144
|
input,
|
|
145
|
+
logprobs:
|
|
146
|
+
options.logprobs === true || options.topLogprobs != null
|
|
147
|
+
? true
|
|
148
|
+
: undefined,
|
|
149
|
+
top_logprobs: options.topLogprobs,
|
|
145
150
|
max_output_tokens: maxOutputTokens,
|
|
146
151
|
temperature,
|
|
147
152
|
top_p: topP,
|
|
@@ -17,6 +17,8 @@ export const xaiLanguageModelResponsesOptions = z.object({
|
|
|
17
17
|
* Possible values are `low` (uses fewer reasoning tokens), `medium` and `high` (uses more reasoning tokens).
|
|
18
18
|
*/
|
|
19
19
|
reasoningEffort: z.enum(['low', 'medium', 'high']).optional(),
|
|
20
|
+
logprobs: z.boolean().optional(),
|
|
21
|
+
topLogprobs: z.number().int().min(0).max(8).optional(),
|
|
20
22
|
/**
|
|
21
23
|
* Whether to store the input message(s) and model response for later retrieval.
|
|
22
24
|
* @default true
|
|
@@ -124,6 +124,11 @@ export class XaiChatLanguageModel implements LanguageModelV3 {
|
|
|
124
124
|
model: this.modelId,
|
|
125
125
|
|
|
126
126
|
// standard generation settings
|
|
127
|
+
logprobs:
|
|
128
|
+
options.logprobs === true || options.topLogprobs != null
|
|
129
|
+
? true
|
|
130
|
+
: undefined,
|
|
131
|
+
top_logprobs: options.topLogprobs,
|
|
127
132
|
max_completion_tokens: maxOutputTokens,
|
|
128
133
|
temperature,
|
|
129
134
|
top_p: topP,
|
package/src/xai-chat-options.ts
CHANGED
|
@@ -74,6 +74,8 @@ const searchSourceSchema = z.discriminatedUnion('type', [
|
|
|
74
74
|
// xai-specific provider options
|
|
75
75
|
export const xaiLanguageModelChatOptions = z.object({
|
|
76
76
|
reasoningEffort: z.enum(['low', 'high']).optional(),
|
|
77
|
+
logprobs: z.boolean().optional(),
|
|
78
|
+
topLogprobs: z.number().int().min(0).max(8).optional(),
|
|
77
79
|
|
|
78
80
|
/**
|
|
79
81
|
* Whether to enable parallel function calling during tool use.
|