@ai-sdk/provider 4.0.0-beta.9 → 4.0.0-canary.16
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 +46 -0
- package/dist/index.d.ts +481 -439
- package/dist/index.js +2 -47
- package/dist/index.js.map +1 -1
- package/package.json +8 -6
- package/src/embedding-model/v2/embedding-model-v2.ts +2 -2
- package/src/embedding-model/v3/embedding-model-v3-call-options.ts +1 -1
- package/src/embedding-model/v3/embedding-model-v3-result.ts +2 -2
- package/src/embedding-model/v3/embedding-model-v3.ts +2 -2
- package/src/embedding-model/v4/embedding-model-v4-call-options.ts +1 -1
- package/src/embedding-model/v4/embedding-model-v4-result.ts +2 -2
- package/src/embedding-model/v4/embedding-model-v4.ts +2 -2
- package/src/embedding-model-middleware/v3/embedding-model-v3-middleware.ts +2 -2
- package/src/embedding-model-middleware/v4/embedding-model-v4-middleware.ts +2 -2
- package/src/errors/no-such-provider-reference-error.ts +1 -1
- package/src/files/v4/files-v4-upload-file-call-options.ts +35 -0
- package/src/files/v4/files-v4-upload-file-result.ts +35 -0
- package/src/files/v4/files-v4.ts +2 -63
- package/src/files/v4/index.ts +3 -5
- package/src/image-model/v2/image-model-v2-call-options.ts +1 -1
- package/src/image-model/v2/image-model-v2-call-warning.ts +1 -1
- package/src/image-model/v2/image-model-v2.ts +3 -3
- package/src/image-model/v3/image-model-v3-call-options.ts +2 -2
- package/src/image-model/v3/image-model-v3-file.ts +1 -1
- package/src/image-model/v3/image-model-v3.ts +4 -4
- package/src/image-model/v4/image-model-v4-call-options.ts +2 -2
- package/src/image-model/v4/image-model-v4-file.ts +1 -1
- package/src/image-model/v4/image-model-v4-result.ts +73 -0
- package/src/image-model/v4/image-model-v4.ts +3 -70
- package/src/image-model/v4/index.ts +4 -3
- package/src/image-model-middleware/v3/image-model-v3-middleware.ts +2 -2
- package/src/image-model-middleware/v4/image-model-v4-middleware.ts +2 -2
- package/src/json-value/is-json.ts +1 -1
- package/src/language-model/v2/language-model-v2-call-options.ts +6 -6
- package/src/language-model/v2/language-model-v2-call-warning.ts +3 -3
- package/src/language-model/v2/language-model-v2-content.ts +6 -6
- package/src/language-model/v2/language-model-v2-function-tool.ts +2 -2
- package/src/language-model/v2/language-model-v2-prompt.ts +3 -3
- package/src/language-model/v2/language-model-v2-reasoning.ts +1 -1
- package/src/language-model/v2/language-model-v2-source.ts +1 -1
- package/src/language-model/v2/language-model-v2-stream-part.ts +9 -9
- package/src/language-model/v2/language-model-v2-text.ts +1 -1
- package/src/language-model/v2/language-model-v2-tool-call.ts +1 -1
- package/src/language-model/v2/language-model-v2-tool-result.ts +1 -1
- package/src/language-model/v2/language-model-v2.ts +9 -9
- package/src/language-model/v3/language-model-v3-call-options.ts +6 -6
- package/src/language-model/v3/language-model-v3-content.ts +7 -7
- package/src/language-model/v3/language-model-v3-file.ts +1 -1
- package/src/language-model/v3/language-model-v3-function-tool.ts +3 -3
- package/src/language-model/v3/language-model-v3-generate-result.ts +6 -6
- package/src/language-model/v3/language-model-v3-prompt.ts +3 -3
- package/src/language-model/v3/language-model-v3-reasoning.ts +1 -1
- package/src/language-model/v3/language-model-v3-source.ts +1 -1
- package/src/language-model/v3/language-model-v3-stream-part.ts +10 -10
- package/src/language-model/v3/language-model-v3-stream-result.ts +2 -2
- package/src/language-model/v3/language-model-v3-text.ts +1 -1
- package/src/language-model/v3/language-model-v3-tool-approval-request.ts +1 -1
- package/src/language-model/v3/language-model-v3-tool-call.ts +1 -1
- package/src/language-model/v3/language-model-v3-tool-result.ts +2 -2
- package/src/language-model/v3/language-model-v3-usage.ts +1 -1
- package/src/language-model/v3/language-model-v3.ts +3 -3
- package/src/language-model/v4/index.ts +0 -1
- package/src/language-model/v4/language-model-v4-call-options.ts +6 -6
- package/src/language-model/v4/language-model-v4-content.ts +9 -9
- package/src/language-model/v4/language-model-v4-custom-content.ts +1 -1
- package/src/language-model/v4/language-model-v4-file.ts +10 -3
- package/src/language-model/v4/language-model-v4-function-tool.ts +3 -3
- package/src/language-model/v4/language-model-v4-generate-result.ts +6 -6
- package/src/language-model/v4/language-model-v4-prompt.ts +43 -97
- package/src/language-model/v4/language-model-v4-reasoning-file.ts +10 -3
- package/src/language-model/v4/language-model-v4-reasoning.ts +1 -1
- package/src/language-model/v4/language-model-v4-source.ts +1 -1
- package/src/language-model/v4/language-model-v4-stream-part.ts +12 -12
- package/src/language-model/v4/language-model-v4-stream-result.ts +2 -2
- package/src/language-model/v4/language-model-v4-text.ts +1 -1
- package/src/language-model/v4/language-model-v4-tool-approval-request.ts +1 -1
- package/src/language-model/v4/language-model-v4-tool-call.ts +1 -1
- package/src/language-model/v4/language-model-v4-tool-result.ts +2 -2
- package/src/language-model/v4/language-model-v4-usage.ts +1 -1
- package/src/language-model/v4/language-model-v4.ts +3 -3
- package/src/language-model-middleware/v2/language-model-v2-middleware.ts +2 -2
- package/src/language-model-middleware/v3/language-model-v3-middleware.ts +4 -4
- package/src/language-model-middleware/v4/language-model-v4-middleware.ts +4 -4
- package/src/provider/v2/provider-v2.ts +5 -5
- package/src/provider/v3/provider-v3.ts +6 -6
- package/src/provider/v4/provider-v4.ts +8 -8
- package/src/reranking-model/v3/reranking-model-v3-call-options.ts +2 -2
- package/src/reranking-model/v3/reranking-model-v3.ts +2 -2
- package/src/reranking-model/v4/index.ts +1 -0
- package/src/reranking-model/v4/reranking-model-v4-call-options.ts +2 -2
- package/src/reranking-model/v4/reranking-model-v4-result.ts +68 -0
- package/src/reranking-model/v4/reranking-model-v4.ts +5 -65
- package/src/shared/v2/shared-v2-provider-metadata.ts +1 -1
- package/src/shared/v2/shared-v2-provider-options.ts +1 -1
- package/src/shared/v3/shared-v3-provider-metadata.ts +1 -1
- package/src/shared/v3/shared-v3-provider-options.ts +1 -1
- package/src/shared/v4/index.ts +1 -0
- package/src/shared/v4/shared-v4-file-data.ts +49 -0
- package/src/shared/v4/shared-v4-provider-metadata.ts +1 -1
- package/src/shared/v4/shared-v4-provider-options.ts +1 -1
- package/src/shared/v4/shared-v4-provider-reference.ts +8 -1
- package/src/skills/v4/index.ts +4 -4
- package/src/skills/v4/skills-v4-upload-skill-call-options.ts +37 -0
- package/src/skills/v4/skills-v4-upload-skill-result.ts +40 -0
- package/src/skills/v4/skills-v4.ts +5 -71
- package/src/speech-model/v2/speech-model-v2-call-options.ts +1 -1
- package/src/speech-model/v2/speech-model-v2-call-warning.ts +1 -1
- package/src/speech-model/v2/speech-model-v2.ts +4 -4
- package/src/speech-model/v3/speech-model-v3-call-options.ts +1 -1
- package/src/speech-model/v3/speech-model-v3.ts +4 -4
- package/src/speech-model/v4/index.ts +1 -0
- package/src/speech-model/v4/speech-model-v4-call-options.ts +1 -1
- package/src/speech-model/v4/speech-model-v4-result.ts +64 -0
- package/src/speech-model/v4/speech-model-v4.ts +5 -61
- package/src/transcription-model/v2/transcription-model-v2-call-options.ts +1 -1
- package/src/transcription-model/v2/transcription-model-v2-call-warning.ts +1 -1
- package/src/transcription-model/v2/transcription-model-v2.ts +4 -4
- package/src/transcription-model/v3/transcription-model-v3-call-options.ts +1 -1
- package/src/transcription-model/v3/transcription-model-v3.ts +4 -4
- package/src/transcription-model/v4/index.ts +1 -0
- package/src/transcription-model/v4/transcription-model-v4-call-options.ts +1 -1
- package/src/transcription-model/v4/transcription-model-v4-result.ts +92 -0
- package/src/transcription-model/v4/transcription-model-v4.ts +5 -89
- package/src/video-model/v3/video-model-v3-call-options.ts +2 -2
- package/src/video-model/v3/video-model-v3-file.ts +1 -1
- package/src/video-model/v4/index.ts +4 -3
- package/src/video-model/v4/video-model-v4-call-options.ts +2 -2
- package/src/video-model/v4/video-model-v4-file.ts +1 -1
- package/src/video-model/v4/video-model-v4-result.ts +92 -0
- package/src/video-model/v4/video-model-v4.ts +2 -88
- package/dist/index.d.mts +0 -6590
- package/dist/index.mjs +0 -426
- package/dist/index.mjs.map +0 -1
- package/src/language-model/v4/language-model-v4-data-content.ts +0 -4
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { SharedV4ProviderReference } from './shared-v4-provider-reference';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* File data variant containing raw bytes (`Uint8Array`) or a base64-encoded
|
|
5
|
+
* string.
|
|
6
|
+
*/
|
|
7
|
+
export interface SharedV4FileDataData {
|
|
8
|
+
type: 'data';
|
|
9
|
+
data: Uint8Array | string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* File data variant containing a URL that points to the file.
|
|
14
|
+
*/
|
|
15
|
+
export interface SharedV4FileDataUrl {
|
|
16
|
+
type: 'url';
|
|
17
|
+
url: URL;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* File data variant containing a provider reference (`{ [provider]: id }`).
|
|
22
|
+
*/
|
|
23
|
+
export interface SharedV4FileDataReference {
|
|
24
|
+
type: 'reference';
|
|
25
|
+
reference: SharedV4ProviderReference;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* File data variant containing inline text content (e.g. an inline text
|
|
30
|
+
* document).
|
|
31
|
+
*/
|
|
32
|
+
export interface SharedV4FileDataText {
|
|
33
|
+
type: 'text';
|
|
34
|
+
text: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* File data as a tagged discriminated union:
|
|
39
|
+
*
|
|
40
|
+
* - `{ type: 'data', data }`: raw bytes (`Uint8Array`) or base64-encoded string.
|
|
41
|
+
* - `{ type: 'url', url }`: a URL that points to the file.
|
|
42
|
+
* - `{ type: 'reference', reference }`: a provider reference (`{ [provider]: id }`).
|
|
43
|
+
* - `{ type: 'text', text }`: inline text content (e.g. an inline text document).
|
|
44
|
+
*/
|
|
45
|
+
export type SharedV4FileData =
|
|
46
|
+
| SharedV4FileDataData
|
|
47
|
+
| SharedV4FileDataUrl
|
|
48
|
+
| SharedV4FileDataReference
|
|
49
|
+
| SharedV4FileDataText;
|
|
@@ -11,5 +11,12 @@
|
|
|
11
11
|
* "anthropic": "file-xyz789"
|
|
12
12
|
* }
|
|
13
13
|
* ```
|
|
14
|
+
*
|
|
15
|
+
* The `type?: never` constraint excludes any object that has a `type`
|
|
16
|
+
* property, so a `SharedV4ProviderReference` cannot be confused with a
|
|
17
|
+
* tagged file-data shape (e.g. `{ type: 'data', data }` or
|
|
18
|
+
* `{ type: 'reference', reference }`) when both appear in the same union.
|
|
14
19
|
*/
|
|
15
|
-
export type SharedV4ProviderReference = Record<string, string
|
|
20
|
+
export type SharedV4ProviderReference = Record<string, string> & {
|
|
21
|
+
type?: never;
|
|
22
|
+
};
|
package/src/skills/v4/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
export type { SkillsV4 } from './skills-v4';
|
|
1
2
|
export type {
|
|
2
|
-
SkillsV4,
|
|
3
3
|
SkillsV4File,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from './skills-v4';
|
|
4
|
+
SkillsV4UploadSkillCallOptions,
|
|
5
|
+
} from './skills-v4-upload-skill-call-options';
|
|
6
|
+
export type { SkillsV4UploadSkillResult } from './skills-v4-upload-skill-result';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SharedV4FileDataData,
|
|
3
|
+
SharedV4FileDataText,
|
|
4
|
+
} from '../../shared/v4/shared-v4-file-data';
|
|
5
|
+
import type { SharedV4ProviderOptions } from '../../shared/v4/shared-v4-provider-options';
|
|
6
|
+
|
|
7
|
+
export interface SkillsV4File {
|
|
8
|
+
/**
|
|
9
|
+
* The path of the file relative to the skill root.
|
|
10
|
+
*/
|
|
11
|
+
path: string;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The file data.
|
|
15
|
+
*
|
|
16
|
+
* - `{ type: 'data', data }`: raw bytes (`Uint8Array`) or a base64-encoded string.
|
|
17
|
+
* - `{ type: 'text', text }`: inline text (UTF-8).
|
|
18
|
+
*/
|
|
19
|
+
data: SharedV4FileDataData | SharedV4FileDataText;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface SkillsV4UploadSkillCallOptions {
|
|
23
|
+
/**
|
|
24
|
+
* The files that make up the skill.
|
|
25
|
+
*/
|
|
26
|
+
files: SkillsV4File[];
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Optional human-readable title for the skill.
|
|
30
|
+
*/
|
|
31
|
+
displayTitle?: string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Additional provider-specific options.
|
|
35
|
+
*/
|
|
36
|
+
providerOptions?: SharedV4ProviderOptions;
|
|
37
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { SharedV4ProviderMetadata } from '../../shared/v4/shared-v4-provider-metadata';
|
|
2
|
+
import type { SharedV4ProviderReference } from '../../shared/v4/shared-v4-provider-reference';
|
|
3
|
+
import type { SharedV4Warning } from '../../shared/v4/shared-v4-warning';
|
|
4
|
+
|
|
5
|
+
export interface SkillsV4UploadSkillResult {
|
|
6
|
+
/**
|
|
7
|
+
* A provider reference mapping provider names to provider-specific skill identifiers.
|
|
8
|
+
*/
|
|
9
|
+
providerReference: SharedV4ProviderReference;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Optional human-readable title for the uploaded skill.
|
|
13
|
+
*/
|
|
14
|
+
displayTitle?: string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Optional name of the uploaded skill.
|
|
18
|
+
*/
|
|
19
|
+
name?: string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Optional description of what the uploaded skill does.
|
|
23
|
+
*/
|
|
24
|
+
description?: string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Optional latest version identifier of the uploaded skill.
|
|
28
|
+
*/
|
|
29
|
+
latestVersion?: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Additional provider-specific metadata.
|
|
33
|
+
*/
|
|
34
|
+
providerMetadata?: SharedV4ProviderMetadata;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Warnings for the call, e.g. unsupported settings.
|
|
38
|
+
*/
|
|
39
|
+
warnings: SharedV4Warning[];
|
|
40
|
+
}
|
|
@@ -1,73 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { SharedV4ProviderReference } from '../../shared/v4/shared-v4-provider-reference';
|
|
4
|
-
import { SharedV4Warning } from '../../shared/v4/shared-v4-warning';
|
|
5
|
-
|
|
6
|
-
export interface SkillsV4File {
|
|
7
|
-
/**
|
|
8
|
-
* The path of the file relative to the skill root.
|
|
9
|
-
*/
|
|
10
|
-
path: string;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* The content of the file, either as a base64 string or binary data.
|
|
14
|
-
*/
|
|
15
|
-
content: string | Uint8Array;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface SkillsV4UploadParams {
|
|
19
|
-
/**
|
|
20
|
-
* The files that make up the skill.
|
|
21
|
-
*/
|
|
22
|
-
files: SkillsV4File[];
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Optional human-readable title for the skill.
|
|
26
|
-
*/
|
|
27
|
-
displayTitle?: string;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Additional provider-specific options.
|
|
31
|
-
*/
|
|
32
|
-
providerOptions?: SharedV4ProviderOptions;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface SkillsV4UploadResult {
|
|
36
|
-
/**
|
|
37
|
-
* A provider reference mapping provider names to provider-specific skill identifiers.
|
|
38
|
-
*/
|
|
39
|
-
providerReference: SharedV4ProviderReference;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Optional human-readable title for the uploaded skill.
|
|
43
|
-
*/
|
|
44
|
-
displayTitle?: string;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Optional name of the uploaded skill.
|
|
48
|
-
*/
|
|
49
|
-
name?: string;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Optional description of what the uploaded skill does.
|
|
53
|
-
*/
|
|
54
|
-
description?: string;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Optional latest version identifier of the uploaded skill.
|
|
58
|
-
*/
|
|
59
|
-
latestVersion?: string;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Additional provider-specific metadata.
|
|
63
|
-
*/
|
|
64
|
-
providerMetadata?: SharedV4ProviderMetadata;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Warnings for the call, e.g. unsupported settings.
|
|
68
|
-
*/
|
|
69
|
-
warnings: SharedV4Warning[];
|
|
70
|
-
}
|
|
1
|
+
import type { SkillsV4UploadSkillCallOptions } from './skills-v4-upload-skill-call-options';
|
|
2
|
+
import type { SkillsV4UploadSkillResult } from './skills-v4-upload-skill-result';
|
|
71
3
|
|
|
72
4
|
/**
|
|
73
5
|
* Skills specification version 4.
|
|
@@ -90,5 +22,7 @@ export interface SkillsV4 {
|
|
|
90
22
|
/**
|
|
91
23
|
* Uploads a new skill from the given files.
|
|
92
24
|
*/
|
|
93
|
-
uploadSkill(
|
|
25
|
+
uploadSkill(
|
|
26
|
+
params: SkillsV4UploadSkillCallOptions,
|
|
27
|
+
): PromiseLike<SkillsV4UploadSkillResult>;
|
|
94
28
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { JSONValue } from '../../json-value';
|
|
2
|
-
import { SharedV2Headers } from '../../shared';
|
|
3
|
-
import { SpeechModelV2CallOptions } from './speech-model-v2-call-options';
|
|
4
|
-
import { SpeechModelV2CallWarning } from './speech-model-v2-call-warning';
|
|
1
|
+
import type { JSONValue } from '../../json-value';
|
|
2
|
+
import type { SharedV2Headers } from '../../shared';
|
|
3
|
+
import type { SpeechModelV2CallOptions } from './speech-model-v2-call-options';
|
|
4
|
+
import type { SpeechModelV2CallWarning } from './speech-model-v2-call-warning';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Speech model specification version 2.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { JSONObject } from '../../json-value';
|
|
2
|
-
import { SharedV2Headers } from '../../shared';
|
|
3
|
-
import { SharedV3Warning } from '../../shared/v3/shared-v3-warning';
|
|
4
|
-
import { SpeechModelV3CallOptions } from './speech-model-v3-call-options';
|
|
1
|
+
import type { JSONObject } from '../../json-value';
|
|
2
|
+
import type { SharedV2Headers } from '../../shared';
|
|
3
|
+
import type { SharedV3Warning } from '../../shared/v3/shared-v3-warning';
|
|
4
|
+
import type { SpeechModelV3CallOptions } from './speech-model-v3-call-options';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Speech model specification version 3.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { JSONObject } from '../../json-value';
|
|
2
|
+
import type { SharedV2Headers } from '../../shared';
|
|
3
|
+
import type { SharedV4Warning } from '../../shared/v4/shared-v4-warning';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The result of a speech model doGenerate call.
|
|
7
|
+
*/
|
|
8
|
+
export type SpeechModelV4Result = {
|
|
9
|
+
/**
|
|
10
|
+
* Generated audio as an ArrayBuffer.
|
|
11
|
+
* The audio should be returned without any unnecessary conversion.
|
|
12
|
+
* If the API returns base64 encoded strings, the audio should be returned
|
|
13
|
+
* as base64 encoded strings. If the API returns binary data, the audio
|
|
14
|
+
* should be returned as binary data.
|
|
15
|
+
*/
|
|
16
|
+
audio: string | Uint8Array;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Warnings for the call, e.g. unsupported settings.
|
|
20
|
+
*/
|
|
21
|
+
warnings: Array<SharedV4Warning>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Optional request information for telemetry and debugging purposes.
|
|
25
|
+
*/
|
|
26
|
+
request?: {
|
|
27
|
+
/**
|
|
28
|
+
* Response body (available only for providers that use HTTP requests).
|
|
29
|
+
*/
|
|
30
|
+
body?: unknown;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Response information for telemetry and debugging purposes.
|
|
35
|
+
*/
|
|
36
|
+
response: {
|
|
37
|
+
/**
|
|
38
|
+
* Timestamp for the start of the generated response.
|
|
39
|
+
*/
|
|
40
|
+
timestamp: Date;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The ID of the response model that was used to generate the response.
|
|
44
|
+
*/
|
|
45
|
+
modelId: string;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Response headers.
|
|
49
|
+
*/
|
|
50
|
+
headers?: SharedV2Headers;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Response body.
|
|
54
|
+
*/
|
|
55
|
+
body?: unknown;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Additional provider-specific metadata. They are passed through
|
|
60
|
+
* from the provider to the AI SDK and enable provider-specific
|
|
61
|
+
* results that can be fully encapsulated in the provider.
|
|
62
|
+
*/
|
|
63
|
+
providerMetadata?: Record<string, JSONObject>;
|
|
64
|
+
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { SharedV4Warning } from '../../shared/v4/shared-v4-warning';
|
|
4
|
-
import { SpeechModelV4CallOptions } from './speech-model-v4-call-options';
|
|
1
|
+
import type { SpeechModelV4CallOptions } from './speech-model-v4-call-options';
|
|
2
|
+
import type { SpeechModelV4Result } from './speech-model-v4-result';
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
* Speech model specification version 3.
|
|
@@ -29,61 +27,7 @@ export type SpeechModelV4 = {
|
|
|
29
27
|
/**
|
|
30
28
|
* Generates speech audio from text.
|
|
31
29
|
*/
|
|
32
|
-
doGenerate(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
* The audio should be returned without any unnecessary conversion.
|
|
36
|
-
* If the API returns base64 encoded strings, the audio should be returned
|
|
37
|
-
* as base64 encoded strings. If the API returns binary data, the audio
|
|
38
|
-
* should be returned as binary data.
|
|
39
|
-
*/
|
|
40
|
-
audio: string | Uint8Array;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Warnings for the call, e.g. unsupported settings.
|
|
44
|
-
*/
|
|
45
|
-
warnings: Array<SharedV4Warning>;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Optional request information for telemetry and debugging purposes.
|
|
49
|
-
*/
|
|
50
|
-
request?: {
|
|
51
|
-
/**
|
|
52
|
-
* Response body (available only for providers that use HTTP requests).
|
|
53
|
-
*/
|
|
54
|
-
body?: unknown;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Response information for telemetry and debugging purposes.
|
|
59
|
-
*/
|
|
60
|
-
response: {
|
|
61
|
-
/**
|
|
62
|
-
* Timestamp for the start of the generated response.
|
|
63
|
-
*/
|
|
64
|
-
timestamp: Date;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* The ID of the response model that was used to generate the response.
|
|
68
|
-
*/
|
|
69
|
-
modelId: string;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Response headers.
|
|
73
|
-
*/
|
|
74
|
-
headers?: SharedV2Headers;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Response body.
|
|
78
|
-
*/
|
|
79
|
-
body?: unknown;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Additional provider-specific metadata. They are passed through
|
|
84
|
-
* from the provider to the AI SDK and enable provider-specific
|
|
85
|
-
* results that can be fully encapsulated in the provider.
|
|
86
|
-
*/
|
|
87
|
-
providerMetadata?: Record<string, JSONObject>;
|
|
88
|
-
}>;
|
|
30
|
+
doGenerate(
|
|
31
|
+
options: SpeechModelV4CallOptions,
|
|
32
|
+
): PromiseLike<SpeechModelV4Result>;
|
|
89
33
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TranscriptionModelV2CallOptions } from './transcription-model-v2-call-options';
|
|
1
|
+
import type { TranscriptionModelV2CallOptions } from './transcription-model-v2-call-options';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Warning from the model provider for this call. The call will proceed, but e.g.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { JSONValue } from '../../json-value';
|
|
2
|
-
import { SharedV2Headers } from '../../shared';
|
|
3
|
-
import { TranscriptionModelV2CallOptions } from './transcription-model-v2-call-options';
|
|
4
|
-
import { TranscriptionModelV2CallWarning } from './transcription-model-v2-call-warning';
|
|
1
|
+
import type { JSONValue } from '../../json-value';
|
|
2
|
+
import type { SharedV2Headers } from '../../shared';
|
|
3
|
+
import type { TranscriptionModelV2CallOptions } from './transcription-model-v2-call-options';
|
|
4
|
+
import type { TranscriptionModelV2CallWarning } from './transcription-model-v2-call-warning';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Transcription model specification version 2.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { JSONObject } from '../../json-value';
|
|
2
|
-
import { SharedV3Headers } from '../../shared';
|
|
3
|
-
import { SharedV3Warning } from '../../shared/v3/shared-v3-warning';
|
|
4
|
-
import { TranscriptionModelV3CallOptions } from './transcription-model-v3-call-options';
|
|
1
|
+
import type { JSONObject } from '../../json-value';
|
|
2
|
+
import type { SharedV3Headers } from '../../shared';
|
|
3
|
+
import type { SharedV3Warning } from '../../shared/v3/shared-v3-warning';
|
|
4
|
+
import type { TranscriptionModelV3CallOptions } from './transcription-model-v3-call-options';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Transcription model specification version 3.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { JSONObject } from '../../json-value';
|
|
2
|
+
import type { SharedV4Headers } from '../../shared';
|
|
3
|
+
import type { SharedV4Warning } from '../../shared/v4/shared-v4-warning';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The result of a transcription model doGenerate call.
|
|
7
|
+
*/
|
|
8
|
+
export type TranscriptionModelV4Result = {
|
|
9
|
+
/**
|
|
10
|
+
* The complete transcribed text from the audio.
|
|
11
|
+
*/
|
|
12
|
+
text: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Array of transcript segments with timing information.
|
|
16
|
+
* Each segment represents a portion of the transcribed text with start and end times.
|
|
17
|
+
*/
|
|
18
|
+
segments: Array<{
|
|
19
|
+
/**
|
|
20
|
+
* The text content of this segment.
|
|
21
|
+
*/
|
|
22
|
+
text: string;
|
|
23
|
+
/**
|
|
24
|
+
* The start time of this segment in seconds.
|
|
25
|
+
*/
|
|
26
|
+
startSecond: number;
|
|
27
|
+
/**
|
|
28
|
+
* The end time of this segment in seconds.
|
|
29
|
+
*/
|
|
30
|
+
endSecond: number;
|
|
31
|
+
}>;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The detected language of the audio content, as an ISO-639-1 code (e.g., 'en' for English).
|
|
35
|
+
* May be undefined if the language couldn't be detected.
|
|
36
|
+
*/
|
|
37
|
+
language: string | undefined;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The total duration of the audio file in seconds.
|
|
41
|
+
* May be undefined if the duration couldn't be determined.
|
|
42
|
+
*/
|
|
43
|
+
durationInSeconds: number | undefined;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Warnings for the call, e.g. unsupported settings.
|
|
47
|
+
*/
|
|
48
|
+
warnings: Array<SharedV4Warning>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Optional request information for telemetry and debugging purposes.
|
|
52
|
+
*/
|
|
53
|
+
request?: {
|
|
54
|
+
/**
|
|
55
|
+
* Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
|
|
56
|
+
* Non-HTTP(s) providers should not set this.
|
|
57
|
+
*/
|
|
58
|
+
body?: string;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Response information for telemetry and debugging purposes.
|
|
63
|
+
*/
|
|
64
|
+
response: {
|
|
65
|
+
/**
|
|
66
|
+
* Timestamp for the start of the generated response.
|
|
67
|
+
*/
|
|
68
|
+
timestamp: Date;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The ID of the response model that was used to generate the response.
|
|
72
|
+
*/
|
|
73
|
+
modelId: string;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Response headers.
|
|
77
|
+
*/
|
|
78
|
+
headers?: SharedV4Headers;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Response body.
|
|
82
|
+
*/
|
|
83
|
+
body?: unknown;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Additional provider-specific metadata. They are passed through
|
|
88
|
+
* from the provider to the AI SDK and enable provider-specific
|
|
89
|
+
* results that can be fully encapsulated in the provider.
|
|
90
|
+
*/
|
|
91
|
+
providerMetadata?: Record<string, JSONObject>;
|
|
92
|
+
};
|