@ai-sdk/alibaba 2.0.0-beta.3 → 2.0.0-beta.30
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 +242 -0
- package/README.md +2 -0
- package/dist/index.js +262 -209
- package/dist/index.js.map +1 -1
- package/package.json +8 -10
- package/src/alibaba-chat-language-model.ts +72 -9
- package/src/alibaba-config.ts +1 -1
- package/src/convert-to-alibaba-chat-messages.ts +17 -26
- package/dist/index.d.mts +0 -119
- package/dist/index.mjs +0 -1054
- package/dist/index.mjs.map +0 -1
package/dist/index.d.mts
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod/v4';
|
|
2
|
-
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
-
import { ProviderV4, LanguageModelV4, Experimental_VideoModelV4 } from '@ai-sdk/provider';
|
|
4
|
-
|
|
5
|
-
type AlibabaChatModelId = '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
|
-
declare const alibabaLanguageModelOptions: z.ZodObject<{
|
|
7
|
-
enableThinking: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
-
thinkingBudget: z.ZodOptional<z.ZodNumber>;
|
|
9
|
-
parallelToolCalls: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
-
}, z.core.$strip>;
|
|
11
|
-
type AlibabaLanguageModelOptions = z.infer<typeof alibabaLanguageModelOptions>;
|
|
12
|
-
|
|
13
|
-
type AlibabaCacheControl = {
|
|
14
|
-
type: string;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
type AlibabaVideoModelId = 'wan2.6-t2v' | 'wan2.5-t2v-preview' | 'wan2.6-i2v' | 'wan2.6-i2v-flash' | 'wan2.6-r2v' | 'wan2.6-r2v-flash' | (string & {});
|
|
18
|
-
|
|
19
|
-
interface AlibabaProvider extends ProviderV4 {
|
|
20
|
-
(modelId: AlibabaChatModelId): LanguageModelV4;
|
|
21
|
-
/**
|
|
22
|
-
* Creates a model for text generation.
|
|
23
|
-
*/
|
|
24
|
-
languageModel(modelId: AlibabaChatModelId): LanguageModelV4;
|
|
25
|
-
/**
|
|
26
|
-
* Creates a chat model for text generation.
|
|
27
|
-
*/
|
|
28
|
-
chatModel(modelId: AlibabaChatModelId): LanguageModelV4;
|
|
29
|
-
/**
|
|
30
|
-
* Creates a model for video generation.
|
|
31
|
-
*/
|
|
32
|
-
video(modelId: AlibabaVideoModelId): Experimental_VideoModelV4;
|
|
33
|
-
/**
|
|
34
|
-
* Creates a model for video generation.
|
|
35
|
-
*/
|
|
36
|
-
videoModel(modelId: AlibabaVideoModelId): Experimental_VideoModelV4;
|
|
37
|
-
}
|
|
38
|
-
interface AlibabaProviderSettings {
|
|
39
|
-
/**
|
|
40
|
-
* Use a different URL prefix for API calls, e.g. to use proxy servers or regional endpoints.
|
|
41
|
-
* The default prefix is `https://dashscope-intl.aliyuncs.com/compatible-mode/v1`.
|
|
42
|
-
*/
|
|
43
|
-
baseURL?: string;
|
|
44
|
-
/**
|
|
45
|
-
* Use a different URL prefix for video generation API calls.
|
|
46
|
-
* The video API uses the DashScope native endpoint (not the OpenAI-compatible endpoint).
|
|
47
|
-
* The default prefix is `https://dashscope-intl.aliyuncs.com`.
|
|
48
|
-
*/
|
|
49
|
-
videoBaseURL?: string;
|
|
50
|
-
/**
|
|
51
|
-
* API key that is being sent using the `Authorization` header.
|
|
52
|
-
* It defaults to the `ALIBABA_API_KEY` environment variable.
|
|
53
|
-
*/
|
|
54
|
-
apiKey?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Custom headers to include in the requests.
|
|
57
|
-
*/
|
|
58
|
-
headers?: Record<string, string>;
|
|
59
|
-
/**
|
|
60
|
-
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
61
|
-
* or to provide a custom fetch implementation for e.g. testing.
|
|
62
|
-
*/
|
|
63
|
-
fetch?: FetchFunction;
|
|
64
|
-
/**
|
|
65
|
-
* Include usage information in streaming responses.
|
|
66
|
-
* When enabled, token usage will be included in the final chunk.
|
|
67
|
-
*
|
|
68
|
-
* @default true
|
|
69
|
-
*/
|
|
70
|
-
includeUsage?: boolean;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Create an Alibaba Cloud (Qwen) provider instance.
|
|
74
|
-
*/
|
|
75
|
-
declare function createAlibaba(options?: AlibabaProviderSettings): AlibabaProvider;
|
|
76
|
-
declare const alibaba: AlibabaProvider;
|
|
77
|
-
|
|
78
|
-
type AlibabaVideoModelOptions = {
|
|
79
|
-
/** Negative prompt to specify what to avoid (max 500 chars). */
|
|
80
|
-
negativePrompt?: string | null;
|
|
81
|
-
/** URL to audio file for audio-video sync (WAV/MP3, 3-30s, max 15MB). */
|
|
82
|
-
audioUrl?: string | null;
|
|
83
|
-
/** Enable prompt extension/rewriting for better generation. Defaults to true. */
|
|
84
|
-
promptExtend?: boolean | null;
|
|
85
|
-
/** Shot type: 'single' for single-shot or 'multi' for multi-shot narrative. */
|
|
86
|
-
shotType?: 'single' | 'multi' | null;
|
|
87
|
-
/** Whether to add watermark to generated video. Defaults to false. */
|
|
88
|
-
watermark?: boolean | null;
|
|
89
|
-
/** Enable audio generation (for I2V/R2V models). */
|
|
90
|
-
audio?: boolean | null;
|
|
91
|
-
/**
|
|
92
|
-
* Reference URLs for reference-to-video mode.
|
|
93
|
-
* Array of URLs to images (0-5) and/or videos (0-3), max 5 total.
|
|
94
|
-
* Use character identifiers (character1, character2) in prompts to reference them.
|
|
95
|
-
*/
|
|
96
|
-
referenceUrls?: string[] | null;
|
|
97
|
-
/** Polling interval in milliseconds. Defaults to 5000 (5 seconds). */
|
|
98
|
-
pollIntervalMs?: number | null;
|
|
99
|
-
/** Maximum wait time in milliseconds for video generation. Defaults to 600000 (10 minutes). */
|
|
100
|
-
pollTimeoutMs?: number | null;
|
|
101
|
-
[key: string]: unknown;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
type AlibabaUsage = {
|
|
105
|
-
prompt_tokens?: number | null;
|
|
106
|
-
completion_tokens?: number | null;
|
|
107
|
-
total_tokens?: number | null;
|
|
108
|
-
prompt_tokens_details?: {
|
|
109
|
-
cached_tokens?: number | null;
|
|
110
|
-
cache_creation_input_tokens?: number | null;
|
|
111
|
-
} | null;
|
|
112
|
-
completion_tokens_details?: {
|
|
113
|
-
reasoning_tokens?: number | null;
|
|
114
|
-
} | null;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
declare const VERSION: string;
|
|
118
|
-
|
|
119
|
-
export { type AlibabaCacheControl, type AlibabaChatModelId, type AlibabaLanguageModelOptions, type AlibabaProvider, type AlibabaLanguageModelOptions as AlibabaProviderOptions, type AlibabaProviderSettings, type AlibabaUsage, type AlibabaVideoModelId, type AlibabaVideoModelOptions, type AlibabaVideoModelOptions as AlibabaVideoProviderOptions, VERSION, alibaba, createAlibaba };
|