@livekit/agents-plugin-openai 0.9.0 → 0.9.2

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.
@@ -0,0 +1,15 @@
1
+ export type ChatModels = 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo-preview' | 'gpt-4-0125-preview' | 'gpt-4-1106-preview' | 'gpt-4-vision-preview' | 'gpt-4-1106-vision-preview' | 'gpt-4' | 'gpt-4-0314' | 'gpt-4-0613' | 'gpt-4-32k' | 'gpt-4-32k-0314' | 'gpt-4-32k-0613' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-16k' | 'gpt-3.5-turbo-0301' | 'gpt-3.5-turbo-0613' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k-0613';
2
+ export type WhisperModels = 'whisper-1';
3
+ export type TTSModels = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts';
4
+ export type TTSVoices = 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'fable' | 'nova' | 'onyx' | 'sage' | 'shimmer' | 'verse';
5
+ export type TelnyxChatModels = 'meta-llama/Meta-Llama-3.1-8B-Instruct' | 'meta-llama/Meta-Llama-3.1-70B-Instruct';
6
+ export type CerebrasChatModels = 'llama3.1-8b' | 'llama3.1-70b';
7
+ export type PerplexityChatModels = 'llama-3.1-sonar-small-128k-online' | 'llama-3.1-sonar-small-128k-chat' | 'llama-3.1-sonar-large-128k-online' | 'llama-3.1-sonar-large-128k-chat' | 'llama-3.1-8b-instruct' | 'llama-3.1-70b-instruct';
8
+ export type GroqChatModels = 'llama-3.1-405b-reasoning' | 'llama-3.1-70b-versatile' | 'llama-3.1-8b-instant' | 'llama-3.3-70b-versatile' | 'llama3-groq-70b-8192-tool-use-preview' | 'llama3-groq-8b-8192-tool-use-preview' | 'llama-guard-3-8b' | 'llama3-70b-8192' | 'llama3-8b-8192' | 'mixtral-8x7b-32768' | 'gemma-7b-it' | 'gemma2-9b-it';
9
+ export type GroqAudioModels = 'whisper-large-v3' | 'distil-whisper-large-v3-en' | 'whisper-large-v3-turbo';
10
+ export type DeepSeekChatModels = 'deepseek-coder' | 'deepseek-chat';
11
+ export type TogetherChatModels = 'garage-bAInd/Platypus2-70B-instruct' | 'google/gemma-2-27b-it' | 'google/gemma-2-9b-it' | 'google/gemma-2b-it' | 'google/gemma-7b-it' | 'lmsys/vicuna-13b-v1.5' | 'lmsys/vicuna-7b-v1.5' | 'meta-llama/Llama-2-13b-chat-hf' | 'meta-llama/Llama-2-70b-chat-hf' | 'meta-llama/Llama-2-7b-chat-hf' | 'meta-llama/Llama-3-70b-chat-hf' | 'meta-llama/Llama-3-8b-chat-hf' | 'meta-llama/Meta-Llama-3-70B-Instruct-Lite' | 'meta-llama/Meta-Llama-3-70B-Instruct-Turbo' | 'meta-llama/Meta-Llama-3-8B-Instruct-Lite' | 'meta-llama/Meta-Llama-3-8B-Instruct-Turbo' | 'meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo' | 'meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo' | 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo' | 'mistralai/Mistral-7B-Instruct-v0.1' | 'mistralai/Mistral-7B-Instruct-v0.2' | 'mistralai/Mistral-7B-Instruct-v0.3' | 'mistralai/Mixtral-8x22B-Instruct-v0.1' | 'mistralai/Mixtral-8x7B-Instruct-v0.1' | 'openchat/openchat-3.5-1210' | 'snorkelai/Snorkel-Mistral-PairRM-DPO' | 'teknium/OpenHermes-2-Mistral-7B' | 'teknium/OpenHermes-2p5-Mistral-7B' | 'togethercomputer/Llama-2-7B-32K-Instruct' | 'togethercomputer/RedPajama-INCITE-7B-Chat' | 'togethercomputer/RedPajama-INCITE-Chat-3B-v1' | 'togethercomputer/StripedHyena-Nous-7B' | 'togethercomputer/alpaca-7b' | 'upstage/SOLAR-10.7B-Instruct-v1.0' | 'zero-one-ai/Yi-34B-Chat';
12
+ export type OctoChatModels = 'meta-llama-3-70b-instruct' | 'meta-llama-3.1-405b-instruct' | 'meta-llama-3.1-70b-instruct' | 'meta-llama-3.1-8b-instruct' | 'mistral-7b-instruct' | 'mixtral-8x7b-instruct' | 'wizardlm-2-8x22bllamaguard-2-7b';
13
+ export type XAIChatModels = 'grok-2' | 'grok-2-mini' | 'grok-2-mini-public' | 'grok-2-public';
14
+ export type MetaChatModels = 'Llama-4-Scout-17B-16E-Instruct-FP8' | 'Llama-4-Maverick-17B-128E-Instruct-FP8' | 'Llama-3.3-70B-Instruct' | 'Llama-3.3-8B-Instruct';
15
+ //# sourceMappingURL=models.d.ts.map
package/dist/models.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export type ChatModels = 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo-preview' | 'gpt-4-0125-preview' | 'gpt-4-1106-preview' | 'gpt-4-vision-preview' | 'gpt-4-1106-vision-preview' | 'gpt-4' | 'gpt-4-0314' | 'gpt-4-0613' | 'gpt-4-32k' | 'gpt-4-32k-0314' | 'gpt-4-32k-0613' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-16k' | 'gpt-3.5-turbo-0301' | 'gpt-3.5-turbo-0613' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k-0613';
2
2
  export type WhisperModels = 'whisper-1';
