@ai-sdk/provider 4.0.0-beta.13 → 4.0.0-beta.19
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 +50 -0
- package/dist/index.d.ts +626 -67
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- 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 +10 -3
- package/src/files/v4/files-v4-upload-file-result.ts +3 -3
- package/src/files/v4/files-v4.ts +2 -2
- 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 +3 -3
- package/src/image-model/v4/image-model-v4.ts +2 -2
- 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/index.ts +1 -0
- 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 -48
- 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/realtime-model/index.ts +1 -0
- package/src/realtime-model/v4/index.ts +20 -0
- package/src/realtime-model/v4/realtime-factory-v4.ts +20 -0
- package/src/realtime-model/v4/realtime-model-v4-client-event.ts +68 -0
- package/src/realtime-model/v4/realtime-model-v4-client-secret.ts +40 -0
- package/src/realtime-model/v4/realtime-model-v4-conversation-item.ts +55 -0
- package/src/realtime-model/v4/realtime-model-v4-server-event.ts +199 -0
- package/src/realtime-model/v4/realtime-model-v4-session-config.ts +142 -0
- package/src/realtime-model/v4/realtime-model-v4-tool-definition.ts +28 -0
- package/src/realtime-model/v4/realtime-model-v4.ts +89 -0
- 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/reranking-model-v4-call-options.ts +2 -2
- package/src/reranking-model/v4/reranking-model-v4-result.ts +1 -1
- package/src/reranking-model/v4/reranking-model-v4.ts +2 -2
- 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/skills-v4-upload-skill-call-options.ts +10 -3
- package/src/skills/v4/skills-v4-upload-skill-result.ts +3 -3
- package/src/skills/v4/skills-v4.ts +2 -2
- 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/speech-model-v4-call-options.ts +1 -1
- package/src/speech-model/v4/speech-model-v4-result.ts +3 -3
- package/src/speech-model/v4/speech-model-v4.ts +2 -2
- 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/transcription-model-v4-call-options.ts +1 -1
- package/src/transcription-model/v4/transcription-model-v4-result.ts +3 -3
- package/src/transcription-model/v4/transcription-model-v4.ts +2 -2
- 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/video-model-v4-call-options.ts +2 -2
- package/src/video-model/v4/video-model-v4-file.ts +1 -1
- package/src/language-model/v4/language-model-v4-data-content.ts +0 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,69 @@
|
|
|
1
1
|
import { JSONSchema7 } from 'json-schema';
|
|
2
2
|
export { JSONSchema7, JSONSchema7Definition } from 'json-schema';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* A mapping of provider names to provider-specific file identifiers.
|
|
6
|
+
*
|
|
7
|
+
* Provider references allow files to be identified across different
|
|
8
|
+
* providers without re-uploading, by storing each provider's own
|
|
9
|
+
* identifier for the same logical file.
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* {
|
|
13
|
+
* "openai": "file-abc123",
|
|
14
|
+
* "anthropic": "file-xyz789"
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* The `type?: never` constraint excludes any object that has a `type`
|
|
19
|
+
* property, so a `SharedV4ProviderReference` cannot be confused with a
|
|
20
|
+
* tagged file-data shape (e.g. `{ type: 'data', data }` or
|
|
21
|
+
* `{ type: 'reference', reference }`) when both appear in the same union.
|
|
22
|
+
*/
|
|
23
|
+
type SharedV4ProviderReference = Record<string, string> & {
|
|
24
|
+
type?: never;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* File data variant containing raw bytes (`Uint8Array`) or a base64-encoded
|
|
29
|
+
* string.
|
|
30
|
+
*/
|
|
31
|
+
interface SharedV4FileDataData {
|
|
32
|
+
type: 'data';
|
|
33
|
+
data: Uint8Array | string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* File data variant containing a URL that points to the file.
|
|
37
|
+
*/
|
|
38
|
+
interface SharedV4FileDataUrl {
|
|
39
|
+
type: 'url';
|
|
40
|
+
url: URL;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* File data variant containing a provider reference (`{ [provider]: id }`).
|
|
44
|
+
*/
|
|
45
|
+
interface SharedV4FileDataReference {
|
|
46
|
+
type: 'reference';
|
|
47
|
+
reference: SharedV4ProviderReference;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* File data variant containing inline text content (e.g. an inline text
|
|
51
|
+
* document).
|
|
52
|
+
*/
|
|
53
|
+
interface SharedV4FileDataText {
|
|
54
|
+
type: 'text';
|
|
55
|
+
text: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* File data as a tagged discriminated union:
|
|
59
|
+
*
|
|
60
|
+
* - `{ type: 'data', data }`: raw bytes (`Uint8Array`) or base64-encoded string.
|
|
61
|
+
* - `{ type: 'url', url }`: a URL that points to the file.
|
|
62
|
+
* - `{ type: 'reference', reference }`: a provider reference (`{ [provider]: id }`).
|
|
63
|
+
* - `{ type: 'text', text }`: inline text content (e.g. an inline text document).
|
|
64
|
+
*/
|
|
65
|
+
type SharedV4FileData = SharedV4FileDataData | SharedV4FileDataUrl | SharedV4FileDataReference | SharedV4FileDataText;
|
|
66
|
+
|
|
4
67
|
type SharedV4Headers = Record<string, string>;
|
|
5
68
|
|
|
6
69
|
/**
|
|
@@ -59,22 +122,6 @@ type SharedV4ProviderMetadata = Record<string, JSONObject>;
|
|
|
59
122
|
*/
|
|
60
123
|
type SharedV4ProviderOptions = Record<string, JSONObject>;
|
|
61
124
|
|
|
62
|
-
/**
|
|
63
|
-
* A mapping of provider names to provider-specific file identifiers.
|
|
64
|
-
*
|
|
65
|
-
* Provider references allow files to be identified across different
|
|
66
|
-
* providers without re-uploading, by storing each provider's own
|
|
67
|
-
* identifier for the same logical file.
|
|
68
|
-
*
|
|
69
|
-
* ```ts
|
|
70
|
-
* {
|
|
71
|
-
* "openai": "file-abc123",
|
|
72
|
-
* "anthropic": "file-xyz789"
|
|
73
|
-
* }
|
|
74
|
-
* ```
|
|
75
|
-
*/
|
|
76
|
-
type SharedV4ProviderReference = Record<string, string>;
|
|
77
|
-
|
|
78
125
|
/**
|
|
79
126
|
* Warning from the model.
|
|
80
127
|
*
|
|
@@ -850,9 +897,12 @@ declare class UnsupportedFunctionalityError extends AISDKError {
|
|
|
850
897
|
*/
|
|
851
898
|
type FilesV4UploadFileCallOptions = {
|
|
852
899
|
/**
|
|
853
|
-
* The file data
|
|
900
|
+
* The file data.
|
|
901
|
+
*
|
|
902
|
+
* - `{ type: 'data', data }`: raw bytes (`Uint8Array`) or a base64-encoded string.
|
|
903
|
+
* - `{ type: 'text', text }`: inline text (UTF-8).
|
|
854
904
|
*/
|
|
855
|
-
data:
|
|
905
|
+
data: SharedV4FileDataData | SharedV4FileDataText;
|
|
856
906
|
/**
|
|
857
907
|
* The IANA media type of the file (e.g. `'application/pdf'`).
|
|
858
908
|
*/
|
|
@@ -1655,11 +1705,6 @@ type LanguageModelV4FunctionTool = {
|
|
|
1655
1705
|
providerOptions?: SharedV4ProviderOptions;
|
|
1656
1706
|
};
|
|
1657
1707
|
|
|
1658
|
-
/**
|
|
1659
|
-
* Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
|
|
1660
|
-
*/
|
|
1661
|
-
type LanguageModelV4DataContent = Uint8Array | string | URL;
|
|
1662
|
-
|
|
1663
1708
|
/**
|
|
1664
1709
|
* A prompt is a list of messages.
|
|
1665
1710
|
*
|
|
@@ -1728,9 +1773,12 @@ interface LanguageModelV4ReasoningPart {
|
|
|
1728
1773
|
interface LanguageModelV4ReasoningFilePart {
|
|
1729
1774
|
type: 'reasoning-file';
|
|
1730
1775
|
/**
|
|
1731
|
-
* File data
|
|
1776
|
+
* File data as a tagged discriminated union:
|
|
1777
|
+
*
|
|
1778
|
+
* - `{ type: 'data', data }`: raw bytes (Uint8Array) or base64-encoded string.
|
|
1779
|
+
* - `{ type: 'url', url }`: a URL that points to the file.
|
|
1732
1780
|
*/
|
|
1733
|
-
data:
|
|
1781
|
+
data: SharedV4FileDataData | SharedV4FileDataUrl;
|
|
1734
1782
|
/**
|
|
1735
1783
|
* IANA media type of the file.
|
|
1736
1784
|
*
|
|
@@ -1771,14 +1819,23 @@ interface LanguageModelV4FilePart {
|
|
|
1771
1819
|
*/
|
|
1772
1820
|
filename?: string;
|
|
1773
1821
|
/**
|
|
1774
|
-
* File data
|
|
1775
|
-
*
|
|
1822
|
+
* File data as a tagged discriminated union:
|
|
1823
|
+
*
|
|
1824
|
+
* - `{ type: 'data', data }`: raw bytes (Uint8Array) or base64-encoded string.
|
|
1825
|
+
* - `{ type: 'url', url }`: a URL that points to the file.
|
|
1826
|
+
* - `{ type: 'reference', reference }`: a provider reference (`{ [provider]: id }`).
|
|
1827
|
+
* - `{ type: 'text', text }`: inline text content (e.g. an inline text document).
|
|
1776
1828
|
*/
|
|
1777
|
-
data:
|
|
1829
|
+
data: SharedV4FileData;
|
|
1778
1830
|
/**
|
|
1779
|
-
* IANA media type
|
|
1831
|
+
* Either a full IANA media type (`type/subtype`, e.g. `image/png`) or just
|
|
1832
|
+
* the top-level IANA segment (e.g. `image`, `audio`, `video`, `text`).
|
|
1780
1833
|
*
|
|
1781
|
-
*
|
|
1834
|
+
* `*`-subtype wildcards (e.g. `image/*`) are normalized as equivalent to the
|
|
1835
|
+
* top-level segment alone (e.g. `image`). Providers can use the helpers in
|
|
1836
|
+
* `@ai-sdk/provider-utils` (`isFullMediaType`, `getTopLevelMediaType`,
|
|
1837
|
+
* `detectMediaType`) to resolve the field according to their API
|
|
1838
|
+
* requirements.
|
|
1782
1839
|
*
|
|
1783
1840
|
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
1784
1841
|
*/
|
|
@@ -1928,13 +1985,26 @@ type LanguageModelV4ToolResultOutput = {
|
|
|
1928
1985
|
*/
|
|
1929
1986
|
providerOptions?: SharedV4ProviderOptions;
|
|
1930
1987
|
} | {
|
|
1931
|
-
type: 'file
|
|
1988
|
+
type: 'file';
|
|
1932
1989
|
/**
|
|
1933
|
-
*
|
|
1990
|
+
* File data as a tagged discriminated union:
|
|
1991
|
+
*
|
|
1992
|
+
* - `{ type: 'data', data }`: raw bytes (Uint8Array) or base64-encoded string.
|
|
1993
|
+
* - `{ type: 'url', url }`: a URL that points to the file.
|
|
1994
|
+
* - `{ type: 'reference', reference }`: a provider reference (`{ [provider]: id }`).
|
|
1995
|
+
* - `{ type: 'text', text }`: inline text content (e.g. an inline text document).
|
|
1934
1996
|
*/
|
|
1935
|
-
data:
|
|
1997
|
+
data: SharedV4FileData;
|
|
1936
1998
|
/**
|
|
1937
|
-
* IANA media type.
|
|
1999
|
+
* Either a full IANA media type (`type/subtype`, e.g. `image/png`) or just
|
|
2000
|
+
* the top-level IANA segment (e.g. `image`, `audio`, `video`, `text`).
|
|
2001
|
+
*
|
|
2002
|
+
* `*`-subtype wildcards (e.g. `image/*`) are normalized as equivalent to the
|
|
2003
|
+
* top-level segment alone (e.g. `image`). Providers can use the helpers in
|
|
2004
|
+
* `@ai-sdk/provider-utils` (`isFullMediaType`, `getTopLevelMediaType`,
|
|
2005
|
+
* `detectMediaType`) to resolve the field according to their API
|
|
2006
|
+
* requirements.
|
|
2007
|
+
*
|
|
1938
2008
|
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
1939
2009
|
*/
|
|
1940
2010
|
mediaType: string;
|
|
@@ -1946,32 +2016,6 @@ type LanguageModelV4ToolResultOutput = {
|
|
|
1946
2016
|
* Provider-specific options.
|
|
1947
2017
|
*/
|
|
1948
2018
|
providerOptions?: SharedV4ProviderOptions;
|
|
1949
|
-
} | {
|
|
1950
|
-
type: 'file-url';
|
|
1951
|
-
/**
|
|
1952
|
-
* URL of the file.
|
|
1953
|
-
*/
|
|
1954
|
-
url: string;
|
|
1955
|
-
/**
|
|
1956
|
-
* IANA media type.
|
|
1957
|
-
* @see https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
1958
|
-
*/
|
|
1959
|
-
mediaType: string;
|
|
1960
|
-
/**
|
|
1961
|
-
* Provider-specific options.
|
|
1962
|
-
*/
|
|
1963
|
-
providerOptions?: SharedV4ProviderOptions;
|
|
1964
|
-
} | {
|
|
1965
|
-
type: 'file-reference';
|
|
1966
|
-
/**
|
|
1967
|
-
* Provider-specific references for the file.
|
|
1968
|
-
* The key is the provider name, e.g. 'openai' or 'anthropic'.
|
|
1969
|
-
*/
|
|
1970
|
-
providerReference: SharedV4ProviderReference;
|
|
1971
|
-
/**
|
|
1972
|
-
* Provider-specific options.
|
|
1973
|
-
*/
|
|
1974
|
-
providerOptions?: SharedV4ProviderOptions;
|
|
1975
2019
|
} | {
|
|
1976
2020
|
/**
|
|
1977
2021
|
* Custom content part. This can be used to implement
|
|
@@ -2160,14 +2204,17 @@ type LanguageModelV4File = {
|
|
|
2160
2204
|
*/
|
|
2161
2205
|
mediaType: string;
|
|
2162
2206
|
/**
|
|
2163
|
-
* Generated file data as
|
|
2207
|
+
* Generated file data as a tagged discriminated union:
|
|
2208
|
+
*
|
|
2209
|
+
* - `{ type: 'data', data }`: raw bytes (Uint8Array) or base64-encoded string.
|
|
2210
|
+
* - `{ type: 'url', url }`: a URL that points to the file.
|
|
2164
2211
|
*
|
|
2165
2212
|
* The file data should be returned without any unnecessary conversion.
|
|
2166
2213
|
* If the API returns base64 encoded strings, the file data should be returned
|
|
2167
2214
|
* as base64 encoded strings. If the API returns binary data, the file data should
|
|
2168
2215
|
* be returned as binary data.
|
|
2169
2216
|
*/
|
|
2170
|
-
data:
|
|
2217
|
+
data: SharedV4FileDataData | SharedV4FileDataUrl;
|
|
2171
2218
|
/**
|
|
2172
2219
|
* Optional provider-specific metadata for the file part.
|
|
2173
2220
|
*/
|
|
@@ -2200,14 +2247,17 @@ type LanguageModelV4ReasoningFile = {
|
|
|
2200
2247
|
*/
|
|
2201
2248
|
mediaType: string;
|
|
2202
2249
|
/**
|
|
2203
|
-
* Generated file data as
|
|
2250
|
+
* Generated file data as a tagged discriminated union:
|
|
2251
|
+
*
|
|
2252
|
+
* - `{ type: 'data', data }`: raw bytes (Uint8Array) or base64-encoded string.
|
|
2253
|
+
* - `{ type: 'url', url }`: a URL that points to the file.
|
|
2204
2254
|
*
|
|
2205
2255
|
* The file data should be returned without any unnecessary conversion.
|
|
2206
2256
|
* If the API returns base64 encoded strings, the file data should be returned
|
|
2207
2257
|
* as base64 encoded strings. If the API returns binary data, the file data should
|
|
2208
2258
|
* be returned as binary data.
|
|
2209
2259
|
*/
|
|
2210
|
-
data:
|
|
2260
|
+
data: SharedV4FileDataData | SharedV4FileDataUrl;
|
|
2211
2261
|
/**
|
|
2212
2262
|
* Optional provider-specific metadata for the reasoning file part.
|
|
2213
2263
|
*/
|
|
@@ -5186,9 +5236,12 @@ interface SkillsV4File {
|
|
|
5186
5236
|
*/
|
|
5187
5237
|
path: string;
|
|
5188
5238
|
/**
|
|
5189
|
-
* The
|
|
5239
|
+
* The file data.
|
|
5240
|
+
*
|
|
5241
|
+
* - `{ type: 'data', data }`: raw bytes (`Uint8Array`) or a base64-encoded string.
|
|
5242
|
+
* - `{ type: 'text', text }`: inline text (UTF-8).
|
|
5190
5243
|
*/
|
|
5191
|
-
|
|
5244
|
+
data: SharedV4FileDataData | SharedV4FileDataText;
|
|
5192
5245
|
}
|
|
5193
5246
|
interface SkillsV4UploadSkillCallOptions {
|
|
5194
5247
|
/**
|
|
@@ -6139,6 +6192,512 @@ interface ProviderV2 {
|
|
|
6139
6192
|
speechModel?(modelId: string): SpeechModelV2;
|
|
6140
6193
|
}
|
|
6141
6194
|
|
|
6195
|
+
/**
|
|
6196
|
+
* A tool definition for realtime models. Sent as part of the session
|
|
6197
|
+
* configuration so the model knows which functions it can call.
|
|
6198
|
+
*/
|
|
6199
|
+
type RealtimeModelV4ToolDefinition = {
|
|
6200
|
+
/**
|
|
6201
|
+
* The type of the tool (always 'function').
|
|
6202
|
+
*/
|
|
6203
|
+
type: 'function';
|
|
6204
|
+
/**
|
|
6205
|
+
* The name of the tool. Unique within the session.
|
|
6206
|
+
*/
|
|
6207
|
+
name: string;
|
|
6208
|
+
/**
|
|
6209
|
+
* A description of what the tool does. The model uses this to decide
|
|
6210
|
+
* whether to call the tool.
|
|
6211
|
+
*/
|
|
6212
|
+
description?: string;
|
|
6213
|
+
/**
|
|
6214
|
+
* JSON Schema describing the parameters the tool expects.
|
|
6215
|
+
*/
|
|
6216
|
+
parameters: JSONSchema7;
|
|
6217
|
+
};
|
|
6218
|
+
|
|
6219
|
+
/**
|
|
6220
|
+
* Provider-neutral configuration for a realtime session.
|
|
6221
|
+
* Each provider maps this to their specific session.update payload.
|
|
6222
|
+
*/
|
|
6223
|
+
type RealtimeModelV4SessionConfig = {
|
|
6224
|
+
/**
|
|
6225
|
+
* System instructions for the model.
|
|
6226
|
+
*/
|
|
6227
|
+
instructions?: string;
|
|
6228
|
+
/**
|
|
6229
|
+
* Voice to use for audio output.
|
|
6230
|
+
*/
|
|
6231
|
+
voice?: string;
|
|
6232
|
+
/**
|
|
6233
|
+
* Which output modalities the model should produce.
|
|
6234
|
+
*/
|
|
6235
|
+
outputModalities?: Array<'text' | 'audio'>;
|
|
6236
|
+
/**
|
|
6237
|
+
* Audio format configuration for input audio.
|
|
6238
|
+
*/
|
|
6239
|
+
inputAudioFormat?: {
|
|
6240
|
+
/**
|
|
6241
|
+
* Audio format type (e.g. "audio/pcm", "audio/pcmu", "audio/pcma").
|
|
6242
|
+
*/
|
|
6243
|
+
type: string;
|
|
6244
|
+
/**
|
|
6245
|
+
* Sample rate in Hz. Only applicable for PCM format.
|
|
6246
|
+
*/
|
|
6247
|
+
rate?: number;
|
|
6248
|
+
};
|
|
6249
|
+
/**
|
|
6250
|
+
* Input audio transcription configuration.
|
|
6251
|
+
*
|
|
6252
|
+
* When enabled, providers that support input transcription emit normalized
|
|
6253
|
+
* `input-transcription-completed` events that can be rendered as user
|
|
6254
|
+
* messages.
|
|
6255
|
+
*/
|
|
6256
|
+
inputAudioTranscription?: {
|
|
6257
|
+
/**
|
|
6258
|
+
* Provider-specific transcription model.
|
|
6259
|
+
*/
|
|
6260
|
+
model?: string;
|
|
6261
|
+
/**
|
|
6262
|
+
* Optional language hint for the input audio.
|
|
6263
|
+
*/
|
|
6264
|
+
language?: string;
|
|
6265
|
+
/**
|
|
6266
|
+
* Optional prompt to guide transcription.
|
|
6267
|
+
*/
|
|
6268
|
+
prompt?: string;
|
|
6269
|
+
};
|
|
6270
|
+
/**
|
|
6271
|
+
* Output audio transcription configuration.
|
|
6272
|
+
*
|
|
6273
|
+
* When enabled, providers that support output transcription emit normalized
|
|
6274
|
+
* `audio-transcript-delta` / `audio-transcript-done` events for the model's
|
|
6275
|
+
* spoken response. Some providers transcribe output by default; setting this
|
|
6276
|
+
* makes the behavior explicit rather than relying on that default.
|
|
6277
|
+
*/
|
|
6278
|
+
outputAudioTranscription?: {
|
|
6279
|
+
/**
|
|
6280
|
+
* Provider-specific transcription model.
|
|
6281
|
+
*/
|
|
6282
|
+
model?: string;
|
|
6283
|
+
/**
|
|
6284
|
+
* Optional language hint for the output audio.
|
|
6285
|
+
*/
|
|
6286
|
+
language?: string;
|
|
6287
|
+
/**
|
|
6288
|
+
* Optional prompt to guide transcription.
|
|
6289
|
+
*/
|
|
6290
|
+
prompt?: string;
|
|
6291
|
+
};
|
|
6292
|
+
/**
|
|
6293
|
+
* Audio format configuration for output audio.
|
|
6294
|
+
*/
|
|
6295
|
+
outputAudioFormat?: {
|
|
6296
|
+
/**
|
|
6297
|
+
* Audio format type (e.g. "audio/pcm", "audio/pcmu", "audio/pcma").
|
|
6298
|
+
*/
|
|
6299
|
+
type: string;
|
|
6300
|
+
/**
|
|
6301
|
+
* Sample rate in Hz. Only applicable for PCM format.
|
|
6302
|
+
*/
|
|
6303
|
+
rate?: number;
|
|
6304
|
+
};
|
|
6305
|
+
/**
|
|
6306
|
+
* Voice activity detection configuration.
|
|
6307
|
+
* Set to null or type 'disabled' to turn off VAD (push-to-talk mode).
|
|
6308
|
+
*/
|
|
6309
|
+
turnDetection?: {
|
|
6310
|
+
/**
|
|
6311
|
+
* VAD mode. 'server-vad' for automatic detection,
|
|
6312
|
+
* 'semantic-vad' for OpenAI's semantic detection,
|
|
6313
|
+
* 'disabled' to turn off VAD.
|
|
6314
|
+
*/
|
|
6315
|
+
type: 'server-vad' | 'semantic-vad' | 'disabled';
|
|
6316
|
+
/**
|
|
6317
|
+
* VAD activation threshold (0.0-1.0).
|
|
6318
|
+
* Higher values require louder audio to trigger.
|
|
6319
|
+
*/
|
|
6320
|
+
threshold?: number;
|
|
6321
|
+
/**
|
|
6322
|
+
* How long the user must be silent (in ms) before
|
|
6323
|
+
* the server ends the turn.
|
|
6324
|
+
*/
|
|
6325
|
+
silenceDurationMs?: number;
|
|
6326
|
+
/**
|
|
6327
|
+
* Amount of audio (in ms) to include before the
|
|
6328
|
+
* detected start of speech.
|
|
6329
|
+
*/
|
|
6330
|
+
prefixPaddingMs?: number;
|
|
6331
|
+
} | null;
|
|
6332
|
+
/**
|
|
6333
|
+
* Tool definitions available to the model in this session.
|
|
6334
|
+
*/
|
|
6335
|
+
tools?: RealtimeModelV4ToolDefinition[];
|
|
6336
|
+
/**
|
|
6337
|
+
* Provider-specific options that are passed through to the provider.
|
|
6338
|
+
*/
|
|
6339
|
+
providerOptions?: Record<string, unknown>;
|
|
6340
|
+
};
|
|
6341
|
+
|
|
6342
|
+
/**
|
|
6343
|
+
* Options for creating an ephemeral client secret for browser-side
|
|
6344
|
+
* WebSocket connections to a realtime model.
|
|
6345
|
+
*/
|
|
6346
|
+
type RealtimeModelV4ClientSecretOptions = {
|
|
6347
|
+
/**
|
|
6348
|
+
* Number of seconds until the client secret expires.
|
|
6349
|
+
*/
|
|
6350
|
+
expiresAfterSeconds?: number;
|
|
6351
|
+
/**
|
|
6352
|
+
* Optional session configuration to embed in the token request.
|
|
6353
|
+
* Some providers (e.g. Google) require the full session config at token creation time.
|
|
6354
|
+
*/
|
|
6355
|
+
sessionConfig?: RealtimeModelV4SessionConfig;
|
|
6356
|
+
};
|
|
6357
|
+
/**
|
|
6358
|
+
* Result of creating an ephemeral client secret.
|
|
6359
|
+
*/
|
|
6360
|
+
type RealtimeModelV4ClientSecretResult = {
|
|
6361
|
+
/**
|
|
6362
|
+
* The ephemeral token value. Used as a Bearer token or in the
|
|
6363
|
+
* WebSocket subprotocol header for authentication.
|
|
6364
|
+
*/
|
|
6365
|
+
token: string;
|
|
6366
|
+
/**
|
|
6367
|
+
* The WebSocket URL to connect to. Includes any provider-specific
|
|
6368
|
+
* query parameters (e.g. model ID).
|
|
6369
|
+
*/
|
|
6370
|
+
url: string;
|
|
6371
|
+
/**
|
|
6372
|
+
* Unix timestamp (seconds) when this client secret expires.
|
|
6373
|
+
*/
|
|
6374
|
+
expiresAt?: number;
|
|
6375
|
+
};
|
|
6376
|
+
|
|
6377
|
+
/**
|
|
6378
|
+
* A conversation item that can be created by the client and sent to
|
|
6379
|
+
* the model via the conversation.item.create event.
|
|
6380
|
+
*/
|
|
6381
|
+
type RealtimeModelV4ConversationItem = RealtimeModelV4TextMessage | RealtimeModelV4AudioMessage | RealtimeModelV4FunctionCallOutput;
|
|
6382
|
+
/**
|
|
6383
|
+
* A text message from the user.
|
|
6384
|
+
*/
|
|
6385
|
+
type RealtimeModelV4TextMessage = {
|
|
6386
|
+
type: 'text-message';
|
|
6387
|
+
role: 'user';
|
|
6388
|
+
text: string;
|
|
6389
|
+
};
|
|
6390
|
+
/**
|
|
6391
|
+
* An audio message from the user (complete audio, not streamed).
|
|
6392
|
+
*/
|
|
6393
|
+
type RealtimeModelV4AudioMessage = {
|
|
6394
|
+
type: 'audio-message';
|
|
6395
|
+
role: 'user';
|
|
6396
|
+
/**
|
|
6397
|
+
* Base64-encoded audio data.
|
|
6398
|
+
*/
|
|
6399
|
+
audio: string;
|
|
6400
|
+
};
|
|
6401
|
+
/**
|
|
6402
|
+
* The output of a function call, sent back to the model so it can
|
|
6403
|
+
* continue generating a response using the tool result.
|
|
6404
|
+
*/
|
|
6405
|
+
type RealtimeModelV4FunctionCallOutput = {
|
|
6406
|
+
type: 'function-call-output';
|
|
6407
|
+
/**
|
|
6408
|
+
* The call ID from the function-call-arguments-done event.
|
|
6409
|
+
* Must match so the model knows which function call this result is for.
|
|
6410
|
+
*/
|
|
6411
|
+
callId: string;
|
|
6412
|
+
/**
|
|
6413
|
+
* The name of the function that was called.
|
|
6414
|
+
* Required by some providers (e.g. Google) in the tool response routing.
|
|
6415
|
+
*/
|
|
6416
|
+
name?: string;
|
|
6417
|
+
/**
|
|
6418
|
+
* JSON string containing the function call result.
|
|
6419
|
+
*/
|
|
6420
|
+
output: string;
|
|
6421
|
+
};
|
|
6422
|
+
|
|
6423
|
+
/**
|
|
6424
|
+
* Normalized events sent from the browser to the realtime model.
|
|
6425
|
+
* Each provider maps this to its native event format before sending
|
|
6426
|
+
* over the WebSocket.
|
|
6427
|
+
*/
|
|
6428
|
+
type RealtimeModelV4ClientEvent = {
|
|
6429
|
+
type: 'session-update';
|
|
6430
|
+
config: RealtimeModelV4SessionConfig;
|
|
6431
|
+
} | {
|
|
6432
|
+
type: 'input-audio-append';
|
|
6433
|
+
/**
|
|
6434
|
+
* Base64-encoded audio chunk to append to the input buffer.
|
|
6435
|
+
*/
|
|
6436
|
+
audio: string;
|
|
6437
|
+
} | {
|
|
6438
|
+
type: 'input-audio-commit';
|
|
6439
|
+
} | {
|
|
6440
|
+
type: 'input-audio-clear';
|
|
6441
|
+
} | {
|
|
6442
|
+
type: 'conversation-item-create';
|
|
6443
|
+
item: RealtimeModelV4ConversationItem;
|
|
6444
|
+
} | {
|
|
6445
|
+
type: 'conversation-item-truncate';
|
|
6446
|
+
/**
|
|
6447
|
+
* The ID of the assistant message item to truncate.
|
|
6448
|
+
*/
|
|
6449
|
+
itemId: string;
|
|
6450
|
+
/**
|
|
6451
|
+
* The index of the content part to truncate.
|
|
6452
|
+
*/
|
|
6453
|
+
contentIndex: number;
|
|
6454
|
+
/**
|
|
6455
|
+
* Truncate audio after this many milliseconds.
|
|
6456
|
+
*/
|
|
6457
|
+
audioEndMs: number;
|
|
6458
|
+
} | {
|
|
6459
|
+
type: 'response-create';
|
|
6460
|
+
options?: {
|
|
6461
|
+
modalities?: string[];
|
|
6462
|
+
instructions?: string;
|
|
6463
|
+
metadata?: Record<string, unknown>;
|
|
6464
|
+
};
|
|
6465
|
+
} | {
|
|
6466
|
+
type: 'response-cancel';
|
|
6467
|
+
};
|
|
6468
|
+
|
|
6469
|
+
/**
|
|
6470
|
+
* Normalized events emitted by the realtime model (model → browser).
|
|
6471
|
+
* Each provider maps its native event format to this discriminated union.
|
|
6472
|
+
*
|
|
6473
|
+
* Every event includes a `raw` field with the original provider-specific
|
|
6474
|
+
* event data for debugging and provider-specific access.
|
|
6475
|
+
*/
|
|
6476
|
+
type RealtimeModelV4ServerEvent = {
|
|
6477
|
+
type: 'session-created';
|
|
6478
|
+
sessionId?: string;
|
|
6479
|
+
raw: unknown;
|
|
6480
|
+
} | {
|
|
6481
|
+
type: 'session-updated';
|
|
6482
|
+
raw: unknown;
|
|
6483
|
+
} | {
|
|
6484
|
+
type: 'speech-started';
|
|
6485
|
+
itemId?: string;
|
|
6486
|
+
raw: unknown;
|
|
6487
|
+
} | {
|
|
6488
|
+
type: 'speech-stopped';
|
|
6489
|
+
itemId?: string;
|
|
6490
|
+
raw: unknown;
|
|
6491
|
+
} | {
|
|
6492
|
+
type: 'audio-committed';
|
|
6493
|
+
itemId?: string;
|
|
6494
|
+
previousItemId?: string;
|
|
6495
|
+
raw: unknown;
|
|
6496
|
+
} | {
|
|
6497
|
+
type: 'conversation-item-added';
|
|
6498
|
+
itemId: string;
|
|
6499
|
+
item: unknown;
|
|
6500
|
+
raw: unknown;
|
|
6501
|
+
} | {
|
|
6502
|
+
type: 'input-transcription-completed';
|
|
6503
|
+
itemId: string;
|
|
6504
|
+
transcript: string;
|
|
6505
|
+
raw: unknown;
|
|
6506
|
+
} | {
|
|
6507
|
+
type: 'response-created';
|
|
6508
|
+
responseId: string;
|
|
6509
|
+
raw: unknown;
|
|
6510
|
+
} | {
|
|
6511
|
+
type: 'response-done';
|
|
6512
|
+
responseId: string;
|
|
6513
|
+
status: string;
|
|
6514
|
+
raw: unknown;
|
|
6515
|
+
} | {
|
|
6516
|
+
type: 'output-item-added';
|
|
6517
|
+
responseId: string;
|
|
6518
|
+
itemId: string;
|
|
6519
|
+
raw: unknown;
|
|
6520
|
+
} | {
|
|
6521
|
+
type: 'output-item-done';
|
|
6522
|
+
responseId: string;
|
|
6523
|
+
itemId: string;
|
|
6524
|
+
raw: unknown;
|
|
6525
|
+
} | {
|
|
6526
|
+
type: 'content-part-added';
|
|
6527
|
+
responseId: string;
|
|
6528
|
+
itemId: string;
|
|
6529
|
+
raw: unknown;
|
|
6530
|
+
} | {
|
|
6531
|
+
type: 'content-part-done';
|
|
6532
|
+
responseId: string;
|
|
6533
|
+
itemId: string;
|
|
6534
|
+
raw: unknown;
|
|
6535
|
+
} | {
|
|
6536
|
+
type: 'audio-delta';
|
|
6537
|
+
responseId: string;
|
|
6538
|
+
itemId: string;
|
|
6539
|
+
/**
|
|
6540
|
+
* Base64-encoded audio chunk.
|
|
6541
|
+
*/
|
|
6542
|
+
delta: string;
|
|
6543
|
+
raw: unknown;
|
|
6544
|
+
} | {
|
|
6545
|
+
type: 'audio-done';
|
|
6546
|
+
responseId: string;
|
|
6547
|
+
itemId: string;
|
|
6548
|
+
raw: unknown;
|
|
6549
|
+
} | {
|
|
6550
|
+
type: 'audio-transcript-delta';
|
|
6551
|
+
responseId: string;
|
|
6552
|
+
itemId: string;
|
|
6553
|
+
/**
|
|
6554
|
+
* Text chunk of the audio transcript.
|
|
6555
|
+
*/
|
|
6556
|
+
delta: string;
|
|
6557
|
+
raw: unknown;
|
|
6558
|
+
} | {
|
|
6559
|
+
type: 'audio-transcript-done';
|
|
6560
|
+
responseId: string;
|
|
6561
|
+
itemId: string;
|
|
6562
|
+
transcript?: string;
|
|
6563
|
+
raw: unknown;
|
|
6564
|
+
} | {
|
|
6565
|
+
type: 'text-delta';
|
|
6566
|
+
responseId: string;
|
|
6567
|
+
itemId: string;
|
|
6568
|
+
/**
|
|
6569
|
+
* Text chunk of the model's text response.
|
|
6570
|
+
*/
|
|
6571
|
+
delta: string;
|
|
6572
|
+
raw: unknown;
|
|
6573
|
+
} | {
|
|
6574
|
+
type: 'text-done';
|
|
6575
|
+
responseId: string;
|
|
6576
|
+
itemId: string;
|
|
6577
|
+
text?: string;
|
|
6578
|
+
raw: unknown;
|
|
6579
|
+
} | {
|
|
6580
|
+
type: 'function-call-arguments-delta';
|
|
6581
|
+
responseId: string;
|
|
6582
|
+
itemId: string;
|
|
6583
|
+
callId: string;
|
|
6584
|
+
/**
|
|
6585
|
+
* Partial JSON string of function call arguments.
|
|
6586
|
+
*/
|
|
6587
|
+
delta: string;
|
|
6588
|
+
raw: unknown;
|
|
6589
|
+
} | {
|
|
6590
|
+
type: 'function-call-arguments-done';
|
|
6591
|
+
responseId: string;
|
|
6592
|
+
itemId: string;
|
|
6593
|
+
callId: string;
|
|
6594
|
+
/**
|
|
6595
|
+
* The name of the function to call.
|
|
6596
|
+
*/
|
|
6597
|
+
name: string;
|
|
6598
|
+
/**
|
|
6599
|
+
* Complete JSON string of function call arguments.
|
|
6600
|
+
*/
|
|
6601
|
+
arguments: string;
|
|
6602
|
+
raw: unknown;
|
|
6603
|
+
} | {
|
|
6604
|
+
type: 'error';
|
|
6605
|
+
message: string;
|
|
6606
|
+
code?: string;
|
|
6607
|
+
raw: unknown;
|
|
6608
|
+
} | {
|
|
6609
|
+
type: 'custom';
|
|
6610
|
+
/**
|
|
6611
|
+
* The original event type string from the provider.
|
|
6612
|
+
*/
|
|
6613
|
+
rawType: string;
|
|
6614
|
+
raw: unknown;
|
|
6615
|
+
};
|
|
6616
|
+
|
|
6617
|
+
/**
|
|
6618
|
+
* Specification for a realtime model that supports bidirectional
|
|
6619
|
+
* audio/text communication over WebSocket.
|
|
6620
|
+
*
|
|
6621
|
+
* Providers implement this interface to enable realtime voice
|
|
6622
|
+
* conversations through the AI SDK.
|
|
6623
|
+
*/
|
|
6624
|
+
type RealtimeModelV4 = {
|
|
6625
|
+
/**
|
|
6626
|
+
* The realtime model must specify which interface version it implements.
|
|
6627
|
+
*/
|
|
6628
|
+
readonly specificationVersion: 'v4';
|
|
6629
|
+
/**
|
|
6630
|
+
* Provider ID (e.g. 'openai', 'xai').
|
|
6631
|
+
*/
|
|
6632
|
+
readonly provider: string;
|
|
6633
|
+
/**
|
|
6634
|
+
* Provider-specific model ID (e.g. 'gpt-4o-realtime', 'grok-3').
|
|
6635
|
+
*/
|
|
6636
|
+
readonly modelId: string;
|
|
6637
|
+
/**
|
|
6638
|
+
* Server-side: Creates an ephemeral client secret for authenticating
|
|
6639
|
+
* browser-side WebSocket connections. The secret is short-lived and
|
|
6640
|
+
* safe to expose to client code.
|
|
6641
|
+
*
|
|
6642
|
+
* Naming: "do" prefix to prevent accidental direct usage by the user.
|
|
6643
|
+
*/
|
|
6644
|
+
doCreateClientSecret(options: RealtimeModelV4ClientSecretOptions): PromiseLike<RealtimeModelV4ClientSecretResult>;
|
|
6645
|
+
/**
|
|
6646
|
+
* Browser-side: Returns the WebSocket URL and subprotocols to use
|
|
6647
|
+
* when connecting. Each provider has its own authentication mechanism
|
|
6648
|
+
* (e.g. OpenAI uses subprotocol headers, xAI may use query params).
|
|
6649
|
+
*/
|
|
6650
|
+
getWebSocketConfig(options: {
|
|
6651
|
+
token: string;
|
|
6652
|
+
url: string;
|
|
6653
|
+
}): {
|
|
6654
|
+
url: string;
|
|
6655
|
+
protocols?: string[];
|
|
6656
|
+
};
|
|
6657
|
+
/**
|
|
6658
|
+
* Browser-side: Parses a raw JSON event received over the WebSocket
|
|
6659
|
+
* and returns one or more normalized events. Providers map their native
|
|
6660
|
+
* event format to the common RealtimeModelV4ServerEvent union.
|
|
6661
|
+
*
|
|
6662
|
+
* Returns an array when a single provider message maps to multiple
|
|
6663
|
+
* normalized events (e.g. Google's serverContent can contain audio,
|
|
6664
|
+
* text, and turn-complete data in one message).
|
|
6665
|
+
*/
|
|
6666
|
+
parseServerEvent(raw: unknown): RealtimeModelV4ServerEvent | RealtimeModelV4ServerEvent[];
|
|
6667
|
+
/**
|
|
6668
|
+
* Browser-side: Serializes a normalized client event into the
|
|
6669
|
+
* provider's native JSON format for sending over the WebSocket.
|
|
6670
|
+
*/
|
|
6671
|
+
serializeClientEvent(event: RealtimeModelV4ClientEvent): unknown | PromiseLike<unknown>;
|
|
6672
|
+
/**
|
|
6673
|
+
* Browser-side: Builds the provider-specific session configuration
|
|
6674
|
+
* payload from a normalized session config. Used to construct the
|
|
6675
|
+
* session.update event sent after WebSocket connection.
|
|
6676
|
+
*/
|
|
6677
|
+
buildSessionConfig(config: RealtimeModelV4SessionConfig): unknown;
|
|
6678
|
+
/**
|
|
6679
|
+
* Browser-side: Returns a message to auto-send back over the WebSocket
|
|
6680
|
+
* in response to a raw incoming message, or null if no response is needed.
|
|
6681
|
+
*
|
|
6682
|
+
* Used for provider-specific keepalive protocols (e.g. ping/pong).
|
|
6683
|
+
* Called by the session layer before parseServerEvent.
|
|
6684
|
+
*/
|
|
6685
|
+
getHealthCheckResponse?(raw: unknown): unknown | null;
|
|
6686
|
+
};
|
|
6687
|
+
|
|
6688
|
+
type RealtimeFactoryV4GetTokenOptions = {
|
|
6689
|
+
model: string;
|
|
6690
|
+
} & RealtimeModelV4ClientSecretOptions;
|
|
6691
|
+
type RealtimeFactoryV4GetTokenResult = {
|
|
6692
|
+
token: string;
|
|
6693
|
+
url: string;
|
|
6694
|
+
expiresAt?: number;
|
|
6695
|
+
};
|
|
6696
|
+
interface RealtimeFactoryV4 {
|
|
6697
|
+
(modelId: string): RealtimeModelV4;
|
|
6698
|
+
getToken(options: RealtimeFactoryV4GetTokenOptions): Promise<RealtimeFactoryV4GetTokenResult>;
|
|
6699
|
+
}
|
|
6700
|
+
|
|
6142
6701
|
/**
|
|
6143
6702
|
* A video or image file that can be used for video editing or image-to-video generation.
|
|
6144
6703
|
* Supports both image inputs (for image-to-video) and video inputs (for editing).
|
|
@@ -6576,4 +7135,4 @@ type VideoModelV3 = {
|
|
|
6576
7135
|
}>;
|
|
6577
7136
|
};
|
|
6578
7137
|
|
|
6579
|
-
export { AISDKError, APICallError, type EmbeddingModelV2, type EmbeddingModelV2Embedding, type EmbeddingModelV3, type EmbeddingModelV3CallOptions, type EmbeddingModelV3Embedding, type EmbeddingModelV3Middleware, type EmbeddingModelV3Result, type EmbeddingModelV4, type EmbeddingModelV4CallOptions, type EmbeddingModelV4Embedding, type EmbeddingModelV4Middleware, type EmbeddingModelV4Result, EmptyResponseBodyError, type VideoModelV3 as Experimental_VideoModelV3, type VideoModelV3CallOptions as Experimental_VideoModelV3CallOptions, type VideoModelV3File as Experimental_VideoModelV3File, type VideoModelV3VideoData as Experimental_VideoModelV3VideoData, type VideoModelV4 as Experimental_VideoModelV4, type VideoModelV4CallOptions as Experimental_VideoModelV4CallOptions, type VideoModelV4File as Experimental_VideoModelV4File, type VideoModelV4Result as Experimental_VideoModelV4Result, type VideoModelV4VideoData as Experimental_VideoModelV4VideoData, type FilesV4, type FilesV4UploadFileCallOptions, type FilesV4UploadFileResult, type ImageModelV2, type ImageModelV2CallOptions, type ImageModelV2CallWarning, type ImageModelV2ProviderMetadata, type ImageModelV3, type ImageModelV3CallOptions, type ImageModelV3File, type ImageModelV3Middleware, type ImageModelV3ProviderMetadata, type ImageModelV3Usage, type ImageModelV4, type ImageModelV4CallOptions, type ImageModelV4File, type ImageModelV4Middleware, type ImageModelV4ProviderMetadata, type ImageModelV4Result, type ImageModelV4Usage, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, type JSONArray, type JSONObject, JSONParseError, type JSONValue, type LanguageModelV2, type LanguageModelV2CallOptions, type LanguageModelV2CallWarning, type LanguageModelV2Content, type LanguageModelV2DataContent, type LanguageModelV2File, type LanguageModelV2FilePart, type LanguageModelV2FinishReason, type LanguageModelV2FunctionTool, type LanguageModelV2Message, type LanguageModelV2Middleware, type LanguageModelV2Prompt, type LanguageModelV2ProviderDefinedTool, type LanguageModelV2Reasoning, type LanguageModelV2ReasoningPart, type LanguageModelV2ResponseMetadata, type LanguageModelV2Source, type LanguageModelV2StreamPart, type LanguageModelV2Text, type LanguageModelV2TextPart, type LanguageModelV2ToolCall, type LanguageModelV2ToolCallPart, type LanguageModelV2ToolChoice, type LanguageModelV2ToolResultOutput, type LanguageModelV2ToolResultPart, type LanguageModelV2Usage, type LanguageModelV3, type LanguageModelV3CallOptions, type LanguageModelV3Content, type LanguageModelV3DataContent, type LanguageModelV3File, type LanguageModelV3FilePart, type LanguageModelV3FinishReason, type LanguageModelV3FunctionTool, type LanguageModelV3GenerateResult, type LanguageModelV3Message, type LanguageModelV3Middleware, type LanguageModelV3Prompt, type LanguageModelV3ProviderTool, type LanguageModelV3Reasoning, type LanguageModelV3ReasoningPart, type LanguageModelV3ResponseMetadata, type LanguageModelV3Source, type LanguageModelV3StreamPart, type LanguageModelV3StreamResult, type LanguageModelV3Text, type LanguageModelV3TextPart, type LanguageModelV3ToolApprovalRequest, type LanguageModelV3ToolApprovalResponsePart, type LanguageModelV3ToolCall, type LanguageModelV3ToolCallPart, type LanguageModelV3ToolChoice, type LanguageModelV3ToolResult, type LanguageModelV3ToolResultOutput, type LanguageModelV3ToolResultPart, type LanguageModelV3Usage, type LanguageModelV4, type LanguageModelV4CallOptions, type LanguageModelV4Content, type LanguageModelV4CustomContent, type LanguageModelV4CustomPart, type
|
|
7138
|
+
export { AISDKError, APICallError, type EmbeddingModelV2, type EmbeddingModelV2Embedding, type EmbeddingModelV3, type EmbeddingModelV3CallOptions, type EmbeddingModelV3Embedding, type EmbeddingModelV3Middleware, type EmbeddingModelV3Result, type EmbeddingModelV4, type EmbeddingModelV4CallOptions, type EmbeddingModelV4Embedding, type EmbeddingModelV4Middleware, type EmbeddingModelV4Result, EmptyResponseBodyError, type RealtimeFactoryV4 as Experimental_RealtimeFactoryV4, type RealtimeFactoryV4GetTokenOptions as Experimental_RealtimeFactoryV4GetTokenOptions, type RealtimeFactoryV4GetTokenResult as Experimental_RealtimeFactoryV4GetTokenResult, type RealtimeModelV4 as Experimental_RealtimeModelV4, type RealtimeModelV4AudioMessage as Experimental_RealtimeModelV4AudioMessage, type RealtimeModelV4ClientEvent as Experimental_RealtimeModelV4ClientEvent, type RealtimeModelV4ClientSecretOptions as Experimental_RealtimeModelV4ClientSecretOptions, type RealtimeModelV4ClientSecretResult as Experimental_RealtimeModelV4ClientSecretResult, type RealtimeModelV4ConversationItem as Experimental_RealtimeModelV4ConversationItem, type RealtimeModelV4FunctionCallOutput as Experimental_RealtimeModelV4FunctionCallOutput, type RealtimeModelV4ServerEvent as Experimental_RealtimeModelV4ServerEvent, type RealtimeModelV4SessionConfig as Experimental_RealtimeModelV4SessionConfig, type RealtimeModelV4TextMessage as Experimental_RealtimeModelV4TextMessage, type RealtimeModelV4ToolDefinition as Experimental_RealtimeModelV4ToolDefinition, type VideoModelV3 as Experimental_VideoModelV3, type VideoModelV3CallOptions as Experimental_VideoModelV3CallOptions, type VideoModelV3File as Experimental_VideoModelV3File, type VideoModelV3VideoData as Experimental_VideoModelV3VideoData, type VideoModelV4 as Experimental_VideoModelV4, type VideoModelV4CallOptions as Experimental_VideoModelV4CallOptions, type VideoModelV4File as Experimental_VideoModelV4File, type VideoModelV4Result as Experimental_VideoModelV4Result, type VideoModelV4VideoData as Experimental_VideoModelV4VideoData, type FilesV4, type FilesV4UploadFileCallOptions, type FilesV4UploadFileResult, type ImageModelV2, type ImageModelV2CallOptions, type ImageModelV2CallWarning, type ImageModelV2ProviderMetadata, type ImageModelV3, type ImageModelV3CallOptions, type ImageModelV3File, type ImageModelV3Middleware, type ImageModelV3ProviderMetadata, type ImageModelV3Usage, type ImageModelV4, type ImageModelV4CallOptions, type ImageModelV4File, type ImageModelV4Middleware, type ImageModelV4ProviderMetadata, type ImageModelV4Result, type ImageModelV4Usage, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, type JSONArray, type JSONObject, JSONParseError, type JSONValue, type LanguageModelV2, type LanguageModelV2CallOptions, type LanguageModelV2CallWarning, type LanguageModelV2Content, type LanguageModelV2DataContent, type LanguageModelV2File, type LanguageModelV2FilePart, type LanguageModelV2FinishReason, type LanguageModelV2FunctionTool, type LanguageModelV2Message, type LanguageModelV2Middleware, type LanguageModelV2Prompt, type LanguageModelV2ProviderDefinedTool, type LanguageModelV2Reasoning, type LanguageModelV2ReasoningPart, type LanguageModelV2ResponseMetadata, type LanguageModelV2Source, type LanguageModelV2StreamPart, type LanguageModelV2Text, type LanguageModelV2TextPart, type LanguageModelV2ToolCall, type LanguageModelV2ToolCallPart, type LanguageModelV2ToolChoice, type LanguageModelV2ToolResultOutput, type LanguageModelV2ToolResultPart, type LanguageModelV2Usage, type LanguageModelV3, type LanguageModelV3CallOptions, type LanguageModelV3Content, type LanguageModelV3DataContent, type LanguageModelV3File, type LanguageModelV3FilePart, type LanguageModelV3FinishReason, type LanguageModelV3FunctionTool, type LanguageModelV3GenerateResult, type LanguageModelV3Message, type LanguageModelV3Middleware, type LanguageModelV3Prompt, type LanguageModelV3ProviderTool, type LanguageModelV3Reasoning, type LanguageModelV3ReasoningPart, type LanguageModelV3ResponseMetadata, type LanguageModelV3Source, type LanguageModelV3StreamPart, type LanguageModelV3StreamResult, type LanguageModelV3Text, type LanguageModelV3TextPart, type LanguageModelV3ToolApprovalRequest, type LanguageModelV3ToolApprovalResponsePart, type LanguageModelV3ToolCall, type LanguageModelV3ToolCallPart, type LanguageModelV3ToolChoice, type LanguageModelV3ToolResult, type LanguageModelV3ToolResultOutput, type LanguageModelV3ToolResultPart, type LanguageModelV3Usage, type LanguageModelV4, type LanguageModelV4CallOptions, type LanguageModelV4Content, type LanguageModelV4CustomContent, type LanguageModelV4CustomPart, type LanguageModelV4File, type LanguageModelV4FilePart, type LanguageModelV4FinishReason, type LanguageModelV4FunctionTool, type LanguageModelV4GenerateResult, type LanguageModelV4Message, type LanguageModelV4Middleware, type LanguageModelV4Prompt, type LanguageModelV4ProviderTool, type LanguageModelV4Reasoning, type LanguageModelV4ReasoningFile, type LanguageModelV4ReasoningFilePart, type LanguageModelV4ReasoningPart, type LanguageModelV4ResponseMetadata, type LanguageModelV4Source, type LanguageModelV4StreamPart, type LanguageModelV4StreamResult, type LanguageModelV4Text, type LanguageModelV4TextPart, type LanguageModelV4ToolApprovalRequest, type LanguageModelV4ToolApprovalResponsePart, type LanguageModelV4ToolCall, type LanguageModelV4ToolCallPart, type LanguageModelV4ToolChoice, type LanguageModelV4ToolResult, type LanguageModelV4ToolResultOutput, type LanguageModelV4ToolResultPart, type LanguageModelV4Usage, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, NoSuchProviderReferenceError, type ProviderV2, type ProviderV3, type ProviderV4, type RerankingModelV3, type RerankingModelV3CallOptions, type RerankingModelV4, type RerankingModelV4CallOptions, type RerankingModelV4Result, type SharedV2Headers, type SharedV2ProviderMetadata, type SharedV2ProviderOptions, type SharedV3Headers, type SharedV3ProviderMetadata, type SharedV3ProviderOptions, type SharedV3Warning, type SharedV4FileData, type SharedV4FileDataData, type SharedV4FileDataReference, type SharedV4FileDataText, type SharedV4FileDataUrl, type SharedV4Headers, type SharedV4ProviderMetadata, type SharedV4ProviderOptions, type SharedV4ProviderReference, type SharedV4Warning, type SkillsV4, type SkillsV4File, type SkillsV4UploadSkillCallOptions, type SkillsV4UploadSkillResult, type SpeechModelV2, type SpeechModelV2CallOptions, type SpeechModelV2CallWarning, type SpeechModelV3, type SpeechModelV3CallOptions, type SpeechModelV4, type SpeechModelV4CallOptions, type SpeechModelV4Result, TooManyEmbeddingValuesForCallError, type TranscriptionModelV2, type TranscriptionModelV2CallOptions, type TranscriptionModelV2CallWarning, type TranscriptionModelV3, type TranscriptionModelV3CallOptions, type TranscriptionModelV4, type TranscriptionModelV4CallOptions, type TranscriptionModelV4Result, type TypeValidationContext, TypeValidationError, UnsupportedFunctionalityError, getErrorMessage, isJSONArray, isJSONObject, isJSONValue };
|