@ai-sdk/alibaba 2.0.75 → 2.0.77

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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @ai-sdk/alibaba
2
2
 
3
+ ## 2.0.77
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [e64ed82]
8
+ - @ai-sdk/provider-utils@5.0.69
9
+
10
+ ## 2.0.76
11
+
12
+ ### Patch Changes
13
+
14
+ - e729d58: chore(docs): update `README.md` for consistent format and to avoid duplication
15
+ - Updated dependencies [5475347]
16
+ - Updated dependencies [e729d58]
17
+ - @ai-sdk/provider@4.0.34
18
+ - @ai-sdk/provider-utils@5.0.68
19
+
3
20
  ## 2.0.75
4
21
 
5
22
  ### Patch Changes
package/README.md CHANGED
@@ -6,10 +6,8 @@ The **[Alibaba provider](https://ai-sdk.dev/providers/ai-sdk-providers/alibaba)*
6
6
 
7
7
  ## Setup
8
8
 
9
- The Alibaba provider is available in the `@ai-sdk/alibaba` module. You can install it with
10
-
11
9
  ```bash
12
- npm i @ai-sdk/alibaba
10
+ npm i ai @ai-sdk/alibaba
13
11
  ```
14
12
 
15
13
  ## Skill for Coding Agents
@@ -20,15 +18,7 @@ If you use coding agents such as Claude Code or Cursor, we highly recommend addi
20
18
  npx skills add vercel/ai
21
19
  ```
22
20
 
23
- ## Provider Instance
24
-
25
- You can import the default provider instance `alibaba` from `@ai-sdk/alibaba`:
26
-
27
- ```ts
28
- import { alibaba } from '@ai-sdk/alibaba';
29
- ```
30
-
31
- ## Language Model Example
21
+ ## Usage
32
22
 
33
23
  ```ts
34
24
  import { alibaba } from '@ai-sdk/alibaba';
@@ -40,166 +30,4 @@ const { text } = await generateText({
40
30
  });
41
31
  ```
42
32
 
43
- ## Thinking Mode Example (Qwen Reasoning Models)
44
-
45
- Alibaba's Qwen models support thinking/reasoning mode for complex problem-solving:
46
-
47
- ```ts
48
- import { alibaba } from '@ai-sdk/alibaba';
49
- import { generateText } from 'ai';
50
-
51
- const { text, reasoningText } = await generateText({
52
- model: alibaba('qwen3-max'),
53
- providerOptions: {
54
- alibaba: {
55
- enableThinking: true,
56
- thinkingBudget: 2048,
57
- },
58
- },
59
- prompt: 'How many "r"s are in the word "strawberry"?',
60
- });
61
-
62
- console.log('Reasoning:', reasoningText);
63
- console.log('Answer:', text);
64
- ```
65
-
66
- ## Preserved Thinking Example (Multi-Turn Reasoning)
67
-
68
- For models that support preserved thinking, the AI SDK sends reasoning from
69
- previous assistant messages back as Alibaba `reasoning_content` by default
70
- (`preserve_thinking`), so the model can build on its earlier thought process:
71
-
72
- ```ts
73
- import { alibaba } from '@ai-sdk/alibaba';
74
- import { generateText } from 'ai';
75
-
76
- const providerOptions = {
77
- alibaba: {
78
- enableThinking: true,
79
- thinkingBudget: 2048,
80
- },
81
- };
82
-
83
- const opening = {
84
- role: 'user' as const,
85
- content: 'Is Kafka or RocketMQ a better fit for transactional messages?',
86
- };
87
-
88
- const first = await generateText({
89
- model: alibaba('qwen3.7-max'),
90
- messages: [opening],
91
- providerOptions,
92
- });
93
-
94
- const second = await generateText({
95
- model: alibaba('qwen3.7-max'),
96
- messages: [
97
- opening,
98
- ...first.responseMessages, // append unchanged to keep the reasoning parts
99
- { role: 'user', content: 'Which tradeoff mattered most?' },
100
- ],
101
- providerOptions,
102
- });
103
- ```
104
-
105
- When continuing the conversation, append `responseMessages` unchanged so the
106
- reasoning parts survive to be serialized as `reasoning_content`. Set the
107
- `preserveThinking` provider option to `false` to opt out. Keep in mind:
108
-
109
- - `preserveThinking` does not enable thinking by itself.
110
- - It is enabled by default only for models that Alibaba documents as supporting
111
- preserved thinking; for other models the option is not sent unless you set it
112
- explicitly. See Alibaba's
113
- [preserved-thinking documentation](https://docs.qwencloud.com/developer-guides/text-generation/thinking#preserve-thinking-in-multi-turn).
114
- - Reasoning from the current tool-call round is always sent back with tool
115
- results, as Alibaba recommends.
116
- - Preserved reasoning increases input token usage and billing.
117
- - Historical reasoning remains separate from visible assistant text; it is never
118
- merged into `content`.
119
-
120
- ## Embedding Model Example
121
-
122
- ```ts
123
- import { alibaba, type AlibabaEmbeddingModelOptions } from '@ai-sdk/alibaba';
124
- import { embed } from 'ai';
125
-
126
- const { embedding, usage } = await embed({
127
- model: alibaba.embedding('text-embedding-v4'),
128
- value: 'sunny day at the beach',
129
- providerOptions: {
130
- alibaba: {
131
- textType: 'document',
132
- dimension: 1024,
133
- outputType: 'dense',
134
- } satisfies AlibabaEmbeddingModelOptions,
135
- },
136
- });
137
- ```
138
-
139
- ## Tool Calling Example
140
-
141
- ```ts
142
- import { alibaba } from '@ai-sdk/alibaba';
143
- import { generateText, tool } from 'ai';
144
- import { z } from 'zod';
145
-
146
- const { text } = await generateText({
147
- model: alibaba('qwen-plus'),
148
- tools: {
149
- weather: tool({
150
- description: 'Get the weather in a location',
151
- inputSchema: z.object({
152
- location: z.string().describe('The location to get the weather for'),
153
- }),
154
- execute: async ({ location }) => ({
155
- location,
156
- temperature: 72 + Math.floor(Math.random() * 21) - 10,
157
- }),
158
- }),
159
- },
160
- prompt: 'What is the weather in San Francisco?',
161
- });
162
- ```
163
-
164
- ## Explicit Caching Example
165
-
166
- Alibaba supports both implicit and explicit prompt caching to reduce costs for repeated prompts.
167
-
168
- **Implicit caching** works automatically - the provider caches appropriate content without any configuration. For more control, you can use **explicit caching** by marking specific messages with `cacheControl`:
169
-
170
- ```ts
171
- import { alibaba } from '@ai-sdk/alibaba';
172
- import { generateText } from 'ai';
173
-
174
- const longDocument = '... large document content ...';
175
-
176
- const { text, usage } = await generateText({
177
- model: alibaba('qwen-plus'),
178
- messages: [
179
- {
180
- role: 'user',
181
- content: [
182
- {
183
- type: 'text',
184
- text: 'Context: Please analyze this document.',
185
- },
186
- {
187
- type: 'text',
188
- text: longDocument,
189
- providerOptions: {
190
- alibaba: {
191
- cacheControl: { type: 'ephemeral' },
192
- },
193
- },
194
- },
195
- ],
196
- },
197
- ],
198
- });
199
- ```
200
-
201
- **Note:** The minimum content length for a cache block is 1,024 tokens.
202
-
203
- ## Documentation
204
-
205
- Please check out the **[Alibaba provider documentation](https://ai-sdk.dev/providers/ai-sdk-providers/alibaba)** for more information.
33
+ See the [Alibaba Provider documentation](https://ai-sdk.dev/providers/ai-sdk-providers/alibaba) for more information.
package/dist/index.js CHANGED
@@ -1221,7 +1221,7 @@ var AlibabaVideoModel = class {
1221
1221
  };
1222
1222
  //#endregion
1223
1223
  //#region src/version.ts
1224
- const VERSION = "2.0.75";
1224
+ const VERSION = "2.0.77";
1225
1225
  //#endregion
1226
1226
  //#region src/alibaba-provider.ts
1227
1227
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/alibaba",
3
- "version": "2.0.75",
3
+ "version": "2.0.77",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -25,8 +25,8 @@
25
25
  }
26
26
  },
27
27
  "dependencies": {
28
- "@ai-sdk/provider": "4.0.33",
29
- "@ai-sdk/provider-utils": "5.0.67"
28
+ "@ai-sdk/provider": "4.0.34",
29
+ "@ai-sdk/provider-utils": "5.0.69"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@ai-sdk/test-server": "2.0.4",