3
- export type TTSModels = 'tts-1' | 'tts-1-hd';
4
- export type TTSVoices = 'alloy' | 'echo' | 'fable' | 'onyx' | 'nova' | 'shimmer';
3
+ export type TTSModels = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts';
4
+ export type TTSVoices = 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'fable' | 'nova' | 'onyx' | 'sage' | 'shimmer' | 'verse';
5
5
  export type TelnyxChatModels = 'meta-llama/Meta-Llama-3.1-8B-Instruct' | 'meta-llama/Meta-Llama-3.1-70B-Instruct';
6
6
  export type CerebrasChatModels = 'llama3.1-8b' | 'llama3.1-70b';
7
7
  export type PerplexityChatModels = 'llama-3.1-sonar-small-128k-online' | 'llama-3.1-sonar-small-128k-chat' | 'llama-3.1-sonar-large-128k-online' | 'llama-3.1-sonar-large-128k-chat' | 'llama-3.1-8b-instruct' | 'llama-3.1-70b-instruct';
@@ -11,4 +11,5 @@ export type DeepSeekChatModels = 'deepseek-coder' | 'deepseek-chat';
11
11
  export type TogetherChatModels = 'garage-bAInd/Platypus2-70B-instruct' | 'google/gemma-2-27b-it' | 'google/gemma-2-9b-it' | 'google/gemma-2b-it' | 'google/gemma-7b-it' | 'lmsys/vicuna-13b-v1.5' | 'lmsys/vicuna-7b-v1.5' | 'meta-llama/Llama-2-13b-chat-hf' | 'meta-llama/Llama-2-70b-chat-hf' | 'meta-llama/Llama-2-7b-chat-hf' | 'meta-llama/Llama-3-70b-chat-hf' | 'meta-llama/Llama-3-8b-chat-hf' | 'meta-llama/Meta-Llama-3-70B-Instruct-Lite' | 'meta-llama/Meta-Llama-3-70B-Instruct-Turbo' | 'meta-llama/Meta-Llama-3-8B-Instruct-Lite' | 'meta-llama/Meta-Llama-3-8B-Instruct-Turbo' | 'meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo' | 'meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo' | 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo' | 'mistralai/Mistral-7B-Instruct-v0.1' | 'mistralai/Mistral-7B-Instruct-v0.2' | 'mistralai/Mistral-7B-Instruct-v0.3' | 'mistralai/Mixtral-8x22B-Instruct-v0.1' | 'mistralai/Mixtral-8x7B-Instruct-v0.1' | 'openchat/openchat-3.5-1210' | 'snorkelai/Snorkel-Mistral-PairRM-DPO' | 'teknium/OpenHermes-2-Mistral-7B' | 'teknium/OpenHermes-2p5-Mistral-7B' | 'togethercomputer/Llama-2-7B-32K-Instruct' | 'togethercomputer/RedPajama-INCITE-7B-Chat' | 'togethercomputer/RedPajama-INCITE-Chat-3B-v1' | 'togethercomputer/StripedHyena-Nous-7B' | 'togethercomputer/alpaca-7b' | 'upstage/SOLAR-10.7B-Instruct-v1.0' | 'zero-one-ai/Yi-34B-Chat';
