@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
|
@@ -9,127 +9,127 @@ import { LanguageModelV2StreamPart } from './language-model-v2-stream-part';
|
|
|
9
9
|
import { LanguageModelV2Usage } from './language-model-v2-usage';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
Specification for a language model that implements the language model interface version 2.
|
|
12
|
+
* Specification for a language model that implements the language model interface version 2.
|
|
13
13
|
*/
|
|
14
14
|
export type LanguageModelV2 = {
|
|
15
15
|
/**
|
|
16
|
-
The language model must specify which language model interface version it implements.
|
|
16
|
+
* The language model must specify which language model interface version it implements.
|
|
17
17
|
*/
|
|
18
18
|
readonly specificationVersion: 'v2';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
Name of the provider for logging purposes.
|
|
21
|
+
* Name of the provider for logging purposes.
|
|
22
22
|
*/
|
|
23
23
|
readonly provider: string;
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
Provider-specific model ID for logging purposes.
|
|
26
|
+
* Provider-specific model ID for logging purposes.
|
|
27
27
|
*/
|
|
28
28
|
readonly modelId: string;
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
Supported URL patterns by media type for the provider.
|
|
32
|
-
|
|
33
|
-
The keys are media type patterns or full media types (e.g. `*\/*` for everything, `audio/*`, `video/*`, or `application/pdf`).
|
|
34
|
-
and the values are arrays of regular expressions that match the URL paths.
|
|
35
|
-
|
|
36
|
-
The matching should be against lower-case URLs.
|
|
37
|
-
|
|
38
|
-
Matched URLs are supported natively by the model and are not downloaded.
|
|
39
|
-
|
|
40
|
-
@returns A map of supported URL patterns by media type (as a promise or a plain object).
|
|
31
|
+
* Supported URL patterns by media type for the provider.
|
|
32
|
+
*
|
|
33
|
+
* The keys are media type patterns or full media types (e.g. `*\/*` for everything, `audio/*`, `video/*`, or `application/pdf`).
|
|
34
|
+
* and the values are arrays of regular expressions that match the URL paths.
|
|
35
|
+
*
|
|
36
|
+
* The matching should be against lower-case URLs.
|
|
37
|
+
*
|
|
38
|
+
* Matched URLs are supported natively by the model and are not downloaded.
|
|
39
|
+
*
|
|
40
|
+
* @returns A map of supported URL patterns by media type (as a promise or a plain object).
|
|
41
41
|
*/
|
|
42
42
|
supportedUrls:
|
|
43
43
|
| PromiseLike<Record<string, RegExp[]>>
|
|
44
44
|
| Record<string, RegExp[]>;
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
Generates a language model output (non-streaming).
|
|
48
|
-
|
|
49
|
-
Naming: "do" prefix to prevent accidental direct usage of the method
|
|
50
|
-
by the user.
|
|
47
|
+
* Generates a language model output (non-streaming).
|
|
48
|
+
*
|
|
49
|
+
* Naming: "do" prefix to prevent accidental direct usage of the method
|
|
50
|
+
* by the user.
|
|
51
51
|
*/
|
|
52
52
|
doGenerate(options: LanguageModelV2CallOptions): PromiseLike<{
|
|
53
53
|
/**
|
|
54
|
-
Ordered content that the model has generated.
|
|
54
|
+
* Ordered content that the model has generated.
|
|
55
55
|
*/
|
|
56
56
|
content: Array<LanguageModelV2Content>;
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
|
-
Finish reason.
|
|
59
|
+
* Finish reason.
|
|
60
60
|
*/
|
|
61
61
|
finishReason: LanguageModelV2FinishReason;
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
|
|
64
|
+
* Usage information.
|
|
65
65
|
*/
|
|
66
66
|
usage: LanguageModelV2Usage;
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
|
-
Additional provider-specific metadata. They are passed through
|
|
70
|
-
from the provider to the AI SDK and enable provider-specific
|
|
71
|
-
results that can be fully encapsulated in the provider.
|
|
69
|
+
* Additional provider-specific metadata. They are passed through
|
|
70
|
+
* from the provider to the AI SDK and enable provider-specific
|
|
71
|
+
* results that can be fully encapsulated in the provider.
|
|
72
72
|
*/
|
|
73
73
|
providerMetadata?: SharedV2ProviderMetadata;
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
|
-
Optional request information for telemetry and debugging purposes.
|
|
76
|
+
* Optional request information for telemetry and debugging purposes.
|
|
77
77
|
*/
|
|
78
78
|
request?: {
|
|
79
79
|
/**
|
|
80
|
-
Request HTTP body that was sent to the provider API.
|
|
80
|
+
* Request HTTP body that was sent to the provider API.
|
|
81
81
|
*/
|
|
82
82
|
body?: unknown;
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
Optional response information for telemetry and debugging purposes.
|
|
86
|
+
* Optional response information for telemetry and debugging purposes.
|
|
87
87
|
*/
|
|
88
88
|
response?: LanguageModelV2ResponseMetadata & {
|
|
89
89
|
/**
|
|
90
|
-
Response headers.
|
|
91
|
-
|
|
90
|
+
* Response headers.
|
|
91
|
+
*/
|
|
92
92
|
headers?: SharedV2Headers;
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
|
-
Response HTTP body.
|
|
96
|
-
*/
|
|
95
|
+
* Response HTTP body.
|
|
96
|
+
*/
|
|
97
97
|
body?: unknown;
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
|
-
Warnings for the call, e.g. unsupported settings.
|
|
101
|
+
* Warnings for the call, e.g. unsupported settings.
|
|
102
102
|
*/
|
|
103
103
|
warnings: Array<LanguageModelV2CallWarning>;
|
|
104
104
|
}>;
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
|
-
Generates a language model output (streaming).
|
|
108
|
-
|
|
109
|
-
Naming: "do" prefix to prevent accidental direct usage of the method
|
|
110
|
-
by the user.
|
|
107
|
+
* Generates a language model output (streaming).
|
|
108
|
+
*
|
|
109
|
+
* Naming: "do" prefix to prevent accidental direct usage of the method
|
|
110
|
+
* by the user.
|
|
111
111
|
*
|
|
112
|
-
@return A stream of higher-level language model output parts.
|
|
112
|
+
* @return A stream of higher-level language model output parts.
|
|
113
113
|
*/
|
|
114
114
|
doStream(options: LanguageModelV2CallOptions): PromiseLike<{
|
|
115
115
|
stream: ReadableStream<LanguageModelV2StreamPart>;
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
|
-
Optional request information for telemetry and debugging purposes.
|
|
118
|
+
* Optional request information for telemetry and debugging purposes.
|
|
119
119
|
*/
|
|
120
120
|
request?: {
|
|
121
121
|
/**
|
|
122
|
-
Request HTTP body that was sent to the provider API.
|
|
123
|
-
|
|
122
|
+
* Request HTTP body that was sent to the provider API.
|
|
123
|
+
*/
|
|
124
124
|
body?: unknown;
|
|
125
125
|
};
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
|
-
Optional response data.
|
|
128
|
+
* Optional response data.
|
|
129
129
|
*/
|
|
130
130
|
response?: {
|
|
131
131
|
/**
|
|
132
|
-
Response headers.
|
|
132
|
+
* Response headers.
|
|
133
133
|
*/
|
|
134
134
|
headers?: SharedV2Headers;
|
|
135
135
|
};
|
|
@@ -7,62 +7,62 @@ import { LanguageModelV3ToolChoice } from './language-model-v3-tool-choice';
|
|
|
7
7
|
|
|
8
8
|
export type LanguageModelV3CallOptions = {
|
|
9
9
|
/**
|
|
10
|
-
A language mode prompt is a standardized prompt type.
|
|
11
|
-
|
|
12
|
-
Note: This is **not** the user-facing prompt. The AI SDK methods will map the
|
|
13
|
-
user-facing prompt types such as chat or instruction prompts to this format.
|
|
14
|
-
That approach allows us to evolve the user facing prompts without breaking
|
|
15
|
-
the language model interface.
|
|
10
|
+
* A language mode prompt is a standardized prompt type.
|
|
11
|
+
*
|
|
12
|
+
* Note: This is **not** the user-facing prompt. The AI SDK methods will map the
|
|
13
|
+
* user-facing prompt types such as chat or instruction prompts to this format.
|
|
14
|
+
* That approach allows us to evolve the user facing prompts without breaking
|
|
15
|
+
* the language model interface.
|
|
16
16
|
*/
|
|
17
17
|
prompt: LanguageModelV3Prompt;
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
Maximum number of tokens to generate.
|
|
20
|
+
* Maximum number of tokens to generate.
|
|
21
21
|
*/
|
|
22
22
|
maxOutputTokens?: number;
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
Temperature setting. The range depends on the provider and model.
|
|
26
|
-
|
|
25
|
+
* Temperature setting. The range depends on the provider and model.
|
|
26
|
+
*/
|
|
27
27
|
temperature?: number;
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
Stop sequences.
|
|
31
|
-
If set, the model will stop generating text when one of the stop sequences is generated.
|
|
32
|
-
Providers may have limits on the number of stop sequences.
|
|
33
|
-
|
|
30
|
+
* Stop sequences.
|
|
31
|
+
* If set, the model will stop generating text when one of the stop sequences is generated.
|
|
32
|
+
* Providers may have limits on the number of stop sequences.
|
|
33
|
+
*/
|
|
34
34
|
stopSequences?: string[];
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
Nucleus sampling.
|
|
38
|
-
|
|
37
|
+
* Nucleus sampling.
|
|
38
|
+
*/
|
|
39
39
|
topP?: number;
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
Only sample from the top K options for each subsequent token.
|
|
43
|
-
|
|
44
|
-
Used to remove "long tail" low probability responses.
|
|
45
|
-
Recommended for advanced use cases only. You usually only need to use temperature.
|
|
46
|
-
|
|
42
|
+
* Only sample from the top K options for each subsequent token.
|
|
43
|
+
*
|
|
44
|
+
* Used to remove "long tail" low probability responses.
|
|
45
|
+
* Recommended for advanced use cases only. You usually only need to use temperature.
|
|
46
|
+
*/
|
|
47
47
|
topK?: number;
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
|
-
Presence penalty setting. It affects the likelihood of the model to
|
|
51
|
-
repeat information that is already in the prompt.
|
|
52
|
-
|
|
50
|
+
* Presence penalty setting. It affects the likelihood of the model to
|
|
51
|
+
* repeat information that is already in the prompt.
|
|
52
|
+
*/
|
|
53
53
|
presencePenalty?: number;
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
|
-
Frequency penalty setting. It affects the likelihood of the model
|
|
57
|
-
to repeatedly use the same words or phrases.
|
|
58
|
-
|
|
56
|
+
* Frequency penalty setting. It affects the likelihood of the model
|
|
57
|
+
* to repeatedly use the same words or phrases.
|
|
58
|
+
*/
|
|
59
59
|
frequencyPenalty?: number;
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
Response format. The output can either be text or JSON. Default is text.
|
|
63
|
-
|
|
64
|
-
If JSON is selected, a schema can optionally be provided to guide the LLM.
|
|
65
|
-
|
|
62
|
+
* Response format. The output can either be text or JSON. Default is text.
|
|
63
|
+
*
|
|
64
|
+
* If JSON is selected, a schema can optionally be provided to guide the LLM.
|
|
65
|
+
*/
|
|
66
66
|
responseFormat?:
|
|
67
67
|
| { type: 'text' }
|
|
68
68
|
| {
|
|
@@ -85,35 +85,35 @@ If JSON is selected, a schema can optionally be provided to guide the LLM.
|
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
The seed (integer) to use for random sampling. If set and supported
|
|
89
|
-
by the model, calls will generate deterministic results.
|
|
90
|
-
|
|
88
|
+
* The seed (integer) to use for random sampling. If set and supported
|
|
89
|
+
* by the model, calls will generate deterministic results.
|
|
90
|
+
*/
|
|
91
91
|
seed?: number;
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
|
-
The tools that are available for the model.
|
|
95
|
-
|
|
94
|
+
* The tools that are available for the model.
|
|
95
|
+
*/
|
|
96
96
|
tools?: Array<LanguageModelV3FunctionTool | LanguageModelV3ProviderTool>;
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
Specifies how the tool should be selected. Defaults to 'auto'.
|
|
100
|
-
*/
|
|
99
|
+
* Specifies how the tool should be selected. Defaults to 'auto'.
|
|
100
|
+
*/
|
|
101
101
|
toolChoice?: LanguageModelV3ToolChoice;
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
|
-
Include raw chunks in the stream. Only applicable for streaming calls.
|
|
105
|
-
|
|
104
|
+
* Include raw chunks in the stream. Only applicable for streaming calls.
|
|
105
|
+
*/
|
|
106
106
|
includeRawChunks?: boolean;
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
|
-
Abort signal for cancelling the operation.
|
|
110
|
-
|
|
109
|
+
* Abort signal for cancelling the operation.
|
|
110
|
+
*/
|
|
111
111
|
abortSignal?: AbortSignal;
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
|
-
Additional HTTP headers to be sent with the request.
|
|
115
|
-
Only applicable for HTTP-based providers.
|
|
116
|
-
|
|
114
|
+
* Additional HTTP headers to be sent with the request.
|
|
115
|
+
* Only applicable for HTTP-based providers.
|
|
116
|
+
*/
|
|
117
117
|
headers?: Record<string, string | undefined>;
|
|
118
118
|
|
|
119
119
|
/**
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { SharedV3ProviderMetadata } from '../../shared';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
A file that has been generated by the model.
|
|
5
|
-
Generated files as base64 encoded strings or binary data.
|
|
6
|
-
The files should be returned without any unnecessary conversion.
|
|
4
|
+
* A file that has been generated by the model.
|
|
5
|
+
* Generated files as base64 encoded strings or binary data.
|
|
6
|
+
* The files should be returned without any unnecessary conversion.
|
|
7
7
|
*/
|
|
8
8
|
export type LanguageModelV3File = {
|
|
9
9
|
type: 'file';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
|
|
13
|
-
|
|
14
|
-
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
15
|
-
|
|
12
|
+
* The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
|
|
13
|
+
*
|
|
14
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
15
|
+
*/
|
|
16
16
|
mediaType: string;
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
Generated file data as base64 encoded strings or binary data.
|
|
20
|
-
|
|
21
|
-
The file data should be returned without any unnecessary conversion.
|
|
22
|
-
If the API returns base64 encoded strings, the file data should be returned
|
|
23
|
-
as base64 encoded strings. If the API returns binary data, the file data should
|
|
24
|
-
be returned as binary data.
|
|
25
|
-
|
|
19
|
+
* Generated file data as base64 encoded strings or binary data.
|
|
20
|
+
*
|
|
21
|
+
* The file data should be returned without any unnecessary conversion.
|
|
22
|
+
* If the API returns base64 encoded strings, the file data should be returned
|
|
23
|
+
* as base64 encoded strings. If the API returns binary data, the file data should
|
|
24
|
+
* be returned as binary data.
|
|
25
|
+
*/
|
|
26
26
|
data: string | Uint8Array;
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -3,31 +3,31 @@ import { SharedV3ProviderOptions } from '../../shared';
|
|
|
3
3
|
import { JSONObject } from '../../json-value';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
A tool has a name, a description, and a set of parameters.
|
|
7
|
-
|
|
8
|
-
Note: this is **not** the user-facing tool definition. The AI SDK methods will
|
|
9
|
-
map the user-facing tool definitions to this format.
|
|
6
|
+
* A tool has a name, a description, and a set of parameters.
|
|
7
|
+
*
|
|
8
|
+
* Note: this is **not** the user-facing tool definition. The AI SDK methods will
|
|
9
|
+
* map the user-facing tool definitions to this format.
|
|
10
10
|
*/
|
|
11
11
|
export type LanguageModelV3FunctionTool = {
|
|
12
12
|
/**
|
|
13
|
-
The type of the tool (always 'function').
|
|
13
|
+
* The type of the tool (always 'function').
|
|
14
14
|
*/
|
|
15
15
|
type: 'function';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
The name of the tool. Unique within this model call.
|
|
18
|
+
* The name of the tool. Unique within this model call.
|
|
19
19
|
*/
|
|
20
20
|
name: string;
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
A description of the tool. The language model uses this to understand the
|
|
24
|
-
tool's purpose and to provide better completion suggestions.
|
|
23
|
+
* A description of the tool. The language model uses this to understand the
|
|
24
|
+
* tool's purpose and to provide better completion suggestions.
|
|
25
25
|
*/
|
|
26
26
|
description?: string;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
The parameters that the tool expects. The language model uses this to
|
|
30
|
-
understand the tool's input requirements and to provide matching suggestions.
|
|
29
|
+
* The parameters that the tool expects. The language model uses this to
|
|
30
|
+
* understand the tool's input requirements and to provide matching suggestions.
|
|
31
31
|
*/
|
|
32
32
|
inputSchema: JSONSchema7;
|
|
33
33
|
|
|
@@ -47,7 +47,7 @@ understand the tool's input requirements and to provide matching suggestions.
|
|
|
47
47
|
strict?: boolean;
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
|
-
The provider-specific options for the tool.
|
|
50
|
+
* The provider-specific options for the tool.
|
|
51
51
|
*/
|
|
52
52
|
providerOptions?: SharedV3ProviderOptions;
|
|
53
53
|
};
|
|
@@ -3,13 +3,13 @@ import { SharedV3ProviderOptions } from '../../shared/v3/shared-v3-provider-opti
|
|
|
3
3
|
import { LanguageModelV3DataContent } from './language-model-v3-data-content';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
A prompt is a list of messages.
|
|
7
|
-
|
|
8
|
-
Note: Not all models and prompt formats support multi-modal inputs and
|
|
9
|
-
tool calls. The validation happens at runtime.
|
|
10
|
-
|
|
11
|
-
Note: This is not a user-facing prompt. The AI SDK methods will map the
|
|
12
|
-
user-facing prompt types such as chat or instruction prompts to this format.
|
|
6
|
+
* A prompt is a list of messages.
|
|
7
|
+
*
|
|
8
|
+
* Note: Not all models and prompt formats support multi-modal inputs and
|
|
9
|
+
* tool calls. The validation happens at runtime.
|
|
10
|
+
*
|
|
11
|
+
* Note: This is not a user-facing prompt. The AI SDK methods will map the
|
|
12
|
+
* user-facing prompt types such as chat or instruction prompts to this format.
|
|
13
13
|
*/
|
|
14
14
|
export type LanguageModelV3Prompt = Array<LanguageModelV3Message>;
|
|
15
15
|
|
|
@@ -53,13 +53,13 @@ export type LanguageModelV3Message =
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
|
-
Text content part of a prompt. It contains a string of text.
|
|
56
|
+
* Text content part of a prompt. It contains a string of text.
|
|
57
57
|
*/
|
|
58
58
|
export interface LanguageModelV3TextPart {
|
|
59
59
|
type: 'text';
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
The text content.
|
|
62
|
+
* The text content.
|
|
63
63
|
*/
|
|
64
64
|
text: string;
|
|
65
65
|
|
|
@@ -72,13 +72,13 @@ The text content.
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
|
-
Reasoning content part of a prompt. It contains a string of reasoning text.
|
|
75
|
+
* Reasoning content part of a prompt. It contains a string of reasoning text.
|
|
76
76
|
*/
|
|
77
77
|
export interface LanguageModelV3ReasoningPart {
|
|
78
78
|
type: 'reasoning';
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
|
-
The reasoning text.
|
|
81
|
+
* The reasoning text.
|
|
82
82
|
*/
|
|
83
83
|
text: string;
|
|
84
84
|
|
|
@@ -91,7 +91,7 @@ The reasoning text.
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
|
-
File content part of a prompt. It contains a file.
|
|
94
|
+
* File content part of a prompt. It contains a file.
|
|
95
95
|
*/
|
|
96
96
|
export interface LanguageModelV3FilePart {
|
|
97
97
|
type: 'file';
|
|
@@ -102,16 +102,16 @@ export interface LanguageModelV3FilePart {
|
|
|
102
102
|
filename?: string;
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
|
-
File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
106
|
-
*/
|
|
105
|
+
* File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
106
|
+
*/
|
|
107
107
|
data: LanguageModelV3DataContent;
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
|
-
IANA media type of the file.
|
|
111
|
-
|
|
112
|
-
Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action).
|
|
113
|
-
|
|
114
|
-
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
110
|
+
* IANA media type of the file.
|
|
111
|
+
*
|
|
112
|
+
* Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action).
|
|
113
|
+
*
|
|
114
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
115
115
|
*/
|
|
116
116
|
mediaType: string;
|
|
117
117
|
|
|
@@ -124,23 +124,23 @@ Can support wildcards, e.g. `image/*` (in which case the provider needs to take
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
/**
|
|
127
|
-
Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
127
|
+
* Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
|
|
128
128
|
*/
|
|
129
129
|
export interface LanguageModelV3ToolCallPart {
|
|
130
130
|
type: 'tool-call';
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
|
-
ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
134
|
-
|
|
133
|
+
* ID of the tool call. This ID is used to match the tool call with the tool result.
|
|
134
|
+
*/
|
|
135
135
|
toolCallId: string;
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
|
-
Name of the tool that is being called.
|
|
139
|
-
|
|
138
|
+
* Name of the tool that is being called.
|
|
139
|
+
*/
|
|
140
140
|
toolName: string;
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
|
-
Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
|
143
|
+
* Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
|
|
144
144
|
*/
|
|
145
145
|
input: unknown;
|
|
146
146
|
|
|
@@ -159,23 +159,23 @@ Arguments of the tool call. This is a JSON-serializable object that matches the
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
/**
|
|
162
|
-
Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
162
|
+
* Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
|
|
163
163
|
*/
|
|
164
164
|
export interface LanguageModelV3ToolResultPart {
|
|
165
165
|
type: 'tool-result';
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
|
-
ID of the tool call that this result is associated with.
|
|
169
|
-
|
|
168
|
+
* ID of the tool call that this result is associated with.
|
|
169
|
+
*/
|
|
170
170
|
toolCallId: string;
|
|
171
171
|
|
|
172
172
|
/**
|
|
173
|
-
Name of the tool that generated this result.
|
|
174
|
-
|
|
173
|
+
* Name of the tool that generated this result.
|
|
174
|
+
*/
|
|
175
175
|
toolName: string;
|
|
176
176
|
|
|
177
177
|
/**
|
|
178
|
-
Result of the tool call.
|
|
178
|
+
* Result of the tool call.
|
|
179
179
|
*/
|
|
180
180
|
output: LanguageModelV3ToolResultOutput;
|
|
181
181
|
|
|
@@ -283,8 +283,8 @@ export type LanguageModelV3ToolResultOutput =
|
|
|
283
283
|
type: 'text';
|
|
284
284
|
|
|
285
285
|
/**
|
|
286
|
-
Text content.
|
|
287
|
-
*/
|
|
286
|
+
* Text content.
|
|
287
|
+
*/
|
|
288
288
|
text: string;
|
|
289
289
|
|
|
290
290
|
/**
|
|
@@ -296,14 +296,14 @@ Text content.
|
|
|
296
296
|
type: 'file-data';
|
|
297
297
|
|
|
298
298
|
/**
|
|
299
|
-
Base-64 encoded media data.
|
|
300
|
-
*/
|
|
299
|
+
* Base-64 encoded media data.
|
|
300
|
+
*/
|
|
301
301
|
data: string;
|
|
302
302
|
|
|
303
303
|
/**
|
|
304
|
-
IANA media type.
|
|
305
|
-
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
306
|
-
*/
|
|
304
|
+
* IANA media type.
|
|
305
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
306
|
+
*/
|
|
307
307
|
mediaType: string;
|
|
308
308
|
|
|
309
309
|
/**
|
|
@@ -354,14 +354,14 @@ IANA media type.
|
|
|
354
354
|
type: 'image-data';
|
|
355
355
|
|
|
356
356
|
/**
|
|
357
|
-
Base-64 encoded image data.
|
|
358
|
-
*/
|
|
357
|
+
* Base-64 encoded image data.
|
|
358
|
+
*/
|
|
359
359
|
data: string;
|
|
360
360
|
|
|
361
361
|
/**
|
|
362
|
-
IANA media type.
|
|
363
|
-
@see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
364
|
-
*/
|
|
362
|
+
* IANA media type.
|
|
363
|
+
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
364
|
+
*/
|
|
365
365
|
mediaType: string;
|
|
366
366
|
|
|
367
367
|
/**
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export interface LanguageModelV3ResponseMetadata {
|
|
2
2
|
/**
|
|
3
|
-
ID for the generated response, if the provider sends one.
|
|
4
|
-
|
|
3
|
+
* ID for the generated response, if the provider sends one.
|
|
4
|
+
*/
|
|
5
5
|
id?: string;
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
Timestamp for the start of the generated response, if the provider sends one.
|
|
9
|
-
*/
|
|
8
|
+
* Timestamp for the start of the generated response, if the provider sends one.
|
|
9
|
+
*/
|
|
10
10
|
timestamp?: Date;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
The ID of the response model that was used to generate the response, if the provider sends one.
|
|
14
|
-
*/
|
|
13
|
+
* The ID of the response model that was used to generate the response, if the provider sends one.
|
|
14
|
+
*/
|
|
15
15
|
modelId?: string;
|
|
16
16
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SharedV3ProviderMetadata } from '../../shared/v3/shared-v3-provider-metadata';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
A source that has been used as input to generate the response.
|
|
4
|
+
* A source that has been used as input to generate the response.
|
|
5
5
|
*/
|
|
6
6
|
export type LanguageModelV3Source =
|
|
7
7
|
| {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { SharedV3ProviderMetadata } from '../../shared/v3/shared-v3-provider-metadata';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
Text that the model has generated.
|
|
4
|
+
* Text that the model has generated.
|
|
5
5
|
*/
|
|
6
6
|
export type LanguageModelV3Text = {
|
|
7
7
|
type: 'text';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
The text content.
|
|
10
|
+
* The text content.
|
|
11
11
|
*/
|
|
12
12
|
text: string;
|
|
13
13
|
|