@ai-sdk/alibaba 2.0.57 → 2.0.59
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 +17 -0
- package/dist/index.d.ts +171 -163
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1214 -1531
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/alibaba-provider.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @ai-sdk/alibaba
|
|
2
2
|
|
|
3
|
+
## 2.0.59
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ede5b89: chore: migrate package builds from tsup to tsdown
|
|
8
|
+
- Updated dependencies [ede5b89]
|
|
9
|
+
- @ai-sdk/provider@4.0.20
|
|
10
|
+
- @ai-sdk/provider-utils@5.0.52
|
|
11
|
+
|
|
12
|
+
## 2.0.58
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- c2511c1: fix: use standards-compliant User-Agent header
|
|
17
|
+
- Updated dependencies [c2511c1]
|
|
18
|
+
- @ai-sdk/provider-utils@5.0.51
|
|
19
|
+
|
|
3
20
|
## 2.0.57
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,164 +1,170 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { EmbeddingModelV4, Experimental_VideoModelV4, LanguageModelV4, ProviderV4 } from "@ai-sdk/provider";
|
|
2
|
+
import { FetchFunction } from "@ai-sdk/provider-utils";
|
|
3
|
+
import { z } from "zod/v4";
|
|
4
|
+
//#region src/alibaba-chat-language-model-options.d.ts
|
|
5
5
|
type AlibabaChatModelId = 'qwen3.7-max' | 'qwen3-max' | 'qwen3-max-preview' | 'qwen-plus' | 'qwen-plus-latest' | 'qwen-flash' | 'qwen-turbo' | 'qwen-turbo-latest' | 'qwen3-235b-a22b' | 'qwen3-32b' | 'qwen3-30b-a3b' | 'qwen3-14b' | 'qwen3-next-80b-a3b-thinking' | 'qwen3-235b-a22b-thinking-2507' | 'qwen3-30b-a3b-thinking-2507' | 'qwq-plus' | 'qwq-plus-latest' | 'qwq-32b' | 'qwen-coder' | 'qwen3-coder-plus' | 'qwen3-coder-flash' | (string & {});
|
|
6
6
|
declare const alibabaLanguageModelChatOptions: z.ZodObject<{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
enableThinking: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
+
thinkingBudget: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
preserveThinking: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
parallelToolCalls: z.ZodOptional<z.ZodBoolean>;
|
|
11
11
|
}, z.core.$strip>;
|
|
12
12
|
type AlibabaLanguageModelChatOptions = z.infer<typeof alibabaLanguageModelChatOptions>;
|
|
13
|
-
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/alibaba-chat-prompt.d.ts
|
|
14
15
|
type AlibabaCacheControl = {
|
|
15
|
-
|
|
16
|
+
type: string;
|
|
16
17
|
};
|
|
17
|
-
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/alibaba-embedding-model-options.d.ts
|
|
18
20
|
type AlibabaEmbeddingModelId = 'text-embedding-v4' | 'text-embedding-v3' | (string & {});
|
|
19
21
|
declare const alibabaEmbeddingModelOptions: z.ZodObject<{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
textType: z.ZodOptional<z.ZodEnum<{
|
|
23
|
+
query: "query";
|
|
24
|
+
document: "document";
|
|
25
|
+
}>>;
|
|
26
|
+
dimension: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
outputType: z.ZodOptional<z.ZodEnum<{
|
|
28
|
+
dense: "dense";
|
|
29
|
+
sparse: "sparse";
|
|
30
|
+
"dense&sparse": "dense&sparse";
|
|
31
|
+
}>>;
|
|
30
32
|
}, z.core.$strip>;
|
|
31
33
|
type AlibabaEmbeddingModelOptions = z.infer<typeof alibabaEmbeddingModelOptions>;
|
|
32
|
-
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/alibaba-video-settings.d.ts
|
|
33
36
|
type AlibabaVideoModelId = 'wan2.6-t2v' | 'wan2.5-t2v-preview' | 'wan2.7-t2v' | 'wan2.7-t2v-2026-06-12' | 'wan2.6-i2v' | 'wan2.6-i2v-flash' | 'wan2.6-r2v' | 'wan2.6-r2v-flash' | 'wan2.7-r2v' | 'wan2.7-r2v-2026-06-12' | 'wan3.0-video' | (string & {});
|
|
34
|
-
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/alibaba-provider.d.ts
|
|
35
39
|
interface AlibabaProvider extends ProviderV4 {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
40
|
+
(modelId: AlibabaChatModelId): LanguageModelV4;
|
|
41
|
+
/**
|
|
42
|
+
* Creates a model for text generation.
|
|
43
|
+
*/
|
|
44
|
+
languageModel(modelId: AlibabaChatModelId): LanguageModelV4;
|
|
45
|
+
/**
|
|
46
|
+
* Creates a chat model for text generation.
|
|
47
|
+
*/
|
|
48
|
+
chatModel(modelId: AlibabaChatModelId): LanguageModelV4;
|
|
49
|
+
/**
|
|
50
|
+
* Creates a model for text embeddings.
|
|
51
|
+
*/
|
|
52
|
+
embedding(modelId: AlibabaEmbeddingModelId): EmbeddingModelV4;
|
|
53
|
+
/**
|
|
54
|
+
* Creates a model for text embeddings.
|
|
55
|
+
*/
|
|
56
|
+
embeddingModel(modelId: AlibabaEmbeddingModelId): EmbeddingModelV4;
|
|
57
|
+
/**
|
|
58
|
+
* Creates a model for video generation.
|
|
59
|
+
*/
|
|
60
|
+
video(modelId: AlibabaVideoModelId): Experimental_VideoModelV4;
|
|
61
|
+
/**
|
|
62
|
+
* Creates a model for video generation.
|
|
63
|
+
*/
|
|
64
|
+
videoModel(modelId: AlibabaVideoModelId): Experimental_VideoModelV4;
|
|
61
65
|
}
|
|
62
66
|
interface AlibabaProviderSettings {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Use a different URL prefix for API calls, e.g. to use proxy servers or regional endpoints.
|
|
69
|
+
* The default prefix is `https://dashscope-intl.aliyuncs.com/compatible-mode/v1`.
|
|
70
|
+
*/
|
|
71
|
+
baseURL?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Use a different URL prefix for video generation API calls.
|
|
74
|
+
* The video API uses the DashScope native endpoint (not the OpenAI-compatible endpoint).
|
|
75
|
+
* The default prefix is `https://dashscope-intl.aliyuncs.com`.
|
|
76
|
+
*/
|
|
77
|
+
videoBaseURL?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Use a different URL prefix for embedding API calls.
|
|
80
|
+
* The embedding API uses the DashScope native endpoint (not the OpenAI-compatible endpoint).
|
|
81
|
+
* The default prefix is `https://dashscope-intl.aliyuncs.com/api/v1`.
|
|
82
|
+
*/
|
|
83
|
+
embeddingBaseURL?: string;
|
|
84
|
+
/**
|
|
85
|
+
* API key that is being sent using the `Authorization` header.
|
|
86
|
+
* It defaults to the `ALIBABA_API_KEY` environment variable.
|
|
87
|
+
*/
|
|
88
|
+
apiKey?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Custom headers to include in the requests.
|
|
91
|
+
*/
|
|
92
|
+
headers?: Record<string, string>;
|
|
93
|
+
/**
|
|
94
|
+
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
95
|
+
* or to provide a custom fetch implementation for e.g. testing.
|
|
96
|
+
*/
|
|
97
|
+
fetch?: FetchFunction;
|
|
98
|
+
/**
|
|
99
|
+
* Include usage information in streaming responses.
|
|
100
|
+
* When enabled, token usage will be included in the final chunk.
|
|
101
|
+
*
|
|
102
|
+
* @default true
|
|
103
|
+
*/
|
|
104
|
+
includeUsage?: boolean;
|
|
101
105
|
}
|
|
102
106
|
/**
|
|
103
107
|
* Create an Alibaba Cloud (Qwen) provider instance.
|
|
104
108
|
*/
|
|
105
|
-
declare function createAlibaba(options?: AlibabaProviderSettings): AlibabaProvider;
|
|
106
|
-
declare const alibaba: AlibabaProvider;
|
|
107
|
-
|
|
109
|
+
export declare function createAlibaba(options?: AlibabaProviderSettings): AlibabaProvider;
|
|
110
|
+
export declare const alibaba: AlibabaProvider;
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/alibaba-video-model-options.d.ts
|
|
108
113
|
type AlibabaVideoModelOptions = {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
114
|
+
/** Negative prompt to specify what to avoid (max 500 chars). */
|
|
115
|
+
negativePrompt?: string | null;
|
|
116
|
+
/** URL to audio file for audio-video sync (WAV/MP3, 3-30s, max 15MB). */
|
|
117
|
+
audioUrl?: string | null;
|
|
118
|
+
/** Enable prompt extension/rewriting for better generation. Defaults to true. */
|
|
119
|
+
promptExtend?: boolean | null;
|
|
120
|
+
/**
|
|
121
|
+
* Shot type: 'single' for single-shot or 'multi' for multi-shot narrative
|
|
122
|
+
* (wan2.6 and earlier; wan2.7 models describe shot structure in the prompt).
|
|
123
|
+
*/
|
|
124
|
+
shotType?: 'single' | 'multi' | null;
|
|
125
|
+
/** Whether to add watermark to generated video. Defaults to false. */
|
|
126
|
+
watermark?: boolean | null;
|
|
127
|
+
/**
|
|
128
|
+
* Enable audio generation (wan2.6 I2V/R2V and wan3 models;
|
|
129
|
+
* wan2.7 models always generate audio). Defaults to true on wan3.
|
|
130
|
+
*/
|
|
131
|
+
audio?: boolean | null;
|
|
132
|
+
/**
|
|
133
|
+
* Reference URLs for reference-to-video mode (wan2.6 models).
|
|
134
|
+
* Array of URLs to images (0-5) and/or videos (0-3), max 5 total.
|
|
135
|
+
* Use character identifiers (character1, character2) in prompts to reference them.
|
|
136
|
+
*/
|
|
137
|
+
referenceUrls?: string[] | null;
|
|
138
|
+
/**
|
|
139
|
+
* Explicit media array (wan2.7 and wan3 models). Overrides the automatic
|
|
140
|
+
* mapping from `inputReferences` and `frameImages`.
|
|
141
|
+
* Use `Image 1`, `Video 1`, etc. in prompts to reference media items
|
|
142
|
+
* (images, videos, and audio are counted separately, in array order).
|
|
143
|
+
*
|
|
144
|
+
* `reference_audio`, `file`, and `link` are wan3-only and have no top-level
|
|
145
|
+
* call option, so they can only be passed here. wan3 also rejects mixing
|
|
146
|
+
* `reference_*`/`file`/`link` with `first_frame`/`last_frame`.
|
|
147
|
+
*/
|
|
148
|
+
media?: Array<{
|
|
149
|
+
type: 'reference_image' | 'reference_video' | 'reference_audio' | 'first_frame' | 'last_frame' | 'file' | 'link';
|
|
150
|
+
/** Public URL, or a `data:{mime};base64,{data}` URI for images. */
|
|
151
|
+
url: string;
|
|
152
|
+
/** URL to an audio file used as voice reference for this media item. */
|
|
153
|
+
referenceVoice?: string | null;
|
|
154
|
+
}> | null;
|
|
155
|
+
/**
|
|
156
|
+
* Aspect ratio (wan2.7 text-to-video and reference-to-video models, and
|
|
157
|
+
* every wan3 generation). `adaptive` is wan3-only, and is its default.
|
|
158
|
+
*/
|
|
159
|
+
ratio?: 'adaptive' | '16:9' | '9:16' | '1:1' | '4:3' | '3:4' | null;
|
|
160
|
+
/** Polling interval in milliseconds. Defaults to 5000 (5 seconds). */
|
|
161
|
+
pollIntervalMs?: number | null;
|
|
162
|
+
/** Maximum wait time in milliseconds for video generation. Defaults to 600000 (10 minutes). */
|
|
163
|
+
pollTimeoutMs?: number | null;
|
|
164
|
+
[key: string]: unknown;
|
|
160
165
|
};
|
|
161
|
-
|
|
166
|
+
//#endregion
|
|
167
|
+
//#region src/convert-alibaba-usage.d.ts
|
|
162
168
|
/**
|
|
163
169
|
* Usage as reported by Alibaba's OpenAI-compatible chat completions API.
|
|
164
170
|
*
|
|
@@ -169,26 +175,28 @@ type AlibabaVideoModelOptions = {
|
|
|
169
175
|
* there.
|
|
170
176
|
*/
|
|
171
177
|
type AlibabaUsage = {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
178
|
+
prompt_tokens?: number | null;
|
|
179
|
+
completion_tokens?: number | null;
|
|
180
|
+
total_tokens?: number | null;
|
|
181
|
+
prompt_tokens_details?: {
|
|
182
|
+
cached_tokens?: number | null;
|
|
183
|
+
cache_creation_input_tokens?: number | null;
|
|
184
|
+
/**
|
|
185
|
+
* Which caching mode served the request. Alibaba populates this only under
|
|
186
|
+
* explicit context caching, which sending `cache_control` selects; under
|
|
187
|
+
* implicit caching the field is absent. The two modes are mutually
|
|
188
|
+
* exclusive and priced differently, so this is the discriminator for
|
|
189
|
+
* attributing cache reads to a rate.
|
|
190
|
+
*/
|
|
191
|
+
cache_type?: string | null;
|
|
192
|
+
} | null;
|
|
193
|
+
completion_tokens_details?: {
|
|
194
|
+
reasoning_tokens?: number | null;
|
|
195
|
+
} | null;
|
|
190
196
|
};
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region src/version.d.ts
|
|
199
|
+
export declare const VERSION: string;
|
|
200
|
+
//#endregion
|
|
201
|
+
export type { AlibabaCacheControl, AlibabaChatModelId, AlibabaEmbeddingModelId, AlibabaEmbeddingModelOptions, AlibabaLanguageModelChatOptions, AlibabaLanguageModelChatOptions as AlibabaLanguageModelOptions, AlibabaLanguageModelChatOptions as AlibabaProviderOptions, AlibabaProvider, AlibabaProviderSettings, AlibabaUsage, AlibabaVideoModelId, AlibabaVideoModelOptions, AlibabaVideoModelOptions as AlibabaVideoProviderOptions };
|
|
202
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/alibaba-chat-language-model-options.ts","../src/alibaba-chat-prompt.ts","../src/alibaba-embedding-model-options.ts","../src/alibaba-video-settings.ts","../src/alibaba-provider.ts","../src/alibaba-video-model-options.ts","../src/convert-alibaba-usage.ts","../src/version.ts"],"mappings":";;;;KAGY;cA4BC,iCAA+B,EAAA;;;;;GA8B1C,EAAA,KAAA;KAEU,kCAAkC,EAAE,aACvC;;;KChEG;EAAwB;;;;KCExB;cAKC,8BAA4B,EAAA;;;;;;;;;;;GAqBvC,EAAA,KAAA;KAEU,+BAA+B,EAAE,aACpC;;;KC9BG;;;UCuBK,wBAAwB;GACtC,SAAS,qBAAqB;;;;EAK/B,cAAc,SAAS,qBAAqB;;;;EAK5C,UAAU,SAAS,qBAAqB;;;;EAKxC,UAAU,SAAS,0BAA0B;;;;EAK7C,eAAe,SAAS,0BAA0B;;;;EAKlD,MAAM,SAAS,sBAAsB;;;;EAKrC,WAAW,SAAS,sBAAsB;;UAG3B;;;;;EAKf;;;;;;EAOA;;;;;;EAOA;;;;;EAMA;;;;EAKA,UAAU;;;;;EAMV,QAAQ;;;;;;;EAQR;;;;;wBAMc,cACd,UAAS,0BACR;qBA4EU,SAAO;;;KCvLR;;EAEV;;EAEA;;EAEA;;;;;EAKA;;EAEA;;;;;EAKA;;;;;;EAMA;;;;;;;;;;;EAWA,QAAQ;IACN;;IASA;;IAEA;;;;;;EAMF;;EAEA;;EAEA;GACC;;;;;;;;;;;;;KCjDS;EACV;EACA;EACA;EACA;IACE;IACA;;;;;;;;IAQA;;EAEF;IACE;;;;;qBC3BS"}
|