12
12
  export type OctoChatModels = 'meta-llama-3-70b-instruct' | 'meta-llama-3.1-405b-instruct' | 'meta-llama-3.1-70b-instruct' | 'meta-llama-3.1-8b-instruct' | 'mistral-7b-instruct' | 'mixtral-8x7b-instruct' | 'wizardlm-2-8x22bllamaguard-2-7b';
13
13
  export type XAIChatModels = 'grok-2' | 'grok-2-mini' | 'grok-2-mini-public' | 'grok-2-public';
14
+ export type MetaChatModels = 'Llama-4-Scout-17B-16E-Instruct-FP8' | 'Llama-4-Maverick-17B-128E-Instruct-FP8' | 'Llama-3.3-70B-Instruct' | 'Llama-3.3-8B-Instruct';
14
15
  //# sourceMappingURL=models.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,UAAU,GAClB,QAAQ,GACR,mBAAmB,GACnB,aAAa,GACb,wBAAwB,GACxB,aAAa,GACb,wBAAwB,GACxB,qBAAqB,GACrB,oBAAoB,GACpB,oBAAoB,GACpB,sBAAsB,GACtB,2BAA2B,GAC3B,OAAO,GACP,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,gBAAgB,GAChB,gBAAgB,GAChB,eAAe,GACf,mBAAmB,GACnB,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,GACpB,wBAAwB,CAAC;AAE7B,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC;AAExC,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,CAAC;AAE7C,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SA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cAAc,CAAC;AAEnB,MAAM,MAAM,eAAe,GACvB,kBAAkB,GAClB,4BAA4B,GAC5B,wBAAwB,CAAC;AAE7B,MAAM,MAAM,kBAAkB,GAAG,gBAAgB,GAAG,eAAe,CAAC;AAEpE,MAAM,MAAM,kBAAkB,GAC1B,qCAAqC,GACrC,uBAAuB,GACvB,sBAAsB,GACtB,oBAAoB,GACpB,oBAAoB,GACpB,uBAAuB,GACvB,sBAAsB,GACtB,gCAAgC,GAChC,gCAAgC,GAChC,+BAA+B,GAC/B,gCAAgC,GAChC,+BAA+B,GAC/B,2CAA2C,GAC3C,4CAA4C,GAC5C,0CAA0C,GAC1C,2CAA2C,GAC3C,+CAA+C,GAC/C,8CAA8C,GAC9C,6CAA6C,GAC7C,oCAAoC,GACpC,oCAAoC,GACpC,oCAAoC,GACpC,uCAAuC,GACvC,sCAAsC,GACtC,4BAA4B,GAC5B,sCAAsC,GACtC,iCAAiC,GACjC,mCAAmC,GACnC,0CAA0C,GAC1C,2CAA2C,GAC3C,8CAA8C,GAC9C,uCAAuC,GACvC,4BAA4B,GAC5B,mCAAmC,GACnC,yBAAyB,CAAC;AAE9B,MAAM,MAAM,cAAc,GACtB,2BAA2B,GAC3B,8BAA8B,GAC9B,6BAA6B,GAC7B,4BAA4B,GAC5B,qBAAqB,GACrB,uBAAuB,GACvB,iCAAiC,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,aAAa,GAAG,oBAAoB,GAAG,eAAe,CAAC;AAE9F,MAAM,MAAM,cAAc,GACtB,oCAAoC,GACpC,wCAAwC,GACxC,wBAAwB,GACxB,uBAAuB,CAAC"}
