@ai-sdk/provider 3.0.5 → 3.0.6
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 +6 -0
- package/dist/index.d.mts +733 -715
- package/dist/index.d.ts +733 -715
- package/dist/index.js +32 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/embedding-model/v2/embedding-model-v2-embedding.ts +2 -2
- package/src/embedding-model/v2/embedding-model-v2.ts +39 -39
- package/src/embedding-model/v3/embedding-model-v3-call-options.ts +11 -11
- package/src/embedding-model/v3/embedding-model-v3-embedding.ts +2 -2
- package/src/embedding-model/v3/embedding-model-v3-result.ts +2 -2
- package/src/embedding-model/v3/embedding-model-v3.ts +19 -19
- package/src/errors/index.ts +1 -0
- package/src/errors/no-content-generated-error.ts +1 -1
- package/src/errors/type-validation-error.ts +63 -6
- package/src/image-model/v2/image-model-v2-call-options.ts +33 -33
- package/src/image-model/v2/image-model-v2-call-warning.ts +2 -2
- package/src/image-model/v2/image-model-v2.ts +42 -42
- package/src/image-model/v3/image-model-v3-usage.ts +4 -4
- package/src/image-model/v3/image-model-v3.ts +43 -43
- package/src/json-value/json-value.ts +2 -2
- package/src/language-model/v2/language-model-v2-call-options.ts +44 -44
- package/src/language-model/v2/language-model-v2-call-warning.ts +2 -2
- package/src/language-model/v2/language-model-v2-data-content.ts +2 -2
- package/src/language-model/v2/language-model-v2-file.ts +14 -14
- package/src/language-model/v2/language-model-v2-finish-reason.ts +10 -10
- package/src/language-model/v2/language-model-v2-function-tool.ts +11 -11
- package/src/language-model/v2/language-model-v2-prompt.ts +38 -38
- package/src/language-model/v2/language-model-v2-provider-defined-tool.ts +6 -6
- package/src/language-model/v2/language-model-v2-reasoning.ts +1 -1
- package/src/language-model/v2/language-model-v2-response-metadata.ts +6 -6
- package/src/language-model/v2/language-model-v2-source.ts +1 -1
- package/src/language-model/v2/language-model-v2-text.ts +2 -2
- package/src/language-model/v2/language-model-v2-tool-result.ts +1 -1
- package/src/language-model/v2/language-model-v2-usage.ts +11 -11
- package/src/language-model/v2/language-model-v2.ts +42 -42
- package/src/language-model/v3/language-model-v3-call-options.ts +44 -44
- package/src/language-model/v3/language-model-v3-data-content.ts +2 -2
- package/src/language-model/v3/language-model-v3-file.ts +14 -14
- package/src/language-model/v3/language-model-v3-function-tool.ts +11 -11
- package/src/language-model/v3/language-model-v3-prompt.ts +43 -43
- package/src/language-model/v3/language-model-v3-reasoning.ts +1 -1
- package/src/language-model/v3/language-model-v3-response-metadata.ts +6 -6
- package/src/language-model/v3/language-model-v3-source.ts +1 -1
- package/src/language-model/v3/language-model-v3-text.ts +2 -2
- package/src/language-model/v3/language-model-v3-tool-result.ts +1 -1
- package/src/language-model/v3/language-model-v3-usage.ts +1 -1
- package/src/provider/v2/provider-v2.ts +37 -37
- package/src/provider/v3/provider-v3.ts +55 -55
- package/src/transcription-model/v2/transcription-model-v2-call-options.ts +24 -24
- package/src/transcription-model/v2/transcription-model-v2-call-warning.ts +2 -2
- package/src/transcription-model/v2/transcription-model-v2.ts +25 -25
- package/src/transcription-model/v3/transcription-model-v3-call-options.ts +24 -24
- package/src/transcription-model/v3/transcription-model-v3.ts +25 -25
|
@@ -2,7 +2,7 @@ import { JSONValue } from '../../json-value';
|
|
|
2
2
|
import { SharedV3ProviderMetadata } from '../../shared/v3/shared-v3-provider-metadata';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
Result of a tool call that has been executed by the provider.
|
|
5
|
+
* Result of a tool call that has been executed by the provider.
|
|
6
6
|
*/
|
|
7
7
|
export type LanguageModelV3ToolResult = {
|
|
8
8
|
type: 'tool-result';
|
|
@@ -9,56 +9,56 @@ import { TranscriptionModelV2 } from '../../transcription-model/v2/transcription
|
|
|
9
9
|
*/
|
|
10
10
|
export interface ProviderV2 {
|
|
11
11
|
/**
|
|
12
|
-
Returns the language model with the given id.
|
|
13
|
-
The model id is then passed to the provider function to get the model.
|
|
14
|
-
|
|
15
|
-
@param {string} modelId - The id of the model to return.
|
|
16
|
-
|
|
17
|
-
@returns {LanguageModel} The language model associated with the id
|
|
18
|
-
|
|
19
|
-
@throws {NoSuchModelError} If no such model exists.
|
|
12
|
+
* Returns the language model with the given id.
|
|
13
|
+
* The model id is then passed to the provider function to get the model.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} modelId - The id of the model to return.
|
|
16
|
+
*
|
|
17
|
+
* @returns {LanguageModel} The language model associated with the id
|
|
18
|
+
*
|
|
19
|
+
* @throws {NoSuchModelError} If no such model exists.
|
|
20
20
|
*/
|
|
21
21
|
languageModel(modelId: string): LanguageModelV2;
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
Returns the text embedding model with the given id.
|
|
25
|
-
The model id is then passed to the provider function to get the model.
|
|
26
|
-
|
|
27
|
-
@param {string} modelId - The id of the model to return.
|
|
28
|
-
|
|
29
|
-
@returns {LanguageModel} The language model associated with the id
|
|
30
|
-
|
|
31
|
-
@throws {NoSuchModelError} If no such model exists.
|
|
24
|
+
* Returns the text embedding model with the given id.
|
|
25
|
+
* The model id is then passed to the provider function to get the model.
|
|
26
|
+
*
|
|
27
|
+
* @param {string} modelId - The id of the model to return.
|
|
28
|
+
*
|
|
29
|
+
* @returns {LanguageModel} The language model associated with the id
|
|
30
|
+
*
|
|
31
|
+
* @throws {NoSuchModelError} If no such model exists.
|
|
32
32
|
*/
|
|
33
33
|
textEmbeddingModel(modelId: string): EmbeddingModelV2<string>;
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
Returns the image model with the given id.
|
|
37
|
-
The model id is then passed to the provider function to get the model.
|
|
38
|
-
|
|
39
|
-
@param {string} modelId - The id of the model to return.
|
|
40
|
-
|
|
41
|
-
@returns {ImageModel} The image model associated with the id
|
|
42
|
-
*/
|
|
36
|
+
* Returns the image model with the given id.
|
|
37
|
+
* The model id is then passed to the provider function to get the model.
|
|
38
|
+
*
|
|
39
|
+
* @param {string} modelId - The id of the model to return.
|
|
40
|
+
*
|
|
41
|
+
* @returns {ImageModel} The image model associated with the id
|
|
42
|
+
*/
|
|
43
43
|
imageModel(modelId: string): ImageModelV2;
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
Returns the transcription model with the given id.
|
|
47
|
-
The model id is then passed to the provider function to get the model.
|
|
48
|
-
|
|
49
|
-
@param {string} modelId - The id of the model to return.
|
|
50
|
-
|
|
51
|
-
@returns {TranscriptionModel} The transcription model associated with the id
|
|
52
|
-
|
|
46
|
+
* Returns the transcription model with the given id.
|
|
47
|
+
* The model id is then passed to the provider function to get the model.
|
|
48
|
+
*
|
|
49
|
+
* @param {string} modelId - The id of the model to return.
|
|
50
|
+
*
|
|
51
|
+
* @returns {TranscriptionModel} The transcription model associated with the id
|
|
52
|
+
*/
|
|
53
53
|
transcriptionModel?(modelId: string): TranscriptionModelV2;
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
|
-
Returns the speech model with the given id.
|
|
57
|
-
The model id is then passed to the provider function to get the model.
|
|
58
|
-
|
|
59
|
-
@param {string} modelId - The id of the model to return.
|
|
60
|
-
|
|
61
|
-
@returns {SpeechModel} The speech model associated with the id
|
|
62
|
-
|
|
56
|
+
* Returns the speech model with the given id.
|
|
57
|
+
* The model id is then passed to the provider function to get the model.
|
|
58
|
+
*
|
|
59
|
+
* @param {string} modelId - The id of the model to return.
|
|
60
|
+
*
|
|
61
|
+
* @returns {SpeechModel} The speech model associated with the id
|
|
62
|
+
*/
|
|
63
63
|
speechModel?(modelId: string): SpeechModelV2;
|
|
64
64
|
}
|
|
@@ -12,82 +12,82 @@ export interface ProviderV3 {
|
|
|
12
12
|
readonly specificationVersion: 'v3';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
Returns the language model with the given id.
|
|
16
|
-
The model id is then passed to the provider function to get the model.
|
|
17
|
-
|
|
18
|
-
@param {string} modelId - The id of the model to return.
|
|
19
|
-
|
|
20
|
-
@returns {LanguageModel} The language model associated with the id
|
|
21
|
-
|
|
22
|
-
@throws {NoSuchModelError} If no such model exists.
|
|
15
|
+
* Returns the language model with the given id.
|
|
16
|
+
* The model id is then passed to the provider function to get the model.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} modelId - The id of the model to return.
|
|
19
|
+
*
|
|
20
|
+
* @returns {LanguageModel} The language model associated with the id
|
|
21
|
+
*
|
|
22
|
+
* @throws {NoSuchModelError} If no such model exists.
|
|
23
23
|
*/
|
|
24
24
|
languageModel(modelId: string): LanguageModelV3;
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
Returns the text embedding model with the given id.
|
|
28
|
-
The model id is then passed to the provider function to get the model.
|
|
29
|
-
|
|
30
|
-
@param {string} modelId - The id of the model to return.
|
|
31
|
-
|
|
32
|
-
@returns {LanguageModel} The language model associated with the id
|
|
33
|
-
|
|
34
|
-
@throws {NoSuchModelError} If no such model exists.
|
|
27
|
+
* Returns the text embedding model with the given id.
|
|
28
|
+
* The model id is then passed to the provider function to get the model.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} modelId - The id of the model to return.
|
|
31
|
+
*
|
|
32
|
+
* @returns {LanguageModel} The language model associated with the id
|
|
33
|
+
*
|
|
34
|
+
* @throws {NoSuchModelError} If no such model exists.
|
|
35
35
|
*/
|
|
36
36
|
embeddingModel(modelId: string): EmbeddingModelV3;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
Returns the text embedding model with the given id.
|
|
40
|
-
The model id is then passed to the provider function to get the model.
|
|
41
|
-
|
|
42
|
-
@param {string} modelId - The id of the model to return.
|
|
43
|
-
|
|
44
|
-
@returns {EmbeddingModel} The embedding model associated with the id
|
|
45
|
-
|
|
46
|
-
@throws {NoSuchModelError} If no such model exists.
|
|
47
|
-
|
|
48
|
-
@deprecated Use `embeddingModel` instead.
|
|
39
|
+
* Returns the text embedding model with the given id.
|
|
40
|
+
* The model id is then passed to the provider function to get the model.
|
|
41
|
+
*
|
|
42
|
+
* @param {string} modelId - The id of the model to return.
|
|
43
|
+
*
|
|
44
|
+
* @returns {EmbeddingModel} The embedding model associated with the id
|
|
45
|
+
*
|
|
46
|
+
* @throws {NoSuchModelError} If no such model exists.
|
|
47
|
+
*
|
|
48
|
+
* @deprecated Use `embeddingModel` instead.
|
|
49
49
|
*/
|
|
50
50
|
textEmbeddingModel?(modelId: string): EmbeddingModelV3;
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
|
-
Returns the image model with the given id.
|
|
54
|
-
The model id is then passed to the provider function to get the model.
|
|
55
|
-
|
|
56
|
-
@param {string} modelId - The id of the model to return.
|
|
57
|
-
|
|
58
|
-
@returns {ImageModel} The image model associated with the id
|
|
59
|
-
*/
|
|
53
|
+
* Returns the image model with the given id.
|
|
54
|
+
* The model id is then passed to the provider function to get the model.
|
|
55
|
+
*
|
|
56
|
+
* @param {string} modelId - The id of the model to return.
|
|
57
|
+
*
|
|
58
|
+
* @returns {ImageModel} The image model associated with the id
|
|
59
|
+
*/
|
|
60
60
|
imageModel(modelId: string): ImageModelV3;
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
Returns the transcription model with the given id.
|
|
64
|
-
The model id is then passed to the provider function to get the model.
|
|
65
|
-
|
|
66
|
-
@param {string} modelId - The id of the model to return.
|
|
67
|
-
|
|
68
|
-
@returns {TranscriptionModel} The transcription model associated with the id
|
|
69
|
-
|
|
63
|
+
* Returns the transcription model with the given id.
|
|
64
|
+
* The model id is then passed to the provider function to get the model.
|
|
65
|
+
*
|
|
66
|
+
* @param {string} modelId - The id of the model to return.
|
|
67
|
+
*
|
|
68
|
+
* @returns {TranscriptionModel} The transcription model associated with the id
|
|
69
|
+
*/
|
|
70
70
|
transcriptionModel?(modelId: string): TranscriptionModelV3;
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
|
-
Returns the speech model with the given id.
|
|
74
|
-
The model id is then passed to the provider function to get the model.
|
|
75
|
-
|
|
76
|
-
@param {string} modelId - The id of the model to return.
|
|
77
|
-
|
|
78
|
-
@returns {SpeechModel} The speech model associated with the id
|
|
79
|
-
|
|
73
|
+
* Returns the speech model with the given id.
|
|
74
|
+
* The model id is then passed to the provider function to get the model.
|
|
75
|
+
*
|
|
76
|
+
* @param {string} modelId - The id of the model to return.
|
|
77
|
+
*
|
|
78
|
+
* @returns {SpeechModel} The speech model associated with the id
|
|
79
|
+
*/
|
|
80
80
|
speechModel?(modelId: string): SpeechModelV3;
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
|
-
Returns the reranking model with the given id.
|
|
84
|
-
The model id is then passed to the provider function to get the model.
|
|
85
|
-
|
|
86
|
-
@param {string} modelId - The id of the model to return.
|
|
87
|
-
|
|
88
|
-
@returns {RerankingModel} The reranking model associated with the id
|
|
89
|
-
|
|
90
|
-
@throws {NoSuchModelError} If no such model exists.
|
|
83
|
+
* Returns the reranking model with the given id.
|
|
84
|
+
* The model id is then passed to the provider function to get the model.
|
|
85
|
+
*
|
|
86
|
+
* @param {string} modelId - The id of the model to return.
|
|
87
|
+
*
|
|
88
|
+
* @returns {RerankingModel} The reranking model associated with the id
|
|
89
|
+
*
|
|
90
|
+
* @throws {NoSuchModelError} If no such model exists.
|
|
91
91
|
*/
|
|
92
92
|
rerankingModel?(modelId: string): RerankingModelV3;
|
|
93
93
|
}
|
|
@@ -7,42 +7,42 @@ type TranscriptionModelV2ProviderOptions = Record<
|
|
|
7
7
|
|
|
8
8
|
export type TranscriptionModelV2CallOptions = {
|
|
9
9
|
/**
|
|
10
|
-
Audio data to transcribe.
|
|
11
|
-
Accepts a `Uint8Array` or `string`, where `string` is a base64 encoded audio file.
|
|
12
|
-
|
|
10
|
+
* Audio data to transcribe.
|
|
11
|
+
* Accepts a `Uint8Array` or `string`, where `string` is a base64 encoded audio file.
|
|
12
|
+
*/
|
|
13
13
|
audio: Uint8Array | string;
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
The IANA media type of the audio data.
|
|
17
|
-
|
|
18
|
-
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
16
|
+
* The IANA media type of the audio data.
|
|
17
|
+
*
|
|
18
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
19
19
|
*/
|
|
20
20
|
mediaType: string;
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
Additional provider-specific options that are passed through to the provider
|
|
24
|
-
as body parameters.
|
|
25
|
-
|
|
26
|
-
The outer record is keyed by the provider name, and the inner
|
|
27
|
-
record is keyed by the provider-specific metadata key.
|
|
28
|
-
```ts
|
|
29
|
-
{
|
|
30
|
-
"openai": {
|
|
31
|
-
"timestampGranularities": ["word"]
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
```
|
|
35
|
-
|
|
23
|
+
* Additional provider-specific options that are passed through to the provider
|
|
24
|
+
* as body parameters.
|
|
25
|
+
*
|
|
26
|
+
* The outer record is keyed by the provider name, and the inner
|
|
27
|
+
* record is keyed by the provider-specific metadata key.
|
|
28
|
+
* ```ts
|
|
29
|
+
* {
|
|
30
|
+
* "openai": {
|
|
31
|
+
* "timestampGranularities": ["word"]
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
36
|
providerOptions?: TranscriptionModelV2ProviderOptions;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
Abort signal for cancelling the operation.
|
|
40
|
-
|
|
39
|
+
* Abort signal for cancelling the operation.
|
|
40
|
+
*/
|
|
41
41
|
abortSignal?: AbortSignal;
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
Additional HTTP headers to be sent with the request.
|
|
45
|
-
Only applicable for HTTP-based providers.
|
|
46
|
-
|
|
44
|
+
* Additional HTTP headers to be sent with the request.
|
|
45
|
+
* Only applicable for HTTP-based providers.
|
|
46
|
+
*/
|
|
47
47
|
headers?: Record<string, string | undefined>;
|
|
48
48
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TranscriptionModelV2CallOptions } from './transcription-model-v2-call-options';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
Warning from the model provider for this call. The call will proceed, but e.g.
|
|
5
|
-
some settings might not be supported, which can lead to suboptimal results.
|
|
4
|
+
* Warning from the model provider for this call. The call will proceed, but e.g.
|
|
5
|
+
* some settings might not be supported, which can lead to suboptimal results.
|
|
6
6
|
*/
|
|
7
7
|
export type TranscriptionModelV2CallWarning =
|
|
8
8
|
| {
|
|
@@ -4,30 +4,30 @@ import { TranscriptionModelV2CallOptions } from './transcription-model-v2-call-o
|
|
|
4
4
|
import { TranscriptionModelV2CallWarning } from './transcription-model-v2-call-warning';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
Transcription model specification version 2.
|
|
7
|
+
* Transcription model specification version 2.
|
|
8
8
|
*/
|
|
9
9
|
export type TranscriptionModelV2 = {
|
|
10
10
|
/**
|
|
11
|
-
The transcription model must specify which transcription model interface
|
|
12
|
-
version it implements. This will allow us to evolve the transcription
|
|
13
|
-
model interface and retain backwards compatibility. The different
|
|
14
|
-
implementation versions can be handled as a discriminated union
|
|
15
|
-
on our side.
|
|
11
|
+
* The transcription model must specify which transcription model interface
|
|
12
|
+
* version it implements. This will allow us to evolve the transcription
|
|
13
|
+
* model interface and retain backwards compatibility. The different
|
|
14
|
+
* implementation versions can be handled as a discriminated union
|
|
15
|
+
* on our side.
|
|
16
16
|
*/
|
|
17
17
|
readonly specificationVersion: 'v2';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
Name of the provider for logging purposes.
|
|
20
|
+
* Name of the provider for logging purposes.
|
|
21
21
|
*/
|
|
22
22
|
readonly provider: string;
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
Provider-specific model ID for logging purposes.
|
|
25
|
+
* Provider-specific model ID for logging purposes.
|
|
26
26
|
*/
|
|
27
27
|
readonly modelId: string;
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
Generates a transcript.
|
|
30
|
+
* Generates a transcript.
|
|
31
31
|
*/
|
|
32
32
|
doGenerate(options: TranscriptionModelV2CallOptions): PromiseLike<{
|
|
33
33
|
/**
|
|
@@ -67,50 +67,50 @@ Generates a transcript.
|
|
|
67
67
|
durationInSeconds: number | undefined;
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
|
-
Warnings for the call, e.g. unsupported settings.
|
|
70
|
+
* Warnings for the call, e.g. unsupported settings.
|
|
71
71
|
*/
|
|
72
72
|
warnings: Array<TranscriptionModelV2CallWarning>;
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
|
-
Optional request information for telemetry and debugging purposes.
|
|
75
|
+
* Optional request information for telemetry and debugging purposes.
|
|
76
76
|
*/
|
|
77
77
|
request?: {
|
|
78
78
|
/**
|
|
79
|
-
Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
|
|
80
|
-
Non-HTTP(s) providers should not set this.
|
|
79
|
+
* Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
|
|
80
|
+
* Non-HTTP(s) providers should not set this.
|
|
81
81
|
*/
|
|
82
82
|
body?: string;
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
Response information for telemetry and debugging purposes.
|
|
86
|
+
* Response information for telemetry and debugging purposes.
|
|
87
87
|
*/
|
|
88
88
|
response: {
|
|
89
89
|
/**
|
|
90
|
-
Timestamp for the start of the generated response.
|
|
91
|
-
|
|
90
|
+
* Timestamp for the start of the generated response.
|
|
91
|
+
*/
|
|
92
92
|
timestamp: Date;
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
|
-
The ID of the response model that was used to generate the response.
|
|
96
|
-
|
|
95
|
+
* The ID of the response model that was used to generate the response.
|
|
96
|
+
*/
|
|
97
97
|
modelId: string;
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
|
-
Response headers.
|
|
101
|
-
|
|
100
|
+
* Response headers.
|
|
101
|
+
*/
|
|
102
102
|
headers?: SharedV2Headers;
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
|
-
Response body.
|
|
106
|
-
|
|
105
|
+
* Response body.
|
|
106
|
+
*/
|
|
107
107
|
body?: unknown;
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
|
-
Additional provider-specific metadata. They are passed through
|
|
112
|
-
from the provider to the AI SDK and enable provider-specific
|
|
113
|
-
results that can be fully encapsulated in the provider.
|
|
111
|
+
* Additional provider-specific metadata. They are passed through
|
|
112
|
+
* from the provider to the AI SDK and enable provider-specific
|
|
113
|
+
* results that can be fully encapsulated in the provider.
|
|
114
114
|
*/
|
|
115
115
|
providerMetadata?: Record<string, Record<string, JSONValue>>;
|
|
116
116
|
}>;
|
|
@@ -4,42 +4,42 @@ type TranscriptionModelV3ProviderOptions = Record<string, JSONObject>;
|
|
|
4
4
|
|
|
5
5
|
export type TranscriptionModelV3CallOptions = {
|
|
6
6
|
/**
|
|
7
|
-
Audio data to transcribe.
|
|
8
|
-
Accepts a `Uint8Array` or `string`, where `string` is a base64 encoded audio file.
|
|
9
|
-
|
|
7
|
+
* Audio data to transcribe.
|
|
8
|
+
* Accepts a `Uint8Array` or `string`, where `string` is a base64 encoded audio file.
|
|
9
|
+
*/
|
|
10
10
|
audio: Uint8Array | string;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
The IANA media type of the audio data.
|
|
14
|
-
|
|
15
|
-
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
13
|
+
* The IANA media type of the audio data.
|
|
14
|
+
*
|
|
15
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
16
16
|
*/
|
|
17
17
|
mediaType: string;
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
Additional provider-specific options that are passed through to the provider
|
|
21
|
-
as body parameters.
|
|
22
|
-
|
|
23
|
-
The outer record is keyed by the provider name, and the inner
|
|
24
|
-
record is keyed by the provider-specific metadata key.
|
|
25
|
-
```ts
|
|
26
|
-
{
|
|
27
|
-
"openai": {
|
|
28
|
-
"timestampGranularities": ["word"]
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
```
|
|
32
|
-
|
|
20
|
+
* Additional provider-specific options that are passed through to the provider
|
|
21
|
+
* as body parameters.
|
|
22
|
+
*
|
|
23
|
+
* The outer record is keyed by the provider name, and the inner
|
|
24
|
+
* record is keyed by the provider-specific metadata key.
|
|
25
|
+
* ```ts
|
|
26
|
+
* {
|
|
27
|
+
* "openai": {
|
|
28
|
+
* "timestampGranularities": ["word"]
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
33
|
providerOptions?: TranscriptionModelV3ProviderOptions;
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
Abort signal for cancelling the operation.
|
|
37
|
-
|
|
36
|
+
* Abort signal for cancelling the operation.
|
|
37
|
+
*/
|
|
38
38
|
abortSignal?: AbortSignal;
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
Additional HTTP headers to be sent with the request.
|
|
42
|
-
Only applicable for HTTP-based providers.
|
|
43
|
-
|
|
41
|
+
* Additional HTTP headers to be sent with the request.
|
|
42
|
+
* Only applicable for HTTP-based providers.
|
|
43
|
+
*/
|
|
44
44
|
headers?: Record<string, string | undefined>;
|
|
45
45
|
};
|
|
@@ -4,30 +4,30 @@ import { SharedV3Warning } from '../../shared/v3/shared-v3-warning';
|
|
|
4
4
|
import { TranscriptionModelV3CallOptions } from './transcription-model-v3-call-options';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
Transcription model specification version 3.
|
|
7
|
+
* Transcription model specification version 3.
|
|
8
8
|
*/
|
|
9
9
|
export type TranscriptionModelV3 = {
|
|
10
10
|
/**
|
|
11
|
-
The transcription model must specify which transcription model interface
|
|
12
|
-
version it implements. This will allow us to evolve the transcription
|
|
13
|
-
model interface and retain backwards compatibility. The different
|
|
14
|
-
implementation versions can be handled as a discriminated union
|
|
15
|
-
on our side.
|
|
11
|
+
* The transcription model must specify which transcription model interface
|
|
12
|
+
* version it implements. This will allow us to evolve the transcription
|
|
13
|
+
* model interface and retain backwards compatibility. The different
|
|
14
|
+
* implementation versions can be handled as a discriminated union
|
|
15
|
+
* on our side.
|
|
16
16
|
*/
|
|
17
17
|
readonly specificationVersion: 'v3';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
Name of the provider for logging purposes.
|
|
20
|
+
* Name of the provider for logging purposes.
|
|
21
21
|
*/
|
|
22
22
|
readonly provider: string;
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
Provider-specific model ID for logging purposes.
|
|
25
|
+
* Provider-specific model ID for logging purposes.
|
|
26
26
|
*/
|
|
27
27
|
readonly modelId: string;
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
Generates a transcript.
|
|
30
|
+
* Generates a transcript.
|
|
31
31
|
*/
|
|
32
32
|
doGenerate(options: TranscriptionModelV3CallOptions): PromiseLike<{
|
|
33
33
|
/**
|
|
@@ -67,50 +67,50 @@ Generates a transcript.
|
|
|
67
67
|
durationInSeconds: number | undefined;
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
|
-
Warnings for the call, e.g. unsupported settings.
|
|
70
|
+
* Warnings for the call, e.g. unsupported settings.
|
|
71
71
|
*/
|
|
72
72
|
warnings: Array<SharedV3Warning>;
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
|
-
Optional request information for telemetry and debugging purposes.
|
|
75
|
+
* Optional request information for telemetry and debugging purposes.
|
|
76
76
|
*/
|
|
77
77
|
request?: {
|
|
78
78
|
/**
|
|
79
|
-
Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
|
|
80
|
-
Non-HTTP(s) providers should not set this.
|
|
79
|
+
* Raw request HTTP body that was sent to the provider API as a string (JSON should be stringified).
|
|
80
|
+
* Non-HTTP(s) providers should not set this.
|
|
81
81
|
*/
|
|
82
82
|
body?: string;
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
Response information for telemetry and debugging purposes.
|
|
86
|
+
* Response information for telemetry and debugging purposes.
|
|
87
87
|
*/
|
|
88
88
|
response: {
|
|
89
89
|
/**
|
|
90
|
-
Timestamp for the start of the generated response.
|
|
91
|
-
|
|
90
|
+
* Timestamp for the start of the generated response.
|
|
91
|
+
*/
|
|
92
92
|
timestamp: Date;
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
|
-
The ID of the response model that was used to generate the response.
|
|
96
|
-
|
|
95
|
+
* The ID of the response model that was used to generate the response.
|
|
96
|
+
*/
|
|
97
97
|
modelId: string;
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
|
-
Response headers.
|
|
101
|
-
|
|
100
|
+
* Response headers.
|
|
101
|
+
*/
|
|
102
102
|
headers?: SharedV3Headers;
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
|
-
Response body.
|
|
106
|
-
|
|
105
|
+
* Response body.
|
|
106
|
+
*/
|
|
107
107
|
body?: unknown;
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
|
-
Additional provider-specific metadata. They are passed through
|
|
112
|
-
from the provider to the AI SDK and enable provider-specific
|
|
113
|
-
results that can be fully encapsulated in the provider.
|
|
111
|
+
* Additional provider-specific metadata. They are passed through
|
|
112
|
+
* from the provider to the AI SDK and enable provider-specific
|
|
113
|
+
* results that can be fully encapsulated in the provider.
|
|
114
114
|
*/
|
|
115
115
|
providerMetadata?: Record<string, JSONObject>;
|
|
116
116
|
}>;
|