@tanstack/ai-byteplus 0.0.0
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/LICENSE +21 -0
- package/README.md +202 -0
- package/dist/esm/adapters/image.d.ts +89 -0
- package/dist/esm/adapters/image.js +229 -0
- package/dist/esm/adapters/image.js.map +1 -0
- package/dist/esm/adapters/text.d.ts +163 -0
- package/dist/esm/adapters/text.js +347 -0
- package/dist/esm/adapters/text.js.map +1 -0
- package/dist/esm/adapters/transcription.d.ts +102 -0
- package/dist/esm/adapters/transcription.js +274 -0
- package/dist/esm/adapters/transcription.js.map +1 -0
- package/dist/esm/adapters/tts.d.ts +143 -0
- package/dist/esm/adapters/tts.js +307 -0
- package/dist/esm/adapters/tts.js.map +1 -0
- package/dist/esm/adapters/video.d.ts +182 -0
- package/dist/esm/adapters/video.js +442 -0
- package/dist/esm/adapters/video.js.map +1 -0
- package/dist/esm/audio/transcription-provider-options.d.ts +46 -0
- package/dist/esm/audio/tts-provider-options.d.ts +114 -0
- package/dist/esm/audio/wire-types.d.ts +261 -0
- package/dist/esm/audio/wire-types.js +28 -0
- package/dist/esm/audio/wire-types.js.map +1 -0
- package/dist/esm/image/image-provider-options.d.ts +165 -0
- package/dist/esm/image/image-provider-options.js +134 -0
- package/dist/esm/image/image-provider-options.js.map +1 -0
- package/dist/esm/image/wire-types.d.ts +149 -0
- package/dist/esm/index.d.ts +25 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/message-types.d.ts +154 -0
- package/dist/esm/model-meta.d.ts +594 -0
- package/dist/esm/model-meta.js +619 -0
- package/dist/esm/model-meta.js.map +1 -0
- package/dist/esm/text/text-provider-options.d.ts +109 -0
- package/dist/esm/utils/client.d.ts +183 -0
- package/dist/esm/utils/client.js +253 -0
- package/dist/esm/utils/client.js.map +1 -0
- package/dist/esm/video/video-provider-options.d.ts +197 -0
- package/dist/esm/video/video-provider-options.js +191 -0
- package/dist/esm/video/video-provider-options.js.map +1 -0
- package/dist/esm/video/wire-types.d.ts +248 -0
- package/package.json +77 -0
- package/src/adapters/image.ts +409 -0
- package/src/adapters/text.ts +539 -0
- package/src/adapters/transcription.ts +479 -0
- package/src/adapters/tts.ts +447 -0
- package/src/adapters/video.ts +732 -0
- package/src/audio/transcription-provider-options.ts +46 -0
- package/src/audio/tts-provider-options.ts +122 -0
- package/src/audio/wire-types.ts +290 -0
- package/src/image/image-provider-options.ts +288 -0
- package/src/image/wire-types.ts +169 -0
- package/src/index.ts +222 -0
- package/src/message-types.ts +169 -0
- package/src/model-meta.ts +954 -0
- package/src/text/text-provider-options.ts +151 -0
- package/src/utils/client.ts +377 -0
- package/src/video/video-provider-options.ts +361 -0
- package/src/video/wire-types.ts +293 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BytePlus ModelArk chat message types.
|
|
3
|
+
*
|
|
4
|
+
* Ark's `/chat/completions` wire format is OpenAI Chat Completions plus a few
|
|
5
|
+
* Ark-only extensions, so the OpenAI SDK types (via `@tanstack/openai-base`)
|
|
6
|
+
* cover everything except the fields below. This file is the source of truth
|
|
7
|
+
* for the Ark-only parts of a chat message:
|
|
8
|
+
*
|
|
9
|
+
* - `encrypted_content` on the assistant message (thinking-summary models)
|
|
10
|
+
* - `video_url` content parts (no OpenAI equivalent)
|
|
11
|
+
* - `input_audio` accepting a `url` as well as inline base64
|
|
12
|
+
*
|
|
13
|
+
* Field shapes verified live against
|
|
14
|
+
* `https://ark.ap-southeast.bytepluses.com/api/v3` on 2026-07-31 — see the
|
|
15
|
+
* probe findings referenced from `model-meta.ts`.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Opaque signature blob emitted alongside `reasoning_content` by the
|
|
20
|
+
* thinking-summary models (see `BYTEPLUS_THINKING_SUMMARY_MODELS`).
|
|
21
|
+
*
|
|
22
|
+
* Non-streaming responses carry it on `choices[].message.encrypted_content`;
|
|
23
|
+
* streaming delivers the whole blob as one dedicated chunk
|
|
24
|
+
* (`delta.encrypted_content`, with empty `content` / `reasoning_content`)
|
|
25
|
+
* between the reasoning deltas and the content deltas.
|
|
26
|
+
*
|
|
27
|
+
* When present it should be echoed back verbatim on the assistant message in
|
|
28
|
+
* the next turn. Probing showed omitting it does *not* fail a request, so it
|
|
29
|
+
* is preserved-and-replayed rather than required.
|
|
30
|
+
*/
|
|
31
|
+
export interface BytePlusEncryptedContentFields {
|
|
32
|
+
encrypted_content?: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Streaming delta fields Ark adds on top of the OpenAI chunk shape.
|
|
37
|
+
*/
|
|
38
|
+
export interface BytePlusStreamDeltaExtras extends BytePlusEncryptedContentFields {
|
|
39
|
+
reasoning_content?: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Bounds on how large an image is scaled to before tokenization.
|
|
44
|
+
*
|
|
45
|
+
* Probe-verified to live *inside* `image_url` (a number at the content-part
|
|
46
|
+
* level is silently ignored; Ark validates the object form — asking for
|
|
47
|
+
* `min_pixels` below the model's floor is rejected with a specific error).
|
|
48
|
+
*/
|
|
49
|
+
export interface BytePlusImagePixelLimit {
|
|
50
|
+
max_pixels?: number
|
|
51
|
+
min_pixels?: number
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Image content part. Ark's `image_url` extends OpenAI's with an `xhigh`
|
|
56
|
+
* detail level and {@link BytePlusImagePixelLimit}.
|
|
57
|
+
*/
|
|
58
|
+
export interface BytePlusImageUrlContentPart {
|
|
59
|
+
type: 'image_url'
|
|
60
|
+
image_url: {
|
|
61
|
+
url: string
|
|
62
|
+
detail?: 'auto' | 'low' | 'high' | 'xhigh'
|
|
63
|
+
image_pixel_limit?: BytePlusImagePixelLimit
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Video content part. Ark accepts a public URL or a `data:` URI; there is no
|
|
69
|
+
* OpenAI Chat Completions equivalent, so this shape is defined here.
|
|
70
|
+
*/
|
|
71
|
+
export interface BytePlusVideoUrlContentPart {
|
|
72
|
+
type: 'video_url'
|
|
73
|
+
video_url: {
|
|
74
|
+
url: string
|
|
75
|
+
/**
|
|
76
|
+
* Frame sampling rate in frames per second. Omitted by the adapter unless
|
|
77
|
+
* the caller sets it through content-part metadata.
|
|
78
|
+
*/
|
|
79
|
+
fps?: number
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Audio content part. Ark extends OpenAI's `input_audio` (inline base64 +
|
|
85
|
+
* `format`) with a `url` alternative.
|
|
86
|
+
*/
|
|
87
|
+
export interface BytePlusInputAudioContentPart {
|
|
88
|
+
type: 'input_audio'
|
|
89
|
+
input_audio: {
|
|
90
|
+
/** Base64 audio payload. Mutually exclusive with `url`. */
|
|
91
|
+
data?: string
|
|
92
|
+
/** Container format of `data`. Required whenever `data` is set. */
|
|
93
|
+
format?: 'wav' | 'mp3' | 'ogg' | 'flac' | 'm4a' | 'aac' | 'pcm'
|
|
94
|
+
/** Public audio URL. Mutually exclusive with `data`. */
|
|
95
|
+
url?: string
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The Ark-only content parts, as a single union. The adapter funnels these
|
|
101
|
+
* through one documented cast when handing them to the OpenAI SDK, whose
|
|
102
|
+
* content-part union has no arm for `video_url`, for URL-addressed audio, or
|
|
103
|
+
* for the extra `image_url` fields.
|
|
104
|
+
*/
|
|
105
|
+
export type BytePlusChatContentPart =
|
|
106
|
+
| BytePlusImageUrlContentPart
|
|
107
|
+
| BytePlusVideoUrlContentPart
|
|
108
|
+
| BytePlusInputAudioContentPart
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Metadata for BytePlus text content parts. Ark has no text-part options.
|
|
112
|
+
*/
|
|
113
|
+
export interface BytePlusTextMetadata {}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Metadata for BytePlus image content parts.
|
|
117
|
+
*/
|
|
118
|
+
export interface BytePlusImageMetadata {
|
|
119
|
+
/**
|
|
120
|
+
* Processing detail for the image. Ark adds `xhigh` to OpenAI's set.
|
|
121
|
+
*
|
|
122
|
+
* @default 'auto'
|
|
123
|
+
*/
|
|
124
|
+
detail?: 'auto' | 'low' | 'high' | 'xhigh'
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Bounds the pixel count the image is scaled to before tokenization —
|
|
128
|
+
* see {@link BytePlusImagePixelLimit}. Lower `max_pixels` trades detail for
|
|
129
|
+
* input tokens.
|
|
130
|
+
*/
|
|
131
|
+
image_pixel_limit?: BytePlusImagePixelLimit
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Metadata for BytePlus audio content parts.
|
|
136
|
+
*/
|
|
137
|
+
export interface BytePlusAudioMetadata {
|
|
138
|
+
/**
|
|
139
|
+
* Container format for inline base64 audio. Inferred from the part's
|
|
140
|
+
* `mimeType` when omitted.
|
|
141
|
+
*/
|
|
142
|
+
format?: BytePlusInputAudioContentPart['input_audio']['format']
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Metadata for BytePlus video content parts.
|
|
147
|
+
*/
|
|
148
|
+
export interface BytePlusVideoMetadata {
|
|
149
|
+
/** Frame sampling rate in frames per second. */
|
|
150
|
+
fps?: number
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Metadata for BytePlus document content parts. Ark's chat API takes no
|
|
155
|
+
* document parts — the field exists so the modality map stays total.
|
|
156
|
+
*/
|
|
157
|
+
export interface BytePlusDocumentMetadata {}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Map of modality to BytePlus-specific content-part metadata. Used for type
|
|
161
|
+
* inference when constructing multimodal messages.
|
|
162
|
+
*/
|
|
163
|
+
export interface BytePlusMessageMetadataByModality {
|
|
164
|
+
text: BytePlusTextMetadata
|
|
165
|
+
image: BytePlusImageMetadata
|
|
166
|
+
audio: BytePlusAudioMetadata
|
|
167
|
+
video: BytePlusVideoMetadata
|
|
168
|
+
document: BytePlusDocumentMetadata
|
|
169
|
+
}
|