@@ -0,0 +1,413 @@
1
+ export declare const SAMPLE_RATE = 24000;
2
+ export declare const NUM_CHANNELS = 1;
3
+ export declare const IN_FRAME_SIZE = 2400;
4
+ export declare const OUT_FRAME_SIZE = 1200;
5
+ export declare const BASE_URL = "wss://api.openai.com/v1";
6
+ export type Model = 'gpt-4o-realtime-preview-2024-10-01' | string;
7
+ export type Voice = 'alloy' | 'shimmer' | 'echo' | 'ash' | 'ballad' | 'coral' | 'sage' | 'verse' | string;
8
+ export type AudioFormat = 'pcm16';
9
+ export type Role = 'system' | 'assistant' | 'user' | 'tool';
10
+ export type GenerationFinishedReason = 'stop' | 'max_tokens' | 'content_filter' | 'interrupt';
11
+ export type InputTranscriptionModel = 'whisper-1' | string;
12
+ export type Modality = 'text' | 'audio';
13
+ export type ToolChoice = 'auto' | 'none' | 'required' | string;
14
+ export type State = 'initializing' | 'listening' | 'thinking' | 'speaking' | string;
15
+ export type ResponseStatus = 'in_progress' | 'completed' | 'incomplete' | 'cancelled' | 'failed' | string;
16
+ export type ClientEventType = 'session.update' | 'input_audio_buffer.append' | 'input_audio_buffer.commit' | 'input_audio_buffer.clear' | 'conversation.item.create' | 'conversation.item.truncate' | 'conversation.item.delete' | 'response.create' | 'response.cancel';
17
+ export type ServerEventType = 'error' | 'session.created' | 'session.updated' | 'conversation.created' | 'input_audio_buffer.committed' | 'input_audio_buffer.cleared' | 'input_audio_buffer.speech_started' | 'input_audio_buffer.speech_stopped' | 'conversation.item.created' | 'conversation.item.input_audio_transcription.completed' | 'conversation.item.input_audio_transcription.failed' | 'conversation.item.truncated' | 'conversation.item.deleted' | 'response.created' | 'response.done' | 'response.output_item.added' | 'response.output_item.done' | 'response.content_part.added' | 'response.content_part.done' | 'response.text.delta' | 'response.text.done' | 'response.audio_transcript.delta' | 'response.audio_transcript.done' | 'response.audio.delta' | 'response.audio.done' | 'response.function_call_arguments.delta' | 'response.function_call_arguments.done' | 'rate_limits.updated';
18
+ export type AudioBase64Bytes = string;
19
+ export interface Tool {
20
+ type: 'function';
21
+ name: string;
22
+ description?: string;
23
+ parameters: {
24
+ type: 'object';
25
+ properties: {
26
+ [prop: string]: {
27
+ [prop: string]: any;
28
+ };
29
+ };
30
+ required: string[];
31
+ };
32
+ }
33
+ export type TurnDetectionType = {
34
+ type: 'server_vad';
35
+ threshold?: number;
36
+ prefix_padding_ms?: number;
37
+ silence_duration_ms?: number;
38
+ };
39
+ export type InputAudioTranscription = {
40
+ model: InputTranscriptionModel;
41
+ };
42
+ export interface InputTextContent {
43
+ type: 'input_text';
44
+ text: string;
45
+ }
46
+ export interface InputAudioContent {
47
+ type: 'input_audio';
48
+ audio: AudioBase64Bytes;
49
+ }
50
+ export interface TextContent {
51
+ type: 'text';
52
+ text: string;
53
+ }
54
+ export interface AudioContent {
55
+ type: 'audio';
56
+ audio: AudioBase64Bytes;
57
+ transcript: string;
58
+ }
59
+ export type Content = InputTextContent | InputAudioContent | TextContent | AudioContent;
60
+ export type ContentPart = {
61
+ type: 'text' | 'audio';
62
+ audio?: AudioBase64Bytes;
63
+ transcript?: string;
64
+ };
65
+ export interface BaseItem {
66
+ id: string;
67
+ object: 'realtime.item';
68
+ type: string;
69
+ }
70
+ export interface SystemItem extends BaseItem {
71
+ type: 'message';
72
+ role: 'system';
73
+ content: InputTextContent;
74
+ }
75
+ export interface UserItem extends BaseItem {
76
+ type: 'message';
77
+ role: 'user';
78
+ content: (InputTextContent | InputAudioContent)[];
79
+ }
80
+ export interface AssistantItem extends BaseItem {
81
+ type: 'message';
82
+ role: 'assistant';
83
+ content: (TextContent | AudioContent)[];
84
+ }
85
+ export interface FunctionCallItem extends BaseItem {
86
+ type: 'function_call';
87
+ call_id: string;
88
+ name: string;
89
+ arguments: string;
90
+ }
91
+ export interface FunctionCallOutputItem extends BaseItem {
92
+ type: 'function_call_output';
93
+ call_id: string;
94
+ output: string;
95
+ }
96
+ export type ItemResource = SystemItem | UserItem | AssistantItem | FunctionCallItem | FunctionCallOutputItem;
97
+ export interface SessionResource {
98
+ id: string;
99
+ object: 'realtime.session';
100
+ model: string;
101
+ modalities: ['text', 'audio'] | ['text'];
102
+ instructions: string;
103
+ voice: Voice;
104
+ input_audio_format: AudioFormat;
105
+ output_audio_format: AudioFormat;
106
+ input_audio_transcription: InputAudioTranscription | null;
107
+ turn_detection: TurnDetectionType | null;
108
+ tools: Tool[];
109
+ tool_choice: ToolChoice;
110
+ temperature: number;
111
+ max_response_output_tokens: number | 'inf';
112
+ expires_at: number;
113
+ }
114
+ export interface ConversationResource {
115
+ id: string;
116
+ object: 'realtime.conversation';
117
+ }
118
+ export type ResponseStatusDetails = {
119
+ type: 'incomplete';
120
+ reason: 'max_output_tokens' | 'content_filter' | string;
121
+ } | {
122
+ type: 'failed';
123
+ error?: {
124
+ code: 'server_error' | 'rate_limit_exceeded' | string;
125
+ message: string;
126
+ };
127
+ } | {
128
+ type: 'cancelled';
129
+ reason: 'turn_detected' | 'client_cancelled' | string;
130
+ };
131
+ export interface ModelUsage {
132
+ total_tokens: number;
133
+ input_tokens: number;
134
+ output_tokens: number;
135
+ input_token_details: {
136
+ text_tokens: number;
137
+ audio_tokens: number;
138
+ cached_tokens: number;
139
+ cached_tokens_details: {
140
+ text_tokens: number;
141
+ audio_tokens: number;
142
+ };
143
+ };
144
+ output_token_details: {
145
+ text_tokens: number;
146
+ audio_tokens: number;
147
+ };
148
+ }
149
+ export interface ResponseResource {
150
+ id: string;
151
+ object: 'realtime.response';
152
+ status: ResponseStatus;
153
+ status_details: ResponseStatusDetails;
154
+ output: ItemResource[];
155
+ usage?: ModelUsage;
156
+ }
157
+ interface BaseClientEvent {
158
+ event_id?: string;
159
+ type: ClientEventType;
160
+ }
161
+ export interface SessionUpdateEvent extends BaseClientEvent {
162
+ type: 'session.update';
163
+ session: Partial<{
164
+ modalities: ['text', 'audio'] | ['text'];
165
+ instructions: string;
166
+ voice: Voice;
167
+ input_audio_format: AudioFormat;
168
+ output_audio_format: AudioFormat;
169
+ input_audio_transcription: InputAudioTranscription | null;
170
+ turn_detection: TurnDetectionType | null;
171
+ tools: Tool[];
172
+ tool_choice: ToolChoice;
173
+ temperature: number;
174
+ max_response_output_tokens?: number | 'inf';
175
+ }>;
176
+ }
177
+ export interface InputAudioBufferAppendEvent extends BaseClientEvent {
178
+ type: 'input_audio_buffer.append';
179
+ audio: AudioBase64Bytes;
180
+ }
181
+ export interface InputAudioBufferCommitEvent extends BaseClientEvent {
182
+ type: 'input_audio_buffer.commit';
183
+ }
184
+ export interface InputAudioBufferClearEvent extends BaseClientEvent {
185
+ type: 'input_audio_buffer.clear';
186
+ }
187
+ export interface UserItemCreate {
188
+ type: 'message';
189
+ role: 'user';
190
+ content: (InputTextContent | InputAudioContent)[];
191
+ }
192
+ export interface AssistantItemCreate {
193
+ type: 'message';
194
+ role: 'assistant';
195
+ content: TextContent[];
196
+ }
197
+ export interface SystemItemCreate {
198
+ type: 'message';
199
+ role: 'system';
200
+ content: InputTextContent[];
201
+ }
202
+ export interface FunctionCallOutputItemCreate {
203
+ type: 'function_call_output';
204
+ call_id: string;
205
+ output: string;
206
+ }
207
+ export type ConversationItemCreateContent = UserItemCreate | AssistantItemCreate | SystemItemCreate | FunctionCallOutputItemCreate;
208
+ export interface ConversationItemCreateEvent extends BaseClientEvent {
209
+ type: 'conversation.item.create';
210
+ previous_item_id?: string;
211
+ item: ConversationItemCreateContent;
212
+ }
213
+ export interface ConversationItemTruncateEvent extends BaseClientEvent {
214
+ type: 'conversation.item.truncate';
215
+ item_id: string;
216
+ content_index: number;
217
+ audio_end_ms: number;
218
+ }
219
+ export interface ConversationItemDeleteEvent extends BaseClientEvent {
220
+ type: 'conversation.item.delete';
221
+ item_id: string;
222
+ }
223
+ export interface ResponseCreateEvent extends BaseClientEvent {
224
+ type: 'response.create';
225
+ response?: Partial<{
226
+ modalities: ['text', 'audio'] | ['text'];
227
+ instructions: string;
228
+ voice: Voice;
229
+ output_audio_format: AudioFormat;
230
+ tools?: Tool[];
231
+ tool_choice: ToolChoice;
232
+ temperature: number;
233
+ max_output_tokens: number | 'inf';
234
+ }>;
235
+ }
236
+ export interface ResponseCancelEvent extends BaseClientEvent {
237
+ type: 'response.cancel';
238
+ }
239
+ export type ClientEvent = SessionUpdateEvent | InputAudioBufferAppendEvent | InputAudioBufferCommitEvent | InputAudioBufferClearEvent | ConversationItemCreateEvent | ConversationItemTruncateEvent | ConversationItemDeleteEvent | ResponseCreateEvent | ResponseCancelEvent;
240
+ interface BaseServerEvent {
241
+ event_id: string;
242
+ type: ServerEventType;
243
+ }
244
+ export interface ErrorEvent extends BaseServerEvent {
245
+ type: 'error';
246
+ error: {
247
+ type: 'invalid_request_error' | 'server_error' | string;
248
+ code?: string;
249
+ message: string;
250
+ param: string;
251
+ event_id: string;
252
+ };
253
+ }
254
+ export interface SessionCreatedEvent extends BaseServerEvent {
255
+ type: 'session.created';
256
+ session: SessionResource;
257
+ }
258
+ export interface SessionUpdatedEvent extends BaseServerEvent {
259
+ type: 'session.updated';
260
+ session: SessionResource;
261
+ }
262
+ export interface ConversationCreatedEvent extends BaseServerEvent {
263
+ type: 'conversation.created';
264
+ conversation: ConversationResource;
265
+ }
266
+ export interface InputAudioBufferCommittedEvent extends BaseServerEvent {
267
+ type: 'input_audio_buffer.committed';
268
+ item_id: string;
269
+ }
270
+ export interface InputAudioBufferClearedEvent extends BaseServerEvent {
271
+ type: 'input_audio_buffer.cleared';
272
+ }
273
+ export interface InputAudioBufferSpeechStartedEvent extends BaseServerEvent {
274
+ type: 'input_audio_buffer.speech_started';
275
+ audio_start_ms: number;
276
+ item_id: string;
277
+ }
278
+ export interface InputAudioBufferSpeechStoppedEvent extends BaseServerEvent {
279
+ type: 'input_audio_buffer.speech_stopped';
280
+ audio_end_ms: number;
281
+ item_id: string;
282
+ }
283
+ export interface ConversationItemCreatedEvent extends BaseServerEvent {
284
+ type: 'conversation.item.created';
285
+ item: ItemResource;
286
+ }
287
+ export interface ConversationItemInputAudioTranscriptionCompletedEvent extends BaseServerEvent {
288
+ type: 'conversation.item.input_audio_transcription.completed';
289
+ item_id: string;
290
+ content_index: number;
291
+ transcript: string;
292
+ }
293
+ export interface ConversationItemInputAudioTranscriptionFailedEvent extends BaseServerEvent {
294
+ type: 'conversation.item.input_audio_transcription.failed';
295
+ item_id: string;
296
+ content_index: number;
297
+ error: {
298
+ type: string;
299
+ code?: string;
300
+ message: string;
301
+ param: null;
302
+ };
303
+ }
304
+ export interface ConversationItemTruncatedEvent extends BaseServerEvent {
305
+ type: 'conversation.item.truncated';
306
+ item_id: string;
307
+ content_index: number;
308
+ audio_end_ms: number;
309
+ }
310
+ export interface ConversationItemDeletedEvent extends BaseServerEvent {
311
+ type: 'conversation.item.deleted';
312
+ item_id: string;
313
+ }
314
+ export interface ResponseCreatedEvent extends BaseServerEvent {
315
+ type: 'response.created';
316
+ response: ResponseResource;
317
+ }
318
+ export interface ResponseDoneEvent extends BaseServerEvent {
319
+ type: 'response.done';
320
+ response: ResponseResource;
321
+ }
322
+ export interface ResponseOutputItemAddedEvent extends BaseServerEvent {
323
+ type: 'response.output_item.added';
324
+ response_id: string;
325
+ output_index: number;
326
+ item: ItemResource;
327
+ }
328
+ export interface ResponseOutputItemDoneEvent extends BaseServerEvent {
329
+ type: 'response.output_item.done';
330
+ response_id: string;
331
+ output_index: number;
332
+ item: ItemResource;
333
+ }
334
+ export interface ResponseContentPartAddedEvent extends BaseServerEvent {
335
+ type: 'response.content_part.added';
336
+ response_id: string;
337
+ item_id: string;
338
+ output_index: number;
339
+ content_index: number;
340
+ part: ContentPart;
341
+ }
342
+ export interface ResponseContentPartDoneEvent extends BaseServerEvent {
343
+ type: 'response.content_part.done';
344
+ response_id: string;
345
+ output_index: number;
346
+ content_index: number;
347
+ part: ContentPart;
348
+ }
349
+ export interface ResponseTextDeltaEvent extends BaseServerEvent {
350
+ type: 'response.text.delta';
351
+ response_id: string;
352
+ output_index: number;
353
+ content_index: number;
354
+ delta: string;
355
+ }
356
+ export interface ResponseTextDoneEvent extends BaseServerEvent {
357
+ type: 'response.text.done';
358
+ response_id: string;
359
+ output_index: number;
360
+ content_index: number;
361
+ text: string;
362
+ }
363
+ export interface ResponseAudioTranscriptDeltaEvent extends BaseServerEvent {
364
+ type: 'response.audio_transcript.delta';
365
+ response_id: string;
366
+ output_index: number;
367
+ content_index: number;
368
+ delta: string;
369
+ }
370
+ export interface ResponseAudioTranscriptDoneEvent extends BaseServerEvent {
371
+ type: 'response.audio_transcript.done';
372
+ response_id: string;
373
+ output_index: number;
374
+ content_index: number;
375
+ transcript: string;
376
+ }
377
+ export interface ResponseAudioDeltaEvent extends BaseServerEvent {
378
+ type: 'response.audio.delta';
379
+ response_id: string;
380
+ output_index: number;
381
+ content_index: number;
382
+ delta: AudioBase64Bytes;
383
+ }
384
+ export interface ResponseAudioDoneEvent extends BaseServerEvent {
385
+ type: 'response.audio.done';
386
+ response_id: string;
387
+ output_index: number;
388
+ content_index: number;
389
+ }
390
+ export interface ResponseFunctionCallArgumentsDeltaEvent extends BaseServerEvent {
391
+ type: 'response.function_call_arguments.delta';
392
+ response_id: string;
393
+ output_index: number;
394
+ delta: string;
395
+ }
396
+ export interface ResponseFunctionCallArgumentsDoneEvent extends BaseServerEvent {
397
+ type: 'response.function_call_arguments.done';
398
+ response_id: string;
399
+ output_index: number;
400
+ arguments: string;
401
+ }
402
+ export interface RateLimitsUpdatedEvent extends BaseServerEvent {
403
+ type: 'rate_limits.updated';
404
+ rate_limits: {
405
+ name: 'requests' | 'tokens' | 'input_tokens' | 'output_tokens' | string;
406
+ limit: number;
407
+ remaining: number;
408
+ reset_seconds: number;
409
+ }[];
410
+ }
411
+ export type ServerEvent = ErrorEvent | SessionCreatedEvent | SessionUpdatedEvent | ConversationCreatedEvent | InputAudioBufferCommittedEvent | InputAudioBufferClearedEvent | InputAudioBufferSpeechStartedEvent | InputAudioBufferSpeechStoppedEvent | ConversationItemCreatedEvent | ConversationItemInputAudioTranscriptionCompletedEvent | ConversationItemInputAudioTranscriptionFailedEvent | ConversationItemTruncatedEvent | ConversationItemDeletedEvent | ResponseCreatedEvent | ResponseDoneEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent | ResponseContentPartAddedEvent | ResponseContentPartDoneEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent | ResponseAudioTranscriptDeltaEvent | ResponseAudioTranscriptDoneEvent | ResponseAudioDeltaEvent | ResponseAudioDoneEvent | ResponseFunctionCallArgumentsDeltaEvent | ResponseFunctionCallArgumentsDoneEvent | RateLimitsUpdatedEvent;
412
+ export {};
413
+ //# sourceMappingURL=api_proto.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './api_proto.js';
2
+ export * from './realtime_model.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -276,7 +276,7 @@ class RealtimeModel extends import_agents.multimodal.RealtimeModel {
276
276
  entraToken = void 0
277
277
  }) {
278
278
  super();
279
- if (apiKey === "") {
279
+ if (apiKey === "" && !(isAzure && entraToken)) {
280
280
  throw new Error(
281
281
  "OpenAI API key is required, either using the argument or by setting the OPENAI_API_KEY environmental variable"
282
282
  );