@pipedog/openai 0.0.0 → 0.3.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 +25 -0
- package/NOTICE +9 -0
- package/dist/_constants.d.ts +4 -0
- package/dist/_constants.js +9 -0
- package/dist/base_llm.d.ts +272 -0
- package/dist/base_llm.js +619 -0
- package/dist/image.d.ts +116 -0
- package/dist/image.js +179 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +12 -0
- package/dist/live/events.d.ts +768 -0
- package/dist/live/events.js +1020 -0
- package/dist/live/index.d.ts +2 -0
- package/dist/live/index.js +8 -0
- package/dist/live/llm.d.ts +566 -0
- package/dist/live/llm.js +1652 -0
- package/dist/llm.d.ts +30 -0
- package/dist/llm.js +50 -0
- package/dist/open_ai_live_adapter.d.ts +94 -0
- package/dist/open_ai_live_adapter.js +192 -0
- package/dist/open_ai_realtime_adapter.d.ts +95 -0
- package/dist/open_ai_realtime_adapter.js +221 -0
- package/dist/open_ai_responses_adapter.d.ts +95 -0
- package/dist/open_ai_responses_adapter.js +358 -0
- package/dist/realtime/events.d.ts +1401 -0
- package/dist/realtime/events.js +1639 -0
- package/dist/realtime/index.d.ts +2 -0
- package/dist/realtime/index.js +8 -0
- package/dist/realtime/llm.d.ts +457 -0
- package/dist/realtime/llm.js +1550 -0
- package/dist/responses/index.d.ts +2 -0
- package/dist/responses/index.js +8 -0
- package/dist/responses/llm.d.ts +448 -0
- package/dist/responses/llm.js +1517 -0
- package/dist/stt.d.ts +409 -0
- package/dist/stt.js +741 -0
- package/dist/tts.d.ts +86 -0
- package/dist/tts.js +238 -0
- package/package.json +49 -3
- package/README.md +0 -5
|
@@ -0,0 +1,1401 @@
|
|
|
1
|
+
import type { DirectFunction } from "@pipedog/core/adapters/schemas/direct_function";
|
|
2
|
+
import type { FunctionSchema } from "@pipedog/core/adapters/schemas/function_schema";
|
|
3
|
+
import { ToolsSchema } from "@pipedog/core/adapters/schemas/tools_schema";
|
|
4
|
+
/** A modality the model can respond with. */
|
|
5
|
+
export type Modality = "text" | "audio";
|
|
6
|
+
/** How much detail the model should read out of an image. */
|
|
7
|
+
export type ImageDetail = "auto" | "low" | "high";
|
|
8
|
+
/** Raised when data does not match a model, like pydantic's `ValidationError`. */
|
|
9
|
+
export declare class ValidationError extends Error {
|
|
10
|
+
name: string;
|
|
11
|
+
}
|
|
12
|
+
/** Options for `BaseModel.modelDump()`. */
|
|
13
|
+
export interface ModelDumpOptions {
|
|
14
|
+
/** Leave out fields whose value is `null` (pydantic's `exclude_none`). */
|
|
15
|
+
excludeNone?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** Builds a nested field's value from wire data. */
|
|
18
|
+
type Resolver = (value: unknown) => unknown;
|
|
19
|
+
/**
|
|
20
|
+
* Base of the models in this module (pydantic's `BaseModel`).
|
|
21
|
+
*
|
|
22
|
+
* Fields are the instance's own properties, in declaration order (base class
|
|
23
|
+
* fields first, as pydantic orders them).
|
|
24
|
+
*/
|
|
25
|
+
export declare class BaseModel {
|
|
26
|
+
/** Fields holding nested models, by field name: how to build each from wire data. */
|
|
27
|
+
static _nested: Record<string, Resolver>;
|
|
28
|
+
/** Whether keys that match no field are kept (pydantic's `extra="allow"`). */
|
|
29
|
+
static _extraAllowed: boolean;
|
|
30
|
+
/** Extra fields kept from wire data (pydantic's `model_extra`), by wire key. */
|
|
31
|
+
get modelExtra(): Record<string, unknown> | null;
|
|
32
|
+
/**
|
|
33
|
+
* Validate wire data (snake_case keys) into a model (pydantic's
|
|
34
|
+
* `model_validate`). An instance of the model is returned as is.
|
|
35
|
+
*/
|
|
36
|
+
static modelValidate<T extends BaseModel>(this: new (options: any) => T, data: unknown): T;
|
|
37
|
+
/**
|
|
38
|
+
* Serialize the model to a plain object with the wire (snake_case) keys
|
|
39
|
+
* (pydantic's `model_dump`).
|
|
40
|
+
*/
|
|
41
|
+
modelDump(options?: ModelDumpOptions): Record<string, any>;
|
|
42
|
+
/** JSON form: the wire dump. */
|
|
43
|
+
toJSON(): Record<string, any>;
|
|
44
|
+
/**
|
|
45
|
+
* Shallow copy of the model, with `update` (camelCase field names) applied
|
|
46
|
+
* (pydantic's `model_copy`).
|
|
47
|
+
*/
|
|
48
|
+
modelCopy(options?: {
|
|
49
|
+
update?: Record<string, unknown>;
|
|
50
|
+
}): this;
|
|
51
|
+
}
|
|
52
|
+
export interface AudioFormatOptions {
|
|
53
|
+
type?: string;
|
|
54
|
+
}
|
|
55
|
+
/** Base class for audio format configuration. */
|
|
56
|
+
export declare class AudioFormat extends BaseModel {
|
|
57
|
+
type: string;
|
|
58
|
+
constructor(options: AudioFormatOptions);
|
|
59
|
+
}
|
|
60
|
+
export interface PCMAudioFormatOptions {
|
|
61
|
+
type?: "audio/pcm";
|
|
62
|
+
rate?: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* PCM audio format configuration.
|
|
66
|
+
*
|
|
67
|
+
* - `type`: audio format type, always "audio/pcm".
|
|
68
|
+
* - `rate`: sample rate, always 24000 for PCM.
|
|
69
|
+
*/
|
|
70
|
+
export declare class PCMAudioFormat extends AudioFormat {
|
|
71
|
+
type: "audio/pcm";
|
|
72
|
+
rate: number;
|
|
73
|
+
constructor(options?: PCMAudioFormatOptions);
|
|
74
|
+
}
|
|
75
|
+
export interface PCMUAudioFormatOptions {
|
|
76
|
+
type?: "audio/pcmu";
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* PCMU (G.711 μ-law) audio format configuration.
|
|
80
|
+
*
|
|
81
|
+
* - `type`: audio format type, always "audio/pcmu".
|
|
82
|
+
*/
|
|
83
|
+
export declare class PCMUAudioFormat extends AudioFormat {
|
|
84
|
+
type: "audio/pcmu";
|
|
85
|
+
constructor(options?: PCMUAudioFormatOptions);
|
|
86
|
+
}
|
|
87
|
+
export interface PCMAAudioFormatOptions {
|
|
88
|
+
type?: "audio/pcma";
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* PCMA (G.711 A-law) audio format configuration.
|
|
92
|
+
*
|
|
93
|
+
* - `type`: audio format type, always "audio/pcma".
|
|
94
|
+
*/
|
|
95
|
+
export declare class PCMAAudioFormat extends AudioFormat {
|
|
96
|
+
type: "audio/pcma";
|
|
97
|
+
constructor(options?: PCMAAudioFormatOptions);
|
|
98
|
+
}
|
|
99
|
+
export interface InputAudioTranscriptionOptions {
|
|
100
|
+
/**
|
|
101
|
+
* Transcription model to use (e.g. "gpt-realtime-whisper",
|
|
102
|
+
* "gpt-4o-transcribe", "whisper-1").
|
|
103
|
+
*/
|
|
104
|
+
model?: string | null;
|
|
105
|
+
/** Optional language code for transcription. */
|
|
106
|
+
language?: string | null;
|
|
107
|
+
/** Optional transcription hint text. */
|
|
108
|
+
prompt?: string | null;
|
|
109
|
+
}
|
|
110
|
+
/** Configuration for audio transcription settings. */
|
|
111
|
+
export declare class InputAudioTranscription extends BaseModel {
|
|
112
|
+
model: string;
|
|
113
|
+
language: string | null;
|
|
114
|
+
prompt: string | null;
|
|
115
|
+
/**
|
|
116
|
+
* Initialize InputAudioTranscription.
|
|
117
|
+
*
|
|
118
|
+
* @param options.model Transcription model to use (e.g.
|
|
119
|
+
* "gpt-realtime-whisper", "gpt-4o-transcribe", "whisper-1").
|
|
120
|
+
* @param options.language Optional language code for transcription.
|
|
121
|
+
* @param options.prompt Optional transcription hint text.
|
|
122
|
+
*/
|
|
123
|
+
constructor(options?: InputAudioTranscriptionOptions);
|
|
124
|
+
}
|
|
125
|
+
export interface TurnDetectionOptions {
|
|
126
|
+
type?: "server_vad" | null;
|
|
127
|
+
threshold?: number | null;
|
|
128
|
+
prefixPaddingMs?: number | null;
|
|
129
|
+
silenceDurationMs?: number | null;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Server-side voice activity detection configuration.
|
|
133
|
+
*
|
|
134
|
+
* - `type`: detection type, must be "server_vad".
|
|
135
|
+
* - `threshold`: voice activity detection threshold (0.0-1.0). Defaults to 0.5.
|
|
136
|
+
* - `prefixPaddingMs`: padding before speech starts in milliseconds. Defaults to 300.
|
|
137
|
+
* - `silenceDurationMs`: silence duration to detect speech end in milliseconds.
|
|
138
|
+
* Defaults to 500.
|
|
139
|
+
*/
|
|
140
|
+
export declare class TurnDetection extends BaseModel {
|
|
141
|
+
type: "server_vad" | null;
|
|
142
|
+
threshold: number | null;
|
|
143
|
+
prefixPaddingMs: number | null;
|
|
144
|
+
silenceDurationMs: number | null;
|
|
145
|
+
constructor(options?: TurnDetectionOptions);
|
|
146
|
+
}
|
|
147
|
+
export interface SemanticTurnDetectionOptions {
|
|
148
|
+
type?: "semantic_vad" | null;
|
|
149
|
+
eagerness?: "low" | "medium" | "high" | "auto" | null;
|
|
150
|
+
createResponse?: boolean | null;
|
|
151
|
+
interruptResponse?: boolean | null;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Semantic-based turn detection configuration.
|
|
155
|
+
*
|
|
156
|
+
* - `type`: detection type, must be "semantic_vad".
|
|
157
|
+
* - `eagerness`: turn detection eagerness level. Can be "low", "medium",
|
|
158
|
+
* "high", or "auto".
|
|
159
|
+
* - `createResponse`: whether to automatically create responses on turn detection.
|
|
160
|
+
* - `interruptResponse`: whether to interrupt ongoing responses on turn detection.
|
|
161
|
+
*/
|
|
162
|
+
export declare class SemanticTurnDetection extends BaseModel {
|
|
163
|
+
type: "semantic_vad" | null;
|
|
164
|
+
eagerness: "low" | "medium" | "high" | "auto" | null;
|
|
165
|
+
createResponse: boolean | null;
|
|
166
|
+
interruptResponse: boolean | null;
|
|
167
|
+
constructor(options?: SemanticTurnDetectionOptions);
|
|
168
|
+
}
|
|
169
|
+
export interface InputAudioNoiseReductionOptions {
|
|
170
|
+
type: "near_field" | "far_field" | null;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Input audio noise reduction configuration.
|
|
174
|
+
*
|
|
175
|
+
* - `type`: noise reduction type for different microphone scenarios.
|
|
176
|
+
*/
|
|
177
|
+
export declare class InputAudioNoiseReduction extends BaseModel {
|
|
178
|
+
type: "near_field" | "far_field" | null;
|
|
179
|
+
constructor(options: InputAudioNoiseReductionOptions);
|
|
180
|
+
}
|
|
181
|
+
export interface AudioInputOptions {
|
|
182
|
+
format?: PCMAudioFormat | PCMUAudioFormat | PCMAAudioFormat | null;
|
|
183
|
+
transcription?: InputAudioTranscription | null;
|
|
184
|
+
noiseReduction?: InputAudioNoiseReduction | null;
|
|
185
|
+
turnDetection?: TurnDetection | SemanticTurnDetection | boolean | null;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Audio input configuration.
|
|
189
|
+
*
|
|
190
|
+
* - `format`: the format of the input audio.
|
|
191
|
+
* - `transcription`: configuration for input audio transcription.
|
|
192
|
+
* - `noiseReduction`: configuration for input audio noise reduction.
|
|
193
|
+
* - `turnDetection`: configuration for turn detection, or false to disable.
|
|
194
|
+
*/
|
|
195
|
+
export declare class AudioInput extends BaseModel {
|
|
196
|
+
static _nested: Record<string, Resolver>;
|
|
197
|
+
format: PCMAudioFormat | PCMUAudioFormat | PCMAAudioFormat | null;
|
|
198
|
+
transcription: InputAudioTranscription | null;
|
|
199
|
+
noiseReduction: InputAudioNoiseReduction | null;
|
|
200
|
+
turnDetection: TurnDetection | SemanticTurnDetection | boolean | null;
|
|
201
|
+
constructor(options?: AudioInputOptions);
|
|
202
|
+
}
|
|
203
|
+
export interface AudioOutputOptions {
|
|
204
|
+
format?: PCMAudioFormat | PCMUAudioFormat | PCMAAudioFormat | null;
|
|
205
|
+
voice?: string | null;
|
|
206
|
+
speed?: number | null;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Audio output configuration.
|
|
210
|
+
*
|
|
211
|
+
* - `format`: the format of the output audio.
|
|
212
|
+
* - `voice`: the voice the model uses to respond.
|
|
213
|
+
* - `speed`: the speed of the model's spoken response.
|
|
214
|
+
*/
|
|
215
|
+
export declare class AudioOutput extends BaseModel {
|
|
216
|
+
static _nested: Record<string, Resolver>;
|
|
217
|
+
format: PCMAudioFormat | PCMUAudioFormat | PCMAAudioFormat | null;
|
|
218
|
+
voice: string | null;
|
|
219
|
+
speed: number | null;
|
|
220
|
+
constructor(options?: AudioOutputOptions);
|
|
221
|
+
}
|
|
222
|
+
export interface AudioConfigurationOptions {
|
|
223
|
+
input?: AudioInput | null;
|
|
224
|
+
output?: AudioOutput | null;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Audio configuration for input and output.
|
|
228
|
+
*
|
|
229
|
+
* - `input`: configuration for input audio.
|
|
230
|
+
* - `output`: configuration for output audio.
|
|
231
|
+
*/
|
|
232
|
+
export declare class AudioConfiguration extends BaseModel {
|
|
233
|
+
static _nested: Record<string, Resolver>;
|
|
234
|
+
input: AudioInput | null;
|
|
235
|
+
output: AudioOutput | null;
|
|
236
|
+
constructor(options?: AudioConfigurationOptions);
|
|
237
|
+
}
|
|
238
|
+
/** A reasoning effort level; any string is accepted for forward compatibility. */
|
|
239
|
+
export type ReasoningEffort = "minimal" | "low" | "medium" | "high" | "xhigh" | (string & {});
|
|
240
|
+
export interface ReasoningOptions {
|
|
241
|
+
effort?: ReasoningEffort | null;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Reasoning configuration for reasoning-capable Realtime models (e.g. `gpt-realtime-2`).
|
|
245
|
+
*
|
|
246
|
+
* - `effort`: how much reasoning effort the model should apply. `null` (the
|
|
247
|
+
* default) leaves the field unset and lets the server pick.
|
|
248
|
+
*/
|
|
249
|
+
export declare class Reasoning extends BaseModel {
|
|
250
|
+
effort: ReasoningEffort | null;
|
|
251
|
+
constructor(options?: ReasoningOptions);
|
|
252
|
+
}
|
|
253
|
+
/** The tools a session can carry. */
|
|
254
|
+
export type SessionTools = ToolsSchema | (FunctionSchema | DirectFunction)[] | Record<string, unknown>[];
|
|
255
|
+
export interface SessionPropertiesOptions {
|
|
256
|
+
type?: "realtime" | null;
|
|
257
|
+
object?: "realtime.session" | null;
|
|
258
|
+
id?: string | null;
|
|
259
|
+
model?: string | null;
|
|
260
|
+
outputModalities?: Modality[] | null;
|
|
261
|
+
instructions?: string | null;
|
|
262
|
+
audio?: AudioConfiguration | null;
|
|
263
|
+
tools?: SessionTools | null;
|
|
264
|
+
toolChoice?: "auto" | "none" | "required" | null;
|
|
265
|
+
maxOutputTokens?: number | "inf" | null;
|
|
266
|
+
tracing?: "auto" | Record<string, unknown> | null;
|
|
267
|
+
prompt?: Record<string, unknown> | null;
|
|
268
|
+
expiresAt?: number | null;
|
|
269
|
+
include?: string[] | null;
|
|
270
|
+
reasoning?: Reasoning | null;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Configuration properties for an OpenAI Realtime session.
|
|
274
|
+
*
|
|
275
|
+
* - `type`: the type of session, always "realtime".
|
|
276
|
+
* - `object`: object type identifier, always "realtime.session".
|
|
277
|
+
* - `id`: unique identifier for the session.
|
|
278
|
+
* - `model`: the Realtime model used for this session. Note: the model is set
|
|
279
|
+
* at connection time via the service settings and cannot be changed during
|
|
280
|
+
* the session.
|
|
281
|
+
* - `outputModalities`: the set of modalities the model can respond with.
|
|
282
|
+
* - `instructions`: system instructions for the assistant.
|
|
283
|
+
* - `audio`: configuration for input and output audio.
|
|
284
|
+
* - `tools`: available function tools for the assistant.
|
|
285
|
+
* - `toolChoice`: tool usage strategy ("auto", "none", or "required").
|
|
286
|
+
* - `maxOutputTokens`: maximum tokens in response or "inf" for unlimited.
|
|
287
|
+
* - `tracing`: configuration options for tracing.
|
|
288
|
+
* - `prompt`: reference to a prompt template and its variables.
|
|
289
|
+
* - `expiresAt`: session expiration timestamp.
|
|
290
|
+
* - `include`: additional fields to include in server outputs.
|
|
291
|
+
* - `reasoning`: reasoning configuration. Only supported by reasoning-capable
|
|
292
|
+
* Realtime models such as `gpt-realtime-2`.
|
|
293
|
+
*/
|
|
294
|
+
export declare class SessionProperties extends BaseModel {
|
|
295
|
+
static _nested: Record<string, Resolver>;
|
|
296
|
+
/** The model's fields (pydantic's `model_fields`): camelCase field name to wire key. */
|
|
297
|
+
static readonly modelFields: Readonly<Record<string, string>>;
|
|
298
|
+
type: "realtime" | null;
|
|
299
|
+
object: "realtime.session" | null;
|
|
300
|
+
id: string | null;
|
|
301
|
+
model: string | null;
|
|
302
|
+
outputModalities: Modality[] | null;
|
|
303
|
+
instructions: string | null;
|
|
304
|
+
audio: AudioConfiguration | null;
|
|
305
|
+
tools: SessionTools | null;
|
|
306
|
+
toolChoice: "auto" | "none" | "required" | null;
|
|
307
|
+
maxOutputTokens: number | "inf" | null;
|
|
308
|
+
tracing: "auto" | Record<string, unknown> | null;
|
|
309
|
+
prompt: Record<string, unknown> | null;
|
|
310
|
+
expiresAt: number | null;
|
|
311
|
+
include: string[] | null;
|
|
312
|
+
reasoning: Reasoning | null;
|
|
313
|
+
constructor(options?: SessionPropertiesOptions);
|
|
314
|
+
/**
|
|
315
|
+
* Wrap a plain list of standard tools in a `ToolsSchema`.
|
|
316
|
+
*
|
|
317
|
+
* Provider-native tool lists (dicts) pass through unchanged.
|
|
318
|
+
*/
|
|
319
|
+
static _normalizeTools(v: SessionTools | null): SessionTools | null;
|
|
320
|
+
}
|
|
321
|
+
export type ItemContentType = "text" | "audio" | "input_text" | "input_audio" | "input_image" | "output_text" | "output_audio";
|
|
322
|
+
export interface ItemContentOptions {
|
|
323
|
+
type: ItemContentType;
|
|
324
|
+
text?: string | null;
|
|
325
|
+
audio?: string | null;
|
|
326
|
+
transcript?: string | null;
|
|
327
|
+
imageUrl?: string | null;
|
|
328
|
+
detail?: ImageDetail | null;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Content within a conversation item.
|
|
332
|
+
*
|
|
333
|
+
* - `type`: content type (text, audio, input_text, input_audio, input_image,
|
|
334
|
+
* output_text, or output_audio).
|
|
335
|
+
* - `text`: text content for text-based items.
|
|
336
|
+
* - `audio`: base64-encoded audio data for audio items.
|
|
337
|
+
* - `transcript`: transcribed text for audio items.
|
|
338
|
+
* - `imageUrl`: base64-encoded image data as a data URI for input_image items.
|
|
339
|
+
* - `detail`: detail level for image processing ("auto", "low", or "high").
|
|
340
|
+
*/
|
|
341
|
+
export declare class ItemContent extends BaseModel {
|
|
342
|
+
type: ItemContentType;
|
|
343
|
+
text: string | null;
|
|
344
|
+
audio: string | null;
|
|
345
|
+
transcript: string | null;
|
|
346
|
+
imageUrl: string | null;
|
|
347
|
+
detail: ImageDetail | null;
|
|
348
|
+
constructor(options: ItemContentOptions);
|
|
349
|
+
}
|
|
350
|
+
export interface ConversationItemOptions {
|
|
351
|
+
id?: string;
|
|
352
|
+
object?: "realtime.item" | null;
|
|
353
|
+
type: "message" | "function_call" | "function_call_output";
|
|
354
|
+
status?: "completed" | "in_progress" | "incomplete" | null;
|
|
355
|
+
role?: "user" | "assistant" | "system" | null;
|
|
356
|
+
content?: ItemContent[] | null;
|
|
357
|
+
callId?: string | null;
|
|
358
|
+
name?: string | null;
|
|
359
|
+
arguments?: string | null;
|
|
360
|
+
output?: string | null;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* A conversation item in the realtime session.
|
|
364
|
+
*
|
|
365
|
+
* - `id`: unique identifier for the item, auto-generated if not provided.
|
|
366
|
+
* - `object`: object type identifier for the realtime API.
|
|
367
|
+
* - `type`: item type (message, function_call, or function_call_output).
|
|
368
|
+
* - `status`: current status of the item.
|
|
369
|
+
* - `role`: speaker role for message items (user, assistant, or system).
|
|
370
|
+
* - `content`: content list for message items.
|
|
371
|
+
* - `callId`: function call identifier for function_call items.
|
|
372
|
+
* - `name`: function name for function_call items.
|
|
373
|
+
* - `arguments`: function arguments as JSON string for function_call items.
|
|
374
|
+
* - `output`: function output as JSON string for function_call_output items.
|
|
375
|
+
*/
|
|
376
|
+
export declare class ConversationItem extends BaseModel {
|
|
377
|
+
static _nested: Record<string, Resolver>;
|
|
378
|
+
id: string;
|
|
379
|
+
object: "realtime.item" | null;
|
|
380
|
+
type: "message" | "function_call" | "function_call_output";
|
|
381
|
+
status: "completed" | "in_progress" | "incomplete" | null;
|
|
382
|
+
role: "user" | "assistant" | "system" | null;
|
|
383
|
+
content: ItemContent[] | null;
|
|
384
|
+
callId: string | null;
|
|
385
|
+
name: string | null;
|
|
386
|
+
arguments: string | null;
|
|
387
|
+
output: string | null;
|
|
388
|
+
constructor(options: ConversationItemOptions);
|
|
389
|
+
}
|
|
390
|
+
export interface RealtimeConversationOptions {
|
|
391
|
+
id: string;
|
|
392
|
+
object: "realtime.conversation";
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* A realtime conversation session.
|
|
396
|
+
*
|
|
397
|
+
* - `id`: unique identifier for the conversation.
|
|
398
|
+
* - `object`: object type identifier, always "realtime.conversation".
|
|
399
|
+
*/
|
|
400
|
+
export declare class RealtimeConversation extends BaseModel {
|
|
401
|
+
id: string;
|
|
402
|
+
object: "realtime.conversation";
|
|
403
|
+
constructor(options: RealtimeConversationOptions);
|
|
404
|
+
}
|
|
405
|
+
export interface ResponsePropertiesOptions {
|
|
406
|
+
outputModalities?: Modality[] | null;
|
|
407
|
+
instructions?: string | null;
|
|
408
|
+
audio?: AudioConfiguration | null;
|
|
409
|
+
tools?: Record<string, unknown>[] | null;
|
|
410
|
+
toolChoice?: "auto" | "none" | "required" | null;
|
|
411
|
+
temperature?: number | null;
|
|
412
|
+
maxOutputTokens?: number | "inf" | null;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Properties for configuring assistant responses.
|
|
416
|
+
*
|
|
417
|
+
* - `outputModalities`: output modalities for the response. Must be either
|
|
418
|
+
* ["text"] or ["audio"]. Defaults to ["audio"].
|
|
419
|
+
* - `instructions`: specific instructions for this response.
|
|
420
|
+
* - `audio`: audio configuration for this response.
|
|
421
|
+
* - `tools`: available tools for this response.
|
|
422
|
+
* - `toolChoice`: tool usage strategy for this response.
|
|
423
|
+
* - `temperature`: sampling temperature for this response.
|
|
424
|
+
* - `maxOutputTokens`: maximum tokens for this response.
|
|
425
|
+
*/
|
|
426
|
+
export declare class ResponseProperties extends BaseModel {
|
|
427
|
+
static _nested: Record<string, Resolver>;
|
|
428
|
+
outputModalities: Modality[] | null;
|
|
429
|
+
instructions: string | null;
|
|
430
|
+
audio: AudioConfiguration | null;
|
|
431
|
+
tools: Record<string, unknown>[] | null;
|
|
432
|
+
toolChoice: "auto" | "none" | "required" | null;
|
|
433
|
+
temperature: number | null;
|
|
434
|
+
maxOutputTokens: number | "inf" | null;
|
|
435
|
+
constructor(options?: ResponsePropertiesOptions);
|
|
436
|
+
}
|
|
437
|
+
export interface RealtimeErrorOptions {
|
|
438
|
+
type: string;
|
|
439
|
+
code?: string | null;
|
|
440
|
+
message: string;
|
|
441
|
+
param?: string | null;
|
|
442
|
+
eventId?: string | null;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Error information from the realtime API.
|
|
446
|
+
*
|
|
447
|
+
* - `type`: error type identifier.
|
|
448
|
+
* - `code`: specific error code.
|
|
449
|
+
* - `message`: human-readable error message.
|
|
450
|
+
* - `param`: parameter name that caused the error, if applicable.
|
|
451
|
+
* - `eventId`: event ID associated with the error, if applicable.
|
|
452
|
+
*/
|
|
453
|
+
export declare class RealtimeError extends BaseModel {
|
|
454
|
+
type: string;
|
|
455
|
+
code: string | null;
|
|
456
|
+
message: string;
|
|
457
|
+
param: string | null;
|
|
458
|
+
eventId: string | null;
|
|
459
|
+
constructor(options: RealtimeErrorOptions);
|
|
460
|
+
}
|
|
461
|
+
export interface ClientEventOptions {
|
|
462
|
+
eventId?: string;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Base class for client events sent to the realtime API.
|
|
466
|
+
*
|
|
467
|
+
* - `eventId`: unique identifier for the event, auto-generated if not provided.
|
|
468
|
+
*/
|
|
469
|
+
export declare class ClientEvent extends BaseModel {
|
|
470
|
+
eventId: string;
|
|
471
|
+
constructor(options?: ClientEventOptions);
|
|
472
|
+
}
|
|
473
|
+
export interface SessionUpdateEventOptions extends ClientEventOptions {
|
|
474
|
+
type?: "session.update";
|
|
475
|
+
session: SessionProperties;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Event to update session properties.
|
|
479
|
+
*
|
|
480
|
+
* - `type`: event type, always "session.update".
|
|
481
|
+
* - `session`: updated session properties.
|
|
482
|
+
*/
|
|
483
|
+
export declare class SessionUpdateEvent extends ClientEvent {
|
|
484
|
+
static _nested: Record<string, Resolver>;
|
|
485
|
+
type: "session.update";
|
|
486
|
+
session: SessionProperties;
|
|
487
|
+
constructor(options: SessionUpdateEventOptions);
|
|
488
|
+
/**
|
|
489
|
+
* Serialize the event to a plain object.
|
|
490
|
+
*
|
|
491
|
+
* Handles special serialization for turn_detection where false becomes null.
|
|
492
|
+
*
|
|
493
|
+
* @param options Options passed to the parent `modelDump`.
|
|
494
|
+
* @returns Object representation of the event.
|
|
495
|
+
*/
|
|
496
|
+
modelDump(options?: ModelDumpOptions): Record<string, any>;
|
|
497
|
+
}
|
|
498
|
+
export interface InputAudioBufferAppendEventOptions extends ClientEventOptions {
|
|
499
|
+
type?: "input_audio_buffer.append";
|
|
500
|
+
audio: string;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Event to append audio data to the input buffer.
|
|
504
|
+
*
|
|
505
|
+
* - `type`: event type, always "input_audio_buffer.append".
|
|
506
|
+
* - `audio`: base64-encoded audio data to append.
|
|
507
|
+
*/
|
|
508
|
+
export declare class InputAudioBufferAppendEvent extends ClientEvent {
|
|
509
|
+
type: "input_audio_buffer.append";
|
|
510
|
+
audio: string;
|
|
511
|
+
constructor(options: InputAudioBufferAppendEventOptions);
|
|
512
|
+
}
|
|
513
|
+
export interface InputAudioBufferCommitEventOptions extends ClientEventOptions {
|
|
514
|
+
type?: "input_audio_buffer.commit";
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Event to commit the current input audio buffer.
|
|
518
|
+
*
|
|
519
|
+
* - `type`: event type, always "input_audio_buffer.commit".
|
|
520
|
+
*/
|
|
521
|
+
export declare class InputAudioBufferCommitEvent extends ClientEvent {
|
|
522
|
+
type: "input_audio_buffer.commit";
|
|
523
|
+
constructor(options?: InputAudioBufferCommitEventOptions);
|
|
524
|
+
}
|
|
525
|
+
export interface InputAudioBufferClearEventOptions extends ClientEventOptions {
|
|
526
|
+
type?: "input_audio_buffer.clear";
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Event to clear the input audio buffer.
|
|
530
|
+
*
|
|
531
|
+
* - `type`: event type, always "input_audio_buffer.clear".
|
|
532
|
+
*/
|
|
533
|
+
export declare class InputAudioBufferClearEvent extends ClientEvent {
|
|
534
|
+
type: "input_audio_buffer.clear";
|
|
535
|
+
constructor(options?: InputAudioBufferClearEventOptions);
|
|
536
|
+
}
|
|
537
|
+
export interface ConversationItemCreateEventOptions extends ClientEventOptions {
|
|
538
|
+
type?: "conversation.item.create";
|
|
539
|
+
previousItemId?: string | null;
|
|
540
|
+
item: ConversationItem;
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Event to create a new conversation item.
|
|
544
|
+
*
|
|
545
|
+
* - `type`: event type, always "conversation.item.create".
|
|
546
|
+
* - `previousItemId`: ID of the item to insert after, if any.
|
|
547
|
+
* - `item`: the conversation item to create.
|
|
548
|
+
*/
|
|
549
|
+
export declare class ConversationItemCreateEvent extends ClientEvent {
|
|
550
|
+
static _nested: Record<string, Resolver>;
|
|
551
|
+
type: "conversation.item.create";
|
|
552
|
+
previousItemId: string | null;
|
|
553
|
+
item: ConversationItem;
|
|
554
|
+
constructor(options: ConversationItemCreateEventOptions);
|
|
555
|
+
}
|
|
556
|
+
export interface ConversationItemTruncateEventOptions extends ClientEventOptions {
|
|
557
|
+
type?: "conversation.item.truncate";
|
|
558
|
+
itemId: string;
|
|
559
|
+
contentIndex: number;
|
|
560
|
+
audioEndMs: number;
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Event to truncate a conversation item's audio content.
|
|
564
|
+
*
|
|
565
|
+
* - `type`: event type, always "conversation.item.truncate".
|
|
566
|
+
* - `itemId`: ID of the item to truncate.
|
|
567
|
+
* - `contentIndex`: index of the content to truncate within the item.
|
|
568
|
+
* - `audioEndMs`: end time in milliseconds for the truncated audio.
|
|
569
|
+
*/
|
|
570
|
+
export declare class ConversationItemTruncateEvent extends ClientEvent {
|
|
571
|
+
type: "conversation.item.truncate";
|
|
572
|
+
itemId: string;
|
|
573
|
+
contentIndex: number;
|
|
574
|
+
audioEndMs: number;
|
|
575
|
+
constructor(options: ConversationItemTruncateEventOptions);
|
|
576
|
+
}
|
|
577
|
+
export interface ConversationItemDeleteEventOptions extends ClientEventOptions {
|
|
578
|
+
type?: "conversation.item.delete";
|
|
579
|
+
itemId: string;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Event to delete a conversation item.
|
|
583
|
+
*
|
|
584
|
+
* - `type`: event type, always "conversation.item.delete".
|
|
585
|
+
* - `itemId`: ID of the item to delete.
|
|
586
|
+
*/
|
|
587
|
+
export declare class ConversationItemDeleteEvent extends ClientEvent {
|
|
588
|
+
type: "conversation.item.delete";
|
|
589
|
+
itemId: string;
|
|
590
|
+
constructor(options: ConversationItemDeleteEventOptions);
|
|
591
|
+
}
|
|
592
|
+
export interface ConversationItemRetrieveEventOptions extends ClientEventOptions {
|
|
593
|
+
type?: "conversation.item.retrieve";
|
|
594
|
+
itemId: string;
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Event to retrieve a conversation item by ID.
|
|
598
|
+
*
|
|
599
|
+
* - `type`: event type, always "conversation.item.retrieve".
|
|
600
|
+
* - `itemId`: ID of the item to retrieve.
|
|
601
|
+
*/
|
|
602
|
+
export declare class ConversationItemRetrieveEvent extends ClientEvent {
|
|
603
|
+
type: "conversation.item.retrieve";
|
|
604
|
+
itemId: string;
|
|
605
|
+
constructor(options: ConversationItemRetrieveEventOptions);
|
|
606
|
+
}
|
|
607
|
+
export interface ResponseCreateEventOptions extends ClientEventOptions {
|
|
608
|
+
type?: "response.create";
|
|
609
|
+
response?: ResponseProperties | null;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Event to create a new assistant response.
|
|
613
|
+
*
|
|
614
|
+
* - `type`: event type, always "response.create".
|
|
615
|
+
* - `response`: optional response configuration properties.
|
|
616
|
+
*/
|
|
617
|
+
export declare class ResponseCreateEvent extends ClientEvent {
|
|
618
|
+
static _nested: Record<string, Resolver>;
|
|
619
|
+
type: "response.create";
|
|
620
|
+
response: ResponseProperties | null;
|
|
621
|
+
constructor(options?: ResponseCreateEventOptions);
|
|
622
|
+
}
|
|
623
|
+
export interface ResponseCancelEventOptions extends ClientEventOptions {
|
|
624
|
+
type?: "response.cancel";
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Event to cancel the current assistant response.
|
|
628
|
+
*
|
|
629
|
+
* - `type`: event type, always "response.cancel".
|
|
630
|
+
*/
|
|
631
|
+
export declare class ResponseCancelEvent extends ClientEvent {
|
|
632
|
+
type: "response.cancel";
|
|
633
|
+
constructor(options?: ResponseCancelEventOptions);
|
|
634
|
+
}
|
|
635
|
+
export interface ServerEventOptions {
|
|
636
|
+
eventId: string;
|
|
637
|
+
type: string;
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Base class for server events received from the realtime API.
|
|
641
|
+
*
|
|
642
|
+
* - `eventId`: unique identifier for the event.
|
|
643
|
+
* - `type`: type of the server event.
|
|
644
|
+
*/
|
|
645
|
+
export declare class ServerEvent extends BaseModel {
|
|
646
|
+
eventId: string;
|
|
647
|
+
type: string;
|
|
648
|
+
constructor(options: ServerEventOptions);
|
|
649
|
+
}
|
|
650
|
+
export interface SessionCreatedEventOptions extends ServerEventOptions {
|
|
651
|
+
type: "session.created";
|
|
652
|
+
session: SessionProperties;
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Event indicating a session has been created.
|
|
656
|
+
*
|
|
657
|
+
* - `type`: event type, always "session.created".
|
|
658
|
+
* - `session`: the created session properties.
|
|
659
|
+
*/
|
|
660
|
+
export declare class SessionCreatedEvent extends ServerEvent {
|
|
661
|
+
static _nested: Record<string, Resolver>;
|
|
662
|
+
type: "session.created";
|
|
663
|
+
session: SessionProperties;
|
|
664
|
+
constructor(options: SessionCreatedEventOptions);
|
|
665
|
+
}
|
|
666
|
+
export interface SessionUpdatedEventOptions extends ServerEventOptions {
|
|
667
|
+
type: "session.updated";
|
|
668
|
+
session: SessionProperties;
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Event indicating a session has been updated.
|
|
672
|
+
*
|
|
673
|
+
* - `type`: event type, always "session.updated".
|
|
674
|
+
* - `session`: the updated session properties.
|
|
675
|
+
*/
|
|
676
|
+
export declare class SessionUpdatedEvent extends ServerEvent {
|
|
677
|
+
static _nested: Record<string, Resolver>;
|
|
678
|
+
type: "session.updated";
|
|
679
|
+
session: SessionProperties;
|
|
680
|
+
constructor(options: SessionUpdatedEventOptions);
|
|
681
|
+
}
|
|
682
|
+
export interface ConversationCreatedOptions extends ServerEventOptions {
|
|
683
|
+
type: "conversation.created";
|
|
684
|
+
conversation: RealtimeConversation;
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Event indicating a conversation has been created.
|
|
688
|
+
*
|
|
689
|
+
* - `type`: event type, always "conversation.created".
|
|
690
|
+
* - `conversation`: the created conversation.
|
|
691
|
+
*/
|
|
692
|
+
export declare class ConversationCreated extends ServerEvent {
|
|
693
|
+
static _nested: Record<string, Resolver>;
|
|
694
|
+
type: "conversation.created";
|
|
695
|
+
conversation: RealtimeConversation;
|
|
696
|
+
constructor(options: ConversationCreatedOptions);
|
|
697
|
+
}
|
|
698
|
+
export interface ConversationItemAddedOptions extends ServerEventOptions {
|
|
699
|
+
type: "conversation.item.added";
|
|
700
|
+
previousItemId?: string | null;
|
|
701
|
+
item: ConversationItem;
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* Event indicating a conversation item has been added.
|
|
705
|
+
*
|
|
706
|
+
* - `type`: event type, always "conversation.item.added".
|
|
707
|
+
* - `previousItemId`: ID of the previous item, if any.
|
|
708
|
+
* - `item`: the added conversation item.
|
|
709
|
+
*/
|
|
710
|
+
export declare class ConversationItemAdded extends ServerEvent {
|
|
711
|
+
static _nested: Record<string, Resolver>;
|
|
712
|
+
type: "conversation.item.added";
|
|
713
|
+
previousItemId: string | null;
|
|
714
|
+
item: ConversationItem;
|
|
715
|
+
constructor(options: ConversationItemAddedOptions);
|
|
716
|
+
}
|
|
717
|
+
export interface ConversationItemDoneOptions extends ServerEventOptions {
|
|
718
|
+
type: "conversation.item.done";
|
|
719
|
+
previousItemId?: string | null;
|
|
720
|
+
item: ConversationItem;
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Event indicating a conversation item is done processing.
|
|
724
|
+
*
|
|
725
|
+
* - `type`: event type, always "conversation.item.done".
|
|
726
|
+
* - `previousItemId`: ID of the previous item, if any.
|
|
727
|
+
* - `item`: the completed conversation item.
|
|
728
|
+
*/
|
|
729
|
+
export declare class ConversationItemDone extends ServerEvent {
|
|
730
|
+
static _nested: Record<string, Resolver>;
|
|
731
|
+
type: "conversation.item.done";
|
|
732
|
+
previousItemId: string | null;
|
|
733
|
+
item: ConversationItem;
|
|
734
|
+
constructor(options: ConversationItemDoneOptions);
|
|
735
|
+
}
|
|
736
|
+
export interface ConversationItemInputAudioTranscriptionDeltaOptions extends ServerEventOptions {
|
|
737
|
+
type: "conversation.item.input_audio_transcription.delta";
|
|
738
|
+
itemId: string;
|
|
739
|
+
contentIndex: number;
|
|
740
|
+
delta: string;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Event containing incremental input audio transcription.
|
|
744
|
+
*
|
|
745
|
+
* - `type`: event type, always "conversation.item.input_audio_transcription.delta".
|
|
746
|
+
* - `itemId`: ID of the conversation item being transcribed.
|
|
747
|
+
* - `contentIndex`: index of the content within the item.
|
|
748
|
+
* - `delta`: incremental transcription text.
|
|
749
|
+
*/
|
|
750
|
+
export declare class ConversationItemInputAudioTranscriptionDelta extends ServerEvent {
|
|
751
|
+
type: "conversation.item.input_audio_transcription.delta";
|
|
752
|
+
itemId: string;
|
|
753
|
+
contentIndex: number;
|
|
754
|
+
delta: string;
|
|
755
|
+
constructor(options: ConversationItemInputAudioTranscriptionDeltaOptions);
|
|
756
|
+
}
|
|
757
|
+
export interface ConversationItemInputAudioTranscriptionCompletedOptions extends ServerEventOptions {
|
|
758
|
+
type: "conversation.item.input_audio_transcription.completed";
|
|
759
|
+
itemId: string;
|
|
760
|
+
contentIndex: number;
|
|
761
|
+
transcript: string;
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Event indicating input audio transcription is complete.
|
|
765
|
+
*
|
|
766
|
+
* - `type`: event type, always "conversation.item.input_audio_transcription.completed".
|
|
767
|
+
* - `itemId`: ID of the conversation item that was transcribed.
|
|
768
|
+
* - `contentIndex`: index of the content within the item.
|
|
769
|
+
* - `transcript`: complete transcription text.
|
|
770
|
+
*/
|
|
771
|
+
export declare class ConversationItemInputAudioTranscriptionCompleted extends ServerEvent {
|
|
772
|
+
type: "conversation.item.input_audio_transcription.completed";
|
|
773
|
+
itemId: string;
|
|
774
|
+
contentIndex: number;
|
|
775
|
+
transcript: string;
|
|
776
|
+
constructor(options: ConversationItemInputAudioTranscriptionCompletedOptions);
|
|
777
|
+
}
|
|
778
|
+
export interface ConversationItemInputAudioTranscriptionFailedOptions extends ServerEventOptions {
|
|
779
|
+
type: "conversation.item.input_audio_transcription.failed";
|
|
780
|
+
itemId: string;
|
|
781
|
+
contentIndex: number;
|
|
782
|
+
error: RealtimeError;
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Event indicating input audio transcription failed.
|
|
786
|
+
*
|
|
787
|
+
* - `type`: event type, always "conversation.item.input_audio_transcription.failed".
|
|
788
|
+
* - `itemId`: ID of the conversation item that failed transcription.
|
|
789
|
+
* - `contentIndex`: index of the content within the item.
|
|
790
|
+
* - `error`: error details for the transcription failure.
|
|
791
|
+
*/
|
|
792
|
+
export declare class ConversationItemInputAudioTranscriptionFailed extends ServerEvent {
|
|
793
|
+
static _nested: Record<string, Resolver>;
|
|
794
|
+
type: "conversation.item.input_audio_transcription.failed";
|
|
795
|
+
itemId: string;
|
|
796
|
+
contentIndex: number;
|
|
797
|
+
error: RealtimeError;
|
|
798
|
+
constructor(options: ConversationItemInputAudioTranscriptionFailedOptions);
|
|
799
|
+
}
|
|
800
|
+
export interface ConversationItemTruncatedOptions extends ServerEventOptions {
|
|
801
|
+
type: "conversation.item.truncated";
|
|
802
|
+
itemId: string;
|
|
803
|
+
contentIndex: number;
|
|
804
|
+
audioEndMs: number;
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* Event indicating a conversation item has been truncated.
|
|
808
|
+
*
|
|
809
|
+
* - `type`: event type, always "conversation.item.truncated".
|
|
810
|
+
* - `itemId`: ID of the truncated conversation item.
|
|
811
|
+
* - `contentIndex`: index of the content within the item.
|
|
812
|
+
* - `audioEndMs`: end time in milliseconds for the truncated audio.
|
|
813
|
+
*/
|
|
814
|
+
export declare class ConversationItemTruncated extends ServerEvent {
|
|
815
|
+
type: "conversation.item.truncated";
|
|
816
|
+
itemId: string;
|
|
817
|
+
contentIndex: number;
|
|
818
|
+
audioEndMs: number;
|
|
819
|
+
constructor(options: ConversationItemTruncatedOptions);
|
|
820
|
+
}
|
|
821
|
+
export interface ConversationItemDeletedOptions extends ServerEventOptions {
|
|
822
|
+
type: "conversation.item.deleted";
|
|
823
|
+
itemId: string;
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
* Event indicating a conversation item has been deleted.
|
|
827
|
+
*
|
|
828
|
+
* - `type`: event type, always "conversation.item.deleted".
|
|
829
|
+
* - `itemId`: ID of the deleted conversation item.
|
|
830
|
+
*/
|
|
831
|
+
export declare class ConversationItemDeleted extends ServerEvent {
|
|
832
|
+
type: "conversation.item.deleted";
|
|
833
|
+
itemId: string;
|
|
834
|
+
constructor(options: ConversationItemDeletedOptions);
|
|
835
|
+
}
|
|
836
|
+
export interface ConversationItemRetrievedOptions extends ServerEventOptions {
|
|
837
|
+
type: "conversation.item.retrieved";
|
|
838
|
+
item: ConversationItem;
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Event containing a retrieved conversation item.
|
|
842
|
+
*
|
|
843
|
+
* - `type`: event type, always "conversation.item.retrieved".
|
|
844
|
+
* - `item`: the retrieved conversation item.
|
|
845
|
+
*/
|
|
846
|
+
export declare class ConversationItemRetrieved extends ServerEvent {
|
|
847
|
+
static _nested: Record<string, Resolver>;
|
|
848
|
+
type: "conversation.item.retrieved";
|
|
849
|
+
item: ConversationItem;
|
|
850
|
+
constructor(options: ConversationItemRetrievedOptions);
|
|
851
|
+
}
|
|
852
|
+
export interface ResponseCreatedOptions extends ServerEventOptions {
|
|
853
|
+
type: "response.created";
|
|
854
|
+
response: Response;
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Event indicating an assistant response has been created.
|
|
858
|
+
*
|
|
859
|
+
* - `type`: event type, always "response.created".
|
|
860
|
+
* - `response`: the created response object.
|
|
861
|
+
*/
|
|
862
|
+
export declare class ResponseCreated extends ServerEvent {
|
|
863
|
+
static _nested: Record<string, Resolver>;
|
|
864
|
+
type: "response.created";
|
|
865
|
+
response: Response;
|
|
866
|
+
constructor(options: ResponseCreatedOptions);
|
|
867
|
+
}
|
|
868
|
+
export interface ResponseDoneOptions extends ServerEventOptions {
|
|
869
|
+
type: "response.done";
|
|
870
|
+
response: Response;
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* Event indicating an assistant response is complete.
|
|
874
|
+
*
|
|
875
|
+
* - `type`: event type, always "response.done".
|
|
876
|
+
* - `response`: the completed response object.
|
|
877
|
+
*/
|
|
878
|
+
export declare class ResponseDone extends ServerEvent {
|
|
879
|
+
static _nested: Record<string, Resolver>;
|
|
880
|
+
type: "response.done";
|
|
881
|
+
response: Response;
|
|
882
|
+
constructor(options: ResponseDoneOptions);
|
|
883
|
+
}
|
|
884
|
+
export interface ResponseOutputItemAddedOptions extends ServerEventOptions {
|
|
885
|
+
type: "response.output_item.added";
|
|
886
|
+
responseId: string;
|
|
887
|
+
outputIndex: number;
|
|
888
|
+
item: ConversationItem;
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* Event indicating an output item has been added to a response.
|
|
892
|
+
*
|
|
893
|
+
* - `type`: event type, always "response.output_item.added".
|
|
894
|
+
* - `responseId`: ID of the response.
|
|
895
|
+
* - `outputIndex`: index of the output item.
|
|
896
|
+
* - `item`: the added conversation item.
|
|
897
|
+
*/
|
|
898
|
+
export declare class ResponseOutputItemAdded extends ServerEvent {
|
|
899
|
+
static _nested: Record<string, Resolver>;
|
|
900
|
+
type: "response.output_item.added";
|
|
901
|
+
responseId: string;
|
|
902
|
+
outputIndex: number;
|
|
903
|
+
item: ConversationItem;
|
|
904
|
+
constructor(options: ResponseOutputItemAddedOptions);
|
|
905
|
+
}
|
|
906
|
+
export interface ResponseOutputItemDoneOptions extends ServerEventOptions {
|
|
907
|
+
type: "response.output_item.done";
|
|
908
|
+
responseId: string;
|
|
909
|
+
outputIndex: number;
|
|
910
|
+
item: ConversationItem;
|
|
911
|
+
}
|
|
912
|
+
/**
|
|
913
|
+
* Event indicating an output item is complete.
|
|
914
|
+
*
|
|
915
|
+
* - `type`: event type, always "response.output_item.done".
|
|
916
|
+
* - `responseId`: ID of the response.
|
|
917
|
+
* - `outputIndex`: index of the output item.
|
|
918
|
+
* - `item`: the completed conversation item.
|
|
919
|
+
*/
|
|
920
|
+
export declare class ResponseOutputItemDone extends ServerEvent {
|
|
921
|
+
static _nested: Record<string, Resolver>;
|
|
922
|
+
type: "response.output_item.done";
|
|
923
|
+
responseId: string;
|
|
924
|
+
outputIndex: number;
|
|
925
|
+
item: ConversationItem;
|
|
926
|
+
constructor(options: ResponseOutputItemDoneOptions);
|
|
927
|
+
}
|
|
928
|
+
export interface ResponseContentPartAddedOptions extends ServerEventOptions {
|
|
929
|
+
type: "response.content_part.added";
|
|
930
|
+
responseId: string;
|
|
931
|
+
itemId: string;
|
|
932
|
+
outputIndex: number;
|
|
933
|
+
contentIndex: number;
|
|
934
|
+
part: ItemContent;
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* Event indicating a content part has been added to a response.
|
|
938
|
+
*
|
|
939
|
+
* - `type`: event type, always "response.content_part.added".
|
|
940
|
+
* - `responseId`: ID of the response.
|
|
941
|
+
* - `itemId`: ID of the conversation item.
|
|
942
|
+
* - `outputIndex`: index of the output item.
|
|
943
|
+
* - `contentIndex`: index of the content part.
|
|
944
|
+
* - `part`: the added content part.
|
|
945
|
+
*/
|
|
946
|
+
export declare class ResponseContentPartAdded extends ServerEvent {
|
|
947
|
+
static _nested: Record<string, Resolver>;
|
|
948
|
+
type: "response.content_part.added";
|
|
949
|
+
responseId: string;
|
|
950
|
+
itemId: string;
|
|
951
|
+
outputIndex: number;
|
|
952
|
+
contentIndex: number;
|
|
953
|
+
part: ItemContent;
|
|
954
|
+
constructor(options: ResponseContentPartAddedOptions);
|
|
955
|
+
}
|
|
956
|
+
export interface ResponseContentPartDoneOptions extends ServerEventOptions {
|
|
957
|
+
type: "response.content_part.done";
|
|
958
|
+
responseId: string;
|
|
959
|
+
itemId: string;
|
|
960
|
+
outputIndex: number;
|
|
961
|
+
contentIndex: number;
|
|
962
|
+
part: ItemContent;
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* Event indicating a content part is complete.
|
|
966
|
+
*
|
|
967
|
+
* - `type`: event type, always "response.content_part.done".
|
|
968
|
+
* - `responseId`: ID of the response.
|
|
969
|
+
* - `itemId`: ID of the conversation item.
|
|
970
|
+
* - `outputIndex`: index of the output item.
|
|
971
|
+
* - `contentIndex`: index of the content part.
|
|
972
|
+
* - `part`: the completed content part.
|
|
973
|
+
*/
|
|
974
|
+
export declare class ResponseContentPartDone extends ServerEvent {
|
|
975
|
+
static _nested: Record<string, Resolver>;
|
|
976
|
+
type: "response.content_part.done";
|
|
977
|
+
responseId: string;
|
|
978
|
+
itemId: string;
|
|
979
|
+
outputIndex: number;
|
|
980
|
+
contentIndex: number;
|
|
981
|
+
part: ItemContent;
|
|
982
|
+
constructor(options: ResponseContentPartDoneOptions);
|
|
983
|
+
}
|
|
984
|
+
/** Options shared by the streamed response-content events. */
|
|
985
|
+
interface ResponseContentEventOptions extends ServerEventOptions {
|
|
986
|
+
responseId: string;
|
|
987
|
+
itemId: string;
|
|
988
|
+
outputIndex: number;
|
|
989
|
+
contentIndex: number;
|
|
990
|
+
}
|
|
991
|
+
export interface ResponseTextDeltaOptions extends ResponseContentEventOptions {
|
|
992
|
+
type: "response.output_text.delta";
|
|
993
|
+
delta: string;
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* Event containing incremental text from a response.
|
|
997
|
+
*
|
|
998
|
+
* - `type`: event type, always "response.output_text.delta".
|
|
999
|
+
* - `responseId`: ID of the response.
|
|
1000
|
+
* - `itemId`: ID of the conversation item.
|
|
1001
|
+
* - `outputIndex`: index of the output item.
|
|
1002
|
+
* - `contentIndex`: index of the content part.
|
|
1003
|
+
* - `delta`: incremental text content.
|
|
1004
|
+
*/
|
|
1005
|
+
export declare class ResponseTextDelta extends ServerEvent {
|
|
1006
|
+
type: "response.output_text.delta";
|
|
1007
|
+
responseId: string;
|
|
1008
|
+
itemId: string;
|
|
1009
|
+
outputIndex: number;
|
|
1010
|
+
contentIndex: number;
|
|
1011
|
+
delta: string;
|
|
1012
|
+
constructor(options: ResponseTextDeltaOptions);
|
|
1013
|
+
}
|
|
1014
|
+
export interface ResponseTextDoneOptions extends ResponseContentEventOptions {
|
|
1015
|
+
type: "response.output_text.done";
|
|
1016
|
+
text: string;
|
|
1017
|
+
}
|
|
1018
|
+
/**
|
|
1019
|
+
* Event indicating text content is complete.
|
|
1020
|
+
*
|
|
1021
|
+
* - `type`: event type, always "response.output_text.done".
|
|
1022
|
+
* - `responseId`: ID of the response.
|
|
1023
|
+
* - `itemId`: ID of the conversation item.
|
|
1024
|
+
* - `outputIndex`: index of the output item.
|
|
1025
|
+
* - `contentIndex`: index of the content part.
|
|
1026
|
+
* - `text`: complete text content.
|
|
1027
|
+
*/
|
|
1028
|
+
export declare class ResponseTextDone extends ServerEvent {
|
|
1029
|
+
type: "response.output_text.done";
|
|
1030
|
+
responseId: string;
|
|
1031
|
+
itemId: string;
|
|
1032
|
+
outputIndex: number;
|
|
1033
|
+
contentIndex: number;
|
|
1034
|
+
text: string;
|
|
1035
|
+
constructor(options: ResponseTextDoneOptions);
|
|
1036
|
+
}
|
|
1037
|
+
export interface ResponseAudioTranscriptDeltaOptions extends ResponseContentEventOptions {
|
|
1038
|
+
type: "response.output_audio_transcript.delta";
|
|
1039
|
+
delta: string;
|
|
1040
|
+
}
|
|
1041
|
+
/**
|
|
1042
|
+
* Event containing incremental audio transcript from a response.
|
|
1043
|
+
*
|
|
1044
|
+
* - `type`: event type, always "response.output_audio_transcript.delta".
|
|
1045
|
+
* - `responseId`: ID of the response.
|
|
1046
|
+
* - `itemId`: ID of the conversation item.
|
|
1047
|
+
* - `outputIndex`: index of the output item.
|
|
1048
|
+
* - `contentIndex`: index of the content part.
|
|
1049
|
+
* - `delta`: incremental transcript text.
|
|
1050
|
+
*/
|
|
1051
|
+
export declare class ResponseAudioTranscriptDelta extends ServerEvent {
|
|
1052
|
+
type: "response.output_audio_transcript.delta";
|
|
1053
|
+
responseId: string;
|
|
1054
|
+
itemId: string;
|
|
1055
|
+
outputIndex: number;
|
|
1056
|
+
contentIndex: number;
|
|
1057
|
+
delta: string;
|
|
1058
|
+
constructor(options: ResponseAudioTranscriptDeltaOptions);
|
|
1059
|
+
}
|
|
1060
|
+
export interface ResponseAudioTranscriptDoneOptions extends ResponseContentEventOptions {
|
|
1061
|
+
type: "response.output_audio_transcript.done";
|
|
1062
|
+
transcript: string;
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* Event indicating audio transcript is complete.
|
|
1066
|
+
*
|
|
1067
|
+
* - `type`: event type, always "response.output_audio_transcript.done".
|
|
1068
|
+
* - `responseId`: ID of the response.
|
|
1069
|
+
* - `itemId`: ID of the conversation item.
|
|
1070
|
+
* - `outputIndex`: index of the output item.
|
|
1071
|
+
* - `contentIndex`: index of the content part.
|
|
1072
|
+
* - `transcript`: complete transcript text.
|
|
1073
|
+
*/
|
|
1074
|
+
export declare class ResponseAudioTranscriptDone extends ServerEvent {
|
|
1075
|
+
type: "response.output_audio_transcript.done";
|
|
1076
|
+
responseId: string;
|
|
1077
|
+
itemId: string;
|
|
1078
|
+
outputIndex: number;
|
|
1079
|
+
contentIndex: number;
|
|
1080
|
+
transcript: string;
|
|
1081
|
+
constructor(options: ResponseAudioTranscriptDoneOptions);
|
|
1082
|
+
}
|
|
1083
|
+
export interface ResponseAudioDeltaOptions extends ResponseContentEventOptions {
|
|
1084
|
+
type: "response.output_audio.delta";
|
|
1085
|
+
delta: string;
|
|
1086
|
+
}
|
|
1087
|
+
/**
|
|
1088
|
+
* Event containing incremental audio data from a response.
|
|
1089
|
+
*
|
|
1090
|
+
* - `type`: event type, always "response.output_audio.delta".
|
|
1091
|
+
* - `responseId`: ID of the response.
|
|
1092
|
+
* - `itemId`: ID of the conversation item.
|
|
1093
|
+
* - `outputIndex`: index of the output item.
|
|
1094
|
+
* - `contentIndex`: index of the content part.
|
|
1095
|
+
* - `delta`: base64-encoded incremental audio data.
|
|
1096
|
+
*/
|
|
1097
|
+
export declare class ResponseAudioDelta extends ServerEvent {
|
|
1098
|
+
type: "response.output_audio.delta";
|
|
1099
|
+
responseId: string;
|
|
1100
|
+
itemId: string;
|
|
1101
|
+
outputIndex: number;
|
|
1102
|
+
contentIndex: number;
|
|
1103
|
+
delta: string;
|
|
1104
|
+
constructor(options: ResponseAudioDeltaOptions);
|
|
1105
|
+
}
|
|
1106
|
+
export interface ResponseAudioDoneOptions extends ResponseContentEventOptions {
|
|
1107
|
+
type: "response.output_audio.done";
|
|
1108
|
+
}
|
|
1109
|
+
/**
|
|
1110
|
+
* Event indicating audio content is complete.
|
|
1111
|
+
*
|
|
1112
|
+
* - `type`: event type, always "response.output_audio.done".
|
|
1113
|
+
* - `responseId`: ID of the response.
|
|
1114
|
+
* - `itemId`: ID of the conversation item.
|
|
1115
|
+
* - `outputIndex`: index of the output item.
|
|
1116
|
+
* - `contentIndex`: index of the content part.
|
|
1117
|
+
*/
|
|
1118
|
+
export declare class ResponseAudioDone extends ServerEvent {
|
|
1119
|
+
type: "response.output_audio.done";
|
|
1120
|
+
responseId: string;
|
|
1121
|
+
itemId: string;
|
|
1122
|
+
outputIndex: number;
|
|
1123
|
+
contentIndex: number;
|
|
1124
|
+
constructor(options: ResponseAudioDoneOptions);
|
|
1125
|
+
}
|
|
1126
|
+
export interface ResponseFunctionCallArgumentsDeltaOptions extends ServerEventOptions {
|
|
1127
|
+
type: "response.function_call_arguments.delta";
|
|
1128
|
+
responseId: string;
|
|
1129
|
+
itemId: string;
|
|
1130
|
+
outputIndex: number;
|
|
1131
|
+
callId: string;
|
|
1132
|
+
delta: string;
|
|
1133
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* Event containing incremental function call arguments.
|
|
1136
|
+
*
|
|
1137
|
+
* - `type`: event type, always "response.function_call_arguments.delta".
|
|
1138
|
+
* - `responseId`: ID of the response.
|
|
1139
|
+
* - `itemId`: ID of the conversation item.
|
|
1140
|
+
* - `outputIndex`: index of the output item.
|
|
1141
|
+
* - `callId`: ID of the function call.
|
|
1142
|
+
* - `delta`: incremental function arguments as JSON.
|
|
1143
|
+
*/
|
|
1144
|
+
export declare class ResponseFunctionCallArgumentsDelta extends ServerEvent {
|
|
1145
|
+
type: "response.function_call_arguments.delta";
|
|
1146
|
+
responseId: string;
|
|
1147
|
+
itemId: string;
|
|
1148
|
+
outputIndex: number;
|
|
1149
|
+
callId: string;
|
|
1150
|
+
delta: string;
|
|
1151
|
+
constructor(options: ResponseFunctionCallArgumentsDeltaOptions);
|
|
1152
|
+
}
|
|
1153
|
+
export interface ResponseFunctionCallArgumentsDoneOptions extends ServerEventOptions {
|
|
1154
|
+
type: "response.function_call_arguments.done";
|
|
1155
|
+
responseId: string;
|
|
1156
|
+
itemId: string;
|
|
1157
|
+
outputIndex: number;
|
|
1158
|
+
callId: string;
|
|
1159
|
+
arguments: string;
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* Event indicating function call arguments are complete.
|
|
1163
|
+
*
|
|
1164
|
+
* - `type`: event type, always "response.function_call_arguments.done".
|
|
1165
|
+
* - `responseId`: ID of the response.
|
|
1166
|
+
* - `itemId`: ID of the conversation item.
|
|
1167
|
+
* - `outputIndex`: index of the output item.
|
|
1168
|
+
* - `callId`: ID of the function call.
|
|
1169
|
+
* - `arguments`: complete function arguments as JSON string.
|
|
1170
|
+
*/
|
|
1171
|
+
export declare class ResponseFunctionCallArgumentsDone extends ServerEvent {
|
|
1172
|
+
type: "response.function_call_arguments.done";
|
|
1173
|
+
responseId: string;
|
|
1174
|
+
itemId: string;
|
|
1175
|
+
outputIndex: number;
|
|
1176
|
+
callId: string;
|
|
1177
|
+
arguments: string;
|
|
1178
|
+
constructor(options: ResponseFunctionCallArgumentsDoneOptions);
|
|
1179
|
+
}
|
|
1180
|
+
export interface InputAudioBufferSpeechStartedOptions extends ServerEventOptions {
|
|
1181
|
+
type: "input_audio_buffer.speech_started";
|
|
1182
|
+
audioStartMs: number;
|
|
1183
|
+
itemId: string;
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* Event indicating speech has started in the input audio buffer.
|
|
1187
|
+
*
|
|
1188
|
+
* - `type`: event type, always "input_audio_buffer.speech_started".
|
|
1189
|
+
* - `audioStartMs`: start time of speech in milliseconds.
|
|
1190
|
+
* - `itemId`: ID of the associated conversation item.
|
|
1191
|
+
*/
|
|
1192
|
+
export declare class InputAudioBufferSpeechStarted extends ServerEvent {
|
|
1193
|
+
type: "input_audio_buffer.speech_started";
|
|
1194
|
+
audioStartMs: number;
|
|
1195
|
+
itemId: string;
|
|
1196
|
+
constructor(options: InputAudioBufferSpeechStartedOptions);
|
|
1197
|
+
}
|
|
1198
|
+
export interface InputAudioBufferSpeechStoppedOptions extends ServerEventOptions {
|
|
1199
|
+
type: "input_audio_buffer.speech_stopped";
|
|
1200
|
+
audioEndMs: number;
|
|
1201
|
+
itemId: string;
|
|
1202
|
+
}
|
|
1203
|
+
/**
|
|
1204
|
+
* Event indicating speech has stopped in the input audio buffer.
|
|
1205
|
+
*
|
|
1206
|
+
* - `type`: event type, always "input_audio_buffer.speech_stopped".
|
|
1207
|
+
* - `audioEndMs`: end time of speech in milliseconds.
|
|
1208
|
+
* - `itemId`: ID of the associated conversation item.
|
|
1209
|
+
*/
|
|
1210
|
+
export declare class InputAudioBufferSpeechStopped extends ServerEvent {
|
|
1211
|
+
type: "input_audio_buffer.speech_stopped";
|
|
1212
|
+
audioEndMs: number;
|
|
1213
|
+
itemId: string;
|
|
1214
|
+
constructor(options: InputAudioBufferSpeechStoppedOptions);
|
|
1215
|
+
}
|
|
1216
|
+
export interface InputAudioBufferCommittedOptions extends ServerEventOptions {
|
|
1217
|
+
type: "input_audio_buffer.committed";
|
|
1218
|
+
previousItemId?: string | null;
|
|
1219
|
+
itemId: string;
|
|
1220
|
+
}
|
|
1221
|
+
/**
|
|
1222
|
+
* Event indicating the input audio buffer has been committed.
|
|
1223
|
+
*
|
|
1224
|
+
* - `type`: event type, always "input_audio_buffer.committed".
|
|
1225
|
+
* - `previousItemId`: ID of the previous item, if any.
|
|
1226
|
+
* - `itemId`: ID of the committed conversation item.
|
|
1227
|
+
*/
|
|
1228
|
+
export declare class InputAudioBufferCommitted extends ServerEvent {
|
|
1229
|
+
type: "input_audio_buffer.committed";
|
|
1230
|
+
previousItemId: string | null;
|
|
1231
|
+
itemId: string;
|
|
1232
|
+
constructor(options: InputAudioBufferCommittedOptions);
|
|
1233
|
+
}
|
|
1234
|
+
export interface InputAudioBufferClearedOptions extends ServerEventOptions {
|
|
1235
|
+
type: "input_audio_buffer.cleared";
|
|
1236
|
+
}
|
|
1237
|
+
/**
|
|
1238
|
+
* Event indicating the input audio buffer has been cleared.
|
|
1239
|
+
*
|
|
1240
|
+
* - `type`: event type, always "input_audio_buffer.cleared".
|
|
1241
|
+
*/
|
|
1242
|
+
export declare class InputAudioBufferCleared extends ServerEvent {
|
|
1243
|
+
type: "input_audio_buffer.cleared";
|
|
1244
|
+
constructor(options: InputAudioBufferClearedOptions);
|
|
1245
|
+
}
|
|
1246
|
+
export interface ErrorEventOptions extends ServerEventOptions {
|
|
1247
|
+
type: "error";
|
|
1248
|
+
error: RealtimeError;
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Event indicating an error occurred.
|
|
1252
|
+
*
|
|
1253
|
+
* - `type`: event type, always "error".
|
|
1254
|
+
* - `error`: error details.
|
|
1255
|
+
*/
|
|
1256
|
+
export declare class ErrorEvent extends ServerEvent {
|
|
1257
|
+
static _nested: Record<string, Resolver>;
|
|
1258
|
+
type: "error";
|
|
1259
|
+
error: RealtimeError;
|
|
1260
|
+
constructor(options: ErrorEventOptions);
|
|
1261
|
+
}
|
|
1262
|
+
export interface RateLimitsUpdatedOptions extends ServerEventOptions {
|
|
1263
|
+
type: "rate_limits.updated";
|
|
1264
|
+
rateLimits: Record<string, unknown>[];
|
|
1265
|
+
}
|
|
1266
|
+
/**
|
|
1267
|
+
* Event indicating rate limits have been updated.
|
|
1268
|
+
*
|
|
1269
|
+
* - `type`: event type, always "rate_limits.updated".
|
|
1270
|
+
* - `rateLimits`: list of rate limit information.
|
|
1271
|
+
*/
|
|
1272
|
+
export declare class RateLimitsUpdated extends ServerEvent {
|
|
1273
|
+
type: "rate_limits.updated";
|
|
1274
|
+
rateLimits: Record<string, unknown>[];
|
|
1275
|
+
constructor(options: RateLimitsUpdatedOptions);
|
|
1276
|
+
}
|
|
1277
|
+
export interface CachedTokensDetailsOptions {
|
|
1278
|
+
textTokens?: number | null;
|
|
1279
|
+
audioTokens?: number | null;
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Details about cached tokens.
|
|
1283
|
+
*
|
|
1284
|
+
* - `textTokens`: number of cached text tokens.
|
|
1285
|
+
* - `audioTokens`: number of cached audio tokens.
|
|
1286
|
+
*/
|
|
1287
|
+
export declare class CachedTokensDetails extends BaseModel {
|
|
1288
|
+
textTokens: number | null;
|
|
1289
|
+
audioTokens: number | null;
|
|
1290
|
+
constructor(options?: CachedTokensDetailsOptions);
|
|
1291
|
+
}
|
|
1292
|
+
export interface TokenDetailsOptions {
|
|
1293
|
+
cachedTokens?: number | null;
|
|
1294
|
+
textTokens?: number | null;
|
|
1295
|
+
audioTokens?: number | null;
|
|
1296
|
+
cachedTokensDetails?: CachedTokensDetails | null;
|
|
1297
|
+
imageTokens?: number | null;
|
|
1298
|
+
}
|
|
1299
|
+
/**
|
|
1300
|
+
* Detailed token usage information.
|
|
1301
|
+
*
|
|
1302
|
+
* Keys the model doesn't declare are kept (see `modelExtra`).
|
|
1303
|
+
*
|
|
1304
|
+
* - `cachedTokens`: number of cached tokens used. Defaults to 0.
|
|
1305
|
+
* - `textTokens`: number of text tokens used. Defaults to 0.
|
|
1306
|
+
* - `audioTokens`: number of audio tokens used. Defaults to 0.
|
|
1307
|
+
* - `cachedTokensDetails`: detailed breakdown of cached tokens.
|
|
1308
|
+
* - `imageTokens`: number of image tokens used (for input only).
|
|
1309
|
+
*/
|
|
1310
|
+
export declare class TokenDetails extends BaseModel {
|
|
1311
|
+
static _nested: Record<string, Resolver>;
|
|
1312
|
+
static _extraAllowed: boolean;
|
|
1313
|
+
cachedTokens: number | null;
|
|
1314
|
+
textTokens: number | null;
|
|
1315
|
+
audioTokens: number | null;
|
|
1316
|
+
cachedTokensDetails: CachedTokensDetails | null;
|
|
1317
|
+
imageTokens: number | null;
|
|
1318
|
+
constructor(options?: TokenDetailsOptions);
|
|
1319
|
+
}
|
|
1320
|
+
export interface UsageOptions {
|
|
1321
|
+
totalTokens: number;
|
|
1322
|
+
inputTokens: number;
|
|
1323
|
+
outputTokens: number;
|
|
1324
|
+
inputTokenDetails: TokenDetails;
|
|
1325
|
+
outputTokenDetails: TokenDetails;
|
|
1326
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* Token usage statistics for a response.
|
|
1329
|
+
*
|
|
1330
|
+
* - `totalTokens`: total number of tokens used.
|
|
1331
|
+
* - `inputTokens`: number of input tokens used.
|
|
1332
|
+
* - `outputTokens`: number of output tokens used.
|
|
1333
|
+
* - `inputTokenDetails`: detailed breakdown of input token usage.
|
|
1334
|
+
* - `outputTokenDetails`: detailed breakdown of output token usage.
|
|
1335
|
+
*/
|
|
1336
|
+
export declare class Usage extends BaseModel {
|
|
1337
|
+
static _nested: Record<string, Resolver>;
|
|
1338
|
+
totalTokens: number;
|
|
1339
|
+
inputTokens: number;
|
|
1340
|
+
outputTokens: number;
|
|
1341
|
+
inputTokenDetails: TokenDetails;
|
|
1342
|
+
outputTokenDetails: TokenDetails;
|
|
1343
|
+
constructor(options: UsageOptions);
|
|
1344
|
+
}
|
|
1345
|
+
export type ResponseStatus = "completed" | "in_progress" | "incomplete" | "cancelled" | "failed";
|
|
1346
|
+
export interface ResponseOptions {
|
|
1347
|
+
id: string;
|
|
1348
|
+
object: "realtime.response";
|
|
1349
|
+
status: ResponseStatus;
|
|
1350
|
+
statusDetails: any;
|
|
1351
|
+
output: ConversationItem[];
|
|
1352
|
+
outputModalities?: Modality[] | null;
|
|
1353
|
+
maxOutputTokens?: number | "inf" | null;
|
|
1354
|
+
audio?: AudioConfiguration | null;
|
|
1355
|
+
usage?: Usage | null;
|
|
1356
|
+
voice?: string | null;
|
|
1357
|
+
temperature?: number | null;
|
|
1358
|
+
outputAudioFormat?: string | null;
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* A complete assistant response.
|
|
1362
|
+
*
|
|
1363
|
+
* - `id`: unique identifier for the response.
|
|
1364
|
+
* - `object`: object type, always "realtime.response".
|
|
1365
|
+
* - `status`: current status of the response.
|
|
1366
|
+
* - `statusDetails`: additional status information.
|
|
1367
|
+
* - `output`: list of conversation items in the response.
|
|
1368
|
+
* - `outputModalities`: the set of modalities the model used to respond.
|
|
1369
|
+
* - `maxOutputTokens`: maximum number of output tokens used.
|
|
1370
|
+
* - `audio`: audio configuration for the response.
|
|
1371
|
+
* - `usage`: token usage statistics for the response.
|
|
1372
|
+
* - `voice`: the voice the model used to respond.
|
|
1373
|
+
* - `temperature`: sampling temperature used for the response.
|
|
1374
|
+
* - `outputAudioFormat`: the format of output audio.
|
|
1375
|
+
*/
|
|
1376
|
+
export declare class Response extends BaseModel {
|
|
1377
|
+
static _nested: Record<string, Resolver>;
|
|
1378
|
+
id: string;
|
|
1379
|
+
object: "realtime.response";
|
|
1380
|
+
status: ResponseStatus;
|
|
1381
|
+
statusDetails: any;
|
|
1382
|
+
output: ConversationItem[];
|
|
1383
|
+
outputModalities: Modality[] | null;
|
|
1384
|
+
maxOutputTokens: number | "inf" | null;
|
|
1385
|
+
audio: AudioConfiguration | null;
|
|
1386
|
+
usage: Usage | null;
|
|
1387
|
+
voice: string | null;
|
|
1388
|
+
temperature: number | null;
|
|
1389
|
+
outputAudioFormat: string | null;
|
|
1390
|
+
constructor(options: ResponseOptions);
|
|
1391
|
+
}
|
|
1392
|
+
/**
|
|
1393
|
+
* Parse a server event from JSON string.
|
|
1394
|
+
*
|
|
1395
|
+
* @param str JSON string (or UTF-8 bytes) containing the server event.
|
|
1396
|
+
* @returns Parsed server event object of the appropriate type.
|
|
1397
|
+
* @throws Error If the event type is unimplemented or parsing fails.
|
|
1398
|
+
*/
|
|
1399
|
+
export declare function parseServerEvent(str: string | Uint8Array): ServerEvent;
|
|
1400
|
+
export {};
|
|
1401
|
+
//# sourceMappingURL=events.d.ts.map
|