Skip to content

Commit bd8cd48

Browse files
committed
Custom realtime model selection
1 parent a5cb948 commit bd8cd48

File tree

7 files changed

+1218
-19
lines changed

7 files changed

+1218
-19
lines changed

dist/lib/api.d.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ export class RealtimeAPI extends RealtimeEventHandler {
3131
* @param {{model?: string}} [settings]
3232
* @returns {Promise<true>}
3333
*/
34-
connect({ model }?: {
35-
model?: string;
36-
}): Promise<true>;
34+
connect(model?: string): Promise<true>;
3735
/**
3836
* Disconnects from Realtime API server
3937
* @param {WebSocket} [ws]

dist/lib/api.d.ts.map

+1-1
Original file line numberDiff line numberDiff line change

dist/lib/client.d.ts

+39-10
Original file line numberDiff line numberDiff line change
@@ -153,21 +153,25 @@
153153
* @property {ItemType[]} output
154154
* @property {UsageType|null} usage
155155
*/
156+
/**
157+
* RealtimeClient Settings
158+
* @typedef {Object} RealtimeClientSettings
159+
* @property {string} [url] - The URL for the realtime client
160+
* @property {string} [apiKey] - The API key
161+
* @property {string} [model] - The model name to use
162+
* @property {boolean} [dangerouslyAllowAPIKeyInBrowser] - Whether to allow API key in browser
163+
* @property {boolean} [debug] - Enable debug mode
164+
*/
156165
/**
157166
* RealtimeClient Class
158167
* @class
159168
*/
160169
export class RealtimeClient extends RealtimeEventHandler {
161170
/**
162171
* Create a new RealtimeClient instance
163-
* @param {{url?: string, apiKey?: string, dangerouslyAllowAPIKeyInBrowser?: boolean, debug?: boolean}} [settings]
172+
* @param {RealtimeClientSettings} [settings]
164173
*/
165-
constructor({ url, apiKey, dangerouslyAllowAPIKeyInBrowser, debug }?: {
166-
url?: string;
167-
apiKey?: string;
168-
dangerouslyAllowAPIKeyInBrowser?: boolean;
169-
debug?: boolean;
170-
});
174+
constructor({ url, apiKey, model, dangerouslyAllowAPIKeyInBrowser, debug, }?: RealtimeClientSettings);
171175
defaultSessionConfig: {
172176
modalities: string[];
173177
instructions: string;
@@ -181,6 +185,7 @@ export class RealtimeClient extends RealtimeEventHandler {
181185
temperature: number;
182186
max_response_output_tokens: number;
183187
};
188+
realtimeModel: string;
184189
sessionConfig: {};
185190
transcriptionModels: {
186191
model: string;
@@ -336,8 +341,7 @@ export type SessionResourceType = {
336341
model?: string;
337342
modalities?: string[];
338343
instructions?: string;
339-
voice?: "alloy"|"ash"|"ballad"|"coral"|"echo"|"sage"|"shimmer"|"verse";
340-
344+
voice?: "alloy" | "ash" | "ballad" | "coral" | "echo" | "sage" | "shimmer" | "verse";
341345
input_audio_format?: AudioFormatType;
342346
output_audio_format?: AudioFormatType;
343347
input_audio_transcription?: AudioTranscriptionType | null;
@@ -454,7 +458,32 @@ export type ResponseResourceType = {
454458
output: ItemType[];
455459
usage: UsageType | null;
456460
};
461+
/**
462+
* RealtimeClient Settings
463+
*/
464+
export type RealtimeClientSettings = {
465+
/**
466+
* - The URL for the realtime client
467+
*/
468+
url?: string;
469+
/**
470+
* - The API key
471+
*/
472+
apiKey?: string;
473+
/**
474+
* - The model name to use
475+
*/
476+
model?: string;
477+
/**
478+
* - Whether to allow API key in browser
479+
*/
480+
dangerouslyAllowAPIKeyInBrowser?: boolean;
481+
/**
482+
* - Enable debug mode
483+
*/
484+
debug?: boolean;
485+
};
457486
import { RealtimeEventHandler } from './event_handler.js';
458487
import { RealtimeAPI } from './api.js';
459488
import { RealtimeConversation } from './conversation.js';
460-
//# sourceMappingURL=client.d.ts.map
489+
//# sourceMappingURL=client.d.ts.map

dist/lib/client.d.ts.map

+1-1
Original file line numberDiff line numberDiff line change

0 commit comments

Comments
 (0)