@ai-sdk/alibaba 1.0.67 → 1.0.69
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 +20 -0
- package/dist/index.d.mts +15 -22
- package/dist/index.d.ts +15 -22
- package/dist/index.js +251 -213
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +227 -174
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/alibaba-chat-language-model.ts +94 -81
- package/src/alibaba-chat-options.ts +38 -29
- package/src/alibaba-embedding-model.ts +29 -22
- package/src/alibaba-embedding-options.ts +30 -21
- package/src/alibaba-error.ts +18 -9
- package/src/alibaba-video-model.ts +59 -45
|
@@ -15,6 +15,9 @@ import {
|
|
|
15
15
|
type SharedV3Warning,
|
|
16
16
|
} from '@ai-sdk/provider';
|
|
17
17
|
import {
|
|
18
|
+
lazySchema,
|
|
19
|
+
zodSchema,
|
|
20
|
+
type InferSchema,
|
|
18
21
|
combineHeaders,
|
|
19
22
|
createEventSourceResponseHandler,
|
|
20
23
|
createJsonResponseHandler,
|
|
@@ -221,12 +224,6 @@ export class AlibabaLanguageModel implements LanguageModelV3 {
|
|
|
221
224
|
const choice = response.choices[0];
|
|
222
225
|
const content: Array<LanguageModelV3Content> = [];
|
|
223
226
|
|
|
224
|
-
// text content:
|
|
225
|
-
const text = choice.message.content;
|
|
226
|
-
if (text != null && text.length > 0) {
|
|
227
|
-
content.push({ type: 'text', text });
|
|
228
|
-
}
|
|
229
|
-
|
|
230
227
|
// reasoning content (Alibaba uses 'reasoning_content' field):
|
|
231
228
|
const reasoning = choice.message.reasoning_content;
|
|
232
229
|
if (reasoning != null && reasoning.length > 0) {
|
|
@@ -236,6 +233,12 @@ export class AlibabaLanguageModel implements LanguageModelV3 {
|
|
|
236
233
|
});
|
|
237
234
|
}
|
|
238
235
|
|
|
236
|
+
// text content:
|
|
237
|
+
const text = choice.message.content;
|
|
238
|
+
if (text != null && text.length > 0) {
|
|
239
|
+
content.push({ type: 'text', text });
|
|
240
|
+
}
|
|
241
|
+
|
|
239
242
|
// tool calls:
|
|
240
243
|
if (choice.message.tool_calls != null) {
|
|
241
244
|
for (const toolCall of choice.message.tool_calls) {
|
|
@@ -294,7 +297,8 @@ export class AlibabaLanguageModel implements LanguageModelV3 {
|
|
|
294
297
|
unified: 'other',
|
|
295
298
|
raw: undefined,
|
|
296
299
|
};
|
|
297
|
-
let usage: z.infer<typeof alibabaUsageSchema
|
|
300
|
+
let usage: z.infer<ReturnType<typeof alibabaUsageSchema>> | undefined =
|
|
301
|
+
undefined;
|
|
298
302
|
|
|
299
303
|
let isFirstChunk = true;
|
|
300
304
|
let activeText = false;
|
|
@@ -311,7 +315,7 @@ export class AlibabaLanguageModel implements LanguageModelV3 {
|
|
|
311
315
|
return {
|
|
312
316
|
stream: response.pipeThrough(
|
|
313
317
|
new TransformStream<
|
|
314
|
-
ParseResult<
|
|
318
|
+
ParseResult<InferSchema<typeof alibabaChatChunkSchema>>,
|
|
315
319
|
LanguageModelV3StreamPart
|
|
316
320
|
>({
|
|
317
321
|
start(controller) {
|
|
@@ -546,82 +550,91 @@ export class AlibabaLanguageModel implements LanguageModelV3 {
|
|
|
546
550
|
* Reference for schemas below:
|
|
547
551
|
* https://www.alibabacloud.com/help/en/model-studio/qwen-api-via-openai-chat-completions
|
|
548
552
|
*/
|
|
549
|
-
const alibabaUsageSchema =
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
model: z.string().nullish(),
|
|
570
|
-
choices: z.array(
|
|
553
|
+
const alibabaUsageSchema = () =>
|
|
554
|
+
z.object({
|
|
555
|
+
prompt_tokens: z.number(),
|
|
556
|
+
completion_tokens: z.number(),
|
|
557
|
+
total_tokens: z.number(),
|
|
558
|
+
prompt_tokens_details: z
|
|
559
|
+
.object({
|
|
560
|
+
cached_tokens: z.number().nullish(),
|
|
561
|
+
cache_creation_input_tokens: z.number().nullish(),
|
|
562
|
+
})
|
|
563
|
+
.nullish(),
|
|
564
|
+
completion_tokens_details: z
|
|
565
|
+
.object({
|
|
566
|
+
reasoning_tokens: z.number().nullish(),
|
|
567
|
+
})
|
|
568
|
+
.nullish(),
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
const alibabaChatResponseSchema = lazySchema(() =>
|
|
572
|
+
zodSchema(
|
|
571
573
|
z.object({
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
.
|
|
578
|
-
z.
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
574
|
+
id: z.string().nullish(),
|
|
575
|
+
created: z.number().nullish(),
|
|
576
|
+
model: z.string().nullish(),
|
|
577
|
+
choices: z.array(
|
|
578
|
+
z.object({
|
|
579
|
+
message: z.object({
|
|
580
|
+
role: z.literal('assistant').nullish(),
|
|
581
|
+
content: z.string().nullish(),
|
|
582
|
+
reasoning_content: z.string().nullish(), // Alibaba thinking mode
|
|
583
|
+
tool_calls: z
|
|
584
|
+
.array(
|
|
585
|
+
z.object({
|
|
586
|
+
id: z.string(),
|
|
587
|
+
type: z.literal('function'),
|
|
588
|
+
function: z.object({
|
|
589
|
+
name: z.string(),
|
|
590
|
+
arguments: z.string(),
|
|
591
|
+
}),
|
|
592
|
+
}),
|
|
593
|
+
)
|
|
594
|
+
.nullish(),
|
|
595
|
+
}),
|
|
596
|
+
finish_reason: z.string().nullish(),
|
|
597
|
+
index: z.number(),
|
|
598
|
+
}),
|
|
599
|
+
),
|
|
600
|
+
usage: alibabaUsageSchema().nullish(),
|
|
591
601
|
}),
|
|
592
602
|
),
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
id: z.string().nullish(),
|
|
598
|
-
created: z.number().nullish(),
|
|
599
|
-
model: z.string().nullish(),
|
|
600
|
-
choices: z.array(
|
|
603
|
+
);
|
|
604
|
+
|
|
605
|
+
const alibabaChatChunkSchema = lazySchema(() =>
|
|
606
|
+
zodSchema(
|
|
601
607
|
z.object({
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
.
|
|
608
|
-
z.
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
.object({
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
608
|
+
id: z.string().nullish(),
|
|
609
|
+
created: z.number().nullish(),
|
|
610
|
+
model: z.string().nullish(),
|
|
611
|
+
choices: z.array(
|
|
612
|
+
z.object({
|
|
613
|
+
delta: z.object({
|
|
614
|
+
role: z.enum(['assistant']).nullish(),
|
|
615
|
+
content: z.string().nullish(),
|
|
616
|
+
reasoning_content: z.string().nullish(), // Alibaba thinking mode delta
|
|
617
|
+
tool_calls: z
|
|
618
|
+
.array(
|
|
619
|
+
z.object({
|
|
620
|
+
index: z.number().nullish(), // Index for accumulating tool calls
|
|
621
|
+
id: z.string().nullish(),
|
|
622
|
+
type: z.literal('function').nullish(),
|
|
623
|
+
function: z
|
|
624
|
+
.object({
|
|
625
|
+
name: z.string().nullish(),
|
|
626
|
+
arguments: z.string().nullish(),
|
|
627
|
+
})
|
|
628
|
+
.nullish(),
|
|
629
|
+
}),
|
|
630
|
+
)
|
|
631
|
+
.nullish(),
|
|
632
|
+
}),
|
|
633
|
+
finish_reason: z.string().nullish(),
|
|
634
|
+
index: z.number(),
|
|
635
|
+
}),
|
|
636
|
+
),
|
|
637
|
+
usage: alibabaUsageSchema().nullish(), // Usage only appears in final chunk
|
|
624
638
|
}),
|
|
625
639
|
),
|
|
626
|
-
|
|
627
|
-
});
|
|
640
|
+
);
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
lazySchema,
|
|
3
|
+
zodSchema,
|
|
4
|
+
type InferSchema,
|
|
5
|
+
} from '@ai-sdk/provider-utils';
|
|
1
6
|
import { z } from 'zod/v4';
|
|
2
7
|
|
|
3
8
|
// https://www.alibabacloud.com/help/en/model-studio/models
|
|
@@ -29,38 +34,42 @@ export type AlibabaChatModelId =
|
|
|
29
34
|
| 'qwen3-coder-flash'
|
|
30
35
|
| (string & {});
|
|
31
36
|
|
|
32
|
-
export const alibabaLanguageModelOptions =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
export const alibabaLanguageModelOptions = lazySchema(() =>
|
|
38
|
+
zodSchema(
|
|
39
|
+
z.object({
|
|
40
|
+
/**
|
|
41
|
+
* Enable thinking/reasoning mode for supported models.
|
|
42
|
+
* When enabled, the model generates reasoning content before the response.
|
|
43
|
+
*
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
enableThinking: z.boolean().optional(),
|
|
40
47
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Maximum number of reasoning tokens to generate.
|
|
50
|
+
*/
|
|
51
|
+
thinkingBudget: z.number().positive().optional(),
|
|
45
52
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Whether to preserve reasoning from previous assistant messages.
|
|
55
|
+
*
|
|
56
|
+
* When enabled, historical reasoning is sent separately as
|
|
57
|
+
* `reasoning_content` and Alibaba receives `preserve_thinking: true`.
|
|
58
|
+
* Defaults to `true` for models that support preserved thinking; set to
|
|
59
|
+
* `false` to opt out.
|
|
60
|
+
*/
|
|
61
|
+
preserveThinking: z.boolean().optional(),
|
|
55
62
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
})
|
|
63
|
+
/**
|
|
64
|
+
* Whether to enable parallel function calling during tool use.
|
|
65
|
+
*
|
|
66
|
+
* @default true
|
|
67
|
+
*/
|
|
68
|
+
parallelToolCalls: z.boolean().optional(),
|
|
69
|
+
}),
|
|
70
|
+
),
|
|
71
|
+
);
|
|
63
72
|
|
|
64
|
-
export type AlibabaLanguageModelOptions =
|
|
73
|
+
export type AlibabaLanguageModelOptions = InferSchema<
|
|
65
74
|
typeof alibabaLanguageModelOptions
|
|
66
75
|
>;
|
|
@@ -4,6 +4,8 @@ import {
|
|
|
4
4
|
type EmbeddingModelV3,
|
|
5
5
|
} from '@ai-sdk/provider';
|
|
6
6
|
import {
|
|
7
|
+
lazySchema,
|
|
8
|
+
zodSchema,
|
|
7
9
|
combineHeaders,
|
|
8
10
|
createJsonErrorResponseHandler,
|
|
9
11
|
createJsonResponseHandler,
|
|
@@ -135,27 +137,32 @@ export class AlibabaEmbeddingModel implements EmbeddingModelV3 {
|
|
|
135
137
|
}
|
|
136
138
|
}
|
|
137
139
|
|
|
138
|
-
const alibabaTextEmbeddingSparseEmbeddingSchema =
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
const alibabaTextEmbeddingSparseEmbeddingSchema = () =>
|
|
141
|
+
z.object({
|
|
142
|
+
index: z.number(),
|
|
143
|
+
value: z.number(),
|
|
144
|
+
token: z.string().nullish(),
|
|
145
|
+
});
|
|
143
146
|
|
|
144
|
-
const alibabaTextEmbeddingResponseSchema =
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
z.object({
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
147
|
+
const alibabaTextEmbeddingResponseSchema = lazySchema(() =>
|
|
148
|
+
zodSchema(
|
|
149
|
+
z.object({
|
|
150
|
+
output: z.object({
|
|
151
|
+
embeddings: z.array(
|
|
152
|
+
z.object({
|
|
153
|
+
embedding: z.array(z.number()),
|
|
154
|
+
text_index: z.number(),
|
|
155
|
+
sparse_embedding: z
|
|
156
|
+
.array(alibabaTextEmbeddingSparseEmbeddingSchema())
|
|
157
|
+
.nullish(),
|
|
158
|
+
}),
|
|
159
|
+
),
|
|
153
160
|
}),
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
})
|
|
160
|
-
|
|
161
|
-
|
|
161
|
+
usage: z
|
|
162
|
+
.object({
|
|
163
|
+
total_tokens: z.number(),
|
|
164
|
+
})
|
|
165
|
+
.nullish(),
|
|
166
|
+
}),
|
|
167
|
+
),
|
|
168
|
+
);
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
lazySchema,
|
|
3
|
+
zodSchema,
|
|
4
|
+
type InferSchema,
|
|
5
|
+
} from '@ai-sdk/provider-utils';
|
|
1
6
|
import { z } from 'zod/v4';
|
|
2
7
|
|
|
3
8
|
export type AlibabaEmbeddingModelId =
|
|
@@ -5,29 +10,33 @@ export type AlibabaEmbeddingModelId =
|
|
|
5
10
|
| 'text-embedding-v3'
|
|
6
11
|
| (string & {});
|
|
7
12
|
|
|
8
|
-
export const alibabaEmbeddingModelOptions =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
export const alibabaEmbeddingModelOptions = lazySchema(() =>
|
|
14
|
+
zodSchema(
|
|
15
|
+
z.object({
|
|
16
|
+
/**
|
|
17
|
+
* Differentiates query text from document text for asymmetric retrieval tasks.
|
|
18
|
+
* Defaults to `document`.
|
|
19
|
+
*/
|
|
20
|
+
textType: z.enum(['query', 'document']).optional(),
|
|
14
21
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
/**
|
|
23
|
+
* The dimension of the output embedding vectors. Defaults to 1024.
|
|
24
|
+
*
|
|
25
|
+
* `text-embedding-v4` also supports 1536 and 2048 dimensions.
|
|
26
|
+
*/
|
|
27
|
+
dimension: z.number().optional(),
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
})
|
|
29
|
+
/**
|
|
30
|
+
* The output vector type. Defaults to `dense`.
|
|
31
|
+
*
|
|
32
|
+
* Sparse-only output is not supported by the AI SDK embedding interface,
|
|
33
|
+
* which requires dense number arrays.
|
|
34
|
+
*/
|
|
35
|
+
outputType: z.enum(['dense', 'sparse', 'dense&sparse']).optional(),
|
|
36
|
+
}),
|
|
37
|
+
),
|
|
38
|
+
);
|
|
30
39
|
|
|
31
|
-
export type AlibabaEmbeddingModelOptions =
|
|
40
|
+
export type AlibabaEmbeddingModelOptions = InferSchema<
|
|
32
41
|
typeof alibabaEmbeddingModelOptions
|
|
33
42
|
>;
|
package/src/alibaba-error.ts
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
lazySchema,
|
|
3
|
+
zodSchema,
|
|
4
|
+
type InferSchema,
|
|
5
|
+
createJsonErrorResponseHandler,
|
|
6
|
+
} from '@ai-sdk/provider-utils';
|
|
2
7
|
import { z } from 'zod/v4';
|
|
3
8
|
|
|
4
|
-
const alibabaErrorDataSchema =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const alibabaErrorDataSchema = lazySchema(() =>
|
|
10
|
+
zodSchema(
|
|
11
|
+
z.object({
|
|
12
|
+
error: z.object({
|
|
13
|
+
message: z.string(),
|
|
14
|
+
code: z.string().nullish(),
|
|
15
|
+
type: z.string().nullish(),
|
|
16
|
+
}),
|
|
17
|
+
}),
|
|
18
|
+
),
|
|
19
|
+
);
|
|
11
20
|
|
|
12
|
-
export type AlibabaErrorData =
|
|
21
|
+
export type AlibabaErrorData = InferSchema<typeof alibabaErrorDataSchema>;
|
|
13
22
|
|
|
14
23
|
export const alibabaFailedResponseHandler = createJsonErrorResponseHandler({
|
|
15
24
|
errorSchema: alibabaErrorDataSchema,
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
type SharedV3Warning,
|
|
6
6
|
} from '@ai-sdk/provider';
|
|
7
7
|
import {
|
|
8
|
+
type InferSchema,
|
|
8
9
|
combineHeaders,
|
|
9
10
|
convertImageModelFileToDataUri,
|
|
10
11
|
convertUint8ArrayToBase64,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
createJsonResponseHandler,
|
|
13
14
|
delay,
|
|
14
15
|
type FetchFunction,
|
|
16
|
+
encodePathSegment,
|
|
15
17
|
getFromApi,
|
|
16
18
|
lazySchema,
|
|
17
19
|
parseProviderOptions,
|
|
@@ -130,58 +132,70 @@ interface AlibabaVideoModelConfig {
|
|
|
130
132
|
}
|
|
131
133
|
|
|
132
134
|
// DashScope native API error format (different from OpenAI-compatible endpoint)
|
|
133
|
-
const alibabaVideoErrorSchema =
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
const alibabaVideoErrorSchema = lazySchema(() =>
|
|
136
|
+
zodSchema(
|
|
137
|
+
z.object({
|
|
138
|
+
code: z.string().nullish(),
|
|
139
|
+
message: z.string(),
|
|
140
|
+
request_id: z.string().nullish(),
|
|
141
|
+
}),
|
|
142
|
+
),
|
|
143
|
+
);
|
|
138
144
|
|
|
139
145
|
const alibabaVideoFailedResponseHandler = createJsonErrorResponseHandler({
|
|
140
146
|
errorSchema: alibabaVideoErrorSchema,
|
|
141
147
|
errorToMessage: data => data.message,
|
|
142
148
|
});
|
|
143
149
|
|
|
144
|
-
const alibabaVideoCreateTaskSchema =
|
|
145
|
-
|
|
146
|
-
.object({
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
const alibabaVideoCreateTaskSchema = lazySchema(() =>
|
|
151
|
+
zodSchema(
|
|
152
|
+
z.object({
|
|
153
|
+
output: z
|
|
154
|
+
.object({
|
|
155
|
+
task_status: z.string(),
|
|
156
|
+
task_id: z.string(),
|
|
157
|
+
})
|
|
158
|
+
.nullish(),
|
|
159
|
+
request_id: z.string().nullish(),
|
|
160
|
+
}),
|
|
161
|
+
),
|
|
162
|
+
);
|
|
153
163
|
|
|
154
|
-
const alibabaVideoTaskStatusSchema =
|
|
155
|
-
|
|
156
|
-
.object({
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
164
|
+
const alibabaVideoTaskStatusSchema = lazySchema(() =>
|
|
165
|
+
zodSchema(
|
|
166
|
+
z.object({
|
|
167
|
+
output: z
|
|
168
|
+
.object({
|
|
169
|
+
task_id: z.string(),
|
|
170
|
+
task_status: z.string(),
|
|
171
|
+
video_url: z.string().nullish(),
|
|
172
|
+
submit_time: z.string().nullish(),
|
|
173
|
+
scheduled_time: z.string().nullish(),
|
|
174
|
+
end_time: z.string().nullish(),
|
|
175
|
+
orig_prompt: z.string().nullish(),
|
|
176
|
+
actual_prompt: z.string().nullish(),
|
|
177
|
+
code: z.string().nullish(),
|
|
178
|
+
message: z.string().nullish(),
|
|
179
|
+
})
|
|
180
|
+
.nullish(),
|
|
181
|
+
usage: z
|
|
182
|
+
.object({
|
|
183
|
+
duration: z.number().nullish(),
|
|
184
|
+
output_video_duration: z.number().nullish(),
|
|
185
|
+
// wan3 splits the total: input video counts toward its 30s ceiling.
|
|
186
|
+
input_video_duration: z.number().nullish(),
|
|
187
|
+
fps: z.number().nullish(),
|
|
188
|
+
SR: z.number().nullish(),
|
|
189
|
+
size: z.string().nullish(),
|
|
190
|
+
ratio: z.string().nullish(),
|
|
191
|
+
})
|
|
192
|
+
.nullish(),
|
|
193
|
+
request_id: z.string().nullish(),
|
|
194
|
+
}),
|
|
195
|
+
),
|
|
196
|
+
);
|
|
183
197
|
|
|
184
|
-
type AlibabaVideoTaskStatusResponse =
|
|
198
|
+
type AlibabaVideoTaskStatusResponse = InferSchema<
|
|
185
199
|
typeof alibabaVideoTaskStatusSchema
|
|
186
200
|
>;
|
|
187
201
|
|
|
@@ -667,7 +681,7 @@ export class AlibabaVideoModel implements Experimental_VideoModelV3 {
|
|
|
667
681
|
|
|
668
682
|
const { value: statusResponse, responseHeaders: pollHeaders } =
|
|
669
683
|
await getFromApi({
|
|
670
|
-
url: `${this.config.baseURL}/api/v1/tasks/${taskId}`,
|
|
684
|
+
url: `${this.config.baseURL}/api/v1/tasks/${encodePathSegment(taskId)}`,
|
|
671
685
|
headers: combineHeaders(
|
|
672
686
|
await resolve(this.config.headers),
|
|
673
687
|
options.headers,
|