diff --git a/packages/openai_dart/oas/main.dart b/packages/openai_dart/oas/main.dart index 2b8573f8..8e0ddce5 100644 --- a/packages/openai_dart/oas/main.dart +++ b/packages/openai_dart/oas/main.dart @@ -3,7 +3,7 @@ import 'dart:io'; import 'package:openapi_spec/openapi_spec.dart'; -/// Generates Chroma API client Dart code from the OpenAPI spec. +/// Generates OpenAI API client Dart code from the OpenAPI spec. /// Official spec: https://github.com/openai/openai-openapi/blob/master/openapi.yaml void main() async { final spec = OpenApi.fromFile(source: 'oas/openapi_curated.yaml'); diff --git a/packages/openai_realtime_dart/README.md b/packages/openai_realtime_dart/README.md index 0c2c2f05..cb5b2764 100644 --- a/packages/openai_realtime_dart/README.md +++ b/packages/openai_realtime_dart/README.md @@ -36,28 +36,33 @@ final client = RealtimeClient( ); // Can set parameters ahead of connecting, either separately or all at once -client.updateSession(instructions: 'You are a great, upbeat friend.'); -client.updateSession(voice: 'alloy'); -client.updateSession( - turnDetection: {'type': 'none'}, - inputAudioTranscription: {'model': 'whisper-1'}, +await client.updateSession(instructions: 'You are a great, upbeat friend.'); +await client.updateSession(voice: Voice.alloy); +await client.updateSession( + turnDetection: TurnDetection( + type: TurnDetectionType.serverVad, + ), + inputAudioTranscription: InputAudioTranscriptionConfig( + model: 'whisper-1', + ), ); // Set up event handling -client.on('conversation.updated', (event) { +client.on(RealtimeEventType.conversationUpdated, (event) { // item is the current item being updated - final item = event?['item']; - // delta can be null or populated - final delta = event?['delta']; + final result = (event as RealtimeEventConversationUpdated).result; + final item = result.item; + final delta = result.delta; // you can fetch a full list of items at any time + final items = client.conversation.getItems(); }); // Connect to Realtime API await client.connect(); // Send a item and triggers a generation -client.sendUserMessageContent([ - {'type': 'input_text', 'text': 'How are you?'}, +await client.sendUserMessageContent([ + const ContentPart.inputText(text: 'How are you?'), ]); ``` @@ -94,7 +99,7 @@ In this package, there are three primitives for interfacing with the Realtime AP - Thin wrapper over [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) - Use this for connecting to the API, authenticating, and sending items - There is **no item validation**, you will have to rely on the API specification directly - - Dispatches events as `server.{event_name}` and `client.{event_name}`, respectively + - Dispatches events according to the `RealtimeEventType` enum 3. [`RealtimeConversation`](./lib/src/conversation.dart) - Exists on client instance as `client.conversation` - Stores a client-side cache of the current conversation @@ -109,18 +114,18 @@ The client comes packaged with some basic utilities that make it easy to build r Sending messages to the server from the user is easy. ```dart -client.sendUserMessageContent([ - {'type': 'input_text', 'text': 'How are you?'}, +await client.sendUserMessageContent([ + const ContentPart.inputText(text: 'How are you?'), ]); // or (empty audio) -client.sendUserMessageContent([ - {'type': 'input_audio', 'audio': Uint8List(0)}, +await client.sendUserMessageContent([ + ContentPart.inputAudio(audio: ''), // Base64 encoded audio ]); ``` ### Sending streaming audio -To send streaming audio, use the `.appendInputAudio()` method. If you're in `turn_detection: 'disabled'` mode, then you need to use `.createResponse()` to tell the model to respond. +To send streaming audio, use the `.appendInputAudio()` method. If you're in manual mode (no turn detection), then you need to use `.createResponse()` to tell the model to respond. ```dart // Send user audio, must be Uint8List @@ -132,10 +137,10 @@ for (var i = 0; i < 10; i++) { final value = (Random().nextDouble() * 2 - 1) * 0x8000; data[n] = value.toInt(); } - client.appendInputAudio(data); + await client.appendInputAudio(data); } // Pending audio is committed and model is asked to generate -client.createResponse(); +await client.createResponse(); ``` ### Adding and using tools @@ -143,42 +148,37 @@ client.createResponse(); Working with tools is easy. Just call `.addTool()` and set a callback as the second parameter. The callback will be executed with the parameters for the tool, and the result will be automatically sent back to the model. ```dart -// We can add tools as well, with callbacks specified -client.addTool( - { - 'name': 'get_weather', - 'description': 'Retrieves the weather for a given lat, lng coordinate pair. Specify a label for the location.', - 'parameters': { +await client.addTool( + const ToolDefinition( + name: 'get_weather', + description: 'Retrieves the weather for a location given its latitude and longitude coordinate pair.', + parameters: { 'type': 'object', 'properties': { 'lat': { 'type': 'number', - 'description': 'Latitude', + 'description': 'Latitude of the location', }, 'lng': { 'type': 'number', - 'description': 'Longitude', - }, - 'location': { - 'type': 'string', - 'description': 'Name of the location', + 'description': 'Longitude of the location', }, }, - 'required': ['lat', 'lng', 'location'], + 'required': ['lat', 'lng'], }, - }, + ), (Map params) async { final result = await HttpClient() .getUrl( Uri.parse( 'https://api.open-meteo.com/v1/forecast?' - 'latitude=${params['lat']}&' - 'longitude=${params['lng']}&' - 'current=temperature_2m,wind_speed_10m', + 'latitude=${params['lat']}&' + 'longitude=${params['lng']}&' + 'current=temperature_2m,wind_speed_10m', ), ) .then((request) => request.close()) - .then((response) => response.transform(Utf8Decoder()).join()) + .then((res) => res.transform(const Utf8Decoder()).join()) .then(jsonDecode); return result; }, @@ -189,19 +189,17 @@ client.addTool( The `.addTool()` method automatically runs a tool handler and triggers a response on handler completion. Sometimes you may not want that, for example: using tools to generate a schema that you use for other purposes. -In this case, we can use the `tools` item with `updateSession`. In this case you **must** specify `type: 'function'`, which is not required for `.addTool()`. +In this case, we can use the `tools` parameter with `updateSession`. **Note:** Tools added with `.addTool()` will **not** be overridden when updating sessions manually like this, but every `updateSession()` change will override previous `updateSession()` changes. Tools added via `.addTool()` are persisted and appended to anything set manually here. ```dart -client.updateSession( +await client.updateSession( tools: [ - { - 'type': 'function', - 'name': 'get_weather', - 'description': - 'Retrieves the weather for a given lat, lng coordinate pair. Specify a label for the location.', - 'parameters': { + const ToolDefinition( + name: 'get_weather', + description: 'Retrieves the weather for a location given its latitude and longitude coordinate pair.', + parameters: { 'type': 'object', 'properties': { 'lat': { @@ -212,14 +210,10 @@ client.updateSession( 'type': 'number', 'description': 'Longitude', }, - 'location': { - 'type': 'string', - 'description': 'Name of the location', - }, }, - 'required': ['lat', 'lng', 'location'], + 'required': ['lat', 'lng'], }, - }, + ), ], ); ``` @@ -227,9 +221,9 @@ client.updateSession( Then, to handle function calls... ```dart -client.on('conversation.item.completed', (event) { - final item = event?['item'] as Map?; - if (item?['type'] == 'function_call') { +client.on(RealtimeEventType.conversationItemCompleted, (event) { + final item = (event as RealtimeEventConversationItemCompleted).item; + if (item.item is ItemFunctionCall) { // your function call is complete, execute some custom code } }); @@ -237,99 +231,97 @@ client.on('conversation.item.completed', (event) { ### Interrupting the model -You may want to manually interrupt the model, especially in `turn_detection: 'disabled'` mode. To do this, we can use: +You may want to manually interrupt the model, especially when not using turn detection. To do this, we can use: ```dart // id is the id of the item currently being generated // sampleCount is the number of audio samples that have been heard by the listener -client.cancelResponse(id, sampleCount); +await client.cancelResponse(id, sampleCount); ``` This method will cause the model to immediately cease generation, but also truncate the item being played by removing all audio after `sampleCount` and clearing the text response. By using this method you can interrupt the model and prevent it from "remembering" anything it has generated that is ahead of where the user's state is. ## Client events -If you need more manual control and want to send custom client events according to the [Realtime Client Events API Reference](https://platform.openai.com/docs/api-reference/realtime-client-events), you can use `client.realtime.send()` like so: +The `RealtimeClient` provides strongly typed events that map to the [Realtime API Events](https://platform.openai.com/docs/api-reference/realtime-events). You can listen to specific events using the `RealtimeEventType` enum. ```dart -client.realtime.send('conversation.item.create', { - 'item': { - 'type': 'function_call_output', - 'call_id': 'my-call-id', - 'output': '{function_succeeded:true}', - }, -}); +client.realtime.send( + RealtimeEvent.conversationItemCreate( + eventId: RealtimeUtils.generateId(), + item: Item.functionCallOutput( + id: RealtimeUtils.generateId(), + callId: 'my-call-id', + output: '{function_succeeded:true}', + ), + ), +); ``` ### Utility events -With `RealtimeClient` we have reduced the event overhead from server events to **five** main events that are most critical for your application control flow. These events **are not** part of the API specification itself, but wrap logic to make application development easier. +With `RealtimeClient` we have reduced the event overhead from server events to **five** main events that are most critical for your application control flow: ```dart // Errors like connection failures -client.on('error', (event) { - // do something +client.on(RealtimeEventType.error, (event) { + final error = (event as RealtimeEventError).error; + // do something with the error }); // In VAD mode, the user starts speaking // we can use this to stop audio playback of a previous response if necessary -client.on('conversation.interrupted', (event) { - // do something +client.on(RealtimeEventType.conversationInterrupted, (event) { + // handle interruption }); // Includes all changes to conversations -// delta may be populated -client.on('conversation.updated', (event) { - final item = event?['item'] as Map?; - final delta = event?['delta'] as Map?; +client.on(RealtimeEventType.conversationUpdated, (event) { + final result = (event as RealtimeEventConversationUpdated).result; + final item = result.item; + final delta = result.delta; // get all items, e.g. if you need to update a chat window final items = client.conversation.getItems(); - final type = item?['type'] as String?; - switch (type) { - case 'message': - // system, user, or assistant message (item.role) - case 'function_call': - // always a function call from the model - case 'function_call_output': - // always a response from the user / application + if (item?.item case final ItemMessage message) { + // system, user, or assistant message (message.role) + } else if (item?.item case final ItemFunctionCall functionCall) { + // always a function call from the model + } else if (item?.item case final ItemFunctionCallOutput functionCallOutput) { + // always a response from the user / application } + if (delta != null) { // Only one of the following will be populated for any given event - // delta['audio'] -> Uint8List, audio added - // delta['transcript'] -> string, transcript added - // delta['arguments'] -> string, function arguments added + // delta.audio -> Uint8List, audio added + // delta.transcript -> string, transcript added + // delta.arguments -> string, function arguments added } }); // Only triggered after item added to conversation -client.on('conversation.item.appended', (event) { - final item = event?['item'] as Map?; - // item?['status'] -> can be 'in_progress' or 'completed' +client.on(RealtimeEventType.conversationItemAppended, (event) { + final item = (event as RealtimeEventConversationItemAppended).item; + // item.status can be ItemStatus.inProgress or ItemStatus.completed }); // Only triggered after item completed in conversation // will always be triggered after conversation.item.appended -client.on('conversation.item.completed', (event) { - final item = event?['item'] as Map?; - // item?['status'] -> will always be 'completed' +client.on(RealtimeEventType.conversationItemCompleted, (event) { + final item = (event as RealtimeEventConversationItemCompleted).item; + // item.status will always be ItemStatus.completed }); ``` ### Server events -If you want more control over your application development, you can use the `realtime.event` event and choose only to respond to **server** events. The full documentation for these events are available on the [Realtime Server Events API Reference](https://platform.openai.com/docs/api-reference/realtime-server-events). +If you want more control over your application development, you can use the `RealtimeEventType.all` event and choose only to respond to **server** events. The full documentation for these events are available on the [Realtime Server Events API Reference](https://platform.openai.com/docs/api-reference/realtime-server-events). ```dart // all events, can use for logging, debugging, or manual event handling -client.on('realtime.event', (event ) { - final time = event?['time'] as String?; - final source = event?['source'] as String?; - final eventPayload = event?['event'] as Map?; - if (source == 'server') { - // do something - } +client.on(RealtimeEventType.all, (event) { + // Handle any RealtimeEvent }); ``` diff --git a/packages/openai_realtime_dart/build.yaml b/packages/openai_realtime_dart/build.yaml new file mode 100644 index 00000000..dee719ac --- /dev/null +++ b/packages/openai_realtime_dart/build.yaml @@ -0,0 +1,13 @@ +targets: + $default: + builders: + source_gen|combining_builder: + options: + ignore_for_file: + - prefer_final_parameters + - require_trailing_commas + - non_constant_identifier_names + - unnecessary_null_checks + json_serializable: + options: + explicit_to_json: true diff --git a/packages/openai_realtime_dart/example/openai_realtime_dart_example.dart b/packages/openai_realtime_dart/example/openai_realtime_dart_example.dart index 072f5046..b830d92c 100644 --- a/packages/openai_realtime_dart/example/openai_realtime_dart_example.dart +++ b/packages/openai_realtime_dart/example/openai_realtime_dart_example.dart @@ -9,19 +9,21 @@ Future main() async { ); // Can set parameters ahead of connecting, either separately or all at once - client.updateSession(instructions: 'You are a great, upbeat friend.'); - client.updateSession(voice: 'alloy'); - client.updateSession( - turnDetection: {'type': 'none'}, - inputAudioTranscription: {'model': 'whisper-1'}, + await client.updateSession(instructions: 'You are a great, upbeat friend.'); + await client.updateSession(voice: Voice.alloy); + await client.updateSession( + turnDetection: null, + inputAudioTranscription: + const InputAudioTranscriptionConfig(model: 'whisper-1'), ); // Set up event handling - client.on('conversation.updated', (event) { + client.on(RealtimeEventType.conversationUpdated, (e) { + final event = e as RealtimeEventConversationUpdated; // item is the current item being updated - final item = event?['item']; + final item = event.result.item; // delta can be null or populated - final delta = event?['delta']; + final delta = event.result.delta; // you can fetch a full list of items at any time }); @@ -29,7 +31,7 @@ Future main() async { await client.connect(); // Send a item and triggers a generation - client.sendUserMessageContent([ - {'type': 'input_text', 'text': 'How are you?'}, + await client.sendUserMessageContent(const [ + ContentPart.text(text: 'How are you?'), ]); } diff --git a/packages/openai_realtime_dart/lib/openai_realtime_dart.dart b/packages/openai_realtime_dart/lib/openai_realtime_dart.dart index 5334e883..36c06a3a 100644 --- a/packages/openai_realtime_dart/lib/openai_realtime_dart.dart +++ b/packages/openai_realtime_dart/lib/openai_realtime_dart.dart @@ -5,3 +5,4 @@ export 'src/api.dart'; export 'src/client.dart'; export 'src/conversation.dart'; export 'src/event_handler.dart'; +export 'src/schema/schema.dart'; diff --git a/packages/openai_realtime_dart/lib/src/api.dart b/packages/openai_realtime_dart/lib/src/api.dart index d04c83df..eb7528ea 100644 --- a/packages/openai_realtime_dart/lib/src/api.dart +++ b/packages/openai_realtime_dart/lib/src/api.dart @@ -7,6 +7,7 @@ import 'package:web_socket_channel/status.dart' as status; import 'package:web_socket_channel/web_socket_channel.dart'; import 'event_handler.dart'; +import 'schema/generated/schema/schema.dart'; import 'utils.dart'; import 'web_socket/web_socket.dart'; @@ -76,15 +77,27 @@ class RealtimeAPI extends RealtimeEventHandler { _ws!.stream.listen( (data) { final message = json.decode(data) as Map; - receive(message['type'], message); + receive(message); }, onError: (dynamic error) { _log.severe('Error', error); - dispatch('close', {'error': true}); + dispatch( + RealtimeEventType.close, + RealtimeEvent.close( + eventId: RealtimeUtils.generateId(), + error: true, + ), + ); }, onDone: () { _log.info('Disconnected from "$url"'); - dispatch('close', {'error': false}); + dispatch( + RealtimeEventType.close, + RealtimeEvent.close( + eventId: RealtimeUtils.generateId(), + error: false, + ), + ); }, ); @@ -119,42 +132,69 @@ class RealtimeAPI extends RealtimeEventHandler { } /// Receives an event from WebSocket and dispatches as - /// "server.{eventName}" and "server.*" events. - void receive(String eventName, Map event) { - _logEvent(eventName, event, fromClient: false); - dispatch('server.$eventName', event); - dispatch('server.*', event); + /// "[RealtimeEventType]" and "[RealtimeEventType.serverAll]" events. + Future receive(Map eventData) async { + final event = RealtimeEvent.fromJson(eventData); + _logEvent(event, fromClient: false); + await dispatch(event.type, event); + await dispatch(RealtimeEventType.serverAll, event); + await dispatch(RealtimeEventType.all, event); } - /// Sends an event to WebSocket and dispatches as "client.{eventName}" - /// and "client.*" events. - void send(String eventName, [Map? data]) { + /// Sends an event to WebSocket and dispatches as "[RealtimeEventType]" + /// and "[RealtimeEventType.clientAll]" events. + Future send(RealtimeEvent event) async { if (!isConnected()) { throw Exception('RealtimeAPI is not connected'); } - final event = { - 'event_id': RealtimeUtils.generateId('evt_'), - 'type': eventName, - ...?data, - }; + final finalEvent = event.copyWith( + eventId: RealtimeUtils.generateId(), + ); - dispatch('client.$eventName', event); - dispatch('client.*', event); - _logEvent(eventName, event, fromClient: true); + _logEvent(finalEvent, fromClient: true); + await dispatch(finalEvent.type, finalEvent); + await dispatch(RealtimeEventType.clientAll, finalEvent); + await dispatch(RealtimeEventType.all, finalEvent); - _ws!.sink.add(json.encode(event)); + final data = json.encode(finalEvent.toJson()); + _ws!.sink.add(data); } void _logEvent( - String name, - Map event, { + RealtimeEvent event, { required bool fromClient, }) { - final eventString = event.toString(); - final eventLength = eventString.length; - final eventFormatted = - eventString.substring(0, eventLength > 200 ? 200 : eventLength); - _log.info('${fromClient ? 'sent' : 'received'}: $name $eventFormatted'); + if (!debug) { + return; + } + + final eventJson = event.toJson(); + + // Recursive function to replace "audio" property content + void replaceAudioProperty(dynamic json) { + if (json is Map) { + json.forEach((key, value) { + if (key == 'audio' || + (key == 'delta' && json['type'] == 'response.audio.delta')) { + json[key] = 'base64-encoded-audio'; + } else { + replaceAudioProperty(value); + } + }); + } else if (json is List) { + for (var i = 0; i < json.length; i++) { + replaceAudioProperty(json[i]); + } + } + } + + // Replace "audio" property content in the event JSON + replaceAudioProperty(eventJson); + + final eventString = jsonEncode(eventJson); + _log.info( + '${fromClient ? 'sent' : 'received'}: ${event.type.name} $eventString', + ); } } diff --git a/packages/openai_realtime_dart/lib/src/client.dart b/packages/openai_realtime_dart/lib/src/client.dart index 48236b6f..3aa6df7e 100644 --- a/packages/openai_realtime_dart/lib/src/client.dart +++ b/packages/openai_realtime_dart/lib/src/client.dart @@ -6,6 +6,8 @@ import 'package:logging/logging.dart'; import 'api.dart'; import 'conversation.dart'; import 'event_handler.dart'; +import 'schema/generated/schema/schema.dart'; +import 'schema/schema.dart'; import 'utils.dart'; final _log = Logger('openai_realtime_dart.api'); @@ -48,10 +50,10 @@ class RealtimeClient extends RealtimeEventHandler { final RealtimeConversation conversation; /// The session configuration. - Map sessionConfig = {}; + late SessionConfig sessionConfig; /// The tools added to the client. - final Map tools = {}; + final Map tools = {}; /// Whether the session has been created. bool sessionCreated = false; @@ -62,142 +64,170 @@ class RealtimeClient extends RealtimeEventHandler { void _resetConfig() { sessionCreated = false; tools.clear(); - sessionConfig = { - 'modalities': ['text', 'audio'], - 'instructions': '', - 'voice': 'alloy', - 'input_audio_format': 'pcm16', - 'output_audio_format': 'pcm16', - 'input_audio_transcription': null, - 'turn_detection': null, - 'tools': [], - 'tool_choice': 'auto', - 'temperature': 0.8, - 'max_response_output_tokens': 4096, - }; + sessionConfig = const SessionConfig( + modalities: [Modality.text, Modality.audio], + instructions: '', + voice: Voice.alloy, + inputAudioFormat: AudioFormat.pcm16, + outputAudioFormat: AudioFormat.pcm16, + inputAudioTranscription: null, + turnDetection: null, + tools: [], + toolChoice: SessionConfigToolChoice.mode( + SessionConfigToolChoiceMode.auto, + ), + temperature: 0.8, + maxResponseOutputTokens: SessionConfigMaxResponseOutputTokens.int(4096), + ); inputAudioBuffer = Uint8List(0); } void _addApiEventHandlers() { realtime - ..on('client.*', (event) { - dispatch('realtime.event', { - 'time': DateTime.now().toIso8601String(), - 'source': 'client', - 'event': event, - }); - }) - ..on('server.*', (event) { - dispatch('realtime.event', { - 'time': DateTime.now().toIso8601String(), - 'source': 'server', - 'event': event, - }); - }) - ..on('server.session.created', (_) => sessionCreated = true); + ..on(RealtimeEventType.sessionCreated, (_) => sessionCreated = true) + ..on( + RealtimeEventType.all, + ((e) async => dispatch(RealtimeEventType.all, e)), + ); - Future> handler( - Map? event, [ + FutureOr handler( + RealtimeEvent event, [ dynamic args, ]) async { return conversation.processEvent(event, args); } - Future> handlerWithDispatch( - Map? event, [ + Future handlerWithDispatch( + RealtimeEvent event, [ dynamic args, ]) async { final result = await handler(event, args); - if (result['item'] != null) { - dispatch('conversation.updated', result); + if (result.item != null) { + await dispatch( + RealtimeEventType.conversationUpdated, + RealtimeEvent.conversationUpdated( + eventId: RealtimeUtils.generateId(), + result: result, + ), + ); } return result; } realtime - ..on('server.response.created', handler) - ..on('server.response.output_item.added', handler) - ..on('server.response.content_part.added', handler) - ..on('server.input_audio_buffer.speech_started', (event) async { + ..on(RealtimeEventType.responseCreated, handler) + ..on(RealtimeEventType.responseOutputItemAdded, handler) + ..on(RealtimeEventType.responseContentPartAdded, handler) + ..on(RealtimeEventType.inputAudioBufferSpeechStarted, (event) async { await handler(event); - dispatch('conversation.interrupted', null); + await dispatch( + RealtimeEventType.conversationInterrupted, + RealtimeEvent.conversationInterrupted( + eventId: RealtimeUtils.generateId(), + ), + ); }) ..on( - 'server.input_audio_buffer.speech_stopped', + RealtimeEventType.inputAudioBufferSpeechStopped, (event) async => handler(event, inputAudioBuffer), ) - ..on('server.conversation.item.created', (event) async { + ..on(RealtimeEventType.conversationItemCreated, (event) async { final result = await handlerWithDispatch(event); - final item = result['item'] as Map?; - dispatch('conversation.item.appended', {'item': item}); - if (item?['status'] == 'completed') { - dispatch('conversation.item.completed', {'item': item}); + await dispatch( + RealtimeEventType.conversationItemAppended, + RealtimeEvent.conversationItemAppended( + eventId: RealtimeUtils.generateId(), + item: result.item!, + ), + ); + if (result.item?.item.status == ItemStatus.completed) { + await dispatch( + RealtimeEventType.conversationItemCompleted, + RealtimeEvent.conversationItemCompleted( + eventId: RealtimeUtils.generateId(), + item: result.item!, + ), + ); } }) - ..on('server.conversation.item.truncated', handlerWithDispatch) - ..on('server.conversation.item.deleted', handlerWithDispatch) + ..on(RealtimeEventType.conversationItemTruncated, handlerWithDispatch) + ..on(RealtimeEventType.conversationItemDeleted, handlerWithDispatch) + ..on( + RealtimeEventType.conversationItemInputAudioTranscriptionCompleted, + handlerWithDispatch, + ) ..on( - 'server.conversation.item.input_audio_transcription.completed', + RealtimeEventType.responseAudioTranscriptDelta, handlerWithDispatch, ) - ..on('server.response.audio_transcript.delta', handlerWithDispatch) - ..on('server.response.audio.delta', handlerWithDispatch) - ..on('server.response.text.delta', handlerWithDispatch) + ..on(RealtimeEventType.responseAudioDelta, handlerWithDispatch) + ..on(RealtimeEventType.responseTextDelta, handlerWithDispatch) ..on( - 'server.response.function_call_arguments.delta', + RealtimeEventType.responseFunctionCallArgumentsDelta, handlerWithDispatch, ) - ..on('server.response.output_item.done', (event) async { + ..on(RealtimeEventType.responseOutputItemDone, (event) async { final result = await handlerWithDispatch(event); - final item = result['item'] as Map?; - if (item?['status'] == 'completed') { - dispatch('conversation.item.completed', {'item': item}); + if (result.item?.item.status == ItemStatus.completed) { + await dispatch( + RealtimeEventType.conversationItemCompleted, + RealtimeEvent.conversationItemCompleted( + eventId: RealtimeUtils.generateId(), + item: result.item!, + ), + ); } - final formatted = item?['formatted'] as Map?; - if (formatted?['tool'] != null) { - unawaited(_callTool(formatted!['tool'])); + + final tool = result.item?.formatted?.tool; + if (tool != null) { + unawaited(_callTool(tool)); } }); } - Future _callTool(Map tool) async { + Future _callTool(FormattedTool tool) async { try { - final name = tool['name'] as String; - final arguments = tool['arguments'] as String? ?? '{}'; + final name = tool.name; + final arguments = tool.arguments; final jsonArguments = jsonDecode(arguments) as Map? ?? const {}; - final toolConfig = tools[tool['name']] as Map?; + final toolConfig = tools[name]; if (toolConfig == null) { - throw Exception('Tool "${tool['name']}" has not been added'); + throw Exception('Tool "$name" has not been added'); } _log.info('Calling tool "$name" with arguments:\n$arguments'); - final handler = toolConfig['handler'] as FutureOr> - Function(Map); + final (spec, handler) = toolConfig; final result = await handler(jsonArguments); _log.fine('Result of calling "$name" tool:\n$result'); - realtime.send('conversation.item.create', { - 'item': { - 'type': 'function_call_output', - 'call_id': tool['call_id'], - 'output': jsonEncode(result), - }, - }); + await realtime.send( + RealtimeEvent.conversationItemCreate( + eventId: RealtimeUtils.generateId(), + item: Item.functionCallOutput( + id: tool.callId, + callId: tool.callId, + output: jsonEncode(result), + ), + ), + ); } catch (e) { - _log.severe('Error calling tool "${tool['name']}":\n$e'); - realtime.send('conversation.item.create', { - 'item': { - 'type': 'function_call_output', - 'call_id': tool['call_id'], - 'output': {'error': e.toString()}, - }, - }); + _log.severe('Error calling tool "${tool.name}":\n$e'); + await realtime.send( + RealtimeEvent.conversationItemCreate( + eventId: RealtimeUtils.generateId(), + item: Item.functionCallOutput( + id: tool.callId, + callId: tool.callId, + output: jsonEncode({'error': e.toString()}), + ), + ), + ); } - createResponse(); + await createResponse(); } /// Tells us whether the realtime socket is connected and the session has @@ -221,7 +251,7 @@ class RealtimeClient extends RealtimeEventHandler { } final connected = await realtime.connect(); if (connected) { - updateSession(); + await updateSession(); } return connected; } @@ -240,37 +270,33 @@ class RealtimeClient extends RealtimeEventHandler { /// Disconnects from the Realtime API and clears the conversation history. Future disconnect() async { sessionCreated = false; - conversation.clear(); if (realtime.isConnected()) { await realtime.disconnect(); } + conversation.clear(); } /// Gets the active turn detection mode. - String? getTurnDetectionType() { - final turnDetection = - sessionConfig['turn_detection'] as Map?; - return turnDetection?['type']; + TurnDetectionType? getTurnDetectionType() { + return sessionConfig.turnDetection?.type; } /// Add a tool and handler. - Map addTool( - Map definition, - FutureOr> Function(Map) handler, - ) { - if (definition['name'] == null) { - throw Exception('Missing tool name in definition'); - } - final name = definition['name']; + Future<(ToolDefinition, ToolHandler)> addTool( + ToolDefinition definition, + ToolHandler handler, + ) async { + final name = definition.name; if (tools.containsKey(name)) { throw Exception( 'Tool "$name" already added. ' 'Please use .removeTool("$name") before trying to add again.', ); } - tools[name] = {'definition': definition, 'handler': handler}; - updateSession(); - return tools[name]; + final tool = (definition, handler); + tools[name] = (definition, handler); + await updateSession(); + return tool; } /// Removes a tool. @@ -283,105 +309,89 @@ class RealtimeClient extends RealtimeEventHandler { } /// Deletes an item. - bool deleteItem(String id) { - realtime.send('conversation.item.delete', {'item_id': id}); + Future deleteItem(String id) async { + await realtime.send( + RealtimeEvent.conversationItemDelete( + eventId: RealtimeUtils.generateId(), + itemId: id, + ), + ); return true; } /// Updates session configuration. /// If the client is not yet connected, will save details and instantiate /// upon connection. - void updateSession({ - List? modalities, + Future updateSession({ + List? modalities, String? instructions, - String? voice, - String? inputAudioFormat, - String? outputAudioFormat, - Map? inputAudioTranscription, - Map? turnDetection, - List>? tools, - dynamic toolChoice, + Voice? voice, + AudioFormat? inputAudioFormat, + AudioFormat? outputAudioFormat, + InputAudioTranscriptionConfig? inputAudioTranscription, + TurnDetection? turnDetection, + List? tools, + SessionConfigToolChoice? toolChoice, double? temperature, - dynamic maxResponseOutputTokens, - }) { - if (modalities != null) sessionConfig['modalities'] = modalities; - if (instructions != null) sessionConfig['instructions'] = instructions; - if (voice != null) sessionConfig['voice'] = voice; - if (inputAudioFormat != null) { - sessionConfig['input_audio_format'] = inputAudioFormat; - } - if (outputAudioFormat != null) { - sessionConfig['output_audio_format'] = outputAudioFormat; - } - if (inputAudioTranscription != null) { - sessionConfig['input_audio_transcription'] = inputAudioTranscription; - } - if (turnDetection != null) sessionConfig['turn_detection'] = turnDetection; - if (tools != null) sessionConfig['tools'] = tools; - if (toolChoice != null) sessionConfig['tool_choice'] = toolChoice; - if (temperature != null) sessionConfig['temperature'] = temperature; - if (maxResponseOutputTokens != null) { - sessionConfig['max_response_output_tokens'] = maxResponseOutputTokens; - } - + SessionConfigMaxResponseOutputTokens? maxResponseOutputTokens, + }) async { // Load tools from tool definitions + already loaded tools final useTools = [ - ...(tools ?? const []).map((toolDefinition) { - final definition = { - 'type': 'function', - ...toolDefinition, - }; - if (this.tools.containsKey(definition['name'])) { - throw Exception( - 'Tool "${definition['name']}" has already been defined', - ); - } - return definition; - }), - ...this.tools.values.map( - (tool) => { - 'type': 'function', - ...(tool as Map)['definition'], - }, - ), + ...?tools, + ...this.tools.values.map((tool) => tool.$1), ]; - final session = Map.from(sessionConfig); - session['tools'] = useTools; + sessionConfig = sessionConfig.copyWith( + modalities: modalities ?? sessionConfig.modalities, + instructions: instructions ?? sessionConfig.instructions, + voice: voice ?? sessionConfig.voice, + inputAudioFormat: inputAudioFormat ?? sessionConfig.inputAudioFormat, + outputAudioFormat: outputAudioFormat ?? sessionConfig.outputAudioFormat, + inputAudioTranscription: + inputAudioTranscription ?? sessionConfig.inputAudioTranscription, + turnDetection: turnDetection ?? sessionConfig.turnDetection, + tools: useTools, + toolChoice: toolChoice ?? sessionConfig.toolChoice, + temperature: temperature ?? sessionConfig.temperature, + maxResponseOutputTokens: + maxResponseOutputTokens ?? sessionConfig.maxResponseOutputTokens, + ); if (realtime.isConnected()) { - realtime.send('session.update', {'session': session}); + await realtime.send( + RealtimeEvent.sessionUpdate( + eventId: RealtimeUtils.generateId(), + session: sessionConfig, + ), + ); } } /// Sends user message content and generates a response. - bool sendUserMessageContent(List> content) { - if (content.isNotEmpty) { - for (final c in content) { - if (c['type'] == 'input_audio') { - if (c['audio'] is Uint8List) { - c['audio'] = base64.encode(c['audio'] as Uint8List); - } - } - } - realtime.send('conversation.item.create', { - 'item': { - 'type': 'message', - 'role': 'user', - 'content': content, - }, - }); - } - createResponse(); - return true; + Future sendUserMessageContent(List content) async { + await realtime.send( + RealtimeEvent.conversationItemCreate( + eventId: RealtimeUtils.generateId(), + item: Item.message( + id: RealtimeUtils.generateId(), + status: ItemStatus.completed, + role: ItemRole.user, + content: content, + ), + ), + ); + return createResponse(); } /// Appends user audio to the existing audio buffer. - bool appendInputAudio(Uint8List audioData) { + Future appendInputAudio(Uint8List audioData) async { if (audioData.isNotEmpty) { - realtime.send('input_audio_buffer.append', { - 'audio': base64.encode(audioData), - }); + await realtime.send( + RealtimeEvent.inputAudioBufferAppend( + eventId: RealtimeUtils.generateId(), + audio: base64.encode(audioData), + ), + ); inputAudioBuffer = RealtimeUtils.mergeUint8Lists( inputAudioBuffer, audioData, @@ -391,77 +401,99 @@ class RealtimeClient extends RealtimeEventHandler { } /// Forces a model response generation. - bool createResponse() { + Future createResponse() async { if (getTurnDetectionType() == null && inputAudioBuffer.isNotEmpty) { - realtime.send('input_audio_buffer.commit'); + await realtime.send( + RealtimeEvent.inputAudioBufferCommit( + eventId: RealtimeUtils.generateId(), + ), + ); conversation.queueInputAudio(inputAudioBuffer); inputAudioBuffer = Uint8List(0); } - realtime.send('response.create'); + await realtime.send( + RealtimeEvent.responseCreate( + eventId: RealtimeUtils.generateId(), + ), + ); return true; } /// Cancels the ongoing server generation and truncates ongoing generation, /// if applicable. /// If no id provided, will simply call `cancel_generation` command. - Map cancelResponse(String? id, [int sampleCount = 0]) { + Future cancelResponse(String? id, [int sampleCount = 0]) async { if (id == null) { - realtime.send('response.cancel'); - return {'item': null}; + await realtime.send( + RealtimeEvent.responseCancel( + eventId: RealtimeUtils.generateId(), + ), + ); + return null; } else { - final item = conversation.getItem(id) as Map?; - if (item == null) { + final formattedItem = conversation.getItem(id); + if (formattedItem == null) { throw Exception('Could not find item "$id"'); } - final type = item['type'] as String; - final role = item['role'] as String; - if (type != 'message') { + final item = formattedItem.item; + + if (item is! ItemMessage) { throw Exception('Can only cancelResponse messages with type "message"'); - } else if (role != 'assistant') { + } else if (item.role != ItemRole.assistant) { throw Exception( 'Can only cancelResponse messages with role "assistant"', ); } - realtime.send('response.cancel'); + await realtime.send( + RealtimeEvent.responseCancel( + eventId: RealtimeUtils.generateId(), + ), + ); - final content = - (item['content'] as List?)?.cast>(); - final audioIndex = content?.indexWhere((c) => c['type'] == 'audio') ?? -1; + final audioIndex = item.content.indexWhere((c) => c is ContentPartAudio); if (audioIndex == -1) { throw Exception('Could not find audio on item to cancel'); } - realtime.send('conversation.item.truncate', { - 'item_id': id, - 'content_index': audioIndex, - 'audio_end_ms': - (sampleCount / conversation.defaultFrequency * 1000).floor(), - }); - return {'item': item}; + await realtime.send( + RealtimeEvent.conversationItemTruncate( + eventId: RealtimeUtils.generateId(), + itemId: id, + contentIndex: audioIndex, + audioEndMs: + (sampleCount / conversation.defaultFrequency * 1000).floor(), + ), + ); + return item; } } /// Utility for waiting for the next `conversation.item.appended` event to /// be triggered by the server. - Future> waitForNextItem({ + Future waitForNextItem({ Duration? timeout, }) async { - final event = await waitForNext( - 'conversation.item.appended', + final res = await waitForNext( + RealtimeEventType.conversationItemAppended, timeout: timeout, - ); - return {'item': event?['item']}; + ) as RealtimeEventConversationItemAppended?; + return res?.item; } /// Utility for waiting for the next `conversation.item.completed` event to /// be triggered by the server. - Future> waitForNextCompletedItem({ + Future waitForNextCompletedItem({ Duration? timeout, }) async { - final event = await waitForNext( - 'conversation.item.completed', + final res = await waitForNext( + RealtimeEventType.conversationItemCompleted, timeout: timeout, - ); - return {'item': event?['item']}; + ) as RealtimeEventConversationItemCompleted?; + return res?.item; } } + +/// The handler for a tool. +typedef ToolHandler = FutureOr> Function( + Map, +); diff --git a/packages/openai_realtime_dart/lib/src/conversation.dart b/packages/openai_realtime_dart/lib/src/conversation.dart index 5e0d81d5..5457a337 100644 --- a/packages/openai_realtime_dart/lib/src/conversation.dart +++ b/packages/openai_realtime_dart/lib/src/conversation.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:convert'; import 'dart:typed_data'; +import 'schema/schema.dart'; import 'utils.dart'; /// Stores a client-side cache of the current conversation and performs event @@ -13,31 +14,25 @@ class RealtimeConversation { } /// Map of item ids to items. - final Map itemLookup = {}; - - /// List of items in the conversation. - final List items = []; + final Map items = {}; /// Map of response ids to responses. - final Map responseLookup = {}; - - /// List of responses in the conversation. - final List responses = []; + final Map responses = {}; /// Map of queued speech items. - final Map queuedSpeechItems = {}; + final Map queuedSpeechItems = {}; /// Map of queued transcript items. - final Map queuedTranscriptItems = {}; + final Map queuedTranscriptItems = {}; /// Queued input audio. Uint8List? queuedInputAudio; /// Event processors for conversation events. final Map< - String, - FutureOr> Function( - Map? event, [ + RealtimeEventType, + FutureOr Function( + RealtimeEvent event, [ dynamic args, ])> _eventProcessors = {}; @@ -45,333 +40,469 @@ class RealtimeConversation { final int defaultFrequency = 24000; // 24,000 Hz void _initializeEventProcessors() { - _eventProcessors['conversation.item.created'] = ( - Map? event, [ + _eventProcessors[RealtimeEventType.conversationItemCreated] = ( + RealtimeEvent e, [ dynamic args, ]) { - final item = event?['item']; - final newItem = Map.from(item); - if (!itemLookup.containsKey(newItem['id'])) { - itemLookup[newItem['id']] = newItem; - items.add(newItem); + final event = e as RealtimeEventConversationItemCreated; + final item = event.item; + var newItem = FormattedItem( + item: item, + formatted: FormattedProperty( + audio: Uint8List(0), + text: '', + transcript: '', + ), + ); + + if (!items.containsKey(item.id)) { + items[item.id] = newItem; + } else { + newItem = items[item.id]!; } - newItem['formatted'] = { - 'audio': Uint8List(0), - 'text': '', - 'transcript': '', - }; + // If we have a speech item, can populate audio - final newItemId = newItem['id'] as String; - final formatted = newItem['formatted'] as Map; - if (queuedSpeechItems.containsKey(newItemId)) { - final queuedSpeechItem = - queuedSpeechItems[newItemId] as Map; - formatted['audio'] = queuedSpeechItem['audio']; - queuedSpeechItems.remove(newItemId); + if (queuedSpeechItems.containsKey(item.id)) { + newItem = newItem.copyWith( + formatted: newItem.formatted!.copyWith( + audio: queuedSpeechItems[item.id]!.audio!, + ), + ); + queuedSpeechItems.remove(item.id); } + // Populate formatted text if it comes out on creation - final newItemContent = - (newItem['content'] as List?)?.cast>(); - if (newItemContent != null) { - final textContent = newItemContent - .where((c) => ['text', 'input_text'].contains(c['type'] as String)); - for (final content in textContent) { - formatted['text'] = '${formatted['text']}${content['text']}'; - } + if (item is ItemMessage && item.content.isNotEmpty) { + final textContent = item.content + .where( + (c) => c is ContentPartText || c is ContentPartInputText, + ) + .toList(growable: false); + newItem = newItem.copyWith( + formatted: newItem.formatted!.copyWith( + text: textContent + .map( + (c) => c.mapOrNull( + inputText: (c) => c.text, + text: (c) => c.text, + ), + ) + .join(), + ), + ); } + // If we have a transcript item, can pre-populate transcript - if (queuedTranscriptItems.containsKey(newItem['id'])) { - final queuedTranscriptItem = - queuedTranscriptItems[newItemId] as Map; - formatted['transcript'] = queuedTranscriptItem['transcript']; - queuedTranscriptItems.remove(newItem['id']); + if (queuedTranscriptItems.containsKey(item.id)) { + newItem = newItem.copyWith( + formatted: newItem.formatted!.copyWith( + transcript: queuedTranscriptItems[item.id]!.transcript, + ), + ); + queuedTranscriptItems.remove(item.id); } - if (newItem['type'] == 'message') { - if (newItem['role'] == 'user') { - newItem['status'] = 'completed'; + + if (item is ItemMessage) { + if (item.role == ItemRole.user) { if (queuedInputAudio != null) { - formatted['audio'] = queuedInputAudio; + newItem = newItem.copyWith( + formatted: newItem.formatted!.copyWith(audio: queuedInputAudio!), + ); queuedInputAudio = null; } + newItem = newItem.copyWith( + item: item.copyWith(status: ItemStatus.completed), + ); } else { - newItem['status'] = 'in_progress'; + newItem = newItem.copyWith( + item: item.copyWith(status: ItemStatus.inProgress), + ); } - } else if (newItem['type'] == 'function_call') { - formatted['tool'] = { - 'type': 'function', - 'name': newItem['name'], - 'call_id': newItem['call_id'], - 'arguments': '', - }; - newItem['status'] = 'in_progress'; - } else if (newItem['type'] == 'function_call_output') { - newItem['status'] = 'completed'; - formatted['output'] = newItem['output']; + } else if (item is ItemFunctionCall) { + newItem = newItem.copyWith( + item: item.copyWith(status: ItemStatus.inProgress), + formatted: newItem.formatted!.copyWith( + tool: FormattedTool( + type: ToolType.function, + name: item.name, + callId: item.callId, + arguments: item.arguments, + ), + ), + ); + } else if (item is ItemFunctionCallOutput) { + newItem = newItem.copyWith( + item: item.copyWith(status: ItemStatus.completed), + formatted: newItem.formatted!.copyWith(output: item.output), + ); } - return {'item': newItem, 'delta': null}; + + items[item.id] = newItem; + return EventHandlerResult(item: newItem); }; - _eventProcessors['conversation.item.truncated'] = ( - Map? event, [ + _eventProcessors[RealtimeEventType.conversationItemTruncated] = ( + RealtimeEvent e, [ dynamic args, ]) { - final itemId = event?['item_id']; - final audioEndMs = event?['audio_end_ms'] as int; - final item = itemLookup[itemId] as Map?; - if (item == null) { - throw Exception('item.truncated: Item "$itemId" not found'); + final event = e as RealtimeEventConversationItemTruncated; + var foundItem = items[event.itemId]; + if (foundItem == null) { + throw Exception('item.truncated: Item "${event.itemId}" not found'); } - final formatted = item['formatted'] as Map; - final endIndex = audioEndMs * defaultFrequency ~/ 1000; - formatted['transcript'] = ''; - formatted['audio'] = - (formatted['audio'] as Uint8List).sublist(0, endIndex); - return {'item': item, 'delta': null}; + final endIndex = event.audioEndMs * defaultFrequency ~/ 1000; + foundItem = foundItem.copyWith( + formatted: foundItem.formatted!.copyWith( + transcript: '', + audio: foundItem.formatted!.audio.sublist(0, endIndex), + ), + ); + + items[event.itemId] = foundItem; + return EventHandlerResult(item: foundItem); }; - _eventProcessors['conversation.item.deleted'] = ( - Map? event, [ + _eventProcessors[RealtimeEventType.conversationItemDeleted] = ( + RealtimeEvent e, [ dynamic args, ]) { - final itemId = event?['item_id']; - final item = itemLookup[itemId]; - if (item == null) { - throw Exception('item.deleted: Item "$itemId" not found'); + final event = e as RealtimeEventConversationItemDeleted; + final foundItem = items[event.itemId]; + if (foundItem == null) { + throw Exception('item.deleted: Item "${event.itemId}" not found'); } - itemLookup.remove(itemId); - items.remove(item); - return {'item': item, 'delta': null}; + items.remove(event.itemId); + return EventHandlerResult(item: foundItem); }; - _eventProcessors['conversation.item.input_audio_transcription.completed'] = - ( - Map? event, [ + _eventProcessors[ + RealtimeEventType.conversationItemInputAudioTranscriptionCompleted] = ( + RealtimeEvent e, [ dynamic args, ]) { - final itemId = event?['item_id']; - final contentIndex = event?['content_index']; - final transcript = event?['transcript']; - final item = itemLookup[itemId] as Map?; + final event = + e as RealtimeEventConversationItemInputAudioTranscriptionCompleted; + var foundItem = items[event.itemId]; // We use a single space to represent an empty transcript for .formatted values // Otherwise it looks like no transcript provided - final formattedTranscript = transcript ?? ' '; - if (item == null) { + final formattedTranscript = + event.transcript.isEmpty ? ' ' : event.transcript; + + if (foundItem == null) { // We can receive transcripts in VAD mode before item.created // This happens specifically when audio is empty - queuedTranscriptItems[itemId] = {'transcript': formattedTranscript}; - return {'item': null, 'delta': null}; - } else { - final itemContent = - (item['content'] as List?)?.cast>(); - - final formatted = item['formatted'] as Map; - itemContent?[contentIndex]['transcript'] = transcript; - formatted['transcript'] = formattedTranscript; - return { - 'item': item, - 'delta': {'transcript': transcript}, - }; + queuedTranscriptItems[event.itemId] = ItemTranscript( + transcript: formattedTranscript, + ); + return const EventHandlerResult(); + } + + final item = foundItem.item; + if (item is ItemMessage) { + final content = [...item.content]; + final contentPart = event.contentIndex < content.length + ? content[event.contentIndex] + : null; + if (contentPart is ContentPartInputAudio) { + content[event.contentIndex] = contentPart.copyWith( + transcript: event.transcript, + ); + } else if (contentPart is ContentPartAudio) { + content[event.contentIndex] = contentPart.copyWith( + transcript: event.transcript, + ); + } + foundItem = foundItem.copyWith( + item: item.copyWith(content: content), + ); } + + foundItem = foundItem.copyWith( + formatted: + foundItem.formatted!.copyWith(transcript: formattedTranscript), + ); + + items[event.itemId] = foundItem; + return EventHandlerResult( + item: foundItem, + delta: Delta(transcript: event.transcript), + ); }; - _eventProcessors['input_audio_buffer.speech_started'] = ( - Map? event, [ + _eventProcessors[RealtimeEventType.inputAudioBufferSpeechStarted] = ( + RealtimeEvent e, [ dynamic args, ]) { - final itemId = event?['item_id']; - final audioStartMs = event?['audio_start_ms']; - queuedSpeechItems[itemId] = {'audio_start_ms': audioStartMs}; - return {'item': null, 'delta': null}; + final event = e as RealtimeEventInputAudioBufferSpeechStarted; + queuedSpeechItems[event.itemId] = ItemSpeech( + audioStartMs: event.audioStartMs, + ); + return const EventHandlerResult(); }; - _eventProcessors['input_audio_buffer.speech_stopped'] = ( - Map? event, [ + _eventProcessors[RealtimeEventType.inputAudioBufferSpeechStopped] = ( + RealtimeEvent e, [ dynamic args, ]) { - final itemId = event?['item_id']; - final audioEndMs = event?['audio_end_ms']; - final speech = queuedSpeechItems[itemId] as Map; - speech['audio_end_ms'] = audioEndMs; + final event = e as RealtimeEventInputAudioBufferSpeechStopped; + + if (!queuedSpeechItems.containsKey(event.itemId)) { + queuedSpeechItems[event.itemId] = ItemSpeech( + audioStartMs: event.audioEndMs, + ); + } + + final speech = queuedSpeechItems[event.itemId]; + if (speech == null) return const EventHandlerResult(); + + queuedSpeechItems[event.itemId] = speech.copyWith( + audioEndMs: event.audioEndMs, + ); + if (args != null) { final inputAudioBuffer = args as Uint8List; - final speechAudioStartMs = speech['audio_start_ms'] as int; - final speechAudioEndMs = speech['audio_end_ms'] as int; - final startIndex = speechAudioStartMs * defaultFrequency ~/ 1000; - final endIndex = speechAudioEndMs * defaultFrequency ~/ 1000; - speech['audio'] = inputAudioBuffer.sublist(startIndex, endIndex); + final startIndex = speech.audioStartMs * defaultFrequency ~/ 1000; + final endIndex = event.audioEndMs * defaultFrequency ~/ 1000; + queuedSpeechItems[event.itemId] = speech.copyWith( + audio: inputAudioBuffer.sublist(startIndex, endIndex), + ); } - return {'item': null, 'delta': null}; + return const EventHandlerResult(); }; - _eventProcessors['response.created'] = ( - Map? event, [ + _eventProcessors[RealtimeEventType.responseCreated] = ( + RealtimeEvent e, [ dynamic args, ]) { - final response = event?['response'] as Map?; - final responseId = response?['id'] as String? ?? ''; - if (!responseLookup.containsKey(responseId)) { - responseLookup[responseId] = response; - responses.add(response); + final event = e as RealtimeEventResponseCreated; + final response = event.response; + if (!responses.containsKey(response.id)) { + responses[response.id] = response; } - return {'item': null, 'delta': null}; + return const EventHandlerResult(); }; - _eventProcessors['response.output_item.added'] = ( - Map? event, [ + _eventProcessors[RealtimeEventType.responseOutputItemAdded] = ( + RealtimeEvent e, [ dynamic args, ]) { - final responseId = event?['response_id']; - final item = event?['item'] as Map?; - final itemId = item?['id'] as String? ?? ''; - final response = responseLookup[responseId] as Map?; - if (response == null) { + final event = e as RealtimeEventResponseOutputItemAdded; + var foundResponse = responses[event.responseId]; + if (foundResponse == null) { throw Exception( - 'response.output_item.added: Response "$responseId" not found', + 'response.output_item.added: Response "${event.responseId}" not found', ); } - (response['output'] as List).add(itemId); - return {'item': null, 'delta': null}; + final output = [...foundResponse.output, event.item]; + foundResponse = foundResponse.copyWith(output: output); + responses[event.responseId] = foundResponse; + return const EventHandlerResult(); }; - _eventProcessors['response.output_item.done'] = ( - Map? event, [ + _eventProcessors[RealtimeEventType.responseOutputItemDone] = ( + RealtimeEvent e, [ dynamic args, ]) { - final item = event?['item'] as Map?; - if (item == null) { - throw Exception('response.output_item.done: Missing "item"'); - } - final itemId = item['id'] as String; - final foundItem = itemLookup[itemId] as Map?; + final event = e as RealtimeEventResponseOutputItemDone; + var foundItem = items[event.item.id]; if (foundItem == null) { throw Exception( - 'response.output_item.done: Item "${item['id']}" not found', + 'response.output_item.done: Item "${event.item.id}" not found', ); } - foundItem['status'] = item['status']; - return {'item': foundItem, 'delta': null}; + foundItem = foundItem.copyWith( + item: foundItem.item.copyWith( + status: e.item.status, + ), + ); + + items[event.item.id] = foundItem; + return EventHandlerResult(item: foundItem); }; - _eventProcessors['response.content_part.added'] = ( - Map? event, [ + _eventProcessors[RealtimeEventType.responseContentPartAdded] = ( + RealtimeEvent e, [ dynamic args, ]) { - final itemId = event?['item_id']; - final part = event?['part']; - final item = itemLookup[itemId] as Map?; - if (item == null) { + final event = e as RealtimeEventResponseContentPartAdded; + var foundItem = items[event.itemId]; + if (foundItem == null) { throw Exception( - 'response.content_part.added: Item "$itemId" not found', + 'response.content_part.added: Item "${event.itemId}" not found', + ); + } + final item = foundItem.item; + if (item is ItemMessage) { + final content = [...item.content, event.part]; + foundItem = foundItem.copyWith( + item: item.copyWith(content: content), ); } - (item['content'] as List).add(part); - return {'item': item, 'delta': null}; + + items[event.itemId] = foundItem; + return EventHandlerResult(item: foundItem); }; - _eventProcessors['response.audio_transcript.delta'] = ( - Map? event, [ + _eventProcessors[RealtimeEventType.responseAudioTranscriptDelta] = ( + RealtimeEvent e, [ dynamic args, ]) { - final itemId = event?['item_id']; - final contentIndex = event?['content_index']; - final delta = event?['delta']; - final item = itemLookup[itemId] as Map?; - if (item == null) { + final event = e as RealtimeEventResponseAudioTranscriptDelta; + var foundItem = items[event.itemId]; + if (foundItem == null) { throw Exception( - 'response.audio_transcript.delta: Item "$itemId" not found', + 'response.audio_transcript.delta: Item "${event.itemId}" not found', ); } - final itemContent = - (item['content'] as List).cast>(); - final itemTranscript = itemContent[contentIndex]['transcript'] as String; - final formatted = item['formatted'] as Map; - final formattedTranscript = formatted['transcript'] as String; - itemContent[contentIndex]['transcript'] = itemTranscript + delta; - formatted['transcript'] = formattedTranscript + delta; - return { - 'item': item, - 'delta': {'transcript': delta}, - }; + + final item = foundItem.item; + if (item is ItemMessage) { + final content = [...item.content]; + final contentPart = event.contentIndex < content.length + ? content[event.contentIndex] + : null; + if (contentPart is ContentPartInputAudio) { + content[event.contentIndex] = contentPart.copyWith( + transcript: (contentPart.transcript ?? '') + event.delta, + ); + } else if (contentPart is ContentPartAudio) { + content[event.contentIndex] = contentPart.copyWith( + transcript: (contentPart.transcript ?? '') + event.delta, + ); + } + foundItem = foundItem.copyWith( + item: item.copyWith(content: content), + ); + } + + foundItem = foundItem.copyWith( + formatted: foundItem.formatted!.copyWith( + transcript: foundItem.formatted!.transcript + event.delta, + ), + ); + + items[event.itemId] = foundItem; + return EventHandlerResult( + item: foundItem, + delta: Delta(transcript: event.delta), + ); }; - _eventProcessors['response.audio.delta'] = ( - Map? event, [ + _eventProcessors[RealtimeEventType.responseAudioDelta] = ( + RealtimeEvent e, [ dynamic args, ]) { - final itemId = event?['item_id']; - final delta = event?['delta']; - final item = itemLookup[itemId] as Map?; - if (item == null) { - throw Exception('response.audio.delta: Item "$itemId" not found'); + final event = e as RealtimeEventResponseAudioDelta; + var foundItem = items[event.itemId]; + if (foundItem == null) { + throw Exception( + 'response.audio.delta: Item "${event.itemId}" not found', + ); } - // This never gets rendered, we care about the file data instead - // item.content[content_index].audio += delta; - final arrayBuffer = base64.decode(delta); - final formatted = item['formatted'] as Map; - formatted['audio'] = RealtimeUtils.mergeUint8Lists( - formatted['audio'], - arrayBuffer, + final arrayBuffer = base64.decode(event.delta); + foundItem = foundItem.copyWith( + formatted: foundItem.formatted!.copyWith( + audio: RealtimeUtils.mergeUint8Lists( + foundItem.formatted!.audio, + arrayBuffer, + ), + ), + ); + + items[event.itemId] = foundItem; + return EventHandlerResult( + item: foundItem, + delta: Delta(audio: arrayBuffer), ); - return { - 'item': item, - 'delta': {'audio': arrayBuffer}, - }; }; - _eventProcessors['response.text.delta'] = ( - Map? event, [ + _eventProcessors[RealtimeEventType.responseTextDelta] = ( + RealtimeEvent e, [ dynamic args, ]) { - final itemId = event?['item_id']; - final contentIndex = event?['content_index']; - final delta = event?['delta']; - final item = itemLookup[itemId] as Map?; - if (item == null) { - throw Exception('response.text.delta: Item "$itemId" not found'); + final event = e as RealtimeEventResponseTextDelta; + var foundItem = items[event.itemId]; + if (foundItem == null) { + throw Exception( + 'response.text.delta: Item "${event.itemId}" not found', + ); + } + + if (foundItem.item is ItemMessage) { + final messageItem = foundItem.item as ItemMessage; + final content = [...messageItem.content]; + final contentPart = event.contentIndex < content.length + ? content[event.contentIndex] + : null; + if (contentPart is ContentPartInputText) { + content[event.contentIndex] = contentPart.copyWith( + text: contentPart.text + event.delta, + ); + } else if (contentPart is ContentPartText) { + content[event.contentIndex] = contentPart.copyWith( + text: contentPart.text + event.delta, + ); + } + foundItem = foundItem.copyWith( + item: messageItem.copyWith(content: content), + ); } - final itemContent = - (item['content'] as List?)?.cast>(); - final itemText = itemContent?[contentIndex]['text'] as String? ?? ''; - final formatted = item['formatted'] as Map; - final formattedText = formatted['text'] as String; - itemContent?[contentIndex]['text'] = itemText + delta; - formatted['text'] = formattedText + delta; - return { - 'item': item, - 'delta': {'text': delta}, - }; + + foundItem = foundItem.copyWith( + formatted: foundItem.formatted!.copyWith( + text: foundItem.formatted!.text + event.delta, + ), + ); + + items[event.itemId] = foundItem; + return EventHandlerResult( + item: foundItem, + delta: Delta(text: event.delta), + ); }; - _eventProcessors['response.function_call_arguments.delta'] = ( - Map? event, [ + _eventProcessors[RealtimeEventType.responseFunctionCallArgumentsDelta] = ( + RealtimeEvent e, [ dynamic args, ]) { - final itemId = event?['item_id']; - final delta = event?['delta']; - final item = itemLookup[itemId] as Map?; - if (item == null) { + final event = e as RealtimeEventResponseFunctionCallArgumentsDelta; + var foundItem = items[event.itemId]; + if (foundItem == null) { throw Exception( - 'response.function_call_arguments.delta: Item "$itemId" not found', + 'response.function_call_arguments.delta: Item "${event.itemId}" not found', ); } - final arguments = item['arguments'] as String; - final formatted = item['formatted'] as Map; - final formattedTool = formatted['tool'] as Map; - final formattedToolArguments = formattedTool['arguments'] as String; - item['arguments'] = arguments + delta; - formattedTool['arguments'] = formattedToolArguments + delta; - return { - 'item': item, - 'delta': {'arguments': delta}, - }; + + final item = foundItem.item; + if (item is ItemFunctionCall) { + foundItem = foundItem.copyWith( + item: item.copyWith( + arguments: item.arguments + event.delta, + ), + ); + } + + if (foundItem.formatted?.tool != null) { + foundItem = foundItem.copyWith( + formatted: foundItem.formatted!.copyWith( + tool: foundItem.formatted!.tool!.copyWith( + arguments: foundItem.formatted!.tool!.arguments + event.delta, + ), + ), + ); + } + + items[event.itemId] = foundItem; + return EventHandlerResult( + item: foundItem, + delta: Delta(arguments: event.delta), + ); }; } - /// * Clears the conversation history and resets to default. + /// Clears the conversation history and resets to default. void clear() { - itemLookup.clear(); items.clear(); - responseLookup.clear(); responses.clear(); queuedSpeechItems.clear(); queuedTranscriptItems.clear(); @@ -385,21 +516,14 @@ class RealtimeConversation { } /// Process an event from the WebSocket server and compose items. - FutureOr> processEvent( - Map? event, [ + FutureOr processEvent( + RealtimeEvent event, [ dynamic args, ]) { - if (event?['event_id'] == null) { - throw Exception('Missing "event_id" on event'); - } - if (event?['type'] == null) { - throw Exception('Missing "type" on event'); - } - - final eventProcessor = _eventProcessors[event?['type']]; + final eventProcessor = _eventProcessors[event.type]; if (eventProcessor == null) { throw Exception( - 'Missing conversation event processor for "${event?['type']}"', + 'Missing conversation event processor for "${event.type}"', ); } @@ -407,12 +531,12 @@ class RealtimeConversation { } /// Retrieves a item by id. - dynamic getItem(String id) { - return itemLookup[id]; + FormattedItem? getItem(String id) { + return items[id]; } /// Retrieves all items in the conversation. - List getItems() { - return List.from(items); + List getItems() { + return List.from(items.values); } } diff --git a/packages/openai_realtime_dart/lib/src/event_handler.dart b/packages/openai_realtime_dart/lib/src/event_handler.dart index 458eabb6..2c42249e 100644 --- a/packages/openai_realtime_dart/lib/src/event_handler.dart +++ b/packages/openai_realtime_dart/lib/src/event_handler.dart @@ -1,27 +1,30 @@ import 'dart:async'; +import 'schema/schema.dart'; + /// EventHandler callback. typedef EventHandlerCallback = FutureOr Function( - Map? event, + RealtimeEvent event, ); /// Inherited class for RealtimeAPI and RealtimeClient. -/// Adds basic event handling. +/// Adds basic event handling. class RealtimeEventHandler { - final Map> _eventHandlers = {}; - final Map> _nextEventHandlers = {}; + final Map> _eventHandlers = {}; + final Map> _nextEventHandlers = + {}; /// Listen to specific events. /// - [eventName] The name of the event to listen to. /// - [callback] The callback function to call when the event is received. - void on(String eventName, EventHandlerCallback callback) { + void on(RealtimeEventType eventName, EventHandlerCallback callback) { _eventHandlers.putIfAbsent(eventName, () => []).add(callback); } /// Listen for the next event of a specified type. /// - [eventName] The name of the event to listen to. /// - [callback] The callback function to call when the event is received. - void onNext(String eventName, EventHandlerCallback callback) { + void onNext(RealtimeEventType eventName, EventHandlerCallback callback) { _nextEventHandlers.putIfAbsent(eventName, () => []).add(callback); } @@ -29,7 +32,7 @@ class RealtimeEventHandler { /// Calling without a callback will remove all listeners for the event. /// - [eventName] The name of the event to stop listening to. /// - [callback] The callback function to remove. - void off(String eventName, [EventHandlerCallback? callback]) { + void off(RealtimeEventType eventName, [EventHandlerCallback? callback]) { if (callback == null) { _eventHandlers.remove(eventName); } else { @@ -41,7 +44,7 @@ class RealtimeEventHandler { /// Calling without a callback will remove all listeners for the next event. /// - [eventName] The name of the event to stop listening to. /// - [callback] The callback function to remove. - void offNext(String eventName, [EventHandlerCallback? callback]) { + void offNext(RealtimeEventType eventName, [EventHandlerCallback? callback]) { if (callback == null) { _nextEventHandlers.remove(eventName); } else { @@ -52,11 +55,11 @@ class RealtimeEventHandler { /// Waits for next event of a specific type and returns the payload. /// - [eventName] The name of the event to wait for. /// - [timeout] The maximum time to wait for the event. - Future?> waitForNext( - String eventName, { + Future waitForNext( + RealtimeEventType eventName, { Duration? timeout, }) async { - final completer = Completer?>(); + final completer = Completer(); onNext(eventName, completer.complete); @@ -71,10 +74,19 @@ class RealtimeEventHandler { /// handlers executing before[onNext] handlers. /// - [eventName] The name of the event to dispatch. /// - [event] The event payload to pass to the handlers. - void dispatch(String eventName, Map? event) { - _eventHandlers[eventName]?.forEach((handler) async => handler(event)); - _nextEventHandlers[eventName]?.forEach((handler) async => handler(event)); + Future dispatch( + RealtimeEventType eventName, + RealtimeEvent event, + ) async { + final handlers = [...?_eventHandlers[eventName]]; + for (final handler in handlers) { + await handler(event); + } + final nextHandlers = [...?_nextEventHandlers[eventName]]; _nextEventHandlers.remove(eventName); + for (final handler in nextHandlers) { + await handler(event); + } } /// Clears all event handlers. diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/api_error.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/api_error.dart new file mode 100644 index 00000000..0fca92b2 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/api_error.dart @@ -0,0 +1,62 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: APIError +// ========================================== + +/// Details of the API error. +@freezed +class APIError with _$APIError { + const APIError._(); + + /// Factory constructor for APIError + const factory APIError({ + /// The type of error (e.g., "invalid_request_error", "server_error"). + @JsonKey(includeIfNull: false) String? type, + + /// Error code, if any. + @JsonKey(includeIfNull: false) String? code, + + /// A human-readable error message. + @JsonKey(includeIfNull: false) String? message, + + /// Parameter related to the error, if any. + @JsonKey(includeIfNull: false) String? param, + + /// The event_id of the client event that caused the error, if applicable. + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + }) = _APIError; + + /// Object construction from a JSON representation + factory APIError.fromJson(Map json) => + _$APIErrorFromJson(json); + + /// List of all property names of schema + static const List propertyNames = [ + 'type', + 'code', + 'message', + 'param', + 'event_id' + ]; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'type': type, + 'code': code, + 'message': message, + 'param': param, + 'event_id': eventId, + }; + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/audio_format.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/audio_format.dart new file mode 100644 index 00000000..77387f64 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/audio_format.dart @@ -0,0 +1,19 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// ENUM: AudioFormat +// ========================================== + +/// The format of the audio. +enum AudioFormat { + @JsonValue('pcm16') + pcm16, + @JsonValue('g711_ulaw') + g711Ulaw, + @JsonValue('g711_alaw') + g711Alaw, +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/content_part.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/content_part.dart new file mode 100644 index 00000000..3e2428e2 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/content_part.dart @@ -0,0 +1,100 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: ContentPart +// ========================================== + +/// A part of the content. +@Freezed(unionKey: 'type', unionValueCase: FreezedUnionCase.snake) +sealed class ContentPart with _$ContentPart { + const ContentPart._(); + + // ------------------------------------------ + // UNION: ContentPartInputText + // ------------------------------------------ + + /// A part of the input text content. + + @FreezedUnionValue('input_text') + const factory ContentPart.inputText({ + /// The content type. + @Default(ContentType.inputText) ContentType type, + + /// The text content. + required String text, + }) = ContentPartInputText; + + // ------------------------------------------ + // UNION: ContentPartInputAudio + // ------------------------------------------ + + /// A part of the input audio content. + + @FreezedUnionValue('input_audio') + const factory ContentPart.inputAudio({ + /// The content type. + @Default(ContentType.inputAudio) ContentType type, + + /// Base64-encoded audio bytes. + @JsonKey(includeIfNull: false) String? audio, + + /// The transcript of the audio. + @JsonKey(includeIfNull: false) String? transcript, + }) = ContentPartInputAudio; + + // ------------------------------------------ + // UNION: ContentPartText + // ------------------------------------------ + + /// A part of the text content. + + @FreezedUnionValue('text') + const factory ContentPart.text({ + /// The content type. + @Default(ContentType.text) ContentType type, + + /// The text content. + required String text, + }) = ContentPartText; + + // ------------------------------------------ + // UNION: ContentPartAudio + // ------------------------------------------ + + /// A part of the audio content. + + @FreezedUnionValue('audio') + const factory ContentPart.audio({ + /// The content type. + @Default(ContentType.audio) ContentType type, + + /// Base64-encoded audio bytes. + @JsonKey(includeIfNull: false) String? audio, + + /// The transcript of the audio. + @JsonKey(includeIfNull: false) String? transcript, + }) = ContentPartAudio; + + /// Object construction from a JSON representation + factory ContentPart.fromJson(Map json) => + _$ContentPartFromJson(json); +} + +// ========================================== +// ENUM: ContentPartEnumType +// ========================================== + +enum ContentPartEnumType { + @JsonValue('input_text') + inputText, + @JsonValue('input_audio') + inputAudio, + @JsonValue('text') + text, + @JsonValue('audio') + audio, +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/content_type.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/content_type.dart new file mode 100644 index 00000000..cfb1532a --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/content_type.dart @@ -0,0 +1,21 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// ENUM: ContentType +// ========================================== + +/// The type of the content. +enum ContentType { + @JsonValue('input_text') + inputText, + @JsonValue('input_audio') + inputAudio, + @JsonValue('text') + text, + @JsonValue('audio') + audio, +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/conversation.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/conversation.dart new file mode 100644 index 00000000..417b7220 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/conversation.dart @@ -0,0 +1,44 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: Conversation +// ========================================== + +/// The conversation resource. +@freezed +class Conversation with _$Conversation { + const Conversation._(); + + /// Factory constructor for Conversation + const factory Conversation({ + /// The unique ID of the conversation. + required String id, + + /// The object type, must be "realtime.conversation". + @Default(ObjectType.realtimeConversation) ObjectType object, + }) = _Conversation; + + /// Object construction from a JSON representation + factory Conversation.fromJson(Map json) => + _$ConversationFromJson(json); + + /// List of all property names of schema + static const List propertyNames = ['id', 'object']; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'id': id, + 'object': object, + }; + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/delta.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/delta.dart new file mode 100644 index 00000000..eb4b054a --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/delta.dart @@ -0,0 +1,56 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: Delta +// ========================================== + +/// Delta object. +@freezed +class Delta with _$Delta { + const Delta._(); + + /// Factory constructor for Delta + const factory Delta({ + /// The transcript of the audio. + @JsonKey(includeIfNull: false) String? transcript, + + /// The audio bytes. + @Uint8ListConverter() @JsonKey(includeIfNull: false) Uint8List? audio, + + /// The text. + @JsonKey(includeIfNull: false) String? text, + + /// The arguments. + @JsonKey(includeIfNull: false) String? arguments, + }) = _Delta; + + /// Object construction from a JSON representation + factory Delta.fromJson(Map json) => _$DeltaFromJson(json); + + /// List of all property names of schema + static const List propertyNames = [ + 'transcript', + 'audio', + 'text', + 'arguments' + ]; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'transcript': transcript, + 'audio': audio, + 'text': text, + 'arguments': arguments, + }; + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/event_handler_result.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/event_handler_result.dart new file mode 100644 index 00000000..37129cd8 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/event_handler_result.dart @@ -0,0 +1,48 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: EventHandlerResult +// ========================================== + +/// No Description +@freezed +class EventHandlerResult with _$EventHandlerResult { + const EventHandlerResult._(); + + /// Factory constructor for EventHandlerResult + const factory EventHandlerResult({ + /// A formatted item. + @JsonKey(includeIfNull: false) FormattedItem? item, + + /// Delta object. + @JsonKey(includeIfNull: false) Delta? delta, + + /// The response resource. + @JsonKey(includeIfNull: false) Response? response, + }) = _EventHandlerResult; + + /// Object construction from a JSON representation + factory EventHandlerResult.fromJson(Map json) => + _$EventHandlerResultFromJson(json); + + /// List of all property names of schema + static const List propertyNames = ['item', 'delta', 'response']; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'item': item, + 'delta': delta, + 'response': response, + }; + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/formatted_item.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/formatted_item.dart new file mode 100644 index 00000000..c3089548 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/formatted_item.dart @@ -0,0 +1,45 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: FormattedItem +// ========================================== + +/// A formatted item. +@freezed +class FormattedItem with _$FormattedItem { + const FormattedItem._(); + + /// Factory constructor for FormattedItem + const factory FormattedItem({ + /// The item to add to the conversation. + /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput] + required Item item, + + /// A formatted property. + required FormattedProperty? formatted, + }) = _FormattedItem; + + /// Object construction from a JSON representation + factory FormattedItem.fromJson(Map json) => + _$FormattedItemFromJson(json); + + /// List of all property names of schema + static const List propertyNames = ['item', 'formatted']; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'item': item, + 'formatted': formatted, + }; + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/formatted_property.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/formatted_property.dart new file mode 100644 index 00000000..f55511a9 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/formatted_property.dart @@ -0,0 +1,62 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: FormattedProperty +// ========================================== + +/// A formatted property. +@freezed +class FormattedProperty with _$FormattedProperty { + const FormattedProperty._(); + + /// Factory constructor for FormattedProperty + const factory FormattedProperty({ + /// The audio bytes. + @Uint8ListConverter() required Uint8List audio, + + /// The text. + required String text, + + /// The transcript. + required String transcript, + + /// A formatted tool. + @JsonKey(includeIfNull: false) FormattedTool? tool, + + /// The output. + @JsonKey(includeIfNull: false) String? output, + }) = _FormattedProperty; + + /// Object construction from a JSON representation + factory FormattedProperty.fromJson(Map json) => + _$FormattedPropertyFromJson(json); + + /// List of all property names of schema + static const List propertyNames = [ + 'audio', + 'text', + 'transcript', + 'tool', + 'output' + ]; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'audio': audio, + 'text': text, + 'transcript': transcript, + 'tool': tool, + 'output': output, + }; + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/formatted_tool.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/formatted_tool.dart new file mode 100644 index 00000000..1f0cc099 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/formatted_tool.dart @@ -0,0 +1,57 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: FormattedTool +// ========================================== + +/// A formatted tool. +@freezed +class FormattedTool with _$FormattedTool { + const FormattedTool._(); + + /// Factory constructor for FormattedTool + const factory FormattedTool({ + /// The type of the tool. Currently, only `function` is supported. + @Default(ToolType.function) ToolType type, + + /// The name of the function. + required String name, + + /// The call id. + @JsonKey(name: 'call_id') required String callId, + + /// The arguments. + required String arguments, + }) = _FormattedTool; + + /// Object construction from a JSON representation + factory FormattedTool.fromJson(Map json) => + _$FormattedToolFromJson(json); + + /// List of all property names of schema + static const List propertyNames = [ + 'type', + 'name', + 'call_id', + 'arguments' + ]; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'type': type, + 'name': name, + 'call_id': callId, + 'arguments': arguments, + }; + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/input_audio_transcription_config.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/input_audio_transcription_config.dart new file mode 100644 index 00000000..07611d70 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/input_audio_transcription_config.dart @@ -0,0 +1,44 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: InputAudioTranscriptionConfig +// ========================================== + +/// Configuration for input audio transcription. +@freezed +class InputAudioTranscriptionConfig with _$InputAudioTranscriptionConfig { + const InputAudioTranscriptionConfig._(); + + /// Factory constructor for InputAudioTranscriptionConfig + const factory InputAudioTranscriptionConfig({ + /// Whether input audio transcription is enabled. + @JsonKey(includeIfNull: false) bool? enabled, + + /// The model used for transcription. + @JsonKey(includeIfNull: false) String? model, + }) = _InputAudioTranscriptionConfig; + + /// Object construction from a JSON representation + factory InputAudioTranscriptionConfig.fromJson(Map json) => + _$InputAudioTranscriptionConfigFromJson(json); + + /// List of all property names of schema + static const List propertyNames = ['enabled', 'model']; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'enabled': enabled, + 'model': model, + }; + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/item.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/item.dart new file mode 100644 index 00000000..835c1e93 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/item.dart @@ -0,0 +1,135 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: Item +// ========================================== + +/// The item to add to the conversation. +@Freezed(unionKey: 'type', unionValueCase: FreezedUnionCase.snake) +sealed class Item with _$Item { + const Item._(); + + // ------------------------------------------ + // UNION: ItemMessage + // ------------------------------------------ + + /// A message item. + + @FreezedUnionValue('message') + const factory Item.message({ + /// The unique ID of the item. + required String id, + + /// The object type, must be "realtime.item". + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue, + ) + ObjectType? object, + + /// The type of the item. + @Default(ItemType.message) ItemType type, + + /// The status of the item. + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue, + ) + ItemStatus? status, + + /// The role of the message sender. + required ItemRole role, + + /// The content of the message. + required List content, + }) = ItemMessage; + + // ------------------------------------------ + // UNION: ItemFunctionCall + // ------------------------------------------ + + /// A function call item. + + @FreezedUnionValue('function_call') + const factory Item.functionCall({ + /// The unique ID of the item. + required String id, + + /// The object type. + @Default(ObjectType.realtimeItem) ObjectType object, + + /// The type of the item. + @Default(ItemType.functionCall) ItemType type, + + /// The status of the item. + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue, + ) + ItemStatus? status, + + /// The ID of the function call. + @JsonKey(name: 'call_id') required String callId, + + /// The name of the function being called. + required String name, + + /// The arguments of the function call. + required String arguments, + }) = ItemFunctionCall; + + // ------------------------------------------ + // UNION: ItemFunctionCallOutput + // ------------------------------------------ + + /// A function call output item. + + @FreezedUnionValue('function_call_output') + const factory Item.functionCallOutput({ + /// The unique ID of the item. + required String id, + + /// The object type. Always "realtime.item". + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue, + ) + ObjectType? object, + + /// The type of the item. + @Default(ItemType.functionCallOutput) ItemType type, + + /// The status of the item. + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue, + ) + ItemStatus? status, + + /// The ID of the function call. + @JsonKey(name: 'call_id') required String callId, + + /// The output of the function call. + required String output, + }) = ItemFunctionCallOutput; + + /// Object construction from a JSON representation + factory Item.fromJson(Map json) => _$ItemFromJson(json); +} + +// ========================================== +// ENUM: ItemEnumType +// ========================================== + +enum ItemEnumType { + @JsonValue('message') + message, + @JsonValue('function_call') + functionCall, + @JsonValue('function_call_output') + functionCallOutput, +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/item_role.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/item_role.dart new file mode 100644 index 00000000..c748f836 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/item_role.dart @@ -0,0 +1,19 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// ENUM: ItemRole +// ========================================== + +/// The role associated with the item. +enum ItemRole { + @JsonValue('user') + user, + @JsonValue('assistant') + assistant, + @JsonValue('system') + system, +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/item_speech.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/item_speech.dart new file mode 100644 index 00000000..c7d41cff --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/item_speech.dart @@ -0,0 +1,52 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: ItemSpeech +// ========================================== + +/// The speech item. +@freezed +class ItemSpeech with _$ItemSpeech { + const ItemSpeech._(); + + /// Factory constructor for ItemSpeech + const factory ItemSpeech({ + /// The start time of the audio in milliseconds. + required int audioStartMs, + + /// The end time of the audio in milliseconds. + @JsonKey(includeIfNull: false) int? audioEndMs, + + /// The audio bytes. + @Uint8ListConverter() @JsonKey(includeIfNull: false) Uint8List? audio, + }) = _ItemSpeech; + + /// Object construction from a JSON representation + factory ItemSpeech.fromJson(Map json) => + _$ItemSpeechFromJson(json); + + /// List of all property names of schema + static const List propertyNames = [ + 'audioStartMs', + 'audioEndMs', + 'audio' + ]; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'audioStartMs': audioStartMs, + 'audioEndMs': audioEndMs, + 'audio': audio, + }; + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/item_status.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/item_status.dart new file mode 100644 index 00000000..80c0c4e4 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/item_status.dart @@ -0,0 +1,19 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// ENUM: ItemStatus +// ========================================== + +/// The status of the item. +enum ItemStatus { + @JsonValue('completed') + completed, + @JsonValue('in_progress') + inProgress, + @JsonValue('incomplete') + incomplete, +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/item_transcript.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/item_transcript.dart new file mode 100644 index 00000000..f52b0b57 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/item_transcript.dart @@ -0,0 +1,40 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: ItemTranscript +// ========================================== + +/// The transcript item. +@freezed +class ItemTranscript with _$ItemTranscript { + const ItemTranscript._(); + + /// Factory constructor for ItemTranscript + const factory ItemTranscript({ + /// The transcript. + required String transcript, + }) = _ItemTranscript; + + /// Object construction from a JSON representation + factory ItemTranscript.fromJson(Map json) => + _$ItemTranscriptFromJson(json); + + /// List of all property names of schema + static const List propertyNames = ['transcript']; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'transcript': transcript, + }; + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/item_type.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/item_type.dart new file mode 100644 index 00000000..9cf0c208 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/item_type.dart @@ -0,0 +1,19 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// ENUM: ItemType +// ========================================== + +/// The type of the item. +enum ItemType { + @JsonValue('message') + message, + @JsonValue('function_call') + functionCall, + @JsonValue('function_call_output') + functionCallOutput, +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/modality.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/modality.dart new file mode 100644 index 00000000..8f524010 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/modality.dart @@ -0,0 +1,17 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// ENUM: Modality +// ========================================== + +/// The modality of the model response. +enum Modality { + @JsonValue('text') + text, + @JsonValue('audio') + audio, +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/object_type.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/object_type.dart new file mode 100644 index 00000000..9ebb422b --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/object_type.dart @@ -0,0 +1,21 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// ENUM: ObjectType +// ========================================== + +/// The object type. +enum ObjectType { + @JsonValue('realtime.item') + realtimeItem, + @JsonValue('realtime.response') + realtimeResponse, + @JsonValue('realtime.session') + realtimeSession, + @JsonValue('realtime.conversation') + realtimeConversation, +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/rate_limit.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/rate_limit.dart new file mode 100644 index 00000000..5b667619 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/rate_limit.dart @@ -0,0 +1,57 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: RateLimit +// ========================================== + +/// Rate limit information. +@freezed +class RateLimit with _$RateLimit { + const RateLimit._(); + + /// Factory constructor for RateLimit + const factory RateLimit({ + /// The name of the rate limit. + required RateLimitName name, + + /// The maximum allowed value for the rate limit. + required int limit, + + /// The remaining value before the limit is reached. + required int remaining, + + /// Seconds until the rate limit resets. + @JsonKey(name: 'reset_seconds') required double resetSeconds, + }) = _RateLimit; + + /// Object construction from a JSON representation + factory RateLimit.fromJson(Map json) => + _$RateLimitFromJson(json); + + /// List of all property names of schema + static const List propertyNames = [ + 'name', + 'limit', + 'remaining', + 'reset_seconds' + ]; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'name': name, + 'limit': limit, + 'remaining': remaining, + 'reset_seconds': resetSeconds, + }; + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/rate_limit_name.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/rate_limit_name.dart new file mode 100644 index 00000000..c284b0da --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/rate_limit_name.dart @@ -0,0 +1,21 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// ENUM: RateLimitName +// ========================================== + +/// The name of the rate limit. +enum RateLimitName { + @JsonValue('requests') + requests, + @JsonValue('tokens') + tokens, + @JsonValue('input_tokens') + inputTokens, + @JsonValue('output_tokens') + outputTokens, +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/realtime_event.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/realtime_event.dart new file mode 100644 index 00000000..8ed26351 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/realtime_event.dart @@ -0,0 +1,1058 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: RealtimeEvent +// ========================================== + +/// A Realtime API event. +@Freezed(unionKey: 'type', unionValueCase: FreezedUnionCase.snake) +sealed class RealtimeEvent with _$RealtimeEvent { + const RealtimeEvent._(); + + // ------------------------------------------ + // UNION: RealtimeEventConversationItemCreate + // ------------------------------------------ + + /// Send this event when adding an item to the conversation. + + @FreezedUnionValue('conversation.item.create') + const factory RealtimeEvent.conversationItemCreate({ + /// Optional client-generated ID used to identify this event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.conversationItemCreate) RealtimeEventType type, + + /// The ID of the preceding item after which the new item will be inserted. + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + + /// The item to add to the conversation. + /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput] + required Item item, + }) = RealtimeEventConversationItemCreate; + + // ------------------------------------------ + // UNION: RealtimeEventConversationItemDelete + // ------------------------------------------ + + /// Send this event when you want to remove any item from the conversation history. + + @FreezedUnionValue('conversation.item.delete') + const factory RealtimeEvent.conversationItemDelete({ + /// Optional client-generated ID used to identify this event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.conversationItemDelete) RealtimeEventType type, + + /// The ID of the item to delete. + @JsonKey(name: 'item_id') required String itemId, + }) = RealtimeEventConversationItemDelete; + + // ------------------------------------------ + // UNION: RealtimeEventConversationItemTruncate + // ------------------------------------------ + + /// Send this event when you want to truncate a previous assistant message’s audio. + + @FreezedUnionValue('conversation.item.truncate') + const factory RealtimeEvent.conversationItemTruncate({ + /// Optional client-generated ID used to identify this event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.conversationItemTruncate) RealtimeEventType type, + + /// The ID of the assistant message item to truncate. + @JsonKey(name: 'item_id') required String itemId, + + /// The index of the content part to truncate. + @JsonKey(name: 'content_index') required int contentIndex, + + /// Inclusive duration up to which audio is truncated, in milliseconds. + @JsonKey(name: 'audio_end_ms') required int audioEndMs, + }) = RealtimeEventConversationItemTruncate; + + // ------------------------------------------ + // UNION: RealtimeEventInputAudioBufferAppend + // ------------------------------------------ + + /// Send this event to append audio bytes to the input audio buffer. + + @FreezedUnionValue('input_audio_buffer.append') + const factory RealtimeEvent.inputAudioBufferAppend({ + /// Optional client-generated ID used to identify this event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.inputAudioBufferAppend) RealtimeEventType type, + + /// Base64-encoded audio bytes. + required String audio, + }) = RealtimeEventInputAudioBufferAppend; + + // ------------------------------------------ + // UNION: RealtimeEventInputAudioBufferClear + // ------------------------------------------ + + /// Send this event to clear the audio bytes in the buffer. + + @FreezedUnionValue('input_audio_buffer.clear') + const factory RealtimeEvent.inputAudioBufferClear({ + /// Optional client-generated ID used to identify this event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.inputAudioBufferClear) RealtimeEventType type, + }) = RealtimeEventInputAudioBufferClear; + + // ------------------------------------------ + // UNION: RealtimeEventInputAudioBufferCommit + // ------------------------------------------ + + /// Send this event to commit audio bytes to a user message. + + @FreezedUnionValue('input_audio_buffer.commit') + const factory RealtimeEvent.inputAudioBufferCommit({ + /// Optional client-generated ID used to identify this event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.inputAudioBufferCommit) RealtimeEventType type, + }) = RealtimeEventInputAudioBufferCommit; + + // ------------------------------------------ + // UNION: RealtimeEventResponseCancel + // ------------------------------------------ + + /// Send this event to cancel an in-progress response. + + @FreezedUnionValue('response.cancel') + const factory RealtimeEvent.responseCancel({ + /// Optional client-generated ID used to identify this event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.responseCancel) RealtimeEventType type, + }) = RealtimeEventResponseCancel; + + // ------------------------------------------ + // UNION: RealtimeEventResponseCreate + // ------------------------------------------ + + /// Send this event to trigger a response generation. + + @FreezedUnionValue('response.create') + const factory RealtimeEvent.responseCreate({ + /// Optional client-generated ID used to identify this event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.responseCreate) RealtimeEventType type, + + /// Configuration for the response. + @JsonKey(includeIfNull: false) ResponseConfig? response, + }) = RealtimeEventResponseCreate; + + // ------------------------------------------ + // UNION: RealtimeEventSessionUpdate + // ------------------------------------------ + + /// Send this event to update the session’s default configuration. + + @FreezedUnionValue('session.update') + const factory RealtimeEvent.sessionUpdate({ + /// Optional client-generated ID used to identify this event. + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + + /// The type of the event. + @Default(RealtimeEventType.sessionUpdate) RealtimeEventType type, + + /// Session configuration to update. + required SessionConfig session, + }) = RealtimeEventSessionUpdate; + + // ------------------------------------------ + // UNION: RealtimeEventConversationCreated + // ------------------------------------------ + + /// Returned when a conversation is created. Emitted right after session creation. + + @FreezedUnionValue('conversation.created') + const factory RealtimeEvent.conversationCreated({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.conversationCreated) RealtimeEventType type, + + /// The conversation resource. + required Conversation conversation, + }) = RealtimeEventConversationCreated; + + // ------------------------------------------ + // UNION: RealtimeEventConversationItemCreated + // ------------------------------------------ + + /// Returned when a conversation item is created. + + @FreezedUnionValue('conversation.item.created') + const factory RealtimeEvent.conversationItemCreated({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.conversationItemCreated) RealtimeEventType type, + + /// The ID of the preceding item. + @JsonKey(name: 'previous_item_id') required String? previousItemId, + + /// The item to add to the conversation. + /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput] + required Item item, + }) = RealtimeEventConversationItemCreated; + + // ------------------------------------------ + // UNION: RealtimeEventConversationItemDeleted + // ------------------------------------------ + + /// Returned when an item in the conversation is deleted. + + @FreezedUnionValue('conversation.item.deleted') + const factory RealtimeEvent.conversationItemDeleted({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.conversationItemDeleted) RealtimeEventType type, + + /// The ID of the item that was deleted. + @JsonKey(name: 'item_id') required String itemId, + }) = RealtimeEventConversationItemDeleted; + + // ------------------------------------------ + // UNION: RealtimeEventConversationItemInputAudioTranscriptionCompleted + // ------------------------------------------ + + /// Returned when input audio transcription is enabled and a transcription succeeds. + + @FreezedUnionValue('conversation.item.input_audio_transcription.completed') + const factory RealtimeEvent.conversationItemInputAudioTranscriptionCompleted({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.conversationItemInputAudioTranscriptionCompleted) + RealtimeEventType type, + + /// The ID of the user message item. + @JsonKey(name: 'item_id') required String itemId, + + /// The index of the content part containing the audio. + @JsonKey(name: 'content_index') required int contentIndex, + + /// The transcribed text. + required String transcript, + }) = RealtimeEventConversationItemInputAudioTranscriptionCompleted; + + // ------------------------------------------ + // UNION: RealtimeEventConversationItemInputAudioTranscriptionFailed + // ------------------------------------------ + + /// Returned when input audio transcription is configured, and a transcription request for a user message failed. + + @FreezedUnionValue('conversation.item.input_audio_transcription.failed') + const factory RealtimeEvent.conversationItemInputAudioTranscriptionFailed({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.conversationItemInputAudioTranscriptionFailed) + RealtimeEventType type, + + /// The ID of the user message item. + @JsonKey(name: 'item_id') required String itemId, + + /// The index of the content part containing the audio. + @JsonKey(name: 'content_index') required int contentIndex, + + /// Details of the transcription error. + required TranscriptionError error, + }) = RealtimeEventConversationItemInputAudioTranscriptionFailed; + + // ------------------------------------------ + // UNION: RealtimeEventConversationItemTruncated + // ------------------------------------------ + + /// Returned when an earlier assistant audio message item is truncated by the client. + + @FreezedUnionValue('conversation.item.truncated') + const factory RealtimeEvent.conversationItemTruncated({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.conversationItemTruncated) + RealtimeEventType type, + + /// The ID of the assistant message item that was truncated. + @JsonKey(name: 'item_id') required String itemId, + + /// The index of the content part that was truncated. + @JsonKey(name: 'content_index') required int contentIndex, + + /// The duration up to which the audio was truncated, in milliseconds. + @JsonKey(name: 'audio_end_ms') required int audioEndMs, + }) = RealtimeEventConversationItemTruncated; + + // ------------------------------------------ + // UNION: RealtimeEventError + // ------------------------------------------ + + /// Returned when an error occurs. + + @FreezedUnionValue('error') + const factory RealtimeEvent.error({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.error) RealtimeEventType type, + + /// Details of the API error. + required APIError error, + }) = RealtimeEventError; + + // ------------------------------------------ + // UNION: RealtimeEventInputAudioBufferCleared + // ------------------------------------------ + + /// Returned when the input audio buffer is cleared by the client. + + @FreezedUnionValue('input_audio_buffer.cleared') + const factory RealtimeEvent.inputAudioBufferCleared({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.inputAudioBufferCleared) RealtimeEventType type, + }) = RealtimeEventInputAudioBufferCleared; + + // ------------------------------------------ + // UNION: RealtimeEventInputAudioBufferCommitted + // ------------------------------------------ + + /// Returned when an input audio buffer is committed, either by the client or automatically in server VAD mode. + + @FreezedUnionValue('input_audio_buffer.committed') + const factory RealtimeEvent.inputAudioBufferCommitted({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.inputAudioBufferCommitted) + RealtimeEventType type, + + /// The ID of the preceding item after which the new item will be inserted. + @JsonKey(name: 'previous_item_id') required String previousItemId, + + /// The ID of the user message item that will be created. + @JsonKey(name: 'item_id') required String itemId, + }) = RealtimeEventInputAudioBufferCommitted; + + // ------------------------------------------ + // UNION: RealtimeEventInputAudioBufferSpeechStarted + // ------------------------------------------ + + /// Returned in server turn detection mode when speech is detected. + + @FreezedUnionValue('input_audio_buffer.speech_started') + const factory RealtimeEvent.inputAudioBufferSpeechStarted({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.inputAudioBufferSpeechStarted) + RealtimeEventType type, + + /// Milliseconds since the session started when speech was detected. + @JsonKey(name: 'audio_start_ms') required int audioStartMs, + + /// The ID of the user message item that will be created when speech stops. + @JsonKey(name: 'item_id') required String itemId, + }) = RealtimeEventInputAudioBufferSpeechStarted; + + // ------------------------------------------ + // UNION: RealtimeEventInputAudioBufferSpeechStopped + // ------------------------------------------ + + /// Returned in server turn detection mode when speech stops. + + @FreezedUnionValue('input_audio_buffer.speech_stopped') + const factory RealtimeEvent.inputAudioBufferSpeechStopped({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.inputAudioBufferSpeechStopped) + RealtimeEventType type, + + /// Milliseconds since the session started when speech stopped. + @JsonKey(name: 'audio_end_ms') required int audioEndMs, + + /// The ID of the user message item that will be created. + @JsonKey(name: 'item_id') required String itemId, + }) = RealtimeEventInputAudioBufferSpeechStopped; + + // ------------------------------------------ + // UNION: RealtimeEventRateLimitsUpdated + // ------------------------------------------ + + /// Emitted after every "response.done" event to indicate the updated rate limits. + + @FreezedUnionValue('rate_limits.updated') + const factory RealtimeEvent.rateLimitsUpdated({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.rateLimitsUpdated) RealtimeEventType type, + + /// List of rate limit information. + @JsonKey(name: 'rate_limits') required List rateLimits, + }) = RealtimeEventRateLimitsUpdated; + + // ------------------------------------------ + // UNION: RealtimeEventResponseAudioDelta + // ------------------------------------------ + + /// Returned when the model-generated audio is updated. + + @FreezedUnionValue('response.audio.delta') + const factory RealtimeEvent.responseAudioDelta({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.responseAudioDelta) RealtimeEventType type, + + /// The ID of the response. + @JsonKey(name: 'response_id') required String responseId, + + /// The ID of the item. + @JsonKey(name: 'item_id') required String itemId, + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') required int outputIndex, + + /// The index of the content part in the item's content array. + @JsonKey(name: 'content_index') required int contentIndex, + + /// Base64-encoded audio data delta. + required String delta, + }) = RealtimeEventResponseAudioDelta; + + // ------------------------------------------ + // UNION: RealtimeEventResponseAudioDone + // ------------------------------------------ + + /// Returned when the model-generated audio is done. Also emitted when a Response is interrupted, incomplete, or cancelled. + + @FreezedUnionValue('response.audio.done') + const factory RealtimeEvent.responseAudioDone({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.responseAudioDone) RealtimeEventType type, + + /// The ID of the response. + @JsonKey(name: 'response_id') required String responseId, + + /// The ID of the item. + @JsonKey(name: 'item_id') required String itemId, + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') required int outputIndex, + + /// The index of the content part in the item's content array. + @JsonKey(name: 'content_index') required int contentIndex, + }) = RealtimeEventResponseAudioDone; + + // ------------------------------------------ + // UNION: RealtimeEventResponseAudioTranscriptDelta + // ------------------------------------------ + + /// Returned when the model-generated transcription of audio output is updated. + + @FreezedUnionValue('response.audio_transcript.delta') + const factory RealtimeEvent.responseAudioTranscriptDelta({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.responseAudioTranscriptDelta) + RealtimeEventType type, + + /// The ID of the response. + @JsonKey(name: 'response_id') required String responseId, + + /// The ID of the item. + @JsonKey(name: 'item_id') required String itemId, + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') required int outputIndex, + + /// The index of the content part in the item's content array. + @JsonKey(name: 'content_index') required int contentIndex, + + /// The transcript delta. + required String delta, + }) = RealtimeEventResponseAudioTranscriptDelta; + + // ------------------------------------------ + // UNION: RealtimeEventResponseAudioTranscriptDone + // ------------------------------------------ + + /// Returned when the model-generated transcription of audio output is done streaming. Also emitted when a Response is interrupted, incomplete, or cancelled. + + @FreezedUnionValue('response.audio_transcript.done') + const factory RealtimeEvent.responseAudioTranscriptDone({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.responseAudioTranscriptDone) + RealtimeEventType type, + + /// The ID of the response. + @JsonKey(name: 'response_id') required String responseId, + + /// The ID of the item. + @JsonKey(name: 'item_id') required String itemId, + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') required int outputIndex, + + /// The index of the content part in the item's content array. + @JsonKey(name: 'content_index') required int contentIndex, + + /// The final transcript of the audio. + required String transcript, + }) = RealtimeEventResponseAudioTranscriptDone; + + // ------------------------------------------ + // UNION: RealtimeEventResponseContentPartAdded + // ------------------------------------------ + + /// Returned when a new content part is added to an assistant message item during response generation. + + @FreezedUnionValue('response.content_part.added') + const factory RealtimeEvent.responseContentPartAdded({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.responseContentPartAdded) RealtimeEventType type, + + /// The ID of the response. + @JsonKey(name: 'response_id') required String responseId, + + /// The ID of the item to which the content part was added. + @JsonKey(name: 'item_id') required String itemId, + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') required int outputIndex, + + /// The index of the content part in the item's content array. + @JsonKey(name: 'content_index') required int contentIndex, + + /// A part of the content. + /// Any of: [ContentPartInputText], [ContentPartInputAudio], [ContentPartText], [ContentPartAudio] + required ContentPart part, + }) = RealtimeEventResponseContentPartAdded; + + // ------------------------------------------ + // UNION: RealtimeEventResponseContentPartDone + // ------------------------------------------ + + /// Returned when a content part is done streaming in an assistant message item. Also emitted when a Response is interrupted, incomplete, or cancelled. + + @FreezedUnionValue('response.content_part.done') + const factory RealtimeEvent.responseContentPartDone({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.responseContentPartDone) RealtimeEventType type, + + /// The ID of the response. + @JsonKey(name: 'response_id') required String responseId, + + /// The ID of the item. + @JsonKey(name: 'item_id') required String itemId, + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') required int outputIndex, + + /// The index of the content part in the item's content array. + @JsonKey(name: 'content_index') required int contentIndex, + + /// A part of the content. + /// Any of: [ContentPartInputText], [ContentPartInputAudio], [ContentPartText], [ContentPartAudio] + required ContentPart part, + }) = RealtimeEventResponseContentPartDone; + + // ------------------------------------------ + // UNION: RealtimeEventResponseCreated + // ------------------------------------------ + + /// Returned when a new Response is created. The first event of response creation, where the response is in an initial state of "in_progress". + + @FreezedUnionValue('response.created') + const factory RealtimeEvent.responseCreated({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.responseCreated) RealtimeEventType type, + + /// The response resource. + required Response response, + }) = RealtimeEventResponseCreated; + + // ------------------------------------------ + // UNION: RealtimeEventResponseDone + // ------------------------------------------ + + /// Returned when a Response is done streaming. Always emitted, no matter the final state. + + @FreezedUnionValue('response.done') + const factory RealtimeEvent.responseDone({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.responseDone) RealtimeEventType type, + + /// The response resource. + required Response response, + }) = RealtimeEventResponseDone; + + // ------------------------------------------ + // UNION: RealtimeEventResponseFunctionCallArgumentsDelta + // ------------------------------------------ + + /// Returned when the model-generated function call arguments are updated. + + @FreezedUnionValue('response.function_call_arguments.delta') + const factory RealtimeEvent.responseFunctionCallArgumentsDelta({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.responseFunctionCallArgumentsDelta) + RealtimeEventType type, + + /// The ID of the response. + @JsonKey(name: 'response_id') required String responseId, + + /// The ID of the function call item. + @JsonKey(name: 'item_id') required String itemId, + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') required int outputIndex, + + /// The ID of the function call. + @JsonKey(name: 'call_id') required String callId, + + /// The arguments delta as a JSON string. + required String delta, + }) = RealtimeEventResponseFunctionCallArgumentsDelta; + + // ------------------------------------------ + // UNION: RealtimeEventResponseFunctionCallArgumentsDone + // ------------------------------------------ + + /// Returned when the model-generated function call arguments are done streaming. Also emitted when a Response is interrupted, incomplete, or cancelled. + + @FreezedUnionValue('response.function_call_arguments.done') + const factory RealtimeEvent.responseFunctionCallArgumentsDone({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.responseFunctionCallArgumentsDone) + RealtimeEventType type, + + /// The ID of the response. + @JsonKey(name: 'response_id') required String responseId, + + /// The ID of the function call item. + @JsonKey(name: 'item_id') required String itemId, + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') required int outputIndex, + + /// The ID of the function call. + @JsonKey(name: 'call_id') required String callId, + + /// The final arguments as a JSON string. + required String arguments, + }) = RealtimeEventResponseFunctionCallArgumentsDone; + + // ------------------------------------------ + // UNION: RealtimeEventResponseOutputItemAdded + // ------------------------------------------ + + /// Returned when a new Item is created during response generation. + + @FreezedUnionValue('response.output_item.added') + const factory RealtimeEvent.responseOutputItemAdded({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.responseOutputItemAdded) RealtimeEventType type, + + /// The ID of the response to which the item belongs. + @JsonKey(name: 'response_id') required String responseId, + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') required int outputIndex, + + /// The item to add to the conversation. + /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput] + required Item item, + }) = RealtimeEventResponseOutputItemAdded; + + // ------------------------------------------ + // UNION: RealtimeEventResponseOutputItemDone + // ------------------------------------------ + + /// Returned when an Item is done streaming. Also emitted when a Response is interrupted, incomplete, or cancelled. + + @FreezedUnionValue('response.output_item.done') + const factory RealtimeEvent.responseOutputItemDone({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.responseOutputItemDone) RealtimeEventType type, + + /// The ID of the response to which the item belongs. + @JsonKey(name: 'response_id') required String responseId, + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') required int outputIndex, + + /// The item to add to the conversation. + /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput] + required Item item, + }) = RealtimeEventResponseOutputItemDone; + + // ------------------------------------------ + // UNION: RealtimeEventResponseTextDelta + // ------------------------------------------ + + /// Returned when the text value of a "text" content part is updated. + + @FreezedUnionValue('response.text.delta') + const factory RealtimeEvent.responseTextDelta({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.responseTextDelta) RealtimeEventType type, + + /// The ID of the response. + @JsonKey(name: 'response_id') required String responseId, + + /// The ID of the item. + @JsonKey(name: 'item_id') required String itemId, + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') required int outputIndex, + + /// The index of the content part in the item's content array. + @JsonKey(name: 'content_index') required int contentIndex, + + /// The text delta. + required String delta, + }) = RealtimeEventResponseTextDelta; + + // ------------------------------------------ + // UNION: RealtimeEventResponseTextDone + // ------------------------------------------ + + /// Returned when the text value of a "text" content part is done streaming. Also emitted when a Response is interrupted, incomplete, or cancelled. + + @FreezedUnionValue('response.text.done') + const factory RealtimeEvent.responseTextDone({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.responseTextDone) RealtimeEventType type, + + /// The ID of the response. + @JsonKey(name: 'response_id') required String responseId, + + /// The ID of the item. + @JsonKey(name: 'item_id') required String itemId, + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') required int outputIndex, + + /// The index of the content part in the item's content array. + @JsonKey(name: 'content_index') required int contentIndex, + + /// The final text content. + required String text, + }) = RealtimeEventResponseTextDone; + + // ------------------------------------------ + // UNION: RealtimeEventSessionCreated + // ------------------------------------------ + + /// Returned when a session is created. Emitted automatically when a new connection is established. + + @FreezedUnionValue('session.created') + const factory RealtimeEvent.sessionCreated({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.sessionCreated) RealtimeEventType type, + + /// The session resource. + required Session session, + }) = RealtimeEventSessionCreated; + + // ------------------------------------------ + // UNION: RealtimeEventSessionUpdated + // ------------------------------------------ + + /// Returned when a session is updated. + + @FreezedUnionValue('session.updated') + const factory RealtimeEvent.sessionUpdated({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.sessionUpdated) RealtimeEventType type, + + /// The session resource. + required Session session, + }) = RealtimeEventSessionUpdated; + + // ------------------------------------------ + // UNION: RealtimeEventClose + // ------------------------------------------ + + /// The websocket connection was closed. + + @FreezedUnionValue('close') + const factory RealtimeEvent.close({ + /// The unique ID of the server event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.close) RealtimeEventType type, + + /// Whether the close was due to an error. + required bool error, + }) = RealtimeEventClose; + + // ------------------------------------------ + // UNION: RealtimeEventConversationInterrupted + // ------------------------------------------ + + /// The conversation was interrupted. + + @FreezedUnionValue('conversation.interrupted') + const factory RealtimeEvent.conversationInterrupted({ + /// The unique ID of the event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.conversationInterrupted) RealtimeEventType type, + }) = RealtimeEventConversationInterrupted; + + // ------------------------------------------ + // UNION: RealtimeEventConversationUpdated + // ------------------------------------------ + + /// The conversation was updated. + + @FreezedUnionValue('conversation.updated') + const factory RealtimeEvent.conversationUpdated({ + /// The unique ID of the event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.conversationUpdated) RealtimeEventType type, + + /// No Description + required EventHandlerResult result, + }) = RealtimeEventConversationUpdated; + + // ------------------------------------------ + // UNION: RealtimeEventConversationItemAppended + // ------------------------------------------ + + /// An item was appended to the conversation. + + @FreezedUnionValue('conversation.item.appended') + const factory RealtimeEvent.conversationItemAppended({ + /// The unique ID of the event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.conversationItemAppended) RealtimeEventType type, + + /// A formatted item. + required FormattedItem item, + }) = RealtimeEventConversationItemAppended; + + // ------------------------------------------ + // UNION: RealtimeEventConversationItemCompleted + // ------------------------------------------ + + /// An item was completed. + + @FreezedUnionValue('conversation.item.completed') + const factory RealtimeEvent.conversationItemCompleted({ + /// The unique ID of the event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.conversationItemCompleted) + RealtimeEventType type, + + /// A formatted item. + required FormattedItem item, + }) = RealtimeEventConversationItemCompleted; + + // ------------------------------------------ + // UNION: RealtimeEventGeneric + // ------------------------------------------ + + /// A generic realtime event. + + @FreezedUnionValue('realtime.event') + const factory RealtimeEvent.generic({ + /// The unique ID of the event. + @JsonKey(name: 'event_id') required String eventId, + + /// The type of the event. + @Default(RealtimeEventType.realtimeEvent) RealtimeEventType type, + + /// A Realtime API event. + /// Any of: [RealtimeEventConversationItemCreate], [RealtimeEventConversationItemDelete], [RealtimeEventConversationItemTruncate], [RealtimeEventInputAudioBufferAppend], [RealtimeEventInputAudioBufferClear], [RealtimeEventInputAudioBufferCommit], [RealtimeEventResponseCancel], [RealtimeEventResponseCreate], [RealtimeEventSessionUpdate], [RealtimeEventConversationCreated], [RealtimeEventConversationItemCreated], [RealtimeEventConversationItemDeleted], [RealtimeEventConversationItemInputAudioTranscriptionCompleted], [RealtimeEventConversationItemInputAudioTranscriptionFailed], [RealtimeEventConversationItemTruncated], [RealtimeEventError], [RealtimeEventInputAudioBufferCleared], [RealtimeEventInputAudioBufferCommitted], [RealtimeEventInputAudioBufferSpeechStarted], [RealtimeEventInputAudioBufferSpeechStopped], [RealtimeEventRateLimitsUpdated], [RealtimeEventResponseAudioDelta], [RealtimeEventResponseAudioDone], [RealtimeEventResponseAudioTranscriptDelta], [RealtimeEventResponseAudioTranscriptDone], [RealtimeEventResponseContentPartAdded], [RealtimeEventResponseContentPartDone], [RealtimeEventResponseCreated], [RealtimeEventResponseDone], [RealtimeEventResponseFunctionCallArgumentsDelta], [RealtimeEventResponseFunctionCallArgumentsDone], [RealtimeEventResponseOutputItemAdded], [RealtimeEventResponseOutputItemDone], [RealtimeEventResponseTextDelta], [RealtimeEventResponseTextDone], [RealtimeEventSessionCreated], [RealtimeEventSessionUpdated], [RealtimeEventClose], [RealtimeEventConversationInterrupted], [RealtimeEventConversationUpdated], [RealtimeEventConversationItemAppended], [RealtimeEventConversationItemCompleted], [RealtimeEventGeneric] + required RealtimeEvent event, + }) = RealtimeEventGeneric; + + /// Object construction from a JSON representation + factory RealtimeEvent.fromJson(Map json) => + _$RealtimeEventFromJson(json); +} + +// ========================================== +// ENUM: RealtimeEventEnumType +// ========================================== + +enum RealtimeEventEnumType { + @JsonValue('conversation.item.create') + conversationItemCreate, + @JsonValue('conversation.item.delete') + conversationItemDelete, + @JsonValue('conversation.item.truncate') + conversationItemTruncate, + @JsonValue('input_audio_buffer.append') + inputAudioBufferAppend, + @JsonValue('input_audio_buffer.clear') + inputAudioBufferClear, + @JsonValue('input_audio_buffer.commit') + inputAudioBufferCommit, + @JsonValue('response.cancel') + responseCancel, + @JsonValue('response.create') + responseCreate, + @JsonValue('session.update') + sessionUpdate, + @JsonValue('conversation.created') + conversationCreated, + @JsonValue('conversation.item.created') + conversationItemCreated, + @JsonValue('conversation.item.deleted') + conversationItemDeleted, + @JsonValue('conversation.item.input_audio_transcription.completed') + conversationItemInputAudioTranscriptionCompleted, + @JsonValue('conversation.item.input_audio_transcription.failed') + conversationItemInputAudioTranscriptionFailed, + @JsonValue('conversation.item.truncated') + conversationItemTruncated, + @JsonValue('error') + error, + @JsonValue('input_audio_buffer.cleared') + inputAudioBufferCleared, + @JsonValue('input_audio_buffer.committed') + inputAudioBufferCommitted, + @JsonValue('input_audio_buffer.speech_started') + inputAudioBufferSpeechStarted, + @JsonValue('input_audio_buffer.speech_stopped') + inputAudioBufferSpeechStopped, + @JsonValue('rate_limits.updated') + rateLimitsUpdated, + @JsonValue('response.audio.delta') + responseAudioDelta, + @JsonValue('response.audio.done') + responseAudioDone, + @JsonValue('response.audio_transcript.delta') + responseAudioTranscriptDelta, + @JsonValue('response.audio_transcript.done') + responseAudioTranscriptDone, + @JsonValue('response.content_part.added') + responseContentPartAdded, + @JsonValue('response.content_part.done') + responseContentPartDone, + @JsonValue('response.created') + responseCreated, + @JsonValue('response.done') + responseDone, + @JsonValue('response.function_call_arguments.delta') + responseFunctionCallArgumentsDelta, + @JsonValue('response.function_call_arguments.done') + responseFunctionCallArgumentsDone, + @JsonValue('response.output_item.added') + responseOutputItemAdded, + @JsonValue('response.output_item.done') + responseOutputItemDone, + @JsonValue('response.text.delta') + responseTextDelta, + @JsonValue('response.text.done') + responseTextDone, + @JsonValue('session.created') + sessionCreated, + @JsonValue('session.updated') + sessionUpdated, + @JsonValue('close') + close, + @JsonValue('conversation.interrupted') + conversationInterrupted, + @JsonValue('conversation.updated') + conversationUpdated, + @JsonValue('conversation.item.appended') + conversationItemAppended, + @JsonValue('conversation.item.completed') + conversationItemCompleted, + @JsonValue('realtime.event') + realtimeEvent, +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/realtime_event_type.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/realtime_event_type.dart new file mode 100644 index 00000000..2dcc9671 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/realtime_event_type.dart @@ -0,0 +1,105 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// ENUM: RealtimeEventType +// ========================================== + +/// The type of the event. +enum RealtimeEventType { + @JsonValue('conversation.item.create') + conversationItemCreate, + @JsonValue('conversation.item.delete') + conversationItemDelete, + @JsonValue('conversation.item.truncate') + conversationItemTruncate, + @JsonValue('input_audio_buffer.append') + inputAudioBufferAppend, + @JsonValue('input_audio_buffer.clear') + inputAudioBufferClear, + @JsonValue('input_audio_buffer.commit') + inputAudioBufferCommit, + @JsonValue('response.cancel') + responseCancel, + @JsonValue('response.create') + responseCreate, + @JsonValue('session.update') + sessionUpdate, + @JsonValue('conversation.created') + conversationCreated, + @JsonValue('conversation.item.created') + conversationItemCreated, + @JsonValue('conversation.item.deleted') + conversationItemDeleted, + @JsonValue('conversation.item.input_audio_transcription.completed') + conversationItemInputAudioTranscriptionCompleted, + @JsonValue('conversation.item.input_audio_transcription.failed') + conversationItemInputAudioTranscriptionFailed, + @JsonValue('conversation.item.truncated') + conversationItemTruncated, + @JsonValue('error') + error, + @JsonValue('input_audio_buffer.cleared') + inputAudioBufferCleared, + @JsonValue('input_audio_buffer.committed') + inputAudioBufferCommitted, + @JsonValue('input_audio_buffer.speech_started') + inputAudioBufferSpeechStarted, + @JsonValue('input_audio_buffer.speech_stopped') + inputAudioBufferSpeechStopped, + @JsonValue('rate_limits.updated') + rateLimitsUpdated, + @JsonValue('response.audio.delta') + responseAudioDelta, + @JsonValue('response.audio.done') + responseAudioDone, + @JsonValue('response.audio_transcript.delta') + responseAudioTranscriptDelta, + @JsonValue('response.audio_transcript.done') + responseAudioTranscriptDone, + @JsonValue('response.content_part.added') + responseContentPartAdded, + @JsonValue('response.content_part.done') + responseContentPartDone, + @JsonValue('response.created') + responseCreated, + @JsonValue('response.done') + responseDone, + @JsonValue('response.function_call_arguments.delta') + responseFunctionCallArgumentsDelta, + @JsonValue('response.function_call_arguments.done') + responseFunctionCallArgumentsDone, + @JsonValue('response.output_item.added') + responseOutputItemAdded, + @JsonValue('response.output_item.done') + responseOutputItemDone, + @JsonValue('response.text.delta') + responseTextDelta, + @JsonValue('response.text.done') + responseTextDone, + @JsonValue('session.created') + sessionCreated, + @JsonValue('session.updated') + sessionUpdated, + @JsonValue('close') + close, + @JsonValue('conversation.interrupted') + conversationInterrupted, + @JsonValue('conversation.updated') + conversationUpdated, + @JsonValue('conversation.item.appended') + conversationItemAppended, + @JsonValue('conversation.item.completed') + conversationItemCompleted, + @JsonValue('realtime.event') + realtimeEvent, + @JsonValue('all') + all, + @JsonValue('server.all') + serverAll, + @JsonValue('client.all') + clientAll, +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/response.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/response.dart new file mode 100644 index 00000000..d8b626b3 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/response.dart @@ -0,0 +1,69 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: Response +// ========================================== + +/// The response resource. +@freezed +class Response with _$Response { + const Response._(); + + /// Factory constructor for Response + const factory Response({ + /// The unique ID of the response. + required String id, + + /// The object type, must be "realtime.response". + @Default(ObjectType.realtimeResponse) ObjectType object, + + /// The status of the response. + required ResponseStatus status, + + /// Additional details about the status. + /// Any of: [ResponseStatusDetailsIncomplete], [ResponseStatusDetailsFailed] + @JsonKey(name: 'status_details', includeIfNull: false) + ResponseStatusDetails? statusDetails, + + /// The list of output items generated by the response. + required List output, + + /// Usage statistics for the response + @JsonKey(includeIfNull: false) Usage? usage, + }) = _Response; + + /// Object construction from a JSON representation + factory Response.fromJson(Map json) => + _$ResponseFromJson(json); + + /// List of all property names of schema + static const List propertyNames = [ + 'id', + 'object', + 'status', + 'status_details', + 'output', + 'usage' + ]; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'id': id, + 'object': object, + 'status': status, + 'status_details': statusDetails, + 'output': output, + 'usage': usage, + }; + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/response_config.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/response_config.dart new file mode 100644 index 00000000..5f152def --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/response_config.dart @@ -0,0 +1,226 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: ResponseConfig +// ========================================== + +/// Configuration for the response. +@freezed +class ResponseConfig with _$ResponseConfig { + const ResponseConfig._(); + + /// Factory constructor for ResponseConfig + const factory ResponseConfig({ + /// The modalities for the response. + @JsonKey(includeIfNull: false) List? modalities, + + /// Instructions for the model. + @JsonKey(includeIfNull: false) String? instructions, + + /// The voice the model uses to respond - one of `alloy`, `echo`, or `shimmer`. + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue, + ) + Voice? voice, + + /// The format of output audio. + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue, + ) + AudioFormat? outputAudioFormat, + + /// Tools (functions) available to the model. + @JsonKey(includeIfNull: false) List? tools, + + /// How the model chooses tools. + @_ResponseConfigToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + ResponseConfigToolChoice? toolChoice, + + /// Sampling temperature. + @JsonKey(includeIfNull: false) double? temperature, + + /// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf". + @_ResponseConfigMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + ResponseConfigMaxResponseOutputTokens? maxResponseOutputTokens, + }) = _ResponseConfig; + + /// Object construction from a JSON representation + factory ResponseConfig.fromJson(Map json) => + _$ResponseConfigFromJson(json); + + /// List of all property names of schema + static const List propertyNames = [ + 'modalities', + 'instructions', + 'voice', + 'output_audio_format', + 'tools', + 'tool_choice', + 'temperature', + 'max_response_output_tokens' + ]; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'modalities': modalities, + 'instructions': instructions, + 'voice': voice, + 'output_audio_format': outputAudioFormat, + 'tools': tools, + 'tool_choice': toolChoice, + 'temperature': temperature, + 'max_response_output_tokens': maxResponseOutputTokens, + }; + } +} + +// ========================================== +// ENUM: ResponseConfigToolChoiceMode +// ========================================== + +/// `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools. +enum ResponseConfigToolChoiceMode { + @JsonValue('none') + none, + @JsonValue('auto') + auto, + @JsonValue('required') + required, +} + +// ========================================== +// CLASS: ResponseConfigToolChoice +// ========================================== + +/// How the model chooses tools. +@freezed +sealed class ResponseConfigToolChoice with _$ResponseConfigToolChoice { + const ResponseConfigToolChoice._(); + + /// `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools. + const factory ResponseConfigToolChoice.mode( + ResponseConfigToolChoiceMode value, + ) = ResponseConfigToolChoiceEnumeration; + + /// No Description + const factory ResponseConfigToolChoice.toolChoiceForced( + ToolChoiceForced value, + ) = ResponseConfigToolChoiceToolChoiceForced; + + /// Object construction from a JSON representation + factory ResponseConfigToolChoice.fromJson(Map json) => + _$ResponseConfigToolChoiceFromJson(json); +} + +/// Custom JSON converter for [ResponseConfigToolChoice] +class _ResponseConfigToolChoiceConverter + implements JsonConverter { + const _ResponseConfigToolChoiceConverter(); + + @override + ResponseConfigToolChoice? fromJson(Object? data) { + if (data == null) { + return null; + } + if (data is String && + _$ResponseConfigToolChoiceModeEnumMap.values.contains(data)) { + return ResponseConfigToolChoiceEnumeration( + _$ResponseConfigToolChoiceModeEnumMap.keys.elementAt( + _$ResponseConfigToolChoiceModeEnumMap.values.toList().indexOf(data), + ), + ); + } + if (data is Map) { + try { + return ResponseConfigToolChoiceToolChoiceForced( + ToolChoiceForced.fromJson(data), + ); + } catch (e) {} + } + throw Exception( + 'Unexpected value for ResponseConfigToolChoice: $data', + ); + } + + @override + Object? toJson(ResponseConfigToolChoice? data) { + return switch (data) { + ResponseConfigToolChoiceEnumeration(value: final v) => + _$ResponseConfigToolChoiceModeEnumMap[v]!, + ResponseConfigToolChoiceToolChoiceForced(value: final v) => v.toJson(), + null => null, + }; + } +} + +// ========================================== +// CLASS: ResponseConfigMaxResponseOutputTokens +// ========================================== + +/// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf". +@freezed +sealed class ResponseConfigMaxResponseOutputTokens + with _$ResponseConfigMaxResponseOutputTokens { + const ResponseConfigMaxResponseOutputTokens._(); + + /// Provide an integer between 1 and 4096 to limit output tokens. + const factory ResponseConfigMaxResponseOutputTokens.int( + int value, + ) = ResponseConfigMaxResponseOutputTokensInt; + + /// Use inf for the maximum available tokens for a given model. + const factory ResponseConfigMaxResponseOutputTokens.string( + String value, + ) = ResponseConfigMaxResponseOutputTokensString; + + /// Object construction from a JSON representation + factory ResponseConfigMaxResponseOutputTokens.fromJson( + Map json) => + _$ResponseConfigMaxResponseOutputTokensFromJson(json); +} + +/// Custom JSON converter for [ResponseConfigMaxResponseOutputTokens] +class _ResponseConfigMaxResponseOutputTokensConverter + implements JsonConverter { + const _ResponseConfigMaxResponseOutputTokensConverter(); + + @override + ResponseConfigMaxResponseOutputTokens? fromJson(Object? data) { + if (data == null) { + return null; + } + if (data is int) { + return ResponseConfigMaxResponseOutputTokensInt(data); + } + if (data is String) { + return ResponseConfigMaxResponseOutputTokensString(data); + } + throw Exception( + 'Unexpected value for ResponseConfigMaxResponseOutputTokens: $data', + ); + } + + @override + Object? toJson(ResponseConfigMaxResponseOutputTokens? data) { + return switch (data) { + ResponseConfigMaxResponseOutputTokensInt(value: final v) => v, + ResponseConfigMaxResponseOutputTokensString(value: final v) => v, + null => null, + }; + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/response_status.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/response_status.dart new file mode 100644 index 00000000..1f4cbcf8 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/response_status.dart @@ -0,0 +1,23 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// ENUM: ResponseStatus +// ========================================== + +/// The status of the response. +enum ResponseStatus { + @JsonValue('in_progress') + inProgress, + @JsonValue('completed') + completed, + @JsonValue('cancelled') + cancelled, + @JsonValue('failed') + failed, + @JsonValue('incomplete') + incomplete, +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/response_status_details.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/response_status_details.dart new file mode 100644 index 00000000..f4c76997 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/response_status_details.dart @@ -0,0 +1,64 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: ResponseStatusDetails +// ========================================== + +/// Additional details about the status. +@Freezed(unionKey: 'type', unionValueCase: FreezedUnionCase.snake) +sealed class ResponseStatusDetails with _$ResponseStatusDetails { + const ResponseStatusDetails._(); + + // ------------------------------------------ + // UNION: ResponseStatusDetailsIncomplete + // ------------------------------------------ + + /// Details about the incomplete response. + + @FreezedUnionValue('incomplete') + const factory ResponseStatusDetails.incomplete({ + /// The type of the status. + @Default(ResponseStatusType.incomplete) ResponseStatusType type, + + /// The reason the response is incomplete. + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue, + ) + ResponseStatusIncompleteReason? reason, + }) = ResponseStatusDetailsIncomplete; + + // ------------------------------------------ + // UNION: ResponseStatusDetailsFailed + // ------------------------------------------ + + /// Details about the failed response. + + @FreezedUnionValue('failed') + const factory ResponseStatusDetails.failed({ + /// The type of the status. + @Default(ResponseStatusType.failed) ResponseStatusType type, + + /// Details of the API error. + @JsonKey(includeIfNull: false) APIError? error, + }) = ResponseStatusDetailsFailed; + + /// Object construction from a JSON representation + factory ResponseStatusDetails.fromJson(Map json) => + _$ResponseStatusDetailsFromJson(json); +} + +// ========================================== +// ENUM: ResponseStatusDetailsEnumType +// ========================================== + +enum ResponseStatusDetailsEnumType { + @JsonValue('incomplete') + incomplete, + @JsonValue('failed') + failed, +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/response_status_incomplete_reason.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/response_status_incomplete_reason.dart new file mode 100644 index 00000000..b2a61016 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/response_status_incomplete_reason.dart @@ -0,0 +1,19 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// ENUM: ResponseStatusIncompleteReason +// ========================================== + +/// The reason the response is incomplete. +enum ResponseStatusIncompleteReason { + @JsonValue('interruption') + interruption, + @JsonValue('max_output_tokens') + maxOutputTokens, + @JsonValue('content_filter') + contentFilter, +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/response_status_type.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/response_status_type.dart new file mode 100644 index 00000000..8592212d --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/response_status_type.dart @@ -0,0 +1,17 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// ENUM: ResponseStatusType +// ========================================== + +/// The type of the status. +enum ResponseStatusType { + @JsonValue('incomplete') + incomplete, + @JsonValue('failed') + failed, +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/schema.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/schema.dart new file mode 100644 index 00000000..1005c13d --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/schema.dart @@ -0,0 +1,66 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target + +library openai_realtime_schema; + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'dart:typed_data'; + +part 'schema.g.dart'; +part 'schema.freezed.dart'; + +part 'audio_format.dart'; +part 'voice.dart'; +part 'item_role.dart'; +part 'item_type.dart'; +part 'item_status.dart'; +part 'content_type.dart'; +part 'object_type.dart'; +part 'tool_type.dart'; +part 'tool_definition.dart'; +part 'tool_choice_forced.dart'; +part 'input_audio_transcription_config.dart'; +part 'turn_detection.dart'; +part 'turn_detection_type.dart'; +part 'rate_limit.dart'; +part 'rate_limit_name.dart'; +part 'response.dart'; +part 'response_status.dart'; +part 'response_status_type.dart'; +part 'response_status_incomplete_reason.dart'; +part 'response_config.dart'; +part 'usage.dart'; +part 'session.dart'; +part 'session_config.dart'; +part 'conversation.dart'; +part 'modality.dart'; +part 'delta.dart'; +part 'formatted_tool.dart'; +part 'formatted_property.dart'; +part 'formatted_item.dart'; +part 'item_speech.dart'; +part 'item_transcript.dart'; +part 'event_handler_result.dart'; +part 'transcription_error.dart'; +part 'api_error.dart'; +part 'realtime_event_type.dart'; +part 'content_part.dart'; +part 'item.dart'; +part 'response_status_details.dart'; +part 'realtime_event.dart'; + +class Uint8ListConverter implements JsonConverter> { + const Uint8ListConverter(); + + @override + Uint8List fromJson(List json) { + return Uint8List.fromList(json); + } + + @override + List toJson(Uint8List object) { + return object.toList(); + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/schema.freezed.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/schema.freezed.dart new file mode 100644 index 00000000..8e5ac70b --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/schema.freezed.dart @@ -0,0 +1,63151 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'schema.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +ToolDefinition _$ToolDefinitionFromJson(Map json) { + return _ToolDefinition.fromJson(json); +} + +/// @nodoc +mixin _$ToolDefinition { + /// The type of the tool (currently only `function` is supported). + ToolType get type => throw _privateConstructorUsedError; + + /// The name of the function. + String get name => throw _privateConstructorUsedError; + + /// The description of the function. + @JsonKey(includeIfNull: false) + String? get description => throw _privateConstructorUsedError; + + /// Parameters of the function in JSON Schema. + @JsonKey(includeIfNull: false) + dynamic get parameters => throw _privateConstructorUsedError; + + /// Serializes this ToolDefinition to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of ToolDefinition + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $ToolDefinitionCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ToolDefinitionCopyWith<$Res> { + factory $ToolDefinitionCopyWith( + ToolDefinition value, $Res Function(ToolDefinition) then) = + _$ToolDefinitionCopyWithImpl<$Res, ToolDefinition>; + @useResult + $Res call( + {ToolType type, + String name, + @JsonKey(includeIfNull: false) String? description, + @JsonKey(includeIfNull: false) dynamic parameters}); +} + +/// @nodoc +class _$ToolDefinitionCopyWithImpl<$Res, $Val extends ToolDefinition> + implements $ToolDefinitionCopyWith<$Res> { + _$ToolDefinitionCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of ToolDefinition + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? name = null, + Object? description = freezed, + Object? parameters = freezed, + }) { + return _then(_value.copyWith( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as ToolType, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + description: freezed == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + parameters: freezed == parameters + ? _value.parameters + : parameters // ignore: cast_nullable_to_non_nullable + as dynamic, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$ToolDefinitionImplCopyWith<$Res> + implements $ToolDefinitionCopyWith<$Res> { + factory _$$ToolDefinitionImplCopyWith(_$ToolDefinitionImpl value, + $Res Function(_$ToolDefinitionImpl) then) = + __$$ToolDefinitionImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {ToolType type, + String name, + @JsonKey(includeIfNull: false) String? description, + @JsonKey(includeIfNull: false) dynamic parameters}); +} + +/// @nodoc +class __$$ToolDefinitionImplCopyWithImpl<$Res> + extends _$ToolDefinitionCopyWithImpl<$Res, _$ToolDefinitionImpl> + implements _$$ToolDefinitionImplCopyWith<$Res> { + __$$ToolDefinitionImplCopyWithImpl( + _$ToolDefinitionImpl _value, $Res Function(_$ToolDefinitionImpl) _then) + : super(_value, _then); + + /// Create a copy of ToolDefinition + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? name = null, + Object? description = freezed, + Object? parameters = freezed, + }) { + return _then(_$ToolDefinitionImpl( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as ToolType, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + description: freezed == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + parameters: freezed == parameters + ? _value.parameters + : parameters // ignore: cast_nullable_to_non_nullable + as dynamic, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ToolDefinitionImpl extends _ToolDefinition { + const _$ToolDefinitionImpl( + {this.type = ToolType.function, + required this.name, + @JsonKey(includeIfNull: false) this.description, + @JsonKey(includeIfNull: false) this.parameters}) + : super._(); + + factory _$ToolDefinitionImpl.fromJson(Map json) => + _$$ToolDefinitionImplFromJson(json); + + /// The type of the tool (currently only `function` is supported). + @override + @JsonKey() + final ToolType type; + + /// The name of the function. + @override + final String name; + + /// The description of the function. + @override + @JsonKey(includeIfNull: false) + final String? description; + + /// Parameters of the function in JSON Schema. + @override + @JsonKey(includeIfNull: false) + final dynamic parameters; + + @override + String toString() { + return 'ToolDefinition(type: $type, name: $name, description: $description, parameters: $parameters)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ToolDefinitionImpl && + (identical(other.type, type) || other.type == type) && + (identical(other.name, name) || other.name == name) && + (identical(other.description, description) || + other.description == description) && + const DeepCollectionEquality() + .equals(other.parameters, parameters)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, type, name, description, + const DeepCollectionEquality().hash(parameters)); + + /// Create a copy of ToolDefinition + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ToolDefinitionImplCopyWith<_$ToolDefinitionImpl> get copyWith => + __$$ToolDefinitionImplCopyWithImpl<_$ToolDefinitionImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$ToolDefinitionImplToJson( + this, + ); + } +} + +abstract class _ToolDefinition extends ToolDefinition { + const factory _ToolDefinition( + {final ToolType type, + required final String name, + @JsonKey(includeIfNull: false) final String? description, + @JsonKey(includeIfNull: false) final dynamic parameters}) = + _$ToolDefinitionImpl; + const _ToolDefinition._() : super._(); + + factory _ToolDefinition.fromJson(Map json) = + _$ToolDefinitionImpl.fromJson; + + /// The type of the tool (currently only `function` is supported). + @override + ToolType get type; + + /// The name of the function. + @override + String get name; + + /// The description of the function. + @override + @JsonKey(includeIfNull: false) + String? get description; + + /// Parameters of the function in JSON Schema. + @override + @JsonKey(includeIfNull: false) + dynamic get parameters; + + /// Create a copy of ToolDefinition + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ToolDefinitionImplCopyWith<_$ToolDefinitionImpl> get copyWith => + throw _privateConstructorUsedError; +} + +ToolChoiceForced _$ToolChoiceForcedFromJson(Map json) { + return _ToolChoiceForced.fromJson(json); +} + +/// @nodoc +mixin _$ToolChoiceForced { + /// The type of the tool. Currently, only `function` is supported. + ToolType get type => throw _privateConstructorUsedError; + + /// The name of the function to call. + String get name => throw _privateConstructorUsedError; + + /// Serializes this ToolChoiceForced to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of ToolChoiceForced + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $ToolChoiceForcedCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ToolChoiceForcedCopyWith<$Res> { + factory $ToolChoiceForcedCopyWith( + ToolChoiceForced value, $Res Function(ToolChoiceForced) then) = + _$ToolChoiceForcedCopyWithImpl<$Res, ToolChoiceForced>; + @useResult + $Res call({ToolType type, String name}); +} + +/// @nodoc +class _$ToolChoiceForcedCopyWithImpl<$Res, $Val extends ToolChoiceForced> + implements $ToolChoiceForcedCopyWith<$Res> { + _$ToolChoiceForcedCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of ToolChoiceForced + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? name = null, + }) { + return _then(_value.copyWith( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as ToolType, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$ToolChoiceForcedImplCopyWith<$Res> + implements $ToolChoiceForcedCopyWith<$Res> { + factory _$$ToolChoiceForcedImplCopyWith(_$ToolChoiceForcedImpl value, + $Res Function(_$ToolChoiceForcedImpl) then) = + __$$ToolChoiceForcedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({ToolType type, String name}); +} + +/// @nodoc +class __$$ToolChoiceForcedImplCopyWithImpl<$Res> + extends _$ToolChoiceForcedCopyWithImpl<$Res, _$ToolChoiceForcedImpl> + implements _$$ToolChoiceForcedImplCopyWith<$Res> { + __$$ToolChoiceForcedImplCopyWithImpl(_$ToolChoiceForcedImpl _value, + $Res Function(_$ToolChoiceForcedImpl) _then) + : super(_value, _then); + + /// Create a copy of ToolChoiceForced + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? name = null, + }) { + return _then(_$ToolChoiceForcedImpl( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as ToolType, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ToolChoiceForcedImpl extends _ToolChoiceForced { + const _$ToolChoiceForcedImpl( + {this.type = ToolType.function, required this.name}) + : super._(); + + factory _$ToolChoiceForcedImpl.fromJson(Map json) => + _$$ToolChoiceForcedImplFromJson(json); + + /// The type of the tool. Currently, only `function` is supported. + @override + @JsonKey() + final ToolType type; + + /// The name of the function to call. + @override + final String name; + + @override + String toString() { + return 'ToolChoiceForced(type: $type, name: $name)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ToolChoiceForcedImpl && + (identical(other.type, type) || other.type == type) && + (identical(other.name, name) || other.name == name)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, type, name); + + /// Create a copy of ToolChoiceForced + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ToolChoiceForcedImplCopyWith<_$ToolChoiceForcedImpl> get copyWith => + __$$ToolChoiceForcedImplCopyWithImpl<_$ToolChoiceForcedImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$ToolChoiceForcedImplToJson( + this, + ); + } +} + +abstract class _ToolChoiceForced extends ToolChoiceForced { + const factory _ToolChoiceForced( + {final ToolType type, + required final String name}) = _$ToolChoiceForcedImpl; + const _ToolChoiceForced._() : super._(); + + factory _ToolChoiceForced.fromJson(Map json) = + _$ToolChoiceForcedImpl.fromJson; + + /// The type of the tool. Currently, only `function` is supported. + @override + ToolType get type; + + /// The name of the function to call. + @override + String get name; + + /// Create a copy of ToolChoiceForced + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ToolChoiceForcedImplCopyWith<_$ToolChoiceForcedImpl> get copyWith => + throw _privateConstructorUsedError; +} + +InputAudioTranscriptionConfig _$InputAudioTranscriptionConfigFromJson( + Map json) { + return _InputAudioTranscriptionConfig.fromJson(json); +} + +/// @nodoc +mixin _$InputAudioTranscriptionConfig { + /// Whether input audio transcription is enabled. + @JsonKey(includeIfNull: false) + bool? get enabled => throw _privateConstructorUsedError; + + /// The model used for transcription. + @JsonKey(includeIfNull: false) + String? get model => throw _privateConstructorUsedError; + + /// Serializes this InputAudioTranscriptionConfig to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of InputAudioTranscriptionConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $InputAudioTranscriptionConfigCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $InputAudioTranscriptionConfigCopyWith<$Res> { + factory $InputAudioTranscriptionConfigCopyWith( + InputAudioTranscriptionConfig value, + $Res Function(InputAudioTranscriptionConfig) then) = + _$InputAudioTranscriptionConfigCopyWithImpl<$Res, + InputAudioTranscriptionConfig>; + @useResult + $Res call( + {@JsonKey(includeIfNull: false) bool? enabled, + @JsonKey(includeIfNull: false) String? model}); +} + +/// @nodoc +class _$InputAudioTranscriptionConfigCopyWithImpl<$Res, + $Val extends InputAudioTranscriptionConfig> + implements $InputAudioTranscriptionConfigCopyWith<$Res> { + _$InputAudioTranscriptionConfigCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of InputAudioTranscriptionConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = freezed, + Object? model = freezed, + }) { + return _then(_value.copyWith( + enabled: freezed == enabled + ? _value.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool?, + model: freezed == model + ? _value.model + : model // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$InputAudioTranscriptionConfigImplCopyWith<$Res> + implements $InputAudioTranscriptionConfigCopyWith<$Res> { + factory _$$InputAudioTranscriptionConfigImplCopyWith( + _$InputAudioTranscriptionConfigImpl value, + $Res Function(_$InputAudioTranscriptionConfigImpl) then) = + __$$InputAudioTranscriptionConfigImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(includeIfNull: false) bool? enabled, + @JsonKey(includeIfNull: false) String? model}); +} + +/// @nodoc +class __$$InputAudioTranscriptionConfigImplCopyWithImpl<$Res> + extends _$InputAudioTranscriptionConfigCopyWithImpl<$Res, + _$InputAudioTranscriptionConfigImpl> + implements _$$InputAudioTranscriptionConfigImplCopyWith<$Res> { + __$$InputAudioTranscriptionConfigImplCopyWithImpl( + _$InputAudioTranscriptionConfigImpl _value, + $Res Function(_$InputAudioTranscriptionConfigImpl) _then) + : super(_value, _then); + + /// Create a copy of InputAudioTranscriptionConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? enabled = freezed, + Object? model = freezed, + }) { + return _then(_$InputAudioTranscriptionConfigImpl( + enabled: freezed == enabled + ? _value.enabled + : enabled // ignore: cast_nullable_to_non_nullable + as bool?, + model: freezed == model + ? _value.model + : model // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$InputAudioTranscriptionConfigImpl + extends _InputAudioTranscriptionConfig { + const _$InputAudioTranscriptionConfigImpl( + {@JsonKey(includeIfNull: false) this.enabled, + @JsonKey(includeIfNull: false) this.model}) + : super._(); + + factory _$InputAudioTranscriptionConfigImpl.fromJson( + Map json) => + _$$InputAudioTranscriptionConfigImplFromJson(json); + + /// Whether input audio transcription is enabled. + @override + @JsonKey(includeIfNull: false) + final bool? enabled; + + /// The model used for transcription. + @override + @JsonKey(includeIfNull: false) + final String? model; + + @override + String toString() { + return 'InputAudioTranscriptionConfig(enabled: $enabled, model: $model)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$InputAudioTranscriptionConfigImpl && + (identical(other.enabled, enabled) || other.enabled == enabled) && + (identical(other.model, model) || other.model == model)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, enabled, model); + + /// Create a copy of InputAudioTranscriptionConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$InputAudioTranscriptionConfigImplCopyWith< + _$InputAudioTranscriptionConfigImpl> + get copyWith => __$$InputAudioTranscriptionConfigImplCopyWithImpl< + _$InputAudioTranscriptionConfigImpl>(this, _$identity); + + @override + Map toJson() { + return _$$InputAudioTranscriptionConfigImplToJson( + this, + ); + } +} + +abstract class _InputAudioTranscriptionConfig + extends InputAudioTranscriptionConfig { + const factory _InputAudioTranscriptionConfig( + {@JsonKey(includeIfNull: false) final bool? enabled, + @JsonKey(includeIfNull: false) final String? model}) = + _$InputAudioTranscriptionConfigImpl; + const _InputAudioTranscriptionConfig._() : super._(); + + factory _InputAudioTranscriptionConfig.fromJson(Map json) = + _$InputAudioTranscriptionConfigImpl.fromJson; + + /// Whether input audio transcription is enabled. + @override + @JsonKey(includeIfNull: false) + bool? get enabled; + + /// The model used for transcription. + @override + @JsonKey(includeIfNull: false) + String? get model; + + /// Create a copy of InputAudioTranscriptionConfig + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$InputAudioTranscriptionConfigImplCopyWith< + _$InputAudioTranscriptionConfigImpl> + get copyWith => throw _privateConstructorUsedError; +} + +TurnDetection _$TurnDetectionFromJson(Map json) { + return _TurnDetection.fromJson(json); +} + +/// @nodoc +mixin _$TurnDetection { + /// The type of turn detection ("server_vad" or "none"). + TurnDetectionType get type => throw _privateConstructorUsedError; + + /// Activation threshold for VAD. + @JsonKey(includeIfNull: false) + double? get threshold => throw _privateConstructorUsedError; + + /// Audio included before speech starts (in milliseconds). + @JsonKey(name: 'prefix_padding_ms', includeIfNull: false) + int? get prefixPaddingMs => throw _privateConstructorUsedError; + + /// Duration of silence to detect speech stop (in milliseconds). + @JsonKey(name: 'silence_duration_ms', includeIfNull: false) + int? get silenceDurationMs => throw _privateConstructorUsedError; + + /// Serializes this TurnDetection to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of TurnDetection + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $TurnDetectionCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $TurnDetectionCopyWith<$Res> { + factory $TurnDetectionCopyWith( + TurnDetection value, $Res Function(TurnDetection) then) = + _$TurnDetectionCopyWithImpl<$Res, TurnDetection>; + @useResult + $Res call( + {TurnDetectionType type, + @JsonKey(includeIfNull: false) double? threshold, + @JsonKey(name: 'prefix_padding_ms', includeIfNull: false) + int? prefixPaddingMs, + @JsonKey(name: 'silence_duration_ms', includeIfNull: false) + int? silenceDurationMs}); +} + +/// @nodoc +class _$TurnDetectionCopyWithImpl<$Res, $Val extends TurnDetection> + implements $TurnDetectionCopyWith<$Res> { + _$TurnDetectionCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of TurnDetection + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? threshold = freezed, + Object? prefixPaddingMs = freezed, + Object? silenceDurationMs = freezed, + }) { + return _then(_value.copyWith( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as TurnDetectionType, + threshold: freezed == threshold + ? _value.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as double?, + prefixPaddingMs: freezed == prefixPaddingMs + ? _value.prefixPaddingMs + : prefixPaddingMs // ignore: cast_nullable_to_non_nullable + as int?, + silenceDurationMs: freezed == silenceDurationMs + ? _value.silenceDurationMs + : silenceDurationMs // ignore: cast_nullable_to_non_nullable + as int?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$TurnDetectionImplCopyWith<$Res> + implements $TurnDetectionCopyWith<$Res> { + factory _$$TurnDetectionImplCopyWith( + _$TurnDetectionImpl value, $Res Function(_$TurnDetectionImpl) then) = + __$$TurnDetectionImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {TurnDetectionType type, + @JsonKey(includeIfNull: false) double? threshold, + @JsonKey(name: 'prefix_padding_ms', includeIfNull: false) + int? prefixPaddingMs, + @JsonKey(name: 'silence_duration_ms', includeIfNull: false) + int? silenceDurationMs}); +} + +/// @nodoc +class __$$TurnDetectionImplCopyWithImpl<$Res> + extends _$TurnDetectionCopyWithImpl<$Res, _$TurnDetectionImpl> + implements _$$TurnDetectionImplCopyWith<$Res> { + __$$TurnDetectionImplCopyWithImpl( + _$TurnDetectionImpl _value, $Res Function(_$TurnDetectionImpl) _then) + : super(_value, _then); + + /// Create a copy of TurnDetection + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? threshold = freezed, + Object? prefixPaddingMs = freezed, + Object? silenceDurationMs = freezed, + }) { + return _then(_$TurnDetectionImpl( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as TurnDetectionType, + threshold: freezed == threshold + ? _value.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as double?, + prefixPaddingMs: freezed == prefixPaddingMs + ? _value.prefixPaddingMs + : prefixPaddingMs // ignore: cast_nullable_to_non_nullable + as int?, + silenceDurationMs: freezed == silenceDurationMs + ? _value.silenceDurationMs + : silenceDurationMs // ignore: cast_nullable_to_non_nullable + as int?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$TurnDetectionImpl extends _TurnDetection { + const _$TurnDetectionImpl( + {required this.type, + @JsonKey(includeIfNull: false) this.threshold, + @JsonKey(name: 'prefix_padding_ms', includeIfNull: false) + this.prefixPaddingMs, + @JsonKey(name: 'silence_duration_ms', includeIfNull: false) + this.silenceDurationMs}) + : super._(); + + factory _$TurnDetectionImpl.fromJson(Map json) => + _$$TurnDetectionImplFromJson(json); + + /// The type of turn detection ("server_vad" or "none"). + @override + final TurnDetectionType type; + + /// Activation threshold for VAD. + @override + @JsonKey(includeIfNull: false) + final double? threshold; + + /// Audio included before speech starts (in milliseconds). + @override + @JsonKey(name: 'prefix_padding_ms', includeIfNull: false) + final int? prefixPaddingMs; + + /// Duration of silence to detect speech stop (in milliseconds). + @override + @JsonKey(name: 'silence_duration_ms', includeIfNull: false) + final int? silenceDurationMs; + + @override + String toString() { + return 'TurnDetection(type: $type, threshold: $threshold, prefixPaddingMs: $prefixPaddingMs, silenceDurationMs: $silenceDurationMs)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$TurnDetectionImpl && + (identical(other.type, type) || other.type == type) && + (identical(other.threshold, threshold) || + other.threshold == threshold) && + (identical(other.prefixPaddingMs, prefixPaddingMs) || + other.prefixPaddingMs == prefixPaddingMs) && + (identical(other.silenceDurationMs, silenceDurationMs) || + other.silenceDurationMs == silenceDurationMs)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, type, threshold, prefixPaddingMs, silenceDurationMs); + + /// Create a copy of TurnDetection + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$TurnDetectionImplCopyWith<_$TurnDetectionImpl> get copyWith => + __$$TurnDetectionImplCopyWithImpl<_$TurnDetectionImpl>(this, _$identity); + + @override + Map toJson() { + return _$$TurnDetectionImplToJson( + this, + ); + } +} + +abstract class _TurnDetection extends TurnDetection { + const factory _TurnDetection( + {required final TurnDetectionType type, + @JsonKey(includeIfNull: false) final double? threshold, + @JsonKey(name: 'prefix_padding_ms', includeIfNull: false) + final int? prefixPaddingMs, + @JsonKey(name: 'silence_duration_ms', includeIfNull: false) + final int? silenceDurationMs}) = _$TurnDetectionImpl; + const _TurnDetection._() : super._(); + + factory _TurnDetection.fromJson(Map json) = + _$TurnDetectionImpl.fromJson; + + /// The type of turn detection ("server_vad" or "none"). + @override + TurnDetectionType get type; + + /// Activation threshold for VAD. + @override + @JsonKey(includeIfNull: false) + double? get threshold; + + /// Audio included before speech starts (in milliseconds). + @override + @JsonKey(name: 'prefix_padding_ms', includeIfNull: false) + int? get prefixPaddingMs; + + /// Duration of silence to detect speech stop (in milliseconds). + @override + @JsonKey(name: 'silence_duration_ms', includeIfNull: false) + int? get silenceDurationMs; + + /// Create a copy of TurnDetection + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$TurnDetectionImplCopyWith<_$TurnDetectionImpl> get copyWith => + throw _privateConstructorUsedError; +} + +RateLimit _$RateLimitFromJson(Map json) { + return _RateLimit.fromJson(json); +} + +/// @nodoc +mixin _$RateLimit { + /// The name of the rate limit. + RateLimitName get name => throw _privateConstructorUsedError; + + /// The maximum allowed value for the rate limit. + int get limit => throw _privateConstructorUsedError; + + /// The remaining value before the limit is reached. + int get remaining => throw _privateConstructorUsedError; + + /// Seconds until the rate limit resets. + @JsonKey(name: 'reset_seconds') + double get resetSeconds => throw _privateConstructorUsedError; + + /// Serializes this RateLimit to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of RateLimit + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $RateLimitCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $RateLimitCopyWith<$Res> { + factory $RateLimitCopyWith(RateLimit value, $Res Function(RateLimit) then) = + _$RateLimitCopyWithImpl<$Res, RateLimit>; + @useResult + $Res call( + {RateLimitName name, + int limit, + int remaining, + @JsonKey(name: 'reset_seconds') double resetSeconds}); +} + +/// @nodoc +class _$RateLimitCopyWithImpl<$Res, $Val extends RateLimit> + implements $RateLimitCopyWith<$Res> { + _$RateLimitCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of RateLimit + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? limit = null, + Object? remaining = null, + Object? resetSeconds = null, + }) { + return _then(_value.copyWith( + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as RateLimitName, + limit: null == limit + ? _value.limit + : limit // ignore: cast_nullable_to_non_nullable + as int, + remaining: null == remaining + ? _value.remaining + : remaining // ignore: cast_nullable_to_non_nullable + as int, + resetSeconds: null == resetSeconds + ? _value.resetSeconds + : resetSeconds // ignore: cast_nullable_to_non_nullable + as double, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$RateLimitImplCopyWith<$Res> + implements $RateLimitCopyWith<$Res> { + factory _$$RateLimitImplCopyWith( + _$RateLimitImpl value, $Res Function(_$RateLimitImpl) then) = + __$$RateLimitImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {RateLimitName name, + int limit, + int remaining, + @JsonKey(name: 'reset_seconds') double resetSeconds}); +} + +/// @nodoc +class __$$RateLimitImplCopyWithImpl<$Res> + extends _$RateLimitCopyWithImpl<$Res, _$RateLimitImpl> + implements _$$RateLimitImplCopyWith<$Res> { + __$$RateLimitImplCopyWithImpl( + _$RateLimitImpl _value, $Res Function(_$RateLimitImpl) _then) + : super(_value, _then); + + /// Create a copy of RateLimit + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? limit = null, + Object? remaining = null, + Object? resetSeconds = null, + }) { + return _then(_$RateLimitImpl( + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as RateLimitName, + limit: null == limit + ? _value.limit + : limit // ignore: cast_nullable_to_non_nullable + as int, + remaining: null == remaining + ? _value.remaining + : remaining // ignore: cast_nullable_to_non_nullable + as int, + resetSeconds: null == resetSeconds + ? _value.resetSeconds + : resetSeconds // ignore: cast_nullable_to_non_nullable + as double, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RateLimitImpl extends _RateLimit { + const _$RateLimitImpl( + {required this.name, + required this.limit, + required this.remaining, + @JsonKey(name: 'reset_seconds') required this.resetSeconds}) + : super._(); + + factory _$RateLimitImpl.fromJson(Map json) => + _$$RateLimitImplFromJson(json); + + /// The name of the rate limit. + @override + final RateLimitName name; + + /// The maximum allowed value for the rate limit. + @override + final int limit; + + /// The remaining value before the limit is reached. + @override + final int remaining; + + /// Seconds until the rate limit resets. + @override + @JsonKey(name: 'reset_seconds') + final double resetSeconds; + + @override + String toString() { + return 'RateLimit(name: $name, limit: $limit, remaining: $remaining, resetSeconds: $resetSeconds)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RateLimitImpl && + (identical(other.name, name) || other.name == name) && + (identical(other.limit, limit) || other.limit == limit) && + (identical(other.remaining, remaining) || + other.remaining == remaining) && + (identical(other.resetSeconds, resetSeconds) || + other.resetSeconds == resetSeconds)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, name, limit, remaining, resetSeconds); + + /// Create a copy of RateLimit + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RateLimitImplCopyWith<_$RateLimitImpl> get copyWith => + __$$RateLimitImplCopyWithImpl<_$RateLimitImpl>(this, _$identity); + + @override + Map toJson() { + return _$$RateLimitImplToJson( + this, + ); + } +} + +abstract class _RateLimit extends RateLimit { + const factory _RateLimit( + {required final RateLimitName name, + required final int limit, + required final int remaining, + @JsonKey(name: 'reset_seconds') required final double resetSeconds}) = + _$RateLimitImpl; + const _RateLimit._() : super._(); + + factory _RateLimit.fromJson(Map json) = + _$RateLimitImpl.fromJson; + + /// The name of the rate limit. + @override + RateLimitName get name; + + /// The maximum allowed value for the rate limit. + @override + int get limit; + + /// The remaining value before the limit is reached. + @override + int get remaining; + + /// Seconds until the rate limit resets. + @override + @JsonKey(name: 'reset_seconds') + double get resetSeconds; + + /// Create a copy of RateLimit + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RateLimitImplCopyWith<_$RateLimitImpl> get copyWith => + throw _privateConstructorUsedError; +} + +Response _$ResponseFromJson(Map json) { + return _Response.fromJson(json); +} + +/// @nodoc +mixin _$Response { + /// The unique ID of the response. + String get id => throw _privateConstructorUsedError; + + /// The object type, must be "realtime.response". + ObjectType get object => throw _privateConstructorUsedError; + + /// The status of the response. + ResponseStatus get status => throw _privateConstructorUsedError; + + /// Additional details about the status. + /// Any of: [ResponseStatusDetailsIncomplete], [ResponseStatusDetailsFailed] + @JsonKey(name: 'status_details', includeIfNull: false) + ResponseStatusDetails? get statusDetails => + throw _privateConstructorUsedError; + + /// The list of output items generated by the response. + List get output => throw _privateConstructorUsedError; + + /// Usage statistics for the response + @JsonKey(includeIfNull: false) + Usage? get usage => throw _privateConstructorUsedError; + + /// Serializes this Response to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of Response + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $ResponseCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ResponseCopyWith<$Res> { + factory $ResponseCopyWith(Response value, $Res Function(Response) then) = + _$ResponseCopyWithImpl<$Res, Response>; + @useResult + $Res call( + {String id, + ObjectType object, + ResponseStatus status, + @JsonKey(name: 'status_details', includeIfNull: false) + ResponseStatusDetails? statusDetails, + List output, + @JsonKey(includeIfNull: false) Usage? usage}); + + $ResponseStatusDetailsCopyWith<$Res>? get statusDetails; + $UsageCopyWith<$Res>? get usage; +} + +/// @nodoc +class _$ResponseCopyWithImpl<$Res, $Val extends Response> + implements $ResponseCopyWith<$Res> { + _$ResponseCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of Response + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? object = null, + Object? status = null, + Object? statusDetails = freezed, + Object? output = null, + Object? usage = freezed, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + object: null == object + ? _value.object + : object // ignore: cast_nullable_to_non_nullable + as ObjectType, + status: null == status + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as ResponseStatus, + statusDetails: freezed == statusDetails + ? _value.statusDetails + : statusDetails // ignore: cast_nullable_to_non_nullable + as ResponseStatusDetails?, + output: null == output + ? _value.output + : output // ignore: cast_nullable_to_non_nullable + as List, + usage: freezed == usage + ? _value.usage + : usage // ignore: cast_nullable_to_non_nullable + as Usage?, + ) as $Val); + } + + /// Create a copy of Response + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ResponseStatusDetailsCopyWith<$Res>? get statusDetails { + if (_value.statusDetails == null) { + return null; + } + + return $ResponseStatusDetailsCopyWith<$Res>(_value.statusDetails!, (value) { + return _then(_value.copyWith(statusDetails: value) as $Val); + }); + } + + /// Create a copy of Response + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $UsageCopyWith<$Res>? get usage { + if (_value.usage == null) { + return null; + } + + return $UsageCopyWith<$Res>(_value.usage!, (value) { + return _then(_value.copyWith(usage: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$ResponseImplCopyWith<$Res> + implements $ResponseCopyWith<$Res> { + factory _$$ResponseImplCopyWith( + _$ResponseImpl value, $Res Function(_$ResponseImpl) then) = + __$$ResponseImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String id, + ObjectType object, + ResponseStatus status, + @JsonKey(name: 'status_details', includeIfNull: false) + ResponseStatusDetails? statusDetails, + List output, + @JsonKey(includeIfNull: false) Usage? usage}); + + @override + $ResponseStatusDetailsCopyWith<$Res>? get statusDetails; + @override + $UsageCopyWith<$Res>? get usage; +} + +/// @nodoc +class __$$ResponseImplCopyWithImpl<$Res> + extends _$ResponseCopyWithImpl<$Res, _$ResponseImpl> + implements _$$ResponseImplCopyWith<$Res> { + __$$ResponseImplCopyWithImpl( + _$ResponseImpl _value, $Res Function(_$ResponseImpl) _then) + : super(_value, _then); + + /// Create a copy of Response + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? object = null, + Object? status = null, + Object? statusDetails = freezed, + Object? output = null, + Object? usage = freezed, + }) { + return _then(_$ResponseImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + object: null == object + ? _value.object + : object // ignore: cast_nullable_to_non_nullable + as ObjectType, + status: null == status + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as ResponseStatus, + statusDetails: freezed == statusDetails + ? _value.statusDetails + : statusDetails // ignore: cast_nullable_to_non_nullable + as ResponseStatusDetails?, + output: null == output + ? _value._output + : output // ignore: cast_nullable_to_non_nullable + as List, + usage: freezed == usage + ? _value.usage + : usage // ignore: cast_nullable_to_non_nullable + as Usage?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ResponseImpl extends _Response { + const _$ResponseImpl( + {required this.id, + this.object = ObjectType.realtimeResponse, + required this.status, + @JsonKey(name: 'status_details', includeIfNull: false) this.statusDetails, + required final List output, + @JsonKey(includeIfNull: false) this.usage}) + : _output = output, + super._(); + + factory _$ResponseImpl.fromJson(Map json) => + _$$ResponseImplFromJson(json); + + /// The unique ID of the response. + @override + final String id; + + /// The object type, must be "realtime.response". + @override + @JsonKey() + final ObjectType object; + + /// The status of the response. + @override + final ResponseStatus status; + + /// Additional details about the status. + /// Any of: [ResponseStatusDetailsIncomplete], [ResponseStatusDetailsFailed] + @override + @JsonKey(name: 'status_details', includeIfNull: false) + final ResponseStatusDetails? statusDetails; + + /// The list of output items generated by the response. + final List _output; + + /// The list of output items generated by the response. + @override + List get output { + if (_output is EqualUnmodifiableListView) return _output; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_output); + } + + /// Usage statistics for the response + @override + @JsonKey(includeIfNull: false) + final Usage? usage; + + @override + String toString() { + return 'Response(id: $id, object: $object, status: $status, statusDetails: $statusDetails, output: $output, usage: $usage)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ResponseImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.object, object) || other.object == object) && + (identical(other.status, status) || other.status == status) && + (identical(other.statusDetails, statusDetails) || + other.statusDetails == statusDetails) && + const DeepCollectionEquality().equals(other._output, _output) && + (identical(other.usage, usage) || other.usage == usage)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, object, status, + statusDetails, const DeepCollectionEquality().hash(_output), usage); + + /// Create a copy of Response + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ResponseImplCopyWith<_$ResponseImpl> get copyWith => + __$$ResponseImplCopyWithImpl<_$ResponseImpl>(this, _$identity); + + @override + Map toJson() { + return _$$ResponseImplToJson( + this, + ); + } +} + +abstract class _Response extends Response { + const factory _Response( + {required final String id, + final ObjectType object, + required final ResponseStatus status, + @JsonKey(name: 'status_details', includeIfNull: false) + final ResponseStatusDetails? statusDetails, + required final List output, + @JsonKey(includeIfNull: false) final Usage? usage}) = _$ResponseImpl; + const _Response._() : super._(); + + factory _Response.fromJson(Map json) = + _$ResponseImpl.fromJson; + + /// The unique ID of the response. + @override + String get id; + + /// The object type, must be "realtime.response". + @override + ObjectType get object; + + /// The status of the response. + @override + ResponseStatus get status; + + /// Additional details about the status. + /// Any of: [ResponseStatusDetailsIncomplete], [ResponseStatusDetailsFailed] + @override + @JsonKey(name: 'status_details', includeIfNull: false) + ResponseStatusDetails? get statusDetails; + + /// The list of output items generated by the response. + @override + List get output; + + /// Usage statistics for the response + @override + @JsonKey(includeIfNull: false) + Usage? get usage; + + /// Create a copy of Response + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ResponseImplCopyWith<_$ResponseImpl> get copyWith => + throw _privateConstructorUsedError; +} + +ResponseConfig _$ResponseConfigFromJson(Map json) { + return _ResponseConfig.fromJson(json); +} + +/// @nodoc +mixin _$ResponseConfig { + /// The modalities for the response. + @JsonKey(includeIfNull: false) + List? get modalities => throw _privateConstructorUsedError; + + /// Instructions for the model. + @JsonKey(includeIfNull: false) + String? get instructions => throw _privateConstructorUsedError; + + /// The voice the model uses to respond - one of `alloy`, `echo`, or `shimmer`. + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + Voice? get voice => throw _privateConstructorUsedError; + + /// The format of output audio. + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + AudioFormat? get outputAudioFormat => throw _privateConstructorUsedError; + + /// Tools (functions) available to the model. + @JsonKey(includeIfNull: false) + List? get tools => throw _privateConstructorUsedError; + + /// How the model chooses tools. + @_ResponseConfigToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + ResponseConfigToolChoice? get toolChoice => + throw _privateConstructorUsedError; + + /// Sampling temperature. + @JsonKey(includeIfNull: false) + double? get temperature => throw _privateConstructorUsedError; + + /// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf". + @_ResponseConfigMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + ResponseConfigMaxResponseOutputTokens? get maxResponseOutputTokens => + throw _privateConstructorUsedError; + + /// Serializes this ResponseConfig to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of ResponseConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $ResponseConfigCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ResponseConfigCopyWith<$Res> { + factory $ResponseConfigCopyWith( + ResponseConfig value, $Res Function(ResponseConfig) then) = + _$ResponseConfigCopyWithImpl<$Res, ResponseConfig>; + @useResult + $Res call( + {@JsonKey(includeIfNull: false) List? modalities, + @JsonKey(includeIfNull: false) String? instructions, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + Voice? voice, + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + AudioFormat? outputAudioFormat, + @JsonKey(includeIfNull: false) List? tools, + @_ResponseConfigToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + ResponseConfigToolChoice? toolChoice, + @JsonKey(includeIfNull: false) double? temperature, + @_ResponseConfigMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + ResponseConfigMaxResponseOutputTokens? maxResponseOutputTokens}); + + $ResponseConfigToolChoiceCopyWith<$Res>? get toolChoice; + $ResponseConfigMaxResponseOutputTokensCopyWith<$Res>? + get maxResponseOutputTokens; +} + +/// @nodoc +class _$ResponseConfigCopyWithImpl<$Res, $Val extends ResponseConfig> + implements $ResponseConfigCopyWith<$Res> { + _$ResponseConfigCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of ResponseConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? modalities = freezed, + Object? instructions = freezed, + Object? voice = freezed, + Object? outputAudioFormat = freezed, + Object? tools = freezed, + Object? toolChoice = freezed, + Object? temperature = freezed, + Object? maxResponseOutputTokens = freezed, + }) { + return _then(_value.copyWith( + modalities: freezed == modalities + ? _value.modalities + : modalities // ignore: cast_nullable_to_non_nullable + as List?, + instructions: freezed == instructions + ? _value.instructions + : instructions // ignore: cast_nullable_to_non_nullable + as String?, + voice: freezed == voice + ? _value.voice + : voice // ignore: cast_nullable_to_non_nullable + as Voice?, + outputAudioFormat: freezed == outputAudioFormat + ? _value.outputAudioFormat + : outputAudioFormat // ignore: cast_nullable_to_non_nullable + as AudioFormat?, + tools: freezed == tools + ? _value.tools + : tools // ignore: cast_nullable_to_non_nullable + as List?, + toolChoice: freezed == toolChoice + ? _value.toolChoice + : toolChoice // ignore: cast_nullable_to_non_nullable + as ResponseConfigToolChoice?, + temperature: freezed == temperature + ? _value.temperature + : temperature // ignore: cast_nullable_to_non_nullable + as double?, + maxResponseOutputTokens: freezed == maxResponseOutputTokens + ? _value.maxResponseOutputTokens + : maxResponseOutputTokens // ignore: cast_nullable_to_non_nullable + as ResponseConfigMaxResponseOutputTokens?, + ) as $Val); + } + + /// Create a copy of ResponseConfig + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ResponseConfigToolChoiceCopyWith<$Res>? get toolChoice { + if (_value.toolChoice == null) { + return null; + } + + return $ResponseConfigToolChoiceCopyWith<$Res>(_value.toolChoice!, (value) { + return _then(_value.copyWith(toolChoice: value) as $Val); + }); + } + + /// Create a copy of ResponseConfig + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ResponseConfigMaxResponseOutputTokensCopyWith<$Res>? + get maxResponseOutputTokens { + if (_value.maxResponseOutputTokens == null) { + return null; + } + + return $ResponseConfigMaxResponseOutputTokensCopyWith<$Res>( + _value.maxResponseOutputTokens!, (value) { + return _then(_value.copyWith(maxResponseOutputTokens: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$ResponseConfigImplCopyWith<$Res> + implements $ResponseConfigCopyWith<$Res> { + factory _$$ResponseConfigImplCopyWith(_$ResponseConfigImpl value, + $Res Function(_$ResponseConfigImpl) then) = + __$$ResponseConfigImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(includeIfNull: false) List? modalities, + @JsonKey(includeIfNull: false) String? instructions, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + Voice? voice, + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + AudioFormat? outputAudioFormat, + @JsonKey(includeIfNull: false) List? tools, + @_ResponseConfigToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + ResponseConfigToolChoice? toolChoice, + @JsonKey(includeIfNull: false) double? temperature, + @_ResponseConfigMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + ResponseConfigMaxResponseOutputTokens? maxResponseOutputTokens}); + + @override + $ResponseConfigToolChoiceCopyWith<$Res>? get toolChoice; + @override + $ResponseConfigMaxResponseOutputTokensCopyWith<$Res>? + get maxResponseOutputTokens; +} + +/// @nodoc +class __$$ResponseConfigImplCopyWithImpl<$Res> + extends _$ResponseConfigCopyWithImpl<$Res, _$ResponseConfigImpl> + implements _$$ResponseConfigImplCopyWith<$Res> { + __$$ResponseConfigImplCopyWithImpl( + _$ResponseConfigImpl _value, $Res Function(_$ResponseConfigImpl) _then) + : super(_value, _then); + + /// Create a copy of ResponseConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? modalities = freezed, + Object? instructions = freezed, + Object? voice = freezed, + Object? outputAudioFormat = freezed, + Object? tools = freezed, + Object? toolChoice = freezed, + Object? temperature = freezed, + Object? maxResponseOutputTokens = freezed, + }) { + return _then(_$ResponseConfigImpl( + modalities: freezed == modalities + ? _value._modalities + : modalities // ignore: cast_nullable_to_non_nullable + as List?, + instructions: freezed == instructions + ? _value.instructions + : instructions // ignore: cast_nullable_to_non_nullable + as String?, + voice: freezed == voice + ? _value.voice + : voice // ignore: cast_nullable_to_non_nullable + as Voice?, + outputAudioFormat: freezed == outputAudioFormat + ? _value.outputAudioFormat + : outputAudioFormat // ignore: cast_nullable_to_non_nullable + as AudioFormat?, + tools: freezed == tools + ? _value._tools + : tools // ignore: cast_nullable_to_non_nullable + as List?, + toolChoice: freezed == toolChoice + ? _value.toolChoice + : toolChoice // ignore: cast_nullable_to_non_nullable + as ResponseConfigToolChoice?, + temperature: freezed == temperature + ? _value.temperature + : temperature // ignore: cast_nullable_to_non_nullable + as double?, + maxResponseOutputTokens: freezed == maxResponseOutputTokens + ? _value.maxResponseOutputTokens + : maxResponseOutputTokens // ignore: cast_nullable_to_non_nullable + as ResponseConfigMaxResponseOutputTokens?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ResponseConfigImpl extends _ResponseConfig { + const _$ResponseConfigImpl( + {@JsonKey(includeIfNull: false) final List? modalities, + @JsonKey(includeIfNull: false) this.instructions, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + this.voice, + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + this.outputAudioFormat, + @JsonKey(includeIfNull: false) final List? tools, + @_ResponseConfigToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + this.toolChoice, + @JsonKey(includeIfNull: false) this.temperature, + @_ResponseConfigMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + this.maxResponseOutputTokens}) + : _modalities = modalities, + _tools = tools, + super._(); + + factory _$ResponseConfigImpl.fromJson(Map json) => + _$$ResponseConfigImplFromJson(json); + + /// The modalities for the response. + final List? _modalities; + + /// The modalities for the response. + @override + @JsonKey(includeIfNull: false) + List? get modalities { + final value = _modalities; + if (value == null) return null; + if (_modalities is EqualUnmodifiableListView) return _modalities; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + /// Instructions for the model. + @override + @JsonKey(includeIfNull: false) + final String? instructions; + + /// The voice the model uses to respond - one of `alloy`, `echo`, or `shimmer`. + @override + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final Voice? voice; + + /// The format of output audio. + @override + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final AudioFormat? outputAudioFormat; + + /// Tools (functions) available to the model. + final List? _tools; + + /// Tools (functions) available to the model. + @override + @JsonKey(includeIfNull: false) + List? get tools { + final value = _tools; + if (value == null) return null; + if (_tools is EqualUnmodifiableListView) return _tools; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + /// How the model chooses tools. + @override + @_ResponseConfigToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + final ResponseConfigToolChoice? toolChoice; + + /// Sampling temperature. + @override + @JsonKey(includeIfNull: false) + final double? temperature; + + /// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf". + @override + @_ResponseConfigMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + final ResponseConfigMaxResponseOutputTokens? maxResponseOutputTokens; + + @override + String toString() { + return 'ResponseConfig(modalities: $modalities, instructions: $instructions, voice: $voice, outputAudioFormat: $outputAudioFormat, tools: $tools, toolChoice: $toolChoice, temperature: $temperature, maxResponseOutputTokens: $maxResponseOutputTokens)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ResponseConfigImpl && + const DeepCollectionEquality() + .equals(other._modalities, _modalities) && + (identical(other.instructions, instructions) || + other.instructions == instructions) && + (identical(other.voice, voice) || other.voice == voice) && + (identical(other.outputAudioFormat, outputAudioFormat) || + other.outputAudioFormat == outputAudioFormat) && + const DeepCollectionEquality().equals(other._tools, _tools) && + (identical(other.toolChoice, toolChoice) || + other.toolChoice == toolChoice) && + (identical(other.temperature, temperature) || + other.temperature == temperature) && + (identical( + other.maxResponseOutputTokens, maxResponseOutputTokens) || + other.maxResponseOutputTokens == maxResponseOutputTokens)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(_modalities), + instructions, + voice, + outputAudioFormat, + const DeepCollectionEquality().hash(_tools), + toolChoice, + temperature, + maxResponseOutputTokens); + + /// Create a copy of ResponseConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ResponseConfigImplCopyWith<_$ResponseConfigImpl> get copyWith => + __$$ResponseConfigImplCopyWithImpl<_$ResponseConfigImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$ResponseConfigImplToJson( + this, + ); + } +} + +abstract class _ResponseConfig extends ResponseConfig { + const factory _ResponseConfig( + {@JsonKey(includeIfNull: false) final List? modalities, + @JsonKey(includeIfNull: false) final String? instructions, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final Voice? voice, + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final AudioFormat? outputAudioFormat, + @JsonKey(includeIfNull: false) final List? tools, + @_ResponseConfigToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + final ResponseConfigToolChoice? toolChoice, + @JsonKey(includeIfNull: false) final double? temperature, + @_ResponseConfigMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + final ResponseConfigMaxResponseOutputTokens? + maxResponseOutputTokens}) = _$ResponseConfigImpl; + const _ResponseConfig._() : super._(); + + factory _ResponseConfig.fromJson(Map json) = + _$ResponseConfigImpl.fromJson; + + /// The modalities for the response. + @override + @JsonKey(includeIfNull: false) + List? get modalities; + + /// Instructions for the model. + @override + @JsonKey(includeIfNull: false) + String? get instructions; + + /// The voice the model uses to respond - one of `alloy`, `echo`, or `shimmer`. + @override + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + Voice? get voice; + + /// The format of output audio. + @override + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + AudioFormat? get outputAudioFormat; + + /// Tools (functions) available to the model. + @override + @JsonKey(includeIfNull: false) + List? get tools; + + /// How the model chooses tools. + @override + @_ResponseConfigToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + ResponseConfigToolChoice? get toolChoice; + + /// Sampling temperature. + @override + @JsonKey(includeIfNull: false) + double? get temperature; + + /// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf". + @override + @_ResponseConfigMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + ResponseConfigMaxResponseOutputTokens? get maxResponseOutputTokens; + + /// Create a copy of ResponseConfig + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ResponseConfigImplCopyWith<_$ResponseConfigImpl> get copyWith => + throw _privateConstructorUsedError; +} + +ResponseConfigToolChoice _$ResponseConfigToolChoiceFromJson( + Map json) { + switch (json['runtimeType']) { + case 'mode': + return ResponseConfigToolChoiceEnumeration.fromJson(json); + case 'toolChoiceForced': + return ResponseConfigToolChoiceToolChoiceForced.fromJson(json); + + default: + throw CheckedFromJsonException( + json, + 'runtimeType', + 'ResponseConfigToolChoice', + 'Invalid union type "${json['runtimeType']}"!'); + } +} + +/// @nodoc +mixin _$ResponseConfigToolChoice { + Object get value => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult when({ + required TResult Function(ResponseConfigToolChoiceMode value) mode, + required TResult Function(ToolChoiceForced value) toolChoiceForced, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(ResponseConfigToolChoiceMode value)? mode, + TResult? Function(ToolChoiceForced value)? toolChoiceForced, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(ResponseConfigToolChoiceMode value)? mode, + TResult Function(ToolChoiceForced value)? toolChoiceForced, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(ResponseConfigToolChoiceEnumeration value) mode, + required TResult Function(ResponseConfigToolChoiceToolChoiceForced value) + toolChoiceForced, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ResponseConfigToolChoiceEnumeration value)? mode, + TResult? Function(ResponseConfigToolChoiceToolChoiceForced value)? + toolChoiceForced, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ResponseConfigToolChoiceEnumeration value)? mode, + TResult Function(ResponseConfigToolChoiceToolChoiceForced value)? + toolChoiceForced, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + + /// Serializes this ResponseConfigToolChoice to a JSON map. + Map toJson() => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ResponseConfigToolChoiceCopyWith<$Res> { + factory $ResponseConfigToolChoiceCopyWith(ResponseConfigToolChoice value, + $Res Function(ResponseConfigToolChoice) then) = + _$ResponseConfigToolChoiceCopyWithImpl<$Res, ResponseConfigToolChoice>; +} + +/// @nodoc +class _$ResponseConfigToolChoiceCopyWithImpl<$Res, + $Val extends ResponseConfigToolChoice> + implements $ResponseConfigToolChoiceCopyWith<$Res> { + _$ResponseConfigToolChoiceCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of ResponseConfigToolChoice + /// with the given fields replaced by the non-null parameter values. +} + +/// @nodoc +abstract class _$$ResponseConfigToolChoiceEnumerationImplCopyWith<$Res> { + factory _$$ResponseConfigToolChoiceEnumerationImplCopyWith( + _$ResponseConfigToolChoiceEnumerationImpl value, + $Res Function(_$ResponseConfigToolChoiceEnumerationImpl) then) = + __$$ResponseConfigToolChoiceEnumerationImplCopyWithImpl<$Res>; + @useResult + $Res call({ResponseConfigToolChoiceMode value}); +} + +/// @nodoc +class __$$ResponseConfigToolChoiceEnumerationImplCopyWithImpl<$Res> + extends _$ResponseConfigToolChoiceCopyWithImpl<$Res, + _$ResponseConfigToolChoiceEnumerationImpl> + implements _$$ResponseConfigToolChoiceEnumerationImplCopyWith<$Res> { + __$$ResponseConfigToolChoiceEnumerationImplCopyWithImpl( + _$ResponseConfigToolChoiceEnumerationImpl _value, + $Res Function(_$ResponseConfigToolChoiceEnumerationImpl) _then) + : super(_value, _then); + + /// Create a copy of ResponseConfigToolChoice + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_$ResponseConfigToolChoiceEnumerationImpl( + null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as ResponseConfigToolChoiceMode, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ResponseConfigToolChoiceEnumerationImpl + extends ResponseConfigToolChoiceEnumeration { + const _$ResponseConfigToolChoiceEnumerationImpl(this.value, + {final String? $type}) + : $type = $type ?? 'mode', + super._(); + + factory _$ResponseConfigToolChoiceEnumerationImpl.fromJson( + Map json) => + _$$ResponseConfigToolChoiceEnumerationImplFromJson(json); + + @override + final ResponseConfigToolChoiceMode value; + + @JsonKey(name: 'runtimeType') + final String $type; + + @override + String toString() { + return 'ResponseConfigToolChoice.mode(value: $value)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ResponseConfigToolChoiceEnumerationImpl && + (identical(other.value, value) || other.value == value)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, value); + + /// Create a copy of ResponseConfigToolChoice + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ResponseConfigToolChoiceEnumerationImplCopyWith< + _$ResponseConfigToolChoiceEnumerationImpl> + get copyWith => __$$ResponseConfigToolChoiceEnumerationImplCopyWithImpl< + _$ResponseConfigToolChoiceEnumerationImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(ResponseConfigToolChoiceMode value) mode, + required TResult Function(ToolChoiceForced value) toolChoiceForced, + }) { + return mode(value); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(ResponseConfigToolChoiceMode value)? mode, + TResult? Function(ToolChoiceForced value)? toolChoiceForced, + }) { + return mode?.call(value); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(ResponseConfigToolChoiceMode value)? mode, + TResult Function(ToolChoiceForced value)? toolChoiceForced, + required TResult orElse(), + }) { + if (mode != null) { + return mode(value); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ResponseConfigToolChoiceEnumeration value) mode, + required TResult Function(ResponseConfigToolChoiceToolChoiceForced value) + toolChoiceForced, + }) { + return mode(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ResponseConfigToolChoiceEnumeration value)? mode, + TResult? Function(ResponseConfigToolChoiceToolChoiceForced value)? + toolChoiceForced, + }) { + return mode?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ResponseConfigToolChoiceEnumeration value)? mode, + TResult Function(ResponseConfigToolChoiceToolChoiceForced value)? + toolChoiceForced, + required TResult orElse(), + }) { + if (mode != null) { + return mode(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$ResponseConfigToolChoiceEnumerationImplToJson( + this, + ); + } +} + +abstract class ResponseConfigToolChoiceEnumeration + extends ResponseConfigToolChoice { + const factory ResponseConfigToolChoiceEnumeration( + final ResponseConfigToolChoiceMode value) = + _$ResponseConfigToolChoiceEnumerationImpl; + const ResponseConfigToolChoiceEnumeration._() : super._(); + + factory ResponseConfigToolChoiceEnumeration.fromJson( + Map json) = + _$ResponseConfigToolChoiceEnumerationImpl.fromJson; + + @override + ResponseConfigToolChoiceMode get value; + + /// Create a copy of ResponseConfigToolChoice + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ResponseConfigToolChoiceEnumerationImplCopyWith< + _$ResponseConfigToolChoiceEnumerationImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$ResponseConfigToolChoiceToolChoiceForcedImplCopyWith<$Res> { + factory _$$ResponseConfigToolChoiceToolChoiceForcedImplCopyWith( + _$ResponseConfigToolChoiceToolChoiceForcedImpl value, + $Res Function(_$ResponseConfigToolChoiceToolChoiceForcedImpl) then) = + __$$ResponseConfigToolChoiceToolChoiceForcedImplCopyWithImpl<$Res>; + @useResult + $Res call({ToolChoiceForced value}); + + $ToolChoiceForcedCopyWith<$Res> get value; +} + +/// @nodoc +class __$$ResponseConfigToolChoiceToolChoiceForcedImplCopyWithImpl<$Res> + extends _$ResponseConfigToolChoiceCopyWithImpl<$Res, + _$ResponseConfigToolChoiceToolChoiceForcedImpl> + implements _$$ResponseConfigToolChoiceToolChoiceForcedImplCopyWith<$Res> { + __$$ResponseConfigToolChoiceToolChoiceForcedImplCopyWithImpl( + _$ResponseConfigToolChoiceToolChoiceForcedImpl _value, + $Res Function(_$ResponseConfigToolChoiceToolChoiceForcedImpl) _then) + : super(_value, _then); + + /// Create a copy of ResponseConfigToolChoice + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_$ResponseConfigToolChoiceToolChoiceForcedImpl( + null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as ToolChoiceForced, + )); + } + + /// Create a copy of ResponseConfigToolChoice + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ToolChoiceForcedCopyWith<$Res> get value { + return $ToolChoiceForcedCopyWith<$Res>(_value.value, (value) { + return _then(_value.copyWith(value: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$ResponseConfigToolChoiceToolChoiceForcedImpl + extends ResponseConfigToolChoiceToolChoiceForced { + const _$ResponseConfigToolChoiceToolChoiceForcedImpl(this.value, + {final String? $type}) + : $type = $type ?? 'toolChoiceForced', + super._(); + + factory _$ResponseConfigToolChoiceToolChoiceForcedImpl.fromJson( + Map json) => + _$$ResponseConfigToolChoiceToolChoiceForcedImplFromJson(json); + + @override + final ToolChoiceForced value; + + @JsonKey(name: 'runtimeType') + final String $type; + + @override + String toString() { + return 'ResponseConfigToolChoice.toolChoiceForced(value: $value)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ResponseConfigToolChoiceToolChoiceForcedImpl && + (identical(other.value, value) || other.value == value)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, value); + + /// Create a copy of ResponseConfigToolChoice + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ResponseConfigToolChoiceToolChoiceForcedImplCopyWith< + _$ResponseConfigToolChoiceToolChoiceForcedImpl> + get copyWith => + __$$ResponseConfigToolChoiceToolChoiceForcedImplCopyWithImpl< + _$ResponseConfigToolChoiceToolChoiceForcedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(ResponseConfigToolChoiceMode value) mode, + required TResult Function(ToolChoiceForced value) toolChoiceForced, + }) { + return toolChoiceForced(value); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(ResponseConfigToolChoiceMode value)? mode, + TResult? Function(ToolChoiceForced value)? toolChoiceForced, + }) { + return toolChoiceForced?.call(value); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(ResponseConfigToolChoiceMode value)? mode, + TResult Function(ToolChoiceForced value)? toolChoiceForced, + required TResult orElse(), + }) { + if (toolChoiceForced != null) { + return toolChoiceForced(value); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ResponseConfigToolChoiceEnumeration value) mode, + required TResult Function(ResponseConfigToolChoiceToolChoiceForced value) + toolChoiceForced, + }) { + return toolChoiceForced(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ResponseConfigToolChoiceEnumeration value)? mode, + TResult? Function(ResponseConfigToolChoiceToolChoiceForced value)? + toolChoiceForced, + }) { + return toolChoiceForced?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ResponseConfigToolChoiceEnumeration value)? mode, + TResult Function(ResponseConfigToolChoiceToolChoiceForced value)? + toolChoiceForced, + required TResult orElse(), + }) { + if (toolChoiceForced != null) { + return toolChoiceForced(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$ResponseConfigToolChoiceToolChoiceForcedImplToJson( + this, + ); + } +} + +abstract class ResponseConfigToolChoiceToolChoiceForced + extends ResponseConfigToolChoice { + const factory ResponseConfigToolChoiceToolChoiceForced( + final ToolChoiceForced value) = + _$ResponseConfigToolChoiceToolChoiceForcedImpl; + const ResponseConfigToolChoiceToolChoiceForced._() : super._(); + + factory ResponseConfigToolChoiceToolChoiceForced.fromJson( + Map json) = + _$ResponseConfigToolChoiceToolChoiceForcedImpl.fromJson; + + @override + ToolChoiceForced get value; + + /// Create a copy of ResponseConfigToolChoice + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ResponseConfigToolChoiceToolChoiceForcedImplCopyWith< + _$ResponseConfigToolChoiceToolChoiceForcedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +ResponseConfigMaxResponseOutputTokens + _$ResponseConfigMaxResponseOutputTokensFromJson(Map json) { + switch (json['runtimeType']) { + case 'int': + return ResponseConfigMaxResponseOutputTokensInt.fromJson(json); + case 'string': + return ResponseConfigMaxResponseOutputTokensString.fromJson(json); + + default: + throw CheckedFromJsonException( + json, + 'runtimeType', + 'ResponseConfigMaxResponseOutputTokens', + 'Invalid union type "${json['runtimeType']}"!'); + } +} + +/// @nodoc +mixin _$ResponseConfigMaxResponseOutputTokens { + Object get value => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult when({ + required TResult Function(int value) int, + required TResult Function(String value) string, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(int value)? int, + TResult? Function(String value)? string, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(int value)? int, + TResult Function(String value)? string, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(ResponseConfigMaxResponseOutputTokensInt value) + int, + required TResult Function(ResponseConfigMaxResponseOutputTokensString value) + string, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ResponseConfigMaxResponseOutputTokensInt value)? int, + TResult? Function(ResponseConfigMaxResponseOutputTokensString value)? + string, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ResponseConfigMaxResponseOutputTokensInt value)? int, + TResult Function(ResponseConfigMaxResponseOutputTokensString value)? string, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + + /// Serializes this ResponseConfigMaxResponseOutputTokens to a JSON map. + Map toJson() => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ResponseConfigMaxResponseOutputTokensCopyWith<$Res> { + factory $ResponseConfigMaxResponseOutputTokensCopyWith( + ResponseConfigMaxResponseOutputTokens value, + $Res Function(ResponseConfigMaxResponseOutputTokens) then) = + _$ResponseConfigMaxResponseOutputTokensCopyWithImpl<$Res, + ResponseConfigMaxResponseOutputTokens>; +} + +/// @nodoc +class _$ResponseConfigMaxResponseOutputTokensCopyWithImpl<$Res, + $Val extends ResponseConfigMaxResponseOutputTokens> + implements $ResponseConfigMaxResponseOutputTokensCopyWith<$Res> { + _$ResponseConfigMaxResponseOutputTokensCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of ResponseConfigMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. +} + +/// @nodoc +abstract class _$$ResponseConfigMaxResponseOutputTokensIntImplCopyWith<$Res> { + factory _$$ResponseConfigMaxResponseOutputTokensIntImplCopyWith( + _$ResponseConfigMaxResponseOutputTokensIntImpl value, + $Res Function(_$ResponseConfigMaxResponseOutputTokensIntImpl) then) = + __$$ResponseConfigMaxResponseOutputTokensIntImplCopyWithImpl<$Res>; + @useResult + $Res call({int value}); +} + +/// @nodoc +class __$$ResponseConfigMaxResponseOutputTokensIntImplCopyWithImpl<$Res> + extends _$ResponseConfigMaxResponseOutputTokensCopyWithImpl<$Res, + _$ResponseConfigMaxResponseOutputTokensIntImpl> + implements _$$ResponseConfigMaxResponseOutputTokensIntImplCopyWith<$Res> { + __$$ResponseConfigMaxResponseOutputTokensIntImplCopyWithImpl( + _$ResponseConfigMaxResponseOutputTokensIntImpl _value, + $Res Function(_$ResponseConfigMaxResponseOutputTokensIntImpl) _then) + : super(_value, _then); + + /// Create a copy of ResponseConfigMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_$ResponseConfigMaxResponseOutputTokensIntImpl( + null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ResponseConfigMaxResponseOutputTokensIntImpl + extends ResponseConfigMaxResponseOutputTokensInt { + const _$ResponseConfigMaxResponseOutputTokensIntImpl(this.value, + {final String? $type}) + : $type = $type ?? 'int', + super._(); + + factory _$ResponseConfigMaxResponseOutputTokensIntImpl.fromJson( + Map json) => + _$$ResponseConfigMaxResponseOutputTokensIntImplFromJson(json); + + @override + final int value; + + @JsonKey(name: 'runtimeType') + final String $type; + + @override + String toString() { + return 'ResponseConfigMaxResponseOutputTokens.int(value: $value)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ResponseConfigMaxResponseOutputTokensIntImpl && + (identical(other.value, value) || other.value == value)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, value); + + /// Create a copy of ResponseConfigMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ResponseConfigMaxResponseOutputTokensIntImplCopyWith< + _$ResponseConfigMaxResponseOutputTokensIntImpl> + get copyWith => + __$$ResponseConfigMaxResponseOutputTokensIntImplCopyWithImpl< + _$ResponseConfigMaxResponseOutputTokensIntImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(int value) int, + required TResult Function(String value) string, + }) { + return int(value); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(int value)? int, + TResult? Function(String value)? string, + }) { + return int?.call(value); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(int value)? int, + TResult Function(String value)? string, + required TResult orElse(), + }) { + if (int != null) { + return int(value); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ResponseConfigMaxResponseOutputTokensInt value) + int, + required TResult Function(ResponseConfigMaxResponseOutputTokensString value) + string, + }) { + return int(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ResponseConfigMaxResponseOutputTokensInt value)? int, + TResult? Function(ResponseConfigMaxResponseOutputTokensString value)? + string, + }) { + return int?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ResponseConfigMaxResponseOutputTokensInt value)? int, + TResult Function(ResponseConfigMaxResponseOutputTokensString value)? string, + required TResult orElse(), + }) { + if (int != null) { + return int(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$ResponseConfigMaxResponseOutputTokensIntImplToJson( + this, + ); + } +} + +abstract class ResponseConfigMaxResponseOutputTokensInt + extends ResponseConfigMaxResponseOutputTokens { + const factory ResponseConfigMaxResponseOutputTokensInt(final int value) = + _$ResponseConfigMaxResponseOutputTokensIntImpl; + const ResponseConfigMaxResponseOutputTokensInt._() : super._(); + + factory ResponseConfigMaxResponseOutputTokensInt.fromJson( + Map json) = + _$ResponseConfigMaxResponseOutputTokensIntImpl.fromJson; + + @override + int get value; + + /// Create a copy of ResponseConfigMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ResponseConfigMaxResponseOutputTokensIntImplCopyWith< + _$ResponseConfigMaxResponseOutputTokensIntImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$ResponseConfigMaxResponseOutputTokensStringImplCopyWith< + $Res> { + factory _$$ResponseConfigMaxResponseOutputTokensStringImplCopyWith( + _$ResponseConfigMaxResponseOutputTokensStringImpl value, + $Res Function(_$ResponseConfigMaxResponseOutputTokensStringImpl) + then) = + __$$ResponseConfigMaxResponseOutputTokensStringImplCopyWithImpl<$Res>; + @useResult + $Res call({String value}); +} + +/// @nodoc +class __$$ResponseConfigMaxResponseOutputTokensStringImplCopyWithImpl<$Res> + extends _$ResponseConfigMaxResponseOutputTokensCopyWithImpl<$Res, + _$ResponseConfigMaxResponseOutputTokensStringImpl> + implements + _$$ResponseConfigMaxResponseOutputTokensStringImplCopyWith<$Res> { + __$$ResponseConfigMaxResponseOutputTokensStringImplCopyWithImpl( + _$ResponseConfigMaxResponseOutputTokensStringImpl _value, + $Res Function(_$ResponseConfigMaxResponseOutputTokensStringImpl) _then) + : super(_value, _then); + + /// Create a copy of ResponseConfigMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_$ResponseConfigMaxResponseOutputTokensStringImpl( + null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ResponseConfigMaxResponseOutputTokensStringImpl + extends ResponseConfigMaxResponseOutputTokensString { + const _$ResponseConfigMaxResponseOutputTokensStringImpl(this.value, + {final String? $type}) + : $type = $type ?? 'string', + super._(); + + factory _$ResponseConfigMaxResponseOutputTokensStringImpl.fromJson( + Map json) => + _$$ResponseConfigMaxResponseOutputTokensStringImplFromJson(json); + + @override + final String value; + + @JsonKey(name: 'runtimeType') + final String $type; + + @override + String toString() { + return 'ResponseConfigMaxResponseOutputTokens.string(value: $value)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ResponseConfigMaxResponseOutputTokensStringImpl && + (identical(other.value, value) || other.value == value)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, value); + + /// Create a copy of ResponseConfigMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ResponseConfigMaxResponseOutputTokensStringImplCopyWith< + _$ResponseConfigMaxResponseOutputTokensStringImpl> + get copyWith => + __$$ResponseConfigMaxResponseOutputTokensStringImplCopyWithImpl< + _$ResponseConfigMaxResponseOutputTokensStringImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(int value) int, + required TResult Function(String value) string, + }) { + return string(value); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(int value)? int, + TResult? Function(String value)? string, + }) { + return string?.call(value); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(int value)? int, + TResult Function(String value)? string, + required TResult orElse(), + }) { + if (string != null) { + return string(value); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ResponseConfigMaxResponseOutputTokensInt value) + int, + required TResult Function(ResponseConfigMaxResponseOutputTokensString value) + string, + }) { + return string(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ResponseConfigMaxResponseOutputTokensInt value)? int, + TResult? Function(ResponseConfigMaxResponseOutputTokensString value)? + string, + }) { + return string?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ResponseConfigMaxResponseOutputTokensInt value)? int, + TResult Function(ResponseConfigMaxResponseOutputTokensString value)? string, + required TResult orElse(), + }) { + if (string != null) { + return string(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$ResponseConfigMaxResponseOutputTokensStringImplToJson( + this, + ); + } +} + +abstract class ResponseConfigMaxResponseOutputTokensString + extends ResponseConfigMaxResponseOutputTokens { + const factory ResponseConfigMaxResponseOutputTokensString( + final String value) = _$ResponseConfigMaxResponseOutputTokensStringImpl; + const ResponseConfigMaxResponseOutputTokensString._() : super._(); + + factory ResponseConfigMaxResponseOutputTokensString.fromJson( + Map json) = + _$ResponseConfigMaxResponseOutputTokensStringImpl.fromJson; + + @override + String get value; + + /// Create a copy of ResponseConfigMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ResponseConfigMaxResponseOutputTokensStringImplCopyWith< + _$ResponseConfigMaxResponseOutputTokensStringImpl> + get copyWith => throw _privateConstructorUsedError; +} + +Usage _$UsageFromJson(Map json) { + return _Usage.fromJson(json); +} + +/// @nodoc +mixin _$Usage { + /// The total number of tokens used. + @JsonKey(name: 'total_tokens', includeIfNull: false) + int? get totalTokens => throw _privateConstructorUsedError; + + /// The number of input tokens used. + @JsonKey(name: 'input_tokens', includeIfNull: false) + int? get inputTokens => throw _privateConstructorUsedError; + + /// The number of output tokens used. + @JsonKey(name: 'output_tokens', includeIfNull: false) + int? get outputTokens => throw _privateConstructorUsedError; + + /// Details about the input tokens used. + @JsonKey(name: 'input_token_details', includeIfNull: false) + UsageInputTokenDetails? get inputTokenDetails => + throw _privateConstructorUsedError; + + /// Serializes this Usage to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of Usage + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $UsageCopyWith get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $UsageCopyWith<$Res> { + factory $UsageCopyWith(Usage value, $Res Function(Usage) then) = + _$UsageCopyWithImpl<$Res, Usage>; + @useResult + $Res call( + {@JsonKey(name: 'total_tokens', includeIfNull: false) int? totalTokens, + @JsonKey(name: 'input_tokens', includeIfNull: false) int? inputTokens, + @JsonKey(name: 'output_tokens', includeIfNull: false) int? outputTokens, + @JsonKey(name: 'input_token_details', includeIfNull: false) + UsageInputTokenDetails? inputTokenDetails}); + + $UsageInputTokenDetailsCopyWith<$Res>? get inputTokenDetails; +} + +/// @nodoc +class _$UsageCopyWithImpl<$Res, $Val extends Usage> + implements $UsageCopyWith<$Res> { + _$UsageCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of Usage + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? totalTokens = freezed, + Object? inputTokens = freezed, + Object? outputTokens = freezed, + Object? inputTokenDetails = freezed, + }) { + return _then(_value.copyWith( + totalTokens: freezed == totalTokens + ? _value.totalTokens + : totalTokens // ignore: cast_nullable_to_non_nullable + as int?, + inputTokens: freezed == inputTokens + ? _value.inputTokens + : inputTokens // ignore: cast_nullable_to_non_nullable + as int?, + outputTokens: freezed == outputTokens + ? _value.outputTokens + : outputTokens // ignore: cast_nullable_to_non_nullable + as int?, + inputTokenDetails: freezed == inputTokenDetails + ? _value.inputTokenDetails + : inputTokenDetails // ignore: cast_nullable_to_non_nullable + as UsageInputTokenDetails?, + ) as $Val); + } + + /// Create a copy of Usage + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $UsageInputTokenDetailsCopyWith<$Res>? get inputTokenDetails { + if (_value.inputTokenDetails == null) { + return null; + } + + return $UsageInputTokenDetailsCopyWith<$Res>(_value.inputTokenDetails!, + (value) { + return _then(_value.copyWith(inputTokenDetails: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$UsageImplCopyWith<$Res> implements $UsageCopyWith<$Res> { + factory _$$UsageImplCopyWith( + _$UsageImpl value, $Res Function(_$UsageImpl) then) = + __$$UsageImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'total_tokens', includeIfNull: false) int? totalTokens, + @JsonKey(name: 'input_tokens', includeIfNull: false) int? inputTokens, + @JsonKey(name: 'output_tokens', includeIfNull: false) int? outputTokens, + @JsonKey(name: 'input_token_details', includeIfNull: false) + UsageInputTokenDetails? inputTokenDetails}); + + @override + $UsageInputTokenDetailsCopyWith<$Res>? get inputTokenDetails; +} + +/// @nodoc +class __$$UsageImplCopyWithImpl<$Res> + extends _$UsageCopyWithImpl<$Res, _$UsageImpl> + implements _$$UsageImplCopyWith<$Res> { + __$$UsageImplCopyWithImpl( + _$UsageImpl _value, $Res Function(_$UsageImpl) _then) + : super(_value, _then); + + /// Create a copy of Usage + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? totalTokens = freezed, + Object? inputTokens = freezed, + Object? outputTokens = freezed, + Object? inputTokenDetails = freezed, + }) { + return _then(_$UsageImpl( + totalTokens: freezed == totalTokens + ? _value.totalTokens + : totalTokens // ignore: cast_nullable_to_non_nullable + as int?, + inputTokens: freezed == inputTokens + ? _value.inputTokens + : inputTokens // ignore: cast_nullable_to_non_nullable + as int?, + outputTokens: freezed == outputTokens + ? _value.outputTokens + : outputTokens // ignore: cast_nullable_to_non_nullable + as int?, + inputTokenDetails: freezed == inputTokenDetails + ? _value.inputTokenDetails + : inputTokenDetails // ignore: cast_nullable_to_non_nullable + as UsageInputTokenDetails?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$UsageImpl extends _Usage { + const _$UsageImpl( + {@JsonKey(name: 'total_tokens', includeIfNull: false) this.totalTokens, + @JsonKey(name: 'input_tokens', includeIfNull: false) this.inputTokens, + @JsonKey(name: 'output_tokens', includeIfNull: false) this.outputTokens, + @JsonKey(name: 'input_token_details', includeIfNull: false) + this.inputTokenDetails}) + : super._(); + + factory _$UsageImpl.fromJson(Map json) => + _$$UsageImplFromJson(json); + + /// The total number of tokens used. + @override + @JsonKey(name: 'total_tokens', includeIfNull: false) + final int? totalTokens; + + /// The number of input tokens used. + @override + @JsonKey(name: 'input_tokens', includeIfNull: false) + final int? inputTokens; + + /// The number of output tokens used. + @override + @JsonKey(name: 'output_tokens', includeIfNull: false) + final int? outputTokens; + + /// Details about the input tokens used. + @override + @JsonKey(name: 'input_token_details', includeIfNull: false) + final UsageInputTokenDetails? inputTokenDetails; + + @override + String toString() { + return 'Usage(totalTokens: $totalTokens, inputTokens: $inputTokens, outputTokens: $outputTokens, inputTokenDetails: $inputTokenDetails)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$UsageImpl && + (identical(other.totalTokens, totalTokens) || + other.totalTokens == totalTokens) && + (identical(other.inputTokens, inputTokens) || + other.inputTokens == inputTokens) && + (identical(other.outputTokens, outputTokens) || + other.outputTokens == outputTokens) && + (identical(other.inputTokenDetails, inputTokenDetails) || + other.inputTokenDetails == inputTokenDetails)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, totalTokens, inputTokens, outputTokens, inputTokenDetails); + + /// Create a copy of Usage + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$UsageImplCopyWith<_$UsageImpl> get copyWith => + __$$UsageImplCopyWithImpl<_$UsageImpl>(this, _$identity); + + @override + Map toJson() { + return _$$UsageImplToJson( + this, + ); + } +} + +abstract class _Usage extends Usage { + const factory _Usage( + {@JsonKey(name: 'total_tokens', includeIfNull: false) + final int? totalTokens, + @JsonKey(name: 'input_tokens', includeIfNull: false) + final int? inputTokens, + @JsonKey(name: 'output_tokens', includeIfNull: false) + final int? outputTokens, + @JsonKey(name: 'input_token_details', includeIfNull: false) + final UsageInputTokenDetails? inputTokenDetails}) = _$UsageImpl; + const _Usage._() : super._(); + + factory _Usage.fromJson(Map json) = _$UsageImpl.fromJson; + + /// The total number of tokens used. + @override + @JsonKey(name: 'total_tokens', includeIfNull: false) + int? get totalTokens; + + /// The number of input tokens used. + @override + @JsonKey(name: 'input_tokens', includeIfNull: false) + int? get inputTokens; + + /// The number of output tokens used. + @override + @JsonKey(name: 'output_tokens', includeIfNull: false) + int? get outputTokens; + + /// Details about the input tokens used. + @override + @JsonKey(name: 'input_token_details', includeIfNull: false) + UsageInputTokenDetails? get inputTokenDetails; + + /// Create a copy of Usage + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$UsageImplCopyWith<_$UsageImpl> get copyWith => + throw _privateConstructorUsedError; +} + +UsageInputTokenDetails _$UsageInputTokenDetailsFromJson( + Map json) { + return _UsageInputTokenDetails.fromJson(json); +} + +/// @nodoc +mixin _$UsageInputTokenDetails { + /// The number of cached tokens used. + @JsonKey(name: 'cached_tokens', includeIfNull: false) + int? get cachedTokens => throw _privateConstructorUsedError; + + /// The number of text tokens used. + @JsonKey(name: 'text_tokens', includeIfNull: false) + int? get textTokens => throw _privateConstructorUsedError; + + /// The number of audio tokens used. + @JsonKey(name: 'audio_tokens', includeIfNull: false) + int? get audioTokens => throw _privateConstructorUsedError; + + /// Serializes this UsageInputTokenDetails to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of UsageInputTokenDetails + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $UsageInputTokenDetailsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $UsageInputTokenDetailsCopyWith<$Res> { + factory $UsageInputTokenDetailsCopyWith(UsageInputTokenDetails value, + $Res Function(UsageInputTokenDetails) then) = + _$UsageInputTokenDetailsCopyWithImpl<$Res, UsageInputTokenDetails>; + @useResult + $Res call( + {@JsonKey(name: 'cached_tokens', includeIfNull: false) int? cachedTokens, + @JsonKey(name: 'text_tokens', includeIfNull: false) int? textTokens, + @JsonKey(name: 'audio_tokens', includeIfNull: false) int? audioTokens}); +} + +/// @nodoc +class _$UsageInputTokenDetailsCopyWithImpl<$Res, + $Val extends UsageInputTokenDetails> + implements $UsageInputTokenDetailsCopyWith<$Res> { + _$UsageInputTokenDetailsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of UsageInputTokenDetails + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? cachedTokens = freezed, + Object? textTokens = freezed, + Object? audioTokens = freezed, + }) { + return _then(_value.copyWith( + cachedTokens: freezed == cachedTokens + ? _value.cachedTokens + : cachedTokens // ignore: cast_nullable_to_non_nullable + as int?, + textTokens: freezed == textTokens + ? _value.textTokens + : textTokens // ignore: cast_nullable_to_non_nullable + as int?, + audioTokens: freezed == audioTokens + ? _value.audioTokens + : audioTokens // ignore: cast_nullable_to_non_nullable + as int?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$UsageInputTokenDetailsImplCopyWith<$Res> + implements $UsageInputTokenDetailsCopyWith<$Res> { + factory _$$UsageInputTokenDetailsImplCopyWith( + _$UsageInputTokenDetailsImpl value, + $Res Function(_$UsageInputTokenDetailsImpl) then) = + __$$UsageInputTokenDetailsImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'cached_tokens', includeIfNull: false) int? cachedTokens, + @JsonKey(name: 'text_tokens', includeIfNull: false) int? textTokens, + @JsonKey(name: 'audio_tokens', includeIfNull: false) int? audioTokens}); +} + +/// @nodoc +class __$$UsageInputTokenDetailsImplCopyWithImpl<$Res> + extends _$UsageInputTokenDetailsCopyWithImpl<$Res, + _$UsageInputTokenDetailsImpl> + implements _$$UsageInputTokenDetailsImplCopyWith<$Res> { + __$$UsageInputTokenDetailsImplCopyWithImpl( + _$UsageInputTokenDetailsImpl _value, + $Res Function(_$UsageInputTokenDetailsImpl) _then) + : super(_value, _then); + + /// Create a copy of UsageInputTokenDetails + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? cachedTokens = freezed, + Object? textTokens = freezed, + Object? audioTokens = freezed, + }) { + return _then(_$UsageInputTokenDetailsImpl( + cachedTokens: freezed == cachedTokens + ? _value.cachedTokens + : cachedTokens // ignore: cast_nullable_to_non_nullable + as int?, + textTokens: freezed == textTokens + ? _value.textTokens + : textTokens // ignore: cast_nullable_to_non_nullable + as int?, + audioTokens: freezed == audioTokens + ? _value.audioTokens + : audioTokens // ignore: cast_nullable_to_non_nullable + as int?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$UsageInputTokenDetailsImpl extends _UsageInputTokenDetails { + const _$UsageInputTokenDetailsImpl( + {@JsonKey(name: 'cached_tokens', includeIfNull: false) this.cachedTokens, + @JsonKey(name: 'text_tokens', includeIfNull: false) this.textTokens, + @JsonKey(name: 'audio_tokens', includeIfNull: false) this.audioTokens}) + : super._(); + + factory _$UsageInputTokenDetailsImpl.fromJson(Map json) => + _$$UsageInputTokenDetailsImplFromJson(json); + + /// The number of cached tokens used. + @override + @JsonKey(name: 'cached_tokens', includeIfNull: false) + final int? cachedTokens; + + /// The number of text tokens used. + @override + @JsonKey(name: 'text_tokens', includeIfNull: false) + final int? textTokens; + + /// The number of audio tokens used. + @override + @JsonKey(name: 'audio_tokens', includeIfNull: false) + final int? audioTokens; + + @override + String toString() { + return 'UsageInputTokenDetails(cachedTokens: $cachedTokens, textTokens: $textTokens, audioTokens: $audioTokens)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$UsageInputTokenDetailsImpl && + (identical(other.cachedTokens, cachedTokens) || + other.cachedTokens == cachedTokens) && + (identical(other.textTokens, textTokens) || + other.textTokens == textTokens) && + (identical(other.audioTokens, audioTokens) || + other.audioTokens == audioTokens)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, cachedTokens, textTokens, audioTokens); + + /// Create a copy of UsageInputTokenDetails + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$UsageInputTokenDetailsImplCopyWith<_$UsageInputTokenDetailsImpl> + get copyWith => __$$UsageInputTokenDetailsImplCopyWithImpl< + _$UsageInputTokenDetailsImpl>(this, _$identity); + + @override + Map toJson() { + return _$$UsageInputTokenDetailsImplToJson( + this, + ); + } +} + +abstract class _UsageInputTokenDetails extends UsageInputTokenDetails { + const factory _UsageInputTokenDetails( + {@JsonKey(name: 'cached_tokens', includeIfNull: false) + final int? cachedTokens, + @JsonKey(name: 'text_tokens', includeIfNull: false) final int? textTokens, + @JsonKey(name: 'audio_tokens', includeIfNull: false) + final int? audioTokens}) = _$UsageInputTokenDetailsImpl; + const _UsageInputTokenDetails._() : super._(); + + factory _UsageInputTokenDetails.fromJson(Map json) = + _$UsageInputTokenDetailsImpl.fromJson; + + /// The number of cached tokens used. + @override + @JsonKey(name: 'cached_tokens', includeIfNull: false) + int? get cachedTokens; + + /// The number of text tokens used. + @override + @JsonKey(name: 'text_tokens', includeIfNull: false) + int? get textTokens; + + /// The number of audio tokens used. + @override + @JsonKey(name: 'audio_tokens', includeIfNull: false) + int? get audioTokens; + + /// Create a copy of UsageInputTokenDetails + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$UsageInputTokenDetailsImplCopyWith<_$UsageInputTokenDetailsImpl> + get copyWith => throw _privateConstructorUsedError; +} + +Session _$SessionFromJson(Map json) { + return _Session.fromJson(json); +} + +/// @nodoc +mixin _$Session { + /// The unique ID of the session. + @JsonKey(includeIfNull: false) + String? get id => throw _privateConstructorUsedError; + + /// The object type, must be "realtime.session". + ObjectType get object => throw _privateConstructorUsedError; + + /// The default model used for this session. + @JsonKey(includeIfNull: false) + String? get model => throw _privateConstructorUsedError; + + /// The time at which the session expires. + @JsonKey(name: 'expires_at', includeIfNull: false) + int? get expiresAt => throw _privateConstructorUsedError; + + /// The set of modalities the model can respond with. + @JsonKey(includeIfNull: false) + List? get modalities => throw _privateConstructorUsedError; + + /// The default system instructions. + @JsonKey(includeIfNull: false) + String? get instructions => throw _privateConstructorUsedError; + + /// The voice the model uses to respond - one of `alloy`, `echo`, or `shimmer`. + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + Voice? get voice => throw _privateConstructorUsedError; + + /// The format of input audio. + @JsonKey( + name: 'input_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + AudioFormat? get inputAudioFormat => throw _privateConstructorUsedError; + + /// The format of output audio. + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + AudioFormat? get outputAudioFormat => throw _privateConstructorUsedError; + + /// Configuration for input audio transcription. + @JsonKey(name: 'input_audio_transcription', includeIfNull: false) + InputAudioTranscriptionConfig? get inputAudioTranscription => + throw _privateConstructorUsedError; + + /// Configuration for turn detection. + @JsonKey(name: 'turn_detection', includeIfNull: false) + TurnDetection? get turnDetection => throw _privateConstructorUsedError; + + /// Tools (functions) available to the model. + @JsonKey(includeIfNull: false) + List? get tools => throw _privateConstructorUsedError; + + /// How the model chooses tools. + @_SessionToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + SessionToolChoice? get toolChoice => throw _privateConstructorUsedError; + + /// Sampling temperature. + @JsonKey(includeIfNull: false) + double? get temperature => throw _privateConstructorUsedError; + + /// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf". + @_SessionMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + SessionMaxResponseOutputTokens? get maxResponseOutputTokens => + throw _privateConstructorUsedError; + + /// Serializes this Session to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of Session + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $SessionCopyWith get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SessionCopyWith<$Res> { + factory $SessionCopyWith(Session value, $Res Function(Session) then) = + _$SessionCopyWithImpl<$Res, Session>; + @useResult + $Res call( + {@JsonKey(includeIfNull: false) String? id, + ObjectType object, + @JsonKey(includeIfNull: false) String? model, + @JsonKey(name: 'expires_at', includeIfNull: false) int? expiresAt, + @JsonKey(includeIfNull: false) List? modalities, + @JsonKey(includeIfNull: false) String? instructions, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + Voice? voice, + @JsonKey( + name: 'input_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + AudioFormat? inputAudioFormat, + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + AudioFormat? outputAudioFormat, + @JsonKey(name: 'input_audio_transcription', includeIfNull: false) + InputAudioTranscriptionConfig? inputAudioTranscription, + @JsonKey(name: 'turn_detection', includeIfNull: false) + TurnDetection? turnDetection, + @JsonKey(includeIfNull: false) List? tools, + @_SessionToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + SessionToolChoice? toolChoice, + @JsonKey(includeIfNull: false) double? temperature, + @_SessionMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + SessionMaxResponseOutputTokens? maxResponseOutputTokens}); + + $InputAudioTranscriptionConfigCopyWith<$Res>? get inputAudioTranscription; + $TurnDetectionCopyWith<$Res>? get turnDetection; + $SessionToolChoiceCopyWith<$Res>? get toolChoice; + $SessionMaxResponseOutputTokensCopyWith<$Res>? get maxResponseOutputTokens; +} + +/// @nodoc +class _$SessionCopyWithImpl<$Res, $Val extends Session> + implements $SessionCopyWith<$Res> { + _$SessionCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of Session + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = freezed, + Object? object = null, + Object? model = freezed, + Object? expiresAt = freezed, + Object? modalities = freezed, + Object? instructions = freezed, + Object? voice = freezed, + Object? inputAudioFormat = freezed, + Object? outputAudioFormat = freezed, + Object? inputAudioTranscription = freezed, + Object? turnDetection = freezed, + Object? tools = freezed, + Object? toolChoice = freezed, + Object? temperature = freezed, + Object? maxResponseOutputTokens = freezed, + }) { + return _then(_value.copyWith( + id: freezed == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + object: null == object + ? _value.object + : object // ignore: cast_nullable_to_non_nullable + as ObjectType, + model: freezed == model + ? _value.model + : model // ignore: cast_nullable_to_non_nullable + as String?, + expiresAt: freezed == expiresAt + ? _value.expiresAt + : expiresAt // ignore: cast_nullable_to_non_nullable + as int?, + modalities: freezed == modalities + ? _value.modalities + : modalities // ignore: cast_nullable_to_non_nullable + as List?, + instructions: freezed == instructions + ? _value.instructions + : instructions // ignore: cast_nullable_to_non_nullable + as String?, + voice: freezed == voice + ? _value.voice + : voice // ignore: cast_nullable_to_non_nullable + as Voice?, + inputAudioFormat: freezed == inputAudioFormat + ? _value.inputAudioFormat + : inputAudioFormat // ignore: cast_nullable_to_non_nullable + as AudioFormat?, + outputAudioFormat: freezed == outputAudioFormat + ? _value.outputAudioFormat + : outputAudioFormat // ignore: cast_nullable_to_non_nullable + as AudioFormat?, + inputAudioTranscription: freezed == inputAudioTranscription + ? _value.inputAudioTranscription + : inputAudioTranscription // ignore: cast_nullable_to_non_nullable + as InputAudioTranscriptionConfig?, + turnDetection: freezed == turnDetection + ? _value.turnDetection + : turnDetection // ignore: cast_nullable_to_non_nullable + as TurnDetection?, + tools: freezed == tools + ? _value.tools + : tools // ignore: cast_nullable_to_non_nullable + as List?, + toolChoice: freezed == toolChoice + ? _value.toolChoice + : toolChoice // ignore: cast_nullable_to_non_nullable + as SessionToolChoice?, + temperature: freezed == temperature + ? _value.temperature + : temperature // ignore: cast_nullable_to_non_nullable + as double?, + maxResponseOutputTokens: freezed == maxResponseOutputTokens + ? _value.maxResponseOutputTokens + : maxResponseOutputTokens // ignore: cast_nullable_to_non_nullable + as SessionMaxResponseOutputTokens?, + ) as $Val); + } + + /// Create a copy of Session + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $InputAudioTranscriptionConfigCopyWith<$Res>? get inputAudioTranscription { + if (_value.inputAudioTranscription == null) { + return null; + } + + return $InputAudioTranscriptionConfigCopyWith<$Res>( + _value.inputAudioTranscription!, (value) { + return _then(_value.copyWith(inputAudioTranscription: value) as $Val); + }); + } + + /// Create a copy of Session + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $TurnDetectionCopyWith<$Res>? get turnDetection { + if (_value.turnDetection == null) { + return null; + } + + return $TurnDetectionCopyWith<$Res>(_value.turnDetection!, (value) { + return _then(_value.copyWith(turnDetection: value) as $Val); + }); + } + + /// Create a copy of Session + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $SessionToolChoiceCopyWith<$Res>? get toolChoice { + if (_value.toolChoice == null) { + return null; + } + + return $SessionToolChoiceCopyWith<$Res>(_value.toolChoice!, (value) { + return _then(_value.copyWith(toolChoice: value) as $Val); + }); + } + + /// Create a copy of Session + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $SessionMaxResponseOutputTokensCopyWith<$Res>? get maxResponseOutputTokens { + if (_value.maxResponseOutputTokens == null) { + return null; + } + + return $SessionMaxResponseOutputTokensCopyWith<$Res>( + _value.maxResponseOutputTokens!, (value) { + return _then(_value.copyWith(maxResponseOutputTokens: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$SessionImplCopyWith<$Res> implements $SessionCopyWith<$Res> { + factory _$$SessionImplCopyWith( + _$SessionImpl value, $Res Function(_$SessionImpl) then) = + __$$SessionImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(includeIfNull: false) String? id, + ObjectType object, + @JsonKey(includeIfNull: false) String? model, + @JsonKey(name: 'expires_at', includeIfNull: false) int? expiresAt, + @JsonKey(includeIfNull: false) List? modalities, + @JsonKey(includeIfNull: false) String? instructions, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + Voice? voice, + @JsonKey( + name: 'input_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + AudioFormat? inputAudioFormat, + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + AudioFormat? outputAudioFormat, + @JsonKey(name: 'input_audio_transcription', includeIfNull: false) + InputAudioTranscriptionConfig? inputAudioTranscription, + @JsonKey(name: 'turn_detection', includeIfNull: false) + TurnDetection? turnDetection, + @JsonKey(includeIfNull: false) List? tools, + @_SessionToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + SessionToolChoice? toolChoice, + @JsonKey(includeIfNull: false) double? temperature, + @_SessionMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + SessionMaxResponseOutputTokens? maxResponseOutputTokens}); + + @override + $InputAudioTranscriptionConfigCopyWith<$Res>? get inputAudioTranscription; + @override + $TurnDetectionCopyWith<$Res>? get turnDetection; + @override + $SessionToolChoiceCopyWith<$Res>? get toolChoice; + @override + $SessionMaxResponseOutputTokensCopyWith<$Res>? get maxResponseOutputTokens; +} + +/// @nodoc +class __$$SessionImplCopyWithImpl<$Res> + extends _$SessionCopyWithImpl<$Res, _$SessionImpl> + implements _$$SessionImplCopyWith<$Res> { + __$$SessionImplCopyWithImpl( + _$SessionImpl _value, $Res Function(_$SessionImpl) _then) + : super(_value, _then); + + /// Create a copy of Session + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = freezed, + Object? object = null, + Object? model = freezed, + Object? expiresAt = freezed, + Object? modalities = freezed, + Object? instructions = freezed, + Object? voice = freezed, + Object? inputAudioFormat = freezed, + Object? outputAudioFormat = freezed, + Object? inputAudioTranscription = freezed, + Object? turnDetection = freezed, + Object? tools = freezed, + Object? toolChoice = freezed, + Object? temperature = freezed, + Object? maxResponseOutputTokens = freezed, + }) { + return _then(_$SessionImpl( + id: freezed == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String?, + object: null == object + ? _value.object + : object // ignore: cast_nullable_to_non_nullable + as ObjectType, + model: freezed == model + ? _value.model + : model // ignore: cast_nullable_to_non_nullable + as String?, + expiresAt: freezed == expiresAt + ? _value.expiresAt + : expiresAt // ignore: cast_nullable_to_non_nullable + as int?, + modalities: freezed == modalities + ? _value._modalities + : modalities // ignore: cast_nullable_to_non_nullable + as List?, + instructions: freezed == instructions + ? _value.instructions + : instructions // ignore: cast_nullable_to_non_nullable + as String?, + voice: freezed == voice + ? _value.voice + : voice // ignore: cast_nullable_to_non_nullable + as Voice?, + inputAudioFormat: freezed == inputAudioFormat + ? _value.inputAudioFormat + : inputAudioFormat // ignore: cast_nullable_to_non_nullable + as AudioFormat?, + outputAudioFormat: freezed == outputAudioFormat + ? _value.outputAudioFormat + : outputAudioFormat // ignore: cast_nullable_to_non_nullable + as AudioFormat?, + inputAudioTranscription: freezed == inputAudioTranscription + ? _value.inputAudioTranscription + : inputAudioTranscription // ignore: cast_nullable_to_non_nullable + as InputAudioTranscriptionConfig?, + turnDetection: freezed == turnDetection + ? _value.turnDetection + : turnDetection // ignore: cast_nullable_to_non_nullable + as TurnDetection?, + tools: freezed == tools + ? _value._tools + : tools // ignore: cast_nullable_to_non_nullable + as List?, + toolChoice: freezed == toolChoice + ? _value.toolChoice + : toolChoice // ignore: cast_nullable_to_non_nullable + as SessionToolChoice?, + temperature: freezed == temperature + ? _value.temperature + : temperature // ignore: cast_nullable_to_non_nullable + as double?, + maxResponseOutputTokens: freezed == maxResponseOutputTokens + ? _value.maxResponseOutputTokens + : maxResponseOutputTokens // ignore: cast_nullable_to_non_nullable + as SessionMaxResponseOutputTokens?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$SessionImpl extends _Session { + const _$SessionImpl( + {@JsonKey(includeIfNull: false) this.id, + this.object = ObjectType.realtimeSession, + @JsonKey(includeIfNull: false) this.model, + @JsonKey(name: 'expires_at', includeIfNull: false) this.expiresAt, + @JsonKey(includeIfNull: false) final List? modalities, + @JsonKey(includeIfNull: false) this.instructions, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + this.voice, + @JsonKey( + name: 'input_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + this.inputAudioFormat, + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + this.outputAudioFormat, + @JsonKey(name: 'input_audio_transcription', includeIfNull: false) + this.inputAudioTranscription, + @JsonKey(name: 'turn_detection', includeIfNull: false) this.turnDetection, + @JsonKey(includeIfNull: false) final List? tools, + @_SessionToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + this.toolChoice, + @JsonKey(includeIfNull: false) this.temperature, + @_SessionMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + this.maxResponseOutputTokens}) + : _modalities = modalities, + _tools = tools, + super._(); + + factory _$SessionImpl.fromJson(Map json) => + _$$SessionImplFromJson(json); + + /// The unique ID of the session. + @override + @JsonKey(includeIfNull: false) + final String? id; + + /// The object type, must be "realtime.session". + @override + @JsonKey() + final ObjectType object; + + /// The default model used for this session. + @override + @JsonKey(includeIfNull: false) + final String? model; + + /// The time at which the session expires. + @override + @JsonKey(name: 'expires_at', includeIfNull: false) + final int? expiresAt; + + /// The set of modalities the model can respond with. + final List? _modalities; + + /// The set of modalities the model can respond with. + @override + @JsonKey(includeIfNull: false) + List? get modalities { + final value = _modalities; + if (value == null) return null; + if (_modalities is EqualUnmodifiableListView) return _modalities; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + /// The default system instructions. + @override + @JsonKey(includeIfNull: false) + final String? instructions; + + /// The voice the model uses to respond - one of `alloy`, `echo`, or `shimmer`. + @override + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final Voice? voice; + + /// The format of input audio. + @override + @JsonKey( + name: 'input_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final AudioFormat? inputAudioFormat; + + /// The format of output audio. + @override + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final AudioFormat? outputAudioFormat; + + /// Configuration for input audio transcription. + @override + @JsonKey(name: 'input_audio_transcription', includeIfNull: false) + final InputAudioTranscriptionConfig? inputAudioTranscription; + + /// Configuration for turn detection. + @override + @JsonKey(name: 'turn_detection', includeIfNull: false) + final TurnDetection? turnDetection; + + /// Tools (functions) available to the model. + final List? _tools; + + /// Tools (functions) available to the model. + @override + @JsonKey(includeIfNull: false) + List? get tools { + final value = _tools; + if (value == null) return null; + if (_tools is EqualUnmodifiableListView) return _tools; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + /// How the model chooses tools. + @override + @_SessionToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + final SessionToolChoice? toolChoice; + + /// Sampling temperature. + @override + @JsonKey(includeIfNull: false) + final double? temperature; + + /// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf". + @override + @_SessionMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + final SessionMaxResponseOutputTokens? maxResponseOutputTokens; + + @override + String toString() { + return 'Session(id: $id, object: $object, model: $model, expiresAt: $expiresAt, modalities: $modalities, instructions: $instructions, voice: $voice, inputAudioFormat: $inputAudioFormat, outputAudioFormat: $outputAudioFormat, inputAudioTranscription: $inputAudioTranscription, turnDetection: $turnDetection, tools: $tools, toolChoice: $toolChoice, temperature: $temperature, maxResponseOutputTokens: $maxResponseOutputTokens)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SessionImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.object, object) || other.object == object) && + (identical(other.model, model) || other.model == model) && + (identical(other.expiresAt, expiresAt) || + other.expiresAt == expiresAt) && + const DeepCollectionEquality() + .equals(other._modalities, _modalities) && + (identical(other.instructions, instructions) || + other.instructions == instructions) && + (identical(other.voice, voice) || other.voice == voice) && + (identical(other.inputAudioFormat, inputAudioFormat) || + other.inputAudioFormat == inputAudioFormat) && + (identical(other.outputAudioFormat, outputAudioFormat) || + other.outputAudioFormat == outputAudioFormat) && + (identical( + other.inputAudioTranscription, inputAudioTranscription) || + other.inputAudioTranscription == inputAudioTranscription) && + (identical(other.turnDetection, turnDetection) || + other.turnDetection == turnDetection) && + const DeepCollectionEquality().equals(other._tools, _tools) && + (identical(other.toolChoice, toolChoice) || + other.toolChoice == toolChoice) && + (identical(other.temperature, temperature) || + other.temperature == temperature) && + (identical( + other.maxResponseOutputTokens, maxResponseOutputTokens) || + other.maxResponseOutputTokens == maxResponseOutputTokens)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + id, + object, + model, + expiresAt, + const DeepCollectionEquality().hash(_modalities), + instructions, + voice, + inputAudioFormat, + outputAudioFormat, + inputAudioTranscription, + turnDetection, + const DeepCollectionEquality().hash(_tools), + toolChoice, + temperature, + maxResponseOutputTokens); + + /// Create a copy of Session + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$SessionImplCopyWith<_$SessionImpl> get copyWith => + __$$SessionImplCopyWithImpl<_$SessionImpl>(this, _$identity); + + @override + Map toJson() { + return _$$SessionImplToJson( + this, + ); + } +} + +abstract class _Session extends Session { + const factory _Session( + {@JsonKey(includeIfNull: false) final String? id, + final ObjectType object, + @JsonKey(includeIfNull: false) final String? model, + @JsonKey(name: 'expires_at', includeIfNull: false) final int? expiresAt, + @JsonKey(includeIfNull: false) final List? modalities, + @JsonKey(includeIfNull: false) final String? instructions, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final Voice? voice, + @JsonKey( + name: 'input_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final AudioFormat? inputAudioFormat, + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final AudioFormat? outputAudioFormat, + @JsonKey(name: 'input_audio_transcription', includeIfNull: false) + final InputAudioTranscriptionConfig? inputAudioTranscription, + @JsonKey(name: 'turn_detection', includeIfNull: false) + final TurnDetection? turnDetection, + @JsonKey(includeIfNull: false) final List? tools, + @_SessionToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + final SessionToolChoice? toolChoice, + @JsonKey(includeIfNull: false) final double? temperature, + @_SessionMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + final SessionMaxResponseOutputTokens? + maxResponseOutputTokens}) = _$SessionImpl; + const _Session._() : super._(); + + factory _Session.fromJson(Map json) = _$SessionImpl.fromJson; + + /// The unique ID of the session. + @override + @JsonKey(includeIfNull: false) + String? get id; + + /// The object type, must be "realtime.session". + @override + ObjectType get object; + + /// The default model used for this session. + @override + @JsonKey(includeIfNull: false) + String? get model; + + /// The time at which the session expires. + @override + @JsonKey(name: 'expires_at', includeIfNull: false) + int? get expiresAt; + + /// The set of modalities the model can respond with. + @override + @JsonKey(includeIfNull: false) + List? get modalities; + + /// The default system instructions. + @override + @JsonKey(includeIfNull: false) + String? get instructions; + + /// The voice the model uses to respond - one of `alloy`, `echo`, or `shimmer`. + @override + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + Voice? get voice; + + /// The format of input audio. + @override + @JsonKey( + name: 'input_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + AudioFormat? get inputAudioFormat; + + /// The format of output audio. + @override + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + AudioFormat? get outputAudioFormat; + + /// Configuration for input audio transcription. + @override + @JsonKey(name: 'input_audio_transcription', includeIfNull: false) + InputAudioTranscriptionConfig? get inputAudioTranscription; + + /// Configuration for turn detection. + @override + @JsonKey(name: 'turn_detection', includeIfNull: false) + TurnDetection? get turnDetection; + + /// Tools (functions) available to the model. + @override + @JsonKey(includeIfNull: false) + List? get tools; + + /// How the model chooses tools. + @override + @_SessionToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + SessionToolChoice? get toolChoice; + + /// Sampling temperature. + @override + @JsonKey(includeIfNull: false) + double? get temperature; + + /// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf". + @override + @_SessionMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + SessionMaxResponseOutputTokens? get maxResponseOutputTokens; + + /// Create a copy of Session + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$SessionImplCopyWith<_$SessionImpl> get copyWith => + throw _privateConstructorUsedError; +} + +SessionToolChoice _$SessionToolChoiceFromJson(Map json) { + switch (json['runtimeType']) { + case 'mode': + return SessionToolChoiceEnumeration.fromJson(json); + case 'toolChoiceForced': + return SessionToolChoiceToolChoiceForced.fromJson(json); + + default: + throw CheckedFromJsonException(json, 'runtimeType', 'SessionToolChoice', + 'Invalid union type "${json['runtimeType']}"!'); + } +} + +/// @nodoc +mixin _$SessionToolChoice { + Object get value => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult when({ + required TResult Function(SessionToolChoiceMode value) mode, + required TResult Function(ToolChoiceForced value) toolChoiceForced, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(SessionToolChoiceMode value)? mode, + TResult? Function(ToolChoiceForced value)? toolChoiceForced, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(SessionToolChoiceMode value)? mode, + TResult Function(ToolChoiceForced value)? toolChoiceForced, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(SessionToolChoiceEnumeration value) mode, + required TResult Function(SessionToolChoiceToolChoiceForced value) + toolChoiceForced, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(SessionToolChoiceEnumeration value)? mode, + TResult? Function(SessionToolChoiceToolChoiceForced value)? + toolChoiceForced, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(SessionToolChoiceEnumeration value)? mode, + TResult Function(SessionToolChoiceToolChoiceForced value)? toolChoiceForced, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + + /// Serializes this SessionToolChoice to a JSON map. + Map toJson() => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SessionToolChoiceCopyWith<$Res> { + factory $SessionToolChoiceCopyWith( + SessionToolChoice value, $Res Function(SessionToolChoice) then) = + _$SessionToolChoiceCopyWithImpl<$Res, SessionToolChoice>; +} + +/// @nodoc +class _$SessionToolChoiceCopyWithImpl<$Res, $Val extends SessionToolChoice> + implements $SessionToolChoiceCopyWith<$Res> { + _$SessionToolChoiceCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of SessionToolChoice + /// with the given fields replaced by the non-null parameter values. +} + +/// @nodoc +abstract class _$$SessionToolChoiceEnumerationImplCopyWith<$Res> { + factory _$$SessionToolChoiceEnumerationImplCopyWith( + _$SessionToolChoiceEnumerationImpl value, + $Res Function(_$SessionToolChoiceEnumerationImpl) then) = + __$$SessionToolChoiceEnumerationImplCopyWithImpl<$Res>; + @useResult + $Res call({SessionToolChoiceMode value}); +} + +/// @nodoc +class __$$SessionToolChoiceEnumerationImplCopyWithImpl<$Res> + extends _$SessionToolChoiceCopyWithImpl<$Res, + _$SessionToolChoiceEnumerationImpl> + implements _$$SessionToolChoiceEnumerationImplCopyWith<$Res> { + __$$SessionToolChoiceEnumerationImplCopyWithImpl( + _$SessionToolChoiceEnumerationImpl _value, + $Res Function(_$SessionToolChoiceEnumerationImpl) _then) + : super(_value, _then); + + /// Create a copy of SessionToolChoice + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_$SessionToolChoiceEnumerationImpl( + null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as SessionToolChoiceMode, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$SessionToolChoiceEnumerationImpl extends SessionToolChoiceEnumeration { + const _$SessionToolChoiceEnumerationImpl(this.value, {final String? $type}) + : $type = $type ?? 'mode', + super._(); + + factory _$SessionToolChoiceEnumerationImpl.fromJson( + Map json) => + _$$SessionToolChoiceEnumerationImplFromJson(json); + + @override + final SessionToolChoiceMode value; + + @JsonKey(name: 'runtimeType') + final String $type; + + @override + String toString() { + return 'SessionToolChoice.mode(value: $value)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SessionToolChoiceEnumerationImpl && + (identical(other.value, value) || other.value == value)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, value); + + /// Create a copy of SessionToolChoice + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$SessionToolChoiceEnumerationImplCopyWith< + _$SessionToolChoiceEnumerationImpl> + get copyWith => __$$SessionToolChoiceEnumerationImplCopyWithImpl< + _$SessionToolChoiceEnumerationImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(SessionToolChoiceMode value) mode, + required TResult Function(ToolChoiceForced value) toolChoiceForced, + }) { + return mode(value); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(SessionToolChoiceMode value)? mode, + TResult? Function(ToolChoiceForced value)? toolChoiceForced, + }) { + return mode?.call(value); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(SessionToolChoiceMode value)? mode, + TResult Function(ToolChoiceForced value)? toolChoiceForced, + required TResult orElse(), + }) { + if (mode != null) { + return mode(value); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(SessionToolChoiceEnumeration value) mode, + required TResult Function(SessionToolChoiceToolChoiceForced value) + toolChoiceForced, + }) { + return mode(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(SessionToolChoiceEnumeration value)? mode, + TResult? Function(SessionToolChoiceToolChoiceForced value)? + toolChoiceForced, + }) { + return mode?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(SessionToolChoiceEnumeration value)? mode, + TResult Function(SessionToolChoiceToolChoiceForced value)? toolChoiceForced, + required TResult orElse(), + }) { + if (mode != null) { + return mode(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$SessionToolChoiceEnumerationImplToJson( + this, + ); + } +} + +abstract class SessionToolChoiceEnumeration extends SessionToolChoice { + const factory SessionToolChoiceEnumeration( + final SessionToolChoiceMode value) = _$SessionToolChoiceEnumerationImpl; + const SessionToolChoiceEnumeration._() : super._(); + + factory SessionToolChoiceEnumeration.fromJson(Map json) = + _$SessionToolChoiceEnumerationImpl.fromJson; + + @override + SessionToolChoiceMode get value; + + /// Create a copy of SessionToolChoice + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + _$$SessionToolChoiceEnumerationImplCopyWith< + _$SessionToolChoiceEnumerationImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$SessionToolChoiceToolChoiceForcedImplCopyWith<$Res> { + factory _$$SessionToolChoiceToolChoiceForcedImplCopyWith( + _$SessionToolChoiceToolChoiceForcedImpl value, + $Res Function(_$SessionToolChoiceToolChoiceForcedImpl) then) = + __$$SessionToolChoiceToolChoiceForcedImplCopyWithImpl<$Res>; + @useResult + $Res call({ToolChoiceForced value}); + + $ToolChoiceForcedCopyWith<$Res> get value; +} + +/// @nodoc +class __$$SessionToolChoiceToolChoiceForcedImplCopyWithImpl<$Res> + extends _$SessionToolChoiceCopyWithImpl<$Res, + _$SessionToolChoiceToolChoiceForcedImpl> + implements _$$SessionToolChoiceToolChoiceForcedImplCopyWith<$Res> { + __$$SessionToolChoiceToolChoiceForcedImplCopyWithImpl( + _$SessionToolChoiceToolChoiceForcedImpl _value, + $Res Function(_$SessionToolChoiceToolChoiceForcedImpl) _then) + : super(_value, _then); + + /// Create a copy of SessionToolChoice + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_$SessionToolChoiceToolChoiceForcedImpl( + null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as ToolChoiceForced, + )); + } + + /// Create a copy of SessionToolChoice + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ToolChoiceForcedCopyWith<$Res> get value { + return $ToolChoiceForcedCopyWith<$Res>(_value.value, (value) { + return _then(_value.copyWith(value: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$SessionToolChoiceToolChoiceForcedImpl + extends SessionToolChoiceToolChoiceForced { + const _$SessionToolChoiceToolChoiceForcedImpl(this.value, + {final String? $type}) + : $type = $type ?? 'toolChoiceForced', + super._(); + + factory _$SessionToolChoiceToolChoiceForcedImpl.fromJson( + Map json) => + _$$SessionToolChoiceToolChoiceForcedImplFromJson(json); + + @override + final ToolChoiceForced value; + + @JsonKey(name: 'runtimeType') + final String $type; + + @override + String toString() { + return 'SessionToolChoice.toolChoiceForced(value: $value)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SessionToolChoiceToolChoiceForcedImpl && + (identical(other.value, value) || other.value == value)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, value); + + /// Create a copy of SessionToolChoice + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$SessionToolChoiceToolChoiceForcedImplCopyWith< + _$SessionToolChoiceToolChoiceForcedImpl> + get copyWith => __$$SessionToolChoiceToolChoiceForcedImplCopyWithImpl< + _$SessionToolChoiceToolChoiceForcedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(SessionToolChoiceMode value) mode, + required TResult Function(ToolChoiceForced value) toolChoiceForced, + }) { + return toolChoiceForced(value); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(SessionToolChoiceMode value)? mode, + TResult? Function(ToolChoiceForced value)? toolChoiceForced, + }) { + return toolChoiceForced?.call(value); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(SessionToolChoiceMode value)? mode, + TResult Function(ToolChoiceForced value)? toolChoiceForced, + required TResult orElse(), + }) { + if (toolChoiceForced != null) { + return toolChoiceForced(value); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(SessionToolChoiceEnumeration value) mode, + required TResult Function(SessionToolChoiceToolChoiceForced value) + toolChoiceForced, + }) { + return toolChoiceForced(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(SessionToolChoiceEnumeration value)? mode, + TResult? Function(SessionToolChoiceToolChoiceForced value)? + toolChoiceForced, + }) { + return toolChoiceForced?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(SessionToolChoiceEnumeration value)? mode, + TResult Function(SessionToolChoiceToolChoiceForced value)? toolChoiceForced, + required TResult orElse(), + }) { + if (toolChoiceForced != null) { + return toolChoiceForced(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$SessionToolChoiceToolChoiceForcedImplToJson( + this, + ); + } +} + +abstract class SessionToolChoiceToolChoiceForced extends SessionToolChoice { + const factory SessionToolChoiceToolChoiceForced( + final ToolChoiceForced value) = _$SessionToolChoiceToolChoiceForcedImpl; + const SessionToolChoiceToolChoiceForced._() : super._(); + + factory SessionToolChoiceToolChoiceForced.fromJson( + Map json) = + _$SessionToolChoiceToolChoiceForcedImpl.fromJson; + + @override + ToolChoiceForced get value; + + /// Create a copy of SessionToolChoice + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + _$$SessionToolChoiceToolChoiceForcedImplCopyWith< + _$SessionToolChoiceToolChoiceForcedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +SessionMaxResponseOutputTokens _$SessionMaxResponseOutputTokensFromJson( + Map json) { + switch (json['runtimeType']) { + case 'int': + return SessionMaxResponseOutputTokensInt.fromJson(json); + case 'string': + return SessionMaxResponseOutputTokensString.fromJson(json); + + default: + throw CheckedFromJsonException( + json, + 'runtimeType', + 'SessionMaxResponseOutputTokens', + 'Invalid union type "${json['runtimeType']}"!'); + } +} + +/// @nodoc +mixin _$SessionMaxResponseOutputTokens { + Object get value => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult when({ + required TResult Function(int value) int, + required TResult Function(String value) string, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(int value)? int, + TResult? Function(String value)? string, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(int value)? int, + TResult Function(String value)? string, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(SessionMaxResponseOutputTokensInt value) int, + required TResult Function(SessionMaxResponseOutputTokensString value) + string, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(SessionMaxResponseOutputTokensInt value)? int, + TResult? Function(SessionMaxResponseOutputTokensString value)? string, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(SessionMaxResponseOutputTokensInt value)? int, + TResult Function(SessionMaxResponseOutputTokensString value)? string, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + + /// Serializes this SessionMaxResponseOutputTokens to a JSON map. + Map toJson() => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SessionMaxResponseOutputTokensCopyWith<$Res> { + factory $SessionMaxResponseOutputTokensCopyWith( + SessionMaxResponseOutputTokens value, + $Res Function(SessionMaxResponseOutputTokens) then) = + _$SessionMaxResponseOutputTokensCopyWithImpl<$Res, + SessionMaxResponseOutputTokens>; +} + +/// @nodoc +class _$SessionMaxResponseOutputTokensCopyWithImpl<$Res, + $Val extends SessionMaxResponseOutputTokens> + implements $SessionMaxResponseOutputTokensCopyWith<$Res> { + _$SessionMaxResponseOutputTokensCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of SessionMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. +} + +/// @nodoc +abstract class _$$SessionMaxResponseOutputTokensIntImplCopyWith<$Res> { + factory _$$SessionMaxResponseOutputTokensIntImplCopyWith( + _$SessionMaxResponseOutputTokensIntImpl value, + $Res Function(_$SessionMaxResponseOutputTokensIntImpl) then) = + __$$SessionMaxResponseOutputTokensIntImplCopyWithImpl<$Res>; + @useResult + $Res call({int value}); +} + +/// @nodoc +class __$$SessionMaxResponseOutputTokensIntImplCopyWithImpl<$Res> + extends _$SessionMaxResponseOutputTokensCopyWithImpl<$Res, + _$SessionMaxResponseOutputTokensIntImpl> + implements _$$SessionMaxResponseOutputTokensIntImplCopyWith<$Res> { + __$$SessionMaxResponseOutputTokensIntImplCopyWithImpl( + _$SessionMaxResponseOutputTokensIntImpl _value, + $Res Function(_$SessionMaxResponseOutputTokensIntImpl) _then) + : super(_value, _then); + + /// Create a copy of SessionMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_$SessionMaxResponseOutputTokensIntImpl( + null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$SessionMaxResponseOutputTokensIntImpl + extends SessionMaxResponseOutputTokensInt { + const _$SessionMaxResponseOutputTokensIntImpl(this.value, + {final String? $type}) + : $type = $type ?? 'int', + super._(); + + factory _$SessionMaxResponseOutputTokensIntImpl.fromJson( + Map json) => + _$$SessionMaxResponseOutputTokensIntImplFromJson(json); + + @override + final int value; + + @JsonKey(name: 'runtimeType') + final String $type; + + @override + String toString() { + return 'SessionMaxResponseOutputTokens.int(value: $value)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SessionMaxResponseOutputTokensIntImpl && + (identical(other.value, value) || other.value == value)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, value); + + /// Create a copy of SessionMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$SessionMaxResponseOutputTokensIntImplCopyWith< + _$SessionMaxResponseOutputTokensIntImpl> + get copyWith => __$$SessionMaxResponseOutputTokensIntImplCopyWithImpl< + _$SessionMaxResponseOutputTokensIntImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(int value) int, + required TResult Function(String value) string, + }) { + return int(value); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(int value)? int, + TResult? Function(String value)? string, + }) { + return int?.call(value); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(int value)? int, + TResult Function(String value)? string, + required TResult orElse(), + }) { + if (int != null) { + return int(value); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(SessionMaxResponseOutputTokensInt value) int, + required TResult Function(SessionMaxResponseOutputTokensString value) + string, + }) { + return int(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(SessionMaxResponseOutputTokensInt value)? int, + TResult? Function(SessionMaxResponseOutputTokensString value)? string, + }) { + return int?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(SessionMaxResponseOutputTokensInt value)? int, + TResult Function(SessionMaxResponseOutputTokensString value)? string, + required TResult orElse(), + }) { + if (int != null) { + return int(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$SessionMaxResponseOutputTokensIntImplToJson( + this, + ); + } +} + +abstract class SessionMaxResponseOutputTokensInt + extends SessionMaxResponseOutputTokens { + const factory SessionMaxResponseOutputTokensInt(final int value) = + _$SessionMaxResponseOutputTokensIntImpl; + const SessionMaxResponseOutputTokensInt._() : super._(); + + factory SessionMaxResponseOutputTokensInt.fromJson( + Map json) = + _$SessionMaxResponseOutputTokensIntImpl.fromJson; + + @override + int get value; + + /// Create a copy of SessionMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + _$$SessionMaxResponseOutputTokensIntImplCopyWith< + _$SessionMaxResponseOutputTokensIntImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$SessionMaxResponseOutputTokensStringImplCopyWith<$Res> { + factory _$$SessionMaxResponseOutputTokensStringImplCopyWith( + _$SessionMaxResponseOutputTokensStringImpl value, + $Res Function(_$SessionMaxResponseOutputTokensStringImpl) then) = + __$$SessionMaxResponseOutputTokensStringImplCopyWithImpl<$Res>; + @useResult + $Res call({String value}); +} + +/// @nodoc +class __$$SessionMaxResponseOutputTokensStringImplCopyWithImpl<$Res> + extends _$SessionMaxResponseOutputTokensCopyWithImpl<$Res, + _$SessionMaxResponseOutputTokensStringImpl> + implements _$$SessionMaxResponseOutputTokensStringImplCopyWith<$Res> { + __$$SessionMaxResponseOutputTokensStringImplCopyWithImpl( + _$SessionMaxResponseOutputTokensStringImpl _value, + $Res Function(_$SessionMaxResponseOutputTokensStringImpl) _then) + : super(_value, _then); + + /// Create a copy of SessionMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_$SessionMaxResponseOutputTokensStringImpl( + null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$SessionMaxResponseOutputTokensStringImpl + extends SessionMaxResponseOutputTokensString { + const _$SessionMaxResponseOutputTokensStringImpl(this.value, + {final String? $type}) + : $type = $type ?? 'string', + super._(); + + factory _$SessionMaxResponseOutputTokensStringImpl.fromJson( + Map json) => + _$$SessionMaxResponseOutputTokensStringImplFromJson(json); + + @override + final String value; + + @JsonKey(name: 'runtimeType') + final String $type; + + @override + String toString() { + return 'SessionMaxResponseOutputTokens.string(value: $value)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SessionMaxResponseOutputTokensStringImpl && + (identical(other.value, value) || other.value == value)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, value); + + /// Create a copy of SessionMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$SessionMaxResponseOutputTokensStringImplCopyWith< + _$SessionMaxResponseOutputTokensStringImpl> + get copyWith => __$$SessionMaxResponseOutputTokensStringImplCopyWithImpl< + _$SessionMaxResponseOutputTokensStringImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(int value) int, + required TResult Function(String value) string, + }) { + return string(value); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(int value)? int, + TResult? Function(String value)? string, + }) { + return string?.call(value); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(int value)? int, + TResult Function(String value)? string, + required TResult orElse(), + }) { + if (string != null) { + return string(value); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(SessionMaxResponseOutputTokensInt value) int, + required TResult Function(SessionMaxResponseOutputTokensString value) + string, + }) { + return string(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(SessionMaxResponseOutputTokensInt value)? int, + TResult? Function(SessionMaxResponseOutputTokensString value)? string, + }) { + return string?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(SessionMaxResponseOutputTokensInt value)? int, + TResult Function(SessionMaxResponseOutputTokensString value)? string, + required TResult orElse(), + }) { + if (string != null) { + return string(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$SessionMaxResponseOutputTokensStringImplToJson( + this, + ); + } +} + +abstract class SessionMaxResponseOutputTokensString + extends SessionMaxResponseOutputTokens { + const factory SessionMaxResponseOutputTokensString(final String value) = + _$SessionMaxResponseOutputTokensStringImpl; + const SessionMaxResponseOutputTokensString._() : super._(); + + factory SessionMaxResponseOutputTokensString.fromJson( + Map json) = + _$SessionMaxResponseOutputTokensStringImpl.fromJson; + + @override + String get value; + + /// Create a copy of SessionMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + _$$SessionMaxResponseOutputTokensStringImplCopyWith< + _$SessionMaxResponseOutputTokensStringImpl> + get copyWith => throw _privateConstructorUsedError; +} + +SessionConfig _$SessionConfigFromJson(Map json) { + return _SessionConfig.fromJson(json); +} + +/// @nodoc +mixin _$SessionConfig { + /// The set of modalities the model can respond with. To disable audio, set this to ["text"]. + @JsonKey(includeIfNull: false) + List? get modalities => throw _privateConstructorUsedError; + + /// The default system instructions prepended to model calls. + @JsonKey(includeIfNull: false) + String? get instructions => throw _privateConstructorUsedError; + + /// The voice the model uses to respond - one of `alloy`, `echo`, + /// or `shimmer`. Cannot be changed once the model has responded + /// with audio at least once. + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + Voice? get voice => throw _privateConstructorUsedError; + + /// The format of input audio. Options are "pcm16", "g711_ulaw", or "g711_alaw". + @JsonKey( + name: 'input_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + AudioFormat? get inputAudioFormat => throw _privateConstructorUsedError; + + /// The format of output audio. Options are "pcm16", "g711_ulaw", or "g711_alaw". + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + AudioFormat? get outputAudioFormat => throw _privateConstructorUsedError; + + /// Configuration for input audio transcription. Can be set to null to turn off. + @JsonKey(name: 'input_audio_transcription', includeIfNull: false) + InputAudioTranscriptionConfig? get inputAudioTranscription => + throw _privateConstructorUsedError; + + /// Configuration for turn detection. + @JsonKey(name: 'turn_detection', includeIfNull: false) + TurnDetection? get turnDetection => throw _privateConstructorUsedError; + + /// Tools (functions) available to the model. + @JsonKey(includeIfNull: false) + List? get tools => throw _privateConstructorUsedError; + + /// How the model chooses tools. + @_SessionConfigToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + SessionConfigToolChoice? get toolChoice => throw _privateConstructorUsedError; + + /// Sampling temperature for the model. + @JsonKey(includeIfNull: false) + double? get temperature => throw _privateConstructorUsedError; + + /// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf". + @_SessionConfigMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + SessionConfigMaxResponseOutputTokens? get maxResponseOutputTokens => + throw _privateConstructorUsedError; + + /// Serializes this SessionConfig to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of SessionConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $SessionConfigCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SessionConfigCopyWith<$Res> { + factory $SessionConfigCopyWith( + SessionConfig value, $Res Function(SessionConfig) then) = + _$SessionConfigCopyWithImpl<$Res, SessionConfig>; + @useResult + $Res call( + {@JsonKey(includeIfNull: false) List? modalities, + @JsonKey(includeIfNull: false) String? instructions, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + Voice? voice, + @JsonKey( + name: 'input_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + AudioFormat? inputAudioFormat, + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + AudioFormat? outputAudioFormat, + @JsonKey(name: 'input_audio_transcription', includeIfNull: false) + InputAudioTranscriptionConfig? inputAudioTranscription, + @JsonKey(name: 'turn_detection', includeIfNull: false) + TurnDetection? turnDetection, + @JsonKey(includeIfNull: false) List? tools, + @_SessionConfigToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + SessionConfigToolChoice? toolChoice, + @JsonKey(includeIfNull: false) double? temperature, + @_SessionConfigMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + SessionConfigMaxResponseOutputTokens? maxResponseOutputTokens}); + + $InputAudioTranscriptionConfigCopyWith<$Res>? get inputAudioTranscription; + $TurnDetectionCopyWith<$Res>? get turnDetection; + $SessionConfigToolChoiceCopyWith<$Res>? get toolChoice; + $SessionConfigMaxResponseOutputTokensCopyWith<$Res>? + get maxResponseOutputTokens; +} + +/// @nodoc +class _$SessionConfigCopyWithImpl<$Res, $Val extends SessionConfig> + implements $SessionConfigCopyWith<$Res> { + _$SessionConfigCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of SessionConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? modalities = freezed, + Object? instructions = freezed, + Object? voice = freezed, + Object? inputAudioFormat = freezed, + Object? outputAudioFormat = freezed, + Object? inputAudioTranscription = freezed, + Object? turnDetection = freezed, + Object? tools = freezed, + Object? toolChoice = freezed, + Object? temperature = freezed, + Object? maxResponseOutputTokens = freezed, + }) { + return _then(_value.copyWith( + modalities: freezed == modalities + ? _value.modalities + : modalities // ignore: cast_nullable_to_non_nullable + as List?, + instructions: freezed == instructions + ? _value.instructions + : instructions // ignore: cast_nullable_to_non_nullable + as String?, + voice: freezed == voice + ? _value.voice + : voice // ignore: cast_nullable_to_non_nullable + as Voice?, + inputAudioFormat: freezed == inputAudioFormat + ? _value.inputAudioFormat + : inputAudioFormat // ignore: cast_nullable_to_non_nullable + as AudioFormat?, + outputAudioFormat: freezed == outputAudioFormat + ? _value.outputAudioFormat + : outputAudioFormat // ignore: cast_nullable_to_non_nullable + as AudioFormat?, + inputAudioTranscription: freezed == inputAudioTranscription + ? _value.inputAudioTranscription + : inputAudioTranscription // ignore: cast_nullable_to_non_nullable + as InputAudioTranscriptionConfig?, + turnDetection: freezed == turnDetection + ? _value.turnDetection + : turnDetection // ignore: cast_nullable_to_non_nullable + as TurnDetection?, + tools: freezed == tools + ? _value.tools + : tools // ignore: cast_nullable_to_non_nullable + as List?, + toolChoice: freezed == toolChoice + ? _value.toolChoice + : toolChoice // ignore: cast_nullable_to_non_nullable + as SessionConfigToolChoice?, + temperature: freezed == temperature + ? _value.temperature + : temperature // ignore: cast_nullable_to_non_nullable + as double?, + maxResponseOutputTokens: freezed == maxResponseOutputTokens + ? _value.maxResponseOutputTokens + : maxResponseOutputTokens // ignore: cast_nullable_to_non_nullable + as SessionConfigMaxResponseOutputTokens?, + ) as $Val); + } + + /// Create a copy of SessionConfig + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $InputAudioTranscriptionConfigCopyWith<$Res>? get inputAudioTranscription { + if (_value.inputAudioTranscription == null) { + return null; + } + + return $InputAudioTranscriptionConfigCopyWith<$Res>( + _value.inputAudioTranscription!, (value) { + return _then(_value.copyWith(inputAudioTranscription: value) as $Val); + }); + } + + /// Create a copy of SessionConfig + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $TurnDetectionCopyWith<$Res>? get turnDetection { + if (_value.turnDetection == null) { + return null; + } + + return $TurnDetectionCopyWith<$Res>(_value.turnDetection!, (value) { + return _then(_value.copyWith(turnDetection: value) as $Val); + }); + } + + /// Create a copy of SessionConfig + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $SessionConfigToolChoiceCopyWith<$Res>? get toolChoice { + if (_value.toolChoice == null) { + return null; + } + + return $SessionConfigToolChoiceCopyWith<$Res>(_value.toolChoice!, (value) { + return _then(_value.copyWith(toolChoice: value) as $Val); + }); + } + + /// Create a copy of SessionConfig + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $SessionConfigMaxResponseOutputTokensCopyWith<$Res>? + get maxResponseOutputTokens { + if (_value.maxResponseOutputTokens == null) { + return null; + } + + return $SessionConfigMaxResponseOutputTokensCopyWith<$Res>( + _value.maxResponseOutputTokens!, (value) { + return _then(_value.copyWith(maxResponseOutputTokens: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$SessionConfigImplCopyWith<$Res> + implements $SessionConfigCopyWith<$Res> { + factory _$$SessionConfigImplCopyWith( + _$SessionConfigImpl value, $Res Function(_$SessionConfigImpl) then) = + __$$SessionConfigImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(includeIfNull: false) List? modalities, + @JsonKey(includeIfNull: false) String? instructions, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + Voice? voice, + @JsonKey( + name: 'input_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + AudioFormat? inputAudioFormat, + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + AudioFormat? outputAudioFormat, + @JsonKey(name: 'input_audio_transcription', includeIfNull: false) + InputAudioTranscriptionConfig? inputAudioTranscription, + @JsonKey(name: 'turn_detection', includeIfNull: false) + TurnDetection? turnDetection, + @JsonKey(includeIfNull: false) List? tools, + @_SessionConfigToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + SessionConfigToolChoice? toolChoice, + @JsonKey(includeIfNull: false) double? temperature, + @_SessionConfigMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + SessionConfigMaxResponseOutputTokens? maxResponseOutputTokens}); + + @override + $InputAudioTranscriptionConfigCopyWith<$Res>? get inputAudioTranscription; + @override + $TurnDetectionCopyWith<$Res>? get turnDetection; + @override + $SessionConfigToolChoiceCopyWith<$Res>? get toolChoice; + @override + $SessionConfigMaxResponseOutputTokensCopyWith<$Res>? + get maxResponseOutputTokens; +} + +/// @nodoc +class __$$SessionConfigImplCopyWithImpl<$Res> + extends _$SessionConfigCopyWithImpl<$Res, _$SessionConfigImpl> + implements _$$SessionConfigImplCopyWith<$Res> { + __$$SessionConfigImplCopyWithImpl( + _$SessionConfigImpl _value, $Res Function(_$SessionConfigImpl) _then) + : super(_value, _then); + + /// Create a copy of SessionConfig + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? modalities = freezed, + Object? instructions = freezed, + Object? voice = freezed, + Object? inputAudioFormat = freezed, + Object? outputAudioFormat = freezed, + Object? inputAudioTranscription = freezed, + Object? turnDetection = freezed, + Object? tools = freezed, + Object? toolChoice = freezed, + Object? temperature = freezed, + Object? maxResponseOutputTokens = freezed, + }) { + return _then(_$SessionConfigImpl( + modalities: freezed == modalities + ? _value._modalities + : modalities // ignore: cast_nullable_to_non_nullable + as List?, + instructions: freezed == instructions + ? _value.instructions + : instructions // ignore: cast_nullable_to_non_nullable + as String?, + voice: freezed == voice + ? _value.voice + : voice // ignore: cast_nullable_to_non_nullable + as Voice?, + inputAudioFormat: freezed == inputAudioFormat + ? _value.inputAudioFormat + : inputAudioFormat // ignore: cast_nullable_to_non_nullable + as AudioFormat?, + outputAudioFormat: freezed == outputAudioFormat + ? _value.outputAudioFormat + : outputAudioFormat // ignore: cast_nullable_to_non_nullable + as AudioFormat?, + inputAudioTranscription: freezed == inputAudioTranscription + ? _value.inputAudioTranscription + : inputAudioTranscription // ignore: cast_nullable_to_non_nullable + as InputAudioTranscriptionConfig?, + turnDetection: freezed == turnDetection + ? _value.turnDetection + : turnDetection // ignore: cast_nullable_to_non_nullable + as TurnDetection?, + tools: freezed == tools + ? _value._tools + : tools // ignore: cast_nullable_to_non_nullable + as List?, + toolChoice: freezed == toolChoice + ? _value.toolChoice + : toolChoice // ignore: cast_nullable_to_non_nullable + as SessionConfigToolChoice?, + temperature: freezed == temperature + ? _value.temperature + : temperature // ignore: cast_nullable_to_non_nullable + as double?, + maxResponseOutputTokens: freezed == maxResponseOutputTokens + ? _value.maxResponseOutputTokens + : maxResponseOutputTokens // ignore: cast_nullable_to_non_nullable + as SessionConfigMaxResponseOutputTokens?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$SessionConfigImpl extends _SessionConfig { + const _$SessionConfigImpl( + {@JsonKey(includeIfNull: false) final List? modalities, + @JsonKey(includeIfNull: false) this.instructions, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + this.voice, + @JsonKey( + name: 'input_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + this.inputAudioFormat, + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + this.outputAudioFormat, + @JsonKey(name: 'input_audio_transcription', includeIfNull: false) + this.inputAudioTranscription, + @JsonKey(name: 'turn_detection', includeIfNull: false) this.turnDetection, + @JsonKey(includeIfNull: false) final List? tools, + @_SessionConfigToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + this.toolChoice, + @JsonKey(includeIfNull: false) this.temperature, + @_SessionConfigMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + this.maxResponseOutputTokens}) + : _modalities = modalities, + _tools = tools, + super._(); + + factory _$SessionConfigImpl.fromJson(Map json) => + _$$SessionConfigImplFromJson(json); + + /// The set of modalities the model can respond with. To disable audio, set this to ["text"]. + final List? _modalities; + + /// The set of modalities the model can respond with. To disable audio, set this to ["text"]. + @override + @JsonKey(includeIfNull: false) + List? get modalities { + final value = _modalities; + if (value == null) return null; + if (_modalities is EqualUnmodifiableListView) return _modalities; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + /// The default system instructions prepended to model calls. + @override + @JsonKey(includeIfNull: false) + final String? instructions; + + /// The voice the model uses to respond - one of `alloy`, `echo`, + /// or `shimmer`. Cannot be changed once the model has responded + /// with audio at least once. + @override + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final Voice? voice; + + /// The format of input audio. Options are "pcm16", "g711_ulaw", or "g711_alaw". + @override + @JsonKey( + name: 'input_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final AudioFormat? inputAudioFormat; + + /// The format of output audio. Options are "pcm16", "g711_ulaw", or "g711_alaw". + @override + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final AudioFormat? outputAudioFormat; + + /// Configuration for input audio transcription. Can be set to null to turn off. + @override + @JsonKey(name: 'input_audio_transcription', includeIfNull: false) + final InputAudioTranscriptionConfig? inputAudioTranscription; + + /// Configuration for turn detection. + @override + @JsonKey(name: 'turn_detection', includeIfNull: false) + final TurnDetection? turnDetection; + + /// Tools (functions) available to the model. + final List? _tools; + + /// Tools (functions) available to the model. + @override + @JsonKey(includeIfNull: false) + List? get tools { + final value = _tools; + if (value == null) return null; + if (_tools is EqualUnmodifiableListView) return _tools; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + /// How the model chooses tools. + @override + @_SessionConfigToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + final SessionConfigToolChoice? toolChoice; + + /// Sampling temperature for the model. + @override + @JsonKey(includeIfNull: false) + final double? temperature; + + /// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf". + @override + @_SessionConfigMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + final SessionConfigMaxResponseOutputTokens? maxResponseOutputTokens; + + @override + String toString() { + return 'SessionConfig(modalities: $modalities, instructions: $instructions, voice: $voice, inputAudioFormat: $inputAudioFormat, outputAudioFormat: $outputAudioFormat, inputAudioTranscription: $inputAudioTranscription, turnDetection: $turnDetection, tools: $tools, toolChoice: $toolChoice, temperature: $temperature, maxResponseOutputTokens: $maxResponseOutputTokens)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SessionConfigImpl && + const DeepCollectionEquality() + .equals(other._modalities, _modalities) && + (identical(other.instructions, instructions) || + other.instructions == instructions) && + (identical(other.voice, voice) || other.voice == voice) && + (identical(other.inputAudioFormat, inputAudioFormat) || + other.inputAudioFormat == inputAudioFormat) && + (identical(other.outputAudioFormat, outputAudioFormat) || + other.outputAudioFormat == outputAudioFormat) && + (identical( + other.inputAudioTranscription, inputAudioTranscription) || + other.inputAudioTranscription == inputAudioTranscription) && + (identical(other.turnDetection, turnDetection) || + other.turnDetection == turnDetection) && + const DeepCollectionEquality().equals(other._tools, _tools) && + (identical(other.toolChoice, toolChoice) || + other.toolChoice == toolChoice) && + (identical(other.temperature, temperature) || + other.temperature == temperature) && + (identical( + other.maxResponseOutputTokens, maxResponseOutputTokens) || + other.maxResponseOutputTokens == maxResponseOutputTokens)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(_modalities), + instructions, + voice, + inputAudioFormat, + outputAudioFormat, + inputAudioTranscription, + turnDetection, + const DeepCollectionEquality().hash(_tools), + toolChoice, + temperature, + maxResponseOutputTokens); + + /// Create a copy of SessionConfig + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$SessionConfigImplCopyWith<_$SessionConfigImpl> get copyWith => + __$$SessionConfigImplCopyWithImpl<_$SessionConfigImpl>(this, _$identity); + + @override + Map toJson() { + return _$$SessionConfigImplToJson( + this, + ); + } +} + +abstract class _SessionConfig extends SessionConfig { + const factory _SessionConfig( + {@JsonKey(includeIfNull: false) final List? modalities, + @JsonKey(includeIfNull: false) final String? instructions, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final Voice? voice, + @JsonKey( + name: 'input_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final AudioFormat? inputAudioFormat, + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final AudioFormat? outputAudioFormat, + @JsonKey(name: 'input_audio_transcription', includeIfNull: false) + final InputAudioTranscriptionConfig? inputAudioTranscription, + @JsonKey(name: 'turn_detection', includeIfNull: false) + final TurnDetection? turnDetection, + @JsonKey(includeIfNull: false) final List? tools, + @_SessionConfigToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + final SessionConfigToolChoice? toolChoice, + @JsonKey(includeIfNull: false) final double? temperature, + @_SessionConfigMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + final SessionConfigMaxResponseOutputTokens? + maxResponseOutputTokens}) = _$SessionConfigImpl; + const _SessionConfig._() : super._(); + + factory _SessionConfig.fromJson(Map json) = + _$SessionConfigImpl.fromJson; + + /// The set of modalities the model can respond with. To disable audio, set this to ["text"]. + @override + @JsonKey(includeIfNull: false) + List? get modalities; + + /// The default system instructions prepended to model calls. + @override + @JsonKey(includeIfNull: false) + String? get instructions; + + /// The voice the model uses to respond - one of `alloy`, `echo`, + /// or `shimmer`. Cannot be changed once the model has responded + /// with audio at least once. + @override + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + Voice? get voice; + + /// The format of input audio. Options are "pcm16", "g711_ulaw", or "g711_alaw". + @override + @JsonKey( + name: 'input_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + AudioFormat? get inputAudioFormat; + + /// The format of output audio. Options are "pcm16", "g711_ulaw", or "g711_alaw". + @override + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + AudioFormat? get outputAudioFormat; + + /// Configuration for input audio transcription. Can be set to null to turn off. + @override + @JsonKey(name: 'input_audio_transcription', includeIfNull: false) + InputAudioTranscriptionConfig? get inputAudioTranscription; + + /// Configuration for turn detection. + @override + @JsonKey(name: 'turn_detection', includeIfNull: false) + TurnDetection? get turnDetection; + + /// Tools (functions) available to the model. + @override + @JsonKey(includeIfNull: false) + List? get tools; + + /// How the model chooses tools. + @override + @_SessionConfigToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + SessionConfigToolChoice? get toolChoice; + + /// Sampling temperature for the model. + @override + @JsonKey(includeIfNull: false) + double? get temperature; + + /// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf". + @override + @_SessionConfigMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + SessionConfigMaxResponseOutputTokens? get maxResponseOutputTokens; + + /// Create a copy of SessionConfig + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$SessionConfigImplCopyWith<_$SessionConfigImpl> get copyWith => + throw _privateConstructorUsedError; +} + +SessionConfigToolChoice _$SessionConfigToolChoiceFromJson( + Map json) { + switch (json['runtimeType']) { + case 'mode': + return SessionConfigToolChoiceEnumeration.fromJson(json); + case 'toolChoiceForced': + return SessionConfigToolChoiceToolChoiceForced.fromJson(json); + + default: + throw CheckedFromJsonException( + json, + 'runtimeType', + 'SessionConfigToolChoice', + 'Invalid union type "${json['runtimeType']}"!'); + } +} + +/// @nodoc +mixin _$SessionConfigToolChoice { + Object get value => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult when({ + required TResult Function(SessionConfigToolChoiceMode value) mode, + required TResult Function(ToolChoiceForced value) toolChoiceForced, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(SessionConfigToolChoiceMode value)? mode, + TResult? Function(ToolChoiceForced value)? toolChoiceForced, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(SessionConfigToolChoiceMode value)? mode, + TResult Function(ToolChoiceForced value)? toolChoiceForced, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(SessionConfigToolChoiceEnumeration value) mode, + required TResult Function(SessionConfigToolChoiceToolChoiceForced value) + toolChoiceForced, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(SessionConfigToolChoiceEnumeration value)? mode, + TResult? Function(SessionConfigToolChoiceToolChoiceForced value)? + toolChoiceForced, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(SessionConfigToolChoiceEnumeration value)? mode, + TResult Function(SessionConfigToolChoiceToolChoiceForced value)? + toolChoiceForced, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + + /// Serializes this SessionConfigToolChoice to a JSON map. + Map toJson() => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SessionConfigToolChoiceCopyWith<$Res> { + factory $SessionConfigToolChoiceCopyWith(SessionConfigToolChoice value, + $Res Function(SessionConfigToolChoice) then) = + _$SessionConfigToolChoiceCopyWithImpl<$Res, SessionConfigToolChoice>; +} + +/// @nodoc +class _$SessionConfigToolChoiceCopyWithImpl<$Res, + $Val extends SessionConfigToolChoice> + implements $SessionConfigToolChoiceCopyWith<$Res> { + _$SessionConfigToolChoiceCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of SessionConfigToolChoice + /// with the given fields replaced by the non-null parameter values. +} + +/// @nodoc +abstract class _$$SessionConfigToolChoiceEnumerationImplCopyWith<$Res> { + factory _$$SessionConfigToolChoiceEnumerationImplCopyWith( + _$SessionConfigToolChoiceEnumerationImpl value, + $Res Function(_$SessionConfigToolChoiceEnumerationImpl) then) = + __$$SessionConfigToolChoiceEnumerationImplCopyWithImpl<$Res>; + @useResult + $Res call({SessionConfigToolChoiceMode value}); +} + +/// @nodoc +class __$$SessionConfigToolChoiceEnumerationImplCopyWithImpl<$Res> + extends _$SessionConfigToolChoiceCopyWithImpl<$Res, + _$SessionConfigToolChoiceEnumerationImpl> + implements _$$SessionConfigToolChoiceEnumerationImplCopyWith<$Res> { + __$$SessionConfigToolChoiceEnumerationImplCopyWithImpl( + _$SessionConfigToolChoiceEnumerationImpl _value, + $Res Function(_$SessionConfigToolChoiceEnumerationImpl) _then) + : super(_value, _then); + + /// Create a copy of SessionConfigToolChoice + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_$SessionConfigToolChoiceEnumerationImpl( + null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as SessionConfigToolChoiceMode, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$SessionConfigToolChoiceEnumerationImpl + extends SessionConfigToolChoiceEnumeration { + const _$SessionConfigToolChoiceEnumerationImpl(this.value, + {final String? $type}) + : $type = $type ?? 'mode', + super._(); + + factory _$SessionConfigToolChoiceEnumerationImpl.fromJson( + Map json) => + _$$SessionConfigToolChoiceEnumerationImplFromJson(json); + + @override + final SessionConfigToolChoiceMode value; + + @JsonKey(name: 'runtimeType') + final String $type; + + @override + String toString() { + return 'SessionConfigToolChoice.mode(value: $value)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SessionConfigToolChoiceEnumerationImpl && + (identical(other.value, value) || other.value == value)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, value); + + /// Create a copy of SessionConfigToolChoice + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$SessionConfigToolChoiceEnumerationImplCopyWith< + _$SessionConfigToolChoiceEnumerationImpl> + get copyWith => __$$SessionConfigToolChoiceEnumerationImplCopyWithImpl< + _$SessionConfigToolChoiceEnumerationImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(SessionConfigToolChoiceMode value) mode, + required TResult Function(ToolChoiceForced value) toolChoiceForced, + }) { + return mode(value); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(SessionConfigToolChoiceMode value)? mode, + TResult? Function(ToolChoiceForced value)? toolChoiceForced, + }) { + return mode?.call(value); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(SessionConfigToolChoiceMode value)? mode, + TResult Function(ToolChoiceForced value)? toolChoiceForced, + required TResult orElse(), + }) { + if (mode != null) { + return mode(value); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(SessionConfigToolChoiceEnumeration value) mode, + required TResult Function(SessionConfigToolChoiceToolChoiceForced value) + toolChoiceForced, + }) { + return mode(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(SessionConfigToolChoiceEnumeration value)? mode, + TResult? Function(SessionConfigToolChoiceToolChoiceForced value)? + toolChoiceForced, + }) { + return mode?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(SessionConfigToolChoiceEnumeration value)? mode, + TResult Function(SessionConfigToolChoiceToolChoiceForced value)? + toolChoiceForced, + required TResult orElse(), + }) { + if (mode != null) { + return mode(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$SessionConfigToolChoiceEnumerationImplToJson( + this, + ); + } +} + +abstract class SessionConfigToolChoiceEnumeration + extends SessionConfigToolChoice { + const factory SessionConfigToolChoiceEnumeration( + final SessionConfigToolChoiceMode value) = + _$SessionConfigToolChoiceEnumerationImpl; + const SessionConfigToolChoiceEnumeration._() : super._(); + + factory SessionConfigToolChoiceEnumeration.fromJson( + Map json) = + _$SessionConfigToolChoiceEnumerationImpl.fromJson; + + @override + SessionConfigToolChoiceMode get value; + + /// Create a copy of SessionConfigToolChoice + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + _$$SessionConfigToolChoiceEnumerationImplCopyWith< + _$SessionConfigToolChoiceEnumerationImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$SessionConfigToolChoiceToolChoiceForcedImplCopyWith<$Res> { + factory _$$SessionConfigToolChoiceToolChoiceForcedImplCopyWith( + _$SessionConfigToolChoiceToolChoiceForcedImpl value, + $Res Function(_$SessionConfigToolChoiceToolChoiceForcedImpl) then) = + __$$SessionConfigToolChoiceToolChoiceForcedImplCopyWithImpl<$Res>; + @useResult + $Res call({ToolChoiceForced value}); + + $ToolChoiceForcedCopyWith<$Res> get value; +} + +/// @nodoc +class __$$SessionConfigToolChoiceToolChoiceForcedImplCopyWithImpl<$Res> + extends _$SessionConfigToolChoiceCopyWithImpl<$Res, + _$SessionConfigToolChoiceToolChoiceForcedImpl> + implements _$$SessionConfigToolChoiceToolChoiceForcedImplCopyWith<$Res> { + __$$SessionConfigToolChoiceToolChoiceForcedImplCopyWithImpl( + _$SessionConfigToolChoiceToolChoiceForcedImpl _value, + $Res Function(_$SessionConfigToolChoiceToolChoiceForcedImpl) _then) + : super(_value, _then); + + /// Create a copy of SessionConfigToolChoice + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_$SessionConfigToolChoiceToolChoiceForcedImpl( + null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as ToolChoiceForced, + )); + } + + /// Create a copy of SessionConfigToolChoice + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ToolChoiceForcedCopyWith<$Res> get value { + return $ToolChoiceForcedCopyWith<$Res>(_value.value, (value) { + return _then(_value.copyWith(value: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$SessionConfigToolChoiceToolChoiceForcedImpl + extends SessionConfigToolChoiceToolChoiceForced { + const _$SessionConfigToolChoiceToolChoiceForcedImpl(this.value, + {final String? $type}) + : $type = $type ?? 'toolChoiceForced', + super._(); + + factory _$SessionConfigToolChoiceToolChoiceForcedImpl.fromJson( + Map json) => + _$$SessionConfigToolChoiceToolChoiceForcedImplFromJson(json); + + @override + final ToolChoiceForced value; + + @JsonKey(name: 'runtimeType') + final String $type; + + @override + String toString() { + return 'SessionConfigToolChoice.toolChoiceForced(value: $value)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SessionConfigToolChoiceToolChoiceForcedImpl && + (identical(other.value, value) || other.value == value)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, value); + + /// Create a copy of SessionConfigToolChoice + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$SessionConfigToolChoiceToolChoiceForcedImplCopyWith< + _$SessionConfigToolChoiceToolChoiceForcedImpl> + get copyWith => + __$$SessionConfigToolChoiceToolChoiceForcedImplCopyWithImpl< + _$SessionConfigToolChoiceToolChoiceForcedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(SessionConfigToolChoiceMode value) mode, + required TResult Function(ToolChoiceForced value) toolChoiceForced, + }) { + return toolChoiceForced(value); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(SessionConfigToolChoiceMode value)? mode, + TResult? Function(ToolChoiceForced value)? toolChoiceForced, + }) { + return toolChoiceForced?.call(value); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(SessionConfigToolChoiceMode value)? mode, + TResult Function(ToolChoiceForced value)? toolChoiceForced, + required TResult orElse(), + }) { + if (toolChoiceForced != null) { + return toolChoiceForced(value); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(SessionConfigToolChoiceEnumeration value) mode, + required TResult Function(SessionConfigToolChoiceToolChoiceForced value) + toolChoiceForced, + }) { + return toolChoiceForced(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(SessionConfigToolChoiceEnumeration value)? mode, + TResult? Function(SessionConfigToolChoiceToolChoiceForced value)? + toolChoiceForced, + }) { + return toolChoiceForced?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(SessionConfigToolChoiceEnumeration value)? mode, + TResult Function(SessionConfigToolChoiceToolChoiceForced value)? + toolChoiceForced, + required TResult orElse(), + }) { + if (toolChoiceForced != null) { + return toolChoiceForced(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$SessionConfigToolChoiceToolChoiceForcedImplToJson( + this, + ); + } +} + +abstract class SessionConfigToolChoiceToolChoiceForced + extends SessionConfigToolChoice { + const factory SessionConfigToolChoiceToolChoiceForced( + final ToolChoiceForced value) = + _$SessionConfigToolChoiceToolChoiceForcedImpl; + const SessionConfigToolChoiceToolChoiceForced._() : super._(); + + factory SessionConfigToolChoiceToolChoiceForced.fromJson( + Map json) = + _$SessionConfigToolChoiceToolChoiceForcedImpl.fromJson; + + @override + ToolChoiceForced get value; + + /// Create a copy of SessionConfigToolChoice + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + _$$SessionConfigToolChoiceToolChoiceForcedImplCopyWith< + _$SessionConfigToolChoiceToolChoiceForcedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +SessionConfigMaxResponseOutputTokens + _$SessionConfigMaxResponseOutputTokensFromJson(Map json) { + switch (json['runtimeType']) { + case 'int': + return SessionConfigMaxResponseOutputTokensInt.fromJson(json); + case 'string': + return SessionConfigMaxResponseOutputTokensString.fromJson(json); + + default: + throw CheckedFromJsonException( + json, + 'runtimeType', + 'SessionConfigMaxResponseOutputTokens', + 'Invalid union type "${json['runtimeType']}"!'); + } +} + +/// @nodoc +mixin _$SessionConfigMaxResponseOutputTokens { + Object get value => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult when({ + required TResult Function(int value) int, + required TResult Function(String value) string, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(int value)? int, + TResult? Function(String value)? string, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(int value)? int, + TResult Function(String value)? string, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(SessionConfigMaxResponseOutputTokensInt value) + int, + required TResult Function(SessionConfigMaxResponseOutputTokensString value) + string, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(SessionConfigMaxResponseOutputTokensInt value)? int, + TResult? Function(SessionConfigMaxResponseOutputTokensString value)? string, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(SessionConfigMaxResponseOutputTokensInt value)? int, + TResult Function(SessionConfigMaxResponseOutputTokensString value)? string, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + + /// Serializes this SessionConfigMaxResponseOutputTokens to a JSON map. + Map toJson() => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SessionConfigMaxResponseOutputTokensCopyWith<$Res> { + factory $SessionConfigMaxResponseOutputTokensCopyWith( + SessionConfigMaxResponseOutputTokens value, + $Res Function(SessionConfigMaxResponseOutputTokens) then) = + _$SessionConfigMaxResponseOutputTokensCopyWithImpl<$Res, + SessionConfigMaxResponseOutputTokens>; +} + +/// @nodoc +class _$SessionConfigMaxResponseOutputTokensCopyWithImpl<$Res, + $Val extends SessionConfigMaxResponseOutputTokens> + implements $SessionConfigMaxResponseOutputTokensCopyWith<$Res> { + _$SessionConfigMaxResponseOutputTokensCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of SessionConfigMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. +} + +/// @nodoc +abstract class _$$SessionConfigMaxResponseOutputTokensIntImplCopyWith<$Res> { + factory _$$SessionConfigMaxResponseOutputTokensIntImplCopyWith( + _$SessionConfigMaxResponseOutputTokensIntImpl value, + $Res Function(_$SessionConfigMaxResponseOutputTokensIntImpl) then) = + __$$SessionConfigMaxResponseOutputTokensIntImplCopyWithImpl<$Res>; + @useResult + $Res call({int value}); +} + +/// @nodoc +class __$$SessionConfigMaxResponseOutputTokensIntImplCopyWithImpl<$Res> + extends _$SessionConfigMaxResponseOutputTokensCopyWithImpl<$Res, + _$SessionConfigMaxResponseOutputTokensIntImpl> + implements _$$SessionConfigMaxResponseOutputTokensIntImplCopyWith<$Res> { + __$$SessionConfigMaxResponseOutputTokensIntImplCopyWithImpl( + _$SessionConfigMaxResponseOutputTokensIntImpl _value, + $Res Function(_$SessionConfigMaxResponseOutputTokensIntImpl) _then) + : super(_value, _then); + + /// Create a copy of SessionConfigMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_$SessionConfigMaxResponseOutputTokensIntImpl( + null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$SessionConfigMaxResponseOutputTokensIntImpl + extends SessionConfigMaxResponseOutputTokensInt { + const _$SessionConfigMaxResponseOutputTokensIntImpl(this.value, + {final String? $type}) + : $type = $type ?? 'int', + super._(); + + factory _$SessionConfigMaxResponseOutputTokensIntImpl.fromJson( + Map json) => + _$$SessionConfigMaxResponseOutputTokensIntImplFromJson(json); + + @override + final int value; + + @JsonKey(name: 'runtimeType') + final String $type; + + @override + String toString() { + return 'SessionConfigMaxResponseOutputTokens.int(value: $value)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SessionConfigMaxResponseOutputTokensIntImpl && + (identical(other.value, value) || other.value == value)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, value); + + /// Create a copy of SessionConfigMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$SessionConfigMaxResponseOutputTokensIntImplCopyWith< + _$SessionConfigMaxResponseOutputTokensIntImpl> + get copyWith => + __$$SessionConfigMaxResponseOutputTokensIntImplCopyWithImpl< + _$SessionConfigMaxResponseOutputTokensIntImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(int value) int, + required TResult Function(String value) string, + }) { + return int(value); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(int value)? int, + TResult? Function(String value)? string, + }) { + return int?.call(value); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(int value)? int, + TResult Function(String value)? string, + required TResult orElse(), + }) { + if (int != null) { + return int(value); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(SessionConfigMaxResponseOutputTokensInt value) + int, + required TResult Function(SessionConfigMaxResponseOutputTokensString value) + string, + }) { + return int(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(SessionConfigMaxResponseOutputTokensInt value)? int, + TResult? Function(SessionConfigMaxResponseOutputTokensString value)? string, + }) { + return int?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(SessionConfigMaxResponseOutputTokensInt value)? int, + TResult Function(SessionConfigMaxResponseOutputTokensString value)? string, + required TResult orElse(), + }) { + if (int != null) { + return int(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$SessionConfigMaxResponseOutputTokensIntImplToJson( + this, + ); + } +} + +abstract class SessionConfigMaxResponseOutputTokensInt + extends SessionConfigMaxResponseOutputTokens { + const factory SessionConfigMaxResponseOutputTokensInt(final int value) = + _$SessionConfigMaxResponseOutputTokensIntImpl; + const SessionConfigMaxResponseOutputTokensInt._() : super._(); + + factory SessionConfigMaxResponseOutputTokensInt.fromJson( + Map json) = + _$SessionConfigMaxResponseOutputTokensIntImpl.fromJson; + + @override + int get value; + + /// Create a copy of SessionConfigMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + _$$SessionConfigMaxResponseOutputTokensIntImplCopyWith< + _$SessionConfigMaxResponseOutputTokensIntImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$SessionConfigMaxResponseOutputTokensStringImplCopyWith<$Res> { + factory _$$SessionConfigMaxResponseOutputTokensStringImplCopyWith( + _$SessionConfigMaxResponseOutputTokensStringImpl value, + $Res Function(_$SessionConfigMaxResponseOutputTokensStringImpl) + then) = + __$$SessionConfigMaxResponseOutputTokensStringImplCopyWithImpl<$Res>; + @useResult + $Res call({String value}); +} + +/// @nodoc +class __$$SessionConfigMaxResponseOutputTokensStringImplCopyWithImpl<$Res> + extends _$SessionConfigMaxResponseOutputTokensCopyWithImpl<$Res, + _$SessionConfigMaxResponseOutputTokensStringImpl> + implements _$$SessionConfigMaxResponseOutputTokensStringImplCopyWith<$Res> { + __$$SessionConfigMaxResponseOutputTokensStringImplCopyWithImpl( + _$SessionConfigMaxResponseOutputTokensStringImpl _value, + $Res Function(_$SessionConfigMaxResponseOutputTokensStringImpl) _then) + : super(_value, _then); + + /// Create a copy of SessionConfigMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_$SessionConfigMaxResponseOutputTokensStringImpl( + null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$SessionConfigMaxResponseOutputTokensStringImpl + extends SessionConfigMaxResponseOutputTokensString { + const _$SessionConfigMaxResponseOutputTokensStringImpl(this.value, + {final String? $type}) + : $type = $type ?? 'string', + super._(); + + factory _$SessionConfigMaxResponseOutputTokensStringImpl.fromJson( + Map json) => + _$$SessionConfigMaxResponseOutputTokensStringImplFromJson(json); + + @override + final String value; + + @JsonKey(name: 'runtimeType') + final String $type; + + @override + String toString() { + return 'SessionConfigMaxResponseOutputTokens.string(value: $value)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SessionConfigMaxResponseOutputTokensStringImpl && + (identical(other.value, value) || other.value == value)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, value); + + /// Create a copy of SessionConfigMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$SessionConfigMaxResponseOutputTokensStringImplCopyWith< + _$SessionConfigMaxResponseOutputTokensStringImpl> + get copyWith => + __$$SessionConfigMaxResponseOutputTokensStringImplCopyWithImpl< + _$SessionConfigMaxResponseOutputTokensStringImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(int value) int, + required TResult Function(String value) string, + }) { + return string(value); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(int value)? int, + TResult? Function(String value)? string, + }) { + return string?.call(value); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(int value)? int, + TResult Function(String value)? string, + required TResult orElse(), + }) { + if (string != null) { + return string(value); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(SessionConfigMaxResponseOutputTokensInt value) + int, + required TResult Function(SessionConfigMaxResponseOutputTokensString value) + string, + }) { + return string(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(SessionConfigMaxResponseOutputTokensInt value)? int, + TResult? Function(SessionConfigMaxResponseOutputTokensString value)? string, + }) { + return string?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(SessionConfigMaxResponseOutputTokensInt value)? int, + TResult Function(SessionConfigMaxResponseOutputTokensString value)? string, + required TResult orElse(), + }) { + if (string != null) { + return string(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$SessionConfigMaxResponseOutputTokensStringImplToJson( + this, + ); + } +} + +abstract class SessionConfigMaxResponseOutputTokensString + extends SessionConfigMaxResponseOutputTokens { + const factory SessionConfigMaxResponseOutputTokensString(final String value) = + _$SessionConfigMaxResponseOutputTokensStringImpl; + const SessionConfigMaxResponseOutputTokensString._() : super._(); + + factory SessionConfigMaxResponseOutputTokensString.fromJson( + Map json) = + _$SessionConfigMaxResponseOutputTokensStringImpl.fromJson; + + @override + String get value; + + /// Create a copy of SessionConfigMaxResponseOutputTokens + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + _$$SessionConfigMaxResponseOutputTokensStringImplCopyWith< + _$SessionConfigMaxResponseOutputTokensStringImpl> + get copyWith => throw _privateConstructorUsedError; +} + +Conversation _$ConversationFromJson(Map json) { + return _Conversation.fromJson(json); +} + +/// @nodoc +mixin _$Conversation { + /// The unique ID of the conversation. + String get id => throw _privateConstructorUsedError; + + /// The object type, must be "realtime.conversation". + ObjectType get object => throw _privateConstructorUsedError; + + /// Serializes this Conversation to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of Conversation + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $ConversationCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ConversationCopyWith<$Res> { + factory $ConversationCopyWith( + Conversation value, $Res Function(Conversation) then) = + _$ConversationCopyWithImpl<$Res, Conversation>; + @useResult + $Res call({String id, ObjectType object}); +} + +/// @nodoc +class _$ConversationCopyWithImpl<$Res, $Val extends Conversation> + implements $ConversationCopyWith<$Res> { + _$ConversationCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of Conversation + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? object = null, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + object: null == object + ? _value.object + : object // ignore: cast_nullable_to_non_nullable + as ObjectType, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$ConversationImplCopyWith<$Res> + implements $ConversationCopyWith<$Res> { + factory _$$ConversationImplCopyWith( + _$ConversationImpl value, $Res Function(_$ConversationImpl) then) = + __$$ConversationImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String id, ObjectType object}); +} + +/// @nodoc +class __$$ConversationImplCopyWithImpl<$Res> + extends _$ConversationCopyWithImpl<$Res, _$ConversationImpl> + implements _$$ConversationImplCopyWith<$Res> { + __$$ConversationImplCopyWithImpl( + _$ConversationImpl _value, $Res Function(_$ConversationImpl) _then) + : super(_value, _then); + + /// Create a copy of Conversation + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? object = null, + }) { + return _then(_$ConversationImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + object: null == object + ? _value.object + : object // ignore: cast_nullable_to_non_nullable + as ObjectType, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ConversationImpl extends _Conversation { + const _$ConversationImpl( + {required this.id, this.object = ObjectType.realtimeConversation}) + : super._(); + + factory _$ConversationImpl.fromJson(Map json) => + _$$ConversationImplFromJson(json); + + /// The unique ID of the conversation. + @override + final String id; + + /// The object type, must be "realtime.conversation". + @override + @JsonKey() + final ObjectType object; + + @override + String toString() { + return 'Conversation(id: $id, object: $object)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ConversationImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.object, object) || other.object == object)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, object); + + /// Create a copy of Conversation + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ConversationImplCopyWith<_$ConversationImpl> get copyWith => + __$$ConversationImplCopyWithImpl<_$ConversationImpl>(this, _$identity); + + @override + Map toJson() { + return _$$ConversationImplToJson( + this, + ); + } +} + +abstract class _Conversation extends Conversation { + const factory _Conversation( + {required final String id, final ObjectType object}) = _$ConversationImpl; + const _Conversation._() : super._(); + + factory _Conversation.fromJson(Map json) = + _$ConversationImpl.fromJson; + + /// The unique ID of the conversation. + @override + String get id; + + /// The object type, must be "realtime.conversation". + @override + ObjectType get object; + + /// Create a copy of Conversation + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ConversationImplCopyWith<_$ConversationImpl> get copyWith => + throw _privateConstructorUsedError; +} + +Delta _$DeltaFromJson(Map json) { + return _Delta.fromJson(json); +} + +/// @nodoc +mixin _$Delta { + /// The transcript of the audio. + @JsonKey(includeIfNull: false) + String? get transcript => throw _privateConstructorUsedError; + + /// The audio bytes. + @Uint8ListConverter() + @JsonKey(includeIfNull: false) + Uint8List? get audio => throw _privateConstructorUsedError; + + /// The text. + @JsonKey(includeIfNull: false) + String? get text => throw _privateConstructorUsedError; + + /// The arguments. + @JsonKey(includeIfNull: false) + String? get arguments => throw _privateConstructorUsedError; + + /// Serializes this Delta to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of Delta + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $DeltaCopyWith get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $DeltaCopyWith<$Res> { + factory $DeltaCopyWith(Delta value, $Res Function(Delta) then) = + _$DeltaCopyWithImpl<$Res, Delta>; + @useResult + $Res call( + {@JsonKey(includeIfNull: false) String? transcript, + @Uint8ListConverter() @JsonKey(includeIfNull: false) Uint8List? audio, + @JsonKey(includeIfNull: false) String? text, + @JsonKey(includeIfNull: false) String? arguments}); +} + +/// @nodoc +class _$DeltaCopyWithImpl<$Res, $Val extends Delta> + implements $DeltaCopyWith<$Res> { + _$DeltaCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of Delta + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? transcript = freezed, + Object? audio = freezed, + Object? text = freezed, + Object? arguments = freezed, + }) { + return _then(_value.copyWith( + transcript: freezed == transcript + ? _value.transcript + : transcript // ignore: cast_nullable_to_non_nullable + as String?, + audio: freezed == audio + ? _value.audio + : audio // ignore: cast_nullable_to_non_nullable + as Uint8List?, + text: freezed == text + ? _value.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + arguments: freezed == arguments + ? _value.arguments + : arguments // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$DeltaImplCopyWith<$Res> implements $DeltaCopyWith<$Res> { + factory _$$DeltaImplCopyWith( + _$DeltaImpl value, $Res Function(_$DeltaImpl) then) = + __$$DeltaImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(includeIfNull: false) String? transcript, + @Uint8ListConverter() @JsonKey(includeIfNull: false) Uint8List? audio, + @JsonKey(includeIfNull: false) String? text, + @JsonKey(includeIfNull: false) String? arguments}); +} + +/// @nodoc +class __$$DeltaImplCopyWithImpl<$Res> + extends _$DeltaCopyWithImpl<$Res, _$DeltaImpl> + implements _$$DeltaImplCopyWith<$Res> { + __$$DeltaImplCopyWithImpl( + _$DeltaImpl _value, $Res Function(_$DeltaImpl) _then) + : super(_value, _then); + + /// Create a copy of Delta + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? transcript = freezed, + Object? audio = freezed, + Object? text = freezed, + Object? arguments = freezed, + }) { + return _then(_$DeltaImpl( + transcript: freezed == transcript + ? _value.transcript + : transcript // ignore: cast_nullable_to_non_nullable + as String?, + audio: freezed == audio + ? _value.audio + : audio // ignore: cast_nullable_to_non_nullable + as Uint8List?, + text: freezed == text + ? _value.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + arguments: freezed == arguments + ? _value.arguments + : arguments // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$DeltaImpl extends _Delta { + const _$DeltaImpl( + {@JsonKey(includeIfNull: false) this.transcript, + @Uint8ListConverter() @JsonKey(includeIfNull: false) this.audio, + @JsonKey(includeIfNull: false) this.text, + @JsonKey(includeIfNull: false) this.arguments}) + : super._(); + + factory _$DeltaImpl.fromJson(Map json) => + _$$DeltaImplFromJson(json); + + /// The transcript of the audio. + @override + @JsonKey(includeIfNull: false) + final String? transcript; + + /// The audio bytes. + @override + @Uint8ListConverter() + @JsonKey(includeIfNull: false) + final Uint8List? audio; + + /// The text. + @override + @JsonKey(includeIfNull: false) + final String? text; + + /// The arguments. + @override + @JsonKey(includeIfNull: false) + final String? arguments; + + @override + String toString() { + return 'Delta(transcript: $transcript, audio: $audio, text: $text, arguments: $arguments)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DeltaImpl && + (identical(other.transcript, transcript) || + other.transcript == transcript) && + const DeepCollectionEquality().equals(other.audio, audio) && + (identical(other.text, text) || other.text == text) && + (identical(other.arguments, arguments) || + other.arguments == arguments)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, transcript, + const DeepCollectionEquality().hash(audio), text, arguments); + + /// Create a copy of Delta + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$DeltaImplCopyWith<_$DeltaImpl> get copyWith => + __$$DeltaImplCopyWithImpl<_$DeltaImpl>(this, _$identity); + + @override + Map toJson() { + return _$$DeltaImplToJson( + this, + ); + } +} + +abstract class _Delta extends Delta { + const factory _Delta( + {@JsonKey(includeIfNull: false) final String? transcript, + @Uint8ListConverter() + @JsonKey(includeIfNull: false) + final Uint8List? audio, + @JsonKey(includeIfNull: false) final String? text, + @JsonKey(includeIfNull: false) final String? arguments}) = _$DeltaImpl; + const _Delta._() : super._(); + + factory _Delta.fromJson(Map json) = _$DeltaImpl.fromJson; + + /// The transcript of the audio. + @override + @JsonKey(includeIfNull: false) + String? get transcript; + + /// The audio bytes. + @override + @Uint8ListConverter() + @JsonKey(includeIfNull: false) + Uint8List? get audio; + + /// The text. + @override + @JsonKey(includeIfNull: false) + String? get text; + + /// The arguments. + @override + @JsonKey(includeIfNull: false) + String? get arguments; + + /// Create a copy of Delta + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$DeltaImplCopyWith<_$DeltaImpl> get copyWith => + throw _privateConstructorUsedError; +} + +FormattedTool _$FormattedToolFromJson(Map json) { + return _FormattedTool.fromJson(json); +} + +/// @nodoc +mixin _$FormattedTool { + /// The type of the tool. Currently, only `function` is supported. + ToolType get type => throw _privateConstructorUsedError; + + /// The name of the function. + String get name => throw _privateConstructorUsedError; + + /// The call id. + @JsonKey(name: 'call_id') + String get callId => throw _privateConstructorUsedError; + + /// The arguments. + String get arguments => throw _privateConstructorUsedError; + + /// Serializes this FormattedTool to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of FormattedTool + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $FormattedToolCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $FormattedToolCopyWith<$Res> { + factory $FormattedToolCopyWith( + FormattedTool value, $Res Function(FormattedTool) then) = + _$FormattedToolCopyWithImpl<$Res, FormattedTool>; + @useResult + $Res call( + {ToolType type, + String name, + @JsonKey(name: 'call_id') String callId, + String arguments}); +} + +/// @nodoc +class _$FormattedToolCopyWithImpl<$Res, $Val extends FormattedTool> + implements $FormattedToolCopyWith<$Res> { + _$FormattedToolCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of FormattedTool + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? name = null, + Object? callId = null, + Object? arguments = null, + }) { + return _then(_value.copyWith( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as ToolType, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + callId: null == callId + ? _value.callId + : callId // ignore: cast_nullable_to_non_nullable + as String, + arguments: null == arguments + ? _value.arguments + : arguments // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$FormattedToolImplCopyWith<$Res> + implements $FormattedToolCopyWith<$Res> { + factory _$$FormattedToolImplCopyWith( + _$FormattedToolImpl value, $Res Function(_$FormattedToolImpl) then) = + __$$FormattedToolImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {ToolType type, + String name, + @JsonKey(name: 'call_id') String callId, + String arguments}); +} + +/// @nodoc +class __$$FormattedToolImplCopyWithImpl<$Res> + extends _$FormattedToolCopyWithImpl<$Res, _$FormattedToolImpl> + implements _$$FormattedToolImplCopyWith<$Res> { + __$$FormattedToolImplCopyWithImpl( + _$FormattedToolImpl _value, $Res Function(_$FormattedToolImpl) _then) + : super(_value, _then); + + /// Create a copy of FormattedTool + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? name = null, + Object? callId = null, + Object? arguments = null, + }) { + return _then(_$FormattedToolImpl( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as ToolType, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + callId: null == callId + ? _value.callId + : callId // ignore: cast_nullable_to_non_nullable + as String, + arguments: null == arguments + ? _value.arguments + : arguments // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$FormattedToolImpl extends _FormattedTool { + const _$FormattedToolImpl( + {this.type = ToolType.function, + required this.name, + @JsonKey(name: 'call_id') required this.callId, + required this.arguments}) + : super._(); + + factory _$FormattedToolImpl.fromJson(Map json) => + _$$FormattedToolImplFromJson(json); + + /// The type of the tool. Currently, only `function` is supported. + @override + @JsonKey() + final ToolType type; + + /// The name of the function. + @override + final String name; + + /// The call id. + @override + @JsonKey(name: 'call_id') + final String callId; + + /// The arguments. + @override + final String arguments; + + @override + String toString() { + return 'FormattedTool(type: $type, name: $name, callId: $callId, arguments: $arguments)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$FormattedToolImpl && + (identical(other.type, type) || other.type == type) && + (identical(other.name, name) || other.name == name) && + (identical(other.callId, callId) || other.callId == callId) && + (identical(other.arguments, arguments) || + other.arguments == arguments)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, type, name, callId, arguments); + + /// Create a copy of FormattedTool + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$FormattedToolImplCopyWith<_$FormattedToolImpl> get copyWith => + __$$FormattedToolImplCopyWithImpl<_$FormattedToolImpl>(this, _$identity); + + @override + Map toJson() { + return _$$FormattedToolImplToJson( + this, + ); + } +} + +abstract class _FormattedTool extends FormattedTool { + const factory _FormattedTool( + {final ToolType type, + required final String name, + @JsonKey(name: 'call_id') required final String callId, + required final String arguments}) = _$FormattedToolImpl; + const _FormattedTool._() : super._(); + + factory _FormattedTool.fromJson(Map json) = + _$FormattedToolImpl.fromJson; + + /// The type of the tool. Currently, only `function` is supported. + @override + ToolType get type; + + /// The name of the function. + @override + String get name; + + /// The call id. + @override + @JsonKey(name: 'call_id') + String get callId; + + /// The arguments. + @override + String get arguments; + + /// Create a copy of FormattedTool + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$FormattedToolImplCopyWith<_$FormattedToolImpl> get copyWith => + throw _privateConstructorUsedError; +} + +FormattedProperty _$FormattedPropertyFromJson(Map json) { + return _FormattedProperty.fromJson(json); +} + +/// @nodoc +mixin _$FormattedProperty { + /// The audio bytes. + @Uint8ListConverter() + Uint8List get audio => throw _privateConstructorUsedError; + + /// The text. + String get text => throw _privateConstructorUsedError; + + /// The transcript. + String get transcript => throw _privateConstructorUsedError; + + /// A formatted tool. + @JsonKey(includeIfNull: false) + FormattedTool? get tool => throw _privateConstructorUsedError; + + /// The output. + @JsonKey(includeIfNull: false) + String? get output => throw _privateConstructorUsedError; + + /// Serializes this FormattedProperty to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of FormattedProperty + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $FormattedPropertyCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $FormattedPropertyCopyWith<$Res> { + factory $FormattedPropertyCopyWith( + FormattedProperty value, $Res Function(FormattedProperty) then) = + _$FormattedPropertyCopyWithImpl<$Res, FormattedProperty>; + @useResult + $Res call( + {@Uint8ListConverter() Uint8List audio, + String text, + String transcript, + @JsonKey(includeIfNull: false) FormattedTool? tool, + @JsonKey(includeIfNull: false) String? output}); + + $FormattedToolCopyWith<$Res>? get tool; +} + +/// @nodoc +class _$FormattedPropertyCopyWithImpl<$Res, $Val extends FormattedProperty> + implements $FormattedPropertyCopyWith<$Res> { + _$FormattedPropertyCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of FormattedProperty + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? audio = null, + Object? text = null, + Object? transcript = null, + Object? tool = freezed, + Object? output = freezed, + }) { + return _then(_value.copyWith( + audio: null == audio + ? _value.audio + : audio // ignore: cast_nullable_to_non_nullable + as Uint8List, + text: null == text + ? _value.text + : text // ignore: cast_nullable_to_non_nullable + as String, + transcript: null == transcript + ? _value.transcript + : transcript // ignore: cast_nullable_to_non_nullable + as String, + tool: freezed == tool + ? _value.tool + : tool // ignore: cast_nullable_to_non_nullable + as FormattedTool?, + output: freezed == output + ? _value.output + : output // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } + + /// Create a copy of FormattedProperty + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $FormattedToolCopyWith<$Res>? get tool { + if (_value.tool == null) { + return null; + } + + return $FormattedToolCopyWith<$Res>(_value.tool!, (value) { + return _then(_value.copyWith(tool: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$FormattedPropertyImplCopyWith<$Res> + implements $FormattedPropertyCopyWith<$Res> { + factory _$$FormattedPropertyImplCopyWith(_$FormattedPropertyImpl value, + $Res Function(_$FormattedPropertyImpl) then) = + __$$FormattedPropertyImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@Uint8ListConverter() Uint8List audio, + String text, + String transcript, + @JsonKey(includeIfNull: false) FormattedTool? tool, + @JsonKey(includeIfNull: false) String? output}); + + @override + $FormattedToolCopyWith<$Res>? get tool; +} + +/// @nodoc +class __$$FormattedPropertyImplCopyWithImpl<$Res> + extends _$FormattedPropertyCopyWithImpl<$Res, _$FormattedPropertyImpl> + implements _$$FormattedPropertyImplCopyWith<$Res> { + __$$FormattedPropertyImplCopyWithImpl(_$FormattedPropertyImpl _value, + $Res Function(_$FormattedPropertyImpl) _then) + : super(_value, _then); + + /// Create a copy of FormattedProperty + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? audio = null, + Object? text = null, + Object? transcript = null, + Object? tool = freezed, + Object? output = freezed, + }) { + return _then(_$FormattedPropertyImpl( + audio: null == audio + ? _value.audio + : audio // ignore: cast_nullable_to_non_nullable + as Uint8List, + text: null == text + ? _value.text + : text // ignore: cast_nullable_to_non_nullable + as String, + transcript: null == transcript + ? _value.transcript + : transcript // ignore: cast_nullable_to_non_nullable + as String, + tool: freezed == tool + ? _value.tool + : tool // ignore: cast_nullable_to_non_nullable + as FormattedTool?, + output: freezed == output + ? _value.output + : output // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$FormattedPropertyImpl extends _FormattedProperty { + const _$FormattedPropertyImpl( + {@Uint8ListConverter() required this.audio, + required this.text, + required this.transcript, + @JsonKey(includeIfNull: false) this.tool, + @JsonKey(includeIfNull: false) this.output}) + : super._(); + + factory _$FormattedPropertyImpl.fromJson(Map json) => + _$$FormattedPropertyImplFromJson(json); + + /// The audio bytes. + @override + @Uint8ListConverter() + final Uint8List audio; + + /// The text. + @override + final String text; + + /// The transcript. + @override + final String transcript; + + /// A formatted tool. + @override + @JsonKey(includeIfNull: false) + final FormattedTool? tool; + + /// The output. + @override + @JsonKey(includeIfNull: false) + final String? output; + + @override + String toString() { + return 'FormattedProperty(audio: $audio, text: $text, transcript: $transcript, tool: $tool, output: $output)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$FormattedPropertyImpl && + const DeepCollectionEquality().equals(other.audio, audio) && + (identical(other.text, text) || other.text == text) && + (identical(other.transcript, transcript) || + other.transcript == transcript) && + (identical(other.tool, tool) || other.tool == tool) && + (identical(other.output, output) || other.output == output)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(audio), + text, + transcript, + tool, + output); + + /// Create a copy of FormattedProperty + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$FormattedPropertyImplCopyWith<_$FormattedPropertyImpl> get copyWith => + __$$FormattedPropertyImplCopyWithImpl<_$FormattedPropertyImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$FormattedPropertyImplToJson( + this, + ); + } +} + +abstract class _FormattedProperty extends FormattedProperty { + const factory _FormattedProperty( + {@Uint8ListConverter() required final Uint8List audio, + required final String text, + required final String transcript, + @JsonKey(includeIfNull: false) final FormattedTool? tool, + @JsonKey(includeIfNull: false) final String? output}) = + _$FormattedPropertyImpl; + const _FormattedProperty._() : super._(); + + factory _FormattedProperty.fromJson(Map json) = + _$FormattedPropertyImpl.fromJson; + + /// The audio bytes. + @override + @Uint8ListConverter() + Uint8List get audio; + + /// The text. + @override + String get text; + + /// The transcript. + @override + String get transcript; + + /// A formatted tool. + @override + @JsonKey(includeIfNull: false) + FormattedTool? get tool; + + /// The output. + @override + @JsonKey(includeIfNull: false) + String? get output; + + /// Create a copy of FormattedProperty + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$FormattedPropertyImplCopyWith<_$FormattedPropertyImpl> get copyWith => + throw _privateConstructorUsedError; +} + +FormattedItem _$FormattedItemFromJson(Map json) { + return _FormattedItem.fromJson(json); +} + +/// @nodoc +mixin _$FormattedItem { + /// The item to add to the conversation. + /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput] + Item get item => throw _privateConstructorUsedError; + + /// A formatted property. + FormattedProperty? get formatted => throw _privateConstructorUsedError; + + /// Serializes this FormattedItem to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of FormattedItem + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $FormattedItemCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $FormattedItemCopyWith<$Res> { + factory $FormattedItemCopyWith( + FormattedItem value, $Res Function(FormattedItem) then) = + _$FormattedItemCopyWithImpl<$Res, FormattedItem>; + @useResult + $Res call({Item item, FormattedProperty? formatted}); + + $ItemCopyWith<$Res> get item; + $FormattedPropertyCopyWith<$Res>? get formatted; +} + +/// @nodoc +class _$FormattedItemCopyWithImpl<$Res, $Val extends FormattedItem> + implements $FormattedItemCopyWith<$Res> { + _$FormattedItemCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of FormattedItem + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? item = null, + Object? formatted = freezed, + }) { + return _then(_value.copyWith( + item: null == item + ? _value.item + : item // ignore: cast_nullable_to_non_nullable + as Item, + formatted: freezed == formatted + ? _value.formatted + : formatted // ignore: cast_nullable_to_non_nullable + as FormattedProperty?, + ) as $Val); + } + + /// Create a copy of FormattedItem + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ItemCopyWith<$Res> get item { + return $ItemCopyWith<$Res>(_value.item, (value) { + return _then(_value.copyWith(item: value) as $Val); + }); + } + + /// Create a copy of FormattedItem + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $FormattedPropertyCopyWith<$Res>? get formatted { + if (_value.formatted == null) { + return null; + } + + return $FormattedPropertyCopyWith<$Res>(_value.formatted!, (value) { + return _then(_value.copyWith(formatted: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$FormattedItemImplCopyWith<$Res> + implements $FormattedItemCopyWith<$Res> { + factory _$$FormattedItemImplCopyWith( + _$FormattedItemImpl value, $Res Function(_$FormattedItemImpl) then) = + __$$FormattedItemImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({Item item, FormattedProperty? formatted}); + + @override + $ItemCopyWith<$Res> get item; + @override + $FormattedPropertyCopyWith<$Res>? get formatted; +} + +/// @nodoc +class __$$FormattedItemImplCopyWithImpl<$Res> + extends _$FormattedItemCopyWithImpl<$Res, _$FormattedItemImpl> + implements _$$FormattedItemImplCopyWith<$Res> { + __$$FormattedItemImplCopyWithImpl( + _$FormattedItemImpl _value, $Res Function(_$FormattedItemImpl) _then) + : super(_value, _then); + + /// Create a copy of FormattedItem + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? item = null, + Object? formatted = freezed, + }) { + return _then(_$FormattedItemImpl( + item: null == item + ? _value.item + : item // ignore: cast_nullable_to_non_nullable + as Item, + formatted: freezed == formatted + ? _value.formatted + : formatted // ignore: cast_nullable_to_non_nullable + as FormattedProperty?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$FormattedItemImpl extends _FormattedItem { + const _$FormattedItemImpl({required this.item, required this.formatted}) + : super._(); + + factory _$FormattedItemImpl.fromJson(Map json) => + _$$FormattedItemImplFromJson(json); + + /// The item to add to the conversation. + /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput] + @override + final Item item; + + /// A formatted property. + @override + final FormattedProperty? formatted; + + @override + String toString() { + return 'FormattedItem(item: $item, formatted: $formatted)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$FormattedItemImpl && + (identical(other.item, item) || other.item == item) && + (identical(other.formatted, formatted) || + other.formatted == formatted)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, item, formatted); + + /// Create a copy of FormattedItem + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$FormattedItemImplCopyWith<_$FormattedItemImpl> get copyWith => + __$$FormattedItemImplCopyWithImpl<_$FormattedItemImpl>(this, _$identity); + + @override + Map toJson() { + return _$$FormattedItemImplToJson( + this, + ); + } +} + +abstract class _FormattedItem extends FormattedItem { + const factory _FormattedItem( + {required final Item item, + required final FormattedProperty? formatted}) = _$FormattedItemImpl; + const _FormattedItem._() : super._(); + + factory _FormattedItem.fromJson(Map json) = + _$FormattedItemImpl.fromJson; + + /// The item to add to the conversation. + /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput] + @override + Item get item; + + /// A formatted property. + @override + FormattedProperty? get formatted; + + /// Create a copy of FormattedItem + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$FormattedItemImplCopyWith<_$FormattedItemImpl> get copyWith => + throw _privateConstructorUsedError; +} + +ItemSpeech _$ItemSpeechFromJson(Map json) { + return _ItemSpeech.fromJson(json); +} + +/// @nodoc +mixin _$ItemSpeech { + /// The start time of the audio in milliseconds. + int get audioStartMs => throw _privateConstructorUsedError; + + /// The end time of the audio in milliseconds. + @JsonKey(includeIfNull: false) + int? get audioEndMs => throw _privateConstructorUsedError; + + /// The audio bytes. + @Uint8ListConverter() + @JsonKey(includeIfNull: false) + Uint8List? get audio => throw _privateConstructorUsedError; + + /// Serializes this ItemSpeech to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of ItemSpeech + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $ItemSpeechCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ItemSpeechCopyWith<$Res> { + factory $ItemSpeechCopyWith( + ItemSpeech value, $Res Function(ItemSpeech) then) = + _$ItemSpeechCopyWithImpl<$Res, ItemSpeech>; + @useResult + $Res call( + {int audioStartMs, + @JsonKey(includeIfNull: false) int? audioEndMs, + @Uint8ListConverter() @JsonKey(includeIfNull: false) Uint8List? audio}); +} + +/// @nodoc +class _$ItemSpeechCopyWithImpl<$Res, $Val extends ItemSpeech> + implements $ItemSpeechCopyWith<$Res> { + _$ItemSpeechCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of ItemSpeech + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? audioStartMs = null, + Object? audioEndMs = freezed, + Object? audio = freezed, + }) { + return _then(_value.copyWith( + audioStartMs: null == audioStartMs + ? _value.audioStartMs + : audioStartMs // ignore: cast_nullable_to_non_nullable + as int, + audioEndMs: freezed == audioEndMs + ? _value.audioEndMs + : audioEndMs // ignore: cast_nullable_to_non_nullable + as int?, + audio: freezed == audio + ? _value.audio + : audio // ignore: cast_nullable_to_non_nullable + as Uint8List?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$ItemSpeechImplCopyWith<$Res> + implements $ItemSpeechCopyWith<$Res> { + factory _$$ItemSpeechImplCopyWith( + _$ItemSpeechImpl value, $Res Function(_$ItemSpeechImpl) then) = + __$$ItemSpeechImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {int audioStartMs, + @JsonKey(includeIfNull: false) int? audioEndMs, + @Uint8ListConverter() @JsonKey(includeIfNull: false) Uint8List? audio}); +} + +/// @nodoc +class __$$ItemSpeechImplCopyWithImpl<$Res> + extends _$ItemSpeechCopyWithImpl<$Res, _$ItemSpeechImpl> + implements _$$ItemSpeechImplCopyWith<$Res> { + __$$ItemSpeechImplCopyWithImpl( + _$ItemSpeechImpl _value, $Res Function(_$ItemSpeechImpl) _then) + : super(_value, _then); + + /// Create a copy of ItemSpeech + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? audioStartMs = null, + Object? audioEndMs = freezed, + Object? audio = freezed, + }) { + return _then(_$ItemSpeechImpl( + audioStartMs: null == audioStartMs + ? _value.audioStartMs + : audioStartMs // ignore: cast_nullable_to_non_nullable + as int, + audioEndMs: freezed == audioEndMs + ? _value.audioEndMs + : audioEndMs // ignore: cast_nullable_to_non_nullable + as int?, + audio: freezed == audio + ? _value.audio + : audio // ignore: cast_nullable_to_non_nullable + as Uint8List?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ItemSpeechImpl extends _ItemSpeech { + const _$ItemSpeechImpl( + {required this.audioStartMs, + @JsonKey(includeIfNull: false) this.audioEndMs, + @Uint8ListConverter() @JsonKey(includeIfNull: false) this.audio}) + : super._(); + + factory _$ItemSpeechImpl.fromJson(Map json) => + _$$ItemSpeechImplFromJson(json); + + /// The start time of the audio in milliseconds. + @override + final int audioStartMs; + + /// The end time of the audio in milliseconds. + @override + @JsonKey(includeIfNull: false) + final int? audioEndMs; + + /// The audio bytes. + @override + @Uint8ListConverter() + @JsonKey(includeIfNull: false) + final Uint8List? audio; + + @override + String toString() { + return 'ItemSpeech(audioStartMs: $audioStartMs, audioEndMs: $audioEndMs, audio: $audio)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ItemSpeechImpl && + (identical(other.audioStartMs, audioStartMs) || + other.audioStartMs == audioStartMs) && + (identical(other.audioEndMs, audioEndMs) || + other.audioEndMs == audioEndMs) && + const DeepCollectionEquality().equals(other.audio, audio)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, audioStartMs, audioEndMs, + const DeepCollectionEquality().hash(audio)); + + /// Create a copy of ItemSpeech + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ItemSpeechImplCopyWith<_$ItemSpeechImpl> get copyWith => + __$$ItemSpeechImplCopyWithImpl<_$ItemSpeechImpl>(this, _$identity); + + @override + Map toJson() { + return _$$ItemSpeechImplToJson( + this, + ); + } +} + +abstract class _ItemSpeech extends ItemSpeech { + const factory _ItemSpeech( + {required final int audioStartMs, + @JsonKey(includeIfNull: false) final int? audioEndMs, + @Uint8ListConverter() + @JsonKey(includeIfNull: false) + final Uint8List? audio}) = _$ItemSpeechImpl; + const _ItemSpeech._() : super._(); + + factory _ItemSpeech.fromJson(Map json) = + _$ItemSpeechImpl.fromJson; + + /// The start time of the audio in milliseconds. + @override + int get audioStartMs; + + /// The end time of the audio in milliseconds. + @override + @JsonKey(includeIfNull: false) + int? get audioEndMs; + + /// The audio bytes. + @override + @Uint8ListConverter() + @JsonKey(includeIfNull: false) + Uint8List? get audio; + + /// Create a copy of ItemSpeech + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ItemSpeechImplCopyWith<_$ItemSpeechImpl> get copyWith => + throw _privateConstructorUsedError; +} + +ItemTranscript _$ItemTranscriptFromJson(Map json) { + return _ItemTranscript.fromJson(json); +} + +/// @nodoc +mixin _$ItemTranscript { + /// The transcript. + String get transcript => throw _privateConstructorUsedError; + + /// Serializes this ItemTranscript to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of ItemTranscript + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $ItemTranscriptCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ItemTranscriptCopyWith<$Res> { + factory $ItemTranscriptCopyWith( + ItemTranscript value, $Res Function(ItemTranscript) then) = + _$ItemTranscriptCopyWithImpl<$Res, ItemTranscript>; + @useResult + $Res call({String transcript}); +} + +/// @nodoc +class _$ItemTranscriptCopyWithImpl<$Res, $Val extends ItemTranscript> + implements $ItemTranscriptCopyWith<$Res> { + _$ItemTranscriptCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of ItemTranscript + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? transcript = null, + }) { + return _then(_value.copyWith( + transcript: null == transcript + ? _value.transcript + : transcript // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$ItemTranscriptImplCopyWith<$Res> + implements $ItemTranscriptCopyWith<$Res> { + factory _$$ItemTranscriptImplCopyWith(_$ItemTranscriptImpl value, + $Res Function(_$ItemTranscriptImpl) then) = + __$$ItemTranscriptImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String transcript}); +} + +/// @nodoc +class __$$ItemTranscriptImplCopyWithImpl<$Res> + extends _$ItemTranscriptCopyWithImpl<$Res, _$ItemTranscriptImpl> + implements _$$ItemTranscriptImplCopyWith<$Res> { + __$$ItemTranscriptImplCopyWithImpl( + _$ItemTranscriptImpl _value, $Res Function(_$ItemTranscriptImpl) _then) + : super(_value, _then); + + /// Create a copy of ItemTranscript + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? transcript = null, + }) { + return _then(_$ItemTranscriptImpl( + transcript: null == transcript + ? _value.transcript + : transcript // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ItemTranscriptImpl extends _ItemTranscript { + const _$ItemTranscriptImpl({required this.transcript}) : super._(); + + factory _$ItemTranscriptImpl.fromJson(Map json) => + _$$ItemTranscriptImplFromJson(json); + + /// The transcript. + @override + final String transcript; + + @override + String toString() { + return 'ItemTranscript(transcript: $transcript)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ItemTranscriptImpl && + (identical(other.transcript, transcript) || + other.transcript == transcript)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, transcript); + + /// Create a copy of ItemTranscript + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ItemTranscriptImplCopyWith<_$ItemTranscriptImpl> get copyWith => + __$$ItemTranscriptImplCopyWithImpl<_$ItemTranscriptImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$ItemTranscriptImplToJson( + this, + ); + } +} + +abstract class _ItemTranscript extends ItemTranscript { + const factory _ItemTranscript({required final String transcript}) = + _$ItemTranscriptImpl; + const _ItemTranscript._() : super._(); + + factory _ItemTranscript.fromJson(Map json) = + _$ItemTranscriptImpl.fromJson; + + /// The transcript. + @override + String get transcript; + + /// Create a copy of ItemTranscript + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ItemTranscriptImplCopyWith<_$ItemTranscriptImpl> get copyWith => + throw _privateConstructorUsedError; +} + +EventHandlerResult _$EventHandlerResultFromJson(Map json) { + return _EventHandlerResult.fromJson(json); +} + +/// @nodoc +mixin _$EventHandlerResult { + /// A formatted item. + @JsonKey(includeIfNull: false) + FormattedItem? get item => throw _privateConstructorUsedError; + + /// Delta object. + @JsonKey(includeIfNull: false) + Delta? get delta => throw _privateConstructorUsedError; + + /// The response resource. + @JsonKey(includeIfNull: false) + Response? get response => throw _privateConstructorUsedError; + + /// Serializes this EventHandlerResult to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of EventHandlerResult + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $EventHandlerResultCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $EventHandlerResultCopyWith<$Res> { + factory $EventHandlerResultCopyWith( + EventHandlerResult value, $Res Function(EventHandlerResult) then) = + _$EventHandlerResultCopyWithImpl<$Res, EventHandlerResult>; + @useResult + $Res call( + {@JsonKey(includeIfNull: false) FormattedItem? item, + @JsonKey(includeIfNull: false) Delta? delta, + @JsonKey(includeIfNull: false) Response? response}); + + $FormattedItemCopyWith<$Res>? get item; + $DeltaCopyWith<$Res>? get delta; + $ResponseCopyWith<$Res>? get response; +} + +/// @nodoc +class _$EventHandlerResultCopyWithImpl<$Res, $Val extends EventHandlerResult> + implements $EventHandlerResultCopyWith<$Res> { + _$EventHandlerResultCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of EventHandlerResult + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? item = freezed, + Object? delta = freezed, + Object? response = freezed, + }) { + return _then(_value.copyWith( + item: freezed == item + ? _value.item + : item // ignore: cast_nullable_to_non_nullable + as FormattedItem?, + delta: freezed == delta + ? _value.delta + : delta // ignore: cast_nullable_to_non_nullable + as Delta?, + response: freezed == response + ? _value.response + : response // ignore: cast_nullable_to_non_nullable + as Response?, + ) as $Val); + } + + /// Create a copy of EventHandlerResult + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $FormattedItemCopyWith<$Res>? get item { + if (_value.item == null) { + return null; + } + + return $FormattedItemCopyWith<$Res>(_value.item!, (value) { + return _then(_value.copyWith(item: value) as $Val); + }); + } + + /// Create a copy of EventHandlerResult + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $DeltaCopyWith<$Res>? get delta { + if (_value.delta == null) { + return null; + } + + return $DeltaCopyWith<$Res>(_value.delta!, (value) { + return _then(_value.copyWith(delta: value) as $Val); + }); + } + + /// Create a copy of EventHandlerResult + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ResponseCopyWith<$Res>? get response { + if (_value.response == null) { + return null; + } + + return $ResponseCopyWith<$Res>(_value.response!, (value) { + return _then(_value.copyWith(response: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$EventHandlerResultImplCopyWith<$Res> + implements $EventHandlerResultCopyWith<$Res> { + factory _$$EventHandlerResultImplCopyWith(_$EventHandlerResultImpl value, + $Res Function(_$EventHandlerResultImpl) then) = + __$$EventHandlerResultImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(includeIfNull: false) FormattedItem? item, + @JsonKey(includeIfNull: false) Delta? delta, + @JsonKey(includeIfNull: false) Response? response}); + + @override + $FormattedItemCopyWith<$Res>? get item; + @override + $DeltaCopyWith<$Res>? get delta; + @override + $ResponseCopyWith<$Res>? get response; +} + +/// @nodoc +class __$$EventHandlerResultImplCopyWithImpl<$Res> + extends _$EventHandlerResultCopyWithImpl<$Res, _$EventHandlerResultImpl> + implements _$$EventHandlerResultImplCopyWith<$Res> { + __$$EventHandlerResultImplCopyWithImpl(_$EventHandlerResultImpl _value, + $Res Function(_$EventHandlerResultImpl) _then) + : super(_value, _then); + + /// Create a copy of EventHandlerResult + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? item = freezed, + Object? delta = freezed, + Object? response = freezed, + }) { + return _then(_$EventHandlerResultImpl( + item: freezed == item + ? _value.item + : item // ignore: cast_nullable_to_non_nullable + as FormattedItem?, + delta: freezed == delta + ? _value.delta + : delta // ignore: cast_nullable_to_non_nullable + as Delta?, + response: freezed == response + ? _value.response + : response // ignore: cast_nullable_to_non_nullable + as Response?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$EventHandlerResultImpl extends _EventHandlerResult { + const _$EventHandlerResultImpl( + {@JsonKey(includeIfNull: false) this.item, + @JsonKey(includeIfNull: false) this.delta, + @JsonKey(includeIfNull: false) this.response}) + : super._(); + + factory _$EventHandlerResultImpl.fromJson(Map json) => + _$$EventHandlerResultImplFromJson(json); + + /// A formatted item. + @override + @JsonKey(includeIfNull: false) + final FormattedItem? item; + + /// Delta object. + @override + @JsonKey(includeIfNull: false) + final Delta? delta; + + /// The response resource. + @override + @JsonKey(includeIfNull: false) + final Response? response; + + @override + String toString() { + return 'EventHandlerResult(item: $item, delta: $delta, response: $response)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$EventHandlerResultImpl && + (identical(other.item, item) || other.item == item) && + (identical(other.delta, delta) || other.delta == delta) && + (identical(other.response, response) || + other.response == response)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, item, delta, response); + + /// Create a copy of EventHandlerResult + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$EventHandlerResultImplCopyWith<_$EventHandlerResultImpl> get copyWith => + __$$EventHandlerResultImplCopyWithImpl<_$EventHandlerResultImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$EventHandlerResultImplToJson( + this, + ); + } +} + +abstract class _EventHandlerResult extends EventHandlerResult { + const factory _EventHandlerResult( + {@JsonKey(includeIfNull: false) final FormattedItem? item, + @JsonKey(includeIfNull: false) final Delta? delta, + @JsonKey(includeIfNull: false) final Response? response}) = + _$EventHandlerResultImpl; + const _EventHandlerResult._() : super._(); + + factory _EventHandlerResult.fromJson(Map json) = + _$EventHandlerResultImpl.fromJson; + + /// A formatted item. + @override + @JsonKey(includeIfNull: false) + FormattedItem? get item; + + /// Delta object. + @override + @JsonKey(includeIfNull: false) + Delta? get delta; + + /// The response resource. + @override + @JsonKey(includeIfNull: false) + Response? get response; + + /// Create a copy of EventHandlerResult + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$EventHandlerResultImplCopyWith<_$EventHandlerResultImpl> get copyWith => + throw _privateConstructorUsedError; +} + +TranscriptionError _$TranscriptionErrorFromJson(Map json) { + return _TranscriptionError.fromJson(json); +} + +/// @nodoc +mixin _$TranscriptionError { + /// The type of the error. + @JsonKey(includeIfNull: false) + String? get type => throw _privateConstructorUsedError; + + /// Error code, if any. + @JsonKey(includeIfNull: false) + String? get code => throw _privateConstructorUsedError; + + /// A human-readable error message. + @JsonKey(includeIfNull: false) + String? get message => throw _privateConstructorUsedError; + + /// Parameter related to the error, if any. + @JsonKey(includeIfNull: false) + String? get param => throw _privateConstructorUsedError; + + /// Serializes this TranscriptionError to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of TranscriptionError + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $TranscriptionErrorCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $TranscriptionErrorCopyWith<$Res> { + factory $TranscriptionErrorCopyWith( + TranscriptionError value, $Res Function(TranscriptionError) then) = + _$TranscriptionErrorCopyWithImpl<$Res, TranscriptionError>; + @useResult + $Res call( + {@JsonKey(includeIfNull: false) String? type, + @JsonKey(includeIfNull: false) String? code, + @JsonKey(includeIfNull: false) String? message, + @JsonKey(includeIfNull: false) String? param}); +} + +/// @nodoc +class _$TranscriptionErrorCopyWithImpl<$Res, $Val extends TranscriptionError> + implements $TranscriptionErrorCopyWith<$Res> { + _$TranscriptionErrorCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of TranscriptionError + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = freezed, + Object? code = freezed, + Object? message = freezed, + Object? param = freezed, + }) { + return _then(_value.copyWith( + type: freezed == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + code: freezed == code + ? _value.code + : code // ignore: cast_nullable_to_non_nullable + as String?, + message: freezed == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String?, + param: freezed == param + ? _value.param + : param // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$TranscriptionErrorImplCopyWith<$Res> + implements $TranscriptionErrorCopyWith<$Res> { + factory _$$TranscriptionErrorImplCopyWith(_$TranscriptionErrorImpl value, + $Res Function(_$TranscriptionErrorImpl) then) = + __$$TranscriptionErrorImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(includeIfNull: false) String? type, + @JsonKey(includeIfNull: false) String? code, + @JsonKey(includeIfNull: false) String? message, + @JsonKey(includeIfNull: false) String? param}); +} + +/// @nodoc +class __$$TranscriptionErrorImplCopyWithImpl<$Res> + extends _$TranscriptionErrorCopyWithImpl<$Res, _$TranscriptionErrorImpl> + implements _$$TranscriptionErrorImplCopyWith<$Res> { + __$$TranscriptionErrorImplCopyWithImpl(_$TranscriptionErrorImpl _value, + $Res Function(_$TranscriptionErrorImpl) _then) + : super(_value, _then); + + /// Create a copy of TranscriptionError + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = freezed, + Object? code = freezed, + Object? message = freezed, + Object? param = freezed, + }) { + return _then(_$TranscriptionErrorImpl( + type: freezed == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + code: freezed == code + ? _value.code + : code // ignore: cast_nullable_to_non_nullable + as String?, + message: freezed == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String?, + param: freezed == param + ? _value.param + : param // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$TranscriptionErrorImpl extends _TranscriptionError { + const _$TranscriptionErrorImpl( + {@JsonKey(includeIfNull: false) this.type, + @JsonKey(includeIfNull: false) this.code, + @JsonKey(includeIfNull: false) this.message, + @JsonKey(includeIfNull: false) this.param}) + : super._(); + + factory _$TranscriptionErrorImpl.fromJson(Map json) => + _$$TranscriptionErrorImplFromJson(json); + + /// The type of the error. + @override + @JsonKey(includeIfNull: false) + final String? type; + + /// Error code, if any. + @override + @JsonKey(includeIfNull: false) + final String? code; + + /// A human-readable error message. + @override + @JsonKey(includeIfNull: false) + final String? message; + + /// Parameter related to the error, if any. + @override + @JsonKey(includeIfNull: false) + final String? param; + + @override + String toString() { + return 'TranscriptionError(type: $type, code: $code, message: $message, param: $param)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$TranscriptionErrorImpl && + (identical(other.type, type) || other.type == type) && + (identical(other.code, code) || other.code == code) && + (identical(other.message, message) || other.message == message) && + (identical(other.param, param) || other.param == param)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, type, code, message, param); + + /// Create a copy of TranscriptionError + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$TranscriptionErrorImplCopyWith<_$TranscriptionErrorImpl> get copyWith => + __$$TranscriptionErrorImplCopyWithImpl<_$TranscriptionErrorImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$TranscriptionErrorImplToJson( + this, + ); + } +} + +abstract class _TranscriptionError extends TranscriptionError { + const factory _TranscriptionError( + {@JsonKey(includeIfNull: false) final String? type, + @JsonKey(includeIfNull: false) final String? code, + @JsonKey(includeIfNull: false) final String? message, + @JsonKey(includeIfNull: false) final String? param}) = + _$TranscriptionErrorImpl; + const _TranscriptionError._() : super._(); + + factory _TranscriptionError.fromJson(Map json) = + _$TranscriptionErrorImpl.fromJson; + + /// The type of the error. + @override + @JsonKey(includeIfNull: false) + String? get type; + + /// Error code, if any. + @override + @JsonKey(includeIfNull: false) + String? get code; + + /// A human-readable error message. + @override + @JsonKey(includeIfNull: false) + String? get message; + + /// Parameter related to the error, if any. + @override + @JsonKey(includeIfNull: false) + String? get param; + + /// Create a copy of TranscriptionError + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$TranscriptionErrorImplCopyWith<_$TranscriptionErrorImpl> get copyWith => + throw _privateConstructorUsedError; +} + +APIError _$APIErrorFromJson(Map json) { + return _APIError.fromJson(json); +} + +/// @nodoc +mixin _$APIError { + /// The type of error (e.g., "invalid_request_error", "server_error"). + @JsonKey(includeIfNull: false) + String? get type => throw _privateConstructorUsedError; + + /// Error code, if any. + @JsonKey(includeIfNull: false) + String? get code => throw _privateConstructorUsedError; + + /// A human-readable error message. + @JsonKey(includeIfNull: false) + String? get message => throw _privateConstructorUsedError; + + /// Parameter related to the error, if any. + @JsonKey(includeIfNull: false) + String? get param => throw _privateConstructorUsedError; + + /// The event_id of the client event that caused the error, if applicable. + @JsonKey(name: 'event_id', includeIfNull: false) + String? get eventId => throw _privateConstructorUsedError; + + /// Serializes this APIError to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of APIError + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $APIErrorCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $APIErrorCopyWith<$Res> { + factory $APIErrorCopyWith(APIError value, $Res Function(APIError) then) = + _$APIErrorCopyWithImpl<$Res, APIError>; + @useResult + $Res call( + {@JsonKey(includeIfNull: false) String? type, + @JsonKey(includeIfNull: false) String? code, + @JsonKey(includeIfNull: false) String? message, + @JsonKey(includeIfNull: false) String? param, + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId}); +} + +/// @nodoc +class _$APIErrorCopyWithImpl<$Res, $Val extends APIError> + implements $APIErrorCopyWith<$Res> { + _$APIErrorCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of APIError + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = freezed, + Object? code = freezed, + Object? message = freezed, + Object? param = freezed, + Object? eventId = freezed, + }) { + return _then(_value.copyWith( + type: freezed == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + code: freezed == code + ? _value.code + : code // ignore: cast_nullable_to_non_nullable + as String?, + message: freezed == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String?, + param: freezed == param + ? _value.param + : param // ignore: cast_nullable_to_non_nullable + as String?, + eventId: freezed == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$APIErrorImplCopyWith<$Res> + implements $APIErrorCopyWith<$Res> { + factory _$$APIErrorImplCopyWith( + _$APIErrorImpl value, $Res Function(_$APIErrorImpl) then) = + __$$APIErrorImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(includeIfNull: false) String? type, + @JsonKey(includeIfNull: false) String? code, + @JsonKey(includeIfNull: false) String? message, + @JsonKey(includeIfNull: false) String? param, + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId}); +} + +/// @nodoc +class __$$APIErrorImplCopyWithImpl<$Res> + extends _$APIErrorCopyWithImpl<$Res, _$APIErrorImpl> + implements _$$APIErrorImplCopyWith<$Res> { + __$$APIErrorImplCopyWithImpl( + _$APIErrorImpl _value, $Res Function(_$APIErrorImpl) _then) + : super(_value, _then); + + /// Create a copy of APIError + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = freezed, + Object? code = freezed, + Object? message = freezed, + Object? param = freezed, + Object? eventId = freezed, + }) { + return _then(_$APIErrorImpl( + type: freezed == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + code: freezed == code + ? _value.code + : code // ignore: cast_nullable_to_non_nullable + as String?, + message: freezed == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String?, + param: freezed == param + ? _value.param + : param // ignore: cast_nullable_to_non_nullable + as String?, + eventId: freezed == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$APIErrorImpl extends _APIError { + const _$APIErrorImpl( + {@JsonKey(includeIfNull: false) this.type, + @JsonKey(includeIfNull: false) this.code, + @JsonKey(includeIfNull: false) this.message, + @JsonKey(includeIfNull: false) this.param, + @JsonKey(name: 'event_id', includeIfNull: false) this.eventId}) + : super._(); + + factory _$APIErrorImpl.fromJson(Map json) => + _$$APIErrorImplFromJson(json); + + /// The type of error (e.g., "invalid_request_error", "server_error"). + @override + @JsonKey(includeIfNull: false) + final String? type; + + /// Error code, if any. + @override + @JsonKey(includeIfNull: false) + final String? code; + + /// A human-readable error message. + @override + @JsonKey(includeIfNull: false) + final String? message; + + /// Parameter related to the error, if any. + @override + @JsonKey(includeIfNull: false) + final String? param; + + /// The event_id of the client event that caused the error, if applicable. + @override + @JsonKey(name: 'event_id', includeIfNull: false) + final String? eventId; + + @override + String toString() { + return 'APIError(type: $type, code: $code, message: $message, param: $param, eventId: $eventId)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$APIErrorImpl && + (identical(other.type, type) || other.type == type) && + (identical(other.code, code) || other.code == code) && + (identical(other.message, message) || other.message == message) && + (identical(other.param, param) || other.param == param) && + (identical(other.eventId, eventId) || other.eventId == eventId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, type, code, message, param, eventId); + + /// Create a copy of APIError + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$APIErrorImplCopyWith<_$APIErrorImpl> get copyWith => + __$$APIErrorImplCopyWithImpl<_$APIErrorImpl>(this, _$identity); + + @override + Map toJson() { + return _$$APIErrorImplToJson( + this, + ); + } +} + +abstract class _APIError extends APIError { + const factory _APIError( + {@JsonKey(includeIfNull: false) final String? type, + @JsonKey(includeIfNull: false) final String? code, + @JsonKey(includeIfNull: false) final String? message, + @JsonKey(includeIfNull: false) final String? param, + @JsonKey(name: 'event_id', includeIfNull: false) + final String? eventId}) = _$APIErrorImpl; + const _APIError._() : super._(); + + factory _APIError.fromJson(Map json) = + _$APIErrorImpl.fromJson; + + /// The type of error (e.g., "invalid_request_error", "server_error"). + @override + @JsonKey(includeIfNull: false) + String? get type; + + /// Error code, if any. + @override + @JsonKey(includeIfNull: false) + String? get code; + + /// A human-readable error message. + @override + @JsonKey(includeIfNull: false) + String? get message; + + /// Parameter related to the error, if any. + @override + @JsonKey(includeIfNull: false) + String? get param; + + /// The event_id of the client event that caused the error, if applicable. + @override + @JsonKey(name: 'event_id', includeIfNull: false) + String? get eventId; + + /// Create a copy of APIError + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$APIErrorImplCopyWith<_$APIErrorImpl> get copyWith => + throw _privateConstructorUsedError; +} + +ContentPart _$ContentPartFromJson(Map json) { + switch (json['type']) { + case 'input_text': + return ContentPartInputText.fromJson(json); + case 'input_audio': + return ContentPartInputAudio.fromJson(json); + case 'text': + return ContentPartText.fromJson(json); + case 'audio': + return ContentPartAudio.fromJson(json); + + default: + throw CheckedFromJsonException( + json, 'type', 'ContentPart', 'Invalid union type "${json['type']}"!'); + } +} + +/// @nodoc +mixin _$ContentPart { + /// The content type. + ContentType get type => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult when({ + required TResult Function(ContentType type, String text) inputText, + required TResult Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript) + inputAudio, + required TResult Function(ContentType type, String text) text, + required TResult Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript) + audio, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(ContentType type, String text)? inputText, + TResult? Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript)? + inputAudio, + TResult? Function(ContentType type, String text)? text, + TResult? Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript)? + audio, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(ContentType type, String text)? inputText, + TResult Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript)? + inputAudio, + TResult Function(ContentType type, String text)? text, + TResult Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript)? + audio, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(ContentPartInputText value) inputText, + required TResult Function(ContentPartInputAudio value) inputAudio, + required TResult Function(ContentPartText value) text, + required TResult Function(ContentPartAudio value) audio, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ContentPartInputText value)? inputText, + TResult? Function(ContentPartInputAudio value)? inputAudio, + TResult? Function(ContentPartText value)? text, + TResult? Function(ContentPartAudio value)? audio, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ContentPartInputText value)? inputText, + TResult Function(ContentPartInputAudio value)? inputAudio, + TResult Function(ContentPartText value)? text, + TResult Function(ContentPartAudio value)? audio, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + + /// Serializes this ContentPart to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of ContentPart + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $ContentPartCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ContentPartCopyWith<$Res> { + factory $ContentPartCopyWith( + ContentPart value, $Res Function(ContentPart) then) = + _$ContentPartCopyWithImpl<$Res, ContentPart>; + @useResult + $Res call({ContentType type}); +} + +/// @nodoc +class _$ContentPartCopyWithImpl<$Res, $Val extends ContentPart> + implements $ContentPartCopyWith<$Res> { + _$ContentPartCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of ContentPart + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + }) { + return _then(_value.copyWith( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as ContentType, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$ContentPartInputTextImplCopyWith<$Res> + implements $ContentPartCopyWith<$Res> { + factory _$$ContentPartInputTextImplCopyWith(_$ContentPartInputTextImpl value, + $Res Function(_$ContentPartInputTextImpl) then) = + __$$ContentPartInputTextImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({ContentType type, String text}); +} + +/// @nodoc +class __$$ContentPartInputTextImplCopyWithImpl<$Res> + extends _$ContentPartCopyWithImpl<$Res, _$ContentPartInputTextImpl> + implements _$$ContentPartInputTextImplCopyWith<$Res> { + __$$ContentPartInputTextImplCopyWithImpl(_$ContentPartInputTextImpl _value, + $Res Function(_$ContentPartInputTextImpl) _then) + : super(_value, _then); + + /// Create a copy of ContentPart + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? text = null, + }) { + return _then(_$ContentPartInputTextImpl( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as ContentType, + text: null == text + ? _value.text + : text // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ContentPartInputTextImpl extends ContentPartInputText { + const _$ContentPartInputTextImpl( + {this.type = ContentType.inputText, required this.text}) + : super._(); + + factory _$ContentPartInputTextImpl.fromJson(Map json) => + _$$ContentPartInputTextImplFromJson(json); + + /// The content type. + @override + @JsonKey() + final ContentType type; + + /// The text content. + @override + final String text; + + @override + String toString() { + return 'ContentPart.inputText(type: $type, text: $text)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ContentPartInputTextImpl && + (identical(other.type, type) || other.type == type) && + (identical(other.text, text) || other.text == text)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, type, text); + + /// Create a copy of ContentPart + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ContentPartInputTextImplCopyWith<_$ContentPartInputTextImpl> + get copyWith => + __$$ContentPartInputTextImplCopyWithImpl<_$ContentPartInputTextImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(ContentType type, String text) inputText, + required TResult Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript) + inputAudio, + required TResult Function(ContentType type, String text) text, + required TResult Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript) + audio, + }) { + return inputText(type, this.text); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(ContentType type, String text)? inputText, + TResult? Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript)? + inputAudio, + TResult? Function(ContentType type, String text)? text, + TResult? Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript)? + audio, + }) { + return inputText?.call(type, this.text); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(ContentType type, String text)? inputText, + TResult Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript)? + inputAudio, + TResult Function(ContentType type, String text)? text, + TResult Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript)? + audio, + required TResult orElse(), + }) { + if (inputText != null) { + return inputText(type, this.text); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ContentPartInputText value) inputText, + required TResult Function(ContentPartInputAudio value) inputAudio, + required TResult Function(ContentPartText value) text, + required TResult Function(ContentPartAudio value) audio, + }) { + return inputText(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ContentPartInputText value)? inputText, + TResult? Function(ContentPartInputAudio value)? inputAudio, + TResult? Function(ContentPartText value)? text, + TResult? Function(ContentPartAudio value)? audio, + }) { + return inputText?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ContentPartInputText value)? inputText, + TResult Function(ContentPartInputAudio value)? inputAudio, + TResult Function(ContentPartText value)? text, + TResult Function(ContentPartAudio value)? audio, + required TResult orElse(), + }) { + if (inputText != null) { + return inputText(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$ContentPartInputTextImplToJson( + this, + ); + } +} + +abstract class ContentPartInputText extends ContentPart { + const factory ContentPartInputText( + {final ContentType type, + required final String text}) = _$ContentPartInputTextImpl; + const ContentPartInputText._() : super._(); + + factory ContentPartInputText.fromJson(Map json) = + _$ContentPartInputTextImpl.fromJson; + + /// The content type. + @override + ContentType get type; + + /// The text content. + String get text; + + /// Create a copy of ContentPart + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ContentPartInputTextImplCopyWith<_$ContentPartInputTextImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$ContentPartInputAudioImplCopyWith<$Res> + implements $ContentPartCopyWith<$Res> { + factory _$$ContentPartInputAudioImplCopyWith( + _$ContentPartInputAudioImpl value, + $Res Function(_$ContentPartInputAudioImpl) then) = + __$$ContentPartInputAudioImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript}); +} + +/// @nodoc +class __$$ContentPartInputAudioImplCopyWithImpl<$Res> + extends _$ContentPartCopyWithImpl<$Res, _$ContentPartInputAudioImpl> + implements _$$ContentPartInputAudioImplCopyWith<$Res> { + __$$ContentPartInputAudioImplCopyWithImpl(_$ContentPartInputAudioImpl _value, + $Res Function(_$ContentPartInputAudioImpl) _then) + : super(_value, _then); + + /// Create a copy of ContentPart + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? audio = freezed, + Object? transcript = freezed, + }) { + return _then(_$ContentPartInputAudioImpl( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as ContentType, + audio: freezed == audio + ? _value.audio + : audio // ignore: cast_nullable_to_non_nullable + as String?, + transcript: freezed == transcript + ? _value.transcript + : transcript // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ContentPartInputAudioImpl extends ContentPartInputAudio { + const _$ContentPartInputAudioImpl( + {this.type = ContentType.inputAudio, + @JsonKey(includeIfNull: false) this.audio, + @JsonKey(includeIfNull: false) this.transcript}) + : super._(); + + factory _$ContentPartInputAudioImpl.fromJson(Map json) => + _$$ContentPartInputAudioImplFromJson(json); + + /// The content type. + @override + @JsonKey() + final ContentType type; + + /// Base64-encoded audio bytes. + @override + @JsonKey(includeIfNull: false) + final String? audio; + + /// The transcript of the audio. + @override + @JsonKey(includeIfNull: false) + final String? transcript; + + @override + String toString() { + return 'ContentPart.inputAudio(type: $type, audio: $audio, transcript: $transcript)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ContentPartInputAudioImpl && + (identical(other.type, type) || other.type == type) && + (identical(other.audio, audio) || other.audio == audio) && + (identical(other.transcript, transcript) || + other.transcript == transcript)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, type, audio, transcript); + + /// Create a copy of ContentPart + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ContentPartInputAudioImplCopyWith<_$ContentPartInputAudioImpl> + get copyWith => __$$ContentPartInputAudioImplCopyWithImpl< + _$ContentPartInputAudioImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(ContentType type, String text) inputText, + required TResult Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript) + inputAudio, + required TResult Function(ContentType type, String text) text, + required TResult Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript) + audio, + }) { + return inputAudio(type, this.audio, transcript); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(ContentType type, String text)? inputText, + TResult? Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript)? + inputAudio, + TResult? Function(ContentType type, String text)? text, + TResult? Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript)? + audio, + }) { + return inputAudio?.call(type, this.audio, transcript); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(ContentType type, String text)? inputText, + TResult Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript)? + inputAudio, + TResult Function(ContentType type, String text)? text, + TResult Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript)? + audio, + required TResult orElse(), + }) { + if (inputAudio != null) { + return inputAudio(type, this.audio, transcript); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ContentPartInputText value) inputText, + required TResult Function(ContentPartInputAudio value) inputAudio, + required TResult Function(ContentPartText value) text, + required TResult Function(ContentPartAudio value) audio, + }) { + return inputAudio(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ContentPartInputText value)? inputText, + TResult? Function(ContentPartInputAudio value)? inputAudio, + TResult? Function(ContentPartText value)? text, + TResult? Function(ContentPartAudio value)? audio, + }) { + return inputAudio?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ContentPartInputText value)? inputText, + TResult Function(ContentPartInputAudio value)? inputAudio, + TResult Function(ContentPartText value)? text, + TResult Function(ContentPartAudio value)? audio, + required TResult orElse(), + }) { + if (inputAudio != null) { + return inputAudio(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$ContentPartInputAudioImplToJson( + this, + ); + } +} + +abstract class ContentPartInputAudio extends ContentPart { + const factory ContentPartInputAudio( + {final ContentType type, + @JsonKey(includeIfNull: false) final String? audio, + @JsonKey(includeIfNull: false) final String? transcript}) = + _$ContentPartInputAudioImpl; + const ContentPartInputAudio._() : super._(); + + factory ContentPartInputAudio.fromJson(Map json) = + _$ContentPartInputAudioImpl.fromJson; + + /// The content type. + @override + ContentType get type; + + /// Base64-encoded audio bytes. + @JsonKey(includeIfNull: false) + String? get audio; + + /// The transcript of the audio. + @JsonKey(includeIfNull: false) + String? get transcript; + + /// Create a copy of ContentPart + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ContentPartInputAudioImplCopyWith<_$ContentPartInputAudioImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$ContentPartTextImplCopyWith<$Res> + implements $ContentPartCopyWith<$Res> { + factory _$$ContentPartTextImplCopyWith(_$ContentPartTextImpl value, + $Res Function(_$ContentPartTextImpl) then) = + __$$ContentPartTextImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({ContentType type, String text}); +} + +/// @nodoc +class __$$ContentPartTextImplCopyWithImpl<$Res> + extends _$ContentPartCopyWithImpl<$Res, _$ContentPartTextImpl> + implements _$$ContentPartTextImplCopyWith<$Res> { + __$$ContentPartTextImplCopyWithImpl( + _$ContentPartTextImpl _value, $Res Function(_$ContentPartTextImpl) _then) + : super(_value, _then); + + /// Create a copy of ContentPart + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? text = null, + }) { + return _then(_$ContentPartTextImpl( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as ContentType, + text: null == text + ? _value.text + : text // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ContentPartTextImpl extends ContentPartText { + const _$ContentPartTextImpl( + {this.type = ContentType.text, required this.text}) + : super._(); + + factory _$ContentPartTextImpl.fromJson(Map json) => + _$$ContentPartTextImplFromJson(json); + + /// The content type. + @override + @JsonKey() + final ContentType type; + + /// The text content. + @override + final String text; + + @override + String toString() { + return 'ContentPart.text(type: $type, text: $text)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ContentPartTextImpl && + (identical(other.type, type) || other.type == type) && + (identical(other.text, text) || other.text == text)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, type, text); + + /// Create a copy of ContentPart + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ContentPartTextImplCopyWith<_$ContentPartTextImpl> get copyWith => + __$$ContentPartTextImplCopyWithImpl<_$ContentPartTextImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(ContentType type, String text) inputText, + required TResult Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript) + inputAudio, + required TResult Function(ContentType type, String text) text, + required TResult Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript) + audio, + }) { + return text(type, this.text); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(ContentType type, String text)? inputText, + TResult? Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript)? + inputAudio, + TResult? Function(ContentType type, String text)? text, + TResult? Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript)? + audio, + }) { + return text?.call(type, this.text); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(ContentType type, String text)? inputText, + TResult Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript)? + inputAudio, + TResult Function(ContentType type, String text)? text, + TResult Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript)? + audio, + required TResult orElse(), + }) { + if (text != null) { + return text(type, this.text); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ContentPartInputText value) inputText, + required TResult Function(ContentPartInputAudio value) inputAudio, + required TResult Function(ContentPartText value) text, + required TResult Function(ContentPartAudio value) audio, + }) { + return text(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ContentPartInputText value)? inputText, + TResult? Function(ContentPartInputAudio value)? inputAudio, + TResult? Function(ContentPartText value)? text, + TResult? Function(ContentPartAudio value)? audio, + }) { + return text?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ContentPartInputText value)? inputText, + TResult Function(ContentPartInputAudio value)? inputAudio, + TResult Function(ContentPartText value)? text, + TResult Function(ContentPartAudio value)? audio, + required TResult orElse(), + }) { + if (text != null) { + return text(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$ContentPartTextImplToJson( + this, + ); + } +} + +abstract class ContentPartText extends ContentPart { + const factory ContentPartText( + {final ContentType type, + required final String text}) = _$ContentPartTextImpl; + const ContentPartText._() : super._(); + + factory ContentPartText.fromJson(Map json) = + _$ContentPartTextImpl.fromJson; + + /// The content type. + @override + ContentType get type; + + /// The text content. + String get text; + + /// Create a copy of ContentPart + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ContentPartTextImplCopyWith<_$ContentPartTextImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$ContentPartAudioImplCopyWith<$Res> + implements $ContentPartCopyWith<$Res> { + factory _$$ContentPartAudioImplCopyWith(_$ContentPartAudioImpl value, + $Res Function(_$ContentPartAudioImpl) then) = + __$$ContentPartAudioImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript}); +} + +/// @nodoc +class __$$ContentPartAudioImplCopyWithImpl<$Res> + extends _$ContentPartCopyWithImpl<$Res, _$ContentPartAudioImpl> + implements _$$ContentPartAudioImplCopyWith<$Res> { + __$$ContentPartAudioImplCopyWithImpl(_$ContentPartAudioImpl _value, + $Res Function(_$ContentPartAudioImpl) _then) + : super(_value, _then); + + /// Create a copy of ContentPart + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? audio = freezed, + Object? transcript = freezed, + }) { + return _then(_$ContentPartAudioImpl( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as ContentType, + audio: freezed == audio + ? _value.audio + : audio // ignore: cast_nullable_to_non_nullable + as String?, + transcript: freezed == transcript + ? _value.transcript + : transcript // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ContentPartAudioImpl extends ContentPartAudio { + const _$ContentPartAudioImpl( + {this.type = ContentType.audio, + @JsonKey(includeIfNull: false) this.audio, + @JsonKey(includeIfNull: false) this.transcript}) + : super._(); + + factory _$ContentPartAudioImpl.fromJson(Map json) => + _$$ContentPartAudioImplFromJson(json); + + /// The content type. + @override + @JsonKey() + final ContentType type; + + /// Base64-encoded audio bytes. + @override + @JsonKey(includeIfNull: false) + final String? audio; + + /// The transcript of the audio. + @override + @JsonKey(includeIfNull: false) + final String? transcript; + + @override + String toString() { + return 'ContentPart.audio(type: $type, audio: $audio, transcript: $transcript)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ContentPartAudioImpl && + (identical(other.type, type) || other.type == type) && + (identical(other.audio, audio) || other.audio == audio) && + (identical(other.transcript, transcript) || + other.transcript == transcript)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, type, audio, transcript); + + /// Create a copy of ContentPart + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ContentPartAudioImplCopyWith<_$ContentPartAudioImpl> get copyWith => + __$$ContentPartAudioImplCopyWithImpl<_$ContentPartAudioImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(ContentType type, String text) inputText, + required TResult Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript) + inputAudio, + required TResult Function(ContentType type, String text) text, + required TResult Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript) + audio, + }) { + return audio(type, this.audio, transcript); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(ContentType type, String text)? inputText, + TResult? Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript)? + inputAudio, + TResult? Function(ContentType type, String text)? text, + TResult? Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript)? + audio, + }) { + return audio?.call(type, this.audio, transcript); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(ContentType type, String text)? inputText, + TResult Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript)? + inputAudio, + TResult Function(ContentType type, String text)? text, + TResult Function( + ContentType type, + @JsonKey(includeIfNull: false) String? audio, + @JsonKey(includeIfNull: false) String? transcript)? + audio, + required TResult orElse(), + }) { + if (audio != null) { + return audio(type, this.audio, transcript); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ContentPartInputText value) inputText, + required TResult Function(ContentPartInputAudio value) inputAudio, + required TResult Function(ContentPartText value) text, + required TResult Function(ContentPartAudio value) audio, + }) { + return audio(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ContentPartInputText value)? inputText, + TResult? Function(ContentPartInputAudio value)? inputAudio, + TResult? Function(ContentPartText value)? text, + TResult? Function(ContentPartAudio value)? audio, + }) { + return audio?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ContentPartInputText value)? inputText, + TResult Function(ContentPartInputAudio value)? inputAudio, + TResult Function(ContentPartText value)? text, + TResult Function(ContentPartAudio value)? audio, + required TResult orElse(), + }) { + if (audio != null) { + return audio(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$ContentPartAudioImplToJson( + this, + ); + } +} + +abstract class ContentPartAudio extends ContentPart { + const factory ContentPartAudio( + {final ContentType type, + @JsonKey(includeIfNull: false) final String? audio, + @JsonKey(includeIfNull: false) final String? transcript}) = + _$ContentPartAudioImpl; + const ContentPartAudio._() : super._(); + + factory ContentPartAudio.fromJson(Map json) = + _$ContentPartAudioImpl.fromJson; + + /// The content type. + @override + ContentType get type; + + /// Base64-encoded audio bytes. + @JsonKey(includeIfNull: false) + String? get audio; + + /// The transcript of the audio. + @JsonKey(includeIfNull: false) + String? get transcript; + + /// Create a copy of ContentPart + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ContentPartAudioImplCopyWith<_$ContentPartAudioImpl> get copyWith => + throw _privateConstructorUsedError; +} + +Item _$ItemFromJson(Map json) { + switch (json['type']) { + case 'message': + return ItemMessage.fromJson(json); + case 'function_call': + return ItemFunctionCall.fromJson(json); + case 'function_call_output': + return ItemFunctionCallOutput.fromJson(json); + + default: + throw CheckedFromJsonException( + json, 'type', 'Item', 'Invalid union type "${json['type']}"!'); + } +} + +/// @nodoc +mixin _$Item { + /// The unique ID of the item. + String get id => throw _privateConstructorUsedError; + + /// The object type, must be "realtime.item". + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? get object => throw _privateConstructorUsedError; + + /// The type of the item. + ItemType get type => throw _privateConstructorUsedError; + + /// The status of the item. + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? get status => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult when({ + required TResult Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + ItemRole role, + List content) + message, + required TResult Function( + String id, + ObjectType object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String name, + String arguments) + functionCall, + required TResult Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String output) + functionCallOutput, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + ItemRole role, + List content)? + message, + TResult? Function( + String id, + ObjectType object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String name, + String arguments)? + functionCall, + TResult? Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String output)? + functionCallOutput, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + ItemRole role, + List content)? + message, + TResult Function( + String id, + ObjectType object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String name, + String arguments)? + functionCall, + TResult Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String output)? + functionCallOutput, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(ItemMessage value) message, + required TResult Function(ItemFunctionCall value) functionCall, + required TResult Function(ItemFunctionCallOutput value) functionCallOutput, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ItemMessage value)? message, + TResult? Function(ItemFunctionCall value)? functionCall, + TResult? Function(ItemFunctionCallOutput value)? functionCallOutput, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ItemMessage value)? message, + TResult Function(ItemFunctionCall value)? functionCall, + TResult Function(ItemFunctionCallOutput value)? functionCallOutput, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + + /// Serializes this Item to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of Item + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $ItemCopyWith get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ItemCopyWith<$Res> { + factory $ItemCopyWith(Item value, $Res Function(Item) then) = + _$ItemCopyWithImpl<$Res, Item>; + @useResult + $Res call( + {String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status}); +} + +/// @nodoc +class _$ItemCopyWithImpl<$Res, $Val extends Item> + implements $ItemCopyWith<$Res> { + _$ItemCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of Item + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? object = null, + Object? type = null, + Object? status = freezed, + }) { + return _then(_value.copyWith( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + object: null == object + ? _value.object! + : object // ignore: cast_nullable_to_non_nullable + as ObjectType, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as ItemType, + status: freezed == status + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as ItemStatus?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$ItemMessageImplCopyWith<$Res> implements $ItemCopyWith<$Res> { + factory _$$ItemMessageImplCopyWith( + _$ItemMessageImpl value, $Res Function(_$ItemMessageImpl) then) = + __$$ItemMessageImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + ItemRole role, + List content}); +} + +/// @nodoc +class __$$ItemMessageImplCopyWithImpl<$Res> + extends _$ItemCopyWithImpl<$Res, _$ItemMessageImpl> + implements _$$ItemMessageImplCopyWith<$Res> { + __$$ItemMessageImplCopyWithImpl( + _$ItemMessageImpl _value, $Res Function(_$ItemMessageImpl) _then) + : super(_value, _then); + + /// Create a copy of Item + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? object = freezed, + Object? type = null, + Object? status = freezed, + Object? role = null, + Object? content = null, + }) { + return _then(_$ItemMessageImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + object: freezed == object + ? _value.object + : object // ignore: cast_nullable_to_non_nullable + as ObjectType?, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as ItemType, + status: freezed == status + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as ItemStatus?, + role: null == role + ? _value.role + : role // ignore: cast_nullable_to_non_nullable + as ItemRole, + content: null == content + ? _value._content + : content // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ItemMessageImpl extends ItemMessage { + const _$ItemMessageImpl( + {required this.id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + this.object, + this.type = ItemType.message, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + this.status, + required this.role, + required final List content}) + : _content = content, + super._(); + + factory _$ItemMessageImpl.fromJson(Map json) => + _$$ItemMessageImplFromJson(json); + + /// The unique ID of the item. + @override + final String id; + + /// The object type, must be "realtime.item". + @override + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final ObjectType? object; + + /// The type of the item. + @override + @JsonKey() + final ItemType type; + + /// The status of the item. + @override + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final ItemStatus? status; + + /// The role of the message sender. + @override + final ItemRole role; + + /// The content of the message. + final List _content; + + /// The content of the message. + @override + List get content { + if (_content is EqualUnmodifiableListView) return _content; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_content); + } + + @override + String toString() { + return 'Item.message(id: $id, object: $object, type: $type, status: $status, role: $role, content: $content)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ItemMessageImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.object, object) || other.object == object) && + (identical(other.type, type) || other.type == type) && + (identical(other.status, status) || other.status == status) && + (identical(other.role, role) || other.role == role) && + const DeepCollectionEquality().equals(other._content, _content)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, object, type, status, role, + const DeepCollectionEquality().hash(_content)); + + /// Create a copy of Item + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ItemMessageImplCopyWith<_$ItemMessageImpl> get copyWith => + __$$ItemMessageImplCopyWithImpl<_$ItemMessageImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + ItemRole role, + List content) + message, + required TResult Function( + String id, + ObjectType object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String name, + String arguments) + functionCall, + required TResult Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String output) + functionCallOutput, + }) { + return message(id, object, type, status, role, content); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + ItemRole role, + List content)? + message, + TResult? Function( + String id, + ObjectType object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String name, + String arguments)? + functionCall, + TResult? Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String output)? + functionCallOutput, + }) { + return message?.call(id, object, type, status, role, content); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + ItemRole role, + List content)? + message, + TResult Function( + String id, + ObjectType object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String name, + String arguments)? + functionCall, + TResult Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String output)? + functionCallOutput, + required TResult orElse(), + }) { + if (message != null) { + return message(id, object, type, status, role, content); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ItemMessage value) message, + required TResult Function(ItemFunctionCall value) functionCall, + required TResult Function(ItemFunctionCallOutput value) functionCallOutput, + }) { + return message(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ItemMessage value)? message, + TResult? Function(ItemFunctionCall value)? functionCall, + TResult? Function(ItemFunctionCallOutput value)? functionCallOutput, + }) { + return message?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ItemMessage value)? message, + TResult Function(ItemFunctionCall value)? functionCall, + TResult Function(ItemFunctionCallOutput value)? functionCallOutput, + required TResult orElse(), + }) { + if (message != null) { + return message(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$ItemMessageImplToJson( + this, + ); + } +} + +abstract class ItemMessage extends Item { + const factory ItemMessage( + {required final String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final ObjectType? object, + final ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final ItemStatus? status, + required final ItemRole role, + required final List content}) = _$ItemMessageImpl; + const ItemMessage._() : super._(); + + factory ItemMessage.fromJson(Map json) = + _$ItemMessageImpl.fromJson; + + /// The unique ID of the item. + @override + String get id; + + /// The object type, must be "realtime.item". + @override + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? get object; + + /// The type of the item. + @override + ItemType get type; + + /// The status of the item. + @override + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? get status; + + /// The role of the message sender. + ItemRole get role; + + /// The content of the message. + List get content; + + /// Create a copy of Item + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ItemMessageImplCopyWith<_$ItemMessageImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$ItemFunctionCallImplCopyWith<$Res> + implements $ItemCopyWith<$Res> { + factory _$$ItemFunctionCallImplCopyWith(_$ItemFunctionCallImpl value, + $Res Function(_$ItemFunctionCallImpl) then) = + __$$ItemFunctionCallImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String id, + ObjectType object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String name, + String arguments}); +} + +/// @nodoc +class __$$ItemFunctionCallImplCopyWithImpl<$Res> + extends _$ItemCopyWithImpl<$Res, _$ItemFunctionCallImpl> + implements _$$ItemFunctionCallImplCopyWith<$Res> { + __$$ItemFunctionCallImplCopyWithImpl(_$ItemFunctionCallImpl _value, + $Res Function(_$ItemFunctionCallImpl) _then) + : super(_value, _then); + + /// Create a copy of Item + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? object = null, + Object? type = null, + Object? status = freezed, + Object? callId = null, + Object? name = null, + Object? arguments = null, + }) { + return _then(_$ItemFunctionCallImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + object: null == object + ? _value.object + : object // ignore: cast_nullable_to_non_nullable + as ObjectType, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as ItemType, + status: freezed == status + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as ItemStatus?, + callId: null == callId + ? _value.callId + : callId // ignore: cast_nullable_to_non_nullable + as String, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + arguments: null == arguments + ? _value.arguments + : arguments // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ItemFunctionCallImpl extends ItemFunctionCall { + const _$ItemFunctionCallImpl( + {required this.id, + this.object = ObjectType.realtimeItem, + this.type = ItemType.functionCall, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + this.status, + @JsonKey(name: 'call_id') required this.callId, + required this.name, + required this.arguments}) + : super._(); + + factory _$ItemFunctionCallImpl.fromJson(Map json) => + _$$ItemFunctionCallImplFromJson(json); + + /// The unique ID of the item. + @override + final String id; + + /// The object type. + @override + @JsonKey() + final ObjectType object; + + /// The type of the item. + @override + @JsonKey() + final ItemType type; + + /// The status of the item. + @override + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final ItemStatus? status; + + /// The ID of the function call. + @override + @JsonKey(name: 'call_id') + final String callId; + + /// The name of the function being called. + @override + final String name; + + /// The arguments of the function call. + @override + final String arguments; + + @override + String toString() { + return 'Item.functionCall(id: $id, object: $object, type: $type, status: $status, callId: $callId, name: $name, arguments: $arguments)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ItemFunctionCallImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.object, object) || other.object == object) && + (identical(other.type, type) || other.type == type) && + (identical(other.status, status) || other.status == status) && + (identical(other.callId, callId) || other.callId == callId) && + (identical(other.name, name) || other.name == name) && + (identical(other.arguments, arguments) || + other.arguments == arguments)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, id, object, type, status, callId, name, arguments); + + /// Create a copy of Item + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ItemFunctionCallImplCopyWith<_$ItemFunctionCallImpl> get copyWith => + __$$ItemFunctionCallImplCopyWithImpl<_$ItemFunctionCallImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + ItemRole role, + List content) + message, + required TResult Function( + String id, + ObjectType object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String name, + String arguments) + functionCall, + required TResult Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String output) + functionCallOutput, + }) { + return functionCall(id, object, type, status, callId, name, arguments); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + ItemRole role, + List content)? + message, + TResult? Function( + String id, + ObjectType object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String name, + String arguments)? + functionCall, + TResult? Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String output)? + functionCallOutput, + }) { + return functionCall?.call( + id, object, type, status, callId, name, arguments); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + ItemRole role, + List content)? + message, + TResult Function( + String id, + ObjectType object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String name, + String arguments)? + functionCall, + TResult Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String output)? + functionCallOutput, + required TResult orElse(), + }) { + if (functionCall != null) { + return functionCall(id, object, type, status, callId, name, arguments); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ItemMessage value) message, + required TResult Function(ItemFunctionCall value) functionCall, + required TResult Function(ItemFunctionCallOutput value) functionCallOutput, + }) { + return functionCall(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ItemMessage value)? message, + TResult? Function(ItemFunctionCall value)? functionCall, + TResult? Function(ItemFunctionCallOutput value)? functionCallOutput, + }) { + return functionCall?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ItemMessage value)? message, + TResult Function(ItemFunctionCall value)? functionCall, + TResult Function(ItemFunctionCallOutput value)? functionCallOutput, + required TResult orElse(), + }) { + if (functionCall != null) { + return functionCall(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$ItemFunctionCallImplToJson( + this, + ); + } +} + +abstract class ItemFunctionCall extends Item { + const factory ItemFunctionCall( + {required final String id, + final ObjectType object, + final ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final ItemStatus? status, + @JsonKey(name: 'call_id') required final String callId, + required final String name, + required final String arguments}) = _$ItemFunctionCallImpl; + const ItemFunctionCall._() : super._(); + + factory ItemFunctionCall.fromJson(Map json) = + _$ItemFunctionCallImpl.fromJson; + + /// The unique ID of the item. + @override + String get id; + + /// The object type. + @override + ObjectType get object; + + /// The type of the item. + @override + ItemType get type; + + /// The status of the item. + @override + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? get status; + + /// The ID of the function call. + @JsonKey(name: 'call_id') + String get callId; + + /// The name of the function being called. + String get name; + + /// The arguments of the function call. + String get arguments; + + /// Create a copy of Item + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ItemFunctionCallImplCopyWith<_$ItemFunctionCallImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$ItemFunctionCallOutputImplCopyWith<$Res> + implements $ItemCopyWith<$Res> { + factory _$$ItemFunctionCallOutputImplCopyWith( + _$ItemFunctionCallOutputImpl value, + $Res Function(_$ItemFunctionCallOutputImpl) then) = + __$$ItemFunctionCallOutputImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String output}); +} + +/// @nodoc +class __$$ItemFunctionCallOutputImplCopyWithImpl<$Res> + extends _$ItemCopyWithImpl<$Res, _$ItemFunctionCallOutputImpl> + implements _$$ItemFunctionCallOutputImplCopyWith<$Res> { + __$$ItemFunctionCallOutputImplCopyWithImpl( + _$ItemFunctionCallOutputImpl _value, + $Res Function(_$ItemFunctionCallOutputImpl) _then) + : super(_value, _then); + + /// Create a copy of Item + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = null, + Object? object = freezed, + Object? type = null, + Object? status = freezed, + Object? callId = null, + Object? output = null, + }) { + return _then(_$ItemFunctionCallOutputImpl( + id: null == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as String, + object: freezed == object + ? _value.object + : object // ignore: cast_nullable_to_non_nullable + as ObjectType?, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as ItemType, + status: freezed == status + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as ItemStatus?, + callId: null == callId + ? _value.callId + : callId // ignore: cast_nullable_to_non_nullable + as String, + output: null == output + ? _value.output + : output // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ItemFunctionCallOutputImpl extends ItemFunctionCallOutput { + const _$ItemFunctionCallOutputImpl( + {required this.id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + this.object, + this.type = ItemType.functionCallOutput, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + this.status, + @JsonKey(name: 'call_id') required this.callId, + required this.output}) + : super._(); + + factory _$ItemFunctionCallOutputImpl.fromJson(Map json) => + _$$ItemFunctionCallOutputImplFromJson(json); + + /// The unique ID of the item. + @override + final String id; + + /// The object type. Always "realtime.item". + @override + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final ObjectType? object; + + /// The type of the item. + @override + @JsonKey() + final ItemType type; + + /// The status of the item. + @override + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final ItemStatus? status; + + /// The ID of the function call. + @override + @JsonKey(name: 'call_id') + final String callId; + + /// The output of the function call. + @override + final String output; + + @override + String toString() { + return 'Item.functionCallOutput(id: $id, object: $object, type: $type, status: $status, callId: $callId, output: $output)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ItemFunctionCallOutputImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.object, object) || other.object == object) && + (identical(other.type, type) || other.type == type) && + (identical(other.status, status) || other.status == status) && + (identical(other.callId, callId) || other.callId == callId) && + (identical(other.output, output) || other.output == output)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, id, object, type, status, callId, output); + + /// Create a copy of Item + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ItemFunctionCallOutputImplCopyWith<_$ItemFunctionCallOutputImpl> + get copyWith => __$$ItemFunctionCallOutputImplCopyWithImpl< + _$ItemFunctionCallOutputImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + ItemRole role, + List content) + message, + required TResult Function( + String id, + ObjectType object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String name, + String arguments) + functionCall, + required TResult Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String output) + functionCallOutput, + }) { + return functionCallOutput(id, object, type, status, callId, output); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + ItemRole role, + List content)? + message, + TResult? Function( + String id, + ObjectType object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String name, + String arguments)? + functionCall, + TResult? Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String output)? + functionCallOutput, + }) { + return functionCallOutput?.call(id, object, type, status, callId, output); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + ItemRole role, + List content)? + message, + TResult Function( + String id, + ObjectType object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String name, + String arguments)? + functionCall, + TResult Function( + String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? object, + ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? status, + @JsonKey(name: 'call_id') String callId, + String output)? + functionCallOutput, + required TResult orElse(), + }) { + if (functionCallOutput != null) { + return functionCallOutput(id, object, type, status, callId, output); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ItemMessage value) message, + required TResult Function(ItemFunctionCall value) functionCall, + required TResult Function(ItemFunctionCallOutput value) functionCallOutput, + }) { + return functionCallOutput(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ItemMessage value)? message, + TResult? Function(ItemFunctionCall value)? functionCall, + TResult? Function(ItemFunctionCallOutput value)? functionCallOutput, + }) { + return functionCallOutput?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ItemMessage value)? message, + TResult Function(ItemFunctionCall value)? functionCall, + TResult Function(ItemFunctionCallOutput value)? functionCallOutput, + required TResult orElse(), + }) { + if (functionCallOutput != null) { + return functionCallOutput(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$ItemFunctionCallOutputImplToJson( + this, + ); + } +} + +abstract class ItemFunctionCallOutput extends Item { + const factory ItemFunctionCallOutput( + {required final String id, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final ObjectType? object, + final ItemType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final ItemStatus? status, + @JsonKey(name: 'call_id') required final String callId, + required final String output}) = _$ItemFunctionCallOutputImpl; + const ItemFunctionCallOutput._() : super._(); + + factory ItemFunctionCallOutput.fromJson(Map json) = + _$ItemFunctionCallOutputImpl.fromJson; + + /// The unique ID of the item. + @override + String get id; + + /// The object type. Always "realtime.item". + @override + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ObjectType? get object; + + /// The type of the item. + @override + ItemType get type; + + /// The status of the item. + @override + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ItemStatus? get status; + + /// The ID of the function call. + @JsonKey(name: 'call_id') + String get callId; + + /// The output of the function call. + String get output; + + /// Create a copy of Item + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ItemFunctionCallOutputImplCopyWith<_$ItemFunctionCallOutputImpl> + get copyWith => throw _privateConstructorUsedError; +} + +ResponseStatusDetails _$ResponseStatusDetailsFromJson( + Map json) { + switch (json['type']) { + case 'incomplete': + return ResponseStatusDetailsIncomplete.fromJson(json); + case 'failed': + return ResponseStatusDetailsFailed.fromJson(json); + + default: + throw CheckedFromJsonException(json, 'type', 'ResponseStatusDetails', + 'Invalid union type "${json['type']}"!'); + } +} + +/// @nodoc +mixin _$ResponseStatusDetails { + /// The type of the status. + ResponseStatusType get type => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult when({ + required TResult Function( + ResponseStatusType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ResponseStatusIncompleteReason? reason) + incomplete, + required TResult Function(ResponseStatusType type, + @JsonKey(includeIfNull: false) APIError? error) + failed, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + ResponseStatusType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ResponseStatusIncompleteReason? reason)? + incomplete, + TResult? Function(ResponseStatusType type, + @JsonKey(includeIfNull: false) APIError? error)? + failed, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + ResponseStatusType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ResponseStatusIncompleteReason? reason)? + incomplete, + TResult Function(ResponseStatusType type, + @JsonKey(includeIfNull: false) APIError? error)? + failed, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(ResponseStatusDetailsIncomplete value) incomplete, + required TResult Function(ResponseStatusDetailsFailed value) failed, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ResponseStatusDetailsIncomplete value)? incomplete, + TResult? Function(ResponseStatusDetailsFailed value)? failed, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ResponseStatusDetailsIncomplete value)? incomplete, + TResult Function(ResponseStatusDetailsFailed value)? failed, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + + /// Serializes this ResponseStatusDetails to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of ResponseStatusDetails + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $ResponseStatusDetailsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ResponseStatusDetailsCopyWith<$Res> { + factory $ResponseStatusDetailsCopyWith(ResponseStatusDetails value, + $Res Function(ResponseStatusDetails) then) = + _$ResponseStatusDetailsCopyWithImpl<$Res, ResponseStatusDetails>; + @useResult + $Res call({ResponseStatusType type}); +} + +/// @nodoc +class _$ResponseStatusDetailsCopyWithImpl<$Res, + $Val extends ResponseStatusDetails> + implements $ResponseStatusDetailsCopyWith<$Res> { + _$ResponseStatusDetailsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of ResponseStatusDetails + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + }) { + return _then(_value.copyWith( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as ResponseStatusType, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$ResponseStatusDetailsIncompleteImplCopyWith<$Res> + implements $ResponseStatusDetailsCopyWith<$Res> { + factory _$$ResponseStatusDetailsIncompleteImplCopyWith( + _$ResponseStatusDetailsIncompleteImpl value, + $Res Function(_$ResponseStatusDetailsIncompleteImpl) then) = + __$$ResponseStatusDetailsIncompleteImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {ResponseStatusType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ResponseStatusIncompleteReason? reason}); +} + +/// @nodoc +class __$$ResponseStatusDetailsIncompleteImplCopyWithImpl<$Res> + extends _$ResponseStatusDetailsCopyWithImpl<$Res, + _$ResponseStatusDetailsIncompleteImpl> + implements _$$ResponseStatusDetailsIncompleteImplCopyWith<$Res> { + __$$ResponseStatusDetailsIncompleteImplCopyWithImpl( + _$ResponseStatusDetailsIncompleteImpl _value, + $Res Function(_$ResponseStatusDetailsIncompleteImpl) _then) + : super(_value, _then); + + /// Create a copy of ResponseStatusDetails + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? reason = freezed, + }) { + return _then(_$ResponseStatusDetailsIncompleteImpl( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as ResponseStatusType, + reason: freezed == reason + ? _value.reason + : reason // ignore: cast_nullable_to_non_nullable + as ResponseStatusIncompleteReason?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ResponseStatusDetailsIncompleteImpl + extends ResponseStatusDetailsIncomplete { + const _$ResponseStatusDetailsIncompleteImpl( + {this.type = ResponseStatusType.incomplete, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + this.reason}) + : super._(); + + factory _$ResponseStatusDetailsIncompleteImpl.fromJson( + Map json) => + _$$ResponseStatusDetailsIncompleteImplFromJson(json); + + /// The type of the status. + @override + @JsonKey() + final ResponseStatusType type; + + /// The reason the response is incomplete. + @override + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final ResponseStatusIncompleteReason? reason; + + @override + String toString() { + return 'ResponseStatusDetails.incomplete(type: $type, reason: $reason)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ResponseStatusDetailsIncompleteImpl && + (identical(other.type, type) || other.type == type) && + (identical(other.reason, reason) || other.reason == reason)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, type, reason); + + /// Create a copy of ResponseStatusDetails + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ResponseStatusDetailsIncompleteImplCopyWith< + _$ResponseStatusDetailsIncompleteImpl> + get copyWith => __$$ResponseStatusDetailsIncompleteImplCopyWithImpl< + _$ResponseStatusDetailsIncompleteImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + ResponseStatusType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ResponseStatusIncompleteReason? reason) + incomplete, + required TResult Function(ResponseStatusType type, + @JsonKey(includeIfNull: false) APIError? error) + failed, + }) { + return incomplete(type, reason); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + ResponseStatusType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ResponseStatusIncompleteReason? reason)? + incomplete, + TResult? Function(ResponseStatusType type, + @JsonKey(includeIfNull: false) APIError? error)? + failed, + }) { + return incomplete?.call(type, reason); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + ResponseStatusType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ResponseStatusIncompleteReason? reason)? + incomplete, + TResult Function(ResponseStatusType type, + @JsonKey(includeIfNull: false) APIError? error)? + failed, + required TResult orElse(), + }) { + if (incomplete != null) { + return incomplete(type, reason); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ResponseStatusDetailsIncomplete value) incomplete, + required TResult Function(ResponseStatusDetailsFailed value) failed, + }) { + return incomplete(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ResponseStatusDetailsIncomplete value)? incomplete, + TResult? Function(ResponseStatusDetailsFailed value)? failed, + }) { + return incomplete?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ResponseStatusDetailsIncomplete value)? incomplete, + TResult Function(ResponseStatusDetailsFailed value)? failed, + required TResult orElse(), + }) { + if (incomplete != null) { + return incomplete(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$ResponseStatusDetailsIncompleteImplToJson( + this, + ); + } +} + +abstract class ResponseStatusDetailsIncomplete extends ResponseStatusDetails { + const factory ResponseStatusDetailsIncomplete( + {final ResponseStatusType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final ResponseStatusIncompleteReason? reason}) = + _$ResponseStatusDetailsIncompleteImpl; + const ResponseStatusDetailsIncomplete._() : super._(); + + factory ResponseStatusDetailsIncomplete.fromJson(Map json) = + _$ResponseStatusDetailsIncompleteImpl.fromJson; + + /// The type of the status. + @override + ResponseStatusType get type; + + /// The reason the response is incomplete. + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ResponseStatusIncompleteReason? get reason; + + /// Create a copy of ResponseStatusDetails + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ResponseStatusDetailsIncompleteImplCopyWith< + _$ResponseStatusDetailsIncompleteImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$ResponseStatusDetailsFailedImplCopyWith<$Res> + implements $ResponseStatusDetailsCopyWith<$Res> { + factory _$$ResponseStatusDetailsFailedImplCopyWith( + _$ResponseStatusDetailsFailedImpl value, + $Res Function(_$ResponseStatusDetailsFailedImpl) then) = + __$$ResponseStatusDetailsFailedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {ResponseStatusType type, + @JsonKey(includeIfNull: false) APIError? error}); + + $APIErrorCopyWith<$Res>? get error; +} + +/// @nodoc +class __$$ResponseStatusDetailsFailedImplCopyWithImpl<$Res> + extends _$ResponseStatusDetailsCopyWithImpl<$Res, + _$ResponseStatusDetailsFailedImpl> + implements _$$ResponseStatusDetailsFailedImplCopyWith<$Res> { + __$$ResponseStatusDetailsFailedImplCopyWithImpl( + _$ResponseStatusDetailsFailedImpl _value, + $Res Function(_$ResponseStatusDetailsFailedImpl) _then) + : super(_value, _then); + + /// Create a copy of ResponseStatusDetails + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? error = freezed, + }) { + return _then(_$ResponseStatusDetailsFailedImpl( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as ResponseStatusType, + error: freezed == error + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as APIError?, + )); + } + + /// Create a copy of ResponseStatusDetails + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $APIErrorCopyWith<$Res>? get error { + if (_value.error == null) { + return null; + } + + return $APIErrorCopyWith<$Res>(_value.error!, (value) { + return _then(_value.copyWith(error: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$ResponseStatusDetailsFailedImpl extends ResponseStatusDetailsFailed { + const _$ResponseStatusDetailsFailedImpl( + {this.type = ResponseStatusType.failed, + @JsonKey(includeIfNull: false) this.error}) + : super._(); + + factory _$ResponseStatusDetailsFailedImpl.fromJson( + Map json) => + _$$ResponseStatusDetailsFailedImplFromJson(json); + + /// The type of the status. + @override + @JsonKey() + final ResponseStatusType type; + + /// Details of the API error. + @override + @JsonKey(includeIfNull: false) + final APIError? error; + + @override + String toString() { + return 'ResponseStatusDetails.failed(type: $type, error: $error)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ResponseStatusDetailsFailedImpl && + (identical(other.type, type) || other.type == type) && + (identical(other.error, error) || other.error == error)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, type, error); + + /// Create a copy of ResponseStatusDetails + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ResponseStatusDetailsFailedImplCopyWith<_$ResponseStatusDetailsFailedImpl> + get copyWith => __$$ResponseStatusDetailsFailedImplCopyWithImpl< + _$ResponseStatusDetailsFailedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + ResponseStatusType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ResponseStatusIncompleteReason? reason) + incomplete, + required TResult Function(ResponseStatusType type, + @JsonKey(includeIfNull: false) APIError? error) + failed, + }) { + return failed(type, error); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + ResponseStatusType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ResponseStatusIncompleteReason? reason)? + incomplete, + TResult? Function(ResponseStatusType type, + @JsonKey(includeIfNull: false) APIError? error)? + failed, + }) { + return failed?.call(type, error); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + ResponseStatusType type, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + ResponseStatusIncompleteReason? reason)? + incomplete, + TResult Function(ResponseStatusType type, + @JsonKey(includeIfNull: false) APIError? error)? + failed, + required TResult orElse(), + }) { + if (failed != null) { + return failed(type, error); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ResponseStatusDetailsIncomplete value) incomplete, + required TResult Function(ResponseStatusDetailsFailed value) failed, + }) { + return failed(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ResponseStatusDetailsIncomplete value)? incomplete, + TResult? Function(ResponseStatusDetailsFailed value)? failed, + }) { + return failed?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ResponseStatusDetailsIncomplete value)? incomplete, + TResult Function(ResponseStatusDetailsFailed value)? failed, + required TResult orElse(), + }) { + if (failed != null) { + return failed(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$ResponseStatusDetailsFailedImplToJson( + this, + ); + } +} + +abstract class ResponseStatusDetailsFailed extends ResponseStatusDetails { + const factory ResponseStatusDetailsFailed( + {final ResponseStatusType type, + @JsonKey(includeIfNull: false) final APIError? error}) = + _$ResponseStatusDetailsFailedImpl; + const ResponseStatusDetailsFailed._() : super._(); + + factory ResponseStatusDetailsFailed.fromJson(Map json) = + _$ResponseStatusDetailsFailedImpl.fromJson; + + /// The type of the status. + @override + ResponseStatusType get type; + + /// Details of the API error. + @JsonKey(includeIfNull: false) + APIError? get error; + + /// Create a copy of ResponseStatusDetails + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ResponseStatusDetailsFailedImplCopyWith<_$ResponseStatusDetailsFailedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +RealtimeEvent _$RealtimeEventFromJson(Map json) { + switch (json['type']) { + case 'conversation.item.create': + return RealtimeEventConversationItemCreate.fromJson(json); + case 'conversation.item.delete': + return RealtimeEventConversationItemDelete.fromJson(json); + case 'conversation.item.truncate': + return RealtimeEventConversationItemTruncate.fromJson(json); + case 'input_audio_buffer.append': + return RealtimeEventInputAudioBufferAppend.fromJson(json); + case 'input_audio_buffer.clear': + return RealtimeEventInputAudioBufferClear.fromJson(json); + case 'input_audio_buffer.commit': + return RealtimeEventInputAudioBufferCommit.fromJson(json); + case 'response.cancel': + return RealtimeEventResponseCancel.fromJson(json); + case 'response.create': + return RealtimeEventResponseCreate.fromJson(json); + case 'session.update': + return RealtimeEventSessionUpdate.fromJson(json); + case 'conversation.created': + return RealtimeEventConversationCreated.fromJson(json); + case 'conversation.item.created': + return RealtimeEventConversationItemCreated.fromJson(json); + case 'conversation.item.deleted': + return RealtimeEventConversationItemDeleted.fromJson(json); + case 'conversation.item.input_audio_transcription.completed': + return RealtimeEventConversationItemInputAudioTranscriptionCompleted + .fromJson(json); + case 'conversation.item.input_audio_transcription.failed': + return RealtimeEventConversationItemInputAudioTranscriptionFailed + .fromJson(json); + case 'conversation.item.truncated': + return RealtimeEventConversationItemTruncated.fromJson(json); + case 'error': + return RealtimeEventError.fromJson(json); + case 'input_audio_buffer.cleared': + return RealtimeEventInputAudioBufferCleared.fromJson(json); + case 'input_audio_buffer.committed': + return RealtimeEventInputAudioBufferCommitted.fromJson(json); + case 'input_audio_buffer.speech_started': + return RealtimeEventInputAudioBufferSpeechStarted.fromJson(json); + case 'input_audio_buffer.speech_stopped': + return RealtimeEventInputAudioBufferSpeechStopped.fromJson(json); + case 'rate_limits.updated': + return RealtimeEventRateLimitsUpdated.fromJson(json); + case 'response.audio.delta': + return RealtimeEventResponseAudioDelta.fromJson(json); + case 'response.audio.done': + return RealtimeEventResponseAudioDone.fromJson(json); + case 'response.audio_transcript.delta': + return RealtimeEventResponseAudioTranscriptDelta.fromJson(json); + case 'response.audio_transcript.done': + return RealtimeEventResponseAudioTranscriptDone.fromJson(json); + case 'response.content_part.added': + return RealtimeEventResponseContentPartAdded.fromJson(json); + case 'response.content_part.done': + return RealtimeEventResponseContentPartDone.fromJson(json); + case 'response.created': + return RealtimeEventResponseCreated.fromJson(json); + case 'response.done': + return RealtimeEventResponseDone.fromJson(json); + case 'response.function_call_arguments.delta': + return RealtimeEventResponseFunctionCallArgumentsDelta.fromJson(json); + case 'response.function_call_arguments.done': + return RealtimeEventResponseFunctionCallArgumentsDone.fromJson(json); + case 'response.output_item.added': + return RealtimeEventResponseOutputItemAdded.fromJson(json); + case 'response.output_item.done': + return RealtimeEventResponseOutputItemDone.fromJson(json); + case 'response.text.delta': + return RealtimeEventResponseTextDelta.fromJson(json); + case 'response.text.done': + return RealtimeEventResponseTextDone.fromJson(json); + case 'session.created': + return RealtimeEventSessionCreated.fromJson(json); + case 'session.updated': + return RealtimeEventSessionUpdated.fromJson(json); + case 'close': + return RealtimeEventClose.fromJson(json); + case 'conversation.interrupted': + return RealtimeEventConversationInterrupted.fromJson(json); + case 'conversation.updated': + return RealtimeEventConversationUpdated.fromJson(json); + case 'conversation.item.appended': + return RealtimeEventConversationItemAppended.fromJson(json); + case 'conversation.item.completed': + return RealtimeEventConversationItemCompleted.fromJson(json); + case 'realtime.event': + return RealtimeEventGeneric.fromJson(json); + + default: + throw CheckedFromJsonException(json, 'type', 'RealtimeEvent', + 'Invalid union type "${json['type']}"!'); + } +} + +/// @nodoc +mixin _$RealtimeEvent { + /// Optional client-generated ID used to identify this event. + @JsonKey(name: 'event_id') + String? get eventId => throw _privateConstructorUsedError; + + /// The type of the event. + RealtimeEventType get type => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + + /// Serializes this RealtimeEvent to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $RealtimeEventCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $RealtimeEventCopyWith<$Res> { + factory $RealtimeEventCopyWith( + RealtimeEvent value, $Res Function(RealtimeEvent) then) = + _$RealtimeEventCopyWithImpl<$Res, RealtimeEvent>; + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, RealtimeEventType type}); +} + +/// @nodoc +class _$RealtimeEventCopyWithImpl<$Res, $Val extends RealtimeEvent> + implements $RealtimeEventCopyWith<$Res> { + _$RealtimeEventCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + }) { + return _then(_value.copyWith( + eventId: null == eventId + ? _value.eventId! + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$RealtimeEventConversationItemCreateImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventConversationItemCreateImplCopyWith( + _$RealtimeEventConversationItemCreateImpl value, + $Res Function(_$RealtimeEventConversationItemCreateImpl) then) = + __$$RealtimeEventConversationItemCreateImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item}); + + $ItemCopyWith<$Res> get item; +} + +/// @nodoc +class __$$RealtimeEventConversationItemCreateImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventConversationItemCreateImpl> + implements _$$RealtimeEventConversationItemCreateImplCopyWith<$Res> { + __$$RealtimeEventConversationItemCreateImplCopyWithImpl( + _$RealtimeEventConversationItemCreateImpl _value, + $Res Function(_$RealtimeEventConversationItemCreateImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? previousItemId = freezed, + Object? item = null, + }) { + return _then(_$RealtimeEventConversationItemCreateImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + previousItemId: freezed == previousItemId + ? _value.previousItemId + : previousItemId // ignore: cast_nullable_to_non_nullable + as String?, + item: null == item + ? _value.item + : item // ignore: cast_nullable_to_non_nullable + as Item, + )); + } + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ItemCopyWith<$Res> get item { + return $ItemCopyWith<$Res>(_value.item, (value) { + return _then(_value.copyWith(item: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventConversationItemCreateImpl + extends RealtimeEventConversationItemCreate { + const _$RealtimeEventConversationItemCreateImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.conversationItemCreate, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + this.previousItemId, + required this.item}) + : super._(); + + factory _$RealtimeEventConversationItemCreateImpl.fromJson( + Map json) => + _$$RealtimeEventConversationItemCreateImplFromJson(json); + + /// Optional client-generated ID used to identify this event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the preceding item after which the new item will be inserted. + @override + @JsonKey(name: 'previous_item_id', includeIfNull: false) + final String? previousItemId; + + /// The item to add to the conversation. + /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput] + @override + final Item item; + + @override + String toString() { + return 'RealtimeEvent.conversationItemCreate(eventId: $eventId, type: $type, previousItemId: $previousItemId, item: $item)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventConversationItemCreateImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.previousItemId, previousItemId) || + other.previousItemId == previousItemId) && + (identical(other.item, item) || other.item == item)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, eventId, type, previousItemId, item); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventConversationItemCreateImplCopyWith< + _$RealtimeEventConversationItemCreateImpl> + get copyWith => __$$RealtimeEventConversationItemCreateImplCopyWithImpl< + _$RealtimeEventConversationItemCreateImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return conversationItemCreate(eventId, type, previousItemId, item); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return conversationItemCreate?.call(eventId, type, previousItemId, item); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (conversationItemCreate != null) { + return conversationItemCreate(eventId, type, previousItemId, item); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return conversationItemCreate(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return conversationItemCreate?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (conversationItemCreate != null) { + return conversationItemCreate(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventConversationItemCreateImplToJson( + this, + ); + } +} + +abstract class RealtimeEventConversationItemCreate extends RealtimeEvent { + const factory RealtimeEventConversationItemCreate( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + final String? previousItemId, + required final Item item}) = _$RealtimeEventConversationItemCreateImpl; + const RealtimeEventConversationItemCreate._() : super._(); + + factory RealtimeEventConversationItemCreate.fromJson( + Map json) = + _$RealtimeEventConversationItemCreateImpl.fromJson; + + /// Optional client-generated ID used to identify this event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the preceding item after which the new item will be inserted. + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? get previousItemId; + + /// The item to add to the conversation. + /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput] + Item get item; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventConversationItemCreateImplCopyWith< + _$RealtimeEventConversationItemCreateImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventConversationItemDeleteImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventConversationItemDeleteImplCopyWith( + _$RealtimeEventConversationItemDeleteImpl value, + $Res Function(_$RealtimeEventConversationItemDeleteImpl) then) = + __$$RealtimeEventConversationItemDeleteImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId}); +} + +/// @nodoc +class __$$RealtimeEventConversationItemDeleteImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventConversationItemDeleteImpl> + implements _$$RealtimeEventConversationItemDeleteImplCopyWith<$Res> { + __$$RealtimeEventConversationItemDeleteImplCopyWithImpl( + _$RealtimeEventConversationItemDeleteImpl _value, + $Res Function(_$RealtimeEventConversationItemDeleteImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? itemId = null, + }) { + return _then(_$RealtimeEventConversationItemDeleteImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + itemId: null == itemId + ? _value.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventConversationItemDeleteImpl + extends RealtimeEventConversationItemDelete { + const _$RealtimeEventConversationItemDeleteImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.conversationItemDelete, + @JsonKey(name: 'item_id') required this.itemId}) + : super._(); + + factory _$RealtimeEventConversationItemDeleteImpl.fromJson( + Map json) => + _$$RealtimeEventConversationItemDeleteImplFromJson(json); + + /// Optional client-generated ID used to identify this event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the item to delete. + @override + @JsonKey(name: 'item_id') + final String itemId; + + @override + String toString() { + return 'RealtimeEvent.conversationItemDelete(eventId: $eventId, type: $type, itemId: $itemId)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventConversationItemDeleteImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.itemId, itemId) || other.itemId == itemId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, itemId); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventConversationItemDeleteImplCopyWith< + _$RealtimeEventConversationItemDeleteImpl> + get copyWith => __$$RealtimeEventConversationItemDeleteImplCopyWithImpl< + _$RealtimeEventConversationItemDeleteImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return conversationItemDelete(eventId, type, itemId); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return conversationItemDelete?.call(eventId, type, itemId); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (conversationItemDelete != null) { + return conversationItemDelete(eventId, type, itemId); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return conversationItemDelete(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return conversationItemDelete?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (conversationItemDelete != null) { + return conversationItemDelete(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventConversationItemDeleteImplToJson( + this, + ); + } +} + +abstract class RealtimeEventConversationItemDelete extends RealtimeEvent { + const factory RealtimeEventConversationItemDelete( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'item_id') required final String itemId}) = + _$RealtimeEventConversationItemDeleteImpl; + const RealtimeEventConversationItemDelete._() : super._(); + + factory RealtimeEventConversationItemDelete.fromJson( + Map json) = + _$RealtimeEventConversationItemDeleteImpl.fromJson; + + /// Optional client-generated ID used to identify this event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the item to delete. + @JsonKey(name: 'item_id') + String get itemId; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventConversationItemDeleteImplCopyWith< + _$RealtimeEventConversationItemDeleteImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventConversationItemTruncateImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventConversationItemTruncateImplCopyWith( + _$RealtimeEventConversationItemTruncateImpl value, + $Res Function(_$RealtimeEventConversationItemTruncateImpl) then) = + __$$RealtimeEventConversationItemTruncateImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs}); +} + +/// @nodoc +class __$$RealtimeEventConversationItemTruncateImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventConversationItemTruncateImpl> + implements _$$RealtimeEventConversationItemTruncateImplCopyWith<$Res> { + __$$RealtimeEventConversationItemTruncateImplCopyWithImpl( + _$RealtimeEventConversationItemTruncateImpl _value, + $Res Function(_$RealtimeEventConversationItemTruncateImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? itemId = null, + Object? contentIndex = null, + Object? audioEndMs = null, + }) { + return _then(_$RealtimeEventConversationItemTruncateImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + itemId: null == itemId + ? _value.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + contentIndex: null == contentIndex + ? _value.contentIndex + : contentIndex // ignore: cast_nullable_to_non_nullable + as int, + audioEndMs: null == audioEndMs + ? _value.audioEndMs + : audioEndMs // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventConversationItemTruncateImpl + extends RealtimeEventConversationItemTruncate { + const _$RealtimeEventConversationItemTruncateImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.conversationItemTruncate, + @JsonKey(name: 'item_id') required this.itemId, + @JsonKey(name: 'content_index') required this.contentIndex, + @JsonKey(name: 'audio_end_ms') required this.audioEndMs}) + : super._(); + + factory _$RealtimeEventConversationItemTruncateImpl.fromJson( + Map json) => + _$$RealtimeEventConversationItemTruncateImplFromJson(json); + + /// Optional client-generated ID used to identify this event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the assistant message item to truncate. + @override + @JsonKey(name: 'item_id') + final String itemId; + + /// The index of the content part to truncate. + @override + @JsonKey(name: 'content_index') + final int contentIndex; + + /// Inclusive duration up to which audio is truncated, in milliseconds. + @override + @JsonKey(name: 'audio_end_ms') + final int audioEndMs; + + @override + String toString() { + return 'RealtimeEvent.conversationItemTruncate(eventId: $eventId, type: $type, itemId: $itemId, contentIndex: $contentIndex, audioEndMs: $audioEndMs)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventConversationItemTruncateImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.itemId, itemId) || other.itemId == itemId) && + (identical(other.contentIndex, contentIndex) || + other.contentIndex == contentIndex) && + (identical(other.audioEndMs, audioEndMs) || + other.audioEndMs == audioEndMs)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, eventId, type, itemId, contentIndex, audioEndMs); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventConversationItemTruncateImplCopyWith< + _$RealtimeEventConversationItemTruncateImpl> + get copyWith => __$$RealtimeEventConversationItemTruncateImplCopyWithImpl< + _$RealtimeEventConversationItemTruncateImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return conversationItemTruncate( + eventId, type, itemId, contentIndex, audioEndMs); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return conversationItemTruncate?.call( + eventId, type, itemId, contentIndex, audioEndMs); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (conversationItemTruncate != null) { + return conversationItemTruncate( + eventId, type, itemId, contentIndex, audioEndMs); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return conversationItemTruncate(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return conversationItemTruncate?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (conversationItemTruncate != null) { + return conversationItemTruncate(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventConversationItemTruncateImplToJson( + this, + ); + } +} + +abstract class RealtimeEventConversationItemTruncate extends RealtimeEvent { + const factory RealtimeEventConversationItemTruncate( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'item_id') required final String itemId, + @JsonKey(name: 'content_index') required final int contentIndex, + @JsonKey(name: 'audio_end_ms') required final int audioEndMs}) = + _$RealtimeEventConversationItemTruncateImpl; + const RealtimeEventConversationItemTruncate._() : super._(); + + factory RealtimeEventConversationItemTruncate.fromJson( + Map json) = + _$RealtimeEventConversationItemTruncateImpl.fromJson; + + /// Optional client-generated ID used to identify this event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the assistant message item to truncate. + @JsonKey(name: 'item_id') + String get itemId; + + /// The index of the content part to truncate. + @JsonKey(name: 'content_index') + int get contentIndex; + + /// Inclusive duration up to which audio is truncated, in milliseconds. + @JsonKey(name: 'audio_end_ms') + int get audioEndMs; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventConversationItemTruncateImplCopyWith< + _$RealtimeEventConversationItemTruncateImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventInputAudioBufferAppendImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventInputAudioBufferAppendImplCopyWith( + _$RealtimeEventInputAudioBufferAppendImpl value, + $Res Function(_$RealtimeEventInputAudioBufferAppendImpl) then) = + __$$RealtimeEventInputAudioBufferAppendImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + String audio}); +} + +/// @nodoc +class __$$RealtimeEventInputAudioBufferAppendImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventInputAudioBufferAppendImpl> + implements _$$RealtimeEventInputAudioBufferAppendImplCopyWith<$Res> { + __$$RealtimeEventInputAudioBufferAppendImplCopyWithImpl( + _$RealtimeEventInputAudioBufferAppendImpl _value, + $Res Function(_$RealtimeEventInputAudioBufferAppendImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? audio = null, + }) { + return _then(_$RealtimeEventInputAudioBufferAppendImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + audio: null == audio + ? _value.audio + : audio // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventInputAudioBufferAppendImpl + extends RealtimeEventInputAudioBufferAppend { + const _$RealtimeEventInputAudioBufferAppendImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.inputAudioBufferAppend, + required this.audio}) + : super._(); + + factory _$RealtimeEventInputAudioBufferAppendImpl.fromJson( + Map json) => + _$$RealtimeEventInputAudioBufferAppendImplFromJson(json); + + /// Optional client-generated ID used to identify this event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// Base64-encoded audio bytes. + @override + final String audio; + + @override + String toString() { + return 'RealtimeEvent.inputAudioBufferAppend(eventId: $eventId, type: $type, audio: $audio)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventInputAudioBufferAppendImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.audio, audio) || other.audio == audio)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, audio); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventInputAudioBufferAppendImplCopyWith< + _$RealtimeEventInputAudioBufferAppendImpl> + get copyWith => __$$RealtimeEventInputAudioBufferAppendImplCopyWithImpl< + _$RealtimeEventInputAudioBufferAppendImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return inputAudioBufferAppend(eventId, type, audio); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return inputAudioBufferAppend?.call(eventId, type, audio); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (inputAudioBufferAppend != null) { + return inputAudioBufferAppend(eventId, type, audio); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return inputAudioBufferAppend(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return inputAudioBufferAppend?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (inputAudioBufferAppend != null) { + return inputAudioBufferAppend(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventInputAudioBufferAppendImplToJson( + this, + ); + } +} + +abstract class RealtimeEventInputAudioBufferAppend extends RealtimeEvent { + const factory RealtimeEventInputAudioBufferAppend( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + required final String audio}) = _$RealtimeEventInputAudioBufferAppendImpl; + const RealtimeEventInputAudioBufferAppend._() : super._(); + + factory RealtimeEventInputAudioBufferAppend.fromJson( + Map json) = + _$RealtimeEventInputAudioBufferAppendImpl.fromJson; + + /// Optional client-generated ID used to identify this event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// Base64-encoded audio bytes. + String get audio; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventInputAudioBufferAppendImplCopyWith< + _$RealtimeEventInputAudioBufferAppendImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventInputAudioBufferClearImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventInputAudioBufferClearImplCopyWith( + _$RealtimeEventInputAudioBufferClearImpl value, + $Res Function(_$RealtimeEventInputAudioBufferClearImpl) then) = + __$$RealtimeEventInputAudioBufferClearImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, RealtimeEventType type}); +} + +/// @nodoc +class __$$RealtimeEventInputAudioBufferClearImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventInputAudioBufferClearImpl> + implements _$$RealtimeEventInputAudioBufferClearImplCopyWith<$Res> { + __$$RealtimeEventInputAudioBufferClearImplCopyWithImpl( + _$RealtimeEventInputAudioBufferClearImpl _value, + $Res Function(_$RealtimeEventInputAudioBufferClearImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + }) { + return _then(_$RealtimeEventInputAudioBufferClearImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventInputAudioBufferClearImpl + extends RealtimeEventInputAudioBufferClear { + const _$RealtimeEventInputAudioBufferClearImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.inputAudioBufferClear}) + : super._(); + + factory _$RealtimeEventInputAudioBufferClearImpl.fromJson( + Map json) => + _$$RealtimeEventInputAudioBufferClearImplFromJson(json); + + /// Optional client-generated ID used to identify this event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + @override + String toString() { + return 'RealtimeEvent.inputAudioBufferClear(eventId: $eventId, type: $type)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventInputAudioBufferClearImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventInputAudioBufferClearImplCopyWith< + _$RealtimeEventInputAudioBufferClearImpl> + get copyWith => __$$RealtimeEventInputAudioBufferClearImplCopyWithImpl< + _$RealtimeEventInputAudioBufferClearImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return inputAudioBufferClear(eventId, type); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return inputAudioBufferClear?.call(eventId, type); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (inputAudioBufferClear != null) { + return inputAudioBufferClear(eventId, type); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return inputAudioBufferClear(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return inputAudioBufferClear?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (inputAudioBufferClear != null) { + return inputAudioBufferClear(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventInputAudioBufferClearImplToJson( + this, + ); + } +} + +abstract class RealtimeEventInputAudioBufferClear extends RealtimeEvent { + const factory RealtimeEventInputAudioBufferClear( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type}) = _$RealtimeEventInputAudioBufferClearImpl; + const RealtimeEventInputAudioBufferClear._() : super._(); + + factory RealtimeEventInputAudioBufferClear.fromJson( + Map json) = + _$RealtimeEventInputAudioBufferClearImpl.fromJson; + + /// Optional client-generated ID used to identify this event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventInputAudioBufferClearImplCopyWith< + _$RealtimeEventInputAudioBufferClearImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventInputAudioBufferCommitImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventInputAudioBufferCommitImplCopyWith( + _$RealtimeEventInputAudioBufferCommitImpl value, + $Res Function(_$RealtimeEventInputAudioBufferCommitImpl) then) = + __$$RealtimeEventInputAudioBufferCommitImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, RealtimeEventType type}); +} + +/// @nodoc +class __$$RealtimeEventInputAudioBufferCommitImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventInputAudioBufferCommitImpl> + implements _$$RealtimeEventInputAudioBufferCommitImplCopyWith<$Res> { + __$$RealtimeEventInputAudioBufferCommitImplCopyWithImpl( + _$RealtimeEventInputAudioBufferCommitImpl _value, + $Res Function(_$RealtimeEventInputAudioBufferCommitImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + }) { + return _then(_$RealtimeEventInputAudioBufferCommitImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventInputAudioBufferCommitImpl + extends RealtimeEventInputAudioBufferCommit { + const _$RealtimeEventInputAudioBufferCommitImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.inputAudioBufferCommit}) + : super._(); + + factory _$RealtimeEventInputAudioBufferCommitImpl.fromJson( + Map json) => + _$$RealtimeEventInputAudioBufferCommitImplFromJson(json); + + /// Optional client-generated ID used to identify this event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + @override + String toString() { + return 'RealtimeEvent.inputAudioBufferCommit(eventId: $eventId, type: $type)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventInputAudioBufferCommitImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventInputAudioBufferCommitImplCopyWith< + _$RealtimeEventInputAudioBufferCommitImpl> + get copyWith => __$$RealtimeEventInputAudioBufferCommitImplCopyWithImpl< + _$RealtimeEventInputAudioBufferCommitImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return inputAudioBufferCommit(eventId, type); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return inputAudioBufferCommit?.call(eventId, type); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (inputAudioBufferCommit != null) { + return inputAudioBufferCommit(eventId, type); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return inputAudioBufferCommit(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return inputAudioBufferCommit?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (inputAudioBufferCommit != null) { + return inputAudioBufferCommit(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventInputAudioBufferCommitImplToJson( + this, + ); + } +} + +abstract class RealtimeEventInputAudioBufferCommit extends RealtimeEvent { + const factory RealtimeEventInputAudioBufferCommit( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type}) = + _$RealtimeEventInputAudioBufferCommitImpl; + const RealtimeEventInputAudioBufferCommit._() : super._(); + + factory RealtimeEventInputAudioBufferCommit.fromJson( + Map json) = + _$RealtimeEventInputAudioBufferCommitImpl.fromJson; + + /// Optional client-generated ID used to identify this event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventInputAudioBufferCommitImplCopyWith< + _$RealtimeEventInputAudioBufferCommitImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventResponseCancelImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventResponseCancelImplCopyWith( + _$RealtimeEventResponseCancelImpl value, + $Res Function(_$RealtimeEventResponseCancelImpl) then) = + __$$RealtimeEventResponseCancelImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, RealtimeEventType type}); +} + +/// @nodoc +class __$$RealtimeEventResponseCancelImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, _$RealtimeEventResponseCancelImpl> + implements _$$RealtimeEventResponseCancelImplCopyWith<$Res> { + __$$RealtimeEventResponseCancelImplCopyWithImpl( + _$RealtimeEventResponseCancelImpl _value, + $Res Function(_$RealtimeEventResponseCancelImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + }) { + return _then(_$RealtimeEventResponseCancelImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventResponseCancelImpl extends RealtimeEventResponseCancel { + const _$RealtimeEventResponseCancelImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.responseCancel}) + : super._(); + + factory _$RealtimeEventResponseCancelImpl.fromJson( + Map json) => + _$$RealtimeEventResponseCancelImplFromJson(json); + + /// Optional client-generated ID used to identify this event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + @override + String toString() { + return 'RealtimeEvent.responseCancel(eventId: $eventId, type: $type)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventResponseCancelImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventResponseCancelImplCopyWith<_$RealtimeEventResponseCancelImpl> + get copyWith => __$$RealtimeEventResponseCancelImplCopyWithImpl< + _$RealtimeEventResponseCancelImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return responseCancel(eventId, type); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return responseCancel?.call(eventId, type); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (responseCancel != null) { + return responseCancel(eventId, type); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return responseCancel(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return responseCancel?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (responseCancel != null) { + return responseCancel(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventResponseCancelImplToJson( + this, + ); + } +} + +abstract class RealtimeEventResponseCancel extends RealtimeEvent { + const factory RealtimeEventResponseCancel( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type}) = _$RealtimeEventResponseCancelImpl; + const RealtimeEventResponseCancel._() : super._(); + + factory RealtimeEventResponseCancel.fromJson(Map json) = + _$RealtimeEventResponseCancelImpl.fromJson; + + /// Optional client-generated ID used to identify this event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventResponseCancelImplCopyWith<_$RealtimeEventResponseCancelImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventResponseCreateImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventResponseCreateImplCopyWith( + _$RealtimeEventResponseCreateImpl value, + $Res Function(_$RealtimeEventResponseCreateImpl) then) = + __$$RealtimeEventResponseCreateImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response}); + + $ResponseConfigCopyWith<$Res>? get response; +} + +/// @nodoc +class __$$RealtimeEventResponseCreateImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, _$RealtimeEventResponseCreateImpl> + implements _$$RealtimeEventResponseCreateImplCopyWith<$Res> { + __$$RealtimeEventResponseCreateImplCopyWithImpl( + _$RealtimeEventResponseCreateImpl _value, + $Res Function(_$RealtimeEventResponseCreateImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? response = freezed, + }) { + return _then(_$RealtimeEventResponseCreateImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + response: freezed == response + ? _value.response + : response // ignore: cast_nullable_to_non_nullable + as ResponseConfig?, + )); + } + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ResponseConfigCopyWith<$Res>? get response { + if (_value.response == null) { + return null; + } + + return $ResponseConfigCopyWith<$Res>(_value.response!, (value) { + return _then(_value.copyWith(response: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventResponseCreateImpl extends RealtimeEventResponseCreate { + const _$RealtimeEventResponseCreateImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.responseCreate, + @JsonKey(includeIfNull: false) this.response}) + : super._(); + + factory _$RealtimeEventResponseCreateImpl.fromJson( + Map json) => + _$$RealtimeEventResponseCreateImplFromJson(json); + + /// Optional client-generated ID used to identify this event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// Configuration for the response. + @override + @JsonKey(includeIfNull: false) + final ResponseConfig? response; + + @override + String toString() { + return 'RealtimeEvent.responseCreate(eventId: $eventId, type: $type, response: $response)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventResponseCreateImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.response, response) || + other.response == response)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, response); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventResponseCreateImplCopyWith<_$RealtimeEventResponseCreateImpl> + get copyWith => __$$RealtimeEventResponseCreateImplCopyWithImpl< + _$RealtimeEventResponseCreateImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return responseCreate(eventId, type, response); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return responseCreate?.call(eventId, type, response); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (responseCreate != null) { + return responseCreate(eventId, type, response); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return responseCreate(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return responseCreate?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (responseCreate != null) { + return responseCreate(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventResponseCreateImplToJson( + this, + ); + } +} + +abstract class RealtimeEventResponseCreate extends RealtimeEvent { + const factory RealtimeEventResponseCreate( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(includeIfNull: false) final ResponseConfig? response}) = + _$RealtimeEventResponseCreateImpl; + const RealtimeEventResponseCreate._() : super._(); + + factory RealtimeEventResponseCreate.fromJson(Map json) = + _$RealtimeEventResponseCreateImpl.fromJson; + + /// Optional client-generated ID used to identify this event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// Configuration for the response. + @JsonKey(includeIfNull: false) + ResponseConfig? get response; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventResponseCreateImplCopyWith<_$RealtimeEventResponseCreateImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventSessionUpdateImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventSessionUpdateImplCopyWith( + _$RealtimeEventSessionUpdateImpl value, + $Res Function(_$RealtimeEventSessionUpdateImpl) then) = + __$$RealtimeEventSessionUpdateImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session}); + + $SessionConfigCopyWith<$Res> get session; +} + +/// @nodoc +class __$$RealtimeEventSessionUpdateImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, _$RealtimeEventSessionUpdateImpl> + implements _$$RealtimeEventSessionUpdateImplCopyWith<$Res> { + __$$RealtimeEventSessionUpdateImplCopyWithImpl( + _$RealtimeEventSessionUpdateImpl _value, + $Res Function(_$RealtimeEventSessionUpdateImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = freezed, + Object? type = null, + Object? session = null, + }) { + return _then(_$RealtimeEventSessionUpdateImpl( + eventId: freezed == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String?, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + session: null == session + ? _value.session + : session // ignore: cast_nullable_to_non_nullable + as SessionConfig, + )); + } + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $SessionConfigCopyWith<$Res> get session { + return $SessionConfigCopyWith<$Res>(_value.session, (value) { + return _then(_value.copyWith(session: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventSessionUpdateImpl extends RealtimeEventSessionUpdate { + const _$RealtimeEventSessionUpdateImpl( + {@JsonKey(name: 'event_id', includeIfNull: false) this.eventId, + this.type = RealtimeEventType.sessionUpdate, + required this.session}) + : super._(); + + factory _$RealtimeEventSessionUpdateImpl.fromJson( + Map json) => + _$$RealtimeEventSessionUpdateImplFromJson(json); + + /// Optional client-generated ID used to identify this event. + @override + @JsonKey(name: 'event_id', includeIfNull: false) + final String? eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// Session configuration to update. + @override + final SessionConfig session; + + @override + String toString() { + return 'RealtimeEvent.sessionUpdate(eventId: $eventId, type: $type, session: $session)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventSessionUpdateImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.session, session) || other.session == session)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, session); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventSessionUpdateImplCopyWith<_$RealtimeEventSessionUpdateImpl> + get copyWith => __$$RealtimeEventSessionUpdateImplCopyWithImpl< + _$RealtimeEventSessionUpdateImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return sessionUpdate(eventId, type, session); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return sessionUpdate?.call(eventId, type, session); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (sessionUpdate != null) { + return sessionUpdate(eventId, type, session); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return sessionUpdate(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return sessionUpdate?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (sessionUpdate != null) { + return sessionUpdate(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventSessionUpdateImplToJson( + this, + ); + } +} + +abstract class RealtimeEventSessionUpdate extends RealtimeEvent { + const factory RealtimeEventSessionUpdate( + {@JsonKey(name: 'event_id', includeIfNull: false) final String? eventId, + final RealtimeEventType type, + required final SessionConfig session}) = _$RealtimeEventSessionUpdateImpl; + const RealtimeEventSessionUpdate._() : super._(); + + factory RealtimeEventSessionUpdate.fromJson(Map json) = + _$RealtimeEventSessionUpdateImpl.fromJson; + + /// Optional client-generated ID used to identify this event. + @override + @JsonKey(name: 'event_id', includeIfNull: false) + String? get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// Session configuration to update. + SessionConfig get session; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventSessionUpdateImplCopyWith<_$RealtimeEventSessionUpdateImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventConversationCreatedImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventConversationCreatedImplCopyWith( + _$RealtimeEventConversationCreatedImpl value, + $Res Function(_$RealtimeEventConversationCreatedImpl) then) = + __$$RealtimeEventConversationCreatedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + Conversation conversation}); + + $ConversationCopyWith<$Res> get conversation; +} + +/// @nodoc +class __$$RealtimeEventConversationCreatedImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventConversationCreatedImpl> + implements _$$RealtimeEventConversationCreatedImplCopyWith<$Res> { + __$$RealtimeEventConversationCreatedImplCopyWithImpl( + _$RealtimeEventConversationCreatedImpl _value, + $Res Function(_$RealtimeEventConversationCreatedImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? conversation = null, + }) { + return _then(_$RealtimeEventConversationCreatedImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + conversation: null == conversation + ? _value.conversation + : conversation // ignore: cast_nullable_to_non_nullable + as Conversation, + )); + } + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ConversationCopyWith<$Res> get conversation { + return $ConversationCopyWith<$Res>(_value.conversation, (value) { + return _then(_value.copyWith(conversation: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventConversationCreatedImpl + extends RealtimeEventConversationCreated { + const _$RealtimeEventConversationCreatedImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.conversationCreated, + required this.conversation}) + : super._(); + + factory _$RealtimeEventConversationCreatedImpl.fromJson( + Map json) => + _$$RealtimeEventConversationCreatedImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The conversation resource. + @override + final Conversation conversation; + + @override + String toString() { + return 'RealtimeEvent.conversationCreated(eventId: $eventId, type: $type, conversation: $conversation)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventConversationCreatedImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.conversation, conversation) || + other.conversation == conversation)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, conversation); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventConversationCreatedImplCopyWith< + _$RealtimeEventConversationCreatedImpl> + get copyWith => __$$RealtimeEventConversationCreatedImplCopyWithImpl< + _$RealtimeEventConversationCreatedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return conversationCreated(eventId, type, conversation); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return conversationCreated?.call(eventId, type, conversation); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (conversationCreated != null) { + return conversationCreated(eventId, type, conversation); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return conversationCreated(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return conversationCreated?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (conversationCreated != null) { + return conversationCreated(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventConversationCreatedImplToJson( + this, + ); + } +} + +abstract class RealtimeEventConversationCreated extends RealtimeEvent { + const factory RealtimeEventConversationCreated( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + required final Conversation conversation}) = + _$RealtimeEventConversationCreatedImpl; + const RealtimeEventConversationCreated._() : super._(); + + factory RealtimeEventConversationCreated.fromJson(Map json) = + _$RealtimeEventConversationCreatedImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The conversation resource. + Conversation get conversation; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventConversationCreatedImplCopyWith< + _$RealtimeEventConversationCreatedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventConversationItemCreatedImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventConversationItemCreatedImplCopyWith( + _$RealtimeEventConversationItemCreatedImpl value, + $Res Function(_$RealtimeEventConversationItemCreatedImpl) then) = + __$$RealtimeEventConversationItemCreatedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item}); + + $ItemCopyWith<$Res> get item; +} + +/// @nodoc +class __$$RealtimeEventConversationItemCreatedImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventConversationItemCreatedImpl> + implements _$$RealtimeEventConversationItemCreatedImplCopyWith<$Res> { + __$$RealtimeEventConversationItemCreatedImplCopyWithImpl( + _$RealtimeEventConversationItemCreatedImpl _value, + $Res Function(_$RealtimeEventConversationItemCreatedImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? previousItemId = freezed, + Object? item = null, + }) { + return _then(_$RealtimeEventConversationItemCreatedImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + previousItemId: freezed == previousItemId + ? _value.previousItemId + : previousItemId // ignore: cast_nullable_to_non_nullable + as String?, + item: null == item + ? _value.item + : item // ignore: cast_nullable_to_non_nullable + as Item, + )); + } + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ItemCopyWith<$Res> get item { + return $ItemCopyWith<$Res>(_value.item, (value) { + return _then(_value.copyWith(item: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventConversationItemCreatedImpl + extends RealtimeEventConversationItemCreated { + const _$RealtimeEventConversationItemCreatedImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.conversationItemCreated, + @JsonKey(name: 'previous_item_id') required this.previousItemId, + required this.item}) + : super._(); + + factory _$RealtimeEventConversationItemCreatedImpl.fromJson( + Map json) => + _$$RealtimeEventConversationItemCreatedImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the preceding item. + @override + @JsonKey(name: 'previous_item_id') + final String? previousItemId; + + /// The item to add to the conversation. + /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput] + @override + final Item item; + + @override + String toString() { + return 'RealtimeEvent.conversationItemCreated(eventId: $eventId, type: $type, previousItemId: $previousItemId, item: $item)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventConversationItemCreatedImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.previousItemId, previousItemId) || + other.previousItemId == previousItemId) && + (identical(other.item, item) || other.item == item)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, eventId, type, previousItemId, item); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventConversationItemCreatedImplCopyWith< + _$RealtimeEventConversationItemCreatedImpl> + get copyWith => __$$RealtimeEventConversationItemCreatedImplCopyWithImpl< + _$RealtimeEventConversationItemCreatedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return conversationItemCreated(eventId, type, previousItemId, item); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return conversationItemCreated?.call(eventId, type, previousItemId, item); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (conversationItemCreated != null) { + return conversationItemCreated(eventId, type, previousItemId, item); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return conversationItemCreated(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return conversationItemCreated?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (conversationItemCreated != null) { + return conversationItemCreated(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventConversationItemCreatedImplToJson( + this, + ); + } +} + +abstract class RealtimeEventConversationItemCreated extends RealtimeEvent { + const factory RealtimeEventConversationItemCreated( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'previous_item_id') required final String? previousItemId, + required final Item item}) = _$RealtimeEventConversationItemCreatedImpl; + const RealtimeEventConversationItemCreated._() : super._(); + + factory RealtimeEventConversationItemCreated.fromJson( + Map json) = + _$RealtimeEventConversationItemCreatedImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the preceding item. + @JsonKey(name: 'previous_item_id') + String? get previousItemId; + + /// The item to add to the conversation. + /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput] + Item get item; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventConversationItemCreatedImplCopyWith< + _$RealtimeEventConversationItemCreatedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventConversationItemDeletedImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventConversationItemDeletedImplCopyWith( + _$RealtimeEventConversationItemDeletedImpl value, + $Res Function(_$RealtimeEventConversationItemDeletedImpl) then) = + __$$RealtimeEventConversationItemDeletedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId}); +} + +/// @nodoc +class __$$RealtimeEventConversationItemDeletedImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventConversationItemDeletedImpl> + implements _$$RealtimeEventConversationItemDeletedImplCopyWith<$Res> { + __$$RealtimeEventConversationItemDeletedImplCopyWithImpl( + _$RealtimeEventConversationItemDeletedImpl _value, + $Res Function(_$RealtimeEventConversationItemDeletedImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? itemId = null, + }) { + return _then(_$RealtimeEventConversationItemDeletedImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + itemId: null == itemId + ? _value.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventConversationItemDeletedImpl + extends RealtimeEventConversationItemDeleted { + const _$RealtimeEventConversationItemDeletedImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.conversationItemDeleted, + @JsonKey(name: 'item_id') required this.itemId}) + : super._(); + + factory _$RealtimeEventConversationItemDeletedImpl.fromJson( + Map json) => + _$$RealtimeEventConversationItemDeletedImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the item that was deleted. + @override + @JsonKey(name: 'item_id') + final String itemId; + + @override + String toString() { + return 'RealtimeEvent.conversationItemDeleted(eventId: $eventId, type: $type, itemId: $itemId)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventConversationItemDeletedImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.itemId, itemId) || other.itemId == itemId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, itemId); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventConversationItemDeletedImplCopyWith< + _$RealtimeEventConversationItemDeletedImpl> + get copyWith => __$$RealtimeEventConversationItemDeletedImplCopyWithImpl< + _$RealtimeEventConversationItemDeletedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return conversationItemDeleted(eventId, type, itemId); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return conversationItemDeleted?.call(eventId, type, itemId); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (conversationItemDeleted != null) { + return conversationItemDeleted(eventId, type, itemId); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return conversationItemDeleted(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return conversationItemDeleted?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (conversationItemDeleted != null) { + return conversationItemDeleted(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventConversationItemDeletedImplToJson( + this, + ); + } +} + +abstract class RealtimeEventConversationItemDeleted extends RealtimeEvent { + const factory RealtimeEventConversationItemDeleted( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'item_id') required final String itemId}) = + _$RealtimeEventConversationItemDeletedImpl; + const RealtimeEventConversationItemDeleted._() : super._(); + + factory RealtimeEventConversationItemDeleted.fromJson( + Map json) = + _$RealtimeEventConversationItemDeletedImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the item that was deleted. + @JsonKey(name: 'item_id') + String get itemId; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventConversationItemDeletedImplCopyWith< + _$RealtimeEventConversationItemDeletedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplCopyWith< + $Res> implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplCopyWith( + _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl value, + $Res Function( + _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl) + then) = + __$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplCopyWithImpl< + $Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript}); +} + +/// @nodoc +class __$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplCopyWithImpl< + $Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl> + implements + _$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplCopyWith< + $Res> { + __$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplCopyWithImpl( + _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl + _value, + $Res Function( + _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl) + _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? itemId = null, + Object? contentIndex = null, + Object? transcript = null, + }) { + return _then( + _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + itemId: null == itemId + ? _value.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + contentIndex: null == contentIndex + ? _value.contentIndex + : contentIndex // ignore: cast_nullable_to_non_nullable + as int, + transcript: null == transcript + ? _value.transcript + : transcript // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl + extends RealtimeEventConversationItemInputAudioTranscriptionCompleted { + const _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = + RealtimeEventType.conversationItemInputAudioTranscriptionCompleted, + @JsonKey(name: 'item_id') required this.itemId, + @JsonKey(name: 'content_index') required this.contentIndex, + required this.transcript}) + : super._(); + + factory _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl.fromJson( + Map json) => + _$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplFromJson( + json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the user message item. + @override + @JsonKey(name: 'item_id') + final String itemId; + + /// The index of the content part containing the audio. + @override + @JsonKey(name: 'content_index') + final int contentIndex; + + /// The transcribed text. + @override + final String transcript; + + @override + String toString() { + return 'RealtimeEvent.conversationItemInputAudioTranscriptionCompleted(eventId: $eventId, type: $type, itemId: $itemId, contentIndex: $contentIndex, transcript: $transcript)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other + is _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.itemId, itemId) || other.itemId == itemId) && + (identical(other.contentIndex, contentIndex) || + other.contentIndex == contentIndex) && + (identical(other.transcript, transcript) || + other.transcript == transcript)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, eventId, type, itemId, contentIndex, transcript); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplCopyWith< + _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl> + get copyWith => + __$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplCopyWithImpl< + _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return conversationItemInputAudioTranscriptionCompleted( + eventId, type, itemId, contentIndex, transcript); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return conversationItemInputAudioTranscriptionCompleted?.call( + eventId, type, itemId, contentIndex, transcript); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (conversationItemInputAudioTranscriptionCompleted != null) { + return conversationItemInputAudioTranscriptionCompleted( + eventId, type, itemId, contentIndex, transcript); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return conversationItemInputAudioTranscriptionCompleted(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return conversationItemInputAudioTranscriptionCompleted?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (conversationItemInputAudioTranscriptionCompleted != null) { + return conversationItemInputAudioTranscriptionCompleted(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplToJson( + this, + ); + } +} + +abstract class RealtimeEventConversationItemInputAudioTranscriptionCompleted + extends RealtimeEvent { + const factory RealtimeEventConversationItemInputAudioTranscriptionCompleted( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'item_id') required final String itemId, + @JsonKey(name: 'content_index') required final int contentIndex, + required final String transcript}) = + _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl; + const RealtimeEventConversationItemInputAudioTranscriptionCompleted._() + : super._(); + + factory RealtimeEventConversationItemInputAudioTranscriptionCompleted.fromJson( + Map json) = + _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl + .fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the user message item. + @JsonKey(name: 'item_id') + String get itemId; + + /// The index of the content part containing the audio. + @JsonKey(name: 'content_index') + int get contentIndex; + + /// The transcribed text. + String get transcript; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplCopyWith< + _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplCopyWith< + $Res> implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplCopyWith( + _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl value, + $Res Function( + _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl) + then) = + __$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplCopyWithImpl< + $Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error}); + + $TranscriptionErrorCopyWith<$Res> get error; +} + +/// @nodoc +class __$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplCopyWithImpl< + $Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl> + implements + _$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplCopyWith< + $Res> { + __$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplCopyWithImpl( + _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl _value, + $Res Function( + _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl) + _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? itemId = null, + Object? contentIndex = null, + Object? error = null, + }) { + return _then( + _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + itemId: null == itemId + ? _value.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + contentIndex: null == contentIndex + ? _value.contentIndex + : contentIndex // ignore: cast_nullable_to_non_nullable + as int, + error: null == error + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as TranscriptionError, + )); + } + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $TranscriptionErrorCopyWith<$Res> get error { + return $TranscriptionErrorCopyWith<$Res>(_value.error, (value) { + return _then(_value.copyWith(error: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl + extends RealtimeEventConversationItemInputAudioTranscriptionFailed { + const _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = + RealtimeEventType.conversationItemInputAudioTranscriptionFailed, + @JsonKey(name: 'item_id') required this.itemId, + @JsonKey(name: 'content_index') required this.contentIndex, + required this.error}) + : super._(); + + factory _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl.fromJson( + Map json) => + _$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplFromJson( + json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the user message item. + @override + @JsonKey(name: 'item_id') + final String itemId; + + /// The index of the content part containing the audio. + @override + @JsonKey(name: 'content_index') + final int contentIndex; + + /// Details of the transcription error. + @override + final TranscriptionError error; + + @override + String toString() { + return 'RealtimeEvent.conversationItemInputAudioTranscriptionFailed(eventId: $eventId, type: $type, itemId: $itemId, contentIndex: $contentIndex, error: $error)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other + is _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.itemId, itemId) || other.itemId == itemId) && + (identical(other.contentIndex, contentIndex) || + other.contentIndex == contentIndex) && + (identical(other.error, error) || other.error == error)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, eventId, type, itemId, contentIndex, error); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplCopyWith< + _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl> + get copyWith => + __$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplCopyWithImpl< + _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return conversationItemInputAudioTranscriptionFailed( + eventId, type, itemId, contentIndex, this.error); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return conversationItemInputAudioTranscriptionFailed?.call( + eventId, type, itemId, contentIndex, this.error); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (conversationItemInputAudioTranscriptionFailed != null) { + return conversationItemInputAudioTranscriptionFailed( + eventId, type, itemId, contentIndex, this.error); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return conversationItemInputAudioTranscriptionFailed(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return conversationItemInputAudioTranscriptionFailed?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (conversationItemInputAudioTranscriptionFailed != null) { + return conversationItemInputAudioTranscriptionFailed(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplToJson( + this, + ); + } +} + +abstract class RealtimeEventConversationItemInputAudioTranscriptionFailed + extends RealtimeEvent { + const factory RealtimeEventConversationItemInputAudioTranscriptionFailed( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'item_id') required final String itemId, + @JsonKey(name: 'content_index') required final int contentIndex, + required final TranscriptionError error}) = + _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl; + const RealtimeEventConversationItemInputAudioTranscriptionFailed._() + : super._(); + + factory RealtimeEventConversationItemInputAudioTranscriptionFailed.fromJson( + Map json) = + _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the user message item. + @JsonKey(name: 'item_id') + String get itemId; + + /// The index of the content part containing the audio. + @JsonKey(name: 'content_index') + int get contentIndex; + + /// Details of the transcription error. + TranscriptionError get error; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplCopyWith< + _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventConversationItemTruncatedImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventConversationItemTruncatedImplCopyWith( + _$RealtimeEventConversationItemTruncatedImpl value, + $Res Function(_$RealtimeEventConversationItemTruncatedImpl) then) = + __$$RealtimeEventConversationItemTruncatedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs}); +} + +/// @nodoc +class __$$RealtimeEventConversationItemTruncatedImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventConversationItemTruncatedImpl> + implements _$$RealtimeEventConversationItemTruncatedImplCopyWith<$Res> { + __$$RealtimeEventConversationItemTruncatedImplCopyWithImpl( + _$RealtimeEventConversationItemTruncatedImpl _value, + $Res Function(_$RealtimeEventConversationItemTruncatedImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? itemId = null, + Object? contentIndex = null, + Object? audioEndMs = null, + }) { + return _then(_$RealtimeEventConversationItemTruncatedImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + itemId: null == itemId + ? _value.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + contentIndex: null == contentIndex + ? _value.contentIndex + : contentIndex // ignore: cast_nullable_to_non_nullable + as int, + audioEndMs: null == audioEndMs + ? _value.audioEndMs + : audioEndMs // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventConversationItemTruncatedImpl + extends RealtimeEventConversationItemTruncated { + const _$RealtimeEventConversationItemTruncatedImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.conversationItemTruncated, + @JsonKey(name: 'item_id') required this.itemId, + @JsonKey(name: 'content_index') required this.contentIndex, + @JsonKey(name: 'audio_end_ms') required this.audioEndMs}) + : super._(); + + factory _$RealtimeEventConversationItemTruncatedImpl.fromJson( + Map json) => + _$$RealtimeEventConversationItemTruncatedImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the assistant message item that was truncated. + @override + @JsonKey(name: 'item_id') + final String itemId; + + /// The index of the content part that was truncated. + @override + @JsonKey(name: 'content_index') + final int contentIndex; + + /// The duration up to which the audio was truncated, in milliseconds. + @override + @JsonKey(name: 'audio_end_ms') + final int audioEndMs; + + @override + String toString() { + return 'RealtimeEvent.conversationItemTruncated(eventId: $eventId, type: $type, itemId: $itemId, contentIndex: $contentIndex, audioEndMs: $audioEndMs)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventConversationItemTruncatedImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.itemId, itemId) || other.itemId == itemId) && + (identical(other.contentIndex, contentIndex) || + other.contentIndex == contentIndex) && + (identical(other.audioEndMs, audioEndMs) || + other.audioEndMs == audioEndMs)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, eventId, type, itemId, contentIndex, audioEndMs); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventConversationItemTruncatedImplCopyWith< + _$RealtimeEventConversationItemTruncatedImpl> + get copyWith => + __$$RealtimeEventConversationItemTruncatedImplCopyWithImpl< + _$RealtimeEventConversationItemTruncatedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return conversationItemTruncated( + eventId, type, itemId, contentIndex, audioEndMs); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return conversationItemTruncated?.call( + eventId, type, itemId, contentIndex, audioEndMs); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (conversationItemTruncated != null) { + return conversationItemTruncated( + eventId, type, itemId, contentIndex, audioEndMs); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return conversationItemTruncated(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return conversationItemTruncated?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (conversationItemTruncated != null) { + return conversationItemTruncated(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventConversationItemTruncatedImplToJson( + this, + ); + } +} + +abstract class RealtimeEventConversationItemTruncated extends RealtimeEvent { + const factory RealtimeEventConversationItemTruncated( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'item_id') required final String itemId, + @JsonKey(name: 'content_index') required final int contentIndex, + @JsonKey(name: 'audio_end_ms') required final int audioEndMs}) = + _$RealtimeEventConversationItemTruncatedImpl; + const RealtimeEventConversationItemTruncated._() : super._(); + + factory RealtimeEventConversationItemTruncated.fromJson( + Map json) = + _$RealtimeEventConversationItemTruncatedImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the assistant message item that was truncated. + @JsonKey(name: 'item_id') + String get itemId; + + /// The index of the content part that was truncated. + @JsonKey(name: 'content_index') + int get contentIndex; + + /// The duration up to which the audio was truncated, in milliseconds. + @JsonKey(name: 'audio_end_ms') + int get audioEndMs; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventConversationItemTruncatedImplCopyWith< + _$RealtimeEventConversationItemTruncatedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventErrorImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventErrorImplCopyWith(_$RealtimeEventErrorImpl value, + $Res Function(_$RealtimeEventErrorImpl) then) = + __$$RealtimeEventErrorImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + APIError error}); + + $APIErrorCopyWith<$Res> get error; +} + +/// @nodoc +class __$$RealtimeEventErrorImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, _$RealtimeEventErrorImpl> + implements _$$RealtimeEventErrorImplCopyWith<$Res> { + __$$RealtimeEventErrorImplCopyWithImpl(_$RealtimeEventErrorImpl _value, + $Res Function(_$RealtimeEventErrorImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? error = null, + }) { + return _then(_$RealtimeEventErrorImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + error: null == error + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as APIError, + )); + } + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $APIErrorCopyWith<$Res> get error { + return $APIErrorCopyWith<$Res>(_value.error, (value) { + return _then(_value.copyWith(error: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventErrorImpl extends RealtimeEventError { + const _$RealtimeEventErrorImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.error, + required this.error}) + : super._(); + + factory _$RealtimeEventErrorImpl.fromJson(Map json) => + _$$RealtimeEventErrorImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// Details of the API error. + @override + final APIError error; + + @override + String toString() { + return 'RealtimeEvent.error(eventId: $eventId, type: $type, error: $error)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventErrorImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.error, error) || other.error == error)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, error); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventErrorImplCopyWith<_$RealtimeEventErrorImpl> get copyWith => + __$$RealtimeEventErrorImplCopyWithImpl<_$RealtimeEventErrorImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return error(eventId, type, this.error); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return error?.call(eventId, type, this.error); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (error != null) { + return error(eventId, type, this.error); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return error(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return error?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (error != null) { + return error(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventErrorImplToJson( + this, + ); + } +} + +abstract class RealtimeEventError extends RealtimeEvent { + const factory RealtimeEventError( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + required final APIError error}) = _$RealtimeEventErrorImpl; + const RealtimeEventError._() : super._(); + + factory RealtimeEventError.fromJson(Map json) = + _$RealtimeEventErrorImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// Details of the API error. + APIError get error; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventErrorImplCopyWith<_$RealtimeEventErrorImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventInputAudioBufferClearedImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventInputAudioBufferClearedImplCopyWith( + _$RealtimeEventInputAudioBufferClearedImpl value, + $Res Function(_$RealtimeEventInputAudioBufferClearedImpl) then) = + __$$RealtimeEventInputAudioBufferClearedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, RealtimeEventType type}); +} + +/// @nodoc +class __$$RealtimeEventInputAudioBufferClearedImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventInputAudioBufferClearedImpl> + implements _$$RealtimeEventInputAudioBufferClearedImplCopyWith<$Res> { + __$$RealtimeEventInputAudioBufferClearedImplCopyWithImpl( + _$RealtimeEventInputAudioBufferClearedImpl _value, + $Res Function(_$RealtimeEventInputAudioBufferClearedImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + }) { + return _then(_$RealtimeEventInputAudioBufferClearedImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventInputAudioBufferClearedImpl + extends RealtimeEventInputAudioBufferCleared { + const _$RealtimeEventInputAudioBufferClearedImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.inputAudioBufferCleared}) + : super._(); + + factory _$RealtimeEventInputAudioBufferClearedImpl.fromJson( + Map json) => + _$$RealtimeEventInputAudioBufferClearedImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + @override + String toString() { + return 'RealtimeEvent.inputAudioBufferCleared(eventId: $eventId, type: $type)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventInputAudioBufferClearedImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventInputAudioBufferClearedImplCopyWith< + _$RealtimeEventInputAudioBufferClearedImpl> + get copyWith => __$$RealtimeEventInputAudioBufferClearedImplCopyWithImpl< + _$RealtimeEventInputAudioBufferClearedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return inputAudioBufferCleared(eventId, type); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return inputAudioBufferCleared?.call(eventId, type); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (inputAudioBufferCleared != null) { + return inputAudioBufferCleared(eventId, type); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return inputAudioBufferCleared(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return inputAudioBufferCleared?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (inputAudioBufferCleared != null) { + return inputAudioBufferCleared(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventInputAudioBufferClearedImplToJson( + this, + ); + } +} + +abstract class RealtimeEventInputAudioBufferCleared extends RealtimeEvent { + const factory RealtimeEventInputAudioBufferCleared( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type}) = + _$RealtimeEventInputAudioBufferClearedImpl; + const RealtimeEventInputAudioBufferCleared._() : super._(); + + factory RealtimeEventInputAudioBufferCleared.fromJson( + Map json) = + _$RealtimeEventInputAudioBufferClearedImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventInputAudioBufferClearedImplCopyWith< + _$RealtimeEventInputAudioBufferClearedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventInputAudioBufferCommittedImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventInputAudioBufferCommittedImplCopyWith( + _$RealtimeEventInputAudioBufferCommittedImpl value, + $Res Function(_$RealtimeEventInputAudioBufferCommittedImpl) then) = + __$$RealtimeEventInputAudioBufferCommittedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId}); +} + +/// @nodoc +class __$$RealtimeEventInputAudioBufferCommittedImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventInputAudioBufferCommittedImpl> + implements _$$RealtimeEventInputAudioBufferCommittedImplCopyWith<$Res> { + __$$RealtimeEventInputAudioBufferCommittedImplCopyWithImpl( + _$RealtimeEventInputAudioBufferCommittedImpl _value, + $Res Function(_$RealtimeEventInputAudioBufferCommittedImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? previousItemId = null, + Object? itemId = null, + }) { + return _then(_$RealtimeEventInputAudioBufferCommittedImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + previousItemId: null == previousItemId + ? _value.previousItemId + : previousItemId // ignore: cast_nullable_to_non_nullable + as String, + itemId: null == itemId + ? _value.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventInputAudioBufferCommittedImpl + extends RealtimeEventInputAudioBufferCommitted { + const _$RealtimeEventInputAudioBufferCommittedImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.inputAudioBufferCommitted, + @JsonKey(name: 'previous_item_id') required this.previousItemId, + @JsonKey(name: 'item_id') required this.itemId}) + : super._(); + + factory _$RealtimeEventInputAudioBufferCommittedImpl.fromJson( + Map json) => + _$$RealtimeEventInputAudioBufferCommittedImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the preceding item after which the new item will be inserted. + @override + @JsonKey(name: 'previous_item_id') + final String previousItemId; + + /// The ID of the user message item that will be created. + @override + @JsonKey(name: 'item_id') + final String itemId; + + @override + String toString() { + return 'RealtimeEvent.inputAudioBufferCommitted(eventId: $eventId, type: $type, previousItemId: $previousItemId, itemId: $itemId)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventInputAudioBufferCommittedImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.previousItemId, previousItemId) || + other.previousItemId == previousItemId) && + (identical(other.itemId, itemId) || other.itemId == itemId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, eventId, type, previousItemId, itemId); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventInputAudioBufferCommittedImplCopyWith< + _$RealtimeEventInputAudioBufferCommittedImpl> + get copyWith => + __$$RealtimeEventInputAudioBufferCommittedImplCopyWithImpl< + _$RealtimeEventInputAudioBufferCommittedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return inputAudioBufferCommitted(eventId, type, previousItemId, itemId); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return inputAudioBufferCommitted?.call( + eventId, type, previousItemId, itemId); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (inputAudioBufferCommitted != null) { + return inputAudioBufferCommitted(eventId, type, previousItemId, itemId); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return inputAudioBufferCommitted(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return inputAudioBufferCommitted?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (inputAudioBufferCommitted != null) { + return inputAudioBufferCommitted(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventInputAudioBufferCommittedImplToJson( + this, + ); + } +} + +abstract class RealtimeEventInputAudioBufferCommitted extends RealtimeEvent { + const factory RealtimeEventInputAudioBufferCommitted( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'previous_item_id') required final String previousItemId, + @JsonKey(name: 'item_id') + required final String + itemId}) = _$RealtimeEventInputAudioBufferCommittedImpl; + const RealtimeEventInputAudioBufferCommitted._() : super._(); + + factory RealtimeEventInputAudioBufferCommitted.fromJson( + Map json) = + _$RealtimeEventInputAudioBufferCommittedImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the preceding item after which the new item will be inserted. + @JsonKey(name: 'previous_item_id') + String get previousItemId; + + /// The ID of the user message item that will be created. + @JsonKey(name: 'item_id') + String get itemId; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventInputAudioBufferCommittedImplCopyWith< + _$RealtimeEventInputAudioBufferCommittedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventInputAudioBufferSpeechStartedImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventInputAudioBufferSpeechStartedImplCopyWith( + _$RealtimeEventInputAudioBufferSpeechStartedImpl value, + $Res Function(_$RealtimeEventInputAudioBufferSpeechStartedImpl) + then) = + __$$RealtimeEventInputAudioBufferSpeechStartedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId}); +} + +/// @nodoc +class __$$RealtimeEventInputAudioBufferSpeechStartedImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventInputAudioBufferSpeechStartedImpl> + implements _$$RealtimeEventInputAudioBufferSpeechStartedImplCopyWith<$Res> { + __$$RealtimeEventInputAudioBufferSpeechStartedImplCopyWithImpl( + _$RealtimeEventInputAudioBufferSpeechStartedImpl _value, + $Res Function(_$RealtimeEventInputAudioBufferSpeechStartedImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? audioStartMs = null, + Object? itemId = null, + }) { + return _then(_$RealtimeEventInputAudioBufferSpeechStartedImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + audioStartMs: null == audioStartMs + ? _value.audioStartMs + : audioStartMs // ignore: cast_nullable_to_non_nullable + as int, + itemId: null == itemId + ? _value.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventInputAudioBufferSpeechStartedImpl + extends RealtimeEventInputAudioBufferSpeechStarted { + const _$RealtimeEventInputAudioBufferSpeechStartedImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.inputAudioBufferSpeechStarted, + @JsonKey(name: 'audio_start_ms') required this.audioStartMs, + @JsonKey(name: 'item_id') required this.itemId}) + : super._(); + + factory _$RealtimeEventInputAudioBufferSpeechStartedImpl.fromJson( + Map json) => + _$$RealtimeEventInputAudioBufferSpeechStartedImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// Milliseconds since the session started when speech was detected. + @override + @JsonKey(name: 'audio_start_ms') + final int audioStartMs; + + /// The ID of the user message item that will be created when speech stops. + @override + @JsonKey(name: 'item_id') + final String itemId; + + @override + String toString() { + return 'RealtimeEvent.inputAudioBufferSpeechStarted(eventId: $eventId, type: $type, audioStartMs: $audioStartMs, itemId: $itemId)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventInputAudioBufferSpeechStartedImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.audioStartMs, audioStartMs) || + other.audioStartMs == audioStartMs) && + (identical(other.itemId, itemId) || other.itemId == itemId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, eventId, type, audioStartMs, itemId); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventInputAudioBufferSpeechStartedImplCopyWith< + _$RealtimeEventInputAudioBufferSpeechStartedImpl> + get copyWith => + __$$RealtimeEventInputAudioBufferSpeechStartedImplCopyWithImpl< + _$RealtimeEventInputAudioBufferSpeechStartedImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return inputAudioBufferSpeechStarted(eventId, type, audioStartMs, itemId); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return inputAudioBufferSpeechStarted?.call( + eventId, type, audioStartMs, itemId); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (inputAudioBufferSpeechStarted != null) { + return inputAudioBufferSpeechStarted(eventId, type, audioStartMs, itemId); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return inputAudioBufferSpeechStarted(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return inputAudioBufferSpeechStarted?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (inputAudioBufferSpeechStarted != null) { + return inputAudioBufferSpeechStarted(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventInputAudioBufferSpeechStartedImplToJson( + this, + ); + } +} + +abstract class RealtimeEventInputAudioBufferSpeechStarted + extends RealtimeEvent { + const factory RealtimeEventInputAudioBufferSpeechStarted( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') required final int audioStartMs, + @JsonKey(name: 'item_id') required final String itemId}) = + _$RealtimeEventInputAudioBufferSpeechStartedImpl; + const RealtimeEventInputAudioBufferSpeechStarted._() : super._(); + + factory RealtimeEventInputAudioBufferSpeechStarted.fromJson( + Map json) = + _$RealtimeEventInputAudioBufferSpeechStartedImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// Milliseconds since the session started when speech was detected. + @JsonKey(name: 'audio_start_ms') + int get audioStartMs; + + /// The ID of the user message item that will be created when speech stops. + @JsonKey(name: 'item_id') + String get itemId; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventInputAudioBufferSpeechStartedImplCopyWith< + _$RealtimeEventInputAudioBufferSpeechStartedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventInputAudioBufferSpeechStoppedImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventInputAudioBufferSpeechStoppedImplCopyWith( + _$RealtimeEventInputAudioBufferSpeechStoppedImpl value, + $Res Function(_$RealtimeEventInputAudioBufferSpeechStoppedImpl) + then) = + __$$RealtimeEventInputAudioBufferSpeechStoppedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId}); +} + +/// @nodoc +class __$$RealtimeEventInputAudioBufferSpeechStoppedImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventInputAudioBufferSpeechStoppedImpl> + implements _$$RealtimeEventInputAudioBufferSpeechStoppedImplCopyWith<$Res> { + __$$RealtimeEventInputAudioBufferSpeechStoppedImplCopyWithImpl( + _$RealtimeEventInputAudioBufferSpeechStoppedImpl _value, + $Res Function(_$RealtimeEventInputAudioBufferSpeechStoppedImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? audioEndMs = null, + Object? itemId = null, + }) { + return _then(_$RealtimeEventInputAudioBufferSpeechStoppedImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + audioEndMs: null == audioEndMs + ? _value.audioEndMs + : audioEndMs // ignore: cast_nullable_to_non_nullable + as int, + itemId: null == itemId + ? _value.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventInputAudioBufferSpeechStoppedImpl + extends RealtimeEventInputAudioBufferSpeechStopped { + const _$RealtimeEventInputAudioBufferSpeechStoppedImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.inputAudioBufferSpeechStopped, + @JsonKey(name: 'audio_end_ms') required this.audioEndMs, + @JsonKey(name: 'item_id') required this.itemId}) + : super._(); + + factory _$RealtimeEventInputAudioBufferSpeechStoppedImpl.fromJson( + Map json) => + _$$RealtimeEventInputAudioBufferSpeechStoppedImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// Milliseconds since the session started when speech stopped. + @override + @JsonKey(name: 'audio_end_ms') + final int audioEndMs; + + /// The ID of the user message item that will be created. + @override + @JsonKey(name: 'item_id') + final String itemId; + + @override + String toString() { + return 'RealtimeEvent.inputAudioBufferSpeechStopped(eventId: $eventId, type: $type, audioEndMs: $audioEndMs, itemId: $itemId)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventInputAudioBufferSpeechStoppedImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.audioEndMs, audioEndMs) || + other.audioEndMs == audioEndMs) && + (identical(other.itemId, itemId) || other.itemId == itemId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, eventId, type, audioEndMs, itemId); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventInputAudioBufferSpeechStoppedImplCopyWith< + _$RealtimeEventInputAudioBufferSpeechStoppedImpl> + get copyWith => + __$$RealtimeEventInputAudioBufferSpeechStoppedImplCopyWithImpl< + _$RealtimeEventInputAudioBufferSpeechStoppedImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return inputAudioBufferSpeechStopped(eventId, type, audioEndMs, itemId); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return inputAudioBufferSpeechStopped?.call( + eventId, type, audioEndMs, itemId); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (inputAudioBufferSpeechStopped != null) { + return inputAudioBufferSpeechStopped(eventId, type, audioEndMs, itemId); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return inputAudioBufferSpeechStopped(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return inputAudioBufferSpeechStopped?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (inputAudioBufferSpeechStopped != null) { + return inputAudioBufferSpeechStopped(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventInputAudioBufferSpeechStoppedImplToJson( + this, + ); + } +} + +abstract class RealtimeEventInputAudioBufferSpeechStopped + extends RealtimeEvent { + const factory RealtimeEventInputAudioBufferSpeechStopped( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') required final int audioEndMs, + @JsonKey(name: 'item_id') required final String itemId}) = + _$RealtimeEventInputAudioBufferSpeechStoppedImpl; + const RealtimeEventInputAudioBufferSpeechStopped._() : super._(); + + factory RealtimeEventInputAudioBufferSpeechStopped.fromJson( + Map json) = + _$RealtimeEventInputAudioBufferSpeechStoppedImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// Milliseconds since the session started when speech stopped. + @JsonKey(name: 'audio_end_ms') + int get audioEndMs; + + /// The ID of the user message item that will be created. + @JsonKey(name: 'item_id') + String get itemId; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventInputAudioBufferSpeechStoppedImplCopyWith< + _$RealtimeEventInputAudioBufferSpeechStoppedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventRateLimitsUpdatedImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventRateLimitsUpdatedImplCopyWith( + _$RealtimeEventRateLimitsUpdatedImpl value, + $Res Function(_$RealtimeEventRateLimitsUpdatedImpl) then) = + __$$RealtimeEventRateLimitsUpdatedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits}); +} + +/// @nodoc +class __$$RealtimeEventRateLimitsUpdatedImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventRateLimitsUpdatedImpl> + implements _$$RealtimeEventRateLimitsUpdatedImplCopyWith<$Res> { + __$$RealtimeEventRateLimitsUpdatedImplCopyWithImpl( + _$RealtimeEventRateLimitsUpdatedImpl _value, + $Res Function(_$RealtimeEventRateLimitsUpdatedImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? rateLimits = null, + }) { + return _then(_$RealtimeEventRateLimitsUpdatedImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + rateLimits: null == rateLimits + ? _value._rateLimits + : rateLimits // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventRateLimitsUpdatedImpl + extends RealtimeEventRateLimitsUpdated { + const _$RealtimeEventRateLimitsUpdatedImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.rateLimitsUpdated, + @JsonKey(name: 'rate_limits') required final List rateLimits}) + : _rateLimits = rateLimits, + super._(); + + factory _$RealtimeEventRateLimitsUpdatedImpl.fromJson( + Map json) => + _$$RealtimeEventRateLimitsUpdatedImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// List of rate limit information. + final List _rateLimits; + + /// List of rate limit information. + @override + @JsonKey(name: 'rate_limits') + List get rateLimits { + if (_rateLimits is EqualUnmodifiableListView) return _rateLimits; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_rateLimits); + } + + @override + String toString() { + return 'RealtimeEvent.rateLimitsUpdated(eventId: $eventId, type: $type, rateLimits: $rateLimits)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventRateLimitsUpdatedImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + const DeepCollectionEquality() + .equals(other._rateLimits, _rateLimits)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, + const DeepCollectionEquality().hash(_rateLimits)); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventRateLimitsUpdatedImplCopyWith< + _$RealtimeEventRateLimitsUpdatedImpl> + get copyWith => __$$RealtimeEventRateLimitsUpdatedImplCopyWithImpl< + _$RealtimeEventRateLimitsUpdatedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return rateLimitsUpdated(eventId, type, rateLimits); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return rateLimitsUpdated?.call(eventId, type, rateLimits); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (rateLimitsUpdated != null) { + return rateLimitsUpdated(eventId, type, rateLimits); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return rateLimitsUpdated(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return rateLimitsUpdated?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (rateLimitsUpdated != null) { + return rateLimitsUpdated(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventRateLimitsUpdatedImplToJson( + this, + ); + } +} + +abstract class RealtimeEventRateLimitsUpdated extends RealtimeEvent { + const factory RealtimeEventRateLimitsUpdated( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'rate_limits') + required final List rateLimits}) = + _$RealtimeEventRateLimitsUpdatedImpl; + const RealtimeEventRateLimitsUpdated._() : super._(); + + factory RealtimeEventRateLimitsUpdated.fromJson(Map json) = + _$RealtimeEventRateLimitsUpdatedImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// List of rate limit information. + @JsonKey(name: 'rate_limits') + List get rateLimits; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventRateLimitsUpdatedImplCopyWith< + _$RealtimeEventRateLimitsUpdatedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventResponseAudioDeltaImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventResponseAudioDeltaImplCopyWith( + _$RealtimeEventResponseAudioDeltaImpl value, + $Res Function(_$RealtimeEventResponseAudioDeltaImpl) then) = + __$$RealtimeEventResponseAudioDeltaImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta}); +} + +/// @nodoc +class __$$RealtimeEventResponseAudioDeltaImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventResponseAudioDeltaImpl> + implements _$$RealtimeEventResponseAudioDeltaImplCopyWith<$Res> { + __$$RealtimeEventResponseAudioDeltaImplCopyWithImpl( + _$RealtimeEventResponseAudioDeltaImpl _value, + $Res Function(_$RealtimeEventResponseAudioDeltaImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? responseId = null, + Object? itemId = null, + Object? outputIndex = null, + Object? contentIndex = null, + Object? delta = null, + }) { + return _then(_$RealtimeEventResponseAudioDeltaImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + responseId: null == responseId + ? _value.responseId + : responseId // ignore: cast_nullable_to_non_nullable + as String, + itemId: null == itemId + ? _value.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + outputIndex: null == outputIndex + ? _value.outputIndex + : outputIndex // ignore: cast_nullable_to_non_nullable + as int, + contentIndex: null == contentIndex + ? _value.contentIndex + : contentIndex // ignore: cast_nullable_to_non_nullable + as int, + delta: null == delta + ? _value.delta + : delta // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventResponseAudioDeltaImpl + extends RealtimeEventResponseAudioDelta { + const _$RealtimeEventResponseAudioDeltaImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.responseAudioDelta, + @JsonKey(name: 'response_id') required this.responseId, + @JsonKey(name: 'item_id') required this.itemId, + @JsonKey(name: 'output_index') required this.outputIndex, + @JsonKey(name: 'content_index') required this.contentIndex, + required this.delta}) + : super._(); + + factory _$RealtimeEventResponseAudioDeltaImpl.fromJson( + Map json) => + _$$RealtimeEventResponseAudioDeltaImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the response. + @override + @JsonKey(name: 'response_id') + final String responseId; + + /// The ID of the item. + @override + @JsonKey(name: 'item_id') + final String itemId; + + /// The index of the output item in the response. + @override + @JsonKey(name: 'output_index') + final int outputIndex; + + /// The index of the content part in the item's content array. + @override + @JsonKey(name: 'content_index') + final int contentIndex; + + /// Base64-encoded audio data delta. + @override + final String delta; + + @override + String toString() { + return 'RealtimeEvent.responseAudioDelta(eventId: $eventId, type: $type, responseId: $responseId, itemId: $itemId, outputIndex: $outputIndex, contentIndex: $contentIndex, delta: $delta)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventResponseAudioDeltaImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.responseId, responseId) || + other.responseId == responseId) && + (identical(other.itemId, itemId) || other.itemId == itemId) && + (identical(other.outputIndex, outputIndex) || + other.outputIndex == outputIndex) && + (identical(other.contentIndex, contentIndex) || + other.contentIndex == contentIndex) && + (identical(other.delta, delta) || other.delta == delta)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, responseId, + itemId, outputIndex, contentIndex, delta); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventResponseAudioDeltaImplCopyWith< + _$RealtimeEventResponseAudioDeltaImpl> + get copyWith => __$$RealtimeEventResponseAudioDeltaImplCopyWithImpl< + _$RealtimeEventResponseAudioDeltaImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return responseAudioDelta( + eventId, type, responseId, itemId, outputIndex, contentIndex, delta); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return responseAudioDelta?.call( + eventId, type, responseId, itemId, outputIndex, contentIndex, delta); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (responseAudioDelta != null) { + return responseAudioDelta( + eventId, type, responseId, itemId, outputIndex, contentIndex, delta); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return responseAudioDelta(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return responseAudioDelta?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (responseAudioDelta != null) { + return responseAudioDelta(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventResponseAudioDeltaImplToJson( + this, + ); + } +} + +abstract class RealtimeEventResponseAudioDelta extends RealtimeEvent { + const factory RealtimeEventResponseAudioDelta( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'response_id') required final String responseId, + @JsonKey(name: 'item_id') required final String itemId, + @JsonKey(name: 'output_index') required final int outputIndex, + @JsonKey(name: 'content_index') required final int contentIndex, + required final String delta}) = _$RealtimeEventResponseAudioDeltaImpl; + const RealtimeEventResponseAudioDelta._() : super._(); + + factory RealtimeEventResponseAudioDelta.fromJson(Map json) = + _$RealtimeEventResponseAudioDeltaImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the response. + @JsonKey(name: 'response_id') + String get responseId; + + /// The ID of the item. + @JsonKey(name: 'item_id') + String get itemId; + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') + int get outputIndex; + + /// The index of the content part in the item's content array. + @JsonKey(name: 'content_index') + int get contentIndex; + + /// Base64-encoded audio data delta. + String get delta; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventResponseAudioDeltaImplCopyWith< + _$RealtimeEventResponseAudioDeltaImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventResponseAudioDoneImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventResponseAudioDoneImplCopyWith( + _$RealtimeEventResponseAudioDoneImpl value, + $Res Function(_$RealtimeEventResponseAudioDoneImpl) then) = + __$$RealtimeEventResponseAudioDoneImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex}); +} + +/// @nodoc +class __$$RealtimeEventResponseAudioDoneImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventResponseAudioDoneImpl> + implements _$$RealtimeEventResponseAudioDoneImplCopyWith<$Res> { + __$$RealtimeEventResponseAudioDoneImplCopyWithImpl( + _$RealtimeEventResponseAudioDoneImpl _value, + $Res Function(_$RealtimeEventResponseAudioDoneImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? responseId = null, + Object? itemId = null, + Object? outputIndex = null, + Object? contentIndex = null, + }) { + return _then(_$RealtimeEventResponseAudioDoneImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + responseId: null == responseId + ? _value.responseId + : responseId // ignore: cast_nullable_to_non_nullable + as String, + itemId: null == itemId + ? _value.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + outputIndex: null == outputIndex + ? _value.outputIndex + : outputIndex // ignore: cast_nullable_to_non_nullable + as int, + contentIndex: null == contentIndex + ? _value.contentIndex + : contentIndex // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventResponseAudioDoneImpl + extends RealtimeEventResponseAudioDone { + const _$RealtimeEventResponseAudioDoneImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.responseAudioDone, + @JsonKey(name: 'response_id') required this.responseId, + @JsonKey(name: 'item_id') required this.itemId, + @JsonKey(name: 'output_index') required this.outputIndex, + @JsonKey(name: 'content_index') required this.contentIndex}) + : super._(); + + factory _$RealtimeEventResponseAudioDoneImpl.fromJson( + Map json) => + _$$RealtimeEventResponseAudioDoneImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the response. + @override + @JsonKey(name: 'response_id') + final String responseId; + + /// The ID of the item. + @override + @JsonKey(name: 'item_id') + final String itemId; + + /// The index of the output item in the response. + @override + @JsonKey(name: 'output_index') + final int outputIndex; + + /// The index of the content part in the item's content array. + @override + @JsonKey(name: 'content_index') + final int contentIndex; + + @override + String toString() { + return 'RealtimeEvent.responseAudioDone(eventId: $eventId, type: $type, responseId: $responseId, itemId: $itemId, outputIndex: $outputIndex, contentIndex: $contentIndex)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventResponseAudioDoneImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.responseId, responseId) || + other.responseId == responseId) && + (identical(other.itemId, itemId) || other.itemId == itemId) && + (identical(other.outputIndex, outputIndex) || + other.outputIndex == outputIndex) && + (identical(other.contentIndex, contentIndex) || + other.contentIndex == contentIndex)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, responseId, + itemId, outputIndex, contentIndex); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventResponseAudioDoneImplCopyWith< + _$RealtimeEventResponseAudioDoneImpl> + get copyWith => __$$RealtimeEventResponseAudioDoneImplCopyWithImpl< + _$RealtimeEventResponseAudioDoneImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return responseAudioDone( + eventId, type, responseId, itemId, outputIndex, contentIndex); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return responseAudioDone?.call( + eventId, type, responseId, itemId, outputIndex, contentIndex); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (responseAudioDone != null) { + return responseAudioDone( + eventId, type, responseId, itemId, outputIndex, contentIndex); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return responseAudioDone(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return responseAudioDone?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (responseAudioDone != null) { + return responseAudioDone(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventResponseAudioDoneImplToJson( + this, + ); + } +} + +abstract class RealtimeEventResponseAudioDone extends RealtimeEvent { + const factory RealtimeEventResponseAudioDone( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'response_id') required final String responseId, + @JsonKey(name: 'item_id') required final String itemId, + @JsonKey(name: 'output_index') required final int outputIndex, + @JsonKey(name: 'content_index') required final int contentIndex}) = + _$RealtimeEventResponseAudioDoneImpl; + const RealtimeEventResponseAudioDone._() : super._(); + + factory RealtimeEventResponseAudioDone.fromJson(Map json) = + _$RealtimeEventResponseAudioDoneImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the response. + @JsonKey(name: 'response_id') + String get responseId; + + /// The ID of the item. + @JsonKey(name: 'item_id') + String get itemId; + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') + int get outputIndex; + + /// The index of the content part in the item's content array. + @JsonKey(name: 'content_index') + int get contentIndex; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventResponseAudioDoneImplCopyWith< + _$RealtimeEventResponseAudioDoneImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventResponseAudioTranscriptDeltaImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventResponseAudioTranscriptDeltaImplCopyWith( + _$RealtimeEventResponseAudioTranscriptDeltaImpl value, + $Res Function(_$RealtimeEventResponseAudioTranscriptDeltaImpl) then) = + __$$RealtimeEventResponseAudioTranscriptDeltaImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta}); +} + +/// @nodoc +class __$$RealtimeEventResponseAudioTranscriptDeltaImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventResponseAudioTranscriptDeltaImpl> + implements _$$RealtimeEventResponseAudioTranscriptDeltaImplCopyWith<$Res> { + __$$RealtimeEventResponseAudioTranscriptDeltaImplCopyWithImpl( + _$RealtimeEventResponseAudioTranscriptDeltaImpl _value, + $Res Function(_$RealtimeEventResponseAudioTranscriptDeltaImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? responseId = null, + Object? itemId = null, + Object? outputIndex = null, + Object? contentIndex = null, + Object? delta = null, + }) { + return _then(_$RealtimeEventResponseAudioTranscriptDeltaImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + responseId: null == responseId + ? _value.responseId + : responseId // ignore: cast_nullable_to_non_nullable + as String, + itemId: null == itemId + ? _value.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + outputIndex: null == outputIndex + ? _value.outputIndex + : outputIndex // ignore: cast_nullable_to_non_nullable + as int, + contentIndex: null == contentIndex + ? _value.contentIndex + : contentIndex // ignore: cast_nullable_to_non_nullable + as int, + delta: null == delta + ? _value.delta + : delta // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventResponseAudioTranscriptDeltaImpl + extends RealtimeEventResponseAudioTranscriptDelta { + const _$RealtimeEventResponseAudioTranscriptDeltaImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.responseAudioTranscriptDelta, + @JsonKey(name: 'response_id') required this.responseId, + @JsonKey(name: 'item_id') required this.itemId, + @JsonKey(name: 'output_index') required this.outputIndex, + @JsonKey(name: 'content_index') required this.contentIndex, + required this.delta}) + : super._(); + + factory _$RealtimeEventResponseAudioTranscriptDeltaImpl.fromJson( + Map json) => + _$$RealtimeEventResponseAudioTranscriptDeltaImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the response. + @override + @JsonKey(name: 'response_id') + final String responseId; + + /// The ID of the item. + @override + @JsonKey(name: 'item_id') + final String itemId; + + /// The index of the output item in the response. + @override + @JsonKey(name: 'output_index') + final int outputIndex; + + /// The index of the content part in the item's content array. + @override + @JsonKey(name: 'content_index') + final int contentIndex; + + /// The transcript delta. + @override + final String delta; + + @override + String toString() { + return 'RealtimeEvent.responseAudioTranscriptDelta(eventId: $eventId, type: $type, responseId: $responseId, itemId: $itemId, outputIndex: $outputIndex, contentIndex: $contentIndex, delta: $delta)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventResponseAudioTranscriptDeltaImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.responseId, responseId) || + other.responseId == responseId) && + (identical(other.itemId, itemId) || other.itemId == itemId) && + (identical(other.outputIndex, outputIndex) || + other.outputIndex == outputIndex) && + (identical(other.contentIndex, contentIndex) || + other.contentIndex == contentIndex) && + (identical(other.delta, delta) || other.delta == delta)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, responseId, + itemId, outputIndex, contentIndex, delta); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventResponseAudioTranscriptDeltaImplCopyWith< + _$RealtimeEventResponseAudioTranscriptDeltaImpl> + get copyWith => + __$$RealtimeEventResponseAudioTranscriptDeltaImplCopyWithImpl< + _$RealtimeEventResponseAudioTranscriptDeltaImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return responseAudioTranscriptDelta( + eventId, type, responseId, itemId, outputIndex, contentIndex, delta); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return responseAudioTranscriptDelta?.call( + eventId, type, responseId, itemId, outputIndex, contentIndex, delta); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (responseAudioTranscriptDelta != null) { + return responseAudioTranscriptDelta( + eventId, type, responseId, itemId, outputIndex, contentIndex, delta); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return responseAudioTranscriptDelta(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return responseAudioTranscriptDelta?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (responseAudioTranscriptDelta != null) { + return responseAudioTranscriptDelta(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventResponseAudioTranscriptDeltaImplToJson( + this, + ); + } +} + +abstract class RealtimeEventResponseAudioTranscriptDelta extends RealtimeEvent { + const factory RealtimeEventResponseAudioTranscriptDelta( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'response_id') required final String responseId, + @JsonKey(name: 'item_id') required final String itemId, + @JsonKey(name: 'output_index') required final int outputIndex, + @JsonKey(name: 'content_index') required final int contentIndex, + required final String delta}) = + _$RealtimeEventResponseAudioTranscriptDeltaImpl; + const RealtimeEventResponseAudioTranscriptDelta._() : super._(); + + factory RealtimeEventResponseAudioTranscriptDelta.fromJson( + Map json) = + _$RealtimeEventResponseAudioTranscriptDeltaImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the response. + @JsonKey(name: 'response_id') + String get responseId; + + /// The ID of the item. + @JsonKey(name: 'item_id') + String get itemId; + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') + int get outputIndex; + + /// The index of the content part in the item's content array. + @JsonKey(name: 'content_index') + int get contentIndex; + + /// The transcript delta. + String get delta; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventResponseAudioTranscriptDeltaImplCopyWith< + _$RealtimeEventResponseAudioTranscriptDeltaImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventResponseAudioTranscriptDoneImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventResponseAudioTranscriptDoneImplCopyWith( + _$RealtimeEventResponseAudioTranscriptDoneImpl value, + $Res Function(_$RealtimeEventResponseAudioTranscriptDoneImpl) then) = + __$$RealtimeEventResponseAudioTranscriptDoneImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript}); +} + +/// @nodoc +class __$$RealtimeEventResponseAudioTranscriptDoneImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventResponseAudioTranscriptDoneImpl> + implements _$$RealtimeEventResponseAudioTranscriptDoneImplCopyWith<$Res> { + __$$RealtimeEventResponseAudioTranscriptDoneImplCopyWithImpl( + _$RealtimeEventResponseAudioTranscriptDoneImpl _value, + $Res Function(_$RealtimeEventResponseAudioTranscriptDoneImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? responseId = null, + Object? itemId = null, + Object? outputIndex = null, + Object? contentIndex = null, + Object? transcript = null, + }) { + return _then(_$RealtimeEventResponseAudioTranscriptDoneImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + responseId: null == responseId + ? _value.responseId + : responseId // ignore: cast_nullable_to_non_nullable + as String, + itemId: null == itemId + ? _value.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + outputIndex: null == outputIndex + ? _value.outputIndex + : outputIndex // ignore: cast_nullable_to_non_nullable + as int, + contentIndex: null == contentIndex + ? _value.contentIndex + : contentIndex // ignore: cast_nullable_to_non_nullable + as int, + transcript: null == transcript + ? _value.transcript + : transcript // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventResponseAudioTranscriptDoneImpl + extends RealtimeEventResponseAudioTranscriptDone { + const _$RealtimeEventResponseAudioTranscriptDoneImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.responseAudioTranscriptDone, + @JsonKey(name: 'response_id') required this.responseId, + @JsonKey(name: 'item_id') required this.itemId, + @JsonKey(name: 'output_index') required this.outputIndex, + @JsonKey(name: 'content_index') required this.contentIndex, + required this.transcript}) + : super._(); + + factory _$RealtimeEventResponseAudioTranscriptDoneImpl.fromJson( + Map json) => + _$$RealtimeEventResponseAudioTranscriptDoneImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the response. + @override + @JsonKey(name: 'response_id') + final String responseId; + + /// The ID of the item. + @override + @JsonKey(name: 'item_id') + final String itemId; + + /// The index of the output item in the response. + @override + @JsonKey(name: 'output_index') + final int outputIndex; + + /// The index of the content part in the item's content array. + @override + @JsonKey(name: 'content_index') + final int contentIndex; + + /// The final transcript of the audio. + @override + final String transcript; + + @override + String toString() { + return 'RealtimeEvent.responseAudioTranscriptDone(eventId: $eventId, type: $type, responseId: $responseId, itemId: $itemId, outputIndex: $outputIndex, contentIndex: $contentIndex, transcript: $transcript)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventResponseAudioTranscriptDoneImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.responseId, responseId) || + other.responseId == responseId) && + (identical(other.itemId, itemId) || other.itemId == itemId) && + (identical(other.outputIndex, outputIndex) || + other.outputIndex == outputIndex) && + (identical(other.contentIndex, contentIndex) || + other.contentIndex == contentIndex) && + (identical(other.transcript, transcript) || + other.transcript == transcript)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, responseId, + itemId, outputIndex, contentIndex, transcript); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventResponseAudioTranscriptDoneImplCopyWith< + _$RealtimeEventResponseAudioTranscriptDoneImpl> + get copyWith => + __$$RealtimeEventResponseAudioTranscriptDoneImplCopyWithImpl< + _$RealtimeEventResponseAudioTranscriptDoneImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return responseAudioTranscriptDone(eventId, type, responseId, itemId, + outputIndex, contentIndex, transcript); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return responseAudioTranscriptDone?.call(eventId, type, responseId, itemId, + outputIndex, contentIndex, transcript); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (responseAudioTranscriptDone != null) { + return responseAudioTranscriptDone(eventId, type, responseId, itemId, + outputIndex, contentIndex, transcript); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return responseAudioTranscriptDone(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return responseAudioTranscriptDone?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (responseAudioTranscriptDone != null) { + return responseAudioTranscriptDone(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventResponseAudioTranscriptDoneImplToJson( + this, + ); + } +} + +abstract class RealtimeEventResponseAudioTranscriptDone extends RealtimeEvent { + const factory RealtimeEventResponseAudioTranscriptDone( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'response_id') required final String responseId, + @JsonKey(name: 'item_id') required final String itemId, + @JsonKey(name: 'output_index') required final int outputIndex, + @JsonKey(name: 'content_index') required final int contentIndex, + required final String transcript}) = + _$RealtimeEventResponseAudioTranscriptDoneImpl; + const RealtimeEventResponseAudioTranscriptDone._() : super._(); + + factory RealtimeEventResponseAudioTranscriptDone.fromJson( + Map json) = + _$RealtimeEventResponseAudioTranscriptDoneImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the response. + @JsonKey(name: 'response_id') + String get responseId; + + /// The ID of the item. + @JsonKey(name: 'item_id') + String get itemId; + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') + int get outputIndex; + + /// The index of the content part in the item's content array. + @JsonKey(name: 'content_index') + int get contentIndex; + + /// The final transcript of the audio. + String get transcript; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventResponseAudioTranscriptDoneImplCopyWith< + _$RealtimeEventResponseAudioTranscriptDoneImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventResponseContentPartAddedImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventResponseContentPartAddedImplCopyWith( + _$RealtimeEventResponseContentPartAddedImpl value, + $Res Function(_$RealtimeEventResponseContentPartAddedImpl) then) = + __$$RealtimeEventResponseContentPartAddedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part}); + + $ContentPartCopyWith<$Res> get part; +} + +/// @nodoc +class __$$RealtimeEventResponseContentPartAddedImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventResponseContentPartAddedImpl> + implements _$$RealtimeEventResponseContentPartAddedImplCopyWith<$Res> { + __$$RealtimeEventResponseContentPartAddedImplCopyWithImpl( + _$RealtimeEventResponseContentPartAddedImpl _value, + $Res Function(_$RealtimeEventResponseContentPartAddedImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? responseId = null, + Object? itemId = null, + Object? outputIndex = null, + Object? contentIndex = null, + Object? part = null, + }) { + return _then(_$RealtimeEventResponseContentPartAddedImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + responseId: null == responseId + ? _value.responseId + : responseId // ignore: cast_nullable_to_non_nullable + as String, + itemId: null == itemId + ? _value.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + outputIndex: null == outputIndex + ? _value.outputIndex + : outputIndex // ignore: cast_nullable_to_non_nullable + as int, + contentIndex: null == contentIndex + ? _value.contentIndex + : contentIndex // ignore: cast_nullable_to_non_nullable + as int, + part: null == part + ? _value.part + : part // ignore: cast_nullable_to_non_nullable + as ContentPart, + )); + } + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ContentPartCopyWith<$Res> get part { + return $ContentPartCopyWith<$Res>(_value.part, (value) { + return _then(_value.copyWith(part: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventResponseContentPartAddedImpl + extends RealtimeEventResponseContentPartAdded { + const _$RealtimeEventResponseContentPartAddedImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.responseContentPartAdded, + @JsonKey(name: 'response_id') required this.responseId, + @JsonKey(name: 'item_id') required this.itemId, + @JsonKey(name: 'output_index') required this.outputIndex, + @JsonKey(name: 'content_index') required this.contentIndex, + required this.part}) + : super._(); + + factory _$RealtimeEventResponseContentPartAddedImpl.fromJson( + Map json) => + _$$RealtimeEventResponseContentPartAddedImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the response. + @override + @JsonKey(name: 'response_id') + final String responseId; + + /// The ID of the item to which the content part was added. + @override + @JsonKey(name: 'item_id') + final String itemId; + + /// The index of the output item in the response. + @override + @JsonKey(name: 'output_index') + final int outputIndex; + + /// The index of the content part in the item's content array. + @override + @JsonKey(name: 'content_index') + final int contentIndex; + + /// A part of the content. + /// Any of: [ContentPartInputText], [ContentPartInputAudio], [ContentPartText], [ContentPartAudio] + @override + final ContentPart part; + + @override + String toString() { + return 'RealtimeEvent.responseContentPartAdded(eventId: $eventId, type: $type, responseId: $responseId, itemId: $itemId, outputIndex: $outputIndex, contentIndex: $contentIndex, part: $part)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventResponseContentPartAddedImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.responseId, responseId) || + other.responseId == responseId) && + (identical(other.itemId, itemId) || other.itemId == itemId) && + (identical(other.outputIndex, outputIndex) || + other.outputIndex == outputIndex) && + (identical(other.contentIndex, contentIndex) || + other.contentIndex == contentIndex) && + (identical(other.part, part) || other.part == part)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, responseId, + itemId, outputIndex, contentIndex, part); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventResponseContentPartAddedImplCopyWith< + _$RealtimeEventResponseContentPartAddedImpl> + get copyWith => __$$RealtimeEventResponseContentPartAddedImplCopyWithImpl< + _$RealtimeEventResponseContentPartAddedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return responseContentPartAdded( + eventId, type, responseId, itemId, outputIndex, contentIndex, part); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return responseContentPartAdded?.call( + eventId, type, responseId, itemId, outputIndex, contentIndex, part); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (responseContentPartAdded != null) { + return responseContentPartAdded( + eventId, type, responseId, itemId, outputIndex, contentIndex, part); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return responseContentPartAdded(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return responseContentPartAdded?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (responseContentPartAdded != null) { + return responseContentPartAdded(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventResponseContentPartAddedImplToJson( + this, + ); + } +} + +abstract class RealtimeEventResponseContentPartAdded extends RealtimeEvent { + const factory RealtimeEventResponseContentPartAdded( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'response_id') required final String responseId, + @JsonKey(name: 'item_id') required final String itemId, + @JsonKey(name: 'output_index') required final int outputIndex, + @JsonKey(name: 'content_index') required final int contentIndex, + required final ContentPart part}) = + _$RealtimeEventResponseContentPartAddedImpl; + const RealtimeEventResponseContentPartAdded._() : super._(); + + factory RealtimeEventResponseContentPartAdded.fromJson( + Map json) = + _$RealtimeEventResponseContentPartAddedImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the response. + @JsonKey(name: 'response_id') + String get responseId; + + /// The ID of the item to which the content part was added. + @JsonKey(name: 'item_id') + String get itemId; + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') + int get outputIndex; + + /// The index of the content part in the item's content array. + @JsonKey(name: 'content_index') + int get contentIndex; + + /// A part of the content. + /// Any of: [ContentPartInputText], [ContentPartInputAudio], [ContentPartText], [ContentPartAudio] + ContentPart get part; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventResponseContentPartAddedImplCopyWith< + _$RealtimeEventResponseContentPartAddedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventResponseContentPartDoneImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventResponseContentPartDoneImplCopyWith( + _$RealtimeEventResponseContentPartDoneImpl value, + $Res Function(_$RealtimeEventResponseContentPartDoneImpl) then) = + __$$RealtimeEventResponseContentPartDoneImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part}); + + $ContentPartCopyWith<$Res> get part; +} + +/// @nodoc +class __$$RealtimeEventResponseContentPartDoneImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventResponseContentPartDoneImpl> + implements _$$RealtimeEventResponseContentPartDoneImplCopyWith<$Res> { + __$$RealtimeEventResponseContentPartDoneImplCopyWithImpl( + _$RealtimeEventResponseContentPartDoneImpl _value, + $Res Function(_$RealtimeEventResponseContentPartDoneImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? responseId = null, + Object? itemId = null, + Object? outputIndex = null, + Object? contentIndex = null, + Object? part = null, + }) { + return _then(_$RealtimeEventResponseContentPartDoneImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + responseId: null == responseId + ? _value.responseId + : responseId // ignore: cast_nullable_to_non_nullable + as String, + itemId: null == itemId + ? _value.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + outputIndex: null == outputIndex + ? _value.outputIndex + : outputIndex // ignore: cast_nullable_to_non_nullable + as int, + contentIndex: null == contentIndex + ? _value.contentIndex + : contentIndex // ignore: cast_nullable_to_non_nullable + as int, + part: null == part + ? _value.part + : part // ignore: cast_nullable_to_non_nullable + as ContentPart, + )); + } + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ContentPartCopyWith<$Res> get part { + return $ContentPartCopyWith<$Res>(_value.part, (value) { + return _then(_value.copyWith(part: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventResponseContentPartDoneImpl + extends RealtimeEventResponseContentPartDone { + const _$RealtimeEventResponseContentPartDoneImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.responseContentPartDone, + @JsonKey(name: 'response_id') required this.responseId, + @JsonKey(name: 'item_id') required this.itemId, + @JsonKey(name: 'output_index') required this.outputIndex, + @JsonKey(name: 'content_index') required this.contentIndex, + required this.part}) + : super._(); + + factory _$RealtimeEventResponseContentPartDoneImpl.fromJson( + Map json) => + _$$RealtimeEventResponseContentPartDoneImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the response. + @override + @JsonKey(name: 'response_id') + final String responseId; + + /// The ID of the item. + @override + @JsonKey(name: 'item_id') + final String itemId; + + /// The index of the output item in the response. + @override + @JsonKey(name: 'output_index') + final int outputIndex; + + /// The index of the content part in the item's content array. + @override + @JsonKey(name: 'content_index') + final int contentIndex; + + /// A part of the content. + /// Any of: [ContentPartInputText], [ContentPartInputAudio], [ContentPartText], [ContentPartAudio] + @override + final ContentPart part; + + @override + String toString() { + return 'RealtimeEvent.responseContentPartDone(eventId: $eventId, type: $type, responseId: $responseId, itemId: $itemId, outputIndex: $outputIndex, contentIndex: $contentIndex, part: $part)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventResponseContentPartDoneImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.responseId, responseId) || + other.responseId == responseId) && + (identical(other.itemId, itemId) || other.itemId == itemId) && + (identical(other.outputIndex, outputIndex) || + other.outputIndex == outputIndex) && + (identical(other.contentIndex, contentIndex) || + other.contentIndex == contentIndex) && + (identical(other.part, part) || other.part == part)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, responseId, + itemId, outputIndex, contentIndex, part); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventResponseContentPartDoneImplCopyWith< + _$RealtimeEventResponseContentPartDoneImpl> + get copyWith => __$$RealtimeEventResponseContentPartDoneImplCopyWithImpl< + _$RealtimeEventResponseContentPartDoneImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return responseContentPartDone( + eventId, type, responseId, itemId, outputIndex, contentIndex, part); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return responseContentPartDone?.call( + eventId, type, responseId, itemId, outputIndex, contentIndex, part); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (responseContentPartDone != null) { + return responseContentPartDone( + eventId, type, responseId, itemId, outputIndex, contentIndex, part); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return responseContentPartDone(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return responseContentPartDone?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (responseContentPartDone != null) { + return responseContentPartDone(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventResponseContentPartDoneImplToJson( + this, + ); + } +} + +abstract class RealtimeEventResponseContentPartDone extends RealtimeEvent { + const factory RealtimeEventResponseContentPartDone( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'response_id') required final String responseId, + @JsonKey(name: 'item_id') required final String itemId, + @JsonKey(name: 'output_index') required final int outputIndex, + @JsonKey(name: 'content_index') required final int contentIndex, + required final ContentPart part}) = + _$RealtimeEventResponseContentPartDoneImpl; + const RealtimeEventResponseContentPartDone._() : super._(); + + factory RealtimeEventResponseContentPartDone.fromJson( + Map json) = + _$RealtimeEventResponseContentPartDoneImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the response. + @JsonKey(name: 'response_id') + String get responseId; + + /// The ID of the item. + @JsonKey(name: 'item_id') + String get itemId; + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') + int get outputIndex; + + /// The index of the content part in the item's content array. + @JsonKey(name: 'content_index') + int get contentIndex; + + /// A part of the content. + /// Any of: [ContentPartInputText], [ContentPartInputAudio], [ContentPartText], [ContentPartAudio] + ContentPart get part; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventResponseContentPartDoneImplCopyWith< + _$RealtimeEventResponseContentPartDoneImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventResponseCreatedImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventResponseCreatedImplCopyWith( + _$RealtimeEventResponseCreatedImpl value, + $Res Function(_$RealtimeEventResponseCreatedImpl) then) = + __$$RealtimeEventResponseCreatedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + Response response}); + + $ResponseCopyWith<$Res> get response; +} + +/// @nodoc +class __$$RealtimeEventResponseCreatedImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventResponseCreatedImpl> + implements _$$RealtimeEventResponseCreatedImplCopyWith<$Res> { + __$$RealtimeEventResponseCreatedImplCopyWithImpl( + _$RealtimeEventResponseCreatedImpl _value, + $Res Function(_$RealtimeEventResponseCreatedImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? response = null, + }) { + return _then(_$RealtimeEventResponseCreatedImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + response: null == response + ? _value.response + : response // ignore: cast_nullable_to_non_nullable + as Response, + )); + } + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ResponseCopyWith<$Res> get response { + return $ResponseCopyWith<$Res>(_value.response, (value) { + return _then(_value.copyWith(response: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventResponseCreatedImpl extends RealtimeEventResponseCreated { + const _$RealtimeEventResponseCreatedImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.responseCreated, + required this.response}) + : super._(); + + factory _$RealtimeEventResponseCreatedImpl.fromJson( + Map json) => + _$$RealtimeEventResponseCreatedImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The response resource. + @override + final Response response; + + @override + String toString() { + return 'RealtimeEvent.responseCreated(eventId: $eventId, type: $type, response: $response)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventResponseCreatedImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.response, response) || + other.response == response)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, response); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventResponseCreatedImplCopyWith< + _$RealtimeEventResponseCreatedImpl> + get copyWith => __$$RealtimeEventResponseCreatedImplCopyWithImpl< + _$RealtimeEventResponseCreatedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return responseCreated(eventId, type, response); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return responseCreated?.call(eventId, type, response); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (responseCreated != null) { + return responseCreated(eventId, type, response); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return responseCreated(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return responseCreated?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (responseCreated != null) { + return responseCreated(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventResponseCreatedImplToJson( + this, + ); + } +} + +abstract class RealtimeEventResponseCreated extends RealtimeEvent { + const factory RealtimeEventResponseCreated( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + required final Response response}) = _$RealtimeEventResponseCreatedImpl; + const RealtimeEventResponseCreated._() : super._(); + + factory RealtimeEventResponseCreated.fromJson(Map json) = + _$RealtimeEventResponseCreatedImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The response resource. + Response get response; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventResponseCreatedImplCopyWith< + _$RealtimeEventResponseCreatedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventResponseDoneImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventResponseDoneImplCopyWith( + _$RealtimeEventResponseDoneImpl value, + $Res Function(_$RealtimeEventResponseDoneImpl) then) = + __$$RealtimeEventResponseDoneImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + Response response}); + + $ResponseCopyWith<$Res> get response; +} + +/// @nodoc +class __$$RealtimeEventResponseDoneImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, _$RealtimeEventResponseDoneImpl> + implements _$$RealtimeEventResponseDoneImplCopyWith<$Res> { + __$$RealtimeEventResponseDoneImplCopyWithImpl( + _$RealtimeEventResponseDoneImpl _value, + $Res Function(_$RealtimeEventResponseDoneImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? response = null, + }) { + return _then(_$RealtimeEventResponseDoneImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + response: null == response + ? _value.response + : response // ignore: cast_nullable_to_non_nullable + as Response, + )); + } + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ResponseCopyWith<$Res> get response { + return $ResponseCopyWith<$Res>(_value.response, (value) { + return _then(_value.copyWith(response: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventResponseDoneImpl extends RealtimeEventResponseDone { + const _$RealtimeEventResponseDoneImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.responseDone, + required this.response}) + : super._(); + + factory _$RealtimeEventResponseDoneImpl.fromJson(Map json) => + _$$RealtimeEventResponseDoneImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The response resource. + @override + final Response response; + + @override + String toString() { + return 'RealtimeEvent.responseDone(eventId: $eventId, type: $type, response: $response)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventResponseDoneImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.response, response) || + other.response == response)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, response); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventResponseDoneImplCopyWith<_$RealtimeEventResponseDoneImpl> + get copyWith => __$$RealtimeEventResponseDoneImplCopyWithImpl< + _$RealtimeEventResponseDoneImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return responseDone(eventId, type, response); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return responseDone?.call(eventId, type, response); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (responseDone != null) { + return responseDone(eventId, type, response); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return responseDone(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return responseDone?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (responseDone != null) { + return responseDone(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventResponseDoneImplToJson( + this, + ); + } +} + +abstract class RealtimeEventResponseDone extends RealtimeEvent { + const factory RealtimeEventResponseDone( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + required final Response response}) = _$RealtimeEventResponseDoneImpl; + const RealtimeEventResponseDone._() : super._(); + + factory RealtimeEventResponseDone.fromJson(Map json) = + _$RealtimeEventResponseDoneImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The response resource. + Response get response; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventResponseDoneImplCopyWith<_$RealtimeEventResponseDoneImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventResponseFunctionCallArgumentsDeltaImplCopyWith< + $Res> implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventResponseFunctionCallArgumentsDeltaImplCopyWith( + _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl value, + $Res Function(_$RealtimeEventResponseFunctionCallArgumentsDeltaImpl) + then) = + __$$RealtimeEventResponseFunctionCallArgumentsDeltaImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta}); +} + +/// @nodoc +class __$$RealtimeEventResponseFunctionCallArgumentsDeltaImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl> + implements + _$$RealtimeEventResponseFunctionCallArgumentsDeltaImplCopyWith<$Res> { + __$$RealtimeEventResponseFunctionCallArgumentsDeltaImplCopyWithImpl( + _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl _value, + $Res Function(_$RealtimeEventResponseFunctionCallArgumentsDeltaImpl) + _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? responseId = null, + Object? itemId = null, + Object? outputIndex = null, + Object? callId = null, + Object? delta = null, + }) { + return _then(_$RealtimeEventResponseFunctionCallArgumentsDeltaImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + responseId: null == responseId + ? _value.responseId + : responseId // ignore: cast_nullable_to_non_nullable + as String, + itemId: null == itemId + ? _value.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + outputIndex: null == outputIndex + ? _value.outputIndex + : outputIndex // ignore: cast_nullable_to_non_nullable + as int, + callId: null == callId + ? _value.callId + : callId // ignore: cast_nullable_to_non_nullable + as String, + delta: null == delta + ? _value.delta + : delta // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl + extends RealtimeEventResponseFunctionCallArgumentsDelta { + const _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.responseFunctionCallArgumentsDelta, + @JsonKey(name: 'response_id') required this.responseId, + @JsonKey(name: 'item_id') required this.itemId, + @JsonKey(name: 'output_index') required this.outputIndex, + @JsonKey(name: 'call_id') required this.callId, + required this.delta}) + : super._(); + + factory _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl.fromJson( + Map json) => + _$$RealtimeEventResponseFunctionCallArgumentsDeltaImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the response. + @override + @JsonKey(name: 'response_id') + final String responseId; + + /// The ID of the function call item. + @override + @JsonKey(name: 'item_id') + final String itemId; + + /// The index of the output item in the response. + @override + @JsonKey(name: 'output_index') + final int outputIndex; + + /// The ID of the function call. + @override + @JsonKey(name: 'call_id') + final String callId; + + /// The arguments delta as a JSON string. + @override + final String delta; + + @override + String toString() { + return 'RealtimeEvent.responseFunctionCallArgumentsDelta(eventId: $eventId, type: $type, responseId: $responseId, itemId: $itemId, outputIndex: $outputIndex, callId: $callId, delta: $delta)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.responseId, responseId) || + other.responseId == responseId) && + (identical(other.itemId, itemId) || other.itemId == itemId) && + (identical(other.outputIndex, outputIndex) || + other.outputIndex == outputIndex) && + (identical(other.callId, callId) || other.callId == callId) && + (identical(other.delta, delta) || other.delta == delta)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, responseId, + itemId, outputIndex, callId, delta); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventResponseFunctionCallArgumentsDeltaImplCopyWith< + _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl> + get copyWith => + __$$RealtimeEventResponseFunctionCallArgumentsDeltaImplCopyWithImpl< + _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return responseFunctionCallArgumentsDelta( + eventId, type, responseId, itemId, outputIndex, callId, delta); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return responseFunctionCallArgumentsDelta?.call( + eventId, type, responseId, itemId, outputIndex, callId, delta); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (responseFunctionCallArgumentsDelta != null) { + return responseFunctionCallArgumentsDelta( + eventId, type, responseId, itemId, outputIndex, callId, delta); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return responseFunctionCallArgumentsDelta(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return responseFunctionCallArgumentsDelta?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (responseFunctionCallArgumentsDelta != null) { + return responseFunctionCallArgumentsDelta(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventResponseFunctionCallArgumentsDeltaImplToJson( + this, + ); + } +} + +abstract class RealtimeEventResponseFunctionCallArgumentsDelta + extends RealtimeEvent { + const factory RealtimeEventResponseFunctionCallArgumentsDelta( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'response_id') required final String responseId, + @JsonKey(name: 'item_id') required final String itemId, + @JsonKey(name: 'output_index') required final int outputIndex, + @JsonKey(name: 'call_id') required final String callId, + required final String delta}) = + _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl; + const RealtimeEventResponseFunctionCallArgumentsDelta._() : super._(); + + factory RealtimeEventResponseFunctionCallArgumentsDelta.fromJson( + Map json) = + _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the response. + @JsonKey(name: 'response_id') + String get responseId; + + /// The ID of the function call item. + @JsonKey(name: 'item_id') + String get itemId; + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') + int get outputIndex; + + /// The ID of the function call. + @JsonKey(name: 'call_id') + String get callId; + + /// The arguments delta as a JSON string. + String get delta; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventResponseFunctionCallArgumentsDeltaImplCopyWith< + _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventResponseFunctionCallArgumentsDoneImplCopyWith< + $Res> implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventResponseFunctionCallArgumentsDoneImplCopyWith( + _$RealtimeEventResponseFunctionCallArgumentsDoneImpl value, + $Res Function(_$RealtimeEventResponseFunctionCallArgumentsDoneImpl) + then) = + __$$RealtimeEventResponseFunctionCallArgumentsDoneImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments}); +} + +/// @nodoc +class __$$RealtimeEventResponseFunctionCallArgumentsDoneImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventResponseFunctionCallArgumentsDoneImpl> + implements + _$$RealtimeEventResponseFunctionCallArgumentsDoneImplCopyWith<$Res> { + __$$RealtimeEventResponseFunctionCallArgumentsDoneImplCopyWithImpl( + _$RealtimeEventResponseFunctionCallArgumentsDoneImpl _value, + $Res Function(_$RealtimeEventResponseFunctionCallArgumentsDoneImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? responseId = null, + Object? itemId = null, + Object? outputIndex = null, + Object? callId = null, + Object? arguments = null, + }) { + return _then(_$RealtimeEventResponseFunctionCallArgumentsDoneImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + responseId: null == responseId + ? _value.responseId + : responseId // ignore: cast_nullable_to_non_nullable + as String, + itemId: null == itemId + ? _value.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + outputIndex: null == outputIndex + ? _value.outputIndex + : outputIndex // ignore: cast_nullable_to_non_nullable + as int, + callId: null == callId + ? _value.callId + : callId // ignore: cast_nullable_to_non_nullable + as String, + arguments: null == arguments + ? _value.arguments + : arguments // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventResponseFunctionCallArgumentsDoneImpl + extends RealtimeEventResponseFunctionCallArgumentsDone { + const _$RealtimeEventResponseFunctionCallArgumentsDoneImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.responseFunctionCallArgumentsDone, + @JsonKey(name: 'response_id') required this.responseId, + @JsonKey(name: 'item_id') required this.itemId, + @JsonKey(name: 'output_index') required this.outputIndex, + @JsonKey(name: 'call_id') required this.callId, + required this.arguments}) + : super._(); + + factory _$RealtimeEventResponseFunctionCallArgumentsDoneImpl.fromJson( + Map json) => + _$$RealtimeEventResponseFunctionCallArgumentsDoneImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the response. + @override + @JsonKey(name: 'response_id') + final String responseId; + + /// The ID of the function call item. + @override + @JsonKey(name: 'item_id') + final String itemId; + + /// The index of the output item in the response. + @override + @JsonKey(name: 'output_index') + final int outputIndex; + + /// The ID of the function call. + @override + @JsonKey(name: 'call_id') + final String callId; + + /// The final arguments as a JSON string. + @override + final String arguments; + + @override + String toString() { + return 'RealtimeEvent.responseFunctionCallArgumentsDone(eventId: $eventId, type: $type, responseId: $responseId, itemId: $itemId, outputIndex: $outputIndex, callId: $callId, arguments: $arguments)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventResponseFunctionCallArgumentsDoneImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.responseId, responseId) || + other.responseId == responseId) && + (identical(other.itemId, itemId) || other.itemId == itemId) && + (identical(other.outputIndex, outputIndex) || + other.outputIndex == outputIndex) && + (identical(other.callId, callId) || other.callId == callId) && + (identical(other.arguments, arguments) || + other.arguments == arguments)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, responseId, + itemId, outputIndex, callId, arguments); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventResponseFunctionCallArgumentsDoneImplCopyWith< + _$RealtimeEventResponseFunctionCallArgumentsDoneImpl> + get copyWith => + __$$RealtimeEventResponseFunctionCallArgumentsDoneImplCopyWithImpl< + _$RealtimeEventResponseFunctionCallArgumentsDoneImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return responseFunctionCallArgumentsDone( + eventId, type, responseId, itemId, outputIndex, callId, arguments); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return responseFunctionCallArgumentsDone?.call( + eventId, type, responseId, itemId, outputIndex, callId, arguments); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (responseFunctionCallArgumentsDone != null) { + return responseFunctionCallArgumentsDone( + eventId, type, responseId, itemId, outputIndex, callId, arguments); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return responseFunctionCallArgumentsDone(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return responseFunctionCallArgumentsDone?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (responseFunctionCallArgumentsDone != null) { + return responseFunctionCallArgumentsDone(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventResponseFunctionCallArgumentsDoneImplToJson( + this, + ); + } +} + +abstract class RealtimeEventResponseFunctionCallArgumentsDone + extends RealtimeEvent { + const factory RealtimeEventResponseFunctionCallArgumentsDone( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'response_id') required final String responseId, + @JsonKey(name: 'item_id') required final String itemId, + @JsonKey(name: 'output_index') required final int outputIndex, + @JsonKey(name: 'call_id') required final String callId, + required final String arguments}) = + _$RealtimeEventResponseFunctionCallArgumentsDoneImpl; + const RealtimeEventResponseFunctionCallArgumentsDone._() : super._(); + + factory RealtimeEventResponseFunctionCallArgumentsDone.fromJson( + Map json) = + _$RealtimeEventResponseFunctionCallArgumentsDoneImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the response. + @JsonKey(name: 'response_id') + String get responseId; + + /// The ID of the function call item. + @JsonKey(name: 'item_id') + String get itemId; + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') + int get outputIndex; + + /// The ID of the function call. + @JsonKey(name: 'call_id') + String get callId; + + /// The final arguments as a JSON string. + String get arguments; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventResponseFunctionCallArgumentsDoneImplCopyWith< + _$RealtimeEventResponseFunctionCallArgumentsDoneImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventResponseOutputItemAddedImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventResponseOutputItemAddedImplCopyWith( + _$RealtimeEventResponseOutputItemAddedImpl value, + $Res Function(_$RealtimeEventResponseOutputItemAddedImpl) then) = + __$$RealtimeEventResponseOutputItemAddedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item}); + + $ItemCopyWith<$Res> get item; +} + +/// @nodoc +class __$$RealtimeEventResponseOutputItemAddedImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventResponseOutputItemAddedImpl> + implements _$$RealtimeEventResponseOutputItemAddedImplCopyWith<$Res> { + __$$RealtimeEventResponseOutputItemAddedImplCopyWithImpl( + _$RealtimeEventResponseOutputItemAddedImpl _value, + $Res Function(_$RealtimeEventResponseOutputItemAddedImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? responseId = null, + Object? outputIndex = null, + Object? item = null, + }) { + return _then(_$RealtimeEventResponseOutputItemAddedImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + responseId: null == responseId + ? _value.responseId + : responseId // ignore: cast_nullable_to_non_nullable + as String, + outputIndex: null == outputIndex + ? _value.outputIndex + : outputIndex // ignore: cast_nullable_to_non_nullable + as int, + item: null == item + ? _value.item + : item // ignore: cast_nullable_to_non_nullable + as Item, + )); + } + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ItemCopyWith<$Res> get item { + return $ItemCopyWith<$Res>(_value.item, (value) { + return _then(_value.copyWith(item: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventResponseOutputItemAddedImpl + extends RealtimeEventResponseOutputItemAdded { + const _$RealtimeEventResponseOutputItemAddedImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.responseOutputItemAdded, + @JsonKey(name: 'response_id') required this.responseId, + @JsonKey(name: 'output_index') required this.outputIndex, + required this.item}) + : super._(); + + factory _$RealtimeEventResponseOutputItemAddedImpl.fromJson( + Map json) => + _$$RealtimeEventResponseOutputItemAddedImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the response to which the item belongs. + @override + @JsonKey(name: 'response_id') + final String responseId; + + /// The index of the output item in the response. + @override + @JsonKey(name: 'output_index') + final int outputIndex; + + /// The item to add to the conversation. + /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput] + @override + final Item item; + + @override + String toString() { + return 'RealtimeEvent.responseOutputItemAdded(eventId: $eventId, type: $type, responseId: $responseId, outputIndex: $outputIndex, item: $item)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventResponseOutputItemAddedImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.responseId, responseId) || + other.responseId == responseId) && + (identical(other.outputIndex, outputIndex) || + other.outputIndex == outputIndex) && + (identical(other.item, item) || other.item == item)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, eventId, type, responseId, outputIndex, item); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventResponseOutputItemAddedImplCopyWith< + _$RealtimeEventResponseOutputItemAddedImpl> + get copyWith => __$$RealtimeEventResponseOutputItemAddedImplCopyWithImpl< + _$RealtimeEventResponseOutputItemAddedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return responseOutputItemAdded( + eventId, type, responseId, outputIndex, item); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return responseOutputItemAdded?.call( + eventId, type, responseId, outputIndex, item); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (responseOutputItemAdded != null) { + return responseOutputItemAdded( + eventId, type, responseId, outputIndex, item); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return responseOutputItemAdded(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return responseOutputItemAdded?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (responseOutputItemAdded != null) { + return responseOutputItemAdded(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventResponseOutputItemAddedImplToJson( + this, + ); + } +} + +abstract class RealtimeEventResponseOutputItemAdded extends RealtimeEvent { + const factory RealtimeEventResponseOutputItemAdded( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'response_id') required final String responseId, + @JsonKey(name: 'output_index') required final int outputIndex, + required final Item item}) = _$RealtimeEventResponseOutputItemAddedImpl; + const RealtimeEventResponseOutputItemAdded._() : super._(); + + factory RealtimeEventResponseOutputItemAdded.fromJson( + Map json) = + _$RealtimeEventResponseOutputItemAddedImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the response to which the item belongs. + @JsonKey(name: 'response_id') + String get responseId; + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') + int get outputIndex; + + /// The item to add to the conversation. + /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput] + Item get item; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventResponseOutputItemAddedImplCopyWith< + _$RealtimeEventResponseOutputItemAddedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventResponseOutputItemDoneImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventResponseOutputItemDoneImplCopyWith( + _$RealtimeEventResponseOutputItemDoneImpl value, + $Res Function(_$RealtimeEventResponseOutputItemDoneImpl) then) = + __$$RealtimeEventResponseOutputItemDoneImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item}); + + $ItemCopyWith<$Res> get item; +} + +/// @nodoc +class __$$RealtimeEventResponseOutputItemDoneImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventResponseOutputItemDoneImpl> + implements _$$RealtimeEventResponseOutputItemDoneImplCopyWith<$Res> { + __$$RealtimeEventResponseOutputItemDoneImplCopyWithImpl( + _$RealtimeEventResponseOutputItemDoneImpl _value, + $Res Function(_$RealtimeEventResponseOutputItemDoneImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? responseId = null, + Object? outputIndex = null, + Object? item = null, + }) { + return _then(_$RealtimeEventResponseOutputItemDoneImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + responseId: null == responseId + ? _value.responseId + : responseId // ignore: cast_nullable_to_non_nullable + as String, + outputIndex: null == outputIndex + ? _value.outputIndex + : outputIndex // ignore: cast_nullable_to_non_nullable + as int, + item: null == item + ? _value.item + : item // ignore: cast_nullable_to_non_nullable + as Item, + )); + } + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $ItemCopyWith<$Res> get item { + return $ItemCopyWith<$Res>(_value.item, (value) { + return _then(_value.copyWith(item: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventResponseOutputItemDoneImpl + extends RealtimeEventResponseOutputItemDone { + const _$RealtimeEventResponseOutputItemDoneImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.responseOutputItemDone, + @JsonKey(name: 'response_id') required this.responseId, + @JsonKey(name: 'output_index') required this.outputIndex, + required this.item}) + : super._(); + + factory _$RealtimeEventResponseOutputItemDoneImpl.fromJson( + Map json) => + _$$RealtimeEventResponseOutputItemDoneImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the response to which the item belongs. + @override + @JsonKey(name: 'response_id') + final String responseId; + + /// The index of the output item in the response. + @override + @JsonKey(name: 'output_index') + final int outputIndex; + + /// The item to add to the conversation. + /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput] + @override + final Item item; + + @override + String toString() { + return 'RealtimeEvent.responseOutputItemDone(eventId: $eventId, type: $type, responseId: $responseId, outputIndex: $outputIndex, item: $item)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventResponseOutputItemDoneImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.responseId, responseId) || + other.responseId == responseId) && + (identical(other.outputIndex, outputIndex) || + other.outputIndex == outputIndex) && + (identical(other.item, item) || other.item == item)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, eventId, type, responseId, outputIndex, item); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventResponseOutputItemDoneImplCopyWith< + _$RealtimeEventResponseOutputItemDoneImpl> + get copyWith => __$$RealtimeEventResponseOutputItemDoneImplCopyWithImpl< + _$RealtimeEventResponseOutputItemDoneImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return responseOutputItemDone(eventId, type, responseId, outputIndex, item); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return responseOutputItemDone?.call( + eventId, type, responseId, outputIndex, item); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (responseOutputItemDone != null) { + return responseOutputItemDone( + eventId, type, responseId, outputIndex, item); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return responseOutputItemDone(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return responseOutputItemDone?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (responseOutputItemDone != null) { + return responseOutputItemDone(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventResponseOutputItemDoneImplToJson( + this, + ); + } +} + +abstract class RealtimeEventResponseOutputItemDone extends RealtimeEvent { + const factory RealtimeEventResponseOutputItemDone( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'response_id') required final String responseId, + @JsonKey(name: 'output_index') required final int outputIndex, + required final Item item}) = _$RealtimeEventResponseOutputItemDoneImpl; + const RealtimeEventResponseOutputItemDone._() : super._(); + + factory RealtimeEventResponseOutputItemDone.fromJson( + Map json) = + _$RealtimeEventResponseOutputItemDoneImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the response to which the item belongs. + @JsonKey(name: 'response_id') + String get responseId; + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') + int get outputIndex; + + /// The item to add to the conversation. + /// Any of: [ItemMessage], [ItemFunctionCall], [ItemFunctionCallOutput] + Item get item; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventResponseOutputItemDoneImplCopyWith< + _$RealtimeEventResponseOutputItemDoneImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventResponseTextDeltaImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventResponseTextDeltaImplCopyWith( + _$RealtimeEventResponseTextDeltaImpl value, + $Res Function(_$RealtimeEventResponseTextDeltaImpl) then) = + __$$RealtimeEventResponseTextDeltaImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta}); +} + +/// @nodoc +class __$$RealtimeEventResponseTextDeltaImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventResponseTextDeltaImpl> + implements _$$RealtimeEventResponseTextDeltaImplCopyWith<$Res> { + __$$RealtimeEventResponseTextDeltaImplCopyWithImpl( + _$RealtimeEventResponseTextDeltaImpl _value, + $Res Function(_$RealtimeEventResponseTextDeltaImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? responseId = null, + Object? itemId = null, + Object? outputIndex = null, + Object? contentIndex = null, + Object? delta = null, + }) { + return _then(_$RealtimeEventResponseTextDeltaImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + responseId: null == responseId + ? _value.responseId + : responseId // ignore: cast_nullable_to_non_nullable + as String, + itemId: null == itemId + ? _value.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + outputIndex: null == outputIndex + ? _value.outputIndex + : outputIndex // ignore: cast_nullable_to_non_nullable + as int, + contentIndex: null == contentIndex + ? _value.contentIndex + : contentIndex // ignore: cast_nullable_to_non_nullable + as int, + delta: null == delta + ? _value.delta + : delta // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventResponseTextDeltaImpl + extends RealtimeEventResponseTextDelta { + const _$RealtimeEventResponseTextDeltaImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.responseTextDelta, + @JsonKey(name: 'response_id') required this.responseId, + @JsonKey(name: 'item_id') required this.itemId, + @JsonKey(name: 'output_index') required this.outputIndex, + @JsonKey(name: 'content_index') required this.contentIndex, + required this.delta}) + : super._(); + + factory _$RealtimeEventResponseTextDeltaImpl.fromJson( + Map json) => + _$$RealtimeEventResponseTextDeltaImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the response. + @override + @JsonKey(name: 'response_id') + final String responseId; + + /// The ID of the item. + @override + @JsonKey(name: 'item_id') + final String itemId; + + /// The index of the output item in the response. + @override + @JsonKey(name: 'output_index') + final int outputIndex; + + /// The index of the content part in the item's content array. + @override + @JsonKey(name: 'content_index') + final int contentIndex; + + /// The text delta. + @override + final String delta; + + @override + String toString() { + return 'RealtimeEvent.responseTextDelta(eventId: $eventId, type: $type, responseId: $responseId, itemId: $itemId, outputIndex: $outputIndex, contentIndex: $contentIndex, delta: $delta)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventResponseTextDeltaImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.responseId, responseId) || + other.responseId == responseId) && + (identical(other.itemId, itemId) || other.itemId == itemId) && + (identical(other.outputIndex, outputIndex) || + other.outputIndex == outputIndex) && + (identical(other.contentIndex, contentIndex) || + other.contentIndex == contentIndex) && + (identical(other.delta, delta) || other.delta == delta)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, responseId, + itemId, outputIndex, contentIndex, delta); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventResponseTextDeltaImplCopyWith< + _$RealtimeEventResponseTextDeltaImpl> + get copyWith => __$$RealtimeEventResponseTextDeltaImplCopyWithImpl< + _$RealtimeEventResponseTextDeltaImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return responseTextDelta( + eventId, type, responseId, itemId, outputIndex, contentIndex, delta); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return responseTextDelta?.call( + eventId, type, responseId, itemId, outputIndex, contentIndex, delta); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (responseTextDelta != null) { + return responseTextDelta( + eventId, type, responseId, itemId, outputIndex, contentIndex, delta); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return responseTextDelta(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return responseTextDelta?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (responseTextDelta != null) { + return responseTextDelta(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventResponseTextDeltaImplToJson( + this, + ); + } +} + +abstract class RealtimeEventResponseTextDelta extends RealtimeEvent { + const factory RealtimeEventResponseTextDelta( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'response_id') required final String responseId, + @JsonKey(name: 'item_id') required final String itemId, + @JsonKey(name: 'output_index') required final int outputIndex, + @JsonKey(name: 'content_index') required final int contentIndex, + required final String delta}) = _$RealtimeEventResponseTextDeltaImpl; + const RealtimeEventResponseTextDelta._() : super._(); + + factory RealtimeEventResponseTextDelta.fromJson(Map json) = + _$RealtimeEventResponseTextDeltaImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the response. + @JsonKey(name: 'response_id') + String get responseId; + + /// The ID of the item. + @JsonKey(name: 'item_id') + String get itemId; + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') + int get outputIndex; + + /// The index of the content part in the item's content array. + @JsonKey(name: 'content_index') + int get contentIndex; + + /// The text delta. + String get delta; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventResponseTextDeltaImplCopyWith< + _$RealtimeEventResponseTextDeltaImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventResponseTextDoneImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventResponseTextDoneImplCopyWith( + _$RealtimeEventResponseTextDoneImpl value, + $Res Function(_$RealtimeEventResponseTextDoneImpl) then) = + __$$RealtimeEventResponseTextDoneImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text}); +} + +/// @nodoc +class __$$RealtimeEventResponseTextDoneImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventResponseTextDoneImpl> + implements _$$RealtimeEventResponseTextDoneImplCopyWith<$Res> { + __$$RealtimeEventResponseTextDoneImplCopyWithImpl( + _$RealtimeEventResponseTextDoneImpl _value, + $Res Function(_$RealtimeEventResponseTextDoneImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? responseId = null, + Object? itemId = null, + Object? outputIndex = null, + Object? contentIndex = null, + Object? text = null, + }) { + return _then(_$RealtimeEventResponseTextDoneImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + responseId: null == responseId + ? _value.responseId + : responseId // ignore: cast_nullable_to_non_nullable + as String, + itemId: null == itemId + ? _value.itemId + : itemId // ignore: cast_nullable_to_non_nullable + as String, + outputIndex: null == outputIndex + ? _value.outputIndex + : outputIndex // ignore: cast_nullable_to_non_nullable + as int, + contentIndex: null == contentIndex + ? _value.contentIndex + : contentIndex // ignore: cast_nullable_to_non_nullable + as int, + text: null == text + ? _value.text + : text // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventResponseTextDoneImpl + extends RealtimeEventResponseTextDone { + const _$RealtimeEventResponseTextDoneImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.responseTextDone, + @JsonKey(name: 'response_id') required this.responseId, + @JsonKey(name: 'item_id') required this.itemId, + @JsonKey(name: 'output_index') required this.outputIndex, + @JsonKey(name: 'content_index') required this.contentIndex, + required this.text}) + : super._(); + + factory _$RealtimeEventResponseTextDoneImpl.fromJson( + Map json) => + _$$RealtimeEventResponseTextDoneImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The ID of the response. + @override + @JsonKey(name: 'response_id') + final String responseId; + + /// The ID of the item. + @override + @JsonKey(name: 'item_id') + final String itemId; + + /// The index of the output item in the response. + @override + @JsonKey(name: 'output_index') + final int outputIndex; + + /// The index of the content part in the item's content array. + @override + @JsonKey(name: 'content_index') + final int contentIndex; + + /// The final text content. + @override + final String text; + + @override + String toString() { + return 'RealtimeEvent.responseTextDone(eventId: $eventId, type: $type, responseId: $responseId, itemId: $itemId, outputIndex: $outputIndex, contentIndex: $contentIndex, text: $text)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventResponseTextDoneImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.responseId, responseId) || + other.responseId == responseId) && + (identical(other.itemId, itemId) || other.itemId == itemId) && + (identical(other.outputIndex, outputIndex) || + other.outputIndex == outputIndex) && + (identical(other.contentIndex, contentIndex) || + other.contentIndex == contentIndex) && + (identical(other.text, text) || other.text == text)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, responseId, + itemId, outputIndex, contentIndex, text); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventResponseTextDoneImplCopyWith< + _$RealtimeEventResponseTextDoneImpl> + get copyWith => __$$RealtimeEventResponseTextDoneImplCopyWithImpl< + _$RealtimeEventResponseTextDoneImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return responseTextDone( + eventId, type, responseId, itemId, outputIndex, contentIndex, text); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return responseTextDone?.call( + eventId, type, responseId, itemId, outputIndex, contentIndex, text); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (responseTextDone != null) { + return responseTextDone( + eventId, type, responseId, itemId, outputIndex, contentIndex, text); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return responseTextDone(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return responseTextDone?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (responseTextDone != null) { + return responseTextDone(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventResponseTextDoneImplToJson( + this, + ); + } +} + +abstract class RealtimeEventResponseTextDone extends RealtimeEvent { + const factory RealtimeEventResponseTextDone( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + @JsonKey(name: 'response_id') required final String responseId, + @JsonKey(name: 'item_id') required final String itemId, + @JsonKey(name: 'output_index') required final int outputIndex, + @JsonKey(name: 'content_index') required final int contentIndex, + required final String text}) = _$RealtimeEventResponseTextDoneImpl; + const RealtimeEventResponseTextDone._() : super._(); + + factory RealtimeEventResponseTextDone.fromJson(Map json) = + _$RealtimeEventResponseTextDoneImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The ID of the response. + @JsonKey(name: 'response_id') + String get responseId; + + /// The ID of the item. + @JsonKey(name: 'item_id') + String get itemId; + + /// The index of the output item in the response. + @JsonKey(name: 'output_index') + int get outputIndex; + + /// The index of the content part in the item's content array. + @JsonKey(name: 'content_index') + int get contentIndex; + + /// The final text content. + String get text; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventResponseTextDoneImplCopyWith< + _$RealtimeEventResponseTextDoneImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventSessionCreatedImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventSessionCreatedImplCopyWith( + _$RealtimeEventSessionCreatedImpl value, + $Res Function(_$RealtimeEventSessionCreatedImpl) then) = + __$$RealtimeEventSessionCreatedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + Session session}); + + $SessionCopyWith<$Res> get session; +} + +/// @nodoc +class __$$RealtimeEventSessionCreatedImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, _$RealtimeEventSessionCreatedImpl> + implements _$$RealtimeEventSessionCreatedImplCopyWith<$Res> { + __$$RealtimeEventSessionCreatedImplCopyWithImpl( + _$RealtimeEventSessionCreatedImpl _value, + $Res Function(_$RealtimeEventSessionCreatedImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? session = null, + }) { + return _then(_$RealtimeEventSessionCreatedImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + session: null == session + ? _value.session + : session // ignore: cast_nullable_to_non_nullable + as Session, + )); + } + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $SessionCopyWith<$Res> get session { + return $SessionCopyWith<$Res>(_value.session, (value) { + return _then(_value.copyWith(session: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventSessionCreatedImpl extends RealtimeEventSessionCreated { + const _$RealtimeEventSessionCreatedImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.sessionCreated, + required this.session}) + : super._(); + + factory _$RealtimeEventSessionCreatedImpl.fromJson( + Map json) => + _$$RealtimeEventSessionCreatedImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The session resource. + @override + final Session session; + + @override + String toString() { + return 'RealtimeEvent.sessionCreated(eventId: $eventId, type: $type, session: $session)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventSessionCreatedImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.session, session) || other.session == session)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, session); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventSessionCreatedImplCopyWith<_$RealtimeEventSessionCreatedImpl> + get copyWith => __$$RealtimeEventSessionCreatedImplCopyWithImpl< + _$RealtimeEventSessionCreatedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return sessionCreated(eventId, type, session); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return sessionCreated?.call(eventId, type, session); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (sessionCreated != null) { + return sessionCreated(eventId, type, session); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return sessionCreated(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return sessionCreated?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (sessionCreated != null) { + return sessionCreated(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventSessionCreatedImplToJson( + this, + ); + } +} + +abstract class RealtimeEventSessionCreated extends RealtimeEvent { + const factory RealtimeEventSessionCreated( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + required final Session session}) = _$RealtimeEventSessionCreatedImpl; + const RealtimeEventSessionCreated._() : super._(); + + factory RealtimeEventSessionCreated.fromJson(Map json) = + _$RealtimeEventSessionCreatedImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The session resource. + Session get session; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventSessionCreatedImplCopyWith<_$RealtimeEventSessionCreatedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventSessionUpdatedImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventSessionUpdatedImplCopyWith( + _$RealtimeEventSessionUpdatedImpl value, + $Res Function(_$RealtimeEventSessionUpdatedImpl) then) = + __$$RealtimeEventSessionUpdatedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + Session session}); + + $SessionCopyWith<$Res> get session; +} + +/// @nodoc +class __$$RealtimeEventSessionUpdatedImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, _$RealtimeEventSessionUpdatedImpl> + implements _$$RealtimeEventSessionUpdatedImplCopyWith<$Res> { + __$$RealtimeEventSessionUpdatedImplCopyWithImpl( + _$RealtimeEventSessionUpdatedImpl _value, + $Res Function(_$RealtimeEventSessionUpdatedImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? session = null, + }) { + return _then(_$RealtimeEventSessionUpdatedImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + session: null == session + ? _value.session + : session // ignore: cast_nullable_to_non_nullable + as Session, + )); + } + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $SessionCopyWith<$Res> get session { + return $SessionCopyWith<$Res>(_value.session, (value) { + return _then(_value.copyWith(session: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventSessionUpdatedImpl extends RealtimeEventSessionUpdated { + const _$RealtimeEventSessionUpdatedImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.sessionUpdated, + required this.session}) + : super._(); + + factory _$RealtimeEventSessionUpdatedImpl.fromJson( + Map json) => + _$$RealtimeEventSessionUpdatedImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// The session resource. + @override + final Session session; + + @override + String toString() { + return 'RealtimeEvent.sessionUpdated(eventId: $eventId, type: $type, session: $session)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventSessionUpdatedImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.session, session) || other.session == session)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, session); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventSessionUpdatedImplCopyWith<_$RealtimeEventSessionUpdatedImpl> + get copyWith => __$$RealtimeEventSessionUpdatedImplCopyWithImpl< + _$RealtimeEventSessionUpdatedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return sessionUpdated(eventId, type, session); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return sessionUpdated?.call(eventId, type, session); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (sessionUpdated != null) { + return sessionUpdated(eventId, type, session); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return sessionUpdated(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return sessionUpdated?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (sessionUpdated != null) { + return sessionUpdated(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventSessionUpdatedImplToJson( + this, + ); + } +} + +abstract class RealtimeEventSessionUpdated extends RealtimeEvent { + const factory RealtimeEventSessionUpdated( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + required final Session session}) = _$RealtimeEventSessionUpdatedImpl; + const RealtimeEventSessionUpdated._() : super._(); + + factory RealtimeEventSessionUpdated.fromJson(Map json) = + _$RealtimeEventSessionUpdatedImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// The session resource. + Session get session; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventSessionUpdatedImplCopyWith<_$RealtimeEventSessionUpdatedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventCloseImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventCloseImplCopyWith(_$RealtimeEventCloseImpl value, + $Res Function(_$RealtimeEventCloseImpl) then) = + __$$RealtimeEventCloseImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + bool error}); +} + +/// @nodoc +class __$$RealtimeEventCloseImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, _$RealtimeEventCloseImpl> + implements _$$RealtimeEventCloseImplCopyWith<$Res> { + __$$RealtimeEventCloseImplCopyWithImpl(_$RealtimeEventCloseImpl _value, + $Res Function(_$RealtimeEventCloseImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? error = null, + }) { + return _then(_$RealtimeEventCloseImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + error: null == error + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as bool, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventCloseImpl extends RealtimeEventClose { + const _$RealtimeEventCloseImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.close, + required this.error}) + : super._(); + + factory _$RealtimeEventCloseImpl.fromJson(Map json) => + _$$RealtimeEventCloseImplFromJson(json); + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// Whether the close was due to an error. + @override + final bool error; + + @override + String toString() { + return 'RealtimeEvent.close(eventId: $eventId, type: $type, error: $error)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventCloseImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.error, error) || other.error == error)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, error); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventCloseImplCopyWith<_$RealtimeEventCloseImpl> get copyWith => + __$$RealtimeEventCloseImplCopyWithImpl<_$RealtimeEventCloseImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return close(eventId, type, this.error); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return close?.call(eventId, type, this.error); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (close != null) { + return close(eventId, type, this.error); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return close(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return close?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (close != null) { + return close(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventCloseImplToJson( + this, + ); + } +} + +abstract class RealtimeEventClose extends RealtimeEvent { + const factory RealtimeEventClose( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + required final bool error}) = _$RealtimeEventCloseImpl; + const RealtimeEventClose._() : super._(); + + factory RealtimeEventClose.fromJson(Map json) = + _$RealtimeEventCloseImpl.fromJson; + + /// The unique ID of the server event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// Whether the close was due to an error. + bool get error; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventCloseImplCopyWith<_$RealtimeEventCloseImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventConversationInterruptedImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventConversationInterruptedImplCopyWith( + _$RealtimeEventConversationInterruptedImpl value, + $Res Function(_$RealtimeEventConversationInterruptedImpl) then) = + __$$RealtimeEventConversationInterruptedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, RealtimeEventType type}); +} + +/// @nodoc +class __$$RealtimeEventConversationInterruptedImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventConversationInterruptedImpl> + implements _$$RealtimeEventConversationInterruptedImplCopyWith<$Res> { + __$$RealtimeEventConversationInterruptedImplCopyWithImpl( + _$RealtimeEventConversationInterruptedImpl _value, + $Res Function(_$RealtimeEventConversationInterruptedImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + }) { + return _then(_$RealtimeEventConversationInterruptedImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventConversationInterruptedImpl + extends RealtimeEventConversationInterrupted { + const _$RealtimeEventConversationInterruptedImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.conversationInterrupted}) + : super._(); + + factory _$RealtimeEventConversationInterruptedImpl.fromJson( + Map json) => + _$$RealtimeEventConversationInterruptedImplFromJson(json); + + /// The unique ID of the event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + @override + String toString() { + return 'RealtimeEvent.conversationInterrupted(eventId: $eventId, type: $type)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventConversationInterruptedImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventConversationInterruptedImplCopyWith< + _$RealtimeEventConversationInterruptedImpl> + get copyWith => __$$RealtimeEventConversationInterruptedImplCopyWithImpl< + _$RealtimeEventConversationInterruptedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return conversationInterrupted(eventId, type); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return conversationInterrupted?.call(eventId, type); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (conversationInterrupted != null) { + return conversationInterrupted(eventId, type); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return conversationInterrupted(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return conversationInterrupted?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (conversationInterrupted != null) { + return conversationInterrupted(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventConversationInterruptedImplToJson( + this, + ); + } +} + +abstract class RealtimeEventConversationInterrupted extends RealtimeEvent { + const factory RealtimeEventConversationInterrupted( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type}) = + _$RealtimeEventConversationInterruptedImpl; + const RealtimeEventConversationInterrupted._() : super._(); + + factory RealtimeEventConversationInterrupted.fromJson( + Map json) = + _$RealtimeEventConversationInterruptedImpl.fromJson; + + /// The unique ID of the event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventConversationInterruptedImplCopyWith< + _$RealtimeEventConversationInterruptedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventConversationUpdatedImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventConversationUpdatedImplCopyWith( + _$RealtimeEventConversationUpdatedImpl value, + $Res Function(_$RealtimeEventConversationUpdatedImpl) then) = + __$$RealtimeEventConversationUpdatedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + EventHandlerResult result}); + + $EventHandlerResultCopyWith<$Res> get result; +} + +/// @nodoc +class __$$RealtimeEventConversationUpdatedImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventConversationUpdatedImpl> + implements _$$RealtimeEventConversationUpdatedImplCopyWith<$Res> { + __$$RealtimeEventConversationUpdatedImplCopyWithImpl( + _$RealtimeEventConversationUpdatedImpl _value, + $Res Function(_$RealtimeEventConversationUpdatedImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? result = null, + }) { + return _then(_$RealtimeEventConversationUpdatedImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + result: null == result + ? _value.result + : result // ignore: cast_nullable_to_non_nullable + as EventHandlerResult, + )); + } + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $EventHandlerResultCopyWith<$Res> get result { + return $EventHandlerResultCopyWith<$Res>(_value.result, (value) { + return _then(_value.copyWith(result: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventConversationUpdatedImpl + extends RealtimeEventConversationUpdated { + const _$RealtimeEventConversationUpdatedImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.conversationUpdated, + required this.result}) + : super._(); + + factory _$RealtimeEventConversationUpdatedImpl.fromJson( + Map json) => + _$$RealtimeEventConversationUpdatedImplFromJson(json); + + /// The unique ID of the event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// No Description + @override + final EventHandlerResult result; + + @override + String toString() { + return 'RealtimeEvent.conversationUpdated(eventId: $eventId, type: $type, result: $result)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventConversationUpdatedImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.result, result) || other.result == result)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, result); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventConversationUpdatedImplCopyWith< + _$RealtimeEventConversationUpdatedImpl> + get copyWith => __$$RealtimeEventConversationUpdatedImplCopyWithImpl< + _$RealtimeEventConversationUpdatedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return conversationUpdated(eventId, type, result); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return conversationUpdated?.call(eventId, type, result); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (conversationUpdated != null) { + return conversationUpdated(eventId, type, result); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return conversationUpdated(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return conversationUpdated?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (conversationUpdated != null) { + return conversationUpdated(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventConversationUpdatedImplToJson( + this, + ); + } +} + +abstract class RealtimeEventConversationUpdated extends RealtimeEvent { + const factory RealtimeEventConversationUpdated( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + required final EventHandlerResult result}) = + _$RealtimeEventConversationUpdatedImpl; + const RealtimeEventConversationUpdated._() : super._(); + + factory RealtimeEventConversationUpdated.fromJson(Map json) = + _$RealtimeEventConversationUpdatedImpl.fromJson; + + /// The unique ID of the event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// No Description + EventHandlerResult get result; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventConversationUpdatedImplCopyWith< + _$RealtimeEventConversationUpdatedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventConversationItemAppendedImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventConversationItemAppendedImplCopyWith( + _$RealtimeEventConversationItemAppendedImpl value, + $Res Function(_$RealtimeEventConversationItemAppendedImpl) then) = + __$$RealtimeEventConversationItemAppendedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + FormattedItem item}); + + $FormattedItemCopyWith<$Res> get item; +} + +/// @nodoc +class __$$RealtimeEventConversationItemAppendedImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventConversationItemAppendedImpl> + implements _$$RealtimeEventConversationItemAppendedImplCopyWith<$Res> { + __$$RealtimeEventConversationItemAppendedImplCopyWithImpl( + _$RealtimeEventConversationItemAppendedImpl _value, + $Res Function(_$RealtimeEventConversationItemAppendedImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? item = null, + }) { + return _then(_$RealtimeEventConversationItemAppendedImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + item: null == item + ? _value.item + : item // ignore: cast_nullable_to_non_nullable + as FormattedItem, + )); + } + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $FormattedItemCopyWith<$Res> get item { + return $FormattedItemCopyWith<$Res>(_value.item, (value) { + return _then(_value.copyWith(item: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventConversationItemAppendedImpl + extends RealtimeEventConversationItemAppended { + const _$RealtimeEventConversationItemAppendedImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.conversationItemAppended, + required this.item}) + : super._(); + + factory _$RealtimeEventConversationItemAppendedImpl.fromJson( + Map json) => + _$$RealtimeEventConversationItemAppendedImplFromJson(json); + + /// The unique ID of the event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// A formatted item. + @override + final FormattedItem item; + + @override + String toString() { + return 'RealtimeEvent.conversationItemAppended(eventId: $eventId, type: $type, item: $item)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventConversationItemAppendedImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.item, item) || other.item == item)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, item); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventConversationItemAppendedImplCopyWith< + _$RealtimeEventConversationItemAppendedImpl> + get copyWith => __$$RealtimeEventConversationItemAppendedImplCopyWithImpl< + _$RealtimeEventConversationItemAppendedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return conversationItemAppended(eventId, type, item); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return conversationItemAppended?.call(eventId, type, item); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (conversationItemAppended != null) { + return conversationItemAppended(eventId, type, item); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return conversationItemAppended(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return conversationItemAppended?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (conversationItemAppended != null) { + return conversationItemAppended(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventConversationItemAppendedImplToJson( + this, + ); + } +} + +abstract class RealtimeEventConversationItemAppended extends RealtimeEvent { + const factory RealtimeEventConversationItemAppended( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + required final FormattedItem item}) = + _$RealtimeEventConversationItemAppendedImpl; + const RealtimeEventConversationItemAppended._() : super._(); + + factory RealtimeEventConversationItemAppended.fromJson( + Map json) = + _$RealtimeEventConversationItemAppendedImpl.fromJson; + + /// The unique ID of the event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// A formatted item. + FormattedItem get item; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventConversationItemAppendedImplCopyWith< + _$RealtimeEventConversationItemAppendedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventConversationItemCompletedImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventConversationItemCompletedImplCopyWith( + _$RealtimeEventConversationItemCompletedImpl value, + $Res Function(_$RealtimeEventConversationItemCompletedImpl) then) = + __$$RealtimeEventConversationItemCompletedImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + FormattedItem item}); + + $FormattedItemCopyWith<$Res> get item; +} + +/// @nodoc +class __$$RealtimeEventConversationItemCompletedImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, + _$RealtimeEventConversationItemCompletedImpl> + implements _$$RealtimeEventConversationItemCompletedImplCopyWith<$Res> { + __$$RealtimeEventConversationItemCompletedImplCopyWithImpl( + _$RealtimeEventConversationItemCompletedImpl _value, + $Res Function(_$RealtimeEventConversationItemCompletedImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? item = null, + }) { + return _then(_$RealtimeEventConversationItemCompletedImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + item: null == item + ? _value.item + : item // ignore: cast_nullable_to_non_nullable + as FormattedItem, + )); + } + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $FormattedItemCopyWith<$Res> get item { + return $FormattedItemCopyWith<$Res>(_value.item, (value) { + return _then(_value.copyWith(item: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventConversationItemCompletedImpl + extends RealtimeEventConversationItemCompleted { + const _$RealtimeEventConversationItemCompletedImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.conversationItemCompleted, + required this.item}) + : super._(); + + factory _$RealtimeEventConversationItemCompletedImpl.fromJson( + Map json) => + _$$RealtimeEventConversationItemCompletedImplFromJson(json); + + /// The unique ID of the event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// A formatted item. + @override + final FormattedItem item; + + @override + String toString() { + return 'RealtimeEvent.conversationItemCompleted(eventId: $eventId, type: $type, item: $item)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventConversationItemCompletedImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.item, item) || other.item == item)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, item); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventConversationItemCompletedImplCopyWith< + _$RealtimeEventConversationItemCompletedImpl> + get copyWith => + __$$RealtimeEventConversationItemCompletedImplCopyWithImpl< + _$RealtimeEventConversationItemCompletedImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return conversationItemCompleted(eventId, type, item); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return conversationItemCompleted?.call(eventId, type, item); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (conversationItemCompleted != null) { + return conversationItemCompleted(eventId, type, item); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return conversationItemCompleted(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return conversationItemCompleted?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (conversationItemCompleted != null) { + return conversationItemCompleted(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventConversationItemCompletedImplToJson( + this, + ); + } +} + +abstract class RealtimeEventConversationItemCompleted extends RealtimeEvent { + const factory RealtimeEventConversationItemCompleted( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + required final FormattedItem item}) = + _$RealtimeEventConversationItemCompletedImpl; + const RealtimeEventConversationItemCompleted._() : super._(); + + factory RealtimeEventConversationItemCompleted.fromJson( + Map json) = + _$RealtimeEventConversationItemCompletedImpl.fromJson; + + /// The unique ID of the event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// A formatted item. + FormattedItem get item; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventConversationItemCompletedImplCopyWith< + _$RealtimeEventConversationItemCompletedImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$RealtimeEventGenericImplCopyWith<$Res> + implements $RealtimeEventCopyWith<$Res> { + factory _$$RealtimeEventGenericImplCopyWith(_$RealtimeEventGenericImpl value, + $Res Function(_$RealtimeEventGenericImpl) then) = + __$$RealtimeEventGenericImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + RealtimeEvent event}); + + $RealtimeEventCopyWith<$Res> get event; +} + +/// @nodoc +class __$$RealtimeEventGenericImplCopyWithImpl<$Res> + extends _$RealtimeEventCopyWithImpl<$Res, _$RealtimeEventGenericImpl> + implements _$$RealtimeEventGenericImplCopyWith<$Res> { + __$$RealtimeEventGenericImplCopyWithImpl(_$RealtimeEventGenericImpl _value, + $Res Function(_$RealtimeEventGenericImpl) _then) + : super(_value, _then); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? eventId = null, + Object? type = null, + Object? event = null, + }) { + return _then(_$RealtimeEventGenericImpl( + eventId: null == eventId + ? _value.eventId + : eventId // ignore: cast_nullable_to_non_nullable + as String, + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as RealtimeEventType, + event: null == event + ? _value.event + : event // ignore: cast_nullable_to_non_nullable + as RealtimeEvent, + )); + } + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $RealtimeEventCopyWith<$Res> get event { + return $RealtimeEventCopyWith<$Res>(_value.event, (value) { + return _then(_value.copyWith(event: value)); + }); + } +} + +/// @nodoc +@JsonSerializable() +class _$RealtimeEventGenericImpl extends RealtimeEventGeneric { + const _$RealtimeEventGenericImpl( + {@JsonKey(name: 'event_id') required this.eventId, + this.type = RealtimeEventType.realtimeEvent, + required this.event}) + : super._(); + + factory _$RealtimeEventGenericImpl.fromJson(Map json) => + _$$RealtimeEventGenericImplFromJson(json); + + /// The unique ID of the event. + @override + @JsonKey(name: 'event_id') + final String eventId; + + /// The type of the event. + @override + @JsonKey() + final RealtimeEventType type; + + /// A Realtime API event. + /// Any of: [RealtimeEventConversationItemCreate], [RealtimeEventConversationItemDelete], [RealtimeEventConversationItemTruncate], [RealtimeEventInputAudioBufferAppend], [RealtimeEventInputAudioBufferClear], [RealtimeEventInputAudioBufferCommit], [RealtimeEventResponseCancel], [RealtimeEventResponseCreate], [RealtimeEventSessionUpdate], [RealtimeEventConversationCreated], [RealtimeEventConversationItemCreated], [RealtimeEventConversationItemDeleted], [RealtimeEventConversationItemInputAudioTranscriptionCompleted], [RealtimeEventConversationItemInputAudioTranscriptionFailed], [RealtimeEventConversationItemTruncated], [RealtimeEventError], [RealtimeEventInputAudioBufferCleared], [RealtimeEventInputAudioBufferCommitted], [RealtimeEventInputAudioBufferSpeechStarted], [RealtimeEventInputAudioBufferSpeechStopped], [RealtimeEventRateLimitsUpdated], [RealtimeEventResponseAudioDelta], [RealtimeEventResponseAudioDone], [RealtimeEventResponseAudioTranscriptDelta], [RealtimeEventResponseAudioTranscriptDone], [RealtimeEventResponseContentPartAdded], [RealtimeEventResponseContentPartDone], [RealtimeEventResponseCreated], [RealtimeEventResponseDone], [RealtimeEventResponseFunctionCallArgumentsDelta], [RealtimeEventResponseFunctionCallArgumentsDone], [RealtimeEventResponseOutputItemAdded], [RealtimeEventResponseOutputItemDone], [RealtimeEventResponseTextDelta], [RealtimeEventResponseTextDone], [RealtimeEventSessionCreated], [RealtimeEventSessionUpdated], [RealtimeEventClose], [RealtimeEventConversationInterrupted], [RealtimeEventConversationUpdated], [RealtimeEventConversationItemAppended], [RealtimeEventConversationItemCompleted], [RealtimeEventGeneric] + @override + final RealtimeEvent event; + + @override + String toString() { + return 'RealtimeEvent.generic(eventId: $eventId, type: $type, event: $event)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RealtimeEventGenericImpl && + (identical(other.eventId, eventId) || other.eventId == eventId) && + (identical(other.type, type) || other.type == type) && + (identical(other.event, event) || other.event == event)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, eventId, type, event); + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RealtimeEventGenericImplCopyWith<_$RealtimeEventGenericImpl> + get copyWith => + __$$RealtimeEventGenericImplCopyWithImpl<_$RealtimeEventGenericImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item) + conversationItemCreate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDelete, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio) + inputAudioBufferAppend, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferClear, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCommit, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + responseCancel, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response) + responseCreate, + required TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session) + sessionUpdate, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation) + conversationCreated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item) + conversationItemCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId) + conversationItemDeleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error) + conversationItemInputAudioTranscriptionFailed, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs) + conversationItemTruncated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error) + error, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + inputAudioBufferCleared, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferCommitted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStarted, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId) + inputAudioBufferSpeechStopped, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits) + rateLimitsUpdated, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex) + responseAudioDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseAudioTranscriptDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript) + responseAudioTranscriptDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part) + responseContentPartDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response) + responseDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta) + responseFunctionCallArgumentsDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments) + responseFunctionCallArgumentsDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemAdded, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item) + responseOutputItemDone, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta) + responseTextDelta, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text) + responseTextDone, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionCreated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session) + sessionUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error) + close, + required TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type) + conversationInterrupted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result) + conversationUpdated, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemAppended, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item) + conversationItemCompleted, + required TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event) + generic, + }) { + return generic(eventId, type, event); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult? Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult? Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult? Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + }) { + return generic?.call(eventId, type, event); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id', includeIfNull: false) + String? previousItemId, + Item item)? + conversationItemCreate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDelete, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, String audio)? + inputAudioBufferAppend, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferClear, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCommit, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + responseCancel, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(includeIfNull: false) ResponseConfig? response)? + responseCreate, + TResult Function( + @JsonKey(name: 'event_id', includeIfNull: false) String? eventId, + RealtimeEventType type, + SessionConfig session)? + sessionUpdate, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Conversation conversation)? + conversationCreated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String? previousItemId, + Item item)? + conversationItemCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, @JsonKey(name: 'item_id') String itemId)? + conversationItemDeleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + TranscriptionError error)? + conversationItemInputAudioTranscriptionFailed, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'content_index') int contentIndex, + @JsonKey(name: 'audio_end_ms') int audioEndMs)? + conversationItemTruncated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, APIError error)? + error, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + inputAudioBufferCleared, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'previous_item_id') String previousItemId, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferCommitted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_start_ms') int audioStartMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStarted, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'audio_end_ms') int audioEndMs, + @JsonKey(name: 'item_id') String itemId)? + inputAudioBufferSpeechStopped, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'rate_limits') List rateLimits)? + rateLimitsUpdated, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex)? + responseAudioDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseAudioTranscriptDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String transcript)? + responseAudioTranscriptDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + ContentPart part)? + responseContentPartDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Response response)? + responseDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String delta)? + responseFunctionCallArgumentsDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'call_id') String callId, + String arguments)? + responseFunctionCallArgumentsDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemAdded, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'output_index') int outputIndex, + Item item)? + responseOutputItemDone, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String delta)? + responseTextDelta, + TResult Function( + @JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, + @JsonKey(name: 'response_id') String responseId, + @JsonKey(name: 'item_id') String itemId, + @JsonKey(name: 'output_index') int outputIndex, + @JsonKey(name: 'content_index') int contentIndex, + String text)? + responseTextDone, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionCreated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, Session session)? + sessionUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, bool error)? + close, + TResult Function( + @JsonKey(name: 'event_id') String eventId, RealtimeEventType type)? + conversationInterrupted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, EventHandlerResult result)? + conversationUpdated, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemAppended, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, FormattedItem item)? + conversationItemCompleted, + TResult Function(@JsonKey(name: 'event_id') String eventId, + RealtimeEventType type, RealtimeEvent event)? + generic, + required TResult orElse(), + }) { + if (generic != null) { + return generic(eventId, type, event); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(RealtimeEventConversationItemCreate value) + conversationItemCreate, + required TResult Function(RealtimeEventConversationItemDelete value) + conversationItemDelete, + required TResult Function(RealtimeEventConversationItemTruncate value) + conversationItemTruncate, + required TResult Function(RealtimeEventInputAudioBufferAppend value) + inputAudioBufferAppend, + required TResult Function(RealtimeEventInputAudioBufferClear value) + inputAudioBufferClear, + required TResult Function(RealtimeEventInputAudioBufferCommit value) + inputAudioBufferCommit, + required TResult Function(RealtimeEventResponseCancel value) responseCancel, + required TResult Function(RealtimeEventResponseCreate value) responseCreate, + required TResult Function(RealtimeEventSessionUpdate value) sessionUpdate, + required TResult Function(RealtimeEventConversationCreated value) + conversationCreated, + required TResult Function(RealtimeEventConversationItemCreated value) + conversationItemCreated, + required TResult Function(RealtimeEventConversationItemDeleted value) + conversationItemDeleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted value) + conversationItemInputAudioTranscriptionCompleted, + required TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value) + conversationItemInputAudioTranscriptionFailed, + required TResult Function(RealtimeEventConversationItemTruncated value) + conversationItemTruncated, + required TResult Function(RealtimeEventError value) error, + required TResult Function(RealtimeEventInputAudioBufferCleared value) + inputAudioBufferCleared, + required TResult Function(RealtimeEventInputAudioBufferCommitted value) + inputAudioBufferCommitted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStarted value) + inputAudioBufferSpeechStarted, + required TResult Function(RealtimeEventInputAudioBufferSpeechStopped value) + inputAudioBufferSpeechStopped, + required TResult Function(RealtimeEventRateLimitsUpdated value) + rateLimitsUpdated, + required TResult Function(RealtimeEventResponseAudioDelta value) + responseAudioDelta, + required TResult Function(RealtimeEventResponseAudioDone value) + responseAudioDone, + required TResult Function(RealtimeEventResponseAudioTranscriptDelta value) + responseAudioTranscriptDelta, + required TResult Function(RealtimeEventResponseAudioTranscriptDone value) + responseAudioTranscriptDone, + required TResult Function(RealtimeEventResponseContentPartAdded value) + responseContentPartAdded, + required TResult Function(RealtimeEventResponseContentPartDone value) + responseContentPartDone, + required TResult Function(RealtimeEventResponseCreated value) + responseCreated, + required TResult Function(RealtimeEventResponseDone value) responseDone, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDelta value) + responseFunctionCallArgumentsDelta, + required TResult Function( + RealtimeEventResponseFunctionCallArgumentsDone value) + responseFunctionCallArgumentsDone, + required TResult Function(RealtimeEventResponseOutputItemAdded value) + responseOutputItemAdded, + required TResult Function(RealtimeEventResponseOutputItemDone value) + responseOutputItemDone, + required TResult Function(RealtimeEventResponseTextDelta value) + responseTextDelta, + required TResult Function(RealtimeEventResponseTextDone value) + responseTextDone, + required TResult Function(RealtimeEventSessionCreated value) sessionCreated, + required TResult Function(RealtimeEventSessionUpdated value) sessionUpdated, + required TResult Function(RealtimeEventClose value) close, + required TResult Function(RealtimeEventConversationInterrupted value) + conversationInterrupted, + required TResult Function(RealtimeEventConversationUpdated value) + conversationUpdated, + required TResult Function(RealtimeEventConversationItemAppended value) + conversationItemAppended, + required TResult Function(RealtimeEventConversationItemCompleted value) + conversationItemCompleted, + required TResult Function(RealtimeEventGeneric value) generic, + }) { + return generic(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult? Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult? Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult? Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult? Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult? Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult? Function(RealtimeEventResponseCancel value)? responseCancel, + TResult? Function(RealtimeEventResponseCreate value)? responseCreate, + TResult? Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult? Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult? Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult? Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult? Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult? Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult? Function(RealtimeEventError value)? error, + TResult? Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult? Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult? Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult? Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult? Function(RealtimeEventResponseAudioDelta value)? + responseAudioDelta, + TResult? Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult? Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult? Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult? Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult? Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult? Function(RealtimeEventResponseCreated value)? responseCreated, + TResult? Function(RealtimeEventResponseDone value)? responseDone, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult? Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult? Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult? Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult? Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult? Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult? Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult? Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult? Function(RealtimeEventClose value)? close, + TResult? Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult? Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult? Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult? Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult? Function(RealtimeEventGeneric value)? generic, + }) { + return generic?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(RealtimeEventConversationItemCreate value)? + conversationItemCreate, + TResult Function(RealtimeEventConversationItemDelete value)? + conversationItemDelete, + TResult Function(RealtimeEventConversationItemTruncate value)? + conversationItemTruncate, + TResult Function(RealtimeEventInputAudioBufferAppend value)? + inputAudioBufferAppend, + TResult Function(RealtimeEventInputAudioBufferClear value)? + inputAudioBufferClear, + TResult Function(RealtimeEventInputAudioBufferCommit value)? + inputAudioBufferCommit, + TResult Function(RealtimeEventResponseCancel value)? responseCancel, + TResult Function(RealtimeEventResponseCreate value)? responseCreate, + TResult Function(RealtimeEventSessionUpdate value)? sessionUpdate, + TResult Function(RealtimeEventConversationCreated value)? + conversationCreated, + TResult Function(RealtimeEventConversationItemCreated value)? + conversationItemCreated, + TResult Function(RealtimeEventConversationItemDeleted value)? + conversationItemDeleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionCompleted + value)? + conversationItemInputAudioTranscriptionCompleted, + TResult Function( + RealtimeEventConversationItemInputAudioTranscriptionFailed value)? + conversationItemInputAudioTranscriptionFailed, + TResult Function(RealtimeEventConversationItemTruncated value)? + conversationItemTruncated, + TResult Function(RealtimeEventError value)? error, + TResult Function(RealtimeEventInputAudioBufferCleared value)? + inputAudioBufferCleared, + TResult Function(RealtimeEventInputAudioBufferCommitted value)? + inputAudioBufferCommitted, + TResult Function(RealtimeEventInputAudioBufferSpeechStarted value)? + inputAudioBufferSpeechStarted, + TResult Function(RealtimeEventInputAudioBufferSpeechStopped value)? + inputAudioBufferSpeechStopped, + TResult Function(RealtimeEventRateLimitsUpdated value)? rateLimitsUpdated, + TResult Function(RealtimeEventResponseAudioDelta value)? responseAudioDelta, + TResult Function(RealtimeEventResponseAudioDone value)? responseAudioDone, + TResult Function(RealtimeEventResponseAudioTranscriptDelta value)? + responseAudioTranscriptDelta, + TResult Function(RealtimeEventResponseAudioTranscriptDone value)? + responseAudioTranscriptDone, + TResult Function(RealtimeEventResponseContentPartAdded value)? + responseContentPartAdded, + TResult Function(RealtimeEventResponseContentPartDone value)? + responseContentPartDone, + TResult Function(RealtimeEventResponseCreated value)? responseCreated, + TResult Function(RealtimeEventResponseDone value)? responseDone, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDelta value)? + responseFunctionCallArgumentsDelta, + TResult Function(RealtimeEventResponseFunctionCallArgumentsDone value)? + responseFunctionCallArgumentsDone, + TResult Function(RealtimeEventResponseOutputItemAdded value)? + responseOutputItemAdded, + TResult Function(RealtimeEventResponseOutputItemDone value)? + responseOutputItemDone, + TResult Function(RealtimeEventResponseTextDelta value)? responseTextDelta, + TResult Function(RealtimeEventResponseTextDone value)? responseTextDone, + TResult Function(RealtimeEventSessionCreated value)? sessionCreated, + TResult Function(RealtimeEventSessionUpdated value)? sessionUpdated, + TResult Function(RealtimeEventClose value)? close, + TResult Function(RealtimeEventConversationInterrupted value)? + conversationInterrupted, + TResult Function(RealtimeEventConversationUpdated value)? + conversationUpdated, + TResult Function(RealtimeEventConversationItemAppended value)? + conversationItemAppended, + TResult Function(RealtimeEventConversationItemCompleted value)? + conversationItemCompleted, + TResult Function(RealtimeEventGeneric value)? generic, + required TResult orElse(), + }) { + if (generic != null) { + return generic(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$RealtimeEventGenericImplToJson( + this, + ); + } +} + +abstract class RealtimeEventGeneric extends RealtimeEvent { + const factory RealtimeEventGeneric( + {@JsonKey(name: 'event_id') required final String eventId, + final RealtimeEventType type, + required final RealtimeEvent event}) = _$RealtimeEventGenericImpl; + const RealtimeEventGeneric._() : super._(); + + factory RealtimeEventGeneric.fromJson(Map json) = + _$RealtimeEventGenericImpl.fromJson; + + /// The unique ID of the event. + @override + @JsonKey(name: 'event_id') + String get eventId; + + /// The type of the event. + @override + RealtimeEventType get type; + + /// A Realtime API event. + /// Any of: [RealtimeEventConversationItemCreate], [RealtimeEventConversationItemDelete], [RealtimeEventConversationItemTruncate], [RealtimeEventInputAudioBufferAppend], [RealtimeEventInputAudioBufferClear], [RealtimeEventInputAudioBufferCommit], [RealtimeEventResponseCancel], [RealtimeEventResponseCreate], [RealtimeEventSessionUpdate], [RealtimeEventConversationCreated], [RealtimeEventConversationItemCreated], [RealtimeEventConversationItemDeleted], [RealtimeEventConversationItemInputAudioTranscriptionCompleted], [RealtimeEventConversationItemInputAudioTranscriptionFailed], [RealtimeEventConversationItemTruncated], [RealtimeEventError], [RealtimeEventInputAudioBufferCleared], [RealtimeEventInputAudioBufferCommitted], [RealtimeEventInputAudioBufferSpeechStarted], [RealtimeEventInputAudioBufferSpeechStopped], [RealtimeEventRateLimitsUpdated], [RealtimeEventResponseAudioDelta], [RealtimeEventResponseAudioDone], [RealtimeEventResponseAudioTranscriptDelta], [RealtimeEventResponseAudioTranscriptDone], [RealtimeEventResponseContentPartAdded], [RealtimeEventResponseContentPartDone], [RealtimeEventResponseCreated], [RealtimeEventResponseDone], [RealtimeEventResponseFunctionCallArgumentsDelta], [RealtimeEventResponseFunctionCallArgumentsDone], [RealtimeEventResponseOutputItemAdded], [RealtimeEventResponseOutputItemDone], [RealtimeEventResponseTextDelta], [RealtimeEventResponseTextDone], [RealtimeEventSessionCreated], [RealtimeEventSessionUpdated], [RealtimeEventClose], [RealtimeEventConversationInterrupted], [RealtimeEventConversationUpdated], [RealtimeEventConversationItemAppended], [RealtimeEventConversationItemCompleted], [RealtimeEventGeneric] + RealtimeEvent get event; + + /// Create a copy of RealtimeEvent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RealtimeEventGenericImplCopyWith<_$RealtimeEventGenericImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/schema.g.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/schema.g.dart new file mode 100644 index 00000000..5bd69e76 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/schema.g.dart @@ -0,0 +1,2099 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ignore_for_file: prefer_final_parameters, require_trailing_commas, non_constant_identifier_names, unnecessary_null_checks + +part of 'schema.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$ToolDefinitionImpl _$$ToolDefinitionImplFromJson(Map json) => + _$ToolDefinitionImpl( + type: $enumDecodeNullable(_$ToolTypeEnumMap, json['type']) ?? + ToolType.function, + name: json['name'] as String, + description: json['description'] as String?, + parameters: json['parameters'], + ); + +Map _$$ToolDefinitionImplToJson( + _$ToolDefinitionImpl instance) { + final val = { + 'type': _$ToolTypeEnumMap[instance.type]!, + 'name': instance.name, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('description', instance.description); + writeNotNull('parameters', instance.parameters); + return val; +} + +const _$ToolTypeEnumMap = { + ToolType.function: 'function', +}; + +_$ToolChoiceForcedImpl _$$ToolChoiceForcedImplFromJson( + Map json) => + _$ToolChoiceForcedImpl( + type: $enumDecodeNullable(_$ToolTypeEnumMap, json['type']) ?? + ToolType.function, + name: json['name'] as String, + ); + +Map _$$ToolChoiceForcedImplToJson( + _$ToolChoiceForcedImpl instance) => + { + 'type': _$ToolTypeEnumMap[instance.type]!, + 'name': instance.name, + }; + +_$InputAudioTranscriptionConfigImpl + _$$InputAudioTranscriptionConfigImplFromJson(Map json) => + _$InputAudioTranscriptionConfigImpl( + enabled: json['enabled'] as bool?, + model: json['model'] as String?, + ); + +Map _$$InputAudioTranscriptionConfigImplToJson( + _$InputAudioTranscriptionConfigImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('enabled', instance.enabled); + writeNotNull('model', instance.model); + return val; +} + +_$TurnDetectionImpl _$$TurnDetectionImplFromJson(Map json) => + _$TurnDetectionImpl( + type: $enumDecode(_$TurnDetectionTypeEnumMap, json['type']), + threshold: (json['threshold'] as num?)?.toDouble(), + prefixPaddingMs: (json['prefix_padding_ms'] as num?)?.toInt(), + silenceDurationMs: (json['silence_duration_ms'] as num?)?.toInt(), + ); + +Map _$$TurnDetectionImplToJson(_$TurnDetectionImpl instance) { + final val = { + 'type': _$TurnDetectionTypeEnumMap[instance.type]!, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('threshold', instance.threshold); + writeNotNull('prefix_padding_ms', instance.prefixPaddingMs); + writeNotNull('silence_duration_ms', instance.silenceDurationMs); + return val; +} + +const _$TurnDetectionTypeEnumMap = { + TurnDetectionType.serverVad: 'server_vad', +}; + +_$RateLimitImpl _$$RateLimitImplFromJson(Map json) => + _$RateLimitImpl( + name: $enumDecode(_$RateLimitNameEnumMap, json['name']), + limit: (json['limit'] as num).toInt(), + remaining: (json['remaining'] as num).toInt(), + resetSeconds: (json['reset_seconds'] as num).toDouble(), + ); + +Map _$$RateLimitImplToJson(_$RateLimitImpl instance) => + { + 'name': _$RateLimitNameEnumMap[instance.name]!, + 'limit': instance.limit, + 'remaining': instance.remaining, + 'reset_seconds': instance.resetSeconds, + }; + +const _$RateLimitNameEnumMap = { + RateLimitName.requests: 'requests', + RateLimitName.tokens: 'tokens', + RateLimitName.inputTokens: 'input_tokens', + RateLimitName.outputTokens: 'output_tokens', +}; + +_$ResponseImpl _$$ResponseImplFromJson(Map json) => + _$ResponseImpl( + id: json['id'] as String, + object: $enumDecodeNullable(_$ObjectTypeEnumMap, json['object']) ?? + ObjectType.realtimeResponse, + status: $enumDecode(_$ResponseStatusEnumMap, json['status']), + statusDetails: json['status_details'] == null + ? null + : ResponseStatusDetails.fromJson( + json['status_details'] as Map), + output: (json['output'] as List) + .map((e) => Item.fromJson(e as Map)) + .toList(), + usage: json['usage'] == null + ? null + : Usage.fromJson(json['usage'] as Map), + ); + +Map _$$ResponseImplToJson(_$ResponseImpl instance) { + final val = { + 'id': instance.id, + 'object': _$ObjectTypeEnumMap[instance.object]!, + 'status': _$ResponseStatusEnumMap[instance.status]!, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('status_details', instance.statusDetails?.toJson()); + val['output'] = instance.output.map((e) => e.toJson()).toList(); + writeNotNull('usage', instance.usage?.toJson()); + return val; +} + +const _$ObjectTypeEnumMap = { + ObjectType.realtimeItem: 'realtime.item', + ObjectType.realtimeResponse: 'realtime.response', + ObjectType.realtimeSession: 'realtime.session', + ObjectType.realtimeConversation: 'realtime.conversation', +}; + +const _$ResponseStatusEnumMap = { + ResponseStatus.inProgress: 'in_progress', + ResponseStatus.completed: 'completed', + ResponseStatus.cancelled: 'cancelled', + ResponseStatus.failed: 'failed', + ResponseStatus.incomplete: 'incomplete', +}; + +_$ResponseConfigImpl _$$ResponseConfigImplFromJson(Map json) => + _$ResponseConfigImpl( + modalities: (json['modalities'] as List?) + ?.map((e) => $enumDecode(_$ModalityEnumMap, e)) + .toList(), + instructions: json['instructions'] as String?, + voice: $enumDecodeNullable(_$VoiceEnumMap, json['voice'], + unknownValue: JsonKey.nullForUndefinedEnumValue), + outputAudioFormat: $enumDecodeNullable( + _$AudioFormatEnumMap, json['output_audio_format'], + unknownValue: JsonKey.nullForUndefinedEnumValue), + tools: (json['tools'] as List?) + ?.map((e) => ToolDefinition.fromJson(e as Map)) + .toList(), + toolChoice: const _ResponseConfigToolChoiceConverter() + .fromJson(json['tool_choice']), + temperature: (json['temperature'] as num?)?.toDouble(), + maxResponseOutputTokens: + const _ResponseConfigMaxResponseOutputTokensConverter() + .fromJson(json['max_response_output_tokens']), + ); + +Map _$$ResponseConfigImplToJson( + _$ResponseConfigImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('modalities', + instance.modalities?.map((e) => _$ModalityEnumMap[e]!).toList()); + writeNotNull('instructions', instance.instructions); + writeNotNull('voice', _$VoiceEnumMap[instance.voice]); + writeNotNull( + 'output_audio_format', _$AudioFormatEnumMap[instance.outputAudioFormat]); + writeNotNull('tools', instance.tools?.map((e) => e.toJson()).toList()); + writeNotNull('tool_choice', + const _ResponseConfigToolChoiceConverter().toJson(instance.toolChoice)); + writeNotNull('temperature', instance.temperature); + writeNotNull( + 'max_response_output_tokens', + const _ResponseConfigMaxResponseOutputTokensConverter() + .toJson(instance.maxResponseOutputTokens)); + return val; +} + +const _$ModalityEnumMap = { + Modality.text: 'text', + Modality.audio: 'audio', +}; + +const _$VoiceEnumMap = { + Voice.alloy: 'alloy', + Voice.echo: 'echo', + Voice.shimmer: 'shimmer', +}; + +const _$AudioFormatEnumMap = { + AudioFormat.pcm16: 'pcm16', + AudioFormat.g711Ulaw: 'g711_ulaw', + AudioFormat.g711Alaw: 'g711_alaw', +}; + +_$ResponseConfigToolChoiceEnumerationImpl + _$$ResponseConfigToolChoiceEnumerationImplFromJson( + Map json) => + _$ResponseConfigToolChoiceEnumerationImpl( + $enumDecode(_$ResponseConfigToolChoiceModeEnumMap, json['value']), + $type: json['runtimeType'] as String?, + ); + +Map _$$ResponseConfigToolChoiceEnumerationImplToJson( + _$ResponseConfigToolChoiceEnumerationImpl instance) => + { + 'value': _$ResponseConfigToolChoiceModeEnumMap[instance.value]!, + 'runtimeType': instance.$type, + }; + +const _$ResponseConfigToolChoiceModeEnumMap = { + ResponseConfigToolChoiceMode.none: 'none', + ResponseConfigToolChoiceMode.auto: 'auto', + ResponseConfigToolChoiceMode.required: 'required', +}; + +_$ResponseConfigToolChoiceToolChoiceForcedImpl + _$$ResponseConfigToolChoiceToolChoiceForcedImplFromJson( + Map json) => + _$ResponseConfigToolChoiceToolChoiceForcedImpl( + ToolChoiceForced.fromJson(json['value'] as Map), + $type: json['runtimeType'] as String?, + ); + +Map _$$ResponseConfigToolChoiceToolChoiceForcedImplToJson( + _$ResponseConfigToolChoiceToolChoiceForcedImpl instance) => + { + 'value': instance.value.toJson(), + 'runtimeType': instance.$type, + }; + +_$ResponseConfigMaxResponseOutputTokensIntImpl + _$$ResponseConfigMaxResponseOutputTokensIntImplFromJson( + Map json) => + _$ResponseConfigMaxResponseOutputTokensIntImpl( + (json['value'] as num).toInt(), + $type: json['runtimeType'] as String?, + ); + +Map _$$ResponseConfigMaxResponseOutputTokensIntImplToJson( + _$ResponseConfigMaxResponseOutputTokensIntImpl instance) => + { + 'value': instance.value, + 'runtimeType': instance.$type, + }; + +_$ResponseConfigMaxResponseOutputTokensStringImpl + _$$ResponseConfigMaxResponseOutputTokensStringImplFromJson( + Map json) => + _$ResponseConfigMaxResponseOutputTokensStringImpl( + json['value'] as String, + $type: json['runtimeType'] as String?, + ); + +Map _$$ResponseConfigMaxResponseOutputTokensStringImplToJson( + _$ResponseConfigMaxResponseOutputTokensStringImpl instance) => + { + 'value': instance.value, + 'runtimeType': instance.$type, + }; + +_$UsageImpl _$$UsageImplFromJson(Map json) => _$UsageImpl( + totalTokens: (json['total_tokens'] as num?)?.toInt(), + inputTokens: (json['input_tokens'] as num?)?.toInt(), + outputTokens: (json['output_tokens'] as num?)?.toInt(), + inputTokenDetails: json['input_token_details'] == null + ? null + : UsageInputTokenDetails.fromJson( + json['input_token_details'] as Map), + ); + +Map _$$UsageImplToJson(_$UsageImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('total_tokens', instance.totalTokens); + writeNotNull('input_tokens', instance.inputTokens); + writeNotNull('output_tokens', instance.outputTokens); + writeNotNull('input_token_details', instance.inputTokenDetails?.toJson()); + return val; +} + +_$UsageInputTokenDetailsImpl _$$UsageInputTokenDetailsImplFromJson( + Map json) => + _$UsageInputTokenDetailsImpl( + cachedTokens: (json['cached_tokens'] as num?)?.toInt(), + textTokens: (json['text_tokens'] as num?)?.toInt(), + audioTokens: (json['audio_tokens'] as num?)?.toInt(), + ); + +Map _$$UsageInputTokenDetailsImplToJson( + _$UsageInputTokenDetailsImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('cached_tokens', instance.cachedTokens); + writeNotNull('text_tokens', instance.textTokens); + writeNotNull('audio_tokens', instance.audioTokens); + return val; +} + +_$SessionImpl _$$SessionImplFromJson(Map json) => + _$SessionImpl( + id: json['id'] as String?, + object: $enumDecodeNullable(_$ObjectTypeEnumMap, json['object']) ?? + ObjectType.realtimeSession, + model: json['model'] as String?, + expiresAt: (json['expires_at'] as num?)?.toInt(), + modalities: (json['modalities'] as List?) + ?.map((e) => $enumDecode(_$ModalityEnumMap, e)) + .toList(), + instructions: json['instructions'] as String?, + voice: $enumDecodeNullable(_$VoiceEnumMap, json['voice'], + unknownValue: JsonKey.nullForUndefinedEnumValue), + inputAudioFormat: $enumDecodeNullable( + _$AudioFormatEnumMap, json['input_audio_format'], + unknownValue: JsonKey.nullForUndefinedEnumValue), + outputAudioFormat: $enumDecodeNullable( + _$AudioFormatEnumMap, json['output_audio_format'], + unknownValue: JsonKey.nullForUndefinedEnumValue), + inputAudioTranscription: json['input_audio_transcription'] == null + ? null + : InputAudioTranscriptionConfig.fromJson( + json['input_audio_transcription'] as Map), + turnDetection: json['turn_detection'] == null + ? null + : TurnDetection.fromJson( + json['turn_detection'] as Map), + tools: (json['tools'] as List?) + ?.map((e) => ToolDefinition.fromJson(e as Map)) + .toList(), + toolChoice: + const _SessionToolChoiceConverter().fromJson(json['tool_choice']), + temperature: (json['temperature'] as num?)?.toDouble(), + maxResponseOutputTokens: const _SessionMaxResponseOutputTokensConverter() + .fromJson(json['max_response_output_tokens']), + ); + +Map _$$SessionImplToJson(_$SessionImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('id', instance.id); + val['object'] = _$ObjectTypeEnumMap[instance.object]!; + writeNotNull('model', instance.model); + writeNotNull('expires_at', instance.expiresAt); + writeNotNull('modalities', + instance.modalities?.map((e) => _$ModalityEnumMap[e]!).toList()); + writeNotNull('instructions', instance.instructions); + writeNotNull('voice', _$VoiceEnumMap[instance.voice]); + writeNotNull( + 'input_audio_format', _$AudioFormatEnumMap[instance.inputAudioFormat]); + writeNotNull( + 'output_audio_format', _$AudioFormatEnumMap[instance.outputAudioFormat]); + writeNotNull( + 'input_audio_transcription', instance.inputAudioTranscription?.toJson()); + writeNotNull('turn_detection', instance.turnDetection?.toJson()); + writeNotNull('tools', instance.tools?.map((e) => e.toJson()).toList()); + writeNotNull('tool_choice', + const _SessionToolChoiceConverter().toJson(instance.toolChoice)); + writeNotNull('temperature', instance.temperature); + writeNotNull( + 'max_response_output_tokens', + const _SessionMaxResponseOutputTokensConverter() + .toJson(instance.maxResponseOutputTokens)); + return val; +} + +_$SessionToolChoiceEnumerationImpl _$$SessionToolChoiceEnumerationImplFromJson( + Map json) => + _$SessionToolChoiceEnumerationImpl( + $enumDecode(_$SessionToolChoiceModeEnumMap, json['value']), + $type: json['runtimeType'] as String?, + ); + +Map _$$SessionToolChoiceEnumerationImplToJson( + _$SessionToolChoiceEnumerationImpl instance) => + { + 'value': _$SessionToolChoiceModeEnumMap[instance.value]!, + 'runtimeType': instance.$type, + }; + +const _$SessionToolChoiceModeEnumMap = { + SessionToolChoiceMode.none: 'none', + SessionToolChoiceMode.auto: 'auto', + SessionToolChoiceMode.required: 'required', +}; + +_$SessionToolChoiceToolChoiceForcedImpl + _$$SessionToolChoiceToolChoiceForcedImplFromJson( + Map json) => + _$SessionToolChoiceToolChoiceForcedImpl( + ToolChoiceForced.fromJson(json['value'] as Map), + $type: json['runtimeType'] as String?, + ); + +Map _$$SessionToolChoiceToolChoiceForcedImplToJson( + _$SessionToolChoiceToolChoiceForcedImpl instance) => + { + 'value': instance.value.toJson(), + 'runtimeType': instance.$type, + }; + +_$SessionMaxResponseOutputTokensIntImpl + _$$SessionMaxResponseOutputTokensIntImplFromJson( + Map json) => + _$SessionMaxResponseOutputTokensIntImpl( + (json['value'] as num).toInt(), + $type: json['runtimeType'] as String?, + ); + +Map _$$SessionMaxResponseOutputTokensIntImplToJson( + _$SessionMaxResponseOutputTokensIntImpl instance) => + { + 'value': instance.value, + 'runtimeType': instance.$type, + }; + +_$SessionMaxResponseOutputTokensStringImpl + _$$SessionMaxResponseOutputTokensStringImplFromJson( + Map json) => + _$SessionMaxResponseOutputTokensStringImpl( + json['value'] as String, + $type: json['runtimeType'] as String?, + ); + +Map _$$SessionMaxResponseOutputTokensStringImplToJson( + _$SessionMaxResponseOutputTokensStringImpl instance) => + { + 'value': instance.value, + 'runtimeType': instance.$type, + }; + +_$SessionConfigImpl _$$SessionConfigImplFromJson(Map json) => + _$SessionConfigImpl( + modalities: (json['modalities'] as List?) + ?.map((e) => $enumDecode(_$ModalityEnumMap, e)) + .toList(), + instructions: json['instructions'] as String?, + voice: $enumDecodeNullable(_$VoiceEnumMap, json['voice'], + unknownValue: JsonKey.nullForUndefinedEnumValue), + inputAudioFormat: $enumDecodeNullable( + _$AudioFormatEnumMap, json['input_audio_format'], + unknownValue: JsonKey.nullForUndefinedEnumValue), + outputAudioFormat: $enumDecodeNullable( + _$AudioFormatEnumMap, json['output_audio_format'], + unknownValue: JsonKey.nullForUndefinedEnumValue), + inputAudioTranscription: json['input_audio_transcription'] == null + ? null + : InputAudioTranscriptionConfig.fromJson( + json['input_audio_transcription'] as Map), + turnDetection: json['turn_detection'] == null + ? null + : TurnDetection.fromJson( + json['turn_detection'] as Map), + tools: (json['tools'] as List?) + ?.map((e) => ToolDefinition.fromJson(e as Map)) + .toList(), + toolChoice: const _SessionConfigToolChoiceConverter() + .fromJson(json['tool_choice']), + temperature: (json['temperature'] as num?)?.toDouble(), + maxResponseOutputTokens: + const _SessionConfigMaxResponseOutputTokensConverter() + .fromJson(json['max_response_output_tokens']), + ); + +Map _$$SessionConfigImplToJson(_$SessionConfigImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('modalities', + instance.modalities?.map((e) => _$ModalityEnumMap[e]!).toList()); + writeNotNull('instructions', instance.instructions); + writeNotNull('voice', _$VoiceEnumMap[instance.voice]); + writeNotNull( + 'input_audio_format', _$AudioFormatEnumMap[instance.inputAudioFormat]); + writeNotNull( + 'output_audio_format', _$AudioFormatEnumMap[instance.outputAudioFormat]); + writeNotNull( + 'input_audio_transcription', instance.inputAudioTranscription?.toJson()); + writeNotNull('turn_detection', instance.turnDetection?.toJson()); + writeNotNull('tools', instance.tools?.map((e) => e.toJson()).toList()); + writeNotNull('tool_choice', + const _SessionConfigToolChoiceConverter().toJson(instance.toolChoice)); + writeNotNull('temperature', instance.temperature); + writeNotNull( + 'max_response_output_tokens', + const _SessionConfigMaxResponseOutputTokensConverter() + .toJson(instance.maxResponseOutputTokens)); + return val; +} + +_$SessionConfigToolChoiceEnumerationImpl + _$$SessionConfigToolChoiceEnumerationImplFromJson( + Map json) => + _$SessionConfigToolChoiceEnumerationImpl( + $enumDecode(_$SessionConfigToolChoiceModeEnumMap, json['value']), + $type: json['runtimeType'] as String?, + ); + +Map _$$SessionConfigToolChoiceEnumerationImplToJson( + _$SessionConfigToolChoiceEnumerationImpl instance) => + { + 'value': _$SessionConfigToolChoiceModeEnumMap[instance.value]!, + 'runtimeType': instance.$type, + }; + +const _$SessionConfigToolChoiceModeEnumMap = { + SessionConfigToolChoiceMode.none: 'none', + SessionConfigToolChoiceMode.auto: 'auto', + SessionConfigToolChoiceMode.required: 'required', +}; + +_$SessionConfigToolChoiceToolChoiceForcedImpl + _$$SessionConfigToolChoiceToolChoiceForcedImplFromJson( + Map json) => + _$SessionConfigToolChoiceToolChoiceForcedImpl( + ToolChoiceForced.fromJson(json['value'] as Map), + $type: json['runtimeType'] as String?, + ); + +Map _$$SessionConfigToolChoiceToolChoiceForcedImplToJson( + _$SessionConfigToolChoiceToolChoiceForcedImpl instance) => + { + 'value': instance.value.toJson(), + 'runtimeType': instance.$type, + }; + +_$SessionConfigMaxResponseOutputTokensIntImpl + _$$SessionConfigMaxResponseOutputTokensIntImplFromJson( + Map json) => + _$SessionConfigMaxResponseOutputTokensIntImpl( + (json['value'] as num).toInt(), + $type: json['runtimeType'] as String?, + ); + +Map _$$SessionConfigMaxResponseOutputTokensIntImplToJson( + _$SessionConfigMaxResponseOutputTokensIntImpl instance) => + { + 'value': instance.value, + 'runtimeType': instance.$type, + }; + +_$SessionConfigMaxResponseOutputTokensStringImpl + _$$SessionConfigMaxResponseOutputTokensStringImplFromJson( + Map json) => + _$SessionConfigMaxResponseOutputTokensStringImpl( + json['value'] as String, + $type: json['runtimeType'] as String?, + ); + +Map _$$SessionConfigMaxResponseOutputTokensStringImplToJson( + _$SessionConfigMaxResponseOutputTokensStringImpl instance) => + { + 'value': instance.value, + 'runtimeType': instance.$type, + }; + +_$ConversationImpl _$$ConversationImplFromJson(Map json) => + _$ConversationImpl( + id: json['id'] as String, + object: $enumDecodeNullable(_$ObjectTypeEnumMap, json['object']) ?? + ObjectType.realtimeConversation, + ); + +Map _$$ConversationImplToJson(_$ConversationImpl instance) => + { + 'id': instance.id, + 'object': _$ObjectTypeEnumMap[instance.object]!, + }; + +_$DeltaImpl _$$DeltaImplFromJson(Map json) => _$DeltaImpl( + transcript: json['transcript'] as String?, + audio: _$JsonConverterFromJson, Uint8List>( + json['audio'], const Uint8ListConverter().fromJson), + text: json['text'] as String?, + arguments: json['arguments'] as String?, + ); + +Map _$$DeltaImplToJson(_$DeltaImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('transcript', instance.transcript); + writeNotNull( + 'audio', + _$JsonConverterToJson, Uint8List>( + instance.audio, const Uint8ListConverter().toJson)); + writeNotNull('text', instance.text); + writeNotNull('arguments', instance.arguments); + return val; +} + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => + json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => + value == null ? null : toJson(value); + +_$FormattedToolImpl _$$FormattedToolImplFromJson(Map json) => + _$FormattedToolImpl( + type: $enumDecodeNullable(_$ToolTypeEnumMap, json['type']) ?? + ToolType.function, + name: json['name'] as String, + callId: json['call_id'] as String, + arguments: json['arguments'] as String, + ); + +Map _$$FormattedToolImplToJson(_$FormattedToolImpl instance) => + { + 'type': _$ToolTypeEnumMap[instance.type]!, + 'name': instance.name, + 'call_id': instance.callId, + 'arguments': instance.arguments, + }; + +_$FormattedPropertyImpl _$$FormattedPropertyImplFromJson( + Map json) => + _$FormattedPropertyImpl( + audio: const Uint8ListConverter().fromJson(json['audio'] as List), + text: json['text'] as String, + transcript: json['transcript'] as String, + tool: json['tool'] == null + ? null + : FormattedTool.fromJson(json['tool'] as Map), + output: json['output'] as String?, + ); + +Map _$$FormattedPropertyImplToJson( + _$FormattedPropertyImpl instance) { + final val = { + 'audio': const Uint8ListConverter().toJson(instance.audio), + 'text': instance.text, + 'transcript': instance.transcript, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('tool', instance.tool?.toJson()); + writeNotNull('output', instance.output); + return val; +} + +_$FormattedItemImpl _$$FormattedItemImplFromJson(Map json) => + _$FormattedItemImpl( + item: Item.fromJson(json['item'] as Map), + formatted: json['formatted'] == null + ? null + : FormattedProperty.fromJson( + json['formatted'] as Map), + ); + +Map _$$FormattedItemImplToJson(_$FormattedItemImpl instance) => + { + 'item': instance.item.toJson(), + 'formatted': instance.formatted?.toJson(), + }; + +_$ItemSpeechImpl _$$ItemSpeechImplFromJson(Map json) => + _$ItemSpeechImpl( + audioStartMs: (json['audioStartMs'] as num).toInt(), + audioEndMs: (json['audioEndMs'] as num?)?.toInt(), + audio: _$JsonConverterFromJson, Uint8List>( + json['audio'], const Uint8ListConverter().fromJson), + ); + +Map _$$ItemSpeechImplToJson(_$ItemSpeechImpl instance) { + final val = { + 'audioStartMs': instance.audioStartMs, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('audioEndMs', instance.audioEndMs); + writeNotNull( + 'audio', + _$JsonConverterToJson, Uint8List>( + instance.audio, const Uint8ListConverter().toJson)); + return val; +} + +_$ItemTranscriptImpl _$$ItemTranscriptImplFromJson(Map json) => + _$ItemTranscriptImpl( + transcript: json['transcript'] as String, + ); + +Map _$$ItemTranscriptImplToJson( + _$ItemTranscriptImpl instance) => + { + 'transcript': instance.transcript, + }; + +_$EventHandlerResultImpl _$$EventHandlerResultImplFromJson( + Map json) => + _$EventHandlerResultImpl( + item: json['item'] == null + ? null + : FormattedItem.fromJson(json['item'] as Map), + delta: json['delta'] == null + ? null + : Delta.fromJson(json['delta'] as Map), + response: json['response'] == null + ? null + : Response.fromJson(json['response'] as Map), + ); + +Map _$$EventHandlerResultImplToJson( + _$EventHandlerResultImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('item', instance.item?.toJson()); + writeNotNull('delta', instance.delta?.toJson()); + writeNotNull('response', instance.response?.toJson()); + return val; +} + +_$TranscriptionErrorImpl _$$TranscriptionErrorImplFromJson( + Map json) => + _$TranscriptionErrorImpl( + type: json['type'] as String?, + code: json['code'] as String?, + message: json['message'] as String?, + param: json['param'] as String?, + ); + +Map _$$TranscriptionErrorImplToJson( + _$TranscriptionErrorImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('type', instance.type); + writeNotNull('code', instance.code); + writeNotNull('message', instance.message); + writeNotNull('param', instance.param); + return val; +} + +_$APIErrorImpl _$$APIErrorImplFromJson(Map json) => + _$APIErrorImpl( + type: json['type'] as String?, + code: json['code'] as String?, + message: json['message'] as String?, + param: json['param'] as String?, + eventId: json['event_id'] as String?, + ); + +Map _$$APIErrorImplToJson(_$APIErrorImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('type', instance.type); + writeNotNull('code', instance.code); + writeNotNull('message', instance.message); + writeNotNull('param', instance.param); + writeNotNull('event_id', instance.eventId); + return val; +} + +_$ContentPartInputTextImpl _$$ContentPartInputTextImplFromJson( + Map json) => + _$ContentPartInputTextImpl( + type: $enumDecodeNullable(_$ContentTypeEnumMap, json['type']) ?? + ContentType.inputText, + text: json['text'] as String, + ); + +Map _$$ContentPartInputTextImplToJson( + _$ContentPartInputTextImpl instance) => + { + 'type': _$ContentTypeEnumMap[instance.type]!, + 'text': instance.text, + }; + +const _$ContentTypeEnumMap = { + ContentType.inputText: 'input_text', + ContentType.inputAudio: 'input_audio', + ContentType.text: 'text', + ContentType.audio: 'audio', +}; + +_$ContentPartInputAudioImpl _$$ContentPartInputAudioImplFromJson( + Map json) => + _$ContentPartInputAudioImpl( + type: $enumDecodeNullable(_$ContentTypeEnumMap, json['type']) ?? + ContentType.inputAudio, + audio: json['audio'] as String?, + transcript: json['transcript'] as String?, + ); + +Map _$$ContentPartInputAudioImplToJson( + _$ContentPartInputAudioImpl instance) { + final val = { + 'type': _$ContentTypeEnumMap[instance.type]!, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('audio', instance.audio); + writeNotNull('transcript', instance.transcript); + return val; +} + +_$ContentPartTextImpl _$$ContentPartTextImplFromJson( + Map json) => + _$ContentPartTextImpl( + type: $enumDecodeNullable(_$ContentTypeEnumMap, json['type']) ?? + ContentType.text, + text: json['text'] as String, + ); + +Map _$$ContentPartTextImplToJson( + _$ContentPartTextImpl instance) => + { + 'type': _$ContentTypeEnumMap[instance.type]!, + 'text': instance.text, + }; + +_$ContentPartAudioImpl _$$ContentPartAudioImplFromJson( + Map json) => + _$ContentPartAudioImpl( + type: $enumDecodeNullable(_$ContentTypeEnumMap, json['type']) ?? + ContentType.audio, + audio: json['audio'] as String?, + transcript: json['transcript'] as String?, + ); + +Map _$$ContentPartAudioImplToJson( + _$ContentPartAudioImpl instance) { + final val = { + 'type': _$ContentTypeEnumMap[instance.type]!, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('audio', instance.audio); + writeNotNull('transcript', instance.transcript); + return val; +} + +_$ItemMessageImpl _$$ItemMessageImplFromJson(Map json) => + _$ItemMessageImpl( + id: json['id'] as String, + object: $enumDecodeNullable(_$ObjectTypeEnumMap, json['object'], + unknownValue: JsonKey.nullForUndefinedEnumValue), + type: $enumDecodeNullable(_$ItemTypeEnumMap, json['type']) ?? + ItemType.message, + status: $enumDecodeNullable(_$ItemStatusEnumMap, json['status'], + unknownValue: JsonKey.nullForUndefinedEnumValue), + role: $enumDecode(_$ItemRoleEnumMap, json['role']), + content: (json['content'] as List) + .map((e) => ContentPart.fromJson(e as Map)) + .toList(), + ); + +Map _$$ItemMessageImplToJson(_$ItemMessageImpl instance) { + final val = { + 'id': instance.id, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('object', _$ObjectTypeEnumMap[instance.object]); + val['type'] = _$ItemTypeEnumMap[instance.type]!; + writeNotNull('status', _$ItemStatusEnumMap[instance.status]); + val['role'] = _$ItemRoleEnumMap[instance.role]!; + val['content'] = instance.content.map((e) => e.toJson()).toList(); + return val; +} + +const _$ItemTypeEnumMap = { + ItemType.message: 'message', + ItemType.functionCall: 'function_call', + ItemType.functionCallOutput: 'function_call_output', +}; + +const _$ItemStatusEnumMap = { + ItemStatus.completed: 'completed', + ItemStatus.inProgress: 'in_progress', + ItemStatus.incomplete: 'incomplete', +}; + +const _$ItemRoleEnumMap = { + ItemRole.user: 'user', + ItemRole.assistant: 'assistant', + ItemRole.system: 'system', +}; + +_$ItemFunctionCallImpl _$$ItemFunctionCallImplFromJson( + Map json) => + _$ItemFunctionCallImpl( + id: json['id'] as String, + object: $enumDecodeNullable(_$ObjectTypeEnumMap, json['object']) ?? + ObjectType.realtimeItem, + type: $enumDecodeNullable(_$ItemTypeEnumMap, json['type']) ?? + ItemType.functionCall, + status: $enumDecodeNullable(_$ItemStatusEnumMap, json['status'], + unknownValue: JsonKey.nullForUndefinedEnumValue), + callId: json['call_id'] as String, + name: json['name'] as String, + arguments: json['arguments'] as String, + ); + +Map _$$ItemFunctionCallImplToJson( + _$ItemFunctionCallImpl instance) { + final val = { + 'id': instance.id, + 'object': _$ObjectTypeEnumMap[instance.object]!, + 'type': _$ItemTypeEnumMap[instance.type]!, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('status', _$ItemStatusEnumMap[instance.status]); + val['call_id'] = instance.callId; + val['name'] = instance.name; + val['arguments'] = instance.arguments; + return val; +} + +_$ItemFunctionCallOutputImpl _$$ItemFunctionCallOutputImplFromJson( + Map json) => + _$ItemFunctionCallOutputImpl( + id: json['id'] as String, + object: $enumDecodeNullable(_$ObjectTypeEnumMap, json['object'], + unknownValue: JsonKey.nullForUndefinedEnumValue), + type: $enumDecodeNullable(_$ItemTypeEnumMap, json['type']) ?? + ItemType.functionCallOutput, + status: $enumDecodeNullable(_$ItemStatusEnumMap, json['status'], + unknownValue: JsonKey.nullForUndefinedEnumValue), + callId: json['call_id'] as String, + output: json['output'] as String, + ); + +Map _$$ItemFunctionCallOutputImplToJson( + _$ItemFunctionCallOutputImpl instance) { + final val = { + 'id': instance.id, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('object', _$ObjectTypeEnumMap[instance.object]); + val['type'] = _$ItemTypeEnumMap[instance.type]!; + writeNotNull('status', _$ItemStatusEnumMap[instance.status]); + val['call_id'] = instance.callId; + val['output'] = instance.output; + return val; +} + +_$ResponseStatusDetailsIncompleteImpl + _$$ResponseStatusDetailsIncompleteImplFromJson(Map json) => + _$ResponseStatusDetailsIncompleteImpl( + type: + $enumDecodeNullable(_$ResponseStatusTypeEnumMap, json['type']) ?? + ResponseStatusType.incomplete, + reason: $enumDecodeNullable( + _$ResponseStatusIncompleteReasonEnumMap, json['reason'], + unknownValue: JsonKey.nullForUndefinedEnumValue), + ); + +Map _$$ResponseStatusDetailsIncompleteImplToJson( + _$ResponseStatusDetailsIncompleteImpl instance) { + final val = { + 'type': _$ResponseStatusTypeEnumMap[instance.type]!, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull( + 'reason', _$ResponseStatusIncompleteReasonEnumMap[instance.reason]); + return val; +} + +const _$ResponseStatusTypeEnumMap = { + ResponseStatusType.incomplete: 'incomplete', + ResponseStatusType.failed: 'failed', +}; + +const _$ResponseStatusIncompleteReasonEnumMap = { + ResponseStatusIncompleteReason.interruption: 'interruption', + ResponseStatusIncompleteReason.maxOutputTokens: 'max_output_tokens', + ResponseStatusIncompleteReason.contentFilter: 'content_filter', +}; + +_$ResponseStatusDetailsFailedImpl _$$ResponseStatusDetailsFailedImplFromJson( + Map json) => + _$ResponseStatusDetailsFailedImpl( + type: $enumDecodeNullable(_$ResponseStatusTypeEnumMap, json['type']) ?? + ResponseStatusType.failed, + error: json['error'] == null + ? null + : APIError.fromJson(json['error'] as Map), + ); + +Map _$$ResponseStatusDetailsFailedImplToJson( + _$ResponseStatusDetailsFailedImpl instance) { + final val = { + 'type': _$ResponseStatusTypeEnumMap[instance.type]!, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('error', instance.error?.toJson()); + return val; +} + +_$RealtimeEventConversationItemCreateImpl + _$$RealtimeEventConversationItemCreateImplFromJson( + Map json) => + _$RealtimeEventConversationItemCreateImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.conversationItemCreate, + previousItemId: json['previous_item_id'] as String?, + item: Item.fromJson(json['item'] as Map), + ); + +Map _$$RealtimeEventConversationItemCreateImplToJson( + _$RealtimeEventConversationItemCreateImpl instance) { + final val = { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('previous_item_id', instance.previousItemId); + val['item'] = instance.item.toJson(); + return val; +} + +const _$RealtimeEventTypeEnumMap = { + RealtimeEventType.conversationItemCreate: 'conversation.item.create', + RealtimeEventType.conversationItemDelete: 'conversation.item.delete', + RealtimeEventType.conversationItemTruncate: 'conversation.item.truncate', + RealtimeEventType.inputAudioBufferAppend: 'input_audio_buffer.append', + RealtimeEventType.inputAudioBufferClear: 'input_audio_buffer.clear', + RealtimeEventType.inputAudioBufferCommit: 'input_audio_buffer.commit', + RealtimeEventType.responseCancel: 'response.cancel', + RealtimeEventType.responseCreate: 'response.create', + RealtimeEventType.sessionUpdate: 'session.update', + RealtimeEventType.conversationCreated: 'conversation.created', + RealtimeEventType.conversationItemCreated: 'conversation.item.created', + RealtimeEventType.conversationItemDeleted: 'conversation.item.deleted', + RealtimeEventType.conversationItemInputAudioTranscriptionCompleted: + 'conversation.item.input_audio_transcription.completed', + RealtimeEventType.conversationItemInputAudioTranscriptionFailed: + 'conversation.item.input_audio_transcription.failed', + RealtimeEventType.conversationItemTruncated: 'conversation.item.truncated', + RealtimeEventType.error: 'error', + RealtimeEventType.inputAudioBufferCleared: 'input_audio_buffer.cleared', + RealtimeEventType.inputAudioBufferCommitted: 'input_audio_buffer.committed', + RealtimeEventType.inputAudioBufferSpeechStarted: + 'input_audio_buffer.speech_started', + RealtimeEventType.inputAudioBufferSpeechStopped: + 'input_audio_buffer.speech_stopped', + RealtimeEventType.rateLimitsUpdated: 'rate_limits.updated', + RealtimeEventType.responseAudioDelta: 'response.audio.delta', + RealtimeEventType.responseAudioDone: 'response.audio.done', + RealtimeEventType.responseAudioTranscriptDelta: + 'response.audio_transcript.delta', + RealtimeEventType.responseAudioTranscriptDone: + 'response.audio_transcript.done', + RealtimeEventType.responseContentPartAdded: 'response.content_part.added', + RealtimeEventType.responseContentPartDone: 'response.content_part.done', + RealtimeEventType.responseCreated: 'response.created', + RealtimeEventType.responseDone: 'response.done', + RealtimeEventType.responseFunctionCallArgumentsDelta: + 'response.function_call_arguments.delta', + RealtimeEventType.responseFunctionCallArgumentsDone: + 'response.function_call_arguments.done', + RealtimeEventType.responseOutputItemAdded: 'response.output_item.added', + RealtimeEventType.responseOutputItemDone: 'response.output_item.done', + RealtimeEventType.responseTextDelta: 'response.text.delta', + RealtimeEventType.responseTextDone: 'response.text.done', + RealtimeEventType.sessionCreated: 'session.created', + RealtimeEventType.sessionUpdated: 'session.updated', + RealtimeEventType.close: 'close', + RealtimeEventType.conversationInterrupted: 'conversation.interrupted', + RealtimeEventType.conversationUpdated: 'conversation.updated', + RealtimeEventType.conversationItemAppended: 'conversation.item.appended', + RealtimeEventType.conversationItemCompleted: 'conversation.item.completed', + RealtimeEventType.realtimeEvent: 'realtime.event', + RealtimeEventType.all: 'all', + RealtimeEventType.serverAll: 'server.all', + RealtimeEventType.clientAll: 'client.all', +}; + +_$RealtimeEventConversationItemDeleteImpl + _$$RealtimeEventConversationItemDeleteImplFromJson( + Map json) => + _$RealtimeEventConversationItemDeleteImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.conversationItemDelete, + itemId: json['item_id'] as String, + ); + +Map _$$RealtimeEventConversationItemDeleteImplToJson( + _$RealtimeEventConversationItemDeleteImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'item_id': instance.itemId, + }; + +_$RealtimeEventConversationItemTruncateImpl + _$$RealtimeEventConversationItemTruncateImplFromJson( + Map json) => + _$RealtimeEventConversationItemTruncateImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.conversationItemTruncate, + itemId: json['item_id'] as String, + contentIndex: (json['content_index'] as num).toInt(), + audioEndMs: (json['audio_end_ms'] as num).toInt(), + ); + +Map _$$RealtimeEventConversationItemTruncateImplToJson( + _$RealtimeEventConversationItemTruncateImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'item_id': instance.itemId, + 'content_index': instance.contentIndex, + 'audio_end_ms': instance.audioEndMs, + }; + +_$RealtimeEventInputAudioBufferAppendImpl + _$$RealtimeEventInputAudioBufferAppendImplFromJson( + Map json) => + _$RealtimeEventInputAudioBufferAppendImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.inputAudioBufferAppend, + audio: json['audio'] as String, + ); + +Map _$$RealtimeEventInputAudioBufferAppendImplToJson( + _$RealtimeEventInputAudioBufferAppendImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'audio': instance.audio, + }; + +_$RealtimeEventInputAudioBufferClearImpl + _$$RealtimeEventInputAudioBufferClearImplFromJson( + Map json) => + _$RealtimeEventInputAudioBufferClearImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.inputAudioBufferClear, + ); + +Map _$$RealtimeEventInputAudioBufferClearImplToJson( + _$RealtimeEventInputAudioBufferClearImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + }; + +_$RealtimeEventInputAudioBufferCommitImpl + _$$RealtimeEventInputAudioBufferCommitImplFromJson( + Map json) => + _$RealtimeEventInputAudioBufferCommitImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.inputAudioBufferCommit, + ); + +Map _$$RealtimeEventInputAudioBufferCommitImplToJson( + _$RealtimeEventInputAudioBufferCommitImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + }; + +_$RealtimeEventResponseCancelImpl _$$RealtimeEventResponseCancelImplFromJson( + Map json) => + _$RealtimeEventResponseCancelImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.responseCancel, + ); + +Map _$$RealtimeEventResponseCancelImplToJson( + _$RealtimeEventResponseCancelImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + }; + +_$RealtimeEventResponseCreateImpl _$$RealtimeEventResponseCreateImplFromJson( + Map json) => + _$RealtimeEventResponseCreateImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.responseCreate, + response: json['response'] == null + ? null + : ResponseConfig.fromJson(json['response'] as Map), + ); + +Map _$$RealtimeEventResponseCreateImplToJson( + _$RealtimeEventResponseCreateImpl instance) { + final val = { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('response', instance.response?.toJson()); + return val; +} + +_$RealtimeEventSessionUpdateImpl _$$RealtimeEventSessionUpdateImplFromJson( + Map json) => + _$RealtimeEventSessionUpdateImpl( + eventId: json['event_id'] as String?, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.sessionUpdate, + session: SessionConfig.fromJson(json['session'] as Map), + ); + +Map _$$RealtimeEventSessionUpdateImplToJson( + _$RealtimeEventSessionUpdateImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('event_id', instance.eventId); + val['type'] = _$RealtimeEventTypeEnumMap[instance.type]!; + val['session'] = instance.session.toJson(); + return val; +} + +_$RealtimeEventConversationCreatedImpl + _$$RealtimeEventConversationCreatedImplFromJson( + Map json) => + _$RealtimeEventConversationCreatedImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.conversationCreated, + conversation: Conversation.fromJson( + json['conversation'] as Map), + ); + +Map _$$RealtimeEventConversationCreatedImplToJson( + _$RealtimeEventConversationCreatedImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'conversation': instance.conversation.toJson(), + }; + +_$RealtimeEventConversationItemCreatedImpl + _$$RealtimeEventConversationItemCreatedImplFromJson( + Map json) => + _$RealtimeEventConversationItemCreatedImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.conversationItemCreated, + previousItemId: json['previous_item_id'] as String?, + item: Item.fromJson(json['item'] as Map), + ); + +Map _$$RealtimeEventConversationItemCreatedImplToJson( + _$RealtimeEventConversationItemCreatedImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'previous_item_id': instance.previousItemId, + 'item': instance.item.toJson(), + }; + +_$RealtimeEventConversationItemDeletedImpl + _$$RealtimeEventConversationItemDeletedImplFromJson( + Map json) => + _$RealtimeEventConversationItemDeletedImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.conversationItemDeleted, + itemId: json['item_id'] as String, + ); + +Map _$$RealtimeEventConversationItemDeletedImplToJson( + _$RealtimeEventConversationItemDeletedImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'item_id': instance.itemId, + }; + +_$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl + _$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplFromJson( + Map json) => + _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType + .conversationItemInputAudioTranscriptionCompleted, + itemId: json['item_id'] as String, + contentIndex: (json['content_index'] as num).toInt(), + transcript: json['transcript'] as String, + ); + +Map + _$$RealtimeEventConversationItemInputAudioTranscriptionCompletedImplToJson( + _$RealtimeEventConversationItemInputAudioTranscriptionCompletedImpl + instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'item_id': instance.itemId, + 'content_index': instance.contentIndex, + 'transcript': instance.transcript, + }; + +_$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl + _$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplFromJson( + Map json) => + _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.conversationItemInputAudioTranscriptionFailed, + itemId: json['item_id'] as String, + contentIndex: (json['content_index'] as num).toInt(), + error: TranscriptionError.fromJson( + json['error'] as Map), + ); + +Map + _$$RealtimeEventConversationItemInputAudioTranscriptionFailedImplToJson( + _$RealtimeEventConversationItemInputAudioTranscriptionFailedImpl + instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'item_id': instance.itemId, + 'content_index': instance.contentIndex, + 'error': instance.error.toJson(), + }; + +_$RealtimeEventConversationItemTruncatedImpl + _$$RealtimeEventConversationItemTruncatedImplFromJson( + Map json) => + _$RealtimeEventConversationItemTruncatedImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.conversationItemTruncated, + itemId: json['item_id'] as String, + contentIndex: (json['content_index'] as num).toInt(), + audioEndMs: (json['audio_end_ms'] as num).toInt(), + ); + +Map _$$RealtimeEventConversationItemTruncatedImplToJson( + _$RealtimeEventConversationItemTruncatedImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'item_id': instance.itemId, + 'content_index': instance.contentIndex, + 'audio_end_ms': instance.audioEndMs, + }; + +_$RealtimeEventErrorImpl _$$RealtimeEventErrorImplFromJson( + Map json) => + _$RealtimeEventErrorImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.error, + error: APIError.fromJson(json['error'] as Map), + ); + +Map _$$RealtimeEventErrorImplToJson( + _$RealtimeEventErrorImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'error': instance.error.toJson(), + }; + +_$RealtimeEventInputAudioBufferClearedImpl + _$$RealtimeEventInputAudioBufferClearedImplFromJson( + Map json) => + _$RealtimeEventInputAudioBufferClearedImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.inputAudioBufferCleared, + ); + +Map _$$RealtimeEventInputAudioBufferClearedImplToJson( + _$RealtimeEventInputAudioBufferClearedImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + }; + +_$RealtimeEventInputAudioBufferCommittedImpl + _$$RealtimeEventInputAudioBufferCommittedImplFromJson( + Map json) => + _$RealtimeEventInputAudioBufferCommittedImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.inputAudioBufferCommitted, + previousItemId: json['previous_item_id'] as String, + itemId: json['item_id'] as String, + ); + +Map _$$RealtimeEventInputAudioBufferCommittedImplToJson( + _$RealtimeEventInputAudioBufferCommittedImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'previous_item_id': instance.previousItemId, + 'item_id': instance.itemId, + }; + +_$RealtimeEventInputAudioBufferSpeechStartedImpl + _$$RealtimeEventInputAudioBufferSpeechStartedImplFromJson( + Map json) => + _$RealtimeEventInputAudioBufferSpeechStartedImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.inputAudioBufferSpeechStarted, + audioStartMs: (json['audio_start_ms'] as num).toInt(), + itemId: json['item_id'] as String, + ); + +Map _$$RealtimeEventInputAudioBufferSpeechStartedImplToJson( + _$RealtimeEventInputAudioBufferSpeechStartedImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'audio_start_ms': instance.audioStartMs, + 'item_id': instance.itemId, + }; + +_$RealtimeEventInputAudioBufferSpeechStoppedImpl + _$$RealtimeEventInputAudioBufferSpeechStoppedImplFromJson( + Map json) => + _$RealtimeEventInputAudioBufferSpeechStoppedImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.inputAudioBufferSpeechStopped, + audioEndMs: (json['audio_end_ms'] as num).toInt(), + itemId: json['item_id'] as String, + ); + +Map _$$RealtimeEventInputAudioBufferSpeechStoppedImplToJson( + _$RealtimeEventInputAudioBufferSpeechStoppedImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'audio_end_ms': instance.audioEndMs, + 'item_id': instance.itemId, + }; + +_$RealtimeEventRateLimitsUpdatedImpl + _$$RealtimeEventRateLimitsUpdatedImplFromJson(Map json) => + _$RealtimeEventRateLimitsUpdatedImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.rateLimitsUpdated, + rateLimits: (json['rate_limits'] as List) + .map((e) => RateLimit.fromJson(e as Map)) + .toList(), + ); + +Map _$$RealtimeEventRateLimitsUpdatedImplToJson( + _$RealtimeEventRateLimitsUpdatedImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'rate_limits': instance.rateLimits.map((e) => e.toJson()).toList(), + }; + +_$RealtimeEventResponseAudioDeltaImpl + _$$RealtimeEventResponseAudioDeltaImplFromJson(Map json) => + _$RealtimeEventResponseAudioDeltaImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.responseAudioDelta, + responseId: json['response_id'] as String, + itemId: json['item_id'] as String, + outputIndex: (json['output_index'] as num).toInt(), + contentIndex: (json['content_index'] as num).toInt(), + delta: json['delta'] as String, + ); + +Map _$$RealtimeEventResponseAudioDeltaImplToJson( + _$RealtimeEventResponseAudioDeltaImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'response_id': instance.responseId, + 'item_id': instance.itemId, + 'output_index': instance.outputIndex, + 'content_index': instance.contentIndex, + 'delta': instance.delta, + }; + +_$RealtimeEventResponseAudioDoneImpl + _$$RealtimeEventResponseAudioDoneImplFromJson(Map json) => + _$RealtimeEventResponseAudioDoneImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.responseAudioDone, + responseId: json['response_id'] as String, + itemId: json['item_id'] as String, + outputIndex: (json['output_index'] as num).toInt(), + contentIndex: (json['content_index'] as num).toInt(), + ); + +Map _$$RealtimeEventResponseAudioDoneImplToJson( + _$RealtimeEventResponseAudioDoneImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'response_id': instance.responseId, + 'item_id': instance.itemId, + 'output_index': instance.outputIndex, + 'content_index': instance.contentIndex, + }; + +_$RealtimeEventResponseAudioTranscriptDeltaImpl + _$$RealtimeEventResponseAudioTranscriptDeltaImplFromJson( + Map json) => + _$RealtimeEventResponseAudioTranscriptDeltaImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.responseAudioTranscriptDelta, + responseId: json['response_id'] as String, + itemId: json['item_id'] as String, + outputIndex: (json['output_index'] as num).toInt(), + contentIndex: (json['content_index'] as num).toInt(), + delta: json['delta'] as String, + ); + +Map _$$RealtimeEventResponseAudioTranscriptDeltaImplToJson( + _$RealtimeEventResponseAudioTranscriptDeltaImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'response_id': instance.responseId, + 'item_id': instance.itemId, + 'output_index': instance.outputIndex, + 'content_index': instance.contentIndex, + 'delta': instance.delta, + }; + +_$RealtimeEventResponseAudioTranscriptDoneImpl + _$$RealtimeEventResponseAudioTranscriptDoneImplFromJson( + Map json) => + _$RealtimeEventResponseAudioTranscriptDoneImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.responseAudioTranscriptDone, + responseId: json['response_id'] as String, + itemId: json['item_id'] as String, + outputIndex: (json['output_index'] as num).toInt(), + contentIndex: (json['content_index'] as num).toInt(), + transcript: json['transcript'] as String, + ); + +Map _$$RealtimeEventResponseAudioTranscriptDoneImplToJson( + _$RealtimeEventResponseAudioTranscriptDoneImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'response_id': instance.responseId, + 'item_id': instance.itemId, + 'output_index': instance.outputIndex, + 'content_index': instance.contentIndex, + 'transcript': instance.transcript, + }; + +_$RealtimeEventResponseContentPartAddedImpl + _$$RealtimeEventResponseContentPartAddedImplFromJson( + Map json) => + _$RealtimeEventResponseContentPartAddedImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.responseContentPartAdded, + responseId: json['response_id'] as String, + itemId: json['item_id'] as String, + outputIndex: (json['output_index'] as num).toInt(), + contentIndex: (json['content_index'] as num).toInt(), + part: ContentPart.fromJson(json['part'] as Map), + ); + +Map _$$RealtimeEventResponseContentPartAddedImplToJson( + _$RealtimeEventResponseContentPartAddedImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'response_id': instance.responseId, + 'item_id': instance.itemId, + 'output_index': instance.outputIndex, + 'content_index': instance.contentIndex, + 'part': instance.part.toJson(), + }; + +_$RealtimeEventResponseContentPartDoneImpl + _$$RealtimeEventResponseContentPartDoneImplFromJson( + Map json) => + _$RealtimeEventResponseContentPartDoneImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.responseContentPartDone, + responseId: json['response_id'] as String, + itemId: json['item_id'] as String, + outputIndex: (json['output_index'] as num).toInt(), + contentIndex: (json['content_index'] as num).toInt(), + part: ContentPart.fromJson(json['part'] as Map), + ); + +Map _$$RealtimeEventResponseContentPartDoneImplToJson( + _$RealtimeEventResponseContentPartDoneImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'response_id': instance.responseId, + 'item_id': instance.itemId, + 'output_index': instance.outputIndex, + 'content_index': instance.contentIndex, + 'part': instance.part.toJson(), + }; + +_$RealtimeEventResponseCreatedImpl _$$RealtimeEventResponseCreatedImplFromJson( + Map json) => + _$RealtimeEventResponseCreatedImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.responseCreated, + response: Response.fromJson(json['response'] as Map), + ); + +Map _$$RealtimeEventResponseCreatedImplToJson( + _$RealtimeEventResponseCreatedImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'response': instance.response.toJson(), + }; + +_$RealtimeEventResponseDoneImpl _$$RealtimeEventResponseDoneImplFromJson( + Map json) => + _$RealtimeEventResponseDoneImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.responseDone, + response: Response.fromJson(json['response'] as Map), + ); + +Map _$$RealtimeEventResponseDoneImplToJson( + _$RealtimeEventResponseDoneImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'response': instance.response.toJson(), + }; + +_$RealtimeEventResponseFunctionCallArgumentsDeltaImpl + _$$RealtimeEventResponseFunctionCallArgumentsDeltaImplFromJson( + Map json) => + _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.responseFunctionCallArgumentsDelta, + responseId: json['response_id'] as String, + itemId: json['item_id'] as String, + outputIndex: (json['output_index'] as num).toInt(), + callId: json['call_id'] as String, + delta: json['delta'] as String, + ); + +Map + _$$RealtimeEventResponseFunctionCallArgumentsDeltaImplToJson( + _$RealtimeEventResponseFunctionCallArgumentsDeltaImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'response_id': instance.responseId, + 'item_id': instance.itemId, + 'output_index': instance.outputIndex, + 'call_id': instance.callId, + 'delta': instance.delta, + }; + +_$RealtimeEventResponseFunctionCallArgumentsDoneImpl + _$$RealtimeEventResponseFunctionCallArgumentsDoneImplFromJson( + Map json) => + _$RealtimeEventResponseFunctionCallArgumentsDoneImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.responseFunctionCallArgumentsDone, + responseId: json['response_id'] as String, + itemId: json['item_id'] as String, + outputIndex: (json['output_index'] as num).toInt(), + callId: json['call_id'] as String, + arguments: json['arguments'] as String, + ); + +Map + _$$RealtimeEventResponseFunctionCallArgumentsDoneImplToJson( + _$RealtimeEventResponseFunctionCallArgumentsDoneImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'response_id': instance.responseId, + 'item_id': instance.itemId, + 'output_index': instance.outputIndex, + 'call_id': instance.callId, + 'arguments': instance.arguments, + }; + +_$RealtimeEventResponseOutputItemAddedImpl + _$$RealtimeEventResponseOutputItemAddedImplFromJson( + Map json) => + _$RealtimeEventResponseOutputItemAddedImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.responseOutputItemAdded, + responseId: json['response_id'] as String, + outputIndex: (json['output_index'] as num).toInt(), + item: Item.fromJson(json['item'] as Map), + ); + +Map _$$RealtimeEventResponseOutputItemAddedImplToJson( + _$RealtimeEventResponseOutputItemAddedImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'response_id': instance.responseId, + 'output_index': instance.outputIndex, + 'item': instance.item.toJson(), + }; + +_$RealtimeEventResponseOutputItemDoneImpl + _$$RealtimeEventResponseOutputItemDoneImplFromJson( + Map json) => + _$RealtimeEventResponseOutputItemDoneImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.responseOutputItemDone, + responseId: json['response_id'] as String, + outputIndex: (json['output_index'] as num).toInt(), + item: Item.fromJson(json['item'] as Map), + ); + +Map _$$RealtimeEventResponseOutputItemDoneImplToJson( + _$RealtimeEventResponseOutputItemDoneImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'response_id': instance.responseId, + 'output_index': instance.outputIndex, + 'item': instance.item.toJson(), + }; + +_$RealtimeEventResponseTextDeltaImpl + _$$RealtimeEventResponseTextDeltaImplFromJson(Map json) => + _$RealtimeEventResponseTextDeltaImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.responseTextDelta, + responseId: json['response_id'] as String, + itemId: json['item_id'] as String, + outputIndex: (json['output_index'] as num).toInt(), + contentIndex: (json['content_index'] as num).toInt(), + delta: json['delta'] as String, + ); + +Map _$$RealtimeEventResponseTextDeltaImplToJson( + _$RealtimeEventResponseTextDeltaImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'response_id': instance.responseId, + 'item_id': instance.itemId, + 'output_index': instance.outputIndex, + 'content_index': instance.contentIndex, + 'delta': instance.delta, + }; + +_$RealtimeEventResponseTextDoneImpl + _$$RealtimeEventResponseTextDoneImplFromJson(Map json) => + _$RealtimeEventResponseTextDoneImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.responseTextDone, + responseId: json['response_id'] as String, + itemId: json['item_id'] as String, + outputIndex: (json['output_index'] as num).toInt(), + contentIndex: (json['content_index'] as num).toInt(), + text: json['text'] as String, + ); + +Map _$$RealtimeEventResponseTextDoneImplToJson( + _$RealtimeEventResponseTextDoneImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'response_id': instance.responseId, + 'item_id': instance.itemId, + 'output_index': instance.outputIndex, + 'content_index': instance.contentIndex, + 'text': instance.text, + }; + +_$RealtimeEventSessionCreatedImpl _$$RealtimeEventSessionCreatedImplFromJson( + Map json) => + _$RealtimeEventSessionCreatedImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.sessionCreated, + session: Session.fromJson(json['session'] as Map), + ); + +Map _$$RealtimeEventSessionCreatedImplToJson( + _$RealtimeEventSessionCreatedImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'session': instance.session.toJson(), + }; + +_$RealtimeEventSessionUpdatedImpl _$$RealtimeEventSessionUpdatedImplFromJson( + Map json) => + _$RealtimeEventSessionUpdatedImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.sessionUpdated, + session: Session.fromJson(json['session'] as Map), + ); + +Map _$$RealtimeEventSessionUpdatedImplToJson( + _$RealtimeEventSessionUpdatedImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'session': instance.session.toJson(), + }; + +_$RealtimeEventCloseImpl _$$RealtimeEventCloseImplFromJson( + Map json) => + _$RealtimeEventCloseImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.close, + error: json['error'] as bool, + ); + +Map _$$RealtimeEventCloseImplToJson( + _$RealtimeEventCloseImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'error': instance.error, + }; + +_$RealtimeEventConversationInterruptedImpl + _$$RealtimeEventConversationInterruptedImplFromJson( + Map json) => + _$RealtimeEventConversationInterruptedImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.conversationInterrupted, + ); + +Map _$$RealtimeEventConversationInterruptedImplToJson( + _$RealtimeEventConversationInterruptedImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + }; + +_$RealtimeEventConversationUpdatedImpl + _$$RealtimeEventConversationUpdatedImplFromJson( + Map json) => + _$RealtimeEventConversationUpdatedImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.conversationUpdated, + result: EventHandlerResult.fromJson( + json['result'] as Map), + ); + +Map _$$RealtimeEventConversationUpdatedImplToJson( + _$RealtimeEventConversationUpdatedImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'result': instance.result.toJson(), + }; + +_$RealtimeEventConversationItemAppendedImpl + _$$RealtimeEventConversationItemAppendedImplFromJson( + Map json) => + _$RealtimeEventConversationItemAppendedImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.conversationItemAppended, + item: FormattedItem.fromJson(json['item'] as Map), + ); + +Map _$$RealtimeEventConversationItemAppendedImplToJson( + _$RealtimeEventConversationItemAppendedImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'item': instance.item.toJson(), + }; + +_$RealtimeEventConversationItemCompletedImpl + _$$RealtimeEventConversationItemCompletedImplFromJson( + Map json) => + _$RealtimeEventConversationItemCompletedImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.conversationItemCompleted, + item: FormattedItem.fromJson(json['item'] as Map), + ); + +Map _$$RealtimeEventConversationItemCompletedImplToJson( + _$RealtimeEventConversationItemCompletedImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'item': instance.item.toJson(), + }; + +_$RealtimeEventGenericImpl _$$RealtimeEventGenericImplFromJson( + Map json) => + _$RealtimeEventGenericImpl( + eventId: json['event_id'] as String, + type: $enumDecodeNullable(_$RealtimeEventTypeEnumMap, json['type']) ?? + RealtimeEventType.realtimeEvent, + event: RealtimeEvent.fromJson(json['event'] as Map), + ); + +Map _$$RealtimeEventGenericImplToJson( + _$RealtimeEventGenericImpl instance) => + { + 'event_id': instance.eventId, + 'type': _$RealtimeEventTypeEnumMap[instance.type]!, + 'event': instance.event.toJson(), + }; diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/session.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/session.dart new file mode 100644 index 00000000..2bdb9857 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/session.dart @@ -0,0 +1,267 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: Session +// ========================================== + +/// The session resource. +@freezed +class Session with _$Session { + const Session._(); + + /// Factory constructor for Session + const factory Session({ + /// The unique ID of the session. + @JsonKey(includeIfNull: false) String? id, + + /// The object type, must be "realtime.session". + @Default(ObjectType.realtimeSession) ObjectType object, + + /// The default model used for this session. + @JsonKey(includeIfNull: false) String? model, + + /// The time at which the session expires. + @JsonKey(name: 'expires_at', includeIfNull: false) int? expiresAt, + + /// The set of modalities the model can respond with. + @JsonKey(includeIfNull: false) List? modalities, + + /// The default system instructions. + @JsonKey(includeIfNull: false) String? instructions, + + /// The voice the model uses to respond - one of `alloy`, `echo`, or `shimmer`. + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue, + ) + Voice? voice, + + /// The format of input audio. + @JsonKey( + name: 'input_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue, + ) + AudioFormat? inputAudioFormat, + + /// The format of output audio. + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue, + ) + AudioFormat? outputAudioFormat, + + /// Configuration for input audio transcription. + @JsonKey(name: 'input_audio_transcription', includeIfNull: false) + InputAudioTranscriptionConfig? inputAudioTranscription, + + /// Configuration for turn detection. + @JsonKey(name: 'turn_detection', includeIfNull: false) + TurnDetection? turnDetection, + + /// Tools (functions) available to the model. + @JsonKey(includeIfNull: false) List? tools, + + /// How the model chooses tools. + @_SessionToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + SessionToolChoice? toolChoice, + + /// Sampling temperature. + @JsonKey(includeIfNull: false) double? temperature, + + /// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf". + @_SessionMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + SessionMaxResponseOutputTokens? maxResponseOutputTokens, + }) = _Session; + + /// Object construction from a JSON representation + factory Session.fromJson(Map json) => + _$SessionFromJson(json); + + /// List of all property names of schema + static const List propertyNames = [ + 'id', + 'object', + 'model', + 'expires_at', + 'modalities', + 'instructions', + 'voice', + 'input_audio_format', + 'output_audio_format', + 'input_audio_transcription', + 'turn_detection', + 'tools', + 'tool_choice', + 'temperature', + 'max_response_output_tokens' + ]; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'id': id, + 'object': object, + 'model': model, + 'expires_at': expiresAt, + 'modalities': modalities, + 'instructions': instructions, + 'voice': voice, + 'input_audio_format': inputAudioFormat, + 'output_audio_format': outputAudioFormat, + 'input_audio_transcription': inputAudioTranscription, + 'turn_detection': turnDetection, + 'tools': tools, + 'tool_choice': toolChoice, + 'temperature': temperature, + 'max_response_output_tokens': maxResponseOutputTokens, + }; + } +} + +// ========================================== +// ENUM: SessionToolChoiceMode +// ========================================== + +/// `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools. +enum SessionToolChoiceMode { + @JsonValue('none') + none, + @JsonValue('auto') + auto, + @JsonValue('required') + required, +} + +// ========================================== +// CLASS: SessionToolChoice +// ========================================== + +/// How the model chooses tools. +@freezed +sealed class SessionToolChoice with _$SessionToolChoice { + const SessionToolChoice._(); + + /// `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools. + const factory SessionToolChoice.mode( + SessionToolChoiceMode value, + ) = SessionToolChoiceEnumeration; + + /// No Description + const factory SessionToolChoice.toolChoiceForced( + ToolChoiceForced value, + ) = SessionToolChoiceToolChoiceForced; + + /// Object construction from a JSON representation + factory SessionToolChoice.fromJson(Map json) => + _$SessionToolChoiceFromJson(json); +} + +/// Custom JSON converter for [SessionToolChoice] +class _SessionToolChoiceConverter + implements JsonConverter { + const _SessionToolChoiceConverter(); + + @override + SessionToolChoice? fromJson(Object? data) { + if (data == null) { + return null; + } + if (data is String && + _$SessionToolChoiceModeEnumMap.values.contains(data)) { + return SessionToolChoiceEnumeration( + _$SessionToolChoiceModeEnumMap.keys.elementAt( + _$SessionToolChoiceModeEnumMap.values.toList().indexOf(data), + ), + ); + } + if (data is Map) { + try { + return SessionToolChoiceToolChoiceForced( + ToolChoiceForced.fromJson(data), + ); + } catch (e) {} + } + throw Exception( + 'Unexpected value for SessionToolChoice: $data', + ); + } + + @override + Object? toJson(SessionToolChoice? data) { + return switch (data) { + SessionToolChoiceEnumeration(value: final v) => + _$SessionToolChoiceModeEnumMap[v]!, + SessionToolChoiceToolChoiceForced(value: final v) => v.toJson(), + null => null, + }; + } +} + +// ========================================== +// CLASS: SessionMaxResponseOutputTokens +// ========================================== + +/// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf". +@freezed +sealed class SessionMaxResponseOutputTokens + with _$SessionMaxResponseOutputTokens { + const SessionMaxResponseOutputTokens._(); + + /// Provide an integer between 1 and 4096 to limit output tokens. + const factory SessionMaxResponseOutputTokens.int( + int value, + ) = SessionMaxResponseOutputTokensInt; + + /// Use inf for the maximum available tokens for a given model. + const factory SessionMaxResponseOutputTokens.string( + String value, + ) = SessionMaxResponseOutputTokensString; + + /// Object construction from a JSON representation + factory SessionMaxResponseOutputTokens.fromJson(Map json) => + _$SessionMaxResponseOutputTokensFromJson(json); +} + +/// Custom JSON converter for [SessionMaxResponseOutputTokens] +class _SessionMaxResponseOutputTokensConverter + implements JsonConverter { + const _SessionMaxResponseOutputTokensConverter(); + + @override + SessionMaxResponseOutputTokens? fromJson(Object? data) { + if (data == null) { + return null; + } + if (data is int) { + return SessionMaxResponseOutputTokensInt(data); + } + if (data is String) { + return SessionMaxResponseOutputTokensString(data); + } + throw Exception( + 'Unexpected value for SessionMaxResponseOutputTokens: $data', + ); + } + + @override + Object? toJson(SessionMaxResponseOutputTokens? data) { + return switch (data) { + SessionMaxResponseOutputTokensInt(value: final v) => v, + SessionMaxResponseOutputTokensString(value: final v) => v, + null => null, + }; + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/session_config.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/session_config.dart new file mode 100644 index 00000000..3f44feeb --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/session_config.dart @@ -0,0 +1,250 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: SessionConfig +// ========================================== + +/// Session configuration to update. +@freezed +class SessionConfig with _$SessionConfig { + const SessionConfig._(); + + /// Factory constructor for SessionConfig + const factory SessionConfig({ + /// The set of modalities the model can respond with. To disable audio, set this to ["text"]. + @JsonKey(includeIfNull: false) List? modalities, + + /// The default system instructions prepended to model calls. + @JsonKey(includeIfNull: false) String? instructions, + + /// The voice the model uses to respond - one of `alloy`, `echo`, + /// or `shimmer`. Cannot be changed once the model has responded + /// with audio at least once. + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue, + ) + Voice? voice, + + /// The format of input audio. Options are "pcm16", "g711_ulaw", or "g711_alaw". + @JsonKey( + name: 'input_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue, + ) + AudioFormat? inputAudioFormat, + + /// The format of output audio. Options are "pcm16", "g711_ulaw", or "g711_alaw". + @JsonKey( + name: 'output_audio_format', + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue, + ) + AudioFormat? outputAudioFormat, + + /// Configuration for input audio transcription. Can be set to null to turn off. + @JsonKey(name: 'input_audio_transcription', includeIfNull: false) + InputAudioTranscriptionConfig? inputAudioTranscription, + + /// Configuration for turn detection. + @JsonKey(name: 'turn_detection', includeIfNull: false) + TurnDetection? turnDetection, + + /// Tools (functions) available to the model. + @JsonKey(includeIfNull: false) List? tools, + + /// How the model chooses tools. + @_SessionConfigToolChoiceConverter() + @JsonKey(name: 'tool_choice', includeIfNull: false) + SessionConfigToolChoice? toolChoice, + + /// Sampling temperature for the model. + @JsonKey(includeIfNull: false) double? temperature, + + /// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf". + @_SessionConfigMaxResponseOutputTokensConverter() + @JsonKey(name: 'max_response_output_tokens', includeIfNull: false) + SessionConfigMaxResponseOutputTokens? maxResponseOutputTokens, + }) = _SessionConfig; + + /// Object construction from a JSON representation + factory SessionConfig.fromJson(Map json) => + _$SessionConfigFromJson(json); + + /// List of all property names of schema + static const List propertyNames = [ + 'modalities', + 'instructions', + 'voice', + 'input_audio_format', + 'output_audio_format', + 'input_audio_transcription', + 'turn_detection', + 'tools', + 'tool_choice', + 'temperature', + 'max_response_output_tokens' + ]; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'modalities': modalities, + 'instructions': instructions, + 'voice': voice, + 'input_audio_format': inputAudioFormat, + 'output_audio_format': outputAudioFormat, + 'input_audio_transcription': inputAudioTranscription, + 'turn_detection': turnDetection, + 'tools': tools, + 'tool_choice': toolChoice, + 'temperature': temperature, + 'max_response_output_tokens': maxResponseOutputTokens, + }; + } +} + +// ========================================== +// ENUM: SessionConfigToolChoiceMode +// ========================================== + +/// `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools. +enum SessionConfigToolChoiceMode { + @JsonValue('none') + none, + @JsonValue('auto') + auto, + @JsonValue('required') + required, +} + +// ========================================== +// CLASS: SessionConfigToolChoice +// ========================================== + +/// How the model chooses tools. +@freezed +sealed class SessionConfigToolChoice with _$SessionConfigToolChoice { + const SessionConfigToolChoice._(); + + /// `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools. + const factory SessionConfigToolChoice.mode( + SessionConfigToolChoiceMode value, + ) = SessionConfigToolChoiceEnumeration; + + /// No Description + const factory SessionConfigToolChoice.toolChoiceForced( + ToolChoiceForced value, + ) = SessionConfigToolChoiceToolChoiceForced; + + /// Object construction from a JSON representation + factory SessionConfigToolChoice.fromJson(Map json) => + _$SessionConfigToolChoiceFromJson(json); +} + +/// Custom JSON converter for [SessionConfigToolChoice] +class _SessionConfigToolChoiceConverter + implements JsonConverter { + const _SessionConfigToolChoiceConverter(); + + @override + SessionConfigToolChoice? fromJson(Object? data) { + if (data == null) { + return null; + } + if (data is String && + _$SessionConfigToolChoiceModeEnumMap.values.contains(data)) { + return SessionConfigToolChoiceEnumeration( + _$SessionConfigToolChoiceModeEnumMap.keys.elementAt( + _$SessionConfigToolChoiceModeEnumMap.values.toList().indexOf(data), + ), + ); + } + if (data is Map) { + try { + return SessionConfigToolChoiceToolChoiceForced( + ToolChoiceForced.fromJson(data), + ); + } catch (e) {} + } + throw Exception( + 'Unexpected value for SessionConfigToolChoice: $data', + ); + } + + @override + Object? toJson(SessionConfigToolChoice? data) { + return switch (data) { + SessionConfigToolChoiceEnumeration(value: final v) => + _$SessionConfigToolChoiceModeEnumMap[v]!, + SessionConfigToolChoiceToolChoiceForced(value: final v) => v.toJson(), + null => null, + }; + } +} + +// ========================================== +// CLASS: SessionConfigMaxResponseOutputTokens +// ========================================== + +/// Maximum number of output tokens for a single assistant response, inclusive of tool calls. Defaults to "inf". +@freezed +sealed class SessionConfigMaxResponseOutputTokens + with _$SessionConfigMaxResponseOutputTokens { + const SessionConfigMaxResponseOutputTokens._(); + + /// Provide an integer between 1 and 4096 to limit output tokens. + const factory SessionConfigMaxResponseOutputTokens.int( + int value, + ) = SessionConfigMaxResponseOutputTokensInt; + + /// Use inf for the maximum available tokens for a given model. + const factory SessionConfigMaxResponseOutputTokens.string( + String value, + ) = SessionConfigMaxResponseOutputTokensString; + + /// Object construction from a JSON representation + factory SessionConfigMaxResponseOutputTokens.fromJson( + Map json) => + _$SessionConfigMaxResponseOutputTokensFromJson(json); +} + +/// Custom JSON converter for [SessionConfigMaxResponseOutputTokens] +class _SessionConfigMaxResponseOutputTokensConverter + implements JsonConverter { + const _SessionConfigMaxResponseOutputTokensConverter(); + + @override + SessionConfigMaxResponseOutputTokens? fromJson(Object? data) { + if (data == null) { + return null; + } + if (data is int) { + return SessionConfigMaxResponseOutputTokensInt(data); + } + if (data is String) { + return SessionConfigMaxResponseOutputTokensString(data); + } + throw Exception( + 'Unexpected value for SessionConfigMaxResponseOutputTokens: $data', + ); + } + + @override + Object? toJson(SessionConfigMaxResponseOutputTokens? data) { + return switch (data) { + SessionConfigMaxResponseOutputTokensInt(value: final v) => v, + SessionConfigMaxResponseOutputTokensString(value: final v) => v, + null => null, + }; + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/tool_choice_forced.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/tool_choice_forced.dart new file mode 100644 index 00000000..538da9cd --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/tool_choice_forced.dart @@ -0,0 +1,44 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: ToolChoiceForced +// ========================================== + +/// Specifies a tool the model should use. Use to force the model to call a specific function. +@freezed +class ToolChoiceForced with _$ToolChoiceForced { + const ToolChoiceForced._(); + + /// Factory constructor for ToolChoiceForced + const factory ToolChoiceForced({ + /// The type of the tool. Currently, only `function` is supported. + @Default(ToolType.function) ToolType type, + + /// The name of the function to call. + required String name, + }) = _ToolChoiceForced; + + /// Object construction from a JSON representation + factory ToolChoiceForced.fromJson(Map json) => + _$ToolChoiceForcedFromJson(json); + + /// List of all property names of schema + static const List propertyNames = ['type', 'name']; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'type': type, + 'name': name, + }; + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/tool_definition.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/tool_definition.dart new file mode 100644 index 00000000..d4065857 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/tool_definition.dart @@ -0,0 +1,57 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: ToolDefinition +// ========================================== + +/// The definition of a tool the model may use. +@freezed +class ToolDefinition with _$ToolDefinition { + const ToolDefinition._(); + + /// Factory constructor for ToolDefinition + const factory ToolDefinition({ + /// The type of the tool (currently only `function` is supported). + @Default(ToolType.function) ToolType type, + + /// The name of the function. + required String name, + + /// The description of the function. + @JsonKey(includeIfNull: false) String? description, + + /// Parameters of the function in JSON Schema. + @JsonKey(includeIfNull: false) dynamic parameters, + }) = _ToolDefinition; + + /// Object construction from a JSON representation + factory ToolDefinition.fromJson(Map json) => + _$ToolDefinitionFromJson(json); + + /// List of all property names of schema + static const List propertyNames = [ + 'type', + 'name', + 'description', + 'parameters' + ]; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'type': type, + 'name': name, + 'description': description, + 'parameters': parameters, + }; + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/tool_type.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/tool_type.dart new file mode 100644 index 00000000..924631ce --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/tool_type.dart @@ -0,0 +1,15 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// ENUM: ToolType +// ========================================== + +/// The type of the tool. Currently, only `function` is supported. +enum ToolType { + @JsonValue('function') + function, +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/transcription_error.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/transcription_error.dart new file mode 100644 index 00000000..41ad9d48 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/transcription_error.dart @@ -0,0 +1,57 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: TranscriptionError +// ========================================== + +/// Details of the transcription error. +@freezed +class TranscriptionError with _$TranscriptionError { + const TranscriptionError._(); + + /// Factory constructor for TranscriptionError + const factory TranscriptionError({ + /// The type of the error. + @JsonKey(includeIfNull: false) String? type, + + /// Error code, if any. + @JsonKey(includeIfNull: false) String? code, + + /// A human-readable error message. + @JsonKey(includeIfNull: false) String? message, + + /// Parameter related to the error, if any. + @JsonKey(includeIfNull: false) String? param, + }) = _TranscriptionError; + + /// Object construction from a JSON representation + factory TranscriptionError.fromJson(Map json) => + _$TranscriptionErrorFromJson(json); + + /// List of all property names of schema + static const List propertyNames = [ + 'type', + 'code', + 'message', + 'param' + ]; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'type': type, + 'code': code, + 'message': message, + 'param': param, + }; + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/turn_detection.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/turn_detection.dart new file mode 100644 index 00000000..a140718a --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/turn_detection.dart @@ -0,0 +1,59 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: TurnDetection +// ========================================== + +/// Configuration for turn detection. +@freezed +class TurnDetection with _$TurnDetection { + const TurnDetection._(); + + /// Factory constructor for TurnDetection + const factory TurnDetection({ + /// The type of turn detection ("server_vad" or "none"). + required TurnDetectionType type, + + /// Activation threshold for VAD. + @JsonKey(includeIfNull: false) double? threshold, + + /// Audio included before speech starts (in milliseconds). + @JsonKey(name: 'prefix_padding_ms', includeIfNull: false) + int? prefixPaddingMs, + + /// Duration of silence to detect speech stop (in milliseconds). + @JsonKey(name: 'silence_duration_ms', includeIfNull: false) + int? silenceDurationMs, + }) = _TurnDetection; + + /// Object construction from a JSON representation + factory TurnDetection.fromJson(Map json) => + _$TurnDetectionFromJson(json); + + /// List of all property names of schema + static const List propertyNames = [ + 'type', + 'threshold', + 'prefix_padding_ms', + 'silence_duration_ms' + ]; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'type': type, + 'threshold': threshold, + 'prefix_padding_ms': prefixPaddingMs, + 'silence_duration_ms': silenceDurationMs, + }; + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/turn_detection_type.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/turn_detection_type.dart new file mode 100644 index 00000000..e04149b8 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/turn_detection_type.dart @@ -0,0 +1,15 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// ENUM: TurnDetectionType +// ========================================== + +/// The type of turn detection. +enum TurnDetectionType { + @JsonValue('server_vad') + serverVad, +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/usage.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/usage.dart new file mode 100644 index 00000000..d75defc8 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/usage.dart @@ -0,0 +1,104 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// CLASS: Usage +// ========================================== + +/// Usage statistics for the response +@freezed +class Usage with _$Usage { + const Usage._(); + + /// Factory constructor for Usage + const factory Usage({ + /// The total number of tokens used. + @JsonKey(name: 'total_tokens', includeIfNull: false) int? totalTokens, + + /// The number of input tokens used. + @JsonKey(name: 'input_tokens', includeIfNull: false) int? inputTokens, + + /// The number of output tokens used. + @JsonKey(name: 'output_tokens', includeIfNull: false) int? outputTokens, + + /// Details about the input tokens used. + @JsonKey(name: 'input_token_details', includeIfNull: false) + UsageInputTokenDetails? inputTokenDetails, + }) = _Usage; + + /// Object construction from a JSON representation + factory Usage.fromJson(Map json) => _$UsageFromJson(json); + + /// List of all property names of schema + static const List propertyNames = [ + 'total_tokens', + 'input_tokens', + 'output_tokens', + 'input_token_details' + ]; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'total_tokens': totalTokens, + 'input_tokens': inputTokens, + 'output_tokens': outputTokens, + 'input_token_details': inputTokenDetails, + }; + } +} + +// ========================================== +// CLASS: UsageInputTokenDetails +// ========================================== + +/// Details about the input tokens used. +@freezed +class UsageInputTokenDetails with _$UsageInputTokenDetails { + const UsageInputTokenDetails._(); + + /// Factory constructor for UsageInputTokenDetails + const factory UsageInputTokenDetails({ + /// The number of cached tokens used. + @JsonKey(name: 'cached_tokens', includeIfNull: false) int? cachedTokens, + + /// The number of text tokens used. + @JsonKey(name: 'text_tokens', includeIfNull: false) int? textTokens, + + /// The number of audio tokens used. + @JsonKey(name: 'audio_tokens', includeIfNull: false) int? audioTokens, + }) = _UsageInputTokenDetails; + + /// Object construction from a JSON representation + factory UsageInputTokenDetails.fromJson(Map json) => + _$UsageInputTokenDetailsFromJson(json); + + /// List of all property names of schema + static const List propertyNames = [ + 'cached_tokens', + 'text_tokens', + 'audio_tokens' + ]; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'cached_tokens': cachedTokens, + 'text_tokens': textTokens, + 'audio_tokens': audioTokens, + }; + } +} diff --git a/packages/openai_realtime_dart/lib/src/schema/generated/schema/voice.dart b/packages/openai_realtime_dart/lib/src/schema/generated/schema/voice.dart new file mode 100644 index 00000000..a50ec87a --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/generated/schema/voice.dart @@ -0,0 +1,19 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of openai_realtime_schema; + +// ========================================== +// ENUM: Voice +// ========================================== + +/// The voice used by the model. +enum Voice { + @JsonValue('alloy') + alloy, + @JsonValue('echo') + echo, + @JsonValue('shimmer') + shimmer, +} diff --git a/packages/openai_realtime_dart/lib/src/schema/schema.dart b/packages/openai_realtime_dart/lib/src/schema/schema.dart new file mode 100644 index 00000000..7f3d4d17 --- /dev/null +++ b/packages/openai_realtime_dart/lib/src/schema/schema.dart @@ -0,0 +1 @@ +export 'generated/schema/schema.dart'; diff --git a/packages/openai_realtime_dart/lib/src/utils.dart b/packages/openai_realtime_dart/lib/src/utils.dart index 6a2bac9a..376ff132 100644 --- a/packages/openai_realtime_dart/lib/src/utils.dart +++ b/packages/openai_realtime_dart/lib/src/utils.dart @@ -10,7 +10,7 @@ class RealtimeUtils { return result; } - static String generateId(String prefix, {int length = 21}) { + static String generateId({String prefix = 'evt_', int length = 21}) { const chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; final random = Random(); final str = List.generate( diff --git a/packages/openai_realtime_dart/oas/main.dart b/packages/openai_realtime_dart/oas/main.dart new file mode 100644 index 00000000..24df8c33 --- /dev/null +++ b/packages/openai_realtime_dart/oas/main.dart @@ -0,0 +1,35 @@ +// ignore_for_file: avoid_print +import 'dart:io'; + +import 'package:openapi_spec/openapi_spec.dart'; + +/// Generates OpenAI Realtime Dart types from the OpenAPI spec. +/// Official spec: https://github.com/openai/openai-openapi/blob/master/openapi.yaml +void main() async { + final spec = OpenApi.fromFile(source: 'oas/openai_spec_curated.yaml'); + await spec.generate( + package: 'openai_realtime', + destination: 'lib/src/schema/generated/', + replace: true, + schemaOptions: const SchemaGeneratorOptions( + onSchemaUnionFactoryName: _onSchemaUnionFactoryName, + ), + ); + final res = await Process.run( + 'dart', + ['run', 'build_runner', 'build', 'lib', '--delete-conflicting-outputs'], + ); + print(res.stdout); + print(res.stderr); +} + +String? _onSchemaUnionFactoryName( + final String union, + final String unionSubclass, +) => + switch (unionSubclass) { + 'SessionToolChoiceEnumeration' => 'mode', + 'SessionConfigToolChoiceEnumeration' => 'mode', + 'ResponseConfigToolChoiceEnumeration' => 'mode', + _ => null, + }; diff --git a/packages/openai_realtime_dart/oas/openai_spec_curated.yaml b/packages/openai_realtime_dart/oas/openai_spec_curated.yaml new file mode 100644 index 00000000..2bb6b910 --- /dev/null +++ b/packages/openai_realtime_dart/oas/openai_spec_curated.yaml @@ -0,0 +1,1821 @@ +#file: noinspection YAMLSchemaValidation +openapi: 3.0.0 +info: + title: OpenAI API + description: The OpenAI REST API. Please see + https://platform.openai.com/docs/api-reference for more details. + version: 2.3.0 + termsOfService: https://openai.com/policies/terms-of-use + contact: + name: OpenAI Support + url: https://help.openai.com/ + license: + name: MIT + url: https://github.com/openai/openai-openapi/blob/master/LICENSE +components: + schemas: + AudioFormat: + type: string + description: The format of the audio. + enum: + - pcm16 + - g711_ulaw + - g711_alaw + Voice: + type: string + description: The voice used by the model. + enum: + - alloy + - echo + - shimmer + ItemRole: + type: string + description: The role associated with the item. + enum: + - user + - assistant + - system + ItemType: + type: string + description: The type of the item. + enum: + - message + - function_call + - function_call_output + ItemStatus: + type: string + description: The status of the item. + enum: + - completed + - in_progress + - incomplete + ContentType: + type: string + description: The type of the content. + enum: + - input_text + - input_audio + - text + - audio + ObjectType: + type: string + description: The object type. + enum: + - realtime.item + - realtime.response + - realtime.session + - realtime.conversation + ToolType: + type: string + description: The type of the tool. Currently, only `function` is supported. + enum: + - function + ToolDefinition: + type: object + description: The definition of a tool the model may use. + properties: + type: + $ref: "#/components/schemas/ToolType" + default: function + description: The type of the tool (currently only `function` is supported). + name: + type: string + description: The name of the function. + description: + type: string + description: The description of the function. + parameters: + type: object + description: Parameters of the function in JSON Schema. + required: + - name + ToolChoiceForced: + type: object + description: Specifies a tool the model should use. Use to force the model to call a specific function. + properties: + type: + $ref: "#/components/schemas/ToolType" + default: function + name: + type: string + description: The name of the function to call. + required: + - name + ContentPart: + description: A part of the content. + oneOf: + - $ref: "#/components/schemas/ContentPartInputText" + - $ref: "#/components/schemas/ContentPartInputAudio" + - $ref: "#/components/schemas/ContentPartText" + - $ref: "#/components/schemas/ContentPartAudio" + discriminator: + propertyName: type + ContentPartInputText: + type: object + description: A part of the input text content. + properties: + type: + $ref: "#/components/schemas/ContentType" + description: The content type. + default: input_text + text: + type: string + description: The text content. + required: + - text + ContentPartInputAudio: + type: object + description: A part of the input audio content. + properties: + type: + $ref: "#/components/schemas/ContentType" + description: The content type. + default: input_audio + audio: + type: string + description: Base64-encoded audio bytes. + transcript: + type: string + description: The transcript of the audio. + ContentPartText: + type: object + description: A part of the text content. + properties: + type: + $ref: "#/components/schemas/ContentType" + description: The content type. + default: text + text: + type: string + description: The text content. + required: + - text + ContentPartAudio: + type: object + description: A part of the audio content. + properties: + type: + $ref: "#/components/schemas/ContentType" + description: The content type. + default: audio + audio: + type: string + description: Base64-encoded audio bytes. + transcript: + type: string + description: The transcript of the audio. + Item: + type: object + description: The item to add to the conversation. + oneOf: + - $ref: "#/components/schemas/ItemMessage" + - $ref: "#/components/schemas/ItemFunctionCall" + - $ref: "#/components/schemas/ItemFunctionCallOutput" + discriminator: + propertyName: type + ItemMessage: + type: object + description: A message item. + properties: + id: + type: string + description: The unique ID of the item. + object: + $ref: "#/components/schemas/ObjectType" + description: The object type, must be "realtime.item". + type: + $ref: "#/components/schemas/ItemType" + description: The type of the item. + default: message + status: + $ref: "#/components/schemas/ItemStatus" + description: The status of the item. + role: + $ref: "#/components/schemas/ItemRole" + description: The role of the message sender. + content: + type: array + description: The content of the message. + items: + $ref: "#/components/schemas/ContentPart" + required: + - id + - role + - content + ItemFunctionCall: + type: object + description: A function call item. + properties: + id: + type: string + description: The unique ID of the item. + object: + $ref: "#/components/schemas/ObjectType" + description: The object type. + default: realtime.item + type: + $ref: "#/components/schemas/ItemType" + description: The type of the item. + default: function_call + status: + $ref: "#/components/schemas/ItemStatus" + description: The status of the item. + call_id: + type: string + description: The ID of the function call. + name: + type: string + description: The name of the function being called. + arguments: + type: string + description: The arguments of the function call. + required: + - id + - call_id + - name + - arguments + ItemFunctionCallOutput: + type: object + description: A function call output item. + properties: + id: + type: string + description: The unique ID of the item. + object: + $ref: "#/components/schemas/ObjectType" + description: The object type. Always "realtime.item". + type: + $ref: "#/components/schemas/ItemType" + description: The type of the item. + default: function_call_output + status: + $ref: "#/components/schemas/ItemStatus" + description: The status of the item. + call_id: + type: string + description: The ID of the function call. + output: + type: string + description: The output of the function call. + required: + - id + - call_id + - output + InputAudioTranscriptionConfig: + type: object + description: Configuration for input audio transcription. + properties: + enabled: + type: boolean + description: Whether input audio transcription is enabled. + model: + type: string + description: The model used for transcription. + TurnDetection: + type: object + description: Configuration for turn detection. + properties: + type: + $ref: "#/components/schemas/TurnDetectionType" + description: The type of turn detection ("server_vad" or "none"). + threshold: + type: number + description: Activation threshold for VAD. + prefix_padding_ms: + type: integer + description: Audio included before speech starts (in milliseconds). + silence_duration_ms: + type: integer + description: Duration of silence to detect speech stop (in milliseconds). + required: + - type + TurnDetectionType: + type: string + description: The type of turn detection. + enum: + - server_vad + RateLimit: + type: object + description: Rate limit information. + properties: + name: + $ref: "#/components/schemas/RateLimitName" + description: The name of the rate limit. + limit: + type: integer + description: The maximum allowed value for the rate limit. + remaining: + type: integer + description: The remaining value before the limit is reached. + reset_seconds: + type: number + description: Seconds until the rate limit resets. + required: + - name + - limit + - remaining + - reset_seconds + RateLimitName: + type: string + description: The name of the rate limit. + enum: + - requests + - tokens + - input_tokens + - output_tokens + Response: + type: object + description: The response resource. + properties: + id: + type: string + description: The unique ID of the response. + object: + $ref: "#/components/schemas/ObjectType" + description: The object type, must be "realtime.response". + default: realtime.response + status: + $ref: "#/components/schemas/ResponseStatus" + description: The status of the response. + status_details: + $ref: "#/components/schemas/ResponseStatusDetails" + description: Additional details about the status. + nullable: true + output: + type: array + description: The list of output items generated by the response. + items: + $ref: "#/components/schemas/Item" + description: An item in the response output. + usage: + $ref: "#/components/schemas/Usage" + required: + - id + - status + - output + ResponseStatus: + type: string + description: The status of the response. + enum: + - in_progress + - completed + - cancelled + - failed + - incomplete + ResponseStatusDetails: + description: Additional details about the status. + oneOf: + - $ref: "#/components/schemas/ResponseStatusDetailsIncomplete" + - $ref: "#/components/schemas/ResponseStatusDetailsFailed" + discriminator: + propertyName: type + ResponseStatusType: + type: string + description: The type of the status. + enum: + - incomplete + - failed + ResponseStatusDetailsIncomplete: + type: object + description: Details about the incomplete response. + properties: + type: + $ref: "#/components/schemas/ResponseStatusType" + default: incomplete + reason: + $ref: "#/components/schemas/ResponseStatusIncompleteReason" + ResponseStatusIncompleteReason: + type: string + description: The reason the response is incomplete. + enum: + - interruption + - max_output_tokens + - content_filter + ResponseStatusDetailsFailed: + type: object + description: Details about the failed response. + properties: + type: + $ref: "#/components/schemas/ResponseStatusType" + default: failed + error: + $ref: "#/components/schemas/APIError" + nullable: true + ResponseConfig: + type: object + description: Configuration for the response. + properties: + modalities: + type: array + description: The modalities for the response. + items: + $ref: "#/components/schemas/Modality" + instructions: + type: string + description: Instructions for the model. + voice: + $ref: "#/components/schemas/Voice" + description: The voice the model uses to respond - one of `alloy`, `echo`, or + `shimmer`. + output_audio_format: + $ref: "#/components/schemas/AudioFormat" + description: The format of output audio. + tools: + type: array + description: Tools (functions) available to the model. + items: + $ref: "#/components/schemas/ToolDefinition" + tool_choice: + description: How the model chooses tools. + oneOf: + - type: string + title: ResponseConfigToolChoiceMode + description: > + `none` means the model will not call any tool and instead generates a message. + `auto` means the model can pick between generating a message or calling one or more tools. + `required` means the model must call one or more tools. + enum: [ none, auto, required ] + - $ref: "#/components/schemas/ToolChoiceForced" + temperature: + type: number + description: Sampling temperature. + max_response_output_tokens: + description: Maximum number of output tokens for a single assistant response, + inclusive of tool calls. Defaults to "inf". + oneOf: + - type: integer + description: Provide an integer between 1 and 4096 to limit output tokens. + - type: string + description: Use inf for the maximum available tokens for a given model. + default: inf + Usage: + type: object + description: Usage statistics for the response + properties: + total_tokens: + type: integer + description: The total number of tokens used. + input_tokens: + type: integer + description: The number of input tokens used. + output_tokens: + type: integer + description: The number of output tokens used. + input_token_details: + type: object + description: Details about the input tokens used. + properties: + cached_tokens: + type: integer + description: The number of cached tokens used. + text_tokens: + type: integer + description: The number of text tokens used. + audio_tokens: + type: integer + description: The number of audio tokens used. + Session: + type: object + description: The session resource. + properties: + id: + type: string + description: The unique ID of the session. + object: + $ref: "#/components/schemas/ObjectType" + description: The object type, must be "realtime.session". + default: realtime.session + model: + type: string + description: The default model used for this session. + expires_at: + type: integer + description: The time at which the session expires. + modalities: + type: array + description: The set of modalities the model can respond with. + items: + $ref: "#/components/schemas/Modality" + instructions: + type: string + description: The default system instructions. + voice: + $ref: "#/components/schemas/Voice" + description: The voice the model uses to respond - one of `alloy`, `echo`, or + `shimmer`. + input_audio_format: + $ref: "#/components/schemas/AudioFormat" + description: The format of input audio. + output_audio_format: + $ref: "#/components/schemas/AudioFormat" + description: The format of output audio. + input_audio_transcription: + $ref: "#/components/schemas/InputAudioTranscriptionConfig" + turn_detection: + $ref: "#/components/schemas/TurnDetection" + tools: + type: array + description: Tools (functions) available to the model. + items: + $ref: "#/components/schemas/ToolDefinition" + tool_choice: + description: How the model chooses tools. + oneOf: + - type: string + title: SessionToolChoiceMode + description: > + `none` means the model will not call any tool and instead generates a message. + `auto` means the model can pick between generating a message or calling one or more tools. + `required` means the model must call one or more tools. + enum: [ none, auto, required ] + - $ref: "#/components/schemas/ToolChoiceForced" + temperature: + type: number + description: Sampling temperature. + max_response_output_tokens: + description: Maximum number of output tokens for a single assistant response, + inclusive of tool calls. Defaults to "inf". + oneOf: + - type: integer + description: Provide an integer between 1 and 4096 to limit output tokens. + - type: string + description: Use inf for the maximum available tokens for a given model. + default: inf + SessionConfig: + type: object + description: Session configuration to update. + properties: + modalities: + type: array + items: + $ref: "#/components/schemas/Modality" + description: | + The set of modalities the model can respond with. To disable audio, set this to ["text"]. + instructions: + type: string + description: The default system instructions prepended to model calls. + voice: + $ref: "#/components/schemas/Voice" + description: | + The voice the model uses to respond - one of `alloy`, `echo`, + or `shimmer`. Cannot be changed once the model has responded + with audio at least once. + input_audio_format: + $ref: "#/components/schemas/AudioFormat" + description: The format of input audio. Options are "pcm16", "g711_ulaw", or "g711_alaw". + output_audio_format: + $ref: "#/components/schemas/AudioFormat" + description: The format of output audio. Options are "pcm16", "g711_ulaw", or "g711_alaw". + input_audio_transcription: + $ref: "#/components/schemas/InputAudioTranscriptionConfig" + description: Configuration for input audio transcription. Can be set to null to turn off. + nullable: true + turn_detection: + $ref: "#/components/schemas/TurnDetection" + nullable: true + tools: + type: array + description: Tools (functions) available to the model. + items: + $ref: "#/components/schemas/ToolDefinition" + tool_choice: + description: How the model chooses tools. + oneOf: + - type: string + title: SessionConfigToolChoiceMode + description: > + `none` means the model will not call any tool and instead generates a message. + `auto` means the model can pick between generating a message or calling one or more tools. + `required` means the model must call one or more tools. + enum: [ none, auto, required ] + - $ref: "#/components/schemas/ToolChoiceForced" + temperature: + type: number + description: Sampling temperature for the model. + max_response_output_tokens: + description: Maximum number of output tokens for a single assistant response, + inclusive of tool calls. Defaults to "inf". + oneOf: + - type: integer + description: Provide an integer between 1 and 4096 to limit output tokens. + - type: string + description: Use inf for the maximum available tokens for a given model. + default: inf + Conversation: + type: object + description: The conversation resource. + properties: + id: + type: string + description: The unique ID of the conversation. + object: + $ref: "#/components/schemas/ObjectType" + description: The object type, must be "realtime.conversation". + default: realtime.conversation + required: + - id + Modality: + type: string + description: The modality of the model response. + enum: + - text + - audio + Delta: + type: object + description: Delta object. + properties: + transcript: + type: string + description: The transcript of the audio. + nullable: true + audio: + type: string + format: byte + description: The audio bytes. + nullable: true + text: + type: string + nullable: true + description: The text. + arguments: + type: string + nullable: true + description: The arguments. + FormattedTool: + type: object + description: A formatted tool. + properties: + type: + $ref: "#/components/schemas/ToolType" + default: function + name: + type: string + description: The name of the function. + call_id: + type: string + description: The call id. + arguments: + type: string + description: The arguments. + required: + - name + - call_id + - arguments + FormattedProperty: + type: object + description: A formatted property. + properties: + audio: + type: string + format: byte + description: The audio bytes. + text: + type: string + description: The text. + transcript: + type: string + description: The transcript. + tool: + $ref: '#/components/schemas/FormattedTool' + nullable: true + output: + type: string + nullable: true + description: The output. + required: + - audio + - text + - transcript + FormattedItem: + type: object + description: A formatted item. + properties: + item: + $ref: '#/components/schemas/Item' + formatted: + $ref: '#/components/schemas/FormattedProperty' + nullable: true + required: + - item + - formatted + ItemSpeech: + type: object + description: The speech item. + properties: + audioStartMs: + type: integer + format: int32 + description: The start time of the audio in milliseconds. + audioEndMs: + type: integer + format: int32 + description: The end time of the audio in milliseconds. + nullable: true + audio: + type: string + format: byte + description: The audio bytes. + nullable: true + required: + - audioStartMs + ItemTranscript: + type: object + description: The transcript item. + properties: + transcript: + type: string + description: The transcript. + required: + - transcript + EventHandlerResult: + type: object + description: + properties: + item: + $ref: '#/components/schemas/FormattedItem' + nullable: true + delta: + $ref: '#/components/schemas/Delta' + nullable: true + response: + $ref: '#/components/schemas/Response' + nullable: true + TranscriptionError: + type: object + description: Details of the transcription error. + properties: + type: + type: string + description: The type of the error. + code: + type: string + description: Error code, if any. + message: + type: string + description: A human-readable error message. + param: + type: string + description: Parameter related to the error, if any. + APIError: + type: object + description: Details of the API error. + properties: + type: + type: string + description: The type of error (e.g., "invalid_request_error", "server_error"). + code: + type: string + description: Error code, if any. + message: + type: string + description: A human-readable error message. + param: + type: string + description: Parameter related to the error, if any. + event_id: + type: string + description: The event_id of the client event that caused the error, if + applicable. + RealtimeEvent: + type: object + description: A Realtime API event. + oneOf: + - $ref: "#/components/schemas/RealtimeEventConversationItemCreate" + - $ref: "#/components/schemas/RealtimeEventConversationItemDelete" + - $ref: "#/components/schemas/RealtimeEventConversationItemTruncate" + - $ref: "#/components/schemas/RealtimeEventInputAudioBufferAppend" + - $ref: "#/components/schemas/RealtimeEventInputAudioBufferClear" + - $ref: "#/components/schemas/RealtimeEventInputAudioBufferCommit" + - $ref: "#/components/schemas/RealtimeEventResponseCancel" + - $ref: "#/components/schemas/RealtimeEventResponseCreate" + - $ref: "#/components/schemas/RealtimeEventSessionUpdate" + - $ref: "#/components/schemas/RealtimeEventConversationCreated" + - $ref: "#/components/schemas/RealtimeEventConversationItemCreated" + - $ref: "#/components/schemas/RealtimeEventConversationItemDeleted" + - $ref: "#/components/schemas/RealtimeEventConversationItemInputAudioTranscriptionCompleted" + - $ref: "#/components/schemas/RealtimeEventConversationItemInputAudioTranscriptionFailed" + - $ref: "#/components/schemas/RealtimeEventConversationItemTruncated" + - $ref: "#/components/schemas/RealtimeEventError" + - $ref: "#/components/schemas/RealtimeEventInputAudioBufferCleared" + - $ref: "#/components/schemas/RealtimeEventInputAudioBufferCommitted" + - $ref: "#/components/schemas/RealtimeEventInputAudioBufferSpeechStarted" + - $ref: "#/components/schemas/RealtimeEventInputAudioBufferSpeechStopped" + - $ref: "#/components/schemas/RealtimeEventRateLimitsUpdated" + - $ref: "#/components/schemas/RealtimeEventResponseAudioDelta" + - $ref: "#/components/schemas/RealtimeEventResponseAudioDone" + - $ref: "#/components/schemas/RealtimeEventResponseAudioTranscriptDelta" + - $ref: "#/components/schemas/RealtimeEventResponseAudioTranscriptDone" + - $ref: "#/components/schemas/RealtimeEventResponseContentPartAdded" + - $ref: "#/components/schemas/RealtimeEventResponseContentPartDone" + - $ref: "#/components/schemas/RealtimeEventResponseCreated" + - $ref: "#/components/schemas/RealtimeEventResponseDone" + - $ref: "#/components/schemas/RealtimeEventResponseFunctionCallArgumentsDelta" + - $ref: "#/components/schemas/RealtimeEventResponseFunctionCallArgumentsDone" + - $ref: "#/components/schemas/RealtimeEventResponseOutputItemAdded" + - $ref: "#/components/schemas/RealtimeEventResponseOutputItemDone" + - $ref: "#/components/schemas/RealtimeEventResponseTextDelta" + - $ref: "#/components/schemas/RealtimeEventResponseTextDone" + - $ref: "#/components/schemas/RealtimeEventSessionCreated" + - $ref: "#/components/schemas/RealtimeEventSessionUpdated" + - $ref: "#/components/schemas/RealtimeEventClose" + - $ref: "#/components/schemas/RealtimeEventConversationInterrupted" + - $ref: "#/components/schemas/RealtimeEventConversationUpdated" + - $ref: "#/components/schemas/RealtimeEventConversationItemAppended" + - $ref: "#/components/schemas/RealtimeEventConversationItemCompleted" + - $ref: "#/components/schemas/RealtimeEventGeneric" + discriminator: + propertyName: type + RealtimeEventType: + type: string + description: The type of the event. + enum: + - conversation.item.create + - conversation.item.delete + - conversation.item.truncate + - input_audio_buffer.append + - input_audio_buffer.clear + - input_audio_buffer.commit + - response.cancel + - response.create + - session.update + - conversation.created + - conversation.item.created + - conversation.item.deleted + - conversation.item.input_audio_transcription.completed + - conversation.item.input_audio_transcription.failed + - conversation.item.truncated + - error + - input_audio_buffer.cleared + - input_audio_buffer.committed + - input_audio_buffer.speech_started + - input_audio_buffer.speech_stopped + - rate_limits.updated + - response.audio.delta + - response.audio.done + - response.audio_transcript.delta + - response.audio_transcript.done + - response.content_part.added + - response.content_part.done + - response.created + - response.done + - response.function_call_arguments.delta + - response.function_call_arguments.done + - response.output_item.added + - response.output_item.done + - response.text.delta + - response.text.done + - session.created + - session.updated + # Utility events + - close + - conversation.interrupted + - conversation.updated + - conversation.item.appended + - conversation.item.completed + - realtime.event + - all + - server.all + - client.all + RealtimeEventConversationItemCreate: + type: object + description: Send this event when adding an item to the conversation. + properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: conversation.item.create + previous_item_id: + type: string + description: The ID of the preceding item after which the new item will be + inserted. + item: + $ref: "#/components/schemas/Item" + required: + - event_id + - item + RealtimeEventConversationItemDelete: + type: object + description: Send this event when you want to remove any item from the + conversation history. + properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: conversation.item.delete + item_id: + type: string + description: The ID of the item to delete. + required: + - event_id + - item_id + RealtimeEventConversationItemTruncate: + type: object + description: Send this event when you want to truncate a previous assistant + message’s audio. + properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: conversation.item.truncate + item_id: + type: string + description: The ID of the assistant message item to truncate. + content_index: + type: integer + description: The index of the content part to truncate. + audio_end_ms: + type: integer + description: Inclusive duration up to which audio is truncated, in milliseconds. + required: + - event_id + - item_id + - content_index + - audio_end_ms + RealtimeEventInputAudioBufferAppend: + type: object + description: Send this event to append audio bytes to the input audio buffer. + properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: input_audio_buffer.append + audio: + type: string + description: Base64-encoded audio bytes. + required: + - event_id + - audio + RealtimeEventInputAudioBufferClear: + type: object + description: Send this event to clear the audio bytes in the buffer. + properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: input_audio_buffer.clear + required: + - event_id + RealtimeEventInputAudioBufferCommit: + type: object + description: Send this event to commit audio bytes to a user message. + properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: input_audio_buffer.commit + required: + - event_id + RealtimeEventResponseCancel: + type: object + description: Send this event to cancel an in-progress response. + properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: response.cancel + required: + - event_id + RealtimeEventResponseCreate: + type: object + description: Send this event to trigger a response generation. + properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: response.create + response: + $ref: "#/components/schemas/ResponseConfig" + required: + - event_id + RealtimeEventSessionUpdate: + type: object + description: Send this event to update the session’s default configuration. + properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: session.update + session: + $ref: "#/components/schemas/SessionConfig" + required: + - session + RealtimeEventConversationCreated: + type: object + description: Returned when a conversation is created. Emitted right after + session creation. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: conversation.created + conversation: + $ref: "#/components/schemas/Conversation" + required: + - event_id + - conversation + RealtimeEventConversationItemCreated: + type: object + description: Returned when a conversation item is created. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: conversation.item.created + previous_item_id: + type: string + nullable: true + description: The ID of the preceding item. + item: + $ref: "#/components/schemas/Item" + required: + - event_id + - previous_item_id + - item + RealtimeEventConversationItemDeleted: + type: object + description: Returned when an item in the conversation is deleted. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: conversation.item.deleted + item_id: + type: string + description: The ID of the item that was deleted. + required: + - event_id + - item_id + RealtimeEventConversationItemInputAudioTranscriptionCompleted: + type: object + description: Returned when input audio transcription is enabled and a + transcription succeeds. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: conversation.item.input_audio_transcription.completed + item_id: + type: string + description: The ID of the user message item. + content_index: + type: integer + description: The index of the content part containing the audio. + transcript: + type: string + description: The transcribed text. + required: + - event_id + - item_id + - content_index + - transcript + RealtimeEventConversationItemInputAudioTranscriptionFailed: + type: object + description: Returned when input audio transcription is configured, and a + transcription request for a user message failed. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: conversation.item.input_audio_transcription.failed + item_id: + type: string + description: The ID of the user message item. + content_index: + type: integer + description: The index of the content part containing the audio. + error: + $ref: "#/components/schemas/TranscriptionError" + required: + - event_id + - item_id + - content_index + - error + RealtimeEventConversationItemTruncated: + type: object + description: Returned when an earlier assistant audio message item is truncated + by the client. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: conversation.item.truncated + item_id: + type: string + description: The ID of the assistant message item that was truncated. + content_index: + type: integer + description: The index of the content part that was truncated. + audio_end_ms: + type: integer + description: The duration up to which the audio was truncated, in milliseconds. + required: + - event_id + - item_id + - content_index + - audio_end_ms + RealtimeEventError: + type: object + description: Returned when an error occurs. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: error + error: + $ref: "#/components/schemas/APIError" + required: + - event_id + - error + RealtimeEventInputAudioBufferCleared: + type: object + description: Returned when the input audio buffer is cleared by the client. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: input_audio_buffer.cleared + required: + - event_id + RealtimeEventInputAudioBufferCommitted: + type: object + description: Returned when an input audio buffer is committed, either by the + client or automatically in server VAD mode. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: input_audio_buffer.committed + previous_item_id: + type: string + description: The ID of the preceding item after which the new item will be + inserted. + item_id: + type: string + description: The ID of the user message item that will be created. + required: + - event_id + - previous_item_id + - item_id + RealtimeEventInputAudioBufferSpeechStarted: + type: object + description: Returned in server turn detection mode when speech is detected. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: input_audio_buffer.speech_started + audio_start_ms: + type: integer + description: Milliseconds since the session started when speech was detected. + item_id: + type: string + description: The ID of the user message item that will be created when speech + stops. + required: + - event_id + - audio_start_ms + - item_id + RealtimeEventInputAudioBufferSpeechStopped: + type: object + description: Returned in server turn detection mode when speech stops. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: input_audio_buffer.speech_stopped + audio_end_ms: + type: integer + description: Milliseconds since the session started when speech stopped. + item_id: + type: string + description: The ID of the user message item that will be created. + required: + - event_id + - audio_end_ms + - item_id + RealtimeEventRateLimitsUpdated: + type: object + description: Emitted after every "response.done" event to indicate the updated + rate limits. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: rate_limits.updated + rate_limits: + type: array + description: List of rate limit information. + items: + $ref: "#/components/schemas/RateLimit" + required: + - event_id + - rate_limits + RealtimeEventResponseAudioDelta: + type: object + description: Returned when the model-generated audio is updated. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: response.audio.delta + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + delta: + type: string + description: Base64-encoded audio data delta. + required: + - event_id + - response_id + - item_id + - output_index + - content_index + - delta + RealtimeEventResponseAudioDone: + type: object + description: Returned when the model-generated audio is done. Also emitted when + a Response is interrupted, incomplete, or cancelled. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: response.audio.done + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + required: + - event_id + - response_id + - item_id + - output_index + - content_index + RealtimeEventResponseAudioTranscriptDelta: + type: object + description: Returned when the model-generated transcription of audio output is + updated. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: response.audio_transcript.delta + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + delta: + type: string + description: The transcript delta. + required: + - event_id + - response_id + - item_id + - output_index + - content_index + - delta + RealtimeEventResponseAudioTranscriptDone: + type: object + description: Returned when the model-generated transcription of audio output is + done streaming. Also emitted when a Response is interrupted, incomplete, + or cancelled. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: response.audio_transcript.done + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + transcript: + type: string + description: The final transcript of the audio. + required: + - event_id + - response_id + - item_id + - output_index + - content_index + - transcript + RealtimeEventResponseContentPartAdded: + type: object + description: Returned when a new content part is added to an assistant message + item during response generation. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: response.content_part.added + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item to which the content part was added. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + part: + $ref: "#/components/schemas/ContentPart" + required: + - event_id + - response_id + - item_id + - output_index + - content_index + - part + RealtimeEventResponseContentPartDone: + type: object + description: Returned when a content part is done streaming in an assistant + message item. Also emitted when a Response is interrupted, incomplete, + or cancelled. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: response.content_part.done + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + part: + $ref: "#/components/schemas/ContentPart" + required: + - event_id + - response_id + - item_id + - output_index + - content_index + - part + RealtimeEventResponseCreated: + type: object + description: Returned when a new Response is created. The first event of + response creation, where the response is in an initial state of + "in_progress". + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: response.created + response: + $ref: "#/components/schemas/Response" + required: + - event_id + - response + RealtimeEventResponseDone: + type: object + description: Returned when a Response is done streaming. Always emitted, no + matter the final state. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: response.done + response: + $ref: "#/components/schemas/Response" + required: + - event_id + - response + RealtimeEventResponseFunctionCallArgumentsDelta: + type: object + description: Returned when the model-generated function call arguments are updated. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: response.function_call_arguments.delta + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the function call item. + output_index: + type: integer + description: The index of the output item in the response. + call_id: + type: string + description: The ID of the function call. + delta: + type: string + description: The arguments delta as a JSON string. + required: + - event_id + - response_id + - item_id + - output_index + - call_id + - delta + RealtimeEventResponseFunctionCallArgumentsDone: + type: object + description: Returned when the model-generated function call arguments are done + streaming. Also emitted when a Response is interrupted, incomplete, or + cancelled. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: response.function_call_arguments.done + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the function call item. + output_index: + type: integer + description: The index of the output item in the response. + call_id: + type: string + description: The ID of the function call. + arguments: + type: string + description: The final arguments as a JSON string. + required: + - event_id + - response_id + - item_id + - output_index + - call_id + - arguments + RealtimeEventResponseOutputItemAdded: + type: object + description: Returned when a new Item is created during response generation. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: response.output_item.added + response_id: + type: string + description: The ID of the response to which the item belongs. + output_index: + type: integer + description: The index of the output item in the response. + item: + $ref: "#/components/schemas/Item" + required: + - event_id + - response_id + - output_index + - item + RealtimeEventResponseOutputItemDone: + type: object + description: Returned when an Item is done streaming. Also emitted when a + Response is interrupted, incomplete, or cancelled. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: response.output_item.done + response_id: + type: string + description: The ID of the response to which the item belongs. + output_index: + type: integer + description: The index of the output item in the response. + item: + $ref: "#/components/schemas/Item" + required: + - event_id + - response_id + - output_index + - item + RealtimeEventResponseTextDelta: + type: object + description: Returned when the text value of a "text" content part is updated. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: response.text.delta + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + delta: + type: string + description: The text delta. + required: + - event_id + - response_id + - item_id + - output_index + - content_index + - delta + RealtimeEventResponseTextDone: + type: object + description: Returned when the text value of a "text" content part is done + streaming. Also emitted when a Response is interrupted, incomplete, or + cancelled. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: response.text.done + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + text: + type: string + description: The final text content. + required: + - event_id + - response_id + - item_id + - output_index + - content_index + - text + RealtimeEventSessionCreated: + type: object + description: Returned when a session is created. Emitted automatically when a + new connection is established. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: session.created + session: + $ref: "#/components/schemas/Session" + required: + - event_id + - session + RealtimeEventSessionUpdated: + type: object + description: Returned when a session is updated. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: session.updated + session: + $ref: "#/components/schemas/Session" + required: + - event_id + - session + RealtimeEventClose: + type: object + description: The websocket connection was closed. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: close + error: + type: boolean + description: Whether the close was due to an error. + required: + - event_id + - error + RealtimeEventConversationInterrupted: + type: object + description: The conversation was interrupted. + properties: + event_id: + type: string + description: The unique ID of the event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: conversation.interrupted + required: + - event_id + RealtimeEventConversationUpdated: + type: object + description: The conversation was updated. + properties: + event_id: + type: string + description: The unique ID of the event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: conversation.updated + result: + $ref: '#/components/schemas/EventHandlerResult' + required: + - event_id + - result + RealtimeEventConversationItemAppended: + type: object + description: An item was appended to the conversation. + properties: + event_id: + type: string + description: The unique ID of the event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: conversation.item.appended + item: + $ref: '#/components/schemas/FormattedItem' + required: + - event_id + - item + RealtimeEventConversationItemCompleted: + type: object + description: An item was completed. + properties: + event_id: + type: string + description: The unique ID of the event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: conversation.item.completed + item: + $ref: '#/components/schemas/FormattedItem' + required: + - event_id + - item + RealtimeEventGeneric: + type: object + description: A generic realtime event. + properties: + event_id: + type: string + description: The unique ID of the event. + type: + $ref: "#/components/schemas/RealtimeEventType" + description: The type of the event. + default: realtime.event + event: + $ref: '#/components/schemas/RealtimeEvent' + required: + - event_id + - event diff --git a/packages/openai_realtime_dart/oas/openai_spec_official.yaml b/packages/openai_realtime_dart/oas/openai_spec_official.yaml new file mode 100644 index 00000000..af1bd23a --- /dev/null +++ b/packages/openai_realtime_dart/oas/openai_spec_official.yaml @@ -0,0 +1,22353 @@ +openapi: 3.0.0 +info: + title: OpenAI API + description: The OpenAI REST API. Please see + https://platform.openai.com/docs/api-reference for more details. + version: 2.3.0 + termsOfService: https://openai.com/policies/terms-of-use + contact: + name: OpenAI Support + url: https://help.openai.com/ + license: + name: MIT + url: https://github.com/openai/openai-openapi/blob/master/LICENSE +servers: + - url: https://api.openai.com/v1 +tags: + - name: Assistants + description: Build Assistants that can call models and use tools. + - name: Audio + description: Turn audio into text or text into audio. + - name: Chat + description: Given a list of messages comprising a conversation, the model will + return a response. + - name: Completions + description: Given a prompt, the model will return one or more predicted + completions, and can also return the probabilities of alternative tokens + at each position. + - name: Embeddings + description: Get a vector representation of a given input that can be easily + consumed by machine learning models and algorithms. + - name: Fine-tuning + description: Manage fine-tuning jobs to tailor a model to your specific training data. + - name: Batch + description: Create large batches of API requests to run asynchronously. + - name: Files + description: Files are used to upload documents that can be used with features + like Assistants and Fine-tuning. + - name: Uploads + description: Use Uploads to upload large files in multiple parts. + - name: Images + description: Given a prompt and/or an input image, the model will generate a new image. + - name: Models + description: List and describe the various models available in the API. + - name: Moderations + description: Given text and/or image inputs, classifies if those inputs are + potentially harmful. + - name: Audit Logs + description: List user actions and configuration changes within this organization. +paths: + /assistants: + get: + operationId: listAssistants + tags: + - Assistants + summary: Returns a list of assistants. + parameters: + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ListAssistantsResponse" + x-oaiMeta: + name: List assistants + group: assistants + beta: true + returns: A list of [assistant](/docs/api-reference/assistants/object) objects. + examples: + request: + curl: | + curl "https://api.openai.com/v1/assistants?order=desc&limit=20" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: | + from openai import OpenAI + client = OpenAI() + + my_assistants = client.beta.assistants.list( + order="desc", + limit="20", + ) + print(my_assistants.data) + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myAssistants = await openai.beta.assistants.list({ + order: "desc", + limit: "20", + }); + + console.log(myAssistants.data); + } + + main(); + response: > + { + "object": "list", + "data": [ + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698982736, + "name": "Coding Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc456", + "object": "assistant", + "created_at": 1698982718, + "name": "My Assistant", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc789", + "object": "assistant", + "created_at": 1698982643, + "name": null, + "description": null, + "model": "gpt-4o", + "instructions": null, + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + ], + "first_id": "asst_abc123", + "last_id": "asst_abc789", + "has_more": false + } + post: + operationId: createAssistant + tags: + - Assistants + summary: Create an assistant with a model and instructions. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CreateAssistantRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/AssistantObject" + x-oaiMeta: + name: Create assistant + group: assistants + beta: true + returns: An [assistant](/docs/api-reference/assistants/object) object. + examples: + - title: Code Interpreter + request: + curl: > + curl "https://api.openai.com/v1/assistants" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + "name": "Math Tutor", + "tools": [{"type": "code_interpreter"}], + "model": "gpt-4o" + }' + python: > + from openai import OpenAI + + client = OpenAI() + + + my_assistant = client.beta.assistants.create( + instructions="You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + name="Math Tutor", + tools=[{"type": "code_interpreter"}], + model="gpt-4o", + ) + + print(my_assistant) + node.js: >- + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const myAssistant = await openai.beta.assistants.create({ + instructions: + "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + name: "Math Tutor", + tools: [{ type: "code_interpreter" }], + model: "gpt-4o", + }); + + console.log(myAssistant); + } + + + main(); + response: > + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698984975, + "name": "Math Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + - title: Files + request: + curl: > + curl https://api.openai.com/v1/assistants \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.", + "tools": [{"type": "file_search"}], + "tool_resources": {"file_search": {"vector_store_ids": ["vs_123"]}}, + "model": "gpt-4o" + }' + python: > + from openai import OpenAI + + client = OpenAI() + + + my_assistant = client.beta.assistants.create( + instructions="You are an HR bot, and you have access to files to answer employee questions about company policies.", + name="HR Helper", + tools=[{"type": "file_search"}], + tool_resources={"file_search": {"vector_store_ids": ["vs_123"]}}, + model="gpt-4o" + ) + + print(my_assistant) + node.js: >- + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const myAssistant = await openai.beta.assistants.create({ + instructions: + "You are an HR bot, and you have access to files to answer employee questions about company policies.", + name: "HR Helper", + tools: [{ type: "file_search" }], + tool_resources: { + file_search: { + vector_store_ids: ["vs_123"] + } + }, + model: "gpt-4o" + }); + + console.log(myAssistant); + } + + + main(); + response: > + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1699009403, + "name": "HR Helper", + "description": null, + "model": "gpt-4o", + "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.", + "tools": [ + { + "type": "file_search" + } + ], + "tool_resources": { + "file_search": { + "vector_store_ids": ["vs_123"] + } + }, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + /assistants/{assistant_id}: + get: + operationId: getAssistant + tags: + - Assistants + summary: Retrieves an assistant. + parameters: + - in: path + name: assistant_id + required: true + schema: + type: string + description: The ID of the assistant to retrieve. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/AssistantObject" + x-oaiMeta: + name: Retrieve assistant + group: assistants + beta: true + returns: The [assistant](/docs/api-reference/assistants/object) object matching + the specified ID. + examples: + request: + curl: | + curl https://api.openai.com/v1/assistants/asst_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: | + from openai import OpenAI + client = OpenAI() + + my_assistant = client.beta.assistants.retrieve("asst_abc123") + print(my_assistant) + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myAssistant = await openai.beta.assistants.retrieve( + "asst_abc123" + ); + + console.log(myAssistant); + } + + main(); + response: > + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1699009709, + "name": "HR Helper", + "description": null, + "model": "gpt-4o", + "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.", + "tools": [ + { + "type": "file_search" + } + ], + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + post: + operationId: modifyAssistant + tags: + - Assistants + summary: Modifies an assistant. + parameters: + - in: path + name: assistant_id + required: true + schema: + type: string + description: The ID of the assistant to modify. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ModifyAssistantRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/AssistantObject" + x-oaiMeta: + name: Modify assistant + group: assistants + beta: true + returns: The modified [assistant](/docs/api-reference/assistants/object) object. + examples: + request: + curl: > + curl https://api.openai.com/v1/assistants/asst_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.", + "tools": [{"type": "file_search"}], + "model": "gpt-4o" + }' + python: > + from openai import OpenAI + + client = OpenAI() + + + my_updated_assistant = client.beta.assistants.update( + "asst_abc123", + instructions="You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.", + name="HR Helper", + tools=[{"type": "file_search"}], + model="gpt-4o" + ) + + + print(my_updated_assistant) + node.js: >- + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const myUpdatedAssistant = await openai.beta.assistants.update( + "asst_abc123", + { + instructions: + "You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.", + name: "HR Helper", + tools: [{ type: "file_search" }], + model: "gpt-4o" + } + ); + + console.log(myUpdatedAssistant); + } + + + main(); + response: > + { + "id": "asst_123", + "object": "assistant", + "created_at": 1699009709, + "name": "HR Helper", + "description": null, + "model": "gpt-4o", + "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.", + "tools": [ + { + "type": "file_search" + } + ], + "tool_resources": { + "file_search": { + "vector_store_ids": [] + } + }, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + delete: + operationId: deleteAssistant + tags: + - Assistants + summary: Delete an assistant. + parameters: + - in: path + name: assistant_id + required: true + schema: + type: string + description: The ID of the assistant to delete. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/DeleteAssistantResponse" + x-oaiMeta: + name: Delete assistant + group: assistants + beta: true + returns: Deletion status + examples: + request: + curl: | + curl https://api.openai.com/v1/assistants/asst_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -X DELETE + python: | + from openai import OpenAI + client = OpenAI() + + response = client.beta.assistants.delete("asst_abc123") + print(response) + node.js: >- + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const response = await openai.beta.assistants.del("asst_abc123"); + + console.log(response); + } + + main(); + response: | + { + "id": "asst_abc123", + "object": "assistant.deleted", + "deleted": true + } + /audio/speech: + post: + operationId: createSpeech + tags: + - Audio + summary: Generates audio from the input text. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CreateSpeechRequest" + responses: + "200": + description: OK + headers: + Transfer-Encoding: + schema: + type: string + description: chunked + content: + application/octet-stream: + schema: + type: string + format: binary + x-oaiMeta: + name: Create speech + group: audio + returns: The audio file content. + examples: + request: + curl: | + curl https://api.openai.com/v1/audio/speech \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "model": "tts-1", + "input": "The quick brown fox jumped over the lazy dog.", + "voice": "alloy" + }' \ + --output speech.mp3 + python: | + from pathlib import Path + import openai + + speech_file_path = Path(__file__).parent / "speech.mp3" + response = openai.audio.speech.create( + model="tts-1", + voice="alloy", + input="The quick brown fox jumped over the lazy dog." + ) + response.stream_to_file(speech_file_path) + node: > + import fs from "fs"; + + import path from "path"; + + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + const speechFile = path.resolve("./speech.mp3"); + + + async function main() { + const mp3 = await openai.audio.speech.create({ + model: "tts-1", + voice: "alloy", + input: "Today is a wonderful day to build something people love!", + }); + console.log(speechFile); + const buffer = Buffer.from(await mp3.arrayBuffer()); + await fs.promises.writeFile(speechFile, buffer); + } + + main(); + /audio/transcriptions: + post: + operationId: createTranscription + tags: + - Audio + summary: Transcribes audio into the input language. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/CreateTranscriptionRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/CreateTranscriptionResponseJson" + - $ref: "#/components/schemas/CreateTranscriptionResponseVerboseJson" + x-oaiMeta: + name: Create transcription + group: audio + returns: The [transcription object](/docs/api-reference/audio/json-object) or a + [verbose transcription + object](/docs/api-reference/audio/verbose-json-object). + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/audio.mp3" \ + -F model="whisper-1" + python: | + from openai import OpenAI + client = OpenAI() + + audio_file = open("speech.mp3", "rb") + transcript = client.audio.transcriptions.create( + model="whisper-1", + file=audio_file + ) + node: > + import fs from "fs"; + + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const transcription = await openai.audio.transcriptions.create({ + file: fs.createReadStream("audio.mp3"), + model: "whisper-1", + }); + + console.log(transcription.text); + } + + main(); + response: > + { + "text": "Imagine the wildest idea that you've ever had, and you're curious about how it might scale to something that's a 100, a 1,000 times bigger. This is a place where you can get to do that." + } + - title: Word timestamps + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/audio.mp3" \ + -F "timestamp_granularities[]=word" \ + -F model="whisper-1" \ + -F response_format="verbose_json" + python: | + from openai import OpenAI + client = OpenAI() + + audio_file = open("speech.mp3", "rb") + transcript = client.audio.transcriptions.create( + file=audio_file, + model="whisper-1", + response_format="verbose_json", + timestamp_granularities=["word"] + ) + + print(transcript.words) + node: > + import fs from "fs"; + + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const transcription = await openai.audio.transcriptions.create({ + file: fs.createReadStream("audio.mp3"), + model: "whisper-1", + response_format: "verbose_json", + timestamp_granularities: ["word"] + }); + + console.log(transcription.text); + } + + main(); + response: > + { + "task": "transcribe", + "language": "english", + "duration": 8.470000267028809, + "text": "The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.", + "words": [ + { + "word": "The", + "start": 0.0, + "end": 0.23999999463558197 + }, + ... + { + "word": "volleyball", + "start": 7.400000095367432, + "end": 7.900000095367432 + } + ] + } + - title: Segment timestamps + request: + curl: | + curl https://api.openai.com/v1/audio/transcriptions \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/audio.mp3" \ + -F "timestamp_granularities[]=segment" \ + -F model="whisper-1" \ + -F response_format="verbose_json" + python: | + from openai import OpenAI + client = OpenAI() + + audio_file = open("speech.mp3", "rb") + transcript = client.audio.transcriptions.create( + file=audio_file, + model="whisper-1", + response_format="verbose_json", + timestamp_granularities=["segment"] + ) + + print(transcript.words) + node: > + import fs from "fs"; + + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const transcription = await openai.audio.transcriptions.create({ + file: fs.createReadStream("audio.mp3"), + model: "whisper-1", + response_format: "verbose_json", + timestamp_granularities: ["segment"] + }); + + console.log(transcription.text); + } + + main(); + response: > + { + "task": "transcribe", + "language": "english", + "duration": 8.470000267028809, + "text": "The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.", + "segments": [ + { + "id": 0, + "seek": 0, + "start": 0.0, + "end": 3.319999933242798, + "text": " The beach was a popular spot on a hot summer day.", + "tokens": [ + 50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530 + ], + "temperature": 0.0, + "avg_logprob": -0.2860786020755768, + "compression_ratio": 1.2363636493682861, + "no_speech_prob": 0.00985979475080967 + }, + ... + ] + } + /audio/translations: + post: + operationId: createTranslation + tags: + - Audio + summary: Translates audio into English. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/CreateTranslationRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + oneOf: + - $ref: "#/components/schemas/CreateTranslationResponseJson" + - $ref: "#/components/schemas/CreateTranslationResponseVerboseJson" + x-oaiMeta: + name: Create translation + group: audio + returns: The translated text. + examples: + request: + curl: | + curl https://api.openai.com/v1/audio/translations \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: multipart/form-data" \ + -F file="@/path/to/file/german.m4a" \ + -F model="whisper-1" + python: | + from openai import OpenAI + client = OpenAI() + + audio_file = open("speech.mp3", "rb") + transcript = client.audio.translations.create( + model="whisper-1", + file=audio_file + ) + node: | + import fs from "fs"; + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const translation = await openai.audio.translations.create({ + file: fs.createReadStream("speech.mp3"), + model: "whisper-1", + }); + + console.log(translation.text); + } + main(); + response: > + { + "text": "Hello, my name is Wolfgang and I come from Germany. Where are you heading today?" + } + /batches: + post: + summary: Creates and executes a batch from an uploaded file of requests + operationId: createBatch + tags: + - Batch + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - input_file_id + - endpoint + - completion_window + properties: + input_file_id: + type: string + description: > + The ID of an uploaded file that contains requests for the + new batch. + + + See [upload file](/docs/api-reference/files/create) for how + to upload a file. + + + Your input file must be formatted as a [JSONL + file](/docs/api-reference/batch/request-input), and must be + uploaded with the purpose `batch`. The file can contain up + to 50,000 requests, and can be up to 100 MB in size. + endpoint: + type: string + enum: + - /v1/chat/completions + - /v1/embeddings + - /v1/completions + description: The endpoint to be used for all requests in the batch. Currently + `/v1/chat/completions`, `/v1/embeddings`, and + `/v1/completions` are supported. Note that `/v1/embeddings` + batches are also restricted to a maximum of 50,000 embedding + inputs across all requests in the batch. + completion_window: + type: string + enum: + - 24h + description: The time frame within which the batch should be processed. + Currently only `24h` is supported. + metadata: + type: object + additionalProperties: + type: string + description: Optional custom metadata for the batch. + nullable: true + responses: + "200": + description: Batch created successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/Batch" + x-oaiMeta: + name: Create batch + group: batch + returns: The created [Batch](/docs/api-reference/batch/object) object. + examples: + request: + curl: | + curl https://api.openai.com/v1/batches \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "input_file_id": "file-abc123", + "endpoint": "/v1/chat/completions", + "completion_window": "24h" + }' + python: | + from openai import OpenAI + client = OpenAI() + + client.batches.create( + input_file_id="file-abc123", + endpoint="/v1/chat/completions", + completion_window="24h" + ) + node: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const batch = await openai.batches.create({ + input_file_id: "file-abc123", + endpoint: "/v1/chat/completions", + completion_window: "24h" + }); + + console.log(batch); + } + + main(); + response: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "validating", + "output_file_id": null, + "error_file_id": null, + "created_at": 1711471533, + "in_progress_at": null, + "expires_at": null, + "finalizing_at": null, + "completed_at": null, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 0, + "completed": 0, + "failed": 0 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } + get: + operationId: listBatches + tags: + - Batch + summary: List your organization's batches. + parameters: + - in: query + name: after + required: false + schema: + type: string + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + responses: + "200": + description: Batch listed successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/ListBatchesResponse" + x-oaiMeta: + name: List batch + group: batch + returns: A list of paginated [Batch](/docs/api-reference/batch/object) objects. + examples: + request: + curl: | + curl https://api.openai.com/v1/batches?limit=2 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" + python: | + from openai import OpenAI + client = OpenAI() + + client.batches.list() + node: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.batches.list(); + + for await (const batch of list) { + console.log(batch); + } + } + + main(); + response: | + { + "object": "list", + "data": [ + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-cvaTdG", + "error_file_id": "file-HOWS94", + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": 1711493133, + "completed_at": 1711493163, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 95, + "failed": 5 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly job", + } + }, + { ... }, + ], + "first_id": "batch_abc123", + "last_id": "batch_abc456", + "has_more": true + } + /batches/{batch_id}: + get: + operationId: retrieveBatch + tags: + - Batch + summary: Retrieves a batch. + parameters: + - in: path + name: batch_id + required: true + schema: + type: string + description: The ID of the batch to retrieve. + responses: + "200": + description: Batch retrieved successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/Batch" + x-oaiMeta: + name: Retrieve batch + group: batch + returns: The [Batch](/docs/api-reference/batch/object) object matching the + specified ID. + examples: + request: + curl: | + curl https://api.openai.com/v1/batches/batch_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + python: | + from openai import OpenAI + client = OpenAI() + + client.batches.retrieve("batch_abc123") + node: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const batch = await openai.batches.retrieve("batch_abc123"); + + console.log(batch); + } + + main(); + response: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-cvaTdG", + "error_file_id": "file-HOWS94", + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": 1711493133, + "completed_at": 1711493163, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 95, + "failed": 5 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } + /batches/{batch_id}/cancel: + post: + operationId: cancelBatch + tags: + - Batch + summary: Cancels an in-progress batch. The batch will be in status `cancelling` + for up to 10 minutes, before changing to `cancelled`, where it will have + partial results (if any) available in the output file. + parameters: + - in: path + name: batch_id + required: true + schema: + type: string + description: The ID of the batch to cancel. + responses: + "200": + description: Batch is cancelling. Returns the cancelling batch's details. + content: + application/json: + schema: + $ref: "#/components/schemas/Batch" + x-oaiMeta: + name: Cancel batch + group: batch + returns: The [Batch](/docs/api-reference/batch/object) object matching the + specified ID. + examples: + request: + curl: | + curl https://api.openai.com/v1/batches/batch_abc123/cancel \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -X POST + python: | + from openai import OpenAI + client = OpenAI() + + client.batches.cancel("batch_abc123") + node: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const batch = await openai.batches.cancel("batch_abc123"); + + console.log(batch); + } + + main(); + response: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "cancelling", + "output_file_id": null, + "error_file_id": null, + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": null, + "completed_at": null, + "failed_at": null, + "expired_at": null, + "cancelling_at": 1711475133, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 23, + "failed": 1 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } + /chat/completions: + post: + operationId: createChatCompletion + tags: + - Chat + summary: > + Creates a model response for the given chat conversation. Learn more in + the + + [text generation](/docs/guides/text-generation), + [vision](/docs/guides/vision), + + and [audio](/docs/guides/audio) guides. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CreateChatCompletionRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/CreateChatCompletionResponse" + x-oaiMeta: + name: Create chat completion + group: chat + returns: > + Returns a [chat completion](/docs/api-reference/chat/object) object, + or a streamed sequence of [chat completion + chunk](/docs/api-reference/chat/streaming) objects if the request is + streamed. + path: create + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "VAR_model_id", + "messages": [ + { + "role": "system", + "content": "You are a helpful assistant." + }, + { + "role": "user", + "content": "Hello!" + } + ] + }' + python: > + from openai import OpenAI + + client = OpenAI() + + + completion = client.chat.completions.create( + model="VAR_model_id", + messages=[ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Hello!"} + ] + ) + + + print(completion.choices[0].message) + node.js: >- + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const completion = await openai.chat.completions.create({ + messages: [{ role: "system", content: "You are a helpful assistant." }], + model: "VAR_model_id", + }); + + console.log(completion.choices[0]); + } + + + main(); + response: | + { + "id": "chatcmpl-123", + "object": "chat.completion", + "created": 1677652288, + "model": "gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices": [{ + "index": 0, + "message": { + "role": "assistant", + "content": "\n\nHello there, how may I assist you today?", + }, + "logprobs": null, + "finish_reason": "stop" + }], + "usage": { + "prompt_tokens": 9, + "completion_tokens": 12, + "total_tokens": 21, + "completion_tokens_details": { + "reasoning_tokens": 0 + } + } + } + - title: Image input + request: + curl: > + curl https://api.openai.com/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-4o", + "messages": [ + { + "role": "user", + "content": [ + { + "type": "text", + "text": "What'\''s in this image?" + }, + { + "type": "image_url", + "image_url": { + "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" + } + } + ] + } + ], + "max_tokens": 300 + }' + python: > + from openai import OpenAI + + + client = OpenAI() + + + response = client.chat.completions.create( + model="gpt-4o", + messages=[ + { + "role": "user", + "content": [ + {"type": "text", "text": "What's in this image?"}, + { + "type": "image_url", + "image_url": { + "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg", + } + }, + ], + } + ], + max_tokens=300, + ) + + + print(response.choices[0]) + node.js: >- + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const response = await openai.chat.completions.create({ + model: "gpt-4o", + messages: [ + { + role: "user", + content: [ + { type: "text", text: "What's in this image?" }, + { + type: "image_url", + image_url: { + "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg", + }, + } + ], + }, + ], + }); + console.log(response.choices[0]); + } + + main(); + response: > + { + "id": "chatcmpl-123", + "object": "chat.completion", + "created": 1677652288, + "model": "gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices": [{ + "index": 0, + "message": { + "role": "assistant", + "content": "\n\nThis image shows a wooden boardwalk extending through a lush green marshland.", + }, + "logprobs": null, + "finish_reason": "stop" + }], + "usage": { + "prompt_tokens": 9, + "completion_tokens": 12, + "total_tokens": 21, + "completion_tokens_details": { + "reasoning_tokens": 0 + } + } + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "VAR_model_id", + "messages": [ + { + "role": "system", + "content": "You are a helpful assistant." + }, + { + "role": "user", + "content": "Hello!" + } + ], + "stream": true + }' + python: > + from openai import OpenAI + + client = OpenAI() + + + completion = client.chat.completions.create( + model="VAR_model_id", + messages=[ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Hello!"} + ], + stream=True + ) + + + for chunk in completion: + print(chunk.choices[0].delta) + node.js: >- + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const completion = await openai.chat.completions.create({ + model: "VAR_model_id", + messages: [ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Hello!"} + ], + stream: true, + }); + + for await (const chunk of completion) { + console.log(chunk.choices[0].delta.content); + } + } + + + main(); + response: > + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]} + + + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}]} + + + .... + + + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} + - title: Functions + request: + curl: > + curl https://api.openai.com/v1/chat/completions \ + + -H "Content-Type: application/json" \ + + -H "Authorization: Bearer $OPENAI_API_KEY" \ + + -d '{ + "model": "gpt-4o", + "messages": [ + { + "role": "user", + "content": "What'\''s the weather like in Boston today?" + } + ], + "tools": [ + { + "type": "function", + "function": { + "name": "get_current_weather", + "description": "Get the current weather in a given location", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA" + }, + "unit": { + "type": "string", + "enum": ["celsius", "fahrenheit"] + } + }, + "required": ["location"] + } + } + } + ], + "tool_choice": "auto" + }' + python: > + from openai import OpenAI + + client = OpenAI() + + + tools = [ + { + "type": "function", + "function": { + "name": "get_current_weather", + "description": "Get the current weather in a given location", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", + }, + "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}, + }, + "required": ["location"], + }, + } + } + ] + + messages = [{"role": "user", "content": "What's the weather like + in Boston today?"}] + + completion = client.chat.completions.create( + model="VAR_model_id", + messages=messages, + tools=tools, + tool_choice="auto" + ) + + + print(completion) + node.js: >- + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const messages = [{"role": "user", "content": "What's the weather like in Boston today?"}]; + const tools = [ + { + "type": "function", + "function": { + "name": "get_current_weather", + "description": "Get the current weather in a given location", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", + }, + "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}, + }, + "required": ["location"], + }, + } + } + ]; + + const response = await openai.chat.completions.create({ + model: "gpt-4o", + messages: messages, + tools: tools, + tool_choice: "auto", + }); + + console.log(response); + } + + + main(); + response: | + { + "id": "chatcmpl-abc123", + "object": "chat.completion", + "created": 1699896916, + "model": "gpt-4o-mini", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_abc123", + "type": "function", + "function": { + "name": "get_current_weather", + "arguments": "{\n\"location\": \"Boston, MA\"\n}" + } + } + ] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 82, + "completion_tokens": 17, + "total_tokens": 99, + "completion_tokens_details": { + "reasoning_tokens": 0 + } + } + } + - title: Logprobs + request: + curl: | + curl https://api.openai.com/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "VAR_model_id", + "messages": [ + { + "role": "user", + "content": "Hello!" + } + ], + "logprobs": true, + "top_logprobs": 2 + }' + python: | + from openai import OpenAI + client = OpenAI() + + completion = client.chat.completions.create( + model="VAR_model_id", + messages=[ + {"role": "user", "content": "Hello!"} + ], + logprobs=True, + top_logprobs=2 + ) + + print(completion.choices[0].message) + print(completion.choices[0].logprobs) + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const completion = await openai.chat.completions.create({ + messages: [{ role: "user", content: "Hello!" }], + model: "VAR_model_id", + logprobs: true, + top_logprobs: 2, + }); + + console.log(completion.choices[0]); + } + + main(); + response: | + { + "id": "chatcmpl-123", + "object": "chat.completion", + "created": 1702685778, + "model": "gpt-4o-mini", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "Hello! How can I assist you today?" + }, + "logprobs": { + "content": [ + { + "token": "Hello", + "logprob": -0.31725305, + "bytes": [72, 101, 108, 108, 111], + "top_logprobs": [ + { + "token": "Hello", + "logprob": -0.31725305, + "bytes": [72, 101, 108, 108, 111] + }, + { + "token": "Hi", + "logprob": -1.3190403, + "bytes": [72, 105] + } + ] + }, + { + "token": "!", + "logprob": -0.02380986, + "bytes": [ + 33 + ], + "top_logprobs": [ + { + "token": "!", + "logprob": -0.02380986, + "bytes": [33] + }, + { + "token": " there", + "logprob": -3.787621, + "bytes": [32, 116, 104, 101, 114, 101] + } + ] + }, + { + "token": " How", + "logprob": -0.000054669687, + "bytes": [32, 72, 111, 119], + "top_logprobs": [ + { + "token": " How", + "logprob": -0.000054669687, + "bytes": [32, 72, 111, 119] + }, + { + "token": "<|end|>", + "logprob": -10.953937, + "bytes": null + } + ] + }, + { + "token": " can", + "logprob": -0.015801601, + "bytes": [32, 99, 97, 110], + "top_logprobs": [ + { + "token": " can", + "logprob": -0.015801601, + "bytes": [32, 99, 97, 110] + }, + { + "token": " may", + "logprob": -4.161023, + "bytes": [32, 109, 97, 121] + } + ] + }, + { + "token": " I", + "logprob": -3.7697225e-6, + "bytes": [ + 32, + 73 + ], + "top_logprobs": [ + { + "token": " I", + "logprob": -3.7697225e-6, + "bytes": [32, 73] + }, + { + "token": " assist", + "logprob": -13.596657, + "bytes": [32, 97, 115, 115, 105, 115, 116] + } + ] + }, + { + "token": " assist", + "logprob": -0.04571125, + "bytes": [32, 97, 115, 115, 105, 115, 116], + "top_logprobs": [ + { + "token": " assist", + "logprob": -0.04571125, + "bytes": [32, 97, 115, 115, 105, 115, 116] + }, + { + "token": " help", + "logprob": -3.1089056, + "bytes": [32, 104, 101, 108, 112] + } + ] + }, + { + "token": " you", + "logprob": -5.4385737e-6, + "bytes": [32, 121, 111, 117], + "top_logprobs": [ + { + "token": " you", + "logprob": -5.4385737e-6, + "bytes": [32, 121, 111, 117] + }, + { + "token": " today", + "logprob": -12.807695, + "bytes": [32, 116, 111, 100, 97, 121] + } + ] + }, + { + "token": " today", + "logprob": -0.0040071653, + "bytes": [32, 116, 111, 100, 97, 121], + "top_logprobs": [ + { + "token": " today", + "logprob": -0.0040071653, + "bytes": [32, 116, 111, 100, 97, 121] + }, + { + "token": "?", + "logprob": -5.5247097, + "bytes": [63] + } + ] + }, + { + "token": "?", + "logprob": -0.0008108172, + "bytes": [63], + "top_logprobs": [ + { + "token": "?", + "logprob": -0.0008108172, + "bytes": [63] + }, + { + "token": "?\n", + "logprob": -7.184561, + "bytes": [63, 10] + } + ] + } + ] + }, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 9, + "completion_tokens": 9, + "total_tokens": 18, + "completion_tokens_details": { + "reasoning_tokens": 0 + } + }, + "system_fingerprint": null + } + /completions: + post: + operationId: createCompletion + tags: + - Completions + summary: Creates a completion for the provided prompt and parameters. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CreateCompletionRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/CreateCompletionResponse" + x-oaiMeta: + name: Create completion + group: completions + returns: > + Returns a [completion](/docs/api-reference/completions/object) object, + or a sequence of completion objects if the request is streamed. + legacy: true + examples: + - title: No streaming + request: + curl: | + curl https://api.openai.com/v1/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "VAR_model_id", + "prompt": "Say this is a test", + "max_tokens": 7, + "temperature": 0 + }' + python: | + from openai import OpenAI + client = OpenAI() + + client.completions.create( + model="VAR_model_id", + prompt="Say this is a test", + max_tokens=7, + temperature=0 + ) + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const completion = await openai.completions.create({ + model: "VAR_model_id", + prompt: "Say this is a test.", + max_tokens: 7, + temperature: 0, + }); + + console.log(completion); + } + main(); + response: | + { + "id": "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7", + "object": "text_completion", + "created": 1589478378, + "model": "VAR_model_id", + "system_fingerprint": "fp_44709d6fcb", + "choices": [ + { + "text": "\n\nThis is indeed a test", + "index": 0, + "logprobs": null, + "finish_reason": "length" + } + ], + "usage": { + "prompt_tokens": 5, + "completion_tokens": 7, + "total_tokens": 12 + } + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "VAR_model_id", + "prompt": "Say this is a test", + "max_tokens": 7, + "temperature": 0, + "stream": true + }' + python: | + from openai import OpenAI + client = OpenAI() + + for chunk in client.completions.create( + model="VAR_model_id", + prompt="Say this is a test", + max_tokens=7, + temperature=0, + stream=True + ): + print(chunk.choices[0].text) + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const stream = await openai.completions.create({ + model: "VAR_model_id", + prompt: "Say this is a test.", + stream: true, + }); + + for await (const chunk of stream) { + console.log(chunk.choices[0].text) + } + } + main(); + response: | + { + "id": "cmpl-7iA7iJjj8V2zOkCGvWF2hAkDWBQZe", + "object": "text_completion", + "created": 1690759702, + "choices": [ + { + "text": "This", + "index": 0, + "logprobs": null, + "finish_reason": null + } + ], + "model": "gpt-3.5-turbo-instruct" + "system_fingerprint": "fp_44709d6fcb", + } + /embeddings: + post: + operationId: createEmbedding + tags: + - Embeddings + summary: Creates an embedding vector representing the input text. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CreateEmbeddingRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/CreateEmbeddingResponse" + x-oaiMeta: + name: Create embeddings + group: embeddings + returns: A list of [embedding](/docs/api-reference/embeddings/object) objects. + examples: + request: + curl: | + curl https://api.openai.com/v1/embeddings \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "input": "The food was delicious and the waiter...", + "model": "text-embedding-ada-002", + "encoding_format": "float" + }' + python: | + from openai import OpenAI + client = OpenAI() + + client.embeddings.create( + model="text-embedding-ada-002", + input="The food was delicious and the waiter...", + encoding_format="float" + ) + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const embedding = await openai.embeddings.create({ + model: "text-embedding-ada-002", + input: "The quick brown fox jumped over the lazy dog", + encoding_format: "float", + }); + + console.log(embedding); + } + + main(); + response: | + { + "object": "list", + "data": [ + { + "object": "embedding", + "embedding": [ + 0.0023064255, + -0.009327292, + .... (1536 floats total for ada-002) + -0.0028842222, + ], + "index": 0 + } + ], + "model": "text-embedding-ada-002", + "usage": { + "prompt_tokens": 8, + "total_tokens": 8 + } + } + /files: + get: + operationId: listFiles + tags: + - Files + summary: Returns a list of files that belong to the user's organization. + parameters: + - in: query + name: purpose + required: false + schema: + type: string + description: Only return files with the given purpose. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ListFilesResponse" + x-oaiMeta: + name: List files + group: files + returns: A list of [File](/docs/api-reference/files/object) objects. + examples: + request: + curl: | + curl https://api.openai.com/v1/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: | + from openai import OpenAI + client = OpenAI() + + client.files.list() + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.files.list(); + + for await (const file of list) { + console.log(file); + } + } + + main(); + response: | + { + "data": [ + { + "id": "file-abc123", + "object": "file", + "bytes": 175, + "created_at": 1613677385, + "filename": "salesOverview.pdf", + "purpose": "assistants", + }, + { + "id": "file-abc123", + "object": "file", + "bytes": 140, + "created_at": 1613779121, + "filename": "puppy.jsonl", + "purpose": "fine-tune", + } + ], + "object": "list" + } + post: + operationId: createFile + tags: + - Files + summary: > + Upload a file that can be used across various endpoints. Individual + files can be up to 512 MB, and the size of all files uploaded by one + organization can be up to 100 GB. + + + The Assistants API supports files up to 2 million tokens and of specific + file types. See the [Assistants Tools guide](/docs/assistants/tools) for + details. + + + The Fine-tuning API only supports `.jsonl` files. The input also has + certain required formats for fine-tuning + [chat](/docs/api-reference/fine-tuning/chat-input) or + [completions](/docs/api-reference/fine-tuning/completions-input) models. + + + The Batch API only supports `.jsonl` files up to 100 MB in size. The + input also has a specific required + [format](/docs/api-reference/batch/request-input). + + + Please [contact us](https://help.openai.com/) if you need to increase + these storage limits. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/CreateFileRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/OpenAIFile" + x-oaiMeta: + name: Upload file + group: files + returns: The uploaded [File](/docs/api-reference/files/object) object. + examples: + request: + curl: | + curl https://api.openai.com/v1/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -F purpose="fine-tune" \ + -F file="@mydata.jsonl" + python: | + from openai import OpenAI + client = OpenAI() + + client.files.create( + file=open("mydata.jsonl", "rb"), + purpose="fine-tune" + ) + node.js: |- + import fs from "fs"; + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const file = await openai.files.create({ + file: fs.createReadStream("mydata.jsonl"), + purpose: "fine-tune", + }); + + console.log(file); + } + + main(); + response: | + { + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "filename": "mydata.jsonl", + "purpose": "fine-tune", + } + /files/{file_id}: + delete: + operationId: deleteFile + tags: + - Files + summary: Delete a file. + parameters: + - in: path + name: file_id + required: true + schema: + type: string + description: The ID of the file to use for this request. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/DeleteFileResponse" + x-oaiMeta: + name: Delete file + group: files + returns: Deletion status. + examples: + request: + curl: | + curl https://api.openai.com/v1/files/file-abc123 \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: | + from openai import OpenAI + client = OpenAI() + + client.files.delete("file-abc123") + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const file = await openai.files.del("file-abc123"); + + console.log(file); + } + + main(); + response: | + { + "id": "file-abc123", + "object": "file", + "deleted": true + } + get: + operationId: retrieveFile + tags: + - Files + summary: Returns information about a specific file. + parameters: + - in: path + name: file_id + required: true + schema: + type: string + description: The ID of the file to use for this request. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/OpenAIFile" + x-oaiMeta: + name: Retrieve file + group: files + returns: The [File](/docs/api-reference/files/object) object matching the + specified ID. + examples: + request: + curl: | + curl https://api.openai.com/v1/files/file-abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: | + from openai import OpenAI + client = OpenAI() + + client.files.retrieve("file-abc123") + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const file = await openai.files.retrieve("file-abc123"); + + console.log(file); + } + + main(); + response: | + { + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "filename": "mydata.jsonl", + "purpose": "fine-tune", + } + /files/{file_id}/content: + get: + operationId: downloadFile + tags: + - Files + summary: Returns the contents of the specified file. + parameters: + - in: path + name: file_id + required: true + schema: + type: string + description: The ID of the file to use for this request. + responses: + "200": + description: OK + content: + application/json: + schema: + type: string + x-oaiMeta: + name: Retrieve file content + group: files + returns: The file content. + examples: + request: + curl: | + curl https://api.openai.com/v1/files/file-abc123/content \ + -H "Authorization: Bearer $OPENAI_API_KEY" > file.jsonl + python: | + from openai import OpenAI + client = OpenAI() + + content = client.files.content("file-abc123") + node.js: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const file = await openai.files.content("file-abc123"); + + console.log(file); + } + + main(); + /fine_tuning/jobs: + post: + operationId: createFineTuningJob + tags: + - Fine-tuning + summary: > + Creates a fine-tuning job which begins the process of creating a new + model from a given dataset. + + + Response includes details of the enqueued job including job status and + the name of the fine-tuned models once complete. + + + [Learn more about fine-tuning](/docs/guides/fine-tuning) + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CreateFineTuningJobRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/FineTuningJob" + x-oaiMeta: + name: Create fine-tuning job + group: fine-tuning + returns: A [fine-tuning.job](/docs/api-reference/fine-tuning/object) object. + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-BK7bzQj3FfZFXr7DbL6xJwfo", + "model": "gpt-4o-mini" + }' + python: | + from openai import OpenAI + client = OpenAI() + + client.fine_tuning.jobs.create( + training_file="file-abc123", + model="gpt-4o-mini" + ) + node.js: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.create({ + training_file: "file-abc123" + }); + + console.log(fineTune); + } + + main(); + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": null, + "training_file": "file-abc123", + } + - title: Epochs + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc123", + "model": "gpt-4o-mini", + "hyperparameters": { + "n_epochs": 2 + } + }' + python: | + from openai import OpenAI + client = OpenAI() + + client.fine_tuning.jobs.create( + training_file="file-abc123", + model="gpt-4o-mini", + hyperparameters={ + "n_epochs":2 + } + ) + node.js: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.create({ + training_file: "file-abc123", + model: "gpt-4o-mini", + hyperparameters: { n_epochs: 2 } + }); + + console.log(fineTune); + } + + main(); + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": null, + "training_file": "file-abc123", + "hyperparameters": {"n_epochs": 2}, + } + - title: Validation file + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc123", + "validation_file": "file-abc123", + "model": "gpt-4o-mini" + }' + python: | + from openai import OpenAI + client = OpenAI() + + client.fine_tuning.jobs.create( + training_file="file-abc123", + validation_file="file-def456", + model="gpt-4o-mini" + ) + node.js: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const fineTune = await openai.fineTuning.jobs.create({ + training_file: "file-abc123", + validation_file: "file-abc123" + }); + + console.log(fineTune); + } + + main(); + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": "file-abc123", + "training_file": "file-abc123", + } + - title: W&B Integration + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "training_file": "file-abc123", + "validation_file": "file-abc123", + "model": "gpt-4o-mini", + "integrations": [ + { + "type": "wandb", + "wandb": { + "project": "my-wandb-project", + "name": "ft-run-display-name" + "tags": [ + "first-experiment", "v2" + ] + } + } + ] + }' + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "status": "queued", + "validation_file": "file-abc123", + "training_file": "file-abc123", + "integrations": [ + { + "type": "wandb", + "wandb": { + "project": "my-wandb-project", + "entity": None, + "run_id": "ftjob-abc123" + } + } + ] + } + get: + operationId: listPaginatedFineTuningJobs + tags: + - Fine-tuning + summary: | + List your organization's fine-tuning jobs + parameters: + - name: after + in: query + description: Identifier for the last job from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: Number of fine-tuning jobs to retrieve. + required: false + schema: + type: integer + default: 20 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ListPaginatedFineTuningJobsResponse" + x-oaiMeta: + name: List fine-tuning jobs + group: fine-tuning + returns: A list of paginated [fine-tuning + job](/docs/api-reference/fine-tuning/object) objects. + examples: + request: + curl: | + curl https://api.openai.com/v1/fine_tuning/jobs?limit=2 \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: | + from openai import OpenAI + client = OpenAI() + + client.fine_tuning.jobs.list() + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.fineTuning.jobs.list(); + + for await (const fineTune of list) { + console.log(fineTune); + } + } + + main(); + response: > + { + "object": "list", + "data": [ + { + "object": "fine_tuning.job.event", + "id": "ft-event-TjX0lMfOniCZX64t9PUQT5hn", + "created_at": 1689813489, + "level": "warn", + "message": "Fine tuning process stopping due to job cancellation", + "data": null, + "type": "message" + }, + { ... }, + { ... } + ], "has_more": true + } + /fine_tuning/jobs/{fine_tuning_job_id}: + get: + operationId: retrieveFineTuningJob + tags: + - Fine-tuning + summary: | + Get info about a fine-tuning job. + + [Learn more about fine-tuning](/docs/guides/fine-tuning) + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/FineTuningJob" + x-oaiMeta: + name: Retrieve fine-tuning job + group: fine-tuning + returns: The [fine-tuning](/docs/api-reference/fine-tuning/object) object with + the given ID. + examples: + request: + curl: > + curl + https://api.openai.com/v1/fine_tuning/jobs/ft-AF1WoRqd3aJAHsqc9NY7iL8F + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: | + from openai import OpenAI + client = OpenAI() + + client.fine_tuning.jobs.retrieve("ftjob-abc123") + node.js: > + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const fineTune = await openai.fineTuning.jobs.retrieve("ftjob-abc123"); + + console.log(fineTune); + } + + + main(); + response: > + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "davinci-002", + "created_at": 1692661014, + "finished_at": 1692661190, + "fine_tuned_model": "ft:davinci-002:my-org:custom_suffix:7q8mpxmy", + "organization_id": "org-123", + "result_files": [ + "file-abc123" + ], + "status": "succeeded", + "validation_file": null, + "training_file": "file-abc123", + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + }, + "trained_tokens": 5768, + "integrations": [], + "seed": 0, + "estimated_finish": 0 + } + /fine_tuning/jobs/{fine_tuning_job_id}/cancel: + post: + operationId: cancelFineTuningJob + tags: + - Fine-tuning + summary: | + Immediately cancel a fine-tune job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to cancel. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/FineTuningJob" + x-oaiMeta: + name: Cancel fine-tuning + group: fine-tuning + returns: The cancelled [fine-tuning](/docs/api-reference/fine-tuning/object) + object. + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/cancel \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: | + from openai import OpenAI + client = OpenAI() + + client.fine_tuning.jobs.cancel("ftjob-abc123") + node.js: >- + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const fineTune = await openai.fineTuning.jobs.cancel("ftjob-abc123"); + + console.log(fineTune); + } + + main(); + response: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "gpt-4o-mini-2024-07-18", + "created_at": 1721764800, + "fine_tuned_model": null, + "organization_id": "org-123", + "result_files": [], + "hyperparameters": { + "n_epochs": "auto" + }, + "status": "cancelled", + "validation_file": "file-abc123", + "training_file": "file-abc123" + } + /fine_tuning/jobs/{fine_tuning_job_id}/checkpoints: + get: + operationId: listFineTuningJobCheckpoints + tags: + - Fine-tuning + summary: | + List checkpoints for a fine-tuning job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to get checkpoints for. + - name: after + in: query + description: Identifier for the last checkpoint ID from the previous pagination + request. + required: false + schema: + type: string + - name: limit + in: query + description: Number of checkpoints to retrieve. + required: false + schema: + type: integer + default: 10 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ListFineTuningJobCheckpointsResponse" + x-oaiMeta: + name: List fine-tuning checkpoints + group: fine-tuning + returns: A list of fine-tuning [checkpoint + objects](/docs/api-reference/fine-tuning/checkpoint-object) for a + fine-tuning job. + examples: + request: + curl: > + curl + https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/checkpoints + \ + -H "Authorization: Bearer $OPENAI_API_KEY" + response: > + { + "object": "list" + "data": [ + { + "object": "fine_tuning.job.checkpoint", + "id": "ftckpt_zc4Q7MP6XxulcVzj4MZdwsAB", + "created_at": 1721764867, + "fine_tuned_model_checkpoint": "ft:gpt-4o-mini-2024-07-18:my-org:custom-suffix:96olL566:ckpt-step-2000", + "metrics": { + "full_valid_loss": 0.134, + "full_valid_mean_token_accuracy": 0.874 + }, + "fine_tuning_job_id": "ftjob-abc123", + "step_number": 2000, + }, + { + "object": "fine_tuning.job.checkpoint", + "id": "ftckpt_enQCFmOTGj3syEpYVhBRLTSy", + "created_at": 1721764800, + "fine_tuned_model_checkpoint": "ft:gpt-4o-mini-2024-07-18:my-org:custom-suffix:7q8mpxmy:ckpt-step-1000", + "metrics": { + "full_valid_loss": 0.167, + "full_valid_mean_token_accuracy": 0.781 + }, + "fine_tuning_job_id": "ftjob-abc123", + "step_number": 1000, + }, + ], + "first_id": "ftckpt_zc4Q7MP6XxulcVzj4MZdwsAB", + "last_id": "ftckpt_enQCFmOTGj3syEpYVhBRLTSy", + "has_more": true + } + /fine_tuning/jobs/{fine_tuning_job_id}/events: + get: + operationId: listFineTuningEvents + tags: + - Fine-tuning + summary: | + Get status updates for a fine-tuning job. + parameters: + - in: path + name: fine_tuning_job_id + required: true + schema: + type: string + example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + description: | + The ID of the fine-tuning job to get events for. + - name: after + in: query + description: Identifier for the last event from the previous pagination request. + required: false + schema: + type: string + - name: limit + in: query + description: Number of events to retrieve. + required: false + schema: + type: integer + default: 20 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ListFineTuningJobEventsResponse" + x-oaiMeta: + name: List fine-tuning events + group: fine-tuning + returns: A list of fine-tuning event objects. + examples: + request: + curl: > + curl + https://api.openai.com/v1/fine_tuning/jobs/ftjob-abc123/events \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: | + from openai import OpenAI + client = OpenAI() + + client.fine_tuning.jobs.list_events( + fine_tuning_job_id="ftjob-abc123", + limit=2 + ) + node.js: >- + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const list = await openai.fineTuning.list_events(id="ftjob-abc123", limit=2); + + for await (const fineTune of list) { + console.log(fineTune); + } + } + + + main(); + response: > + { + "object": "list", + "data": [ + { + "object": "fine_tuning.job.event", + "id": "ft-event-ddTJfwuMVpfLXseO0Am0Gqjm", + "created_at": 1721764800, + "level": "info", + "message": "Fine tuning job successfully completed", + "data": null, + "type": "message" + }, + { + "object": "fine_tuning.job.event", + "id": "ft-event-tyiGuB72evQncpH87xe505Sv", + "created_at": 1721764800, + "level": "info", + "message": "New fine-tuned model created: ft:gpt-4o-mini:openai::7p4lURel", + "data": null, + "type": "message" + } + ], + "has_more": true + } + /images/edits: + post: + operationId: createImageEdit + tags: + - Images + summary: Creates an edited or extended image given an original image and a prompt. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/CreateImageEditRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ImagesResponse" + x-oaiMeta: + name: Create image edit + group: images + returns: Returns a list of [image](/docs/api-reference/images/object) objects. + examples: + request: + curl: | + curl https://api.openai.com/v1/images/edits \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -F image="@otter.png" \ + -F mask="@mask.png" \ + -F prompt="A cute baby sea otter wearing a beret" \ + -F n=2 \ + -F size="1024x1024" + python: | + from openai import OpenAI + client = OpenAI() + + client.images.edit( + image=open("otter.png", "rb"), + mask=open("mask.png", "rb"), + prompt="A cute baby sea otter wearing a beret", + n=2, + size="1024x1024" + ) + node.js: |- + import fs from "fs"; + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const image = await openai.images.edit({ + image: fs.createReadStream("otter.png"), + mask: fs.createReadStream("mask.png"), + prompt: "A cute baby sea otter wearing a beret", + }); + + console.log(image.data); + } + main(); + response: | + { + "created": 1589478378, + "data": [ + { + "url": "https://..." + }, + { + "url": "https://..." + } + ] + } + /images/generations: + post: + operationId: createImage + tags: + - Images + summary: Creates an image given a prompt. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CreateImageRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ImagesResponse" + x-oaiMeta: + name: Create image + group: images + returns: Returns a list of [image](/docs/api-reference/images/object) objects. + examples: + request: + curl: | + curl https://api.openai.com/v1/images/generations \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "dall-e-3", + "prompt": "A cute baby sea otter", + "n": 1, + "size": "1024x1024" + }' + python: | + from openai import OpenAI + client = OpenAI() + + client.images.generate( + model="dall-e-3", + prompt="A cute baby sea otter", + n=1, + size="1024x1024" + ) + node.js: >- + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const image = await openai.images.generate({ model: "dall-e-3", prompt: "A cute baby sea otter" }); + + console.log(image.data); + } + + main(); + response: | + { + "created": 1589478378, + "data": [ + { + "url": "https://..." + }, + { + "url": "https://..." + } + ] + } + /images/variations: + post: + operationId: createImageVariation + tags: + - Images + summary: Creates a variation of a given image. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/CreateImageVariationRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ImagesResponse" + x-oaiMeta: + name: Create image variation + group: images + returns: Returns a list of [image](/docs/api-reference/images/object) objects. + examples: + request: + curl: | + curl https://api.openai.com/v1/images/variations \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -F image="@otter.png" \ + -F n=2 \ + -F size="1024x1024" + python: | + from openai import OpenAI + client = OpenAI() + + response = client.images.create_variation( + image=open("image_edit_original.png", "rb"), + n=2, + size="1024x1024" + ) + node.js: |- + import fs from "fs"; + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const image = await openai.images.createVariation({ + image: fs.createReadStream("otter.png"), + }); + + console.log(image.data); + } + main(); + response: | + { + "created": 1589478378, + "data": [ + { + "url": "https://..." + }, + { + "url": "https://..." + } + ] + } + /models: + get: + operationId: listModels + tags: + - Models + summary: Lists the currently available models, and provides basic information + about each one such as the owner and availability. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ListModelsResponse" + x-oaiMeta: + name: List models + group: models + returns: A list of [model](/docs/api-reference/models/object) objects. + examples: + request: + curl: | + curl https://api.openai.com/v1/models \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: | + from openai import OpenAI + client = OpenAI() + + client.models.list() + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const list = await openai.models.list(); + + for await (const model of list) { + console.log(model); + } + } + main(); + response: | + { + "object": "list", + "data": [ + { + "id": "model-id-0", + "object": "model", + "created": 1686935002, + "owned_by": "organization-owner" + }, + { + "id": "model-id-1", + "object": "model", + "created": 1686935002, + "owned_by": "organization-owner", + }, + { + "id": "model-id-2", + "object": "model", + "created": 1686935002, + "owned_by": "openai" + }, + ], + "object": "list" + } + /models/{model}: + get: + operationId: retrieveModel + tags: + - Models + summary: Retrieves a model instance, providing basic information about the model + such as the owner and permissioning. + parameters: + - in: path + name: model + required: true + schema: + type: string + example: gpt-4o-mini + description: The ID of the model to use for this request + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Model" + x-oaiMeta: + name: Retrieve model + group: models + returns: The [model](/docs/api-reference/models/object) object matching the + specified ID. + examples: + request: + curl: | + curl https://api.openai.com/v1/models/VAR_model_id \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: | + from openai import OpenAI + client = OpenAI() + + client.models.retrieve("VAR_model_id") + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const model = await openai.models.retrieve("VAR_model_id"); + + console.log(model); + } + + main(); + response: | + { + "id": "VAR_model_id", + "object": "model", + "created": 1686935002, + "owned_by": "openai" + } + delete: + operationId: deleteModel + tags: + - Models + summary: Delete a fine-tuned model. You must have the Owner role in your + organization to delete a model. + parameters: + - in: path + name: model + required: true + schema: + type: string + example: ft:gpt-4o-mini:acemeco:suffix:abc123 + description: The model to delete + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/DeleteModelResponse" + x-oaiMeta: + name: Delete a fine-tuned model + group: models + returns: Deletion status. + examples: + request: + curl: > + curl + https://api.openai.com/v1/models/ft:gpt-4o-mini:acemeco:suffix:abc123 + \ + -X DELETE \ + -H "Authorization: Bearer $OPENAI_API_KEY" + python: | + from openai import OpenAI + client = OpenAI() + + client.models.delete("ft:gpt-4o-mini:acemeco:suffix:abc123") + node.js: >- + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const model = await openai.models.del("ft:gpt-4o-mini:acemeco:suffix:abc123"); + + console.log(model); + } + + main(); + response: | + { + "id": "ft:gpt-4o-mini:acemeco:suffix:abc123", + "object": "model", + "deleted": true + } + /moderations: + post: + operationId: createModeration + tags: + - Moderations + summary: | + Classifies if text and/or image inputs are potentially harmful. Learn + more in the [moderation guide](/docs/guides/moderation). + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CreateModerationRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/CreateModerationResponse" + x-oaiMeta: + name: Create moderation + group: moderations + returns: A [moderation](/docs/api-reference/moderations/object) object. + examples: + - title: Single string + request: + curl: | + curl https://api.openai.com/v1/moderations \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "input": "I want to kill them." + }' + python: > + from openai import OpenAI + + client = OpenAI() + + + moderation = client.moderations.create(input="I want to kill + them.") + + print(moderation) + node.js: > + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const moderation = await openai.moderations.create({ input: "I want to kill them." }); + + console.log(moderation); + } + + main(); + response: | + { + "id": "modr-AB8CjOTu2jiq12hp1AQPfeqFWaORR", + "model": "text-moderation-007", + "results": [ + { + "flagged": true, + "categories": { + "sexual": false, + "hate": false, + "harassment": true, + "self-harm": false, + "sexual/minors": false, + "hate/threatening": false, + "violence/graphic": false, + "self-harm/intent": false, + "self-harm/instructions": false, + "harassment/threatening": true, + "violence": true + }, + "category_scores": { + "sexual": 0.000011726012417057063, + "hate": 0.22706663608551025, + "harassment": 0.5215635299682617, + "self-harm": 2.227119921371923e-6, + "sexual/minors": 7.107352217872176e-8, + "hate/threatening": 0.023547329008579254, + "violence/graphic": 0.00003391829886822961, + "self-harm/intent": 1.646940972932498e-6, + "self-harm/instructions": 1.1198755256458526e-9, + "harassment/threatening": 0.5694745779037476, + "violence": 0.9971134662628174 + } + } + ] + } + - title: Image and text + request: + curl: > + curl https://api.openai.com/v1/moderations \ + -X POST \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "omni-moderation-latest", + "input": [ + { "type": "text", "text": "...text to classify goes here..." }, + { + "type": "image_url", + "image_url": { + "url": "https://example.com/image.png" + } + } + ] + }' + python: > + from openai import OpenAI + + client = OpenAI() + + + response = client.moderations.create( + model="omni-moderation-latest", + input=[ + {"type": "text", "text": "...text to classify goes here..."}, + { + "type": "image_url", + "image_url": { + "url": "https://example.com/image.png", + # can also use base64 encoded image URLs + # "url": "data:image/jpeg;base64,abcdefg..." + } + }, + ], + ) + + + print(response) + node.js: > + import OpenAI from "openai"; + + const openai = new OpenAI(); + + + const moderation = await openai.moderations.create({ + model: "omni-moderation-latest", + input: [ + { type: "text", text: "...text to classify goes here..." }, + { + type: "image_url", + image_url: { + url: "https://example.com/image.png" + // can also use base64 encoded image URLs + // url: "data:image/jpeg;base64,abcdefg..." + } + } + ], + }); + + + console.log(moderation); + response: | + { + "id": "modr-0d9740456c391e43c445bf0f010940c7", + "model": "omni-moderation-latest", + "results": [ + { + "flagged": true, + "categories": { + "harassment": true, + "harassment/threatening": true, + "sexual": false, + "hate": false, + "hate/threatening": false, + "illicit": false, + "illicit/violent": false, + "self-harm/intent": false, + "self-harm/instructions": false, + "self-harm": false, + "sexual/minors": false, + "violence": true, + "violence/graphic": true + }, + "category_scores": { + "harassment": 0.8189693396524255, + "harassment/threatening": 0.804985420696006, + "sexual": 1.573112165348997e-6, + "hate": 0.007562942636942845, + "hate/threatening": 0.004208854591835476, + "illicit": 0.030535955153511665, + "illicit/violent": 0.008925306722380033, + "self-harm/intent": 0.00023023930975076432, + "self-harm/instructions": 0.0002293869201073356, + "self-harm": 0.012598046106750154, + "sexual/minors": 2.212566909570261e-8, + "violence": 0.9999992735124786, + "violence/graphic": 0.843064871157054 + }, + "category_applied_input_types": { + "harassment": [ + "text" + ], + "harassment/threatening": [ + "text" + ], + "sexual": [ + "text", + "image" + ], + "hate": [ + "text" + ], + "hate/threatening": [ + "text" + ], + "illicit": [ + "text" + ], + "illicit/violent": [ + "text" + ], + "self-harm/intent": [ + "text", + "image" + ], + "self-harm/instructions": [ + "text", + "image" + ], + "self-harm": [ + "text", + "image" + ], + "sexual/minors": [ + "text" + ], + "violence": [ + "text", + "image" + ], + "violence/graphic": [ + "text", + "image" + ] + } + } + ] + } + /organization/audit_logs: + get: + summary: List user actions and configuration changes within this organization. + operationId: list-audit-logs + tags: + - Audit Logs + parameters: + - name: effective_at + in: query + description: Return only events whose `effective_at` (Unix seconds) is in this + range. + required: false + schema: + type: object + properties: + gt: + type: integer + description: Return only events whose `effective_at` (Unix seconds) is greater + than this value. + gte: + type: integer + description: Return only events whose `effective_at` (Unix seconds) is greater + than or equal to this value. + lt: + type: integer + description: Return only events whose `effective_at` (Unix seconds) is less than + this value. + lte: + type: integer + description: Return only events whose `effective_at` (Unix seconds) is less than + or equal to this value. + - name: project_ids[] + in: query + description: Return only events for these projects. + required: false + schema: + type: array + items: + type: string + - name: event_types[] + in: query + description: Return only events with a `type` in one of these values. For + example, `project.created`. For all options, see the documentation + for the [audit log object](/docs/api-reference/audit-logs/object). + required: false + schema: + type: array + items: + $ref: "#/components/schemas/AuditLogEventType" + - name: actor_ids[] + in: query + description: Return only events performed by these actors. Can be a user ID, a + service account ID, or an api key tracking ID. + required: false + schema: + type: array + items: + type: string + - name: actor_emails[] + in: query + description: Return only events performed by users with these emails. + required: false + schema: + type: array + items: + type: string + - name: resource_ids[] + in: query + description: Return only events performed on these targets. For example, a + project ID updated. + required: false + schema: + type: array + items: + type: string + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + responses: + "200": + description: Audit logs listed successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/ListAuditLogsResponse" + x-oaiMeta: + name: List audit logs + group: audit-logs + returns: A list of paginated [Audit Log](/docs/api-reference/audit-logs/object) + objects. + examples: + request: + curl: | + curl https://api.openai.com/v1/organization/audit_logs \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + response: > + { + "object": "list", + "data": [ + { + "id": "audit_log-xxx_yyyymmdd", + "type": "project.archived", + "effective_at": 1722461446, + "actor": { + "type": "api_key", + "api_key": { + "type": "user", + "user": { + "id": "user-xxx", + "email": "user@example.com" + } + } + }, + "project.archived": { + "id": "proj_abc" + }, + }, + { + "id": "audit_log-yyy__20240101", + "type": "api_key.updated", + "effective_at": 1720804190, + "actor": { + "type": "session", + "session": { + "user": { + "id": "user-xxx", + "email": "user@example.com" + }, + "ip_address": "127.0.0.1", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" + } + }, + "api_key.updated": { + "id": "key_xxxx", + "data": { + "scopes": ["resource_2.operation_2"] + } + }, + } + ], + "first_id": "audit_log-xxx__20240101", + "last_id": "audit_log_yyy__20240101", + "has_more": true + } + /organization/invites: + get: + summary: Returns a list of invites in the organization. + operationId: list-invites + tags: + - Invites + parameters: + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + required: false + schema: + type: string + responses: + "200": + description: Invites listed successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/InviteListResponse" + x-oaiMeta: + name: List invites + group: administration + returns: A list of [Invite](/docs/api-reference/invite/object) objects. + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/invites?after=invite-abc&limit=20 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: + content: | + { + "object": "list", + "data": [ + { + "object": "organization.invite", + "id": "invite-abc", + "email": "user@example.com", + "role": "owner", + "status": "accepted", + "invited_at": 1711471533, + "expires_at": 1711471533, + "accepted_at": 1711471533 + } + ], + "first_id": "invite-abc", + "last_id": "invite-abc", + "has_more": false + } + post: + summary: Create an invite for a user to the organization. The invite must be + accepted by the user before they have access to the organization. + operationId: inviteUser + tags: + - Invites + requestBody: + description: The invite request payload. + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/InviteRequest" + responses: + "200": + description: User invited successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/Invite" + x-oaiMeta: + name: Create invite + group: administration + returns: The created [Invite](/docs/api-reference/invite/object) object. + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/organization/invites \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "email": "user@example.com", + "role": "owner" + }' + response: + content: | + { + "object": "organization.invite", + "id": "invite-abc", + "email": "user@example.com", + "role": "owner", + "invited_at": 1711471533, + "expires_at": 1711471533, + "accepted_at": null + } + /organization/invites/{invite_id}: + get: + summary: Retrieves an invite. + operationId: retrieve-invite + tags: + - Invites + parameters: + - in: path + name: invite_id + required: true + schema: + type: string + description: The ID of the invite to retrieve. + responses: + "200": + description: Invite retrieved successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/Invite" + x-oaiMeta: + name: Retrieve invite + group: administration + returns: The [Invite](/docs/api-reference/invite/object) object matching the + specified ID. + examples: + request: + curl: | + curl https://api.openai.com/v1/organization/invites/invite-abc \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: + content: | + { + "object": "organization.invite", + "id": "invite-abc", + "email": "user@example.com", + "role": "owner", + "status": "accepted", + "invited_at": 1711471533, + "expires_at": 1711471533, + "accepted_at": 1711471533 + } + delete: + summary: Delete an invite. If the invite has already been accepted, it cannot be + deleted. + operationId: delete-invite + tags: + - Invites + parameters: + - in: path + name: invite_id + required: true + schema: + type: string + description: The ID of the invite to delete. + responses: + "200": + description: Invite deleted successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/InviteDeleteResponse" + x-oaiMeta: + name: Delete invite + group: administration + returns: Confirmation that the invite has been deleted + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/invites/invite-abc \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: + content: | + { + "object": "organization.invite.deleted", + "id": "invite-abc", + "deleted": true + } + /organization/projects: + get: + summary: Returns a list of projects. + operationId: list-projects + tags: + - Projects + parameters: + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + required: false + schema: + type: string + - name: include_archived + in: query + schema: + type: boolean + default: false + description: If `true` returns all projects including those that have been + `archived`. Archived projects are not included by default. + responses: + "200": + description: Projects listed successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectListResponse" + x-oaiMeta: + name: List projects + group: administration + returns: A list of [Project](/docs/api-reference/projects/object) objects. + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/projects?after=proj_abc&limit=20&include_archived=false + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: + content: | + { + "object": "list", + "data": [ + { + "id": "proj_abc", + "object": "organization.project", + "name": "Project example", + "created_at": 1711471533, + "archived_at": null, + "status": "active" + } + ], + "first_id": "proj-abc", + "last_id": "proj-xyz", + "has_more": false + } + post: + summary: Create a new project in the organization. Projects can be created and + archived, but cannot be deleted. + operationId: create-project + tags: + - Projects + requestBody: + description: The project create request payload. + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectCreateRequest" + responses: + "200": + description: Project created successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/Project" + x-oaiMeta: + name: Create project + group: administration + returns: The created [Project](/docs/api-reference/projects/object) object. + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/organization/projects \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Project ABC" + }' + response: + content: | + { + "id": "proj_abc", + "object": "organization.project", + "name": "Project ABC", + "created_at": 1711471533, + "archived_at": null, + "status": "active" + } + /organization/projects/{project_id}: + get: + summary: Retrieves a project. + operationId: retrieve-project + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + responses: + "200": + description: Project retrieved successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/Project" + x-oaiMeta: + name: Retrieve project + group: administration + description: Retrieve a project. + returns: The [Project](/docs/api-reference/projects/object) object matching the + specified ID. + examples: + request: + curl: | + curl https://api.openai.com/v1/organization/projects/proj_abc \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: + content: | + { + "id": "proj_abc", + "object": "organization.project", + "name": "Project example", + "created_at": 1711471533, + "archived_at": null, + "status": "active" + } + post: + summary: Modifies a project in the organization. + operationId: modify-project + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + requestBody: + description: The project update request payload. + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectUpdateRequest" + responses: + "200": + description: Project updated successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/Project" + "400": + description: Error response when updating the default project. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + x-oaiMeta: + name: Modify project + group: administration + returns: The updated [Project](/docs/api-reference/projects/object) object. + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/organization/projects/proj_abc \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Project DEF" + }' + /organization/projects/{project_id}/api_keys: + get: + summary: Returns a list of API keys in the project. + operationId: list-project-api-keys + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + required: false + schema: + type: string + responses: + "200": + description: Project API keys listed successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectApiKeyListResponse" + x-oaiMeta: + name: List project API keys + group: administration + returns: A list of [ProjectApiKey](/docs/api-reference/project-api-keys/object) + objects. + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/api_keys?after=key_abc&limit=20 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: + content: | + { + "object": "list", + "data": [ + { + "object": "organization.project.api_key", + "redacted_value": "sk-abc...def", + "name": "My API Key", + "created_at": 1711471533, + "id": "key_abc", + "owner": { + "type": "user", + "user": { + "object": "organization.project.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + } + } + ], + "first_id": "key_abc", + "last_id": "key_xyz", + "has_more": false + } + error_response: + content: | + { + "code": 400, + "message": "Project {name} is archived" + } + /organization/projects/{project_id}/api_keys/{key_id}: + get: + summary: Retrieves an API key in the project. + operationId: retrieve-project-api-key + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: key_id + in: path + description: The ID of the API key. + required: true + schema: + type: string + responses: + "200": + description: Project API key retrieved successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectApiKey" + x-oaiMeta: + name: Retrieve project API key + group: administration + returns: The [ProjectApiKey](/docs/api-reference/project-api-keys/object) object + matching the specified ID. + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: + content: | + { + "object": "organization.project.api_key", + "redacted_value": "sk-abc...def", + "name": "My API Key", + "created_at": 1711471533, + "id": "key_abc", + "owner": { + "type": "user", + "user": { + "object": "organization.project.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + } + } + delete: + summary: Deletes an API key from the project. + operationId: delete-project-api-key + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: key_id + in: path + description: The ID of the API key. + required: true + schema: + type: string + responses: + "200": + description: Project API key deleted successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectApiKeyDeleteResponse" + "400": + description: Error response for various conditions. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + x-oaiMeta: + name: Delete project API key + group: administration + returns: Confirmation of the key's deletion or an error if the key belonged to a + service account + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: + content: | + { + "object": "organization.project.api_key.deleted", + "id": "key_abc", + "deleted": true + } + error_response: + content: > + { + "code": 400, + "message": "API keys cannot be deleted for service accounts, please delete the service account" + } + /organization/projects/{project_id}/archive: + post: + summary: Archives a project in the organization. Archived projects cannot be + used or updated. + operationId: archive-project + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + responses: + "200": + description: Project archived successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/Project" + x-oaiMeta: + name: Archive project + group: administration + returns: The archived [Project](/docs/api-reference/projects/object) object. + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/organization/projects/proj_abc/archive \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: + content: | + { + "id": "proj_abc", + "object": "organization.project", + "name": "Project DEF", + "created_at": 1711471533, + "archived_at": 1711471533, + "status": "archived" + } + /organization/projects/{project_id}/service_accounts: + get: + summary: Returns a list of service accounts in the project. + operationId: list-project-service-accounts + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + required: false + schema: + type: string + responses: + "200": + description: Project service accounts listed successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectServiceAccountListResponse" + "400": + description: Error response when project is archived. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + x-oaiMeta: + name: List project service accounts + group: administration + returns: A list of + [ProjectServiceAccount](/docs/api-reference/project-service-accounts/object) + objects. + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/service_accounts?after=custom_id&limit=20 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: + content: | + { + "object": "list", + "data": [ + { + "object": "organization.project.service_account", + "id": "svc_acct_abc", + "name": "Service Account", + "role": "owner", + "created_at": 1711471533 + } + ], + "first_id": "svc_acct_abc", + "last_id": "svc_acct_xyz", + "has_more": false + } + post: + summary: Creates a new service account in the project. This also returns an + unredacted API key for the service account. + operationId: create-project-service-account + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + requestBody: + description: The project service account create request payload. + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectServiceAccountCreateRequest" + responses: + "200": + description: Project service account created successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectServiceAccountCreateResponse" + "400": + description: Error response when project is archived. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + x-oaiMeta: + name: Create project service account + group: administration + returns: The created + [ProjectServiceAccount](/docs/api-reference/project-service-accounts/object) + object. + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/organization/projects/proj_abc/service_accounts + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Production App" + }' + response: + content: | + { + "object": "organization.project.service_account", + "id": "svc_acct_abc", + "name": "Production App", + "role": "member", + "created_at": 1711471533, + "api_key": { + "object": "organization.project.service_account.api_key", + "value": "sk-abcdefghijklmnop123", + "name": "Secret Key", + "created_at": 1711471533, + "id": "key_abc" + } + } + /organization/projects/{project_id}/service_accounts/{service_account_id}: + get: + summary: Retrieves a service account in the project. + operationId: retrieve-project-service-account + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: service_account_id + in: path + description: The ID of the service account. + required: true + schema: + type: string + responses: + "200": + description: Project service account retrieved successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectServiceAccount" + x-oaiMeta: + name: Retrieve project service account + group: administration + returns: The + [ProjectServiceAccount](/docs/api-reference/project-service-accounts/object) + object matching the specified ID. + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: + content: | + { + "object": "organization.project.service_account", + "id": "svc_acct_abc", + "name": "Service Account", + "role": "owner", + "created_at": 1711471533 + } + delete: + summary: Deletes a service account from the project. + operationId: delete-project-service-account + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: service_account_id + in: path + description: The ID of the service account. + required: true + schema: + type: string + responses: + "200": + description: Project service account deleted successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectServiceAccountDeleteResponse" + x-oaiMeta: + name: Delete project service account + group: administration + returns: Confirmation of service account being deleted, or an error in case of + an archived project, which has no service accounts + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/projects/proj_abc/service_accounts/svc_acct_abc + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: + content: | + { + "object": "organization.project.service_account.deleted", + "id": "svc_acct_abc", + "deleted": true + } + /organization/projects/{project_id}/users: + get: + summary: Returns a list of users in the project. + operationId: list-project-users + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + required: false + schema: + type: string + responses: + "200": + description: Project users listed successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectUserListResponse" + "400": + description: Error response when project is archived. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + x-oaiMeta: + name: List project users + group: administration + returns: A list of [ProjectUser](/docs/api-reference/project-users/object) + objects. + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/users?after=user_abc&limit=20 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: + content: | + { + "object": "list", + "data": [ + { + "object": "organization.project.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + ], + "first_id": "user-abc", + "last_id": "user-xyz", + "has_more": false + } + error_response: + content: | + { + "code": 400, + "message": "Project {name} is archived" + } + post: + summary: Adds a user to the project. Users must already be members of the + organization to be added to a project. + operationId: create-project-user + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + tags: + - Projects + requestBody: + description: The project user create request payload. + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectUserCreateRequest" + responses: + "200": + description: User added to project successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectUser" + "400": + description: Error response for various conditions. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + x-oaiMeta: + name: Create project user + group: administration + returns: The created [ProjectUser](/docs/api-reference/project-users/object) + object. + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/organization/projects/proj_abc/users \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "user_id": "user_abc", + "role": "member" + }' + response: + content: | + { + "object": "organization.project.user", + "id": "user_abc", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + error_response: + content: | + { + "code": 400, + "message": "Project {name} is archived" + } + /organization/projects/{project_id}/users/{user_id}: + get: + summary: Retrieves a user in the project. + operationId: retrieve-project-user + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: user_id + in: path + description: The ID of the user. + required: true + schema: + type: string + responses: + "200": + description: Project user retrieved successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectUser" + x-oaiMeta: + name: Retrieve project user + group: administration + returns: The [ProjectUser](/docs/api-reference/project-users/object) object + matching the specified ID. + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: + content: | + { + "object": "organization.project.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + post: + summary: Modifies a user's role in the project. + operationId: modify-project-user + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: user_id + in: path + description: The ID of the user. + required: true + schema: + type: string + requestBody: + description: The project user update request payload. + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectUserUpdateRequest" + responses: + "200": + description: Project user's role updated successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectUser" + "400": + description: Error response for various conditions. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + x-oaiMeta: + name: Modify project user + group: administration + returns: The updated [ProjectUser](/docs/api-reference/project-users/object) + object. + examples: + request: + curl: > + curl -X POST + https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "role": "owner" + }' + response: + content: | + { + "object": "organization.project.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + delete: + summary: Deletes a user from the project. + operationId: delete-project-user + tags: + - Projects + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: user_id + in: path + description: The ID of the user. + required: true + schema: + type: string + responses: + "200": + description: Project user deleted successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/ProjectUserDeleteResponse" + "400": + description: Error response for various conditions. + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + x-oaiMeta: + name: Delete project user + group: administration + returns: Confirmation that project has been deleted or an error in case of an + archived project, which has no users + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/projects/proj_abc/users/user_abc + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: + content: | + { + "object": "organization.project.user.deleted", + "id": "user_abc", + "deleted": true + } + /organization/users: + get: + summary: Lists all of the users in the organization. + operationId: list-users + tags: + - Users + parameters: + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + required: false + schema: + type: string + responses: + "200": + description: Users listed successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/UserListResponse" + x-oaiMeta: + name: List users + group: administration + returns: A list of [User](/docs/api-reference/users/object) objects. + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/users?after=user_abc&limit=20 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: + content: | + { + "object": "list", + "data": [ + { + "object": "organization.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + ], + "first_id": "user-abc", + "last_id": "user-xyz", + "has_more": false + } + /organization/users/{user_id}: + get: + summary: Retrieves a user by their identifier. + operationId: retrieve-user + tags: + - Users + parameters: + - name: user_id + in: path + description: The ID of the user. + required: true + schema: + type: string + responses: + "200": + description: User retrieved successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/User" + x-oaiMeta: + name: Retrieve user + group: administration + returns: The [User](/docs/api-reference/users/object) object matching the + specified ID. + examples: + request: + curl: | + curl https://api.openai.com/v1/organization/users/user_abc \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: + content: | + { + "object": "organization.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + post: + summary: Modifies a user's role in the organization. + operationId: modify-user + tags: + - Users + parameters: + - name: user_id + in: path + description: The ID of the user. + required: true + schema: + type: string + requestBody: + description: The new user role to modify. This must be one of `owner` or `member`. + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/UserRoleUpdateRequest" + responses: + "200": + description: User role updated successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/User" + x-oaiMeta: + name: Modify user + group: administration + returns: The updated [User](/docs/api-reference/users/object) object. + examples: + request: + curl: > + curl -X POST https://api.openai.com/v1/organization/users/user_abc + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "role": "owner" + }' + response: + content: | + { + "object": "organization.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + delete: + summary: Deletes a user from the organization. + operationId: delete-user + tags: + - Users + parameters: + - name: user_id + in: path + description: The ID of the user. + required: true + schema: + type: string + responses: + "200": + description: User deleted successfully. + content: + application/json: + schema: + $ref: "#/components/schemas/UserDeleteResponse" + x-oaiMeta: + name: Delete user + group: administration + returns: Confirmation of the deleted user + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/organization/users/user_abc \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + response: + content: | + { + "object": "organization.user.deleted", + "id": "user_abc", + "deleted": true + } + /threads: + post: + operationId: createThread + tags: + - Assistants + summary: Create a thread. + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/CreateThreadRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ThreadObject" + x-oaiMeta: + name: Create thread + group: threads + beta: true + returns: A [thread](/docs/api-reference/threads) object. + examples: + - title: Empty + request: + curl: | + curl https://api.openai.com/v1/threads \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '' + python: | + from openai import OpenAI + client = OpenAI() + + empty_thread = client.beta.threads.create() + print(empty_thread) + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const emptyThread = await openai.beta.threads.create(); + + console.log(emptyThread); + } + + main(); + response: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1699012949, + "metadata": {}, + "tool_resources": {} + } + - title: Messages + request: + curl: | + curl https://api.openai.com/v1/threads \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "messages": [{ + "role": "user", + "content": "Hello, what is AI?" + }, { + "role": "user", + "content": "How does AI work? Explain it in simple terms." + }] + }' + python: | + from openai import OpenAI + client = OpenAI() + + message_thread = client.beta.threads.create( + messages=[ + { + "role": "user", + "content": "Hello, what is AI?" + }, + { + "role": "user", + "content": "How does AI work? Explain it in simple terms." + }, + ] + ) + + print(message_thread) + node.js: >- + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const messageThread = await openai.beta.threads.create({ + messages: [ + { + role: "user", + content: "Hello, what is AI?" + }, + { + role: "user", + content: "How does AI work? Explain it in simple terms.", + }, + ], + }); + + console.log(messageThread); + } + + + main(); + response: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1699014083, + "metadata": {}, + "tool_resources": {} + } + /threads/runs: + post: + operationId: createThreadAndRun + tags: + - Assistants + summary: Create a thread and run it in one request. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CreateThreadAndRunRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/RunObject" + x-oaiMeta: + name: Create thread and run + group: threads + beta: true + returns: A [run](/docs/api-reference/runs/object) object. + examples: + - title: Default + request: + curl: > + curl https://api.openai.com/v1/threads/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_abc123", + "thread": { + "messages": [ + {"role": "user", "content": "Explain deep learning to a 5 year old."} + ] + } + }' + python: > + from openai import OpenAI + + client = OpenAI() + + + run = client.beta.threads.create_and_run( + assistant_id="asst_abc123", + thread={ + "messages": [ + {"role": "user", "content": "Explain deep learning to a 5 year old."} + ] + } + ) + + + print(run) + node.js: > + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const run = await openai.beta.threads.createAndRun({ + assistant_id: "asst_abc123", + thread: { + messages: [ + { role: "user", content: "Explain deep learning to a 5 year old." }, + ], + }, + }); + + console.log(run); + } + + + main(); + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699076792, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "queued", + "started_at": null, + "expires_at": 1699077392, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "required_action": null, + "last_error": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant.", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "temperature": 1.0, + "top_p": 1.0, + "max_completion_tokens": null, + "max_prompt_tokens": null, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "incomplete_details": null, + "usage": null, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/threads/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_123", + "thread": { + "messages": [ + {"role": "user", "content": "Hello"} + ] + }, + "stream": true + }' + python: | + from openai import OpenAI + client = OpenAI() + + stream = client.beta.threads.create_and_run( + assistant_id="asst_123", + thread={ + "messages": [ + {"role": "user", "content": "Hello"} + ] + }, + stream=True + ) + + for event in stream: + print(event) + node.js: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const stream = await openai.beta.threads.createAndRun({ + assistant_id: "asst_123", + thread: { + messages: [ + { role: "user", content: "Hello" }, + ], + }, + stream: true + }); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + response: > + event: thread.created + + data: + {"id":"thread_123","object":"thread","created_at":1710348075,"metadata":{}} + + + event: thread.run.created + + data: + {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} + + + event: thread.run.queued + + data: + {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} + + + event: thread.run.in_progress + + data: + {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} + + + event: thread.run.step.created + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} + + + event: thread.run.step.in_progress + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} + + + event: thread.message.created + + data: + {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[], + "metadata":{}} + + + event: thread.message.in_progress + + data: + {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[], + "metadata":{}} + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + + + ... + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + today"}}]}} + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + + + event: thread.message.completed + + data: + {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710348077,"role":"assistant","content":[{"type":"text","text":{"value":"Hello! + How can I assist you today?","annotations":[]}}], "metadata":{}} + + + event: thread.run.step.completed + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710348077,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31}} + + + event: thread.run.completed + + {"id":"run_123","object":"thread.run","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1713226836,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1713226837,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":345,"completion_tokens":11,"total_tokens":356},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} + + + event: done + + data: [DONE] + - title: Streaming with Functions + request: + curl: > + curl https://api.openai.com/v1/threads/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_abc123", + "thread": { + "messages": [ + {"role": "user", "content": "What is the weather like in San Francisco?"} + ] + }, + "tools": [ + { + "type": "function", + "function": { + "name": "get_current_weather", + "description": "Get the current weather in a given location", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA" + }, + "unit": { + "type": "string", + "enum": ["celsius", "fahrenheit"] + } + }, + "required": ["location"] + } + } + } + ], + "stream": true + }' + python: > + from openai import OpenAI + + client = OpenAI() + + + tools = [ + { + "type": "function", + "function": { + "name": "get_current_weather", + "description": "Get the current weather in a given location", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", + }, + "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}, + }, + "required": ["location"], + }, + } + } + ] + + + stream = client.beta.threads.create_and_run( + thread={ + "messages": [ + {"role": "user", "content": "What is the weather like in San Francisco?"} + ] + }, + assistant_id="asst_abc123", + tools=tools, + stream=True + ) + + + for event in stream: + print(event) + node.js: > + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + const tools = [ + { + "type": "function", + "function": { + "name": "get_current_weather", + "description": "Get the current weather in a given location", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", + }, + "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}, + }, + "required": ["location"], + }, + } + } + ]; + + + async function main() { + const stream = await openai.beta.threads.createAndRun({ + assistant_id: "asst_123", + thread: { + messages: [ + { role: "user", content: "What is the weather like in San Francisco?" }, + ], + }, + tools: tools, + stream: true + }); + + for await (const event of stream) { + console.log(event); + } + } + + + main(); + response: > + event: thread.created + + data: + {"id":"thread_123","object":"thread","created_at":1710351818,"metadata":{}} + + + event: thread.run.created + + data: + {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get + the current weather in a given + location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The + city and state, e.g. San Francisco, + CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + + event: thread.run.queued + + data: + {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get + the current weather in a given + location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The + city and state, e.g. San Francisco, + CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + + event: thread.run.in_progress + + data: + {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710351818,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get + the current weather in a given + location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The + city and state, e.g. San Francisco, + CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + + event: thread.run.step.created + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710351819,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710352418,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[]},"usage":null} + + + event: thread.run.step.in_progress + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710351819,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710352418,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[]},"usage":null} + + + event: thread.run.step.delta + + data: + {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"id":"call_XXNp8YGaFrjrSjgqxtC8JJ1B","type":"function","function":{"name":"get_current_weather","arguments":"","output":null}}]}}} + + + event: thread.run.step.delta + + data: + {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\""}}]}}} + + + event: thread.run.step.delta + + data: + {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"location"}}]}}} + + + ... + + + event: thread.run.step.delta + + data: + {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"ahrenheit"}}]}}} + + + event: thread.run.step.delta + + data: + {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"\"}"}}]}}} + + + event: thread.run.requires_action + + data: + {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"requires_action","started_at":1710351818,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":{"type":"submit_tool_outputs","submit_tool_outputs":{"tool_calls":[{"id":"call_XXNp8YGaFrjrSjgqxtC8JJ1B","type":"function","function":{"name":"get_current_weather","arguments":"{\"location\":\"San + Francisco, + CA\",\"unit\":\"fahrenheit\"}"}}]}},"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get + the current weather in a given + location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The + city and state, e.g. San Francisco, + CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":345,"completion_tokens":11,"total_tokens":356},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + + event: done + + data: [DONE] + /threads/{thread_id}: + get: + operationId: getThread + tags: + - Assistants + summary: Retrieves a thread. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to retrieve. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ThreadObject" + x-oaiMeta: + name: Retrieve thread + group: threads + beta: true + returns: The [thread](/docs/api-reference/threads/object) object matching the + specified ID. + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: | + from openai import OpenAI + client = OpenAI() + + my_thread = client.beta.threads.retrieve("thread_abc123") + print(my_thread) + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const myThread = await openai.beta.threads.retrieve( + "thread_abc123" + ); + + console.log(myThread); + } + + main(); + response: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1699014083, + "metadata": {}, + "tool_resources": { + "code_interpreter": { + "file_ids": [] + } + } + } + post: + operationId: modifyThread + tags: + - Assistants + summary: Modifies a thread. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to modify. Only the `metadata` can be modified. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ModifyThreadRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ThreadObject" + x-oaiMeta: + name: Modify thread + group: threads + beta: true + returns: The modified [thread](/docs/api-reference/threads/object) object + matching the specified ID. + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "metadata": { + "modified": "true", + "user": "abc123" + } + }' + python: | + from openai import OpenAI + client = OpenAI() + + my_updated_thread = client.beta.threads.update( + "thread_abc123", + metadata={ + "modified": "true", + "user": "abc123" + } + ) + print(my_updated_thread) + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const updatedThread = await openai.beta.threads.update( + "thread_abc123", + { + metadata: { modified: "true", user: "abc123" }, + } + ); + + console.log(updatedThread); + } + + main(); + response: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1699014083, + "metadata": { + "modified": "true", + "user": "abc123" + }, + "tool_resources": {} + } + delete: + operationId: deleteThread + tags: + - Assistants + summary: Delete a thread. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to delete. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/DeleteThreadResponse" + x-oaiMeta: + name: Delete thread + group: threads + beta: true + returns: Deletion status + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -X DELETE + python: | + from openai import OpenAI + client = OpenAI() + + response = client.beta.threads.delete("thread_abc123") + print(response) + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const response = await openai.beta.threads.del("thread_abc123"); + + console.log(response); + } + main(); + response: | + { + "id": "thread_abc123", + "object": "thread.deleted", + "deleted": true + } + /threads/{thread_id}/messages: + get: + operationId: listMessages + tags: + - Assistants + summary: Returns a list of messages for a given thread. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) the messages + belong to. + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + - name: run_id + in: query + description: | + Filter messages by the run ID that generated them. + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ListMessagesResponse" + x-oaiMeta: + name: List messages + group: threads + beta: true + returns: A list of [message](/docs/api-reference/messages) objects. + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/messages \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: > + from openai import OpenAI + + client = OpenAI() + + + thread_messages = + client.beta.threads.messages.list("thread_abc123") + + print(thread_messages.data) + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const threadMessages = await openai.beta.threads.messages.list( + "thread_abc123" + ); + + console.log(threadMessages.data); + } + + main(); + response: > + { + "object": "list", + "data": [ + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1699016383, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "How does AI work? Explain it in simple terms.", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + }, + { + "id": "msg_abc456", + "object": "thread.message", + "created_at": 1699016383, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "Hello, what is AI?", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + ], + "first_id": "msg_abc123", + "last_id": "msg_abc456", + "has_more": false + } + post: + operationId: createMessage + tags: + - Assistants + summary: Create a message. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) to create a + message for. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CreateMessageRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/MessageObject" + x-oaiMeta: + name: Create message + group: threads + beta: true + returns: A [message](/docs/api-reference/messages/object) object. + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/messages \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "role": "user", + "content": "How does AI work? Explain it in simple terms." + }' + python: | + from openai import OpenAI + client = OpenAI() + + thread_message = client.beta.threads.messages.create( + "thread_abc123", + role="user", + content="How does AI work? Explain it in simple terms.", + ) + print(thread_message) + node.js: >- + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const threadMessages = await openai.beta.threads.messages.create( + "thread_abc123", + { role: "user", content: "How does AI work? Explain it in simple terms." } + ); + + console.log(threadMessages); + } + + + main(); + response: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1713226573, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "How does AI work? Explain it in simple terms.", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + /threads/{thread_id}/messages/{message_id}: + get: + operationId: getMessage + tags: + - Assistants + summary: Retrieve a message. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) to which this + message belongs. + - in: path + name: message_id + required: true + schema: + type: string + description: The ID of the message to retrieve. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/MessageObject" + x-oaiMeta: + name: Retrieve message + group: threads + beta: true + returns: The [message](/docs/api-reference/messages/object) object matching the + specified ID. + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 + \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: | + from openai import OpenAI + client = OpenAI() + + message = client.beta.threads.messages.retrieve( + message_id="msg_abc123", + thread_id="thread_abc123", + ) + print(message) + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const message = await openai.beta.threads.messages.retrieve( + "thread_abc123", + "msg_abc123" + ); + + console.log(message); + } + + main(); + response: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1699017614, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "How does AI work? Explain it in simple terms.", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + post: + operationId: modifyMessage + tags: + - Assistants + summary: Modifies a message. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to which this message belongs. + - in: path + name: message_id + required: true + schema: + type: string + description: The ID of the message to modify. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ModifyMessageRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/MessageObject" + x-oaiMeta: + name: Modify message + group: threads + beta: true + returns: The modified [message](/docs/api-reference/messages/object) object. + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 + \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "metadata": { + "modified": "true", + "user": "abc123" + } + }' + python: | + from openai import OpenAI + client = OpenAI() + + message = client.beta.threads.messages.update( + message_id="msg_abc12", + thread_id="thread_abc123", + metadata={ + "modified": "true", + "user": "abc123", + }, + ) + print(message) + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const message = await openai.beta.threads.messages.update( + "thread_abc123", + "msg_abc123", + { + metadata: { + modified: "true", + user: "abc123", + }, + } + }' + response: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1699017614, + "assistant_id": null, + "thread_id": "thread_abc123", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "How does AI work? Explain it in simple terms.", + "annotations": [] + } + } + ], + "file_ids": [], + "metadata": { + "modified": "true", + "user": "abc123" + } + } + delete: + operationId: deleteMessage + tags: + - Assistants + summary: Deletes a message. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to which this message belongs. + - in: path + name: message_id + required: true + schema: + type: string + description: The ID of the message to delete. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/DeleteMessageResponse" + x-oaiMeta: + name: Delete message + group: threads + beta: true + returns: Deletion status + examples: + request: + curl: > + curl -X DELETE + https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 + \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: | + from openai import OpenAI + client = OpenAI() + + deleted_message = client.beta.threads.messages.delete( + message_id="msg_abc12", + thread_id="thread_abc123", + ) + print(deleted_message) + node.js: |- + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const deletedMessage = await openai.beta.threads.messages.del( + "thread_abc123", + "msg_abc123" + ); + + console.log(deletedMessage); + } + response: | + { + "id": "msg_abc123", + "object": "thread.message.deleted", + "deleted": true + } + /threads/{thread_id}/runs: + get: + operationId: listRuns + tags: + - Assistants + summary: Returns a list of runs belonging to a thread. + parameters: + - name: thread_id + in: path + required: true + schema: + type: string + description: The ID of the thread the run belongs to. + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ListRunsResponse" + x-oaiMeta: + name: List runs + group: threads + beta: true + returns: A list of [run](/docs/api-reference/runs/object) objects. + examples: + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: | + from openai import OpenAI + client = OpenAI() + + runs = client.beta.threads.runs.list( + "thread_abc123" + ) + + print(runs) + node.js: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const runs = await openai.beta.threads.runs.list( + "thread_abc123" + ); + + console.log(runs); + } + + main(); + response: | + { + "object": "list", + "data": [ + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699075072, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699075072, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699075073, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "tool_resources": { + "code_interpreter": { + "file_ids": [ + "file-abc123", + "file-abc456" + ] + } + }, + "metadata": {}, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + }, + { + "id": "run_abc456", + "object": "thread.run", + "created_at": 1699063290, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699063290, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699063291, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "tool_resources": { + "code_interpreter": { + "file_ids": [ + "file-abc123", + "file-abc456" + ] + } + }, + "metadata": {}, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + ], + "first_id": "run_abc123", + "last_id": "run_abc456", + "has_more": false + } + post: + operationId: createRun + tags: + - Assistants + summary: Create a run. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to run. + - name: include[] + in: query + description: > + A list of additional fields to include in the response. Currently + the only supported value is + `step_details.tool_calls[*].file_search.results[*].content` to fetch + the file search result content. + + + See the [file search tool + documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) + for more information. + schema: + type: array + items: + type: string + enum: + - step_details.tool_calls[*].file_search.results[*].content + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CreateRunRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/RunObject" + x-oaiMeta: + name: Create run + group: threads + beta: true + returns: A [run](/docs/api-reference/runs/object) object. + examples: + - title: Default + request: + curl: | + curl https://api.openai.com/v1/threads/thread_abc123/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_abc123" + }' + python: | + from openai import OpenAI + client = OpenAI() + + run = client.beta.threads.runs.create( + thread_id="thread_abc123", + assistant_id="asst_abc123" + ) + + print(run) + node.js: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.create( + "thread_abc123", + { assistant_id: "asst_abc123" } + ); + + console.log(run); + } + + main(); + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699063290, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "queued", + "started_at": 1699063290, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699063291, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "usage": null, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/threads/thread_123/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_123", + "stream": true + }' + python: | + from openai import OpenAI + client = OpenAI() + + stream = client.beta.threads.runs.create( + thread_id="thread_123", + assistant_id="asst_123", + stream=True + ) + + for event in stream: + print(event) + node.js: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const stream = await openai.beta.threads.runs.create( + "thread_123", + { assistant_id: "asst_123", stream: true } + ); + + for await (const event of stream) { + console.log(event); + } + } + + main(); + response: > + event: thread.run.created + + data: + {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + + event: thread.run.queued + + data: + {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + + event: thread.run.in_progress + + data: + {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710330641,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + + event: thread.run.step.created + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710330641,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710331240,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} + + + event: thread.run.step.in_progress + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710330641,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710331240,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} + + + event: thread.message.created + + data: + {"id":"msg_001","object":"thread.message","created_at":1710330641,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} + + + event: thread.message.in_progress + + data: + {"id":"msg_001","object":"thread.message","created_at":1710330641,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + + + ... + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + today"}}]}} + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + + + event: thread.message.completed + + data: + {"id":"msg_001","object":"thread.message","created_at":1710330641,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710330642,"role":"assistant","content":[{"type":"text","text":{"value":"Hello! + How can I assist you today?","annotations":[]}}],"metadata":{}} + + + event: thread.run.step.completed + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710330641,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710330642,"expires_at":1710331240,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31}} + + + event: thread.run.completed + + data: + {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710330641,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710330642,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + + event: done + + data: [DONE] + - title: Streaming with Functions + request: + curl: > + curl https://api.openai.com/v1/threads/thread_abc123/runs \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "assistant_id": "asst_abc123", + "tools": [ + { + "type": "function", + "function": { + "name": "get_current_weather", + "description": "Get the current weather in a given location", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA" + }, + "unit": { + "type": "string", + "enum": ["celsius", "fahrenheit"] + } + }, + "required": ["location"] + } + } + } + ], + "stream": true + }' + python: > + from openai import OpenAI + + client = OpenAI() + + + tools = [ + { + "type": "function", + "function": { + "name": "get_current_weather", + "description": "Get the current weather in a given location", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", + }, + "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}, + }, + "required": ["location"], + }, + } + } + ] + + + stream = client.beta.threads.runs.create( + thread_id="thread_abc123", + assistant_id="asst_abc123", + tools=tools, + stream=True + ) + + + for event in stream: + print(event) + node.js: > + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + const tools = [ + { + "type": "function", + "function": { + "name": "get_current_weather", + "description": "Get the current weather in a given location", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", + }, + "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}, + }, + "required": ["location"], + }, + } + } + ]; + + + async function main() { + const stream = await openai.beta.threads.runs.create( + "thread_abc123", + { + assistant_id: "asst_abc123", + tools: tools, + stream: true + } + ); + + for await (const event of stream) { + console.log(event); + } + } + + + main(); + response: > + event: thread.run.created + + data: + {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + + event: thread.run.queued + + data: + {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + + event: thread.run.in_progress + + data: + {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710348075,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + + event: thread.run.step.created + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} + + + event: thread.run.step.in_progress + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} + + + event: thread.message.created + + data: + {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} + + + event: thread.message.in_progress + + data: + {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}} + + + ... + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + today"}}]}} + + + event: thread.message.delta + + data: + {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}} + + + event: thread.message.completed + + data: + {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710348077,"role":"assistant","content":[{"type":"text","text":{"value":"Hello! + How can I assist you today?","annotations":[]}}],"metadata":{}} + + + event: thread.run.step.completed + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710348077,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31}} + + + event: thread.run.completed + + data: + {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710348075,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710348077,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + + event: done + + data: [DONE] + /threads/{thread_id}/runs/{run_id}: + get: + operationId: getRun + tags: + - Assistants + summary: Retrieves a run. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) that was run. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run to retrieve. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/RunObject" + x-oaiMeta: + name: Retrieve run + group: threads + beta: true + returns: The [run](/docs/api-reference/runs/object) object matching the + specified ID. + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" + python: | + from openai import OpenAI + client = OpenAI() + + run = client.beta.threads.runs.retrieve( + thread_id="thread_abc123", + run_id="run_abc123" + ) + + print(run) + node.js: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.retrieve( + "thread_abc123", + "run_abc123" + ); + + console.log(run); + } + + main(); + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699075072, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699075072, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699075073, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + post: + operationId: modifyRun + tags: + - Assistants + summary: Modifies a run. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) that was run. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run to modify. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ModifyRunRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/RunObject" + x-oaiMeta: + name: Modify run + group: threads + beta: true + returns: The modified [run](/docs/api-reference/runs/object) object matching the + specified ID. + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "metadata": { + "user_id": "user_abc123" + } + }' + python: | + from openai import OpenAI + client = OpenAI() + + run = client.beta.threads.runs.update( + thread_id="thread_abc123", + run_id="run_abc123", + metadata={"user_id": "user_abc123"}, + ) + + print(run) + node.js: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.update( + "thread_abc123", + "run_abc123", + { + metadata: { + user_id: "user_abc123", + }, + } + ); + + console.log(run); + } + + main(); + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699075072, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699075072, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699075073, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "incomplete_details": null, + "tools": [ + { + "type": "code_interpreter" + } + ], + "tool_resources": { + "code_interpreter": { + "file_ids": [ + "file-abc123", + "file-abc456" + ] + } + }, + "metadata": { + "user_id": "user_abc123" + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + /threads/{thread_id}/runs/{run_id}/cancel: + post: + operationId: cancelRun + tags: + - Assistants + summary: Cancels a run that is `in_progress`. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to which this run belongs. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run to cancel. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/RunObject" + x-oaiMeta: + name: Cancel a run + group: threads + beta: true + returns: The modified [run](/docs/api-reference/runs/object) object matching the + specified ID. + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/cancel + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "OpenAI-Beta: assistants=v2" \ + -X POST + python: | + from openai import OpenAI + client = OpenAI() + + run = client.beta.threads.runs.cancel( + thread_id="thread_abc123", + run_id="run_abc123" + ) + + print(run) + node.js: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.cancel( + "thread_abc123", + "run_abc123" + ); + + console.log(run); + } + + main(); + response: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1699076126, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "cancelling", + "started_at": 1699076126, + "expires_at": 1699076726, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "last_error": null, + "model": "gpt-4o", + "instructions": "You summarize books.", + "tools": [ + { + "type": "file_search" + } + ], + "tool_resources": { + "file_search": { + "vector_store_ids": ["vs_123"] + } + }, + "metadata": {}, + "usage": null, + "temperature": 1.0, + "top_p": 1.0, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + /threads/{thread_id}/runs/{run_id}/steps: + get: + operationId: listRunSteps + tags: + - Assistants + summary: Returns a list of run steps belonging to a run. + parameters: + - name: thread_id + in: path + required: true + schema: + type: string + description: The ID of the thread the run and run steps belong to. + - name: run_id + in: path + required: true + schema: + type: string + description: The ID of the run the run steps belong to. + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + - name: include[] + in: query + description: > + A list of additional fields to include in the response. Currently + the only supported value is + `step_details.tool_calls[*].file_search.results[*].content` to fetch + the file search result content. + + + See the [file search tool + documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) + for more information. + schema: + type: array + items: + type: string + enum: + - step_details.tool_calls[*].file_search.results[*].content + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ListRunStepsResponse" + x-oaiMeta: + name: List run steps + group: threads + beta: true + returns: A list of [run step](/docs/api-reference/run-steps/step-object) + objects. + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: | + from openai import OpenAI + client = OpenAI() + + run_steps = client.beta.threads.runs.steps.list( + thread_id="thread_abc123", + run_id="run_abc123" + ) + + print(run_steps) + node.js: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const runStep = await openai.beta.threads.runs.steps.list( + "thread_abc123", + "run_abc123" + ); + console.log(runStep); + } + + main(); + response: | + { + "object": "list", + "data": [ + { + "id": "step_abc123", + "object": "thread.run.step", + "created_at": 1699063291, + "run_id": "run_abc123", + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "type": "message_creation", + "status": "completed", + "cancelled_at": null, + "completed_at": 1699063291, + "expired_at": null, + "failed_at": null, + "last_error": null, + "step_details": { + "type": "message_creation", + "message_creation": { + "message_id": "msg_abc123" + } + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + } + } + ], + "first_id": "step_abc123", + "last_id": "step_abc456", + "has_more": false + } + /threads/{thread_id}/runs/{run_id}/steps/{step_id}: + get: + operationId: getRunStep + tags: + - Assistants + summary: Retrieves a run step. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the thread to which the run and run step belongs. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run to which the run step belongs. + - in: path + name: step_id + required: true + schema: + type: string + description: The ID of the run step to retrieve. + - name: include[] + in: query + description: > + A list of additional fields to include in the response. Currently + the only supported value is + `step_details.tool_calls[*].file_search.results[*].content` to fetch + the file search result content. + + + See the [file search tool + documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) + for more information. + schema: + type: array + items: + type: string + enum: + - step_details.tool_calls[*].file_search.results[*].content + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/RunStepObject" + x-oaiMeta: + name: Retrieve run step + group: threads + beta: true + returns: The [run step](/docs/api-reference/run-steps/step-object) object + matching the specified ID. + examples: + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps/step_abc123 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: | + from openai import OpenAI + client = OpenAI() + + run_step = client.beta.threads.runs.steps.retrieve( + thread_id="thread_abc123", + run_id="run_abc123", + step_id="step_abc123" + ) + + print(run_step) + node.js: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const runStep = await openai.beta.threads.runs.steps.retrieve( + "thread_abc123", + "run_abc123", + "step_abc123" + ); + console.log(runStep); + } + + main(); + response: | + { + "id": "step_abc123", + "object": "thread.run.step", + "created_at": 1699063291, + "run_id": "run_abc123", + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "type": "message_creation", + "status": "completed", + "cancelled_at": null, + "completed_at": 1699063291, + "expired_at": null, + "failed_at": null, + "last_error": null, + "step_details": { + "type": "message_creation", + "message_creation": { + "message_id": "msg_abc123" + } + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + } + } + /threads/{thread_id}/runs/{run_id}/submit_tool_outputs: + post: + operationId: submitToolOuputsToRun + tags: + - Assistants + summary: > + When a run has the `status: "requires_action"` and + `required_action.type` is `submit_tool_outputs`, this endpoint can be + used to submit the outputs from the tool calls once they're all + completed. All outputs must be submitted in a single request. + parameters: + - in: path + name: thread_id + required: true + schema: + type: string + description: The ID of the [thread](/docs/api-reference/threads) to which this + run belongs. + - in: path + name: run_id + required: true + schema: + type: string + description: The ID of the run that requires the tool output submission. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/SubmitToolOutputsRunRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/RunObject" + x-oaiMeta: + name: Submit tool outputs to run + group: threads + beta: true + returns: The modified [run](/docs/api-reference/runs/object) object matching the + specified ID. + examples: + - title: Default + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "tool_outputs": [ + { + "tool_call_id": "call_001", + "output": "70 degrees and sunny." + } + ] + }' + python: | + from openai import OpenAI + client = OpenAI() + + run = client.beta.threads.runs.submit_tool_outputs( + thread_id="thread_123", + run_id="run_123", + tool_outputs=[ + { + "tool_call_id": "call_001", + "output": "70 degrees and sunny." + } + ] + ) + + print(run) + node.js: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + async function main() { + const run = await openai.beta.threads.runs.submitToolOutputs( + "thread_123", + "run_123", + { + tool_outputs: [ + { + tool_call_id: "call_001", + output: "70 degrees and sunny.", + }, + ], + } + ); + + console.log(run); + } + + main(); + response: > + { + "id": "run_123", + "object": "thread.run", + "created_at": 1699075592, + "assistant_id": "asst_123", + "thread_id": "thread_123", + "status": "queued", + "started_at": 1699075592, + "expires_at": 1699076192, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "tools": [ + { + "type": "function", + "function": { + "name": "get_current_weather", + "description": "Get the current weather in a given location", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA" + }, + "unit": { + "type": "string", + "enum": ["celsius", "fahrenheit"] + } + }, + "required": ["location"] + } + } + } + ], + "metadata": {}, + "usage": null, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + - title: Streaming + request: + curl: > + curl + https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "tool_outputs": [ + { + "tool_call_id": "call_001", + "output": "70 degrees and sunny." + } + ], + "stream": true + }' + python: | + from openai import OpenAI + client = OpenAI() + + stream = client.beta.threads.runs.submit_tool_outputs( + thread_id="thread_123", + run_id="run_123", + tool_outputs=[ + { + "tool_call_id": "call_001", + "output": "70 degrees and sunny." + } + ], + stream=True + ) + + for event in stream: + print(event) + node.js: > + import OpenAI from "openai"; + + + const openai = new OpenAI(); + + + async function main() { + const stream = await openai.beta.threads.runs.submitToolOutputs( + "thread_123", + "run_123", + { + tool_outputs: [ + { + tool_call_id: "call_001", + output: "70 degrees and sunny.", + }, + ], + } + ); + + for await (const event of stream) { + console.log(event); + } + } + + + main(); + response: > + event: thread.run.step.completed + + data: + {"id":"step_001","object":"thread.run.step","created_at":1710352449,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"completed","cancelled_at":null,"completed_at":1710352475,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[{"id":"call_iWr0kQ2EaYMaxNdl0v3KYkx7","type":"function","function":{"name":"get_current_weather","arguments":"{\"location\":\"San + Francisco, CA\",\"unit\":\"fahrenheit\"}","output":"70 degrees and + sunny."}}]},"usage":{"prompt_tokens":291,"completion_tokens":24,"total_tokens":315}} + + + event: thread.run.queued + + data: + {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":1710352448,"expires_at":1710353047,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get + the current weather in a given + location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The + city and state, e.g. San Francisco, + CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + + event: thread.run.in_progress + + data: + {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710352475,"expires_at":1710353047,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get + the current weather in a given + location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The + city and state, e.g. San Francisco, + CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + + event: thread.run.step.created + + data: + {"id":"step_002","object":"thread.run.step","created_at":1710352476,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_002"}},"usage":null} + + + event: thread.run.step.in_progress + + data: + {"id":"step_002","object":"thread.run.step","created_at":1710352476,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_002"}},"usage":null} + + + event: thread.message.created + + data: + {"id":"msg_002","object":"thread.message","created_at":1710352476,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} + + + event: thread.message.in_progress + + data: + {"id":"msg_002","object":"thread.message","created_at":1710352476,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{}} + + + event: thread.message.delta + + data: + {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"The","annotations":[]}}]}} + + + event: thread.message.delta + + data: + {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + current"}}]}} + + + event: thread.message.delta + + data: + {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + weather"}}]}} + + + ... + + + event: thread.message.delta + + data: + {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" + sunny"}}]}} + + + event: thread.message.delta + + data: + {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"."}}]}} + + + event: thread.message.completed + + data: + {"id":"msg_002","object":"thread.message","created_at":1710352476,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710352477,"role":"assistant","content":[{"type":"text","text":{"value":"The + current weather in San Francisco, CA is 70 degrees Fahrenheit and + sunny.","annotations":[]}}],"metadata":{}} + + + event: thread.run.step.completed + + data: + {"id":"step_002","object":"thread.run.step","created_at":1710352476,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710352477,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_002"}},"usage":{"prompt_tokens":329,"completion_tokens":18,"total_tokens":347}} + + + event: thread.run.completed + + data: + {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710352475,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710352477,"required_action":null,"last_error":null,"model":"gpt-4o","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get + the current weather in a given + location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The + city and state, e.g. San Francisco, + CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} + + + event: done + + data: [DONE] + /uploads: + post: + operationId: createUpload + tags: + - Uploads + summary: > + Creates an intermediate [Upload](/docs/api-reference/uploads/object) + object that you can add [Parts](/docs/api-reference/uploads/part-object) + to. Currently, an Upload can accept at most 8 GB in total and expires + after an hour after you create it. + + + Once you complete the Upload, we will create a + [File](/docs/api-reference/files/object) object that contains all the + parts you uploaded. This File is usable in the rest of our platform as a + regular File object. + + + For certain `purpose`s, the correct `mime_type` must be specified. + Please refer to documentation for the supported MIME types for your use + case: + + - [Assistants](/docs/assistants/tools/file-search/supported-files) + + + For guidance on the proper filename extensions for each purpose, please + follow the documentation on [creating a + File](/docs/api-reference/files/create). + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CreateUploadRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Upload" + x-oaiMeta: + name: Create upload + group: uploads + returns: The [Upload](/docs/api-reference/uploads/object) object with status + `pending`. + examples: + request: + curl: | + curl https://api.openai.com/v1/uploads \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "purpose": "fine-tune", + "filename": "training_examples.jsonl", + "bytes": 2147483648, + "mime_type": "text/jsonl" + }' + response: | + { + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "pending", + "expires_at": 1719127296 + } + /uploads/{upload_id}/cancel: + post: + operationId: cancelUpload + tags: + - Uploads + summary: | + Cancels the Upload. No Parts may be added after an Upload is cancelled. + parameters: + - in: path + name: upload_id + required: true + schema: + type: string + example: upload_abc123 + description: | + The ID of the Upload. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Upload" + x-oaiMeta: + name: Cancel upload + group: uploads + returns: The [Upload](/docs/api-reference/uploads/object) object with status + `cancelled`. + examples: + request: + curl: | + curl https://api.openai.com/v1/uploads/upload_abc123/cancel + response: | + { + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "cancelled", + "expires_at": 1719127296 + } + /uploads/{upload_id}/complete: + post: + operationId: completeUpload + tags: + - Uploads + summary: > + Completes the [Upload](/docs/api-reference/uploads/object). + + + Within the returned Upload object, there is a nested + [File](/docs/api-reference/files/object) object that is ready to use in + the rest of the platform. + + + You can specify the order of the Parts by passing in an ordered list of + the Part IDs. + + + The number of bytes uploaded upon completion must match the number of + bytes initially specified when creating the Upload object. No Parts may + be added after an Upload is completed. + parameters: + - in: path + name: upload_id + required: true + schema: + type: string + example: upload_abc123 + description: | + The ID of the Upload. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CompleteUploadRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Upload" + x-oaiMeta: + name: Complete upload + group: uploads + returns: The [Upload](/docs/api-reference/uploads/object) object with status + `completed` with an additional `file` property containing the created + usable File object. + examples: + request: + curl: | + curl https://api.openai.com/v1/uploads/upload_abc123/complete + -d '{ + "part_ids": ["part_def456", "part_ghi789"] + }' + response: | + { + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "completed", + "expires_at": 1719127296, + "file": { + "id": "file-xyz321", + "object": "file", + "bytes": 2147483648, + "created_at": 1719186911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + } + } + /uploads/{upload_id}/parts: + post: + operationId: addUploadPart + tags: + - Uploads + summary: > + Adds a [Part](/docs/api-reference/uploads/part-object) to an + [Upload](/docs/api-reference/uploads/object) object. A Part represents a + chunk of bytes from the file you are trying to upload. + + + Each Part can be at most 64 MB, and you can add Parts until you hit the + Upload maximum of 8 GB. + + + It is possible to add multiple Parts in parallel. You can decide the + intended order of the Parts when you [complete the + Upload](/docs/api-reference/uploads/complete). + parameters: + - in: path + name: upload_id + required: true + schema: + type: string + example: upload_abc123 + description: | + The ID of the Upload. + requestBody: + required: true + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/AddUploadPartRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/UploadPart" + x-oaiMeta: + name: Add upload part + group: uploads + returns: The upload [Part](/docs/api-reference/uploads/part-object) object. + examples: + request: + curl: | + curl https://api.openai.com/v1/uploads/upload_abc123/parts + -F data="aHR0cHM6Ly9hcGkub3BlbmFpLmNvbS92MS91cGxvYWRz..." + response: | + { + "id": "part_def456", + "object": "upload.part", + "created_at": 1719185911, + "upload_id": "upload_abc123" + } + /vector_stores: + get: + operationId: listVectorStores + tags: + - Vector stores + summary: Returns a list of vector stores. + parameters: + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ListVectorStoresResponse" + x-oaiMeta: + name: List vector stores + group: vector_stores + beta: true + returns: A list of [vector store](/docs/api-reference/vector-stores/object) + objects. + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: | + from openai import OpenAI + client = OpenAI() + + vector_stores = client.beta.vector_stores.list() + print(vector_stores) + node.js: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStores = await openai.beta.vectorStores.list(); + console.log(vectorStores); + } + + main(); + response: | + { + "object": "list", + "data": [ + { + "id": "vs_abc123", + "object": "vector_store", + "created_at": 1699061776, + "name": "Support FAQ", + "bytes": 139920, + "file_counts": { + "in_progress": 0, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 3 + } + }, + { + "id": "vs_abc456", + "object": "vector_store", + "created_at": 1699061776, + "name": "Support FAQ v2", + "bytes": 139920, + "file_counts": { + "in_progress": 0, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 3 + } + } + ], + "first_id": "vs_abc123", + "last_id": "vs_abc456", + "has_more": false + } + post: + operationId: createVectorStore + tags: + - Vector stores + summary: Create a vector store. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CreateVectorStoreRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/VectorStoreObject" + x-oaiMeta: + name: Create vector store + group: vector_stores + beta: true + returns: A [vector store](/docs/api-reference/vector-stores/object) object. + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + -d '{ + "name": "Support FAQ" + }' + python: | + from openai import OpenAI + client = OpenAI() + + vector_store = client.beta.vector_stores.create( + name="Support FAQ" + ) + print(vector_store) + node.js: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStore = await openai.beta.vectorStores.create({ + name: "Support FAQ" + }); + console.log(vectorStore); + } + + main(); + response: | + { + "id": "vs_abc123", + "object": "vector_store", + "created_at": 1699061776, + "name": "Support FAQ", + "bytes": 139920, + "file_counts": { + "in_progress": 0, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 3 + } + } + /vector_stores/{vector_store_id}: + get: + operationId: getVectorStore + tags: + - Vector stores + summary: Retrieves a vector store. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store to retrieve. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/VectorStoreObject" + x-oaiMeta: + name: Retrieve vector store + group: vector_stores + beta: true + returns: The [vector store](/docs/api-reference/vector-stores/object) object + matching the specified ID. + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: | + from openai import OpenAI + client = OpenAI() + + vector_store = client.beta.vector_stores.retrieve( + vector_store_id="vs_abc123" + ) + print(vector_store) + node.js: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStore = await openai.beta.vectorStores.retrieve( + "vs_abc123" + ); + console.log(vectorStore); + } + + main(); + response: | + { + "id": "vs_abc123", + "object": "vector_store", + "created_at": 1699061776 + } + post: + operationId: modifyVectorStore + tags: + - Vector stores + summary: Modifies a vector store. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store to modify. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/UpdateVectorStoreRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/VectorStoreObject" + x-oaiMeta: + name: Modify vector store + group: vector_stores + beta: true + returns: The modified [vector store](/docs/api-reference/vector-stores/object) + object. + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + -d '{ + "name": "Support FAQ" + }' + python: | + from openai import OpenAI + client = OpenAI() + + vector_store = client.beta.vector_stores.update( + vector_store_id="vs_abc123", + name="Support FAQ" + ) + print(vector_store) + node.js: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const vectorStore = await openai.beta.vectorStores.update( + "vs_abc123", + { + name: "Support FAQ" + } + ); + console.log(vectorStore); + } + + main(); + response: | + { + "id": "vs_abc123", + "object": "vector_store", + "created_at": 1699061776, + "name": "Support FAQ", + "bytes": 139920, + "file_counts": { + "in_progress": 0, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 3 + } + } + delete: + operationId: deleteVectorStore + tags: + - Vector stores + summary: Delete a vector store. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store to delete. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/DeleteVectorStoreResponse" + x-oaiMeta: + name: Delete vector store + group: vector_stores + beta: true + returns: Deletion status + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123 \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -X DELETE + python: | + from openai import OpenAI + client = OpenAI() + + deleted_vector_store = client.beta.vector_stores.delete( + vector_store_id="vs_abc123" + ) + print(deleted_vector_store) + node.js: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + async function main() { + const deletedVectorStore = await openai.beta.vectorStores.del( + "vs_abc123" + ); + console.log(deletedVectorStore); + } + + main(); + response: | + { + id: "vs_abc123", + object: "vector_store.deleted", + deleted: true + } + /vector_stores/{vector_store_id}/file_batches: + post: + operationId: createVectorStoreFileBatch + tags: + - Vector stores + summary: Create a vector store file batch. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: | + The ID of the vector store for which to create a File Batch. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CreateVectorStoreFileBatchRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/VectorStoreFileBatchObject" + x-oaiMeta: + name: Create vector store file batch + group: vector_stores + beta: true + returns: A [vector store file + batch](/docs/api-reference/vector-stores-file-batches/batch-object) + object. + examples: + request: + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/file_batches \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "file_ids": ["file-abc123", "file-abc456"] + }' + python: > + from openai import OpenAI + + client = OpenAI() + + + vector_store_file_batch = + client.beta.vector_stores.file_batches.create( + vector_store_id="vs_abc123", + file_ids=["file-abc123", "file-abc456"] + ) + + print(vector_store_file_batch) + node.js: > + import OpenAI from "openai"; + + const openai = new OpenAI(); + + + async function main() { + const myVectorStoreFileBatch = await openai.beta.vectorStores.fileBatches.create( + "vs_abc123", + { + file_ids: ["file-abc123", "file-abc456"] + } + ); + console.log(myVectorStoreFileBatch); + } + + + main(); + response: | + { + "id": "vsfb_abc123", + "object": "vector_store.file_batch", + "created_at": 1699061776, + "vector_store_id": "vs_abc123", + "status": "in_progress", + "file_counts": { + "in_progress": 1, + "completed": 1, + "failed": 0, + "cancelled": 0, + "total": 0, + } + } + /vector_stores/{vector_store_id}/file_batches/{batch_id}: + get: + operationId: getVectorStoreFileBatch + tags: + - Vector stores + summary: Retrieves a vector store file batch. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: The ID of the vector store that the file batch belongs to. + - in: path + name: batch_id + required: true + schema: + type: string + example: vsfb_abc123 + description: The ID of the file batch being retrieved. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/VectorStoreFileBatchObject" + x-oaiMeta: + name: Retrieve vector store file batch + group: vector_stores + beta: true + returns: The [vector store file + batch](/docs/api-reference/vector-stores-file-batches/batch-object) + object. + examples: + request: + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: > + from openai import OpenAI + + client = OpenAI() + + + vector_store_file_batch = + client.beta.vector_stores.file_batches.retrieve( + vector_store_id="vs_abc123", + batch_id="vsfb_abc123" + ) + + print(vector_store_file_batch) + node.js: > + import OpenAI from "openai"; + + const openai = new OpenAI(); + + + async function main() { + const vectorStoreFileBatch = await openai.beta.vectorStores.fileBatches.retrieve( + "vs_abc123", + "vsfb_abc123" + ); + console.log(vectorStoreFileBatch); + } + + + main(); + response: | + { + "id": "vsfb_abc123", + "object": "vector_store.file_batch", + "created_at": 1699061776, + "vector_store_id": "vs_abc123", + "status": "in_progress", + "file_counts": { + "in_progress": 1, + "completed": 1, + "failed": 0, + "cancelled": 0, + "total": 0, + } + } + /vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel: + post: + operationId: cancelVectorStoreFileBatch + tags: + - Vector stores + summary: Cancel a vector store file batch. This attempts to cancel the + processing of files in this batch as soon as possible. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store that the file batch belongs to. + - in: path + name: batch_id + required: true + schema: + type: string + description: The ID of the file batch to cancel. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/VectorStoreFileBatchObject" + x-oaiMeta: + name: Cancel vector store file batch + group: vector_stores + beta: true + returns: The modified vector store file batch object. + examples: + request: + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/cancel + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -X POST + python: > + from openai import OpenAI + + client = OpenAI() + + + deleted_vector_store_file_batch = + client.beta.vector_stores.file_batches.cancel( + vector_store_id="vs_abc123", + file_batch_id="vsfb_abc123" + ) + + print(deleted_vector_store_file_batch) + node.js: > + import OpenAI from "openai"; + + const openai = new OpenAI(); + + + async function main() { + const deletedVectorStoreFileBatch = await openai.vector_stores.fileBatches.cancel( + "vs_abc123", + "vsfb_abc123" + ); + console.log(deletedVectorStoreFileBatch); + } + + + main(); + response: | + { + "id": "vsfb_abc123", + "object": "vector_store.file_batch", + "created_at": 1699061776, + "vector_store_id": "vs_abc123", + "status": "cancelling", + "file_counts": { + "in_progress": 12, + "completed": 3, + "failed": 0, + "cancelled": 0, + "total": 15, + } + } + /vector_stores/{vector_store_id}/file_batches/{batch_id}/files: + get: + operationId: listFilesInVectorStoreBatch + tags: + - Vector stores + summary: Returns a list of vector store files in a batch. + parameters: + - name: vector_store_id + in: path + description: The ID of the vector store that the files belong to. + required: true + schema: + type: string + - name: batch_id + in: path + description: The ID of the file batch that the files belong to. + required: true + schema: + type: string + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + - name: filter + in: query + description: Filter by file status. One of `in_progress`, `completed`, `failed`, + `cancelled`. + schema: + type: string + enum: + - in_progress + - completed + - failed + - cancelled + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ListVectorStoreFilesResponse" + x-oaiMeta: + name: List vector store files in a batch + group: vector_stores + beta: true + returns: A list of [vector store + file](/docs/api-reference/vector-stores-files/file-object) objects. + examples: + request: + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/files + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: > + from openai import OpenAI + + client = OpenAI() + + + vector_store_files = + client.beta.vector_stores.file_batches.list_files( + vector_store_id="vs_abc123", + batch_id="vsfb_abc123" + ) + + print(vector_store_files) + node.js: > + import OpenAI from "openai"; + + const openai = new OpenAI(); + + + async function main() { + const vectorStoreFiles = await openai.beta.vectorStores.fileBatches.listFiles( + "vs_abc123", + "vsfb_abc123" + ); + console.log(vectorStoreFiles); + } + + + main(); + response: | + { + "object": "list", + "data": [ + { + "id": "file-abc123", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abc123" + }, + { + "id": "file-abc456", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abc123" + } + ], + "first_id": "file-abc123", + "last_id": "file-abc456", + "has_more": false + } + /vector_stores/{vector_store_id}/files: + get: + operationId: listVectorStoreFiles + tags: + - Vector stores + summary: Returns a list of vector store files. + parameters: + - name: vector_store_id + in: path + description: The ID of the vector store that the files belong to. + required: true + schema: + type: string + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: > + Sort order by the `created_at` timestamp of the objects. `asc` for + ascending order and `desc` for descending order. + schema: + type: string + default: desc + enum: + - asc + - desc + - name: after + in: query + description: > + A cursor for use in pagination. `after` is an object ID that defines + your place in the list. For instance, if you make a list request and + receive 100 objects, ending with obj_foo, your subsequent call can + include after=obj_foo in order to fetch the next page of the list. + schema: + type: string + - name: before + in: query + description: > + A cursor for use in pagination. `before` is an object ID that + defines your place in the list. For instance, if you make a list + request and receive 100 objects, ending with obj_foo, your + subsequent call can include before=obj_foo in order to fetch the + previous page of the list. + schema: + type: string + - name: filter + in: query + description: Filter by file status. One of `in_progress`, `completed`, `failed`, + `cancelled`. + schema: + type: string + enum: + - in_progress + - completed + - failed + - cancelled + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ListVectorStoreFilesResponse" + x-oaiMeta: + name: List vector store files + group: vector_stores + beta: true + returns: A list of [vector store + file](/docs/api-reference/vector-stores-files/file-object) objects. + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: | + from openai import OpenAI + client = OpenAI() + + vector_store_files = client.beta.vector_stores.files.list( + vector_store_id="vs_abc123" + ) + print(vector_store_files) + node.js: > + import OpenAI from "openai"; + + const openai = new OpenAI(); + + + async function main() { + const vectorStoreFiles = await openai.beta.vectorStores.files.list( + "vs_abc123" + ); + console.log(vectorStoreFiles); + } + + + main(); + response: | + { + "object": "list", + "data": [ + { + "id": "file-abc123", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abc123" + }, + { + "id": "file-abc456", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abc123" + } + ], + "first_id": "file-abc123", + "last_id": "file-abc456", + "has_more": false + } + post: + operationId: createVectorStoreFile + tags: + - Vector stores + summary: Create a vector store file by attaching a + [File](/docs/api-reference/files) to a [vector + store](/docs/api-reference/vector-stores/object). + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: | + The ID of the vector store for which to create a File. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CreateVectorStoreFileRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/VectorStoreFileObject" + x-oaiMeta: + name: Create vector store file + group: vector_stores + beta: true + returns: A [vector store + file](/docs/api-reference/vector-stores-files/file-object) object. + examples: + request: + curl: | + curl https://api.openai.com/v1/vector_stores/vs_abc123/files \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -d '{ + "file_id": "file-abc123" + }' + python: | + from openai import OpenAI + client = OpenAI() + + vector_store_file = client.beta.vector_stores.files.create( + vector_store_id="vs_abc123", + file_id="file-abc123" + ) + print(vector_store_file) + node.js: > + import OpenAI from "openai"; + + const openai = new OpenAI(); + + + async function main() { + const myVectorStoreFile = await openai.beta.vectorStores.files.create( + "vs_abc123", + { + file_id: "file-abc123" + } + ); + console.log(myVectorStoreFile); + } + + + main(); + response: | + { + "id": "file-abc123", + "object": "vector_store.file", + "created_at": 1699061776, + "usage_bytes": 1234, + "vector_store_id": "vs_abcd", + "status": "completed", + "last_error": null + } + /vector_stores/{vector_store_id}/files/{file_id}: + get: + operationId: getVectorStoreFile + tags: + - Vector stores + summary: Retrieves a vector store file. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + example: vs_abc123 + description: The ID of the vector store that the file belongs to. + - in: path + name: file_id + required: true + schema: + type: string + example: file-abc123 + description: The ID of the file being retrieved. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/VectorStoreFileObject" + x-oaiMeta: + name: Retrieve vector store file + group: vector_stores + beta: true + returns: The [vector store + file](/docs/api-reference/vector-stores-files/file-object) object. + examples: + request: + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" + python: | + from openai import OpenAI + client = OpenAI() + + vector_store_file = client.beta.vector_stores.files.retrieve( + vector_store_id="vs_abc123", + file_id="file-abc123" + ) + print(vector_store_file) + node.js: > + import OpenAI from "openai"; + + const openai = new OpenAI(); + + + async function main() { + const vectorStoreFile = await openai.beta.vectorStores.files.retrieve( + "vs_abc123", + "file-abc123" + ); + console.log(vectorStoreFile); + } + + + main(); + response: | + { + "id": "file-abc123", + "object": "vector_store.file", + "created_at": 1699061776, + "vector_store_id": "vs_abcd", + "status": "completed", + "last_error": null + } + delete: + operationId: deleteVectorStoreFile + tags: + - Vector stores + summary: Delete a vector store file. This will remove the file from the vector + store but the file itself will not be deleted. To delete the file, use + the [delete file](/docs/api-reference/files/delete) endpoint. + parameters: + - in: path + name: vector_store_id + required: true + schema: + type: string + description: The ID of the vector store that the file belongs to. + - in: path + name: file_id + required: true + schema: + type: string + description: The ID of the file to delete. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/DeleteVectorStoreFileResponse" + x-oaiMeta: + name: Delete vector store file + group: vector_stores + beta: true + returns: Deletion status + examples: + request: + curl: > + curl + https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 + \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -H "Content-Type: application/json" \ + -H "OpenAI-Beta: assistants=v2" \ + -X DELETE + python: > + from openai import OpenAI + + client = OpenAI() + + + deleted_vector_store_file = + client.beta.vector_stores.files.delete( + vector_store_id="vs_abc123", + file_id="file-abc123" + ) + + print(deleted_vector_store_file) + node.js: > + import OpenAI from "openai"; + + const openai = new OpenAI(); + + + async function main() { + const deletedVectorStoreFile = await openai.beta.vectorStores.files.del( + "vs_abc123", + "file-abc123" + ); + console.log(deletedVectorStoreFile); + } + + + main(); + response: | + { + id: "file-abc123", + object: "vector_store.file.deleted", + deleted: true + } +components: + schemas: + AddUploadPartRequest: + type: object + additionalProperties: false + properties: + data: + description: | + The chunk of bytes for this Part. + type: string + format: binary + required: + - data + AssistantObject: + type: object + title: Assistant + description: Represents an `assistant` that can call the model and use tools. + properties: + id: + description: The identifier, which can be referenced in API endpoints. + type: string + object: + description: The object type, which is always `assistant`. + type: string + enum: + - assistant + created_at: + description: The Unix timestamp (in seconds) for when the assistant was created. + type: integer + name: + description: | + The name of the assistant. The maximum length is 256 characters. + type: string + maxLength: 256 + nullable: true + description: + description: > + The description of the assistant. The maximum length is 512 + characters. + type: string + maxLength: 512 + nullable: true + model: + description: > + ID of the model to use. You can use the [List + models](/docs/api-reference/models/list) API to see all of your + available models, or see our [Model overview](/docs/models/overview) + for descriptions of them. + type: string + instructions: + description: > + The system instructions that the assistant uses. The maximum length + is 256,000 characters. + type: string + maxLength: 256000 + nullable: true + tools: + description: > + A list of tool enabled on the assistant. There can be a maximum of + 128 tools per assistant. Tools can be of types `code_interpreter`, + `file_search`, or `function`. + default: [ ] + type: array + maxItems: 128 + items: + oneOf: + - $ref: "#/components/schemas/AssistantToolsCode" + - $ref: "#/components/schemas/AssistantToolsFileSearch" + - $ref: "#/components/schemas/AssistantToolsFunction" + x-oaiExpandable: true + tool_resources: + type: object + description: > + A set of resources that are used by the assistant's tools. The + resources are specific to the type of tool. For example, the + `code_interpreter` tool requires a list of file IDs, while the + `file_search` tool requires a list of vector store IDs. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter`` tool. There can be a + maximum of 20 files associated with the tool. + default: [ ] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The ID of the [vector + store](/docs/api-reference/vector-stores/object) attached to + this assistant. There can be a maximum of 1 vector store + attached to the assistant. + maxItems: 1 + items: + type: string + nullable: true + metadata: + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be useful for storing additional information about the object in + a structured format. Keys can be a maximum of 64 characters long and + values can be a maximum of 512 characters long. + type: object + x-oaiTypeLabel: map + nullable: true + temperature: + description: > + What sampling temperature to use, between 0 and 2. Higher values + like 0.8 will make the output more random, while lower values like + 0.2 will make it more focused and deterministic. + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + nullable: true + top_p: + type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + nullable: true + description: > + An alternative to sampling with temperature, called nucleus + sampling, where the model considers the results of the tokens with + top_p probability mass. So 0.1 means only the tokens comprising the + top 10% probability mass are considered. + + + We generally recommend altering this or temperature but not both. + response_format: + $ref: "#/components/schemas/AssistantsApiResponseFormatOption" + nullable: true + required: + - id + - object + - created_at + - name + - description + - model + - instructions + - tools + - metadata + x-oaiMeta: + name: The assistant object + beta: true + example: > + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698984975, + "name": "Math Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + AssistantStreamEvent: + description: > + Represents an event emitted when streaming a Run. + + + Each event in a server-sent events stream has an `event` and `data` + property: + + + ``` + + event: thread.created + + data: {"id": "thread_123", "object": "thread", ...} + + ``` + + + We emit events whenever a new object is created, transitions to a new + state, or is being + + streamed in parts (deltas). For example, we emit `thread.run.created` + when a new run + + is created, `thread.run.completed` when a run completes, and so on. When + an Assistant chooses + + to create a message during a run, we emit a `thread.message.created + event`, a + + `thread.message.in_progress` event, many `thread.message.delta` events, + and finally a + + `thread.message.completed` event. + + + We may add additional events over time, so we recommend handling unknown + events gracefully + + in your code. See the [Assistants API + quickstart](/docs/assistants/overview) to learn how to + + integrate the Assistants API with streaming. + oneOf: + - $ref: "#/components/schemas/ThreadStreamEvent" + - $ref: "#/components/schemas/RunStreamEvent" + - $ref: "#/components/schemas/RunStepStreamEvent" + - $ref: "#/components/schemas/MessageStreamEvent" + - $ref: "#/components/schemas/ErrorEvent" + - $ref: "#/components/schemas/DoneEvent" + x-oaiMeta: + name: Assistant stream events + beta: true + AssistantToolsCode: + type: object + title: Code interpreter tool + properties: + type: + type: string + description: "The type of tool being defined: `code_interpreter`" + enum: + - code_interpreter + required: + - type + AssistantToolsFileSearch: + type: object + title: FileSearch tool + properties: + type: + type: string + description: "The type of tool being defined: `file_search`" + enum: + - file_search + file_search: + type: object + description: Overrides for the file search tool. + properties: + max_num_results: + type: integer + minimum: 1 + maximum: 50 + description: > + The maximum number of results the file search tool should + output. The default is 20 for `gpt-4*` models and 5 for + `gpt-3.5-turbo`. This number should be between 1 and 50 + inclusive. + + + Note that the file search tool may output fewer than + `max_num_results` results. See the [file search tool + documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) + for more information. + ranking_options: + $ref: "#/components/schemas/FileSearchRankingOptions" + required: + - type + AssistantToolsFileSearchTypeOnly: + type: object + title: FileSearch tool + properties: + type: + type: string + description: "The type of tool being defined: `file_search`" + enum: + - file_search + required: + - type + AssistantToolsFunction: + type: object + title: Function tool + properties: + type: + type: string + description: "The type of tool being defined: `function`" + enum: + - function + function: + $ref: "#/components/schemas/FunctionObject" + required: + - type + - function + AssistantsApiResponseFormatOption: + description: > + Specifies the format that the model must output. Compatible with + [GPT-4o](/docs/models/gpt-4o), [GPT-4 + Turbo](/docs/models/gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models + since `gpt-3.5-turbo-1106`. + + + Setting to `{ "type": "json_schema", "json_schema": {...} }` enables + Structured Outputs which ensures the model will match your supplied JSON + schema. Learn more in the [Structured Outputs + guide](/docs/guides/structured-outputs). + + + Setting to `{ "type": "json_object" }` enables JSON mode, which ensures + the message the model generates is valid JSON. + + + **Important:** when using JSON mode, you **must** also instruct the + model to produce JSON yourself via a system or user message. Without + this, the model may generate an unending stream of whitespace until the + generation reaches the token limit, resulting in a long-running and + seemingly "stuck" request. Also note that the message content may be + partially cut off if `finish_reason="length"`, which indicates the + generation exceeded `max_tokens` or the conversation exceeded the max + context length. + oneOf: + - type: string + description: | + `auto` is the default value + enum: + - auto + - $ref: "#/components/schemas/ResponseFormatText" + - $ref: "#/components/schemas/ResponseFormatJsonObject" + - $ref: "#/components/schemas/ResponseFormatJsonSchema" + x-oaiExpandable: true + AssistantsApiToolChoiceOption: + description: > + Controls which (if any) tool is called by the model. + + `none` means the model will not call any tools and instead generates a + message. + + `auto` is the default value and means the model can pick between + generating a message or calling one or more tools. + + `required` means the model must call one or more tools before responding + to the user. + + Specifying a particular tool like `{"type": "file_search"}` or `{"type": + "function", "function": {"name": "my_function"}}` forces the model to + call that tool. + oneOf: + - type: string + description: > + `none` means the model will not call any tools and instead generates + a message. `auto` means the model can pick between generating a + message or calling one or more tools. `required` means the model + must call one or more tools before responding to the user. + enum: + - none + - auto + - required + - $ref: "#/components/schemas/AssistantsNamedToolChoice" + x-oaiExpandable: true + AssistantsNamedToolChoice: + type: object + description: Specifies a tool the model should use. Use to force the model to + call a specific tool. + properties: + type: + type: string + enum: + - function + - code_interpreter + - file_search + description: The type of the tool. If type is `function`, the function name must + be set + function: + type: object + properties: + name: + type: string + description: The name of the function to call. + required: + - name + required: + - type + AudioResponseFormat: + description: > + The format of the output, in one of these options: `json`, `text`, + `srt`, `verbose_json`, or `vtt`. + type: string + enum: + - json + - text + - srt + - verbose_json + - vtt + default: json + AuditLog: + type: object + description: A log of a user action or configuration change within this organization. + properties: + id: + type: string + description: The ID of this log. + type: + $ref: "#/components/schemas/AuditLogEventType" + effective_at: + type: integer + description: The Unix timestamp (in seconds) of the event. + project: + type: object + description: The project that the action was scoped to. Absent for actions not + scoped to projects. + properties: + id: + type: string + description: The project ID. + name: + type: string + description: The project title. + actor: + $ref: "#/components/schemas/AuditLogActor" + api_key.created: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The tracking ID of the API key. + data: + type: object + description: The payload used to create the API key. + properties: + scopes: + type: array + items: + type: string + description: A list of scopes allowed for the API key, e.g. + `["api.model.request"]` + api_key.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The tracking ID of the API key. + changes_requested: + type: object + description: The payload used to update the API key. + properties: + scopes: + type: array + items: + type: string + description: A list of scopes allowed for the API key, e.g. + `["api.model.request"]` + api_key.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The tracking ID of the API key. + invite.sent: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the invite. + data: + type: object + description: The payload used to create the invite. + properties: + email: + type: string + description: The email invited to the organization. + role: + type: string + description: The role the email was invited to be. Is either `owner` or + `member`. + invite.accepted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the invite. + invite.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the invite. + login.failed: + type: object + description: The details for events with this `type`. + properties: + error_code: + type: string + description: The error code of the failure. + error_message: + type: string + description: The error message of the failure. + logout.failed: + type: object + description: The details for events with this `type`. + properties: + error_code: + type: string + description: The error code of the failure. + error_message: + type: string + description: The error message of the failure. + organization.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The organization ID. + changes_requested: + type: object + description: The payload used to update the organization settings. + properties: + title: + type: string + description: The organization title. + description: + type: string + description: The organization description. + name: + type: string + description: The organization name. + settings: + type: object + properties: + threads_ui_visibility: + type: string + description: Visibility of the threads page which shows messages created with + the Assistants API and Playground. One of `ANY_ROLE`, + `OWNERS`, or `NONE`. + usage_dashboard_visibility: + type: string + description: Visibility of the usage dashboard which shows activity and costs + for your organization. One of `ANY_ROLE` or `OWNERS`. + project.created: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The project ID. + data: + type: object + description: The payload used to create the project. + properties: + name: + type: string + description: The project name. + title: + type: string + description: The title of the project as seen on the dashboard. + project.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The project ID. + changes_requested: + type: object + description: The payload used to update the project. + properties: + title: + type: string + description: The title of the project as seen on the dashboard. + project.archived: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The project ID. + service_account.created: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The service account ID. + data: + type: object + description: The payload used to create the service account. + properties: + role: + type: string + description: The role of the service account. Is either `owner` or `member`. + service_account.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The service account ID. + changes_requested: + type: object + description: The payload used to updated the service account. + properties: + role: + type: string + description: The role of the service account. Is either `owner` or `member`. + service_account.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The service account ID. + user.added: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The user ID. + data: + type: object + description: The payload used to add the user to the project. + properties: + role: + type: string + description: The role of the user. Is either `owner` or `member`. + user.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The project ID. + changes_requested: + type: object + description: The payload used to update the user. + properties: + role: + type: string + description: The role of the user. Is either `owner` or `member`. + user.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The user ID. + required: + - id + - type + - effective_at + - actor + x-oaiMeta: + name: The audit log object + example: > + { + "id": "req_xxx_20240101", + "type": "api_key.created", + "effective_at": 1720804090, + "actor": { + "type": "session", + "session": { + "user": { + "id": "user-xxx", + "email": "user@example.com" + }, + "ip_address": "127.0.0.1", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" + } + }, + "api_key.created": { + "id": "key_xxxx", + "data": { + "scopes": ["resource.operation"] + } + } + } + AuditLogActor: + type: object + description: The actor who performed the audit logged action. + properties: + type: + type: string + description: The type of actor. Is either `session` or `api_key`. + enum: + - session + - api_key + session: + type: object + $ref: "#/components/schemas/AuditLogActorSession" + api_key: + type: object + $ref: "#/components/schemas/AuditLogActorApiKey" + AuditLogActorApiKey: + type: object + description: The API Key used to perform the audit logged action. + properties: + id: + type: string + description: The tracking id of the API key. + type: + type: string + description: The type of API key. Can be either `user` or `service_account`. + enum: + - user + - service_account + user: + $ref: "#/components/schemas/AuditLogActorUser" + service_account: + $ref: "#/components/schemas/AuditLogActorServiceAccount" + AuditLogActorServiceAccount: + type: object + description: The service account that performed the audit logged action. + properties: + id: + type: string + description: The service account id. + AuditLogActorSession: + type: object + description: The session in which the audit logged action was performed. + properties: + user: + $ref: "#/components/schemas/AuditLogActorUser" + ip_address: + type: string + description: The IP address from which the action was performed. + AuditLogActorUser: + type: object + description: The user who performed the audit logged action. + properties: + id: + type: string + description: The user id. + email: + type: string + description: The user email. + AuditLogEventType: + type: string + description: The event type. + x-oaiExpandable: true + enum: + - api_key.created + - api_key.updated + - api_key.deleted + - invite.sent + - invite.accepted + - invite.deleted + - login.succeeded + - login.failed + - logout.succeeded + - logout.failed + - organization.updated + - project.created + - project.updated + - project.archived + - service_account.created + - service_account.updated + - service_account.deleted + - user.added + - user.updated + - user.deleted + AutoChunkingStrategyRequestParam: + type: object + title: Auto Chunking Strategy + description: The default strategy. This strategy currently uses a + `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`. + additionalProperties: false + properties: + type: + type: string + description: Always `auto`. + enum: + - auto + required: + - type + Batch: + type: object + properties: + id: + type: string + object: + type: string + enum: + - batch + description: The object type, which is always `batch`. + endpoint: + type: string + description: The OpenAI API endpoint used by the batch. + errors: + type: object + properties: + object: + type: string + description: The object type, which is always `list`. + data: + type: array + items: + type: object + properties: + code: + type: string + description: An error code identifying the error type. + message: + type: string + description: A human-readable message providing more details about the error. + param: + type: string + description: The name of the parameter that caused the error, if applicable. + nullable: true + line: + type: integer + description: The line number of the input file where the error occurred, if + applicable. + nullable: true + input_file_id: + type: string + description: The ID of the input file for the batch. + completion_window: + type: string + description: The time frame within which the batch should be processed. + status: + type: string + description: The current status of the batch. + enum: + - validating + - failed + - in_progress + - finalizing + - completed + - expired + - cancelling + - cancelled + output_file_id: + type: string + description: The ID of the file containing the outputs of successfully executed + requests. + error_file_id: + type: string + description: The ID of the file containing the outputs of requests with errors. + created_at: + type: integer + description: The Unix timestamp (in seconds) for when the batch was created. + in_progress_at: + type: integer + description: The Unix timestamp (in seconds) for when the batch started + processing. + expires_at: + type: integer + description: The Unix timestamp (in seconds) for when the batch will expire. + finalizing_at: + type: integer + description: The Unix timestamp (in seconds) for when the batch started + finalizing. + completed_at: + type: integer + description: The Unix timestamp (in seconds) for when the batch was completed. + failed_at: + type: integer + description: The Unix timestamp (in seconds) for when the batch failed. + expired_at: + type: integer + description: The Unix timestamp (in seconds) for when the batch expired. + cancelling_at: + type: integer + description: The Unix timestamp (in seconds) for when the batch started + cancelling. + cancelled_at: + type: integer + description: The Unix timestamp (in seconds) for when the batch was cancelled. + request_counts: + type: object + properties: + total: + type: integer + description: Total number of requests in the batch. + completed: + type: integer + description: Number of requests that have been completed successfully. + failed: + type: integer + description: Number of requests that have failed. + required: + - total + - completed + - failed + description: The request counts for different statuses within the batch. + metadata: + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be useful for storing additional information about the object in + a structured format. Keys can be a maximum of 64 characters long and + values can be a maximum of 512 characters long. + type: object + x-oaiTypeLabel: map + nullable: true + required: + - id + - object + - endpoint + - input_file_id + - completion_window + - status + - created_at + x-oaiMeta: + name: The batch object + example: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/completions", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-cvaTdG", + "error_file_id": "file-HOWS94", + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": 1711493133, + "completed_at": 1711493163, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 95, + "failed": 5 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } + BatchRequestInput: + type: object + description: The per-line object of the batch input file + properties: + custom_id: + type: string + description: A developer-provided per-request id that will be used to match + outputs to inputs. Must be unique for each request in a batch. + method: + type: string + enum: + - POST + description: The HTTP method to be used for the request. Currently only `POST` + is supported. + url: + type: string + description: The OpenAI API relative URL to be used for the request. Currently + `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are + supported. + x-oaiMeta: + name: The request input object + example: > + {"custom_id": "request-1", "method": "POST", "url": + "/v1/chat/completions", "body": {"model": "gpt-4o-mini", "messages": + [{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "What is 2+2?"}]}} + BatchRequestOutput: + type: object + description: The per-line object of the batch output and error files + properties: + id: + type: string + custom_id: + type: string + description: A developer-provided per-request id that will be used to match + outputs to inputs. + response: + type: object + nullable: true + properties: + status_code: + type: integer + description: The HTTP status code of the response + request_id: + type: string + description: An unique identifier for the OpenAI API request. Please include + this request ID when contacting support. + body: + type: object + x-oaiTypeLabel: map + description: The JSON body of the response + error: + type: object + nullable: true + description: For requests that failed with a non-HTTP error, this will contain + more information on the cause of the failure. + properties: + code: + type: string + description: A machine-readable error code. + message: + type: string + description: A human-readable error message. + x-oaiMeta: + name: The request output object + example: > + {"id": "batch_req_wnaDys", "custom_id": "request-2", "response": + {"status_code": 200, "request_id": "req_c187b3", "body": {"id": + "chatcmpl-9758Iw", "object": "chat.completion", "created": 1711475054, + "model": "gpt-4o-mini", "choices": [{"index": 0, "message": {"role": + "assistant", "content": "2 + 2 equals 4."}, "finish_reason": "stop"}], + "usage": {"prompt_tokens": 24, "completion_tokens": 15, + "total_tokens": 39}, "system_fingerprint": null}}, "error": null} + CancelUploadRequest: + type: object + additionalProperties: false + ChatCompletionFunctionCallOption: + type: object + description: > + Specifying a particular function via `{"name": "my_function"}` forces + the model to call that function. + properties: + name: + type: string + description: The name of the function to call. + required: + - name + ChatCompletionFunctions: + type: object + deprecated: true + properties: + description: + type: string + description: A description of what the function does, used by the model to + choose when and how to call the function. + name: + type: string + description: The name of the function to be called. Must be a-z, A-Z, 0-9, or + contain underscores and dashes, with a maximum length of 64. + parameters: + $ref: "#/components/schemas/FunctionParameters" + required: + - name + ChatCompletionMessageToolCall: + type: object + properties: + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + type: object + description: The function that the model called. + properties: + name: + type: string + description: The name of the function to call. + arguments: + type: string + description: The arguments to call the function with, as generated by the model + in JSON format. Note that the model does not always generate + valid JSON, and may hallucinate parameters not defined by your + function schema. Validate the arguments in your code before + calling your function. + required: + - name + - arguments + required: + - id + - type + - function + ChatCompletionMessageToolCallChunk: + type: object + properties: + index: + type: integer + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + type: object + properties: + name: + type: string + description: The name of the function to call. + arguments: + type: string + description: The arguments to call the function with, as generated by the model + in JSON format. Note that the model does not always generate + valid JSON, and may hallucinate parameters not defined by your + function schema. Validate the arguments in your code before + calling your function. + required: + - index + ChatCompletionMessageToolCalls: + type: array + description: The tool calls generated by the model, such as function calls. + items: + $ref: "#/components/schemas/ChatCompletionMessageToolCall" + ChatCompletionModalities: + type: array + nullable: true + description: > + Output types that you would like the model to generate for this request. + + Most models are capable of generating text, which is the default: + + + `["text"]` + + + The `gpt-4o-audio-preview` model can also be used to [generate + audio](/docs/guides/audio). To + + request that this model generate both text and audio responses, you can + + use: + + + `["text", "audio"]` + items: + type: string + enum: + - text + - audio + ChatCompletionNamedToolChoice: + type: object + description: Specifies a tool the model should use. Use to force the model to + call a specific function. + properties: + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + type: object + properties: + name: + type: string + description: The name of the function to call. + required: + - name + required: + - type + - function + ChatCompletionRequestAssistantMessage: + type: object + title: Assistant message + properties: + content: + x-oaiExpandable: true + nullable: true + oneOf: + - type: string + description: The contents of the assistant message. + title: Text content + - type: array + description: An array of content parts with a defined type. Can be one or more + of type `text`, or exactly one of type `refusal`. + title: Array of content parts + items: + $ref: "#/components/schemas/ChatCompletionRequestAssistantMessageContentPart" + minItems: 1 + description: > + The contents of the assistant message. Required unless `tool_calls` + or `function_call` is specified. + refusal: + nullable: true + type: string + description: The refusal message by the assistant. + role: + type: string + enum: + - assistant + description: The role of the messages author, in this case `assistant`. + name: + type: string + description: An optional name for the participant. Provides the model + information to differentiate between participants of the same role. + audio: + type: object + nullable: true + x-oaiExpandable: true + description: | + Data about a previous audio response from the model. + [Learn more](/docs/guides/audio). + required: + - id + properties: + id: + type: string + description: | + Unique identifier for a previous audio response from the model. + tool_calls: + $ref: "#/components/schemas/ChatCompletionMessageToolCalls" + function_call: + type: object + deprecated: true + description: Deprecated and replaced by `tool_calls`. The name and arguments of + a function that should be called, as generated by the model. + nullable: true + properties: + arguments: + type: string + description: The arguments to call the function with, as generated by the model + in JSON format. Note that the model does not always generate + valid JSON, and may hallucinate parameters not defined by your + function schema. Validate the arguments in your code before + calling your function. + name: + type: string + description: The name of the function to call. + required: + - arguments + - name + required: + - role + ChatCompletionRequestAssistantMessageContentPart: + oneOf: + - $ref: "#/components/schemas/ChatCompletionRequestMessageContentPartText" + - $ref: "#/components/schemas/ChatCompletionRequestMessageContentPartRefusal" + x-oaiExpandable: true + ChatCompletionRequestFunctionMessage: + type: object + title: Function message + deprecated: true + properties: + role: + type: string + enum: + - function + description: The role of the messages author, in this case `function`. + content: + nullable: true + type: string + description: The contents of the function message. + name: + type: string + description: The name of the function to call. + required: + - role + - content + - name + ChatCompletionRequestMessage: + oneOf: + - $ref: "#/components/schemas/ChatCompletionRequestSystemMessage" + - $ref: "#/components/schemas/ChatCompletionRequestUserMessage" + - $ref: "#/components/schemas/ChatCompletionRequestAssistantMessage" + - $ref: "#/components/schemas/ChatCompletionRequestToolMessage" + - $ref: "#/components/schemas/ChatCompletionRequestFunctionMessage" + x-oaiExpandable: true + ChatCompletionRequestMessageContentPartAudio: + type: object + title: Audio content part + description: | + Learn about [audio inputs](/docs/guides/audio). + properties: + type: + type: string + enum: + - input_audio + description: The type of the content part. Always `input_audio`. + input_audio: + type: object + properties: + data: + type: string + description: Base64 encoded audio data. + format: + type: string + enum: + - wav + - mp3 + description: > + The format of the encoded audio data. Currently supports "wav" + and "mp3". + required: + - data + - format + required: + - type + - input_audio + ChatCompletionRequestMessageContentPartImage: + type: object + title: Image content part + description: | + Learn about [image inputs](/docs/guides/vision). + properties: + type: + type: string + enum: + - image_url + description: The type of the content part. + image_url: + type: object + properties: + url: + type: string + description: Either a URL of the image or the base64 encoded image data. + format: uri + detail: + type: string + description: Specifies the detail level of the image. Learn more in the [Vision + guide](/docs/guides/vision/low-or-high-fidelity-image-understanding). + enum: + - auto + - low + - high + default: auto + required: + - url + required: + - type + - image_url + ChatCompletionRequestMessageContentPartRefusal: + type: object + title: Refusal content part + properties: + type: + type: string + enum: + - refusal + description: The type of the content part. + refusal: + type: string + description: The refusal message generated by the model. + required: + - type + - refusal + ChatCompletionRequestMessageContentPartText: + type: object + title: Text content part + description: | + Learn about [text inputs](/docs/guides/text-generation). + properties: + type: + type: string + enum: + - text + description: The type of the content part. + text: + type: string + description: The text content. + required: + - type + - text + ChatCompletionRequestSystemMessage: + type: object + title: System message + properties: + content: + description: The contents of the system message. + oneOf: + - type: string + description: The contents of the system message. + title: Text content + - type: array + description: An array of content parts with a defined type. For system messages, + only type `text` is supported. + title: Array of content parts + items: + $ref: "#/components/schemas/ChatCompletionRequestSystemMessageContentPart" + minItems: 1 + role: + type: string + enum: + - system + description: The role of the messages author, in this case `system`. + name: + type: string + description: An optional name for the participant. Provides the model + information to differentiate between participants of the same role. + required: + - content + - role + ChatCompletionRequestSystemMessageContentPart: + oneOf: + - $ref: "#/components/schemas/ChatCompletionRequestMessageContentPartText" + x-oaiExpandable: true + ChatCompletionRequestToolMessage: + type: object + title: Tool message + properties: + role: + type: string + enum: + - tool + description: The role of the messages author, in this case `tool`. + content: + oneOf: + - type: string + description: The contents of the tool message. + title: Text content + - type: array + description: An array of content parts with a defined type. For tool messages, + only type `text` is supported. + title: Array of content parts + items: + $ref: "#/components/schemas/ChatCompletionRequestToolMessageContentPart" + minItems: 1 + description: The contents of the tool message. + tool_call_id: + type: string + description: Tool call that this message is responding to. + required: + - role + - content + - tool_call_id + ChatCompletionRequestToolMessageContentPart: + oneOf: + - $ref: "#/components/schemas/ChatCompletionRequestMessageContentPartText" + x-oaiExpandable: true + ChatCompletionRequestUserMessage: + type: object + title: User message + properties: + content: + description: | + The contents of the user message. + oneOf: + - type: string + description: The text contents of the message. + title: Text content + - type: array + description: An array of content parts with a defined type. Supported options + differ based on the [model](/docs/models) being used to generate + the response. Can contain text, image, or audio inputs. + title: Array of content parts + items: + $ref: "#/components/schemas/ChatCompletionRequestUserMessageContentPart" + minItems: 1 + x-oaiExpandable: true + role: + type: string + enum: + - user + description: The role of the messages author, in this case `user`. + name: + type: string + description: An optional name for the participant. Provides the model + information to differentiate between participants of the same role. + required: + - content + - role + ChatCompletionRequestUserMessageContentPart: + oneOf: + - $ref: "#/components/schemas/ChatCompletionRequestMessageContentPartText" + - $ref: "#/components/schemas/ChatCompletionRequestMessageContentPartImage" + - $ref: "#/components/schemas/ChatCompletionRequestMessageContentPartAudio" + x-oaiExpandable: true + ChatCompletionResponseMessage: + type: object + description: A chat completion message generated by the model. + properties: + content: + type: string + description: The contents of the message. + nullable: true + refusal: + type: string + description: The refusal message generated by the model. + nullable: true + tool_calls: + $ref: "#/components/schemas/ChatCompletionMessageToolCalls" + role: + type: string + enum: + - assistant + description: The role of the author of this message. + function_call: + type: object + deprecated: true + description: Deprecated and replaced by `tool_calls`. The name and arguments of + a function that should be called, as generated by the model. + properties: + arguments: + type: string + description: The arguments to call the function with, as generated by the model + in JSON format. Note that the model does not always generate + valid JSON, and may hallucinate parameters not defined by your + function schema. Validate the arguments in your code before + calling your function. + name: + type: string + description: The name of the function to call. + required: + - name + - arguments + audio: + type: object + nullable: true + description: > + If the audio output modality is requested, this object contains data + + about the audio response from the model. [Learn + more](/docs/guides/audio). + x-oaiExpandable: true + required: + - id + - expires_at + - data + - transcript + properties: + id: + type: string + description: Unique identifier for this audio response. + expires_at: + type: integer + description: > + The Unix timestamp (in seconds) for when this audio response + will + + no longer be accessible on the server for use in multi-turn + + conversations. + data: + type: string + description: | + Base64 encoded audio bytes generated by the model, in the format + specified in the request. + transcript: + type: string + description: Transcript of the audio generated by the model. + required: + - role + - content + - refusal + ChatCompletionRole: + type: string + description: The role of the author of a message + enum: + - system + - user + - assistant + - tool + - function + ChatCompletionStreamOptions: + description: > + Options for streaming response. Only set this when you set `stream: + true`. + type: object + nullable: true + default: null + properties: + include_usage: + type: boolean + description: > + If set, an additional chunk will be streamed before the `data: + [DONE]` message. The `usage` field on this chunk shows the token + usage statistics for the entire request, and the `choices` field + will always be an empty array. All other chunks will also include a + `usage` field, but with a null value. + ChatCompletionStreamResponseDelta: + type: object + description: A chat completion delta generated by streamed model responses. + properties: + content: + type: string + description: The contents of the chunk message. + nullable: true + function_call: + deprecated: true + type: object + description: Deprecated and replaced by `tool_calls`. The name and arguments of + a function that should be called, as generated by the model. + properties: + arguments: + type: string + description: The arguments to call the function with, as generated by the model + in JSON format. Note that the model does not always generate + valid JSON, and may hallucinate parameters not defined by your + function schema. Validate the arguments in your code before + calling your function. + name: + type: string + description: The name of the function to call. + tool_calls: + type: array + items: + $ref: "#/components/schemas/ChatCompletionMessageToolCallChunk" + role: + type: string + enum: + - system + - user + - assistant + - tool + description: The role of the author of this message. + refusal: + type: string + description: The refusal message generated by the model. + nullable: true + ChatCompletionTokenLogprob: + type: object + properties: + token: &a1 + description: The token. + type: string + logprob: &a2 + description: The log probability of this token, if it is within the top 20 most + likely tokens. Otherwise, the value `-9999.0` is used to signify + that the token is very unlikely. + type: number + bytes: &a3 + description: A list of integers representing the UTF-8 bytes representation of + the token. Useful in instances where characters are represented by + multiple tokens and their byte representations must be combined to + generate the correct text representation. Can be `null` if there is + no bytes representation for the token. + type: array + items: + type: integer + nullable: true + top_logprobs: + description: List of the most likely tokens and their log probability, at this + token position. In rare cases, there may be fewer than the number of + requested `top_logprobs` returned. + type: array + items: + type: object + properties: + token: *a1 + logprob: *a2 + bytes: *a3 + required: + - token + - logprob + - bytes + required: + - token + - logprob + - bytes + - top_logprobs + ChatCompletionTool: + type: object + properties: + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + $ref: "#/components/schemas/FunctionObject" + required: + - type + - function + ChatCompletionToolChoiceOption: + description: > + Controls which (if any) tool is called by the model. + + `none` means the model will not call any tool and instead generates a + message. + + `auto` means the model can pick between generating a message or calling + one or more tools. + + `required` means the model must call one or more tools. + + Specifying a particular tool via `{"type": "function", "function": + {"name": "my_function"}}` forces the model to call that tool. + + + `none` is the default when no tools are present. `auto` is the default + if tools are present. + oneOf: + - type: string + description: > + `none` means the model will not call any tool and instead generates + a message. `auto` means the model can pick between generating a + message or calling one or more tools. `required` means the model + must call one or more tools. + enum: + - none + - auto + - required + - $ref: "#/components/schemas/ChatCompletionNamedToolChoice" + x-oaiExpandable: true + ChunkingStrategyRequestParam: + type: object + description: The chunking strategy used to chunk the file(s). If not set, will + use the `auto` strategy. + oneOf: + - $ref: "#/components/schemas/AutoChunkingStrategyRequestParam" + - $ref: "#/components/schemas/StaticChunkingStrategyRequestParam" + x-oaiExpandable: true + CompleteUploadRequest: + type: object + additionalProperties: false + properties: + part_ids: + type: array + description: | + The ordered list of Part IDs. + items: + type: string + md5: + description: > + The optional md5 checksum for the file contents to verify if the + bytes uploaded matches what you expect. + type: string + required: + - part_ids + CompletionUsage: + type: object + description: Usage statistics for the completion request. + properties: + completion_tokens: + type: integer + description: Number of tokens in the generated completion. + prompt_tokens: + type: integer + description: Number of tokens in the prompt. + total_tokens: + type: integer + description: Total number of tokens used in the request (prompt + completion). + completion_tokens_details: + type: object + description: Breakdown of tokens used in a completion. + properties: + audio_tokens: + type: integer + description: Audio input tokens generated by the model. + reasoning_tokens: + type: integer + description: Tokens generated by the model for reasoning. + prompt_tokens_details: + type: object + description: Breakdown of tokens used in the prompt. + properties: + audio_tokens: + type: integer + description: Audio input tokens present in the prompt. + cached_tokens: + type: integer + description: Cached tokens present in the prompt. + required: + - prompt_tokens + - completion_tokens + - total_tokens + CreateAssistantRequest: + type: object + additionalProperties: false + properties: + model: + description: > + ID of the model to use. You can use the [List + models](/docs/api-reference/models/list) API to see all of your + available models, or see our [Model overview](/docs/models/overview) + for descriptions of them. + example: gpt-4o + anyOf: + - type: string + - type: string + enum: + - gpt-4o + - gpt-4o-2024-08-06 + - gpt-4o-2024-05-13 + - gpt-4o-2024-08-06 + - gpt-4o-mini + - gpt-4o-mini-2024-07-18 + - gpt-4-turbo + - gpt-4-turbo-2024-04-09 + - gpt-4-0125-preview + - gpt-4-turbo-preview + - gpt-4-1106-preview + - gpt-4-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-0613 + - gpt-3.5-turbo-1106 + - gpt-3.5-turbo-0125 + - gpt-3.5-turbo-16k-0613 + x-oaiTypeLabel: string + name: + description: | + The name of the assistant. The maximum length is 256 characters. + type: string + nullable: true + maxLength: 256 + description: + description: > + The description of the assistant. The maximum length is 512 + characters. + type: string + nullable: true + maxLength: 512 + instructions: + description: > + The system instructions that the assistant uses. The maximum length + is 256,000 characters. + type: string + nullable: true + maxLength: 256000 + tools: + description: > + A list of tool enabled on the assistant. There can be a maximum of + 128 tools per assistant. Tools can be of types `code_interpreter`, + `file_search`, or `function`. + default: [ ] + type: array + maxItems: 128 + items: + oneOf: + - $ref: "#/components/schemas/AssistantToolsCode" + - $ref: "#/components/schemas/AssistantToolsFileSearch" + - $ref: "#/components/schemas/AssistantToolsFunction" + x-oaiExpandable: true + tool_resources: + type: object + description: > + A set of resources that are used by the assistant's tools. The + resources are specific to the type of tool. For example, the + `code_interpreter` tool requires a list of file IDs, while the + `file_search` tool requires a list of vector store IDs. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter` tool. There can be a + maximum of 20 files associated with the tool. + default: [ ] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The [vector store](/docs/api-reference/vector-stores/object) + attached to this assistant. There can be a maximum of 1 + vector store attached to the assistant. + maxItems: 1 + items: + type: string + vector_stores: + type: array + description: > + A helper to create a [vector + store](/docs/api-reference/vector-stores/object) with + file_ids and attach it to this assistant. There can be a + maximum of 1 vector store attached to the assistant. + maxItems: 1 + items: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs to add + to the vector store. There can be a maximum of 10000 + files in a vector store. + maxItems: 10000 + items: + type: string + chunking_strategy: + type: object + description: The chunking strategy used to chunk the file(s). If not set, will + use the `auto` strategy. + oneOf: + - type: object + title: Auto Chunking Strategy + description: The default strategy. This strategy currently uses a + `max_chunk_size_tokens` of `800` and + `chunk_overlap_tokens` of `400`. + additionalProperties: false + properties: + type: + type: string + description: Always `auto`. + enum: + - auto + required: + - type + - type: object + title: Static Chunking Strategy + additionalProperties: false + properties: + type: + type: string + description: Always `static`. + enum: + - static + static: + type: object + additionalProperties: false + properties: + max_chunk_size_tokens: + type: integer + minimum: 100 + maximum: 4096 + description: The maximum number of tokens in each chunk. The default value is + `800`. The minimum value is `100` and the + maximum value is `4096`. + chunk_overlap_tokens: + type: integer + description: > + The number of tokens that overlap between + chunks. The default value is `400`. + + + Note that the overlap must not exceed half + of `max_chunk_size_tokens`. + required: + - max_chunk_size_tokens + - chunk_overlap_tokens + required: + - type + - static + x-oaiExpandable: true + metadata: + type: object + description: > + Set of 16 key-value pairs that can be attached to a + vector store. This can be useful for storing + additional information about the vector store in a + structured format. Keys can be a maximum of 64 + characters long and values can be a maximum of 512 + characters long. + x-oaiTypeLabel: map + oneOf: + - required: + - vector_store_ids + - required: + - vector_stores + nullable: true + metadata: + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be useful for storing additional information about the object in + a structured format. Keys can be a maximum of 64 characters long and + values can be a maximum of 512 characters long. + type: object + x-oaiTypeLabel: map + nullable: true + temperature: + description: > + What sampling temperature to use, between 0 and 2. Higher values + like 0.8 will make the output more random, while lower values like + 0.2 will make it more focused and deterministic. + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + nullable: true + top_p: + type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + nullable: true + description: > + An alternative to sampling with temperature, called nucleus + sampling, where the model considers the results of the tokens with + top_p probability mass. So 0.1 means only the tokens comprising the + top 10% probability mass are considered. + + + We generally recommend altering this or temperature but not both. + response_format: + $ref: "#/components/schemas/AssistantsApiResponseFormatOption" + nullable: true + required: + - model + CreateChatCompletionFunctionResponse: + type: object + description: Represents a chat completion response returned by model, based on + the provided input. + properties: + id: + type: string + description: A unique identifier for the chat completion. + choices: + type: array + description: A list of chat completion choices. Can be more than one if `n` is + greater than 1. + items: + type: object + required: + - finish_reason + - index + - message + - logprobs + properties: + finish_reason: + type: string + description: > + The reason the model stopped generating tokens. This will be + `stop` if the model hit a natural stop point or a provided + stop sequence, `length` if the maximum number of tokens + specified in the request was reached, `content_filter` if + content was omitted due to a flag from our content filters, or + `function_call` if the model called a function. + enum: + - stop + - length + - function_call + - content_filter + index: + type: integer + description: The index of the choice in the list of choices. + message: + $ref: "#/components/schemas/ChatCompletionResponseMessage" + created: + type: integer + description: The Unix timestamp (in seconds) of when the chat completion was + created. + model: + type: string + description: The model used for the chat completion. + system_fingerprint: + type: string + description: > + This fingerprint represents the backend configuration that the model + runs with. + + + Can be used in conjunction with the `seed` request parameter to + understand when backend changes have been made that might impact + determinism. + object: + type: string + description: The object type, which is always `chat.completion`. + enum: + - chat.completion + usage: + $ref: "#/components/schemas/CompletionUsage" + required: + - choices + - created + - id + - model + - object + x-oaiMeta: + name: The chat completion object + group: chat + example: | + { + "id": "chatcmpl-abc123", + "object": "chat.completion", + "created": 1699896916, + "model": "gpt-4o-mini", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": null, + "tool_calls": [ + { + "id": "call_abc123", + "type": "function", + "function": { + "name": "get_current_weather", + "arguments": "{\n\"location\": \"Boston, MA\"\n}" + } + } + ] + }, + "logprobs": null, + "finish_reason": "tool_calls" + } + ], + "usage": { + "prompt_tokens": 82, + "completion_tokens": 17, + "total_tokens": 99, + "completion_tokens_details": { + "reasoning_tokens": 0 + } + } + } + CreateChatCompletionImageResponse: + type: object + description: Represents a streamed chunk of a chat completion response returned + by model, based on the provided input. + x-oaiMeta: + name: The chat completion chunk object + group: chat + example: > + { + "id": "chatcmpl-123", + "object": "chat.completion", + "created": 1677652288, + "model": "gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices": [{ + "index": 0, + "message": { + "role": "assistant", + "content": "\n\nThis image shows a wooden boardwalk extending through a lush green marshland.", + }, + "logprobs": null, + "finish_reason": "stop" + }], + "usage": { + "prompt_tokens": 9, + "completion_tokens": 12, + "total_tokens": 21, + "completion_tokens_details": { + "reasoning_tokens": 0 + } + } + } + CreateChatCompletionRequest: + type: object + properties: + messages: + description: > + A list of messages comprising the conversation so far. Depending on + the + + [model](/docs/models) you use, different message types (modalities) + are + + supported, like [text](/docs/guides/text-generation), + + [images](/docs/guides/vision), and [audio](/docs/guides/audio). + type: array + minItems: 1 + items: + $ref: "#/components/schemas/ChatCompletionRequestMessage" + model: + description: ID of the model to use. See the [model endpoint + compatibility](/docs/models/model-endpoint-compatibility) table for + details on which models work with the Chat API. + example: gpt-4o + anyOf: + - type: string + - type: string + enum: + - o1-preview + - o1-preview-2024-09-12 + - o1-mini + - o1-mini-2024-09-12 + - gpt-4o + - gpt-4o-2024-08-06 + - gpt-4o-2024-05-13 + - gpt-4o-2024-08-06 + - gpt-4o-realtime-preview + - gpt-4o-realtime-preview-2024-10-01 + - gpt-4o-audio-preview + - gpt-4o-audio-preview-2024-10-01 + - chatgpt-4o-latest + - gpt-4o-mini + - gpt-4o-mini-2024-07-18 + - gpt-4-turbo + - gpt-4-turbo-2024-04-09 + - gpt-4-0125-preview + - gpt-4-turbo-preview + - gpt-4-1106-preview + - gpt-4-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-0125 + - gpt-3.5-turbo-16k-0613 + x-oaiTypeLabel: string + store: + type: boolean + default: false + nullable: true + description: > + Whether or not to store the output of this chat completion request + + for use in our [model distillation](/docs/guides/distillation) or + [evals](/docs/guides/evals) products. + metadata: + type: object + nullable: true + description: | + Developer-defined tags and values used for filtering completions + in the [dashboard](https://platform.openai.com/chat-completions). + additionalProperties: + type: string + frequency_penalty: + type: number + default: 0 + minimum: -2 + maximum: 2 + nullable: true + description: > + Number between -2.0 and 2.0. Positive values penalize new tokens + based on their existing frequency in the text so far, decreasing the + model's likelihood to repeat the same line verbatim. + + + [See more information about frequency and presence + penalties.](/docs/guides/text-generation/parameter-details) + logit_bias: + type: object + x-oaiTypeLabel: map + default: null + nullable: true + additionalProperties: + type: integer + description: > + Modify the likelihood of specified tokens appearing in the + completion. + + + Accepts a JSON object that maps tokens (specified by their token ID + in the tokenizer) to an associated bias value from -100 to 100. + Mathematically, the bias is added to the logits generated by the + model prior to sampling. The exact effect will vary per model, but + values between -1 and 1 should decrease or increase likelihood of + selection; values like -100 or 100 should result in a ban or + exclusive selection of the relevant token. + logprobs: + description: Whether to return log probabilities of the output tokens or not. If + true, returns the log probabilities of each output token returned in + the `content` of `message`. + type: boolean + default: false + nullable: true + top_logprobs: + description: An integer between 0 and 20 specifying the number of most likely + tokens to return at each token position, each with an associated log + probability. `logprobs` must be set to `true` if this parameter is + used. + type: integer + minimum: 0 + maximum: 20 + nullable: true + max_tokens: + description: > + The maximum number of [tokens](/tokenizer) that can be generated in + the chat completion. This value can be used to control + [costs](https://openai.com/api/pricing/) for text generated via API. + + + This value is now deprecated in favor of `max_completion_tokens`, + and is not compatible with [o1 series + models](/docs/guides/reasoning). + type: integer + nullable: true + deprecated: true + max_completion_tokens: + description: > + An upper bound for the number of tokens that can be generated for a + completion, including visible output tokens and [reasoning + tokens](/docs/guides/reasoning). + type: integer + nullable: true + n: + type: integer + minimum: 1 + maximum: 128 + default: 1 + example: 1 + nullable: true + description: How many chat completion choices to generate for each input + message. Note that you will be charged based on the number of + generated tokens across all of the choices. Keep `n` as `1` to + minimize costs. + modalities: + $ref: "#/components/schemas/ChatCompletionModalities" + audio: + type: object + nullable: true + description: > + Parameters for audio output. Required when audio output is requested + with + + `modalities: ["audio"]`. [Learn more](/docs/guides/audio). + required: + - voice + - format + x-oaiExpandable: true + properties: + voice: + type: string + enum: + - alloy + - echo + - fable + - onyx + - nova + - shimmer + description: | + Specifies the voice type. Supported voices are `alloy`, `echo`, + `fable`, `onyx`, `nova`, and `shimmer`. + format: + type: string + enum: + - wav + - mp3 + - flac + - opus + - pcm16 + description: > + Specifies the output audio format. Must be one of `wav`, `mp3`, + `flac`, + + `opus`, or `pcm16`. + presence_penalty: + type: number + default: 0 + minimum: -2 + maximum: 2 + nullable: true + description: > + Number between -2.0 and 2.0. Positive values penalize new tokens + based on whether they appear in the text so far, increasing the + model's likelihood to talk about new topics. + + + [See more information about frequency and presence + penalties.](/docs/guides/text-generation/parameter-details) + response_format: + description: > + An object specifying the format that the model must output. + Compatible with [GPT-4o](/docs/models/gpt-4o), [GPT-4o + mini](/docs/models/gpt-4o-mini), [GPT-4 + Turbo](/docs/models/gpt-4-and-gpt-4-turbo) and all GPT-3.5 Turbo + models newer than `gpt-3.5-turbo-1106`. + + + Setting to `{ "type": "json_schema", "json_schema": {...} }` enables + Structured Outputs which ensures the model will match your supplied + JSON schema. Learn more in the [Structured Outputs + guide](/docs/guides/structured-outputs). + + + Setting to `{ "type": "json_object" }` enables JSON mode, which + ensures the message the model generates is valid JSON. + + + **Important:** when using JSON mode, you **must** also instruct the + model to produce JSON yourself via a system or user message. Without + this, the model may generate an unending stream of whitespace until + the generation reaches the token limit, resulting in a long-running + and seemingly "stuck" request. Also note that the message content + may be partially cut off if `finish_reason="length"`, which + indicates the generation exceeded `max_tokens` or the conversation + exceeded the max context length. + oneOf: + - $ref: "#/components/schemas/ResponseFormatText" + - $ref: "#/components/schemas/ResponseFormatJsonObject" + - $ref: "#/components/schemas/ResponseFormatJsonSchema" + x-oaiExpandable: true + seed: + type: integer + minimum: -9223372036854776000 + maximum: 9223372036854776000 + nullable: true + description: > + This feature is in Beta. + + If specified, our system will make a best effort to sample + deterministically, such that repeated requests with the same `seed` + and parameters should return the same result. + + Determinism is not guaranteed, and you should refer to the + `system_fingerprint` response parameter to monitor changes in the + backend. + x-oaiMeta: + beta: true + service_tier: + description: > + Specifies the latency tier to use for processing the request. This + parameter is relevant for customers subscribed to the scale tier + service: + - If set to 'auto', and the Project is Scale tier enabled, the system will utilize scale tier credits until they are exhausted. + - If set to 'auto', and the Project is not Scale tier enabled, the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee. + - If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee. + - When not set, the default behavior is 'auto'. + + When this parameter is set, the response body will include the `service_tier` utilized. + type: string + enum: + - auto + - default + nullable: true + default: auto + stop: + description: | + Up to 4 sequences where the API will stop generating further tokens. + default: null + oneOf: + - type: string + nullable: true + - type: array + minItems: 1 + maxItems: 4 + items: + type: string + stream: + description: > + If set, partial message deltas will be sent, like in ChatGPT. Tokens + will be sent as data-only [server-sent + events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) + as they become available, with the stream terminated by a `data: + [DONE]` message. [Example Python + code](https://cookbook.openai.com/examples/how_to_stream_completions). + type: boolean + nullable: true + default: false + stream_options: + $ref: "#/components/schemas/ChatCompletionStreamOptions" + temperature: + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + nullable: true + description: > + What sampling temperature to use, between 0 and 2. Higher values + like 0.8 will make the output more random, while lower values like + 0.2 will make it more focused and deterministic. + + + We generally recommend altering this or `top_p` but not both. + top_p: + type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + nullable: true + description: > + An alternative to sampling with temperature, called nucleus + sampling, where the model considers the results of the tokens with + top_p probability mass. So 0.1 means only the tokens comprising the + top 10% probability mass are considered. + + + We generally recommend altering this or `temperature` but not both. + tools: + type: array + description: > + A list of tools the model may call. Currently, only functions are + supported as a tool. Use this to provide a list of functions the + model may generate JSON inputs for. A max of 128 functions are + supported. + items: + $ref: "#/components/schemas/ChatCompletionTool" + tool_choice: + $ref: "#/components/schemas/ChatCompletionToolChoiceOption" + parallel_tool_calls: + $ref: "#/components/schemas/ParallelToolCalls" + user: + type: string + example: user-1234 + description: > + A unique identifier representing your end-user, which can help + OpenAI to monitor and detect abuse. [Learn + more](/docs/guides/safety-best-practices/end-user-ids). + function_call: + deprecated: true + description: > + Deprecated in favor of `tool_choice`. + + + Controls which (if any) function is called by the model. + + `none` means the model will not call a function and instead + generates a message. + + `auto` means the model can pick between generating a message or + calling a function. + + Specifying a particular function via `{"name": "my_function"}` + forces the model to call that function. + + + `none` is the default when no functions are present. `auto` is the + default if functions are present. + oneOf: + - type: string + description: > + `none` means the model will not call a function and instead + generates a message. `auto` means the model can pick between + generating a message or calling a function. + enum: + - none + - auto + - $ref: "#/components/schemas/ChatCompletionFunctionCallOption" + x-oaiExpandable: true + functions: + deprecated: true + description: | + Deprecated in favor of `tools`. + + A list of functions the model may generate JSON inputs for. + type: array + minItems: 1 + maxItems: 128 + items: + $ref: "#/components/schemas/ChatCompletionFunctions" + required: + - model + - messages + CreateChatCompletionResponse: + type: object + description: Represents a chat completion response returned by model, based on + the provided input. + properties: + id: + type: string + description: A unique identifier for the chat completion. + choices: + type: array + description: A list of chat completion choices. Can be more than one if `n` is + greater than 1. + items: + type: object + required: + - finish_reason + - index + - message + - logprobs + properties: + finish_reason: + type: string + description: > + The reason the model stopped generating tokens. This will be + `stop` if the model hit a natural stop point or a provided + stop sequence, + + `length` if the maximum number of tokens specified in the + request was reached, + + `content_filter` if content was omitted due to a flag from our + content filters, + + `tool_calls` if the model called a tool, or `function_call` + (deprecated) if the model called a function. + enum: + - stop + - length + - tool_calls + - content_filter + - function_call + index: + type: integer + description: The index of the choice in the list of choices. + message: + $ref: "#/components/schemas/ChatCompletionResponseMessage" + logprobs: + description: Log probability information for the choice. + type: object + nullable: true + properties: + content: + description: A list of message content tokens with log probability information. + type: array + items: + $ref: "#/components/schemas/ChatCompletionTokenLogprob" + nullable: true + refusal: + description: A list of message refusal tokens with log probability information. + type: array + items: + $ref: "#/components/schemas/ChatCompletionTokenLogprob" + nullable: true + required: + - content + - refusal + created: + type: integer + description: The Unix timestamp (in seconds) of when the chat completion was + created. + model: + type: string + description: The model used for the chat completion. + service_tier: + description: The service tier used for processing the request. This field is + only included if the `service_tier` parameter is specified in the + request. + type: string + enum: + - scale + - default + example: scale + nullable: true + system_fingerprint: + type: string + description: > + This fingerprint represents the backend configuration that the model + runs with. + + + Can be used in conjunction with the `seed` request parameter to + understand when backend changes have been made that might impact + determinism. + object: + type: string + description: The object type, which is always `chat.completion`. + enum: + - chat.completion + usage: + $ref: "#/components/schemas/CompletionUsage" + required: + - choices + - created + - id + - model + - object + x-oaiMeta: + name: The chat completion object + group: chat + example: | + { + "id": "chatcmpl-123456", + "object": "chat.completion", + "created": 1728933352, + "model": "gpt-4o-2024-08-06", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "Hi there! How can I assist you today?", + "refusal": null + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 19, + "completion_tokens": 10, + "total_tokens": 29, + "prompt_tokens_details": { + "cached_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0 + } + }, + "system_fingerprint": "fp_6b68a8204b" + } + CreateChatCompletionStreamResponse: + type: object + description: Represents a streamed chunk of a chat completion response returned + by model, based on the provided input. + properties: + id: + type: string + description: A unique identifier for the chat completion. Each chunk has the + same ID. + choices: + type: array + description: > + A list of chat completion choices. Can contain more than one + elements if `n` is greater than 1. Can also be empty for the + + last chunk if you set `stream_options: {"include_usage": true}`. + items: + type: object + required: + - delta + - finish_reason + - index + properties: + delta: + $ref: "#/components/schemas/ChatCompletionStreamResponseDelta" + logprobs: + description: Log probability information for the choice. + type: object + nullable: true + properties: + content: + description: A list of message content tokens with log probability information. + type: array + items: + $ref: "#/components/schemas/ChatCompletionTokenLogprob" + nullable: true + refusal: + description: A list of message refusal tokens with log probability information. + type: array + items: + $ref: "#/components/schemas/ChatCompletionTokenLogprob" + nullable: true + required: + - content + - refusal + finish_reason: + type: string + description: > + The reason the model stopped generating tokens. This will be + `stop` if the model hit a natural stop point or a provided + stop sequence, + + `length` if the maximum number of tokens specified in the + request was reached, + + `content_filter` if content was omitted due to a flag from our + content filters, + + `tool_calls` if the model called a tool, or `function_call` + (deprecated) if the model called a function. + enum: + - stop + - length + - tool_calls + - content_filter + - function_call + nullable: true + index: + type: integer + description: The index of the choice in the list of choices. + created: + type: integer + description: The Unix timestamp (in seconds) of when the chat completion was + created. Each chunk has the same timestamp. + model: + type: string + description: The model to generate the completion. + service_tier: + description: The service tier used for processing the request. This field is + only included if the `service_tier` parameter is specified in the + request. + type: string + enum: + - scale + - default + example: scale + nullable: true + system_fingerprint: + type: string + description: > + This fingerprint represents the backend configuration that the model + runs with. + + Can be used in conjunction with the `seed` request parameter to + understand when backend changes have been made that might impact + determinism. + object: + type: string + description: The object type, which is always `chat.completion.chunk`. + enum: + - chat.completion.chunk + usage: + type: object + description: > + An optional field that will only be present when you set + `stream_options: {"include_usage": true}` in your request. + + When present, it contains a null value except for the last chunk + which contains the token usage statistics for the entire request. + properties: + completion_tokens: + type: integer + description: Number of tokens in the generated completion. + prompt_tokens: + type: integer + description: Number of tokens in the prompt. + total_tokens: + type: integer + description: Total number of tokens used in the request (prompt + completion). + required: + - prompt_tokens + - completion_tokens + - total_tokens + required: + - choices + - created + - id + - model + - object + x-oaiMeta: + name: The chat completion chunk object + group: chat + example: > + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]} + + + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}]} + + + .... + + + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} + CreateCompletionRequest: + type: object + properties: + model: + description: > + ID of the model to use. You can use the [List + models](/docs/api-reference/models/list) API to see all of your + available models, or see our [Model overview](/docs/models/overview) + for descriptions of them. + anyOf: + - type: string + - type: string + enum: + - gpt-3.5-turbo-instruct + - davinci-002 + - babbage-002 + x-oaiTypeLabel: string + prompt: + description: > + The prompt(s) to generate completions for, encoded as a string, + array of strings, array of tokens, or array of token arrays. + + + Note that <|endoftext|> is the document separator that the model + sees during training, so if a prompt is not specified the model will + generate as if from the beginning of a new document. + default: <|endoftext|> + nullable: true + oneOf: + - type: string + default: "" + example: This is a test. + - type: array + items: + type: string + default: "" + example: This is a test. + - type: array + minItems: 1 + items: + type: integer + example: "[1212, 318, 257, 1332, 13]" + - type: array + minItems: 1 + items: + type: array + minItems: 1 + items: + type: integer + example: "[[1212, 318, 257, 1332, 13]]" + best_of: + type: integer + default: 1 + minimum: 0 + maximum: 20 + nullable: true + description: > + Generates `best_of` completions server-side and returns the "best" + (the one with the highest log probability per token). Results cannot + be streamed. + + + When used with `n`, `best_of` controls the number of candidate + completions and `n` specifies how many to return – `best_of` must be + greater than `n`. + + + **Note:** Because this parameter generates many completions, it can + quickly consume your token quota. Use carefully and ensure that you + have reasonable settings for `max_tokens` and `stop`. + echo: + type: boolean + default: false + nullable: true + description: | + Echo back the prompt in addition to the completion + frequency_penalty: + type: number + default: 0 + minimum: -2 + maximum: 2 + nullable: true + description: > + Number between -2.0 and 2.0. Positive values penalize new tokens + based on their existing frequency in the text so far, decreasing the + model's likelihood to repeat the same line verbatim. + + + [See more information about frequency and presence + penalties.](/docs/guides/text-generation/parameter-details) + logit_bias: + type: object + x-oaiTypeLabel: map + default: null + nullable: true + additionalProperties: + type: integer + description: > + Modify the likelihood of specified tokens appearing in the + completion. + + + Accepts a JSON object that maps tokens (specified by their token ID + in the GPT tokenizer) to an associated bias value from -100 to 100. + You can use this [tokenizer tool](/tokenizer?view=bpe) to convert + text to token IDs. Mathematically, the bias is added to the logits + generated by the model prior to sampling. The exact effect will vary + per model, but values between -1 and 1 should decrease or increase + likelihood of selection; values like -100 or 100 should result in a + ban or exclusive selection of the relevant token. + + + As an example, you can pass `{"50256": -100}` to prevent the + <|endoftext|> token from being generated. + logprobs: + type: integer + minimum: 0 + maximum: 5 + default: null + nullable: true + description: > + Include the log probabilities on the `logprobs` most likely output + tokens, as well the chosen tokens. For example, if `logprobs` is 5, + the API will return a list of the 5 most likely tokens. The API will + always return the `logprob` of the sampled token, so there may be up + to `logprobs+1` elements in the response. + + + The maximum value for `logprobs` is 5. + max_tokens: + type: integer + minimum: 0 + default: 16 + example: 16 + nullable: true + description: > + The maximum number of [tokens](/tokenizer) that can be generated in + the completion. + + + The token count of your prompt plus `max_tokens` cannot exceed the + model's context length. [Example Python + code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) + for counting tokens. + n: + type: integer + minimum: 1 + maximum: 128 + default: 1 + example: 1 + nullable: true + description: > + How many completions to generate for each prompt. + + + **Note:** Because this parameter generates many completions, it can + quickly consume your token quota. Use carefully and ensure that you + have reasonable settings for `max_tokens` and `stop`. + presence_penalty: + type: number + default: 0 + minimum: -2 + maximum: 2 + nullable: true + description: > + Number between -2.0 and 2.0. Positive values penalize new tokens + based on whether they appear in the text so far, increasing the + model's likelihood to talk about new topics. + + + [See more information about frequency and presence + penalties.](/docs/guides/text-generation/parameter-details) + seed: + type: integer + minimum: -9223372036854776000 + maximum: 9223372036854776000 + nullable: true + description: > + If specified, our system will make a best effort to sample + deterministically, such that repeated requests with the same `seed` + and parameters should return the same result. + + + Determinism is not guaranteed, and you should refer to the + `system_fingerprint` response parameter to monitor changes in the + backend. + stop: + description: > + Up to 4 sequences where the API will stop generating further tokens. + The returned text will not contain the stop sequence. + default: null + nullable: true + oneOf: + - type: string + default: <|endoftext|> + example: "\n" + nullable: true + - type: array + minItems: 1 + maxItems: 4 + items: + type: string + example: '["\n"]' + stream: + description: > + Whether to stream back partial progress. If set, tokens will be sent + as data-only [server-sent + events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) + as they become available, with the stream terminated by a `data: + [DONE]` message. [Example Python + code](https://cookbook.openai.com/examples/how_to_stream_completions). + type: boolean + nullable: true + default: false + stream_options: + $ref: "#/components/schemas/ChatCompletionStreamOptions" + suffix: + description: | + The suffix that comes after a completion of inserted text. + + This parameter is only supported for `gpt-3.5-turbo-instruct`. + default: null + nullable: true + type: string + example: test. + temperature: + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + nullable: true + description: > + What sampling temperature to use, between 0 and 2. Higher values + like 0.8 will make the output more random, while lower values like + 0.2 will make it more focused and deterministic. + + + We generally recommend altering this or `top_p` but not both. + top_p: + type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + nullable: true + description: > + An alternative to sampling with temperature, called nucleus + sampling, where the model considers the results of the tokens with + top_p probability mass. So 0.1 means only the tokens comprising the + top 10% probability mass are considered. + + + We generally recommend altering this or `temperature` but not both. + user: + type: string + example: user-1234 + description: > + A unique identifier representing your end-user, which can help + OpenAI to monitor and detect abuse. [Learn + more](/docs/guides/safety-best-practices/end-user-ids). + required: + - model + - prompt + CreateCompletionResponse: + type: object + description: > + Represents a completion response from the API. Note: both the streamed + and non-streamed response objects share the same shape (unlike the chat + endpoint). + properties: + id: + type: string + description: A unique identifier for the completion. + choices: + type: array + description: The list of completion choices the model generated for the input + prompt. + items: + type: object + required: + - finish_reason + - index + - logprobs + - text + properties: + finish_reason: + type: string + description: > + The reason the model stopped generating tokens. This will be + `stop` if the model hit a natural stop point or a provided + stop sequence, + + `length` if the maximum number of tokens specified in the + request was reached, + + or `content_filter` if content was omitted due to a flag from + our content filters. + enum: + - stop + - length + - content_filter + index: + type: integer + logprobs: + type: object + nullable: true + properties: + text_offset: + type: array + items: + type: integer + token_logprobs: + type: array + items: + type: number + tokens: + type: array + items: + type: string + top_logprobs: + type: array + items: + type: object + additionalProperties: + type: number + text: + type: string + created: + type: integer + description: The Unix timestamp (in seconds) of when the completion was created. + model: + type: string + description: The model used for completion. + system_fingerprint: + type: string + description: > + This fingerprint represents the backend configuration that the model + runs with. + + + Can be used in conjunction with the `seed` request parameter to + understand when backend changes have been made that might impact + determinism. + object: + type: string + description: The object type, which is always "text_completion" + enum: + - text_completion + usage: + $ref: "#/components/schemas/CompletionUsage" + required: + - id + - object + - created + - model + - choices + x-oaiMeta: + name: The completion object + legacy: true + example: | + { + "id": "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7", + "object": "text_completion", + "created": 1589478378, + "model": "gpt-4-turbo", + "choices": [ + { + "text": "\n\nThis is indeed a test", + "index": 0, + "logprobs": null, + "finish_reason": "length" + } + ], + "usage": { + "prompt_tokens": 5, + "completion_tokens": 7, + "total_tokens": 12 + } + } + CreateEmbeddingRequest: + type: object + additionalProperties: false + properties: + input: + description: > + Input text to embed, encoded as a string or array of tokens. To + embed multiple inputs in a single request, pass an array of strings + or array of token arrays. The input must not exceed the max input + tokens for the model (8192 tokens for `text-embedding-ada-002`), + cannot be an empty string, and any array must be 2048 dimensions or + less. [Example Python + code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) + for counting tokens. + example: The quick brown fox jumped over the lazy dog + oneOf: + - type: string + title: string + description: The string that will be turned into an embedding. + default: "" + example: This is a test. + - type: array + title: array + description: The array of strings that will be turned into an embedding. + minItems: 1 + maxItems: 2048 + items: + type: string + default: "" + example: "['This is a test.']" + - type: array + title: array + description: The array of integers that will be turned into an embedding. + minItems: 1 + maxItems: 2048 + items: + type: integer + example: "[1212, 318, 257, 1332, 13]" + - type: array + title: array + description: The array of arrays containing integers that will be turned into an + embedding. + minItems: 1 + maxItems: 2048 + items: + type: array + minItems: 1 + items: + type: integer + example: "[[1212, 318, 257, 1332, 13]]" + x-oaiExpandable: true + model: + description: > + ID of the model to use. You can use the [List + models](/docs/api-reference/models/list) API to see all of your + available models, or see our [Model overview](/docs/models/overview) + for descriptions of them. + example: text-embedding-3-small + anyOf: + - type: string + - type: string + enum: + - text-embedding-ada-002 + - text-embedding-3-small + - text-embedding-3-large + x-oaiTypeLabel: string + encoding_format: + description: The format to return the embeddings in. Can be either `float` or + [`base64`](https://pypi.org/project/pybase64/). + example: float + default: float + type: string + enum: + - float + - base64 + dimensions: + description: > + The number of dimensions the resulting output embeddings should + have. Only supported in `text-embedding-3` and later models. + type: integer + minimum: 1 + user: + type: string + example: user-1234 + description: > + A unique identifier representing your end-user, which can help + OpenAI to monitor and detect abuse. [Learn + more](/docs/guides/safety-best-practices/end-user-ids). + required: + - model + - input + CreateEmbeddingResponse: + type: object + properties: + data: + type: array + description: The list of embeddings generated by the model. + items: + $ref: "#/components/schemas/Embedding" + model: + type: string + description: The name of the model used to generate the embedding. + object: + type: string + description: The object type, which is always "list". + enum: + - list + usage: + type: object + description: The usage information for the request. + properties: + prompt_tokens: + type: integer + description: The number of tokens used by the prompt. + total_tokens: + type: integer + description: The total number of tokens used by the request. + required: + - prompt_tokens + - total_tokens + required: + - object + - model + - data + - usage + CreateFileRequest: + type: object + additionalProperties: false + properties: + file: + description: | + The File object (not file name) to be uploaded. + type: string + format: binary + purpose: + description: > + The intended purpose of the uploaded file. + + + Use "assistants" for [Assistants](/docs/api-reference/assistants) + and [Message](/docs/api-reference/messages) files, "vision" for + Assistants image file inputs, "batch" for [Batch + API](/docs/guides/batch), and "fine-tune" for + [Fine-tuning](/docs/api-reference/fine-tuning). + type: string + enum: + - assistants + - batch + - fine-tune + - vision + required: + - file + - purpose + CreateFineTuningJobRequest: + type: object + properties: + model: + description: > + The name of the model to fine-tune. You can select one of the + + [supported + models](/docs/guides/fine-tuning/which-models-can-be-fine-tuned). + example: gpt-4o-mini + anyOf: + - type: string + - type: string + enum: + - babbage-002 + - davinci-002 + - gpt-3.5-turbo + - gpt-4o-mini + x-oaiTypeLabel: string + training_file: + description: > + The ID of an uploaded file that contains training data. + + + See [upload file](/docs/api-reference/files/create) for how to + upload a file. + + + Your dataset must be formatted as a JSONL file. Additionally, you + must upload your file with the purpose `fine-tune`. + + + The contents of the file should differ depending on if the model + uses the [chat](/docs/api-reference/fine-tuning/chat-input) or + [completions](/docs/api-reference/fine-tuning/completions-input) + format. + + + See the [fine-tuning guide](/docs/guides/fine-tuning) for more + details. + type: string + example: file-abc123 + hyperparameters: + type: object + description: The hyperparameters used for the fine-tuning job. + properties: + batch_size: + description: > + Number of examples in each batch. A larger batch size means that + model parameters + + are updated less frequently, but with lower variance. + oneOf: + - type: string + enum: + - auto + - type: integer + minimum: 1 + maximum: 256 + default: auto + learning_rate_multiplier: + description: > + Scaling factor for the learning rate. A smaller learning rate + may be useful to avoid + + overfitting. + oneOf: + - type: string + enum: + - auto + - type: number + minimum: 0 + exclusiveMinimum: true + default: auto + n_epochs: + description: > + The number of epochs to train the model for. An epoch refers to + one full cycle + + through the training dataset. + oneOf: + - type: string + enum: + - auto + - type: integer + minimum: 1 + maximum: 50 + default: auto + suffix: + description: > + A string of up to 64 characters that will be added to your + fine-tuned model name. + + + For example, a `suffix` of "custom-model-name" would produce a model + name like `ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`. + type: string + minLength: 1 + maxLength: 64 + default: null + nullable: true + validation_file: + description: > + The ID of an uploaded file that contains validation data. + + + If you provide this file, the data is used to generate validation + + metrics periodically during fine-tuning. These metrics can be viewed + in + + the fine-tuning results file. + + The same data should not be present in both train and validation + files. + + + Your dataset must be formatted as a JSONL file. You must upload your + file with the purpose `fine-tune`. + + + See the [fine-tuning guide](/docs/guides/fine-tuning) for more + details. + type: string + nullable: true + example: file-abc123 + integrations: + type: array + description: A list of integrations to enable for your fine-tuning job. + nullable: true + items: + type: object + required: + - type + - wandb + properties: + type: + description: > + The type of integration to enable. Currently, only "wandb" + (Weights and Biases) is supported. + oneOf: + - type: string + enum: + - wandb + wandb: + type: object + description: > + The settings for your integration with Weights and Biases. + This payload specifies the project that + + metrics will be sent to. Optionally, you can set an explicit + display name for your run, add tags + + to your run, and set a default entity (team, username, etc) to + be associated with your run. + required: + - project + properties: + project: + description: > + The name of the project that the new run will be created + under. + type: string + example: my-wandb-project + name: + description: > + A display name to set for the run. If not set, we will use + the Job ID as the name. + nullable: true + type: string + entity: + description: > + The entity to use for the run. This allows you to set the + team or username of the WandB user that you would + + like associated with the run. If not set, the default + entity for the registered WandB API key is used. + nullable: true + type: string + tags: + description: > + A list of tags to be attached to the newly created run. + These tags are passed through directly to WandB. Some + + default tags are generated by OpenAI: "openai/finetune", + "openai/{base-model}", "openai/{ftjob-abcdef}". + type: array + items: + type: string + example: custom-tag + seed: + description: > + The seed controls the reproducibility of the job. Passing in the + same seed and job parameters should produce the same results, but + may differ in rare cases. + + If a seed is not specified, one will be generated for you. + type: integer + nullable: true + minimum: 0 + maximum: 2147483647 + example: 42 + required: + - model + - training_file + CreateImageEditRequest: + type: object + properties: + image: + description: The image to edit. Must be a valid PNG file, less than 4MB, and + square. If mask is not provided, image must have transparency, which + will be used as the mask. + type: string + format: binary + prompt: + description: A text description of the desired image(s). The maximum length is + 1000 characters. + type: string + example: A cute baby sea otter wearing a beret + mask: + description: An additional image whose fully transparent areas (e.g. where alpha + is zero) indicate where `image` should be edited. Must be a valid + PNG file, less than 4MB, and have the same dimensions as `image`. + type: string + format: binary + model: + anyOf: + - type: string + - type: string + enum: + - dall-e-2 + x-oaiTypeLabel: string + default: dall-e-2 + example: dall-e-2 + nullable: true + description: The model to use for image generation. Only `dall-e-2` is supported + at this time. + n: + type: integer + minimum: 1 + maximum: 10 + default: 1 + example: 1 + nullable: true + description: The number of images to generate. Must be between 1 and 10. + size: + type: string + enum: + - 256x256 + - 512x512 + - 1024x1024 + default: 1024x1024 + example: 1024x1024 + nullable: true + description: The size of the generated images. Must be one of `256x256`, + `512x512`, or `1024x1024`. + response_format: + type: string + enum: + - url + - b64_json + default: url + example: url + nullable: true + description: The format in which the generated images are returned. Must be one + of `url` or `b64_json`. URLs are only valid for 60 minutes after the + image has been generated. + user: + type: string + example: user-1234 + description: > + A unique identifier representing your end-user, which can help + OpenAI to monitor and detect abuse. [Learn + more](/docs/guides/safety-best-practices/end-user-ids). + required: + - prompt + - image + CreateImageRequest: + type: object + properties: + prompt: + description: A text description of the desired image(s). The maximum length is + 1000 characters for `dall-e-2` and 4000 characters for `dall-e-3`. + type: string + example: A cute baby sea otter + model: + anyOf: + - type: string + - type: string + enum: + - dall-e-2 + - dall-e-3 + x-oaiTypeLabel: string + default: dall-e-2 + example: dall-e-3 + nullable: true + description: The model to use for image generation. + n: + type: integer + minimum: 1 + maximum: 10 + default: 1 + example: 1 + nullable: true + description: The number of images to generate. Must be between 1 and 10. For + `dall-e-3`, only `n=1` is supported. + quality: + type: string + enum: + - standard + - hd + default: standard + example: standard + description: The quality of the image that will be generated. `hd` creates + images with finer details and greater consistency across the image. + This param is only supported for `dall-e-3`. + response_format: + type: string + enum: + - url + - b64_json + default: url + example: url + nullable: true + description: The format in which the generated images are returned. Must be one + of `url` or `b64_json`. URLs are only valid for 60 minutes after the + image has been generated. + size: + type: string + enum: + - 256x256 + - 512x512 + - 1024x1024 + - 1792x1024 + - 1024x1792 + default: 1024x1024 + example: 1024x1024 + nullable: true + description: The size of the generated images. Must be one of `256x256`, + `512x512`, or `1024x1024` for `dall-e-2`. Must be one of + `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3` models. + style: + type: string + enum: + - vivid + - natural + default: vivid + example: vivid + nullable: true + description: The style of the generated images. Must be one of `vivid` or + `natural`. Vivid causes the model to lean towards generating + hyper-real and dramatic images. Natural causes the model to produce + more natural, less hyper-real looking images. This param is only + supported for `dall-e-3`. + user: + type: string + example: user-1234 + description: > + A unique identifier representing your end-user, which can help + OpenAI to monitor and detect abuse. [Learn + more](/docs/guides/safety-best-practices/end-user-ids). + required: + - prompt + CreateImageVariationRequest: + type: object + properties: + image: + description: The image to use as the basis for the variation(s). Must be a valid + PNG file, less than 4MB, and square. + type: string + format: binary + model: + anyOf: + - type: string + - type: string + enum: + - dall-e-2 + x-oaiTypeLabel: string + default: dall-e-2 + example: dall-e-2 + nullable: true + description: The model to use for image generation. Only `dall-e-2` is supported + at this time. + n: + type: integer + minimum: 1 + maximum: 10 + default: 1 + example: 1 + nullable: true + description: The number of images to generate. Must be between 1 and 10. For + `dall-e-3`, only `n=1` is supported. + response_format: + type: string + enum: + - url + - b64_json + default: url + example: url + nullable: true + description: The format in which the generated images are returned. Must be one + of `url` or `b64_json`. URLs are only valid for 60 minutes after the + image has been generated. + size: + type: string + enum: + - 256x256 + - 512x512 + - 1024x1024 + default: 1024x1024 + example: 1024x1024 + nullable: true + description: The size of the generated images. Must be one of `256x256`, + `512x512`, or `1024x1024`. + user: + type: string + example: user-1234 + description: > + A unique identifier representing your end-user, which can help + OpenAI to monitor and detect abuse. [Learn + more](/docs/guides/safety-best-practices/end-user-ids). + required: + - image + CreateMessageRequest: + type: object + additionalProperties: false + required: + - role + - content + properties: + role: + type: string + enum: + - user + - assistant + description: > + The role of the entity that is creating the message. Allowed values + include: + + - `user`: Indicates the message is sent by an actual user and should + be used in most cases to represent user-generated messages. + + - `assistant`: Indicates the message is generated by the assistant. + Use this value to insert messages from the assistant into the + conversation. + content: + oneOf: + - type: string + description: The text contents of the message. + title: Text content + - type: array + description: An array of content parts with a defined type, each can be of type + `text` or images can be passed with `image_url` or `image_file`. + Image types are only supported on [Vision-compatible + models](/docs/models/overview). + title: Array of content parts + items: + oneOf: + - $ref: "#/components/schemas/MessageContentImageFileObject" + - $ref: "#/components/schemas/MessageContentImageUrlObject" + - $ref: "#/components/schemas/MessageRequestContentTextObject" + x-oaiExpandable: true + minItems: 1 + x-oaiExpandable: true + attachments: + type: array + items: + type: object + properties: + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + description: The tools to add this file to. + type: array + items: + oneOf: + - $ref: "#/components/schemas/AssistantToolsCode" + - $ref: "#/components/schemas/AssistantToolsFileSearchTypeOnly" + x-oaiExpandable: true + description: A list of files attached to the message, and the tools they should + be added to. + required: + - file_id + - tools + nullable: true + metadata: + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be useful for storing additional information about the object in + a structured format. Keys can be a maximum of 64 characters long and + values can be a maximum of 512 characters long. + type: object + x-oaiTypeLabel: map + nullable: true + CreateModerationRequest: + type: object + properties: + input: + description: > + Input (or inputs) to classify. Can be a single string, an array of + strings, or + + an array of multi-modal input objects similar to other models. + oneOf: + - type: string + description: A string of text to classify for moderation. + default: "" + example: I want to kill them. + - type: array + description: An array of strings to classify for moderation. + items: + type: string + default: "" + example: I want to kill them. + - type: array + description: An array of multi-modal inputs to the moderation model. + items: + x-oaiExpandable: true + oneOf: + - type: object + description: An object describing an image to classify. + properties: + type: + description: Always `image_url`. + type: string + enum: + - image_url + image_url: + type: object + description: Contains either an image URL or a data URL for a base64 encoded + image. + properties: + url: + type: string + description: Either a URL of the image or the base64 encoded image data. + format: uri + example: https://example.com/image.jpg + required: + - url + required: + - type + - image_url + - type: object + description: An object describing text to classify. + properties: + type: + description: Always `text`. + type: string + enum: + - text + text: + description: A string of text to classify. + type: string + example: I want to kill them + required: + - type + - text + x-oaiExpandable: true + model: + description: | + The content moderation model you would like to use. Learn more in + [the moderation guide](/docs/guides/moderation), and learn about + available models [here](/docs/models/moderation). + nullable: false + default: omni-moderation-latest + example: omni-moderation-2024-09-26 + anyOf: + - type: string + - type: string + enum: + - omni-moderation-latest + - omni-moderation-2024-09-26 + - text-moderation-latest + - text-moderation-stable + x-oaiTypeLabel: string + required: + - input + CreateModerationResponse: + type: object + description: Represents if a given text input is potentially harmful. + properties: + id: + type: string + description: The unique identifier for the moderation request. + model: + type: string + description: The model used to generate the moderation results. + results: + type: array + description: A list of moderation objects. + items: + type: object + properties: + flagged: + type: boolean + description: Whether any of the below categories are flagged. + categories: + type: object + description: A list of the categories, and whether they are flagged or not. + properties: + hate: + type: boolean + description: Content that expresses, incites, or promotes hate based on race, + gender, ethnicity, religion, nationality, sexual + orientation, disability status, or caste. Hateful content + aimed at non-protected groups (e.g., chess players) is + harassment. + hate/threatening: + type: boolean + description: Hateful content that also includes violence or serious harm towards + the targeted group based on race, gender, ethnicity, + religion, nationality, sexual orientation, disability + status, or caste. + harassment: + type: boolean + description: Content that expresses, incites, or promotes harassing language + towards any target. + harassment/threatening: + type: boolean + description: Harassment content that also includes violence or serious harm + towards any target. + illicit: + type: boolean + description: Content that includes instructions or advice that facilitate the + planning or execution of wrongdoing, or that gives advice + or instruction on how to commit illicit acts. For example, + "how to shoplift" would fit this category. + illicit/violent: + type: boolean + description: Content that includes instructions or advice that facilitate the + planning or execution of wrongdoing that also includes + violence, or that gives advice or instruction on the + procurement of any weapon. + self-harm: + type: boolean + description: Content that promotes, encourages, or depicts acts of self-harm, + such as suicide, cutting, and eating disorders. + self-harm/intent: + type: boolean + description: Content where the speaker expresses that they are engaging or + intend to engage in acts of self-harm, such as suicide, + cutting, and eating disorders. + self-harm/instructions: + type: boolean + description: Content that encourages performing acts of self-harm, such as + suicide, cutting, and eating disorders, or that gives + instructions or advice on how to commit such acts. + sexual: + type: boolean + description: Content meant to arouse sexual excitement, such as the description + of sexual activity, or that promotes sexual services + (excluding sex education and wellness). + sexual/minors: + type: boolean + description: Sexual content that includes an individual who is under 18 years + old. + violence: + type: boolean + description: Content that depicts death, violence, or physical injury. + violence/graphic: + type: boolean + description: Content that depicts death, violence, or physical injury in graphic + detail. + required: + - hate + - hate/threatening + - harassment + - harassment/threatening + - illicit + - illicit/violent + - self-harm + - self-harm/intent + - self-harm/instructions + - sexual + - sexual/minors + - violence + - violence/graphic + category_scores: + type: object + description: A list of the categories along with their scores as predicted by + model. + properties: + hate: + type: number + description: The score for the category 'hate'. + hate/threatening: + type: number + description: The score for the category 'hate/threatening'. + harassment: + type: number + description: The score for the category 'harassment'. + harassment/threatening: + type: number + description: The score for the category 'harassment/threatening'. + illicit: + type: number + description: The score for the category 'illicit'. + illicit/violent: + type: number + description: The score for the category 'illicit/violent'. + self-harm: + type: number + description: The score for the category 'self-harm'. + self-harm/intent: + type: number + description: The score for the category 'self-harm/intent'. + self-harm/instructions: + type: number + description: The score for the category 'self-harm/instructions'. + sexual: + type: number + description: The score for the category 'sexual'. + sexual/minors: + type: number + description: The score for the category 'sexual/minors'. + violence: + type: number + description: The score for the category 'violence'. + violence/graphic: + type: number + description: The score for the category 'violence/graphic'. + required: + - hate + - hate/threatening + - harassment + - harassment/threatening + - illicit + - illicit/violent + - self-harm + - self-harm/intent + - self-harm/instructions + - sexual + - sexual/minors + - violence + - violence/graphic + category_applied_input_types: + type: object + description: A list of the categories along with the input type(s) that the + score applies to. + properties: + hate: + type: array + description: The applied input type(s) for the category 'hate'. + items: + type: string + enum: + - text + hate/threatening: + type: array + description: The applied input type(s) for the category 'hate/threatening'. + items: + type: string + enum: + - text + harassment: + type: array + description: The applied input type(s) for the category 'harassment'. + items: + type: string + enum: + - text + harassment/threatening: + type: array + description: The applied input type(s) for the category + 'harassment/threatening'. + items: + type: string + enum: + - text + illicit: + type: array + description: The applied input type(s) for the category 'illicit'. + items: + type: string + enum: + - text + illicit/violent: + type: array + description: The applied input type(s) for the category 'illicit/violent'. + items: + type: string + enum: + - text + self-harm: + type: array + description: The applied input type(s) for the category 'self-harm'. + items: + type: string + enum: + - text + - image + self-harm/intent: + type: array + description: The applied input type(s) for the category 'self-harm/intent'. + items: + type: string + enum: + - text + - image + self-harm/instructions: + type: array + description: The applied input type(s) for the category + 'self-harm/instructions'. + items: + type: string + enum: + - text + - image + sexual: + type: array + description: The applied input type(s) for the category 'sexual'. + items: + type: string + enum: + - text + - image + sexual/minors: + type: array + description: The applied input type(s) for the category 'sexual/minors'. + items: + type: string + enum: + - text + violence: + type: array + description: The applied input type(s) for the category 'violence'. + items: + type: string + enum: + - text + - image + violence/graphic: + type: array + description: The applied input type(s) for the category 'violence/graphic'. + items: + type: string + enum: + - text + - image + required: + - hate + - hate/threatening + - harassment + - harassment/threatening + - illicit + - illicit/violent + - self-harm + - self-harm/intent + - self-harm/instructions + - sexual + - sexual/minors + - violence + - violence/graphic + required: + - flagged + - categories + - category_scores + - category_applied_input_types + required: + - id + - model + - results + x-oaiMeta: + name: The moderation object + example: | + { + "id": "modr-0d9740456c391e43c445bf0f010940c7", + "model": "omni-moderation-latest", + "results": [ + { + "flagged": true, + "categories": { + "harassment": true, + "harassment/threatening": true, + "sexual": false, + "hate": false, + "hate/threatening": false, + "illicit": false, + "illicit/violent": false, + "self-harm/intent": false, + "self-harm/instructions": false, + "self-harm": false, + "sexual/minors": false, + "violence": true, + "violence/graphic": true + }, + "category_scores": { + "harassment": 0.8189693396524255, + "harassment/threatening": 0.804985420696006, + "sexual": 1.573112165348997e-6, + "hate": 0.007562942636942845, + "hate/threatening": 0.004208854591835476, + "illicit": 0.030535955153511665, + "illicit/violent": 0.008925306722380033, + "self-harm/intent": 0.00023023930975076432, + "self-harm/instructions": 0.0002293869201073356, + "self-harm": 0.012598046106750154, + "sexual/minors": 2.212566909570261e-8, + "violence": 0.9999992735124786, + "violence/graphic": 0.843064871157054 + }, + "category_applied_input_types": { + "harassment": [ + "text" + ], + "harassment/threatening": [ + "text" + ], + "sexual": [ + "text", + "image" + ], + "hate": [ + "text" + ], + "hate/threatening": [ + "text" + ], + "illicit": [ + "text" + ], + "illicit/violent": [ + "text" + ], + "self-harm/intent": [ + "text", + "image" + ], + "self-harm/instructions": [ + "text", + "image" + ], + "self-harm": [ + "text", + "image" + ], + "sexual/minors": [ + "text" + ], + "violence": [ + "text", + "image" + ], + "violence/graphic": [ + "text", + "image" + ] + } + } + ] + } + CreateRunRequest: + type: object + additionalProperties: false + properties: + assistant_id: + description: The ID of the [assistant](/docs/api-reference/assistants) to use to + execute this run. + type: string + model: + description: The ID of the [Model](/docs/api-reference/models) to be used to + execute this run. If a value is provided here, it will override the + model associated with the assistant. If not, the model associated + with the assistant will be used. + example: gpt-4o + anyOf: + - type: string + - type: string + enum: + - gpt-4o + - gpt-4o-2024-08-06 + - gpt-4o-2024-05-13 + - gpt-4o-2024-08-06 + - gpt-4o-mini + - gpt-4o-mini-2024-07-18 + - gpt-4-turbo + - gpt-4-turbo-2024-04-09 + - gpt-4-0125-preview + - gpt-4-turbo-preview + - gpt-4-1106-preview + - gpt-4-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-0613 + - gpt-3.5-turbo-1106 + - gpt-3.5-turbo-0125 + - gpt-3.5-turbo-16k-0613 + x-oaiTypeLabel: string + nullable: true + instructions: + description: Overrides the + [instructions](/docs/api-reference/assistants/createAssistant) of + the assistant. This is useful for modifying the behavior on a + per-run basis. + type: string + nullable: true + additional_instructions: + description: Appends additional instructions at the end of the instructions for + the run. This is useful for modifying the behavior on a per-run + basis without overriding other instructions. + type: string + nullable: true + additional_messages: + description: Adds additional messages to the thread before creating the run. + type: array + items: + $ref: "#/components/schemas/CreateMessageRequest" + nullable: true + tools: + description: Override the tools the assistant can use for this run. This is + useful for modifying the behavior on a per-run basis. + nullable: true + type: array + maxItems: 20 + items: + oneOf: + - $ref: "#/components/schemas/AssistantToolsCode" + - $ref: "#/components/schemas/AssistantToolsFileSearch" + - $ref: "#/components/schemas/AssistantToolsFunction" + x-oaiExpandable: true + metadata: + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be useful for storing additional information about the object in + a structured format. Keys can be a maximum of 64 characters long and + values can be a maximum of 512 characters long. + type: object + x-oaiTypeLabel: map + nullable: true + temperature: + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + nullable: true + description: > + What sampling temperature to use, between 0 and 2. Higher values + like 0.8 will make the output more random, while lower values like + 0.2 will make it more focused and deterministic. + top_p: + type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + nullable: true + description: > + An alternative to sampling with temperature, called nucleus + sampling, where the model considers the results of the tokens with + top_p probability mass. So 0.1 means only the tokens comprising the + top 10% probability mass are considered. + + + We generally recommend altering this or temperature but not both. + stream: + type: boolean + nullable: true + description: > + If `true`, returns a stream of events that happen during the Run as + server-sent events, terminating when the Run enters a terminal state + with a `data: [DONE]` message. + max_prompt_tokens: + type: integer + nullable: true + description: > + The maximum number of prompt tokens that may be used over the course + of the run. The run will make a best effort to use only the number + of prompt tokens specified, across multiple turns of the run. If the + run exceeds the number of prompt tokens specified, the run will end + with status `incomplete`. See `incomplete_details` for more info. + minimum: 256 + max_completion_tokens: + type: integer + nullable: true + description: > + The maximum number of completion tokens that may be used over the + course of the run. The run will make a best effort to use only the + number of completion tokens specified, across multiple turns of the + run. If the run exceeds the number of completion tokens specified, + the run will end with status `incomplete`. See `incomplete_details` + for more info. + minimum: 256 + truncation_strategy: + $ref: "#/components/schemas/TruncationObject" + nullable: true + tool_choice: + $ref: "#/components/schemas/AssistantsApiToolChoiceOption" + nullable: true + parallel_tool_calls: + $ref: "#/components/schemas/ParallelToolCalls" + response_format: + $ref: "#/components/schemas/AssistantsApiResponseFormatOption" + nullable: true + required: + - assistant_id + CreateSpeechRequest: + type: object + additionalProperties: false + properties: + model: + description: > + One of the available [TTS models](/docs/models/tts): `tts-1` or + `tts-1-hd` + anyOf: + - type: string + - type: string + enum: + - tts-1 + - tts-1-hd + x-oaiTypeLabel: string + input: + type: string + description: The text to generate audio for. The maximum length is 4096 + characters. + maxLength: 4096 + voice: + description: The voice to use when generating the audio. Supported voices are + `alloy`, `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of + the voices are available in the [Text to speech + guide](/docs/guides/text-to-speech/voice-options). + type: string + enum: + - alloy + - echo + - fable + - onyx + - nova + - shimmer + response_format: + description: The format to audio in. Supported formats are `mp3`, `opus`, `aac`, + `flac`, `wav`, and `pcm`. + default: mp3 + type: string + enum: + - mp3 + - opus + - aac + - flac + - wav + - pcm + speed: + description: The speed of the generated audio. Select a value from `0.25` to + `4.0`. `1.0` is the default. + type: number + default: 1 + minimum: 0.25 + maximum: 4 + required: + - model + - input + - voice + CreateThreadAndRunRequest: + type: object + additionalProperties: false + properties: + assistant_id: + description: The ID of the [assistant](/docs/api-reference/assistants) to use to + execute this run. + type: string + thread: + $ref: "#/components/schemas/CreateThreadRequest" + description: If no thread is provided, an empty thread will be created. + model: + description: The ID of the [Model](/docs/api-reference/models) to be used to + execute this run. If a value is provided here, it will override the + model associated with the assistant. If not, the model associated + with the assistant will be used. + example: gpt-4o + anyOf: + - type: string + - type: string + enum: + - gpt-4o + - gpt-4o-2024-08-06 + - gpt-4o-2024-05-13 + - gpt-4o-2024-08-06 + - gpt-4o-mini + - gpt-4o-mini-2024-07-18 + - gpt-4-turbo + - gpt-4-turbo-2024-04-09 + - gpt-4-0125-preview + - gpt-4-turbo-preview + - gpt-4-1106-preview + - gpt-4-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-0613 + - gpt-3.5-turbo-1106 + - gpt-3.5-turbo-0125 + - gpt-3.5-turbo-16k-0613 + x-oaiTypeLabel: string + nullable: true + instructions: + description: Override the default system message of the assistant. This is + useful for modifying the behavior on a per-run basis. + type: string + nullable: true + tools: + description: Override the tools the assistant can use for this run. This is + useful for modifying the behavior on a per-run basis. + nullable: true + type: array + maxItems: 20 + items: + oneOf: + - $ref: "#/components/schemas/AssistantToolsCode" + - $ref: "#/components/schemas/AssistantToolsFileSearch" + - $ref: "#/components/schemas/AssistantToolsFunction" + tool_resources: + type: object + description: > + A set of resources that are used by the assistant's tools. The + resources are specific to the type of tool. For example, the + `code_interpreter` tool requires a list of file IDs, while the + `file_search` tool requires a list of vector store IDs. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter` tool. There can be a + maximum of 20 files associated with the tool. + default: [ ] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The ID of the [vector + store](/docs/api-reference/vector-stores/object) attached to + this assistant. There can be a maximum of 1 vector store + attached to the assistant. + maxItems: 1 + items: + type: string + nullable: true + metadata: + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be useful for storing additional information about the object in + a structured format. Keys can be a maximum of 64 characters long and + values can be a maximum of 512 characters long. + type: object + x-oaiTypeLabel: map + nullable: true + temperature: + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + nullable: true + description: > + What sampling temperature to use, between 0 and 2. Higher values + like 0.8 will make the output more random, while lower values like + 0.2 will make it more focused and deterministic. + top_p: + type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + nullable: true + description: > + An alternative to sampling with temperature, called nucleus + sampling, where the model considers the results of the tokens with + top_p probability mass. So 0.1 means only the tokens comprising the + top 10% probability mass are considered. + + + We generally recommend altering this or temperature but not both. + stream: + type: boolean + nullable: true + description: > + If `true`, returns a stream of events that happen during the Run as + server-sent events, terminating when the Run enters a terminal state + with a `data: [DONE]` message. + max_prompt_tokens: + type: integer + nullable: true + description: > + The maximum number of prompt tokens that may be used over the course + of the run. The run will make a best effort to use only the number + of prompt tokens specified, across multiple turns of the run. If the + run exceeds the number of prompt tokens specified, the run will end + with status `incomplete`. See `incomplete_details` for more info. + minimum: 256 + max_completion_tokens: + type: integer + nullable: true + description: > + The maximum number of completion tokens that may be used over the + course of the run. The run will make a best effort to use only the + number of completion tokens specified, across multiple turns of the + run. If the run exceeds the number of completion tokens specified, + the run will end with status `incomplete`. See `incomplete_details` + for more info. + minimum: 256 + truncation_strategy: + $ref: "#/components/schemas/TruncationObject" + nullable: true + tool_choice: + $ref: "#/components/schemas/AssistantsApiToolChoiceOption" + nullable: true + parallel_tool_calls: + $ref: "#/components/schemas/ParallelToolCalls" + response_format: + $ref: "#/components/schemas/AssistantsApiResponseFormatOption" + nullable: true + required: + - assistant_id + CreateThreadRequest: + type: object + additionalProperties: false + properties: + messages: + description: A list of [messages](/docs/api-reference/messages) to start the + thread with. + type: array + items: + $ref: "#/components/schemas/CreateMessageRequest" + tool_resources: + type: object + description: > + A set of resources that are made available to the assistant's tools + in this thread. The resources are specific to the type of tool. For + example, the `code_interpreter` tool requires a list of file IDs, + while the `file_search` tool requires a list of vector store IDs. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter` tool. There can be a + maximum of 20 files associated with the tool. + default: [ ] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The [vector store](/docs/api-reference/vector-stores/object) + attached to this thread. There can be a maximum of 1 vector + store attached to the thread. + maxItems: 1 + items: + type: string + vector_stores: + type: array + description: > + A helper to create a [vector + store](/docs/api-reference/vector-stores/object) with + file_ids and attach it to this thread. There can be a + maximum of 1 vector store attached to the thread. + maxItems: 1 + items: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs to add + to the vector store. There can be a maximum of 10000 + files in a vector store. + maxItems: 10000 + items: + type: string + chunking_strategy: + type: object + description: The chunking strategy used to chunk the file(s). If not set, will + use the `auto` strategy. + oneOf: + - type: object + title: Auto Chunking Strategy + description: The default strategy. This strategy currently uses a + `max_chunk_size_tokens` of `800` and + `chunk_overlap_tokens` of `400`. + additionalProperties: false + properties: + type: + type: string + description: Always `auto`. + enum: + - auto + required: + - type + - type: object + title: Static Chunking Strategy + additionalProperties: false + properties: + type: + type: string + description: Always `static`. + enum: + - static + static: + type: object + additionalProperties: false + properties: + max_chunk_size_tokens: + type: integer + minimum: 100 + maximum: 4096 + description: The maximum number of tokens in each chunk. The default value is + `800`. The minimum value is `100` and the + maximum value is `4096`. + chunk_overlap_tokens: + type: integer + description: > + The number of tokens that overlap between + chunks. The default value is `400`. + + + Note that the overlap must not exceed half + of `max_chunk_size_tokens`. + required: + - max_chunk_size_tokens + - chunk_overlap_tokens + required: + - type + - static + x-oaiExpandable: true + metadata: + type: object + description: > + Set of 16 key-value pairs that can be attached to a + vector store. This can be useful for storing + additional information about the vector store in a + structured format. Keys can be a maximum of 64 + characters long and values can be a maximum of 512 + characters long. + x-oaiTypeLabel: map + x-oaiExpandable: true + oneOf: + - required: + - vector_store_ids + - required: + - vector_stores + nullable: true + metadata: + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be useful for storing additional information about the object in + a structured format. Keys can be a maximum of 64 characters long and + values can be a maximum of 512 characters long. + type: object + x-oaiTypeLabel: map + nullable: true + CreateTranscriptionRequest: + type: object + additionalProperties: false + properties: + file: + description: > + The audio file object (not file name) to transcribe, in one of these + formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. + type: string + x-oaiTypeLabel: file + format: binary + model: + description: > + ID of the model to use. Only `whisper-1` (which is powered by our + open source Whisper V2 model) is currently available. + example: whisper-1 + anyOf: + - type: string + - type: string + enum: + - whisper-1 + x-oaiTypeLabel: string + language: + description: > + The language of the input audio. Supplying the input language in + [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) + format will improve accuracy and latency. + type: string + prompt: + description: > + An optional text to guide the model's style or continue a previous + audio segment. The [prompt](/docs/guides/speech-to-text/prompting) + should match the audio language. + type: string + response_format: + $ref: "#/components/schemas/AudioResponseFormat" + temperature: + description: > + The sampling temperature, between 0 and 1. Higher values like 0.8 + will make the output more random, while lower values like 0.2 will + make it more focused and deterministic. If set to 0, the model will + use [log probability](https://en.wikipedia.org/wiki/Log_probability) + to automatically increase the temperature until certain thresholds + are hit. + type: number + default: 0 + timestamp_granularities[]: + description: > + The timestamp granularities to populate for this transcription. + `response_format` must be set `verbose_json` to use timestamp + granularities. Either or both of these options are supported: + `word`, or `segment`. Note: There is no additional latency for + segment timestamps, but generating word timestamps incurs additional + latency. + type: array + items: + type: string + enum: + - word + - segment + default: + - segment + required: + - file + - model + CreateTranscriptionResponseJson: + type: object + description: Represents a transcription response returned by model, based on the + provided input. + properties: + text: + type: string + description: The transcribed text. + required: + - text + x-oaiMeta: + name: The transcription object (JSON) + group: audio + example: > + { + "text": "Imagine the wildest idea that you've ever had, and you're curious about how it might scale to something that's a 100, a 1,000 times bigger. This is a place where you can get to do that." + } + CreateTranscriptionResponseVerboseJson: + type: object + description: Represents a verbose json transcription response returned by model, + based on the provided input. + properties: + language: + type: string + description: The language of the input audio. + duration: + type: string + description: The duration of the input audio. + text: + type: string + description: The transcribed text. + words: + type: array + description: Extracted words and their corresponding timestamps. + items: + $ref: "#/components/schemas/TranscriptionWord" + segments: + type: array + description: Segments of the transcribed text and their corresponding details. + items: + $ref: "#/components/schemas/TranscriptionSegment" + required: + - language + - duration + - text + x-oaiMeta: + name: The transcription object (Verbose JSON) + group: audio + example: > + { + "task": "transcribe", + "language": "english", + "duration": 8.470000267028809, + "text": "The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.", + "segments": [ + { + "id": 0, + "seek": 0, + "start": 0.0, + "end": 3.319999933242798, + "text": " The beach was a popular spot on a hot summer day.", + "tokens": [ + 50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530 + ], + "temperature": 0.0, + "avg_logprob": -0.2860786020755768, + "compression_ratio": 1.2363636493682861, + "no_speech_prob": 0.00985979475080967 + }, + ... + ] + } + CreateTranslationRequest: + type: object + additionalProperties: false + properties: + file: + description: > + The audio file object (not file name) translate, in one of these + formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. + type: string + x-oaiTypeLabel: file + format: binary + model: + description: > + ID of the model to use. Only `whisper-1` (which is powered by our + open source Whisper V2 model) is currently available. + example: whisper-1 + anyOf: + - type: string + - type: string + enum: + - whisper-1 + x-oaiTypeLabel: string + prompt: + description: > + An optional text to guide the model's style or continue a previous + audio segment. The [prompt](/docs/guides/speech-to-text/prompting) + should be in English. + type: string + response_format: + $ref: "#/components/schemas/AudioResponseFormat" + temperature: + description: > + The sampling temperature, between 0 and 1. Higher values like 0.8 + will make the output more random, while lower values like 0.2 will + make it more focused and deterministic. If set to 0, the model will + use [log probability](https://en.wikipedia.org/wiki/Log_probability) + to automatically increase the temperature until certain thresholds + are hit. + type: number + default: 0 + required: + - file + - model + CreateTranslationResponseJson: + type: object + properties: + text: + type: string + required: + - text + CreateTranslationResponseVerboseJson: + type: object + properties: + language: + type: string + description: The language of the output translation (always `english`). + duration: + type: string + description: The duration of the input audio. + text: + type: string + description: The translated text. + segments: + type: array + description: Segments of the translated text and their corresponding details. + items: + $ref: "#/components/schemas/TranscriptionSegment" + required: + - language + - duration + - text + CreateUploadRequest: + type: object + additionalProperties: false + properties: + filename: + description: | + The name of the file to upload. + type: string + purpose: + description: > + The intended purpose of the uploaded file. + + + See the [documentation on File + purposes](/docs/api-reference/files/create#files-create-purpose). + type: string + enum: + - assistants + - batch + - fine-tune + - vision + bytes: + description: | + The number of bytes in the file you are uploading. + type: integer + mime_type: + description: > + The MIME type of the file. + + + This must fall within the supported MIME types for your file + purpose. See the supported MIME types for assistants and vision. + type: string + required: + - filename + - purpose + - bytes + - mime_type + CreateVectorStoreFileBatchRequest: + type: object + additionalProperties: false + properties: + file_ids: + description: A list of [File](/docs/api-reference/files) IDs that the vector + store should use. Useful for tools like `file_search` that can + access files. + type: array + minItems: 1 + maxItems: 500 + items: + type: string + chunking_strategy: + $ref: "#/components/schemas/ChunkingStrategyRequestParam" + required: + - file_ids + CreateVectorStoreFileRequest: + type: object + additionalProperties: false + properties: + file_id: + description: A [File](/docs/api-reference/files) ID that the vector store should + use. Useful for tools like `file_search` that can access files. + type: string + chunking_strategy: + $ref: "#/components/schemas/ChunkingStrategyRequestParam" + required: + - file_id + CreateVectorStoreRequest: + type: object + additionalProperties: false + properties: + file_ids: + description: A list of [File](/docs/api-reference/files) IDs that the vector + store should use. Useful for tools like `file_search` that can + access files. + type: array + maxItems: 500 + items: + type: string + name: + description: The name of the vector store. + type: string + expires_after: + $ref: "#/components/schemas/VectorStoreExpirationAfter" + chunking_strategy: + type: object + description: The chunking strategy used to chunk the file(s). If not set, will + use the `auto` strategy. Only applicable if `file_ids` is non-empty. + oneOf: + - $ref: "#/components/schemas/AutoChunkingStrategyRequestParam" + - $ref: "#/components/schemas/StaticChunkingStrategyRequestParam" + x-oaiExpandable: true + metadata: + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be useful for storing additional information about the object in + a structured format. Keys can be a maximum of 64 characters long and + values can be a maximum of 512 characters long. + type: object + x-oaiTypeLabel: map + nullable: true + DefaultProjectErrorResponse: + type: object + properties: + code: + type: integer + message: + type: string + required: + - code + - message + DeleteAssistantResponse: + type: object + properties: + id: + type: string + deleted: + type: boolean + object: + type: string + enum: + - assistant.deleted + required: + - id + - object + - deleted + DeleteFileResponse: + type: object + properties: + id: + type: string + object: + type: string + enum: + - file + deleted: + type: boolean + required: + - id + - object + - deleted + DeleteMessageResponse: + type: object + properties: + id: + type: string + deleted: + type: boolean + object: + type: string + enum: + - thread.message.deleted + required: + - id + - object + - deleted + DeleteModelResponse: + type: object + properties: + id: + type: string + deleted: + type: boolean + object: + type: string + required: + - id + - object + - deleted + DeleteThreadResponse: + type: object + properties: + id: + type: string + deleted: + type: boolean + object: + type: string + enum: + - thread.deleted + required: + - id + - object + - deleted + DeleteVectorStoreFileResponse: + type: object + properties: + id: + type: string + deleted: + type: boolean + object: + type: string + enum: + - vector_store.file.deleted + required: + - id + - object + - deleted + DeleteVectorStoreResponse: + type: object + properties: + id: + type: string + deleted: + type: boolean + object: + type: string + enum: + - vector_store.deleted + required: + - id + - object + - deleted + DoneEvent: + type: object + properties: + event: + type: string + enum: + - done + data: + type: string + enum: + - "[DONE]" + required: + - event + - data + description: Occurs when a stream ends. + x-oaiMeta: + dataDescription: "`data` is `[DONE]`" + Embedding: + type: object + description: | + Represents an embedding vector returned by embedding endpoint. + properties: + index: + type: integer + description: The index of the embedding in the list of embeddings. + embedding: + type: array + description: > + The embedding vector, which is a list of floats. The length of + vector depends on the model as listed in the [embedding + guide](/docs/guides/embeddings). + items: + type: number + object: + type: string + description: The object type, which is always "embedding". + enum: + - embedding + required: + - index + - object + - embedding + x-oaiMeta: + name: The embedding object + example: | + { + "object": "embedding", + "embedding": [ + 0.0023064255, + -0.009327292, + .... (1536 floats total for ada-002) + -0.0028842222, + ], + "index": 0 + } + Error: + type: object + properties: + code: + type: string + nullable: true + message: + type: string + nullable: false + param: + type: string + nullable: true + type: + type: string + nullable: false + required: + - type + - message + - param + - code + ErrorEvent: + type: object + properties: + event: + type: string + enum: + - error + data: + $ref: "#/components/schemas/Error" + required: + - event + - data + description: Occurs when an [error](/docs/guides/error-codes/api-errors) occurs. + This can happen due to an internal server error or a timeout. + x-oaiMeta: + dataDescription: "`data` is an [error](/docs/guides/error-codes/api-errors)" + ErrorResponse: + type: object + properties: + error: + $ref: "#/components/schemas/Error" + required: + - error + FileSearchRankingOptions: + title: File search tool call ranking options + type: object + description: > + The ranking options for the file search. If not specified, the file + search tool will use the `auto` ranker and a score_threshold of 0. + + + See the [file search tool + documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) + for more information. + properties: + ranker: + type: string + description: The ranker to use for the file search. If not specified will use + the `auto` ranker. + enum: + - auto + - default_2024_08_21 + score_threshold: + type: number + description: The score threshold for the file search. All values must be a + floating point number between 0 and 1. + minimum: 0 + maximum: 1 + required: + - score_threshold + FineTuneChatCompletionRequestAssistantMessage: + allOf: + - type: object + title: Assistant message + deprecated: false + properties: + weight: + type: integer + enum: + - 0 + - 1 + description: Controls whether the assistant message is trained against (0 or 1) + - $ref: "#/components/schemas/ChatCompletionRequestAssistantMessage" + required: + - role + FineTuningIntegration: + type: object + title: Fine-Tuning Job Integration + required: + - type + - wandb + properties: + type: + type: string + description: The type of the integration being enabled for the fine-tuning job + enum: + - wandb + wandb: + type: object + description: > + The settings for your integration with Weights and Biases. This + payload specifies the project that + + metrics will be sent to. Optionally, you can set an explicit display + name for your run, add tags + + to your run, and set a default entity (team, username, etc) to be + associated with your run. + required: + - project + properties: + project: + description: | + The name of the project that the new run will be created under. + type: string + example: my-wandb-project + name: + description: > + A display name to set for the run. If not set, we will use the + Job ID as the name. + nullable: true + type: string + entity: + description: > + The entity to use for the run. This allows you to set the team + or username of the WandB user that you would + + like associated with the run. If not set, the default entity for + the registered WandB API key is used. + nullable: true + type: string + tags: + description: > + A list of tags to be attached to the newly created run. These + tags are passed through directly to WandB. Some + + default tags are generated by OpenAI: "openai/finetune", + "openai/{base-model}", "openai/{ftjob-abcdef}". + type: array + items: + type: string + example: custom-tag + FineTuningJob: + type: object + title: FineTuningJob + description: > + The `fine_tuning.job` object represents a fine-tuning job that has been + created through the API. + properties: + id: + type: string + description: The object identifier, which can be referenced in the API endpoints. + created_at: + type: integer + description: The Unix timestamp (in seconds) for when the fine-tuning job was + created. + error: + type: object + nullable: true + description: For fine-tuning jobs that have `failed`, this will contain more + information on the cause of the failure. + properties: + code: + type: string + description: A machine-readable error code. + message: + type: string + description: A human-readable error message. + param: + type: string + description: The parameter that was invalid, usually `training_file` or + `validation_file`. This field will be null if the failure was + not parameter-specific. + nullable: true + required: + - code + - message + - param + fine_tuned_model: + type: string + nullable: true + description: The name of the fine-tuned model that is being created. The value + will be null if the fine-tuning job is still running. + finished_at: + type: integer + nullable: true + description: The Unix timestamp (in seconds) for when the fine-tuning job was + finished. The value will be null if the fine-tuning job is still + running. + hyperparameters: + type: object + description: The hyperparameters used for the fine-tuning job. See the + [fine-tuning guide](/docs/guides/fine-tuning) for more details. + properties: + n_epochs: + oneOf: + - type: string + enum: + - auto + - type: integer + minimum: 1 + maximum: 50 + default: auto + description: >- + The number of epochs to train the model for. An epoch refers to + one full cycle through the training dataset. + + "auto" decides the optimal number of epochs based on the size of + the dataset. If setting the number manually, we support any + number between 1 and 50 epochs. + required: + - n_epochs + model: + type: string + description: The base model that is being fine-tuned. + object: + type: string + description: The object type, which is always "fine_tuning.job". + enum: + - fine_tuning.job + organization_id: + type: string + description: The organization that owns the fine-tuning job. + result_files: + type: array + description: The compiled results file ID(s) for the fine-tuning job. You can + retrieve the results with the [Files + API](/docs/api-reference/files/retrieve-contents). + items: + type: string + example: file-abc123 + status: + type: string + description: The current status of the fine-tuning job, which can be either + `validating_files`, `queued`, `running`, `succeeded`, `failed`, or + `cancelled`. + enum: + - validating_files + - queued + - running + - succeeded + - failed + - cancelled + trained_tokens: + type: integer + nullable: true + description: The total number of billable tokens processed by this fine-tuning + job. The value will be null if the fine-tuning job is still running. + training_file: + type: string + description: The file ID used for training. You can retrieve the training data + with the [Files API](/docs/api-reference/files/retrieve-contents). + validation_file: + type: string + nullable: true + description: The file ID used for validation. You can retrieve the validation + results with the [Files + API](/docs/api-reference/files/retrieve-contents). + integrations: + type: array + nullable: true + description: A list of integrations to enable for this fine-tuning job. + maxItems: 5 + items: + oneOf: + - $ref: "#/components/schemas/FineTuningIntegration" + x-oaiExpandable: true + seed: + type: integer + description: The seed used for the fine-tuning job. + estimated_finish: + type: integer + nullable: true + description: The Unix timestamp (in seconds) for when the fine-tuning job is + estimated to finish. The value will be null if the fine-tuning job + is not running. + required: + - created_at + - error + - finished_at + - fine_tuned_model + - hyperparameters + - id + - model + - object + - organization_id + - result_files + - status + - trained_tokens + - training_file + - validation_file + - seed + x-oaiMeta: + name: The fine-tuning job object + example: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "davinci-002", + "created_at": 1692661014, + "finished_at": 1692661190, + "fine_tuned_model": "ft:davinci-002:my-org:custom_suffix:7q8mpxmy", + "organization_id": "org-123", + "result_files": [ + "file-abc123" + ], + "status": "succeeded", + "validation_file": null, + "training_file": "file-abc123", + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + }, + "trained_tokens": 5768, + "integrations": [], + "seed": 0, + "estimated_finish": 0 + } + FineTuningJobCheckpoint: + type: object + title: FineTuningJobCheckpoint + description: > + The `fine_tuning.job.checkpoint` object represents a model checkpoint + for a fine-tuning job that is ready to use. + properties: + id: + type: string + description: The checkpoint identifier, which can be referenced in the API + endpoints. + created_at: + type: integer + description: The Unix timestamp (in seconds) for when the checkpoint was created. + fine_tuned_model_checkpoint: + type: string + description: The name of the fine-tuned checkpoint model that is created. + step_number: + type: integer + description: The step number that the checkpoint was created at. + metrics: + type: object + description: Metrics at the step number during the fine-tuning job. + properties: + step: + type: number + train_loss: + type: number + train_mean_token_accuracy: + type: number + valid_loss: + type: number + valid_mean_token_accuracy: + type: number + full_valid_loss: + type: number + full_valid_mean_token_accuracy: + type: number + fine_tuning_job_id: + type: string + description: The name of the fine-tuning job that this checkpoint was created + from. + object: + type: string + description: The object type, which is always "fine_tuning.job.checkpoint". + enum: + - fine_tuning.job.checkpoint + required: + - created_at + - fine_tuning_job_id + - fine_tuned_model_checkpoint + - id + - metrics + - object + - step_number + x-oaiMeta: + name: The fine-tuning job checkpoint object + example: > + { + "object": "fine_tuning.job.checkpoint", + "id": "ftckpt_qtZ5Gyk4BLq1SfLFWp3RtO3P", + "created_at": 1712211699, + "fine_tuned_model_checkpoint": "ft:gpt-4o-mini-2024-07-18:my-org:custom_suffix:9ABel2dg:ckpt-step-88", + "fine_tuning_job_id": "ftjob-fpbNQ3H1GrMehXRf8cO97xTN", + "metrics": { + "step": 88, + "train_loss": 0.478, + "train_mean_token_accuracy": 0.924, + "valid_loss": 10.112, + "valid_mean_token_accuracy": 0.145, + "full_valid_loss": 0.567, + "full_valid_mean_token_accuracy": 0.944 + }, + "step_number": 88 + } + FineTuningJobEvent: + type: object + description: Fine-tuning job event object + properties: + id: + type: string + created_at: + type: integer + level: + type: string + enum: + - info + - warn + - error + message: + type: string + object: + type: string + enum: + - fine_tuning.job.event + required: + - id + - object + - created_at + - level + - message + x-oaiMeta: + name: The fine-tuning job event object + example: | + { + "object": "fine_tuning.job.event", + "id": "ftevent-abc123" + "created_at": 1677610602, + "level": "info", + "message": "Created fine-tuning job" + } + FinetuneChatRequestInput: + type: object + description: The per-line training example of a fine-tuning input file for chat models + properties: + messages: + type: array + minItems: 1 + items: + oneOf: + - $ref: "#/components/schemas/ChatCompletionRequestSystemMessage" + - $ref: "#/components/schemas/ChatCompletionRequestUserMessage" + - $ref: "#/components/schemas/FineTuneChatCompletionRequestAssistantMessage" + - $ref: "#/components/schemas/ChatCompletionRequestToolMessage" + - $ref: "#/components/schemas/ChatCompletionRequestFunctionMessage" + x-oaiExpandable: true + tools: + type: array + description: A list of tools the model may generate JSON inputs for. + items: + $ref: "#/components/schemas/ChatCompletionTool" + parallel_tool_calls: + $ref: "#/components/schemas/ParallelToolCalls" + functions: + deprecated: true + description: A list of functions the model may generate JSON inputs for. + type: array + minItems: 1 + maxItems: 128 + items: + $ref: "#/components/schemas/ChatCompletionFunctions" + x-oaiMeta: + name: Training format for chat models + example: > + { + "messages": [ + { "role": "user", "content": "What is the weather in San Francisco?" }, + { + "role": "assistant", + "tool_calls": [ + { + "id": "call_id", + "type": "function", + "function": { + "name": "get_current_weather", + "arguments": "{\"location\": \"San Francisco, USA\", \"format\": \"celsius\"}" + } + } + ] + } + ], + "parallel_tool_calls": false, + "tools": [ + { + "type": "function", + "function": { + "name": "get_current_weather", + "description": "Get the current weather", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and country, eg. San Francisco, USA" + }, + "format": { "type": "string", "enum": ["celsius", "fahrenheit"] } + }, + "required": ["location", "format"] + } + } + } + ] + } + FinetuneCompletionRequestInput: + type: object + description: The per-line training example of a fine-tuning input file for + completions models + properties: + prompt: + type: string + description: The input prompt for this training example. + completion: + type: string + description: The desired completion for this training example. + x-oaiMeta: + name: Training format for completions models + example: | + { + "prompt": "What is the answer to 2+2", + "completion": "4" + } + FunctionObject: + type: object + properties: + description: + type: string + description: A description of what the function does, used by the model to + choose when and how to call the function. + name: + type: string + description: The name of the function to be called. Must be a-z, A-Z, 0-9, or + contain underscores and dashes, with a maximum length of 64. + parameters: + $ref: "#/components/schemas/FunctionParameters" + strict: + type: boolean + nullable: true + default: false + description: Whether to enable strict schema adherence when generating the + function call. If set to true, the model will follow the exact + schema defined in the `parameters` field. Only a subset of JSON + Schema is supported when `strict` is `true`. Learn more about + Structured Outputs in the [function calling + guide](docs/guides/function-calling). + required: + - name + FunctionParameters: + type: object + description: >- + The parameters the functions accepts, described as a JSON Schema object. + See the [guide](/docs/guides/function-calling) for examples, and the + [JSON Schema + reference](https://json-schema.org/understanding-json-schema/) for + documentation about the format. + + + Omitting `parameters` defines a function with an empty parameter list. + additionalProperties: true + Image: + type: object + description: Represents the url or the content of an image generated by the + OpenAI API. + properties: + b64_json: + type: string + description: The base64-encoded JSON of the generated image, if + `response_format` is `b64_json`. + url: + type: string + description: The URL of the generated image, if `response_format` is `url` + (default). + revised_prompt: + type: string + description: The prompt that was used to generate the image, if there was any + revision to the prompt. + x-oaiMeta: + name: The image object + example: | + { + "url": "...", + "revised_prompt": "..." + } + ImagesResponse: + properties: + created: + type: integer + data: + type: array + items: + $ref: "#/components/schemas/Image" + required: + - created + - data + Invite: + type: object + description: Represents an individual `invite` to the organization. + properties: + object: + type: string + enum: + - organization.invite + description: The object type, which is always `organization.invite` + id: + type: string + description: The identifier, which can be referenced in API endpoints + email: + type: string + description: The email address of the individual to whom the invite was sent + role: + type: string + enum: + - owner + - reader + description: "`owner` or `reader`" + status: + type: string + enum: + - accepted + - expired + - pending + description: "`accepted`,`expired`, or `pending`" + invited_at: + type: integer + description: The Unix timestamp (in seconds) of when the invite was sent. + expires_at: + type: integer + description: The Unix timestamp (in seconds) of when the invite expires. + accepted_at: + type: integer + description: The Unix timestamp (in seconds) of when the invite was accepted. + required: + - object + - id + - email + - role + - status + - invited_at + - expires_at + x-oaiMeta: + name: The invite object + example: | + { + "object": "organization.invite", + "id": "invite-abc", + "email": "user@example.com", + "role": "owner", + "status": "accepted", + "invited_at": 1711471533, + "expires_at": 1711471533, + "accepted_at": 1711471533 + } + InviteDeleteResponse: + type: object + properties: + object: + type: string + enum: + - organization.invite.deleted + description: The object type, which is always `organization.invite.deleted` + id: + type: string + deleted: + type: boolean + required: + - object + - id + - deleted + InviteListResponse: + type: object + properties: + object: + type: string + enum: + - list + description: The object type, which is always `list` + data: + type: array + items: + $ref: "#/components/schemas/Invite" + first_id: + type: string + description: The first `invite_id` in the retrieved `list` + last_id: + type: string + description: The last `invite_id` in the retrieved `list` + has_more: + type: boolean + description: The `has_more` property is used for pagination to indicate there + are additional results. + required: + - object + - data + InviteRequest: + type: object + properties: + email: + type: string + description: Send an email to this address + role: + type: string + enum: + - reader + - owner + description: "`owner` or `reader`" + required: + - email + - role + ListAssistantsResponse: + type: object + properties: + object: + type: string + example: list + data: + type: array + items: + $ref: "#/components/schemas/AssistantObject" + first_id: + type: string + example: asst_abc123 + last_id: + type: string + example: asst_abc456 + has_more: + type: boolean + example: false + required: + - object + - data + - first_id + - last_id + - has_more + x-oaiMeta: + name: List assistants response object + group: chat + example: > + { + "object": "list", + "data": [ + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698982736, + "name": "Coding Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc456", + "object": "assistant", + "created_at": 1698982718, + "name": "My Assistant", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc789", + "object": "assistant", + "created_at": 1698982643, + "name": null, + "description": null, + "model": "gpt-4o", + "instructions": null, + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + ], + "first_id": "asst_abc123", + "last_id": "asst_abc789", + "has_more": false + } + ListAuditLogsResponse: + type: object + properties: + object: + type: string + enum: + - list + data: + type: array + items: + $ref: "#/components/schemas/AuditLog" + first_id: + type: string + example: audit_log-defb456h8dks + last_id: + type: string + example: audit_log-hnbkd8s93s + has_more: + type: boolean + required: + - object + - data + - first_id + - last_id + - has_more + ListBatchesResponse: + type: object + properties: + data: + type: array + items: + $ref: "#/components/schemas/Batch" + first_id: + type: string + example: batch_abc123 + last_id: + type: string + example: batch_abc456 + has_more: + type: boolean + object: + type: string + enum: + - list + required: + - object + - data + - has_more + ListFilesResponse: + type: object + properties: + data: + type: array + items: + $ref: "#/components/schemas/OpenAIFile" + object: + type: string + enum: + - list + required: + - object + - data + ListFineTuningJobCheckpointsResponse: + type: object + properties: + data: + type: array + items: + $ref: "#/components/schemas/FineTuningJobCheckpoint" + object: + type: string + enum: + - list + first_id: + type: string + nullable: true + last_id: + type: string + nullable: true + has_more: + type: boolean + required: + - object + - data + - has_more + ListFineTuningJobEventsResponse: + type: object + properties: + data: + type: array + items: + $ref: "#/components/schemas/FineTuningJobEvent" + object: + type: string + enum: + - list + required: + - object + - data + ListMessagesResponse: + properties: + object: + type: string + example: list + data: + type: array + items: + $ref: "#/components/schemas/MessageObject" + first_id: + type: string + example: msg_abc123 + last_id: + type: string + example: msg_abc123 + has_more: + type: boolean + example: false + required: + - object + - data + - first_id + - last_id + - has_more + ListModelsResponse: + type: object + properties: + object: + type: string + enum: + - list + data: + type: array + items: + $ref: "#/components/schemas/Model" + required: + - object + - data + ListPaginatedFineTuningJobsResponse: + type: object + properties: + data: + type: array + items: + $ref: "#/components/schemas/FineTuningJob" + has_more: + type: boolean + object: + type: string + enum: + - list + required: + - object + - data + - has_more + ListRunStepsResponse: + properties: + object: + type: string + example: list + data: + type: array + items: + $ref: "#/components/schemas/RunStepObject" + first_id: + type: string + example: step_abc123 + last_id: + type: string + example: step_abc456 + has_more: + type: boolean + example: false + required: + - object + - data + - first_id + - last_id + - has_more + ListRunsResponse: + type: object + properties: + object: + type: string + example: list + data: + type: array + items: + $ref: "#/components/schemas/RunObject" + first_id: + type: string + example: run_abc123 + last_id: + type: string + example: run_abc456 + has_more: + type: boolean + example: false + required: + - object + - data + - first_id + - last_id + - has_more + ListThreadsResponse: + properties: + object: + type: string + example: list + data: + type: array + items: + $ref: "#/components/schemas/ThreadObject" + first_id: + type: string + example: asst_abc123 + last_id: + type: string + example: asst_abc456 + has_more: + type: boolean + example: false + required: + - object + - data + - first_id + - last_id + - has_more + ListVectorStoreFilesResponse: + properties: + object: + type: string + example: list + data: + type: array + items: + $ref: "#/components/schemas/VectorStoreFileObject" + first_id: + type: string + example: file-abc123 + last_id: + type: string + example: file-abc456 + has_more: + type: boolean + example: false + required: + - object + - data + - first_id + - last_id + - has_more + ListVectorStoresResponse: + properties: + object: + type: string + example: list + data: + type: array + items: + $ref: "#/components/schemas/VectorStoreObject" + first_id: + type: string + example: vs_abc123 + last_id: + type: string + example: vs_abc456 + has_more: + type: boolean + example: false + required: + - object + - data + - first_id + - last_id + - has_more + MessageContentImageFileObject: + title: Image file + type: object + description: References an image [File](/docs/api-reference/files) in the + content of a message. + properties: + type: + description: Always `image_file`. + type: string + enum: + - image_file + image_file: + type: object + properties: + file_id: + description: The [File](/docs/api-reference/files) ID of the image in the + message content. Set `purpose="vision"` when uploading the File + if you need to later display the file content. + type: string + detail: + type: string + description: Specifies the detail level of the image if specified by the user. + `low` uses fewer tokens, you can opt in to high resolution using + `high`. + enum: + - auto + - low + - high + default: auto + required: + - file_id + required: + - type + - image_file + MessageContentImageUrlObject: + title: Image URL + type: object + description: References an image URL in the content of a message. + properties: + type: + type: string + enum: + - image_url + description: The type of the content part. + image_url: + type: object + properties: + url: + type: string + description: "The external URL of the image, must be a supported image types: + jpeg, jpg, png, gif, webp." + format: uri + detail: + type: string + description: Specifies the detail level of the image. `low` uses fewer tokens, + you can opt in to high resolution using `high`. Default value is + `auto` + enum: + - auto + - low + - high + default: auto + required: + - url + required: + - type + - image_url + MessageContentRefusalObject: + title: Refusal + type: object + description: The refusal content generated by the assistant. + properties: + type: + description: Always `refusal`. + type: string + enum: + - refusal + refusal: + type: string + nullable: false + required: + - type + - refusal + MessageContentTextAnnotationsFileCitationObject: + title: File citation + type: object + description: A citation within the message that points to a specific quote from + a specific File associated with the assistant or the message. Generated + when the assistant uses the "file_search" tool to search files. + properties: + type: + description: Always `file_citation`. + type: string + enum: + - file_citation + text: + description: The text in the message content that needs to be replaced. + type: string + file_citation: + type: object + properties: + file_id: + description: The ID of the specific File the citation is from. + type: string + required: + - file_id + start_index: + type: integer + minimum: 0 + end_index: + type: integer + minimum: 0 + required: + - type + - text + - file_citation + - start_index + - end_index + MessageContentTextAnnotationsFilePathObject: + title: File path + type: object + description: A URL for the file that's generated when the assistant used the + `code_interpreter` tool to generate a file. + properties: + type: + description: Always `file_path`. + type: string + enum: + - file_path + text: + description: The text in the message content that needs to be replaced. + type: string + file_path: + type: object + properties: + file_id: + description: The ID of the file that was generated. + type: string + required: + - file_id + start_index: + type: integer + minimum: 0 + end_index: + type: integer + minimum: 0 + required: + - type + - text + - file_path + - start_index + - end_index + MessageContentTextObject: + title: Text + type: object + description: The text content that is part of a message. + properties: + type: + description: Always `text`. + type: string + enum: + - text + text: + type: object + properties: + value: + description: The data that makes up the text. + type: string + annotations: + type: array + items: + oneOf: + - $ref: "#/components/schemas/MessageContentTextAnnotationsFileCitationObject" + - $ref: "#/components/schemas/MessageContentTextAnnotationsFilePathObject" + x-oaiExpandable: true + required: + - value + - annotations + required: + - type + - text + MessageDeltaContentImageFileObject: + title: Image file + type: object + description: References an image [File](/docs/api-reference/files) in the + content of a message. + properties: + index: + type: integer + description: The index of the content part in the message. + type: + description: Always `image_file`. + type: string + enum: + - image_file + image_file: + type: object + properties: + file_id: + description: The [File](/docs/api-reference/files) ID of the image in the + message content. Set `purpose="vision"` when uploading the File + if you need to later display the file content. + type: string + detail: + type: string + description: Specifies the detail level of the image if specified by the user. + `low` uses fewer tokens, you can opt in to high resolution using + `high`. + enum: + - auto + - low + - high + default: auto + required: + - index + - type + MessageDeltaContentImageUrlObject: + title: Image URL + type: object + description: References an image URL in the content of a message. + properties: + index: + type: integer + description: The index of the content part in the message. + type: + description: Always `image_url`. + type: string + enum: + - image_url + image_url: + type: object + properties: + url: + description: "The URL of the image, must be a supported image types: jpeg, jpg, + png, gif, webp." + type: string + detail: + type: string + description: Specifies the detail level of the image. `low` uses fewer tokens, + you can opt in to high resolution using `high`. + enum: + - auto + - low + - high + default: auto + required: + - index + - type + MessageDeltaContentRefusalObject: + title: Refusal + type: object + description: The refusal content that is part of a message. + properties: + index: + type: integer + description: The index of the refusal part in the message. + type: + description: Always `refusal`. + type: string + enum: + - refusal + refusal: + type: string + required: + - index + - type + MessageDeltaContentTextAnnotationsFileCitationObject: + title: File citation + type: object + description: A citation within the message that points to a specific quote from + a specific File associated with the assistant or the message. Generated + when the assistant uses the "file_search" tool to search files. + properties: + index: + type: integer + description: The index of the annotation in the text content part. + type: + description: Always `file_citation`. + type: string + enum: + - file_citation + text: + description: The text in the message content that needs to be replaced. + type: string + file_citation: + type: object + properties: + file_id: + description: The ID of the specific File the citation is from. + type: string + quote: + description: The specific quote in the file. + type: string + start_index: + type: integer + minimum: 0 + end_index: + type: integer + minimum: 0 + required: + - index + - type + MessageDeltaContentTextAnnotationsFilePathObject: + title: File path + type: object + description: A URL for the file that's generated when the assistant used the + `code_interpreter` tool to generate a file. + properties: + index: + type: integer + description: The index of the annotation in the text content part. + type: + description: Always `file_path`. + type: string + enum: + - file_path + text: + description: The text in the message content that needs to be replaced. + type: string + file_path: + type: object + properties: + file_id: + description: The ID of the file that was generated. + type: string + start_index: + type: integer + minimum: 0 + end_index: + type: integer + minimum: 0 + required: + - index + - type + MessageDeltaContentTextObject: + title: Text + type: object + description: The text content that is part of a message. + properties: + index: + type: integer + description: The index of the content part in the message. + type: + description: Always `text`. + type: string + enum: + - text + text: + type: object + properties: + value: + description: The data that makes up the text. + type: string + annotations: + type: array + items: + oneOf: + - $ref: "#/components/schemas/MessageDeltaContentTextAnnotationsFileCitationObjec\ + t" + - $ref: "#/components/schemas/MessageDeltaContentTextAnnotationsFilePathObject" + x-oaiExpandable: true + required: + - index + - type + MessageDeltaObject: + type: object + title: Message delta object + description: > + Represents a message delta i.e. any changed fields on a message during + streaming. + properties: + id: + description: The identifier of the message, which can be referenced in API + endpoints. + type: string + object: + description: The object type, which is always `thread.message.delta`. + type: string + enum: + - thread.message.delta + delta: + description: The delta containing the fields that have changed on the Message. + type: object + properties: + role: + description: The entity that produced the message. One of `user` or `assistant`. + type: string + enum: + - user + - assistant + content: + description: The content of the message in array of text and/or images. + type: array + items: + oneOf: + - $ref: "#/components/schemas/MessageDeltaContentImageFileObject" + - $ref: "#/components/schemas/MessageDeltaContentTextObject" + - $ref: "#/components/schemas/MessageDeltaContentRefusalObject" + - $ref: "#/components/schemas/MessageDeltaContentImageUrlObject" + x-oaiExpandable: true + required: + - id + - object + - delta + x-oaiMeta: + name: The message delta object + beta: true + example: | + { + "id": "msg_123", + "object": "thread.message.delta", + "delta": { + "content": [ + { + "index": 0, + "type": "text", + "text": { "value": "Hello", "annotations": [] } + } + ] + } + } + MessageObject: + type: object + title: The message object + description: Represents a message within a [thread](/docs/api-reference/threads). + properties: + id: + description: The identifier, which can be referenced in API endpoints. + type: string + object: + description: The object type, which is always `thread.message`. + type: string + enum: + - thread.message + created_at: + description: The Unix timestamp (in seconds) for when the message was created. + type: integer + thread_id: + description: The [thread](/docs/api-reference/threads) ID that this message + belongs to. + type: string + status: + description: The status of the message, which can be either `in_progress`, + `incomplete`, or `completed`. + type: string + enum: + - in_progress + - incomplete + - completed + incomplete_details: + description: On an incomplete message, details about why the message is + incomplete. + type: object + properties: + reason: + type: string + description: The reason the message is incomplete. + enum: + - content_filter + - max_tokens + - run_cancelled + - run_expired + - run_failed + nullable: true + required: + - reason + completed_at: + description: The Unix timestamp (in seconds) for when the message was completed. + type: integer + nullable: true + incomplete_at: + description: The Unix timestamp (in seconds) for when the message was marked as + incomplete. + type: integer + nullable: true + role: + description: The entity that produced the message. One of `user` or `assistant`. + type: string + enum: + - user + - assistant + content: + description: The content of the message in array of text and/or images. + type: array + items: + oneOf: + - $ref: "#/components/schemas/MessageContentImageFileObject" + - $ref: "#/components/schemas/MessageContentImageUrlObject" + - $ref: "#/components/schemas/MessageContentTextObject" + - $ref: "#/components/schemas/MessageContentRefusalObject" + x-oaiExpandable: true + assistant_id: + description: If applicable, the ID of the + [assistant](/docs/api-reference/assistants) that authored this + message. + type: string + nullable: true + run_id: + description: The ID of the [run](/docs/api-reference/runs) associated with the + creation of this message. Value is `null` when messages are created + manually using the create message or create thread endpoints. + type: string + nullable: true + attachments: + type: array + items: + type: object + properties: + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + description: The tools to add this file to. + type: array + items: + oneOf: + - $ref: "#/components/schemas/AssistantToolsCode" + - $ref: "#/components/schemas/AssistantToolsFileSearchTypeOnly" + x-oaiExpandable: true + description: A list of files attached to the message, and the tools they were + added to. + nullable: true + metadata: + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be useful for storing additional information about the object in + a structured format. Keys can be a maximum of 64 characters long and + values can be a maximum of 512 characters long. + type: object + x-oaiTypeLabel: map + nullable: true + required: + - id + - object + - created_at + - thread_id + - status + - incomplete_details + - completed_at + - incomplete_at + - role + - content + - assistant_id + - run_id + - attachments + - metadata + x-oaiMeta: + name: The message object + beta: true + example: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1698983503, + "thread_id": "thread_abc123", + "role": "assistant", + "content": [ + { + "type": "text", + "text": { + "value": "Hi! How can I help you today?", + "annotations": [] + } + } + ], + "assistant_id": "asst_abc123", + "run_id": "run_abc123", + "attachments": [], + "metadata": {} + } + MessageRequestContentTextObject: + title: Text + type: object + description: The text content that is part of a message. + properties: + type: + description: Always `text`. + type: string + enum: + - text + text: + type: string + description: Text content to be sent to the model + required: + - type + - text + MessageStreamEvent: + oneOf: + - type: object + properties: + event: + type: string + enum: + - thread.message.created + data: + $ref: "#/components/schemas/MessageObject" + required: + - event + - data + description: Occurs when a [message](/docs/api-reference/messages/object) is + created. + x-oaiMeta: + dataDescription: "`data` is a [message](/docs/api-reference/messages/object)" + - type: object + properties: + event: + type: string + enum: + - thread.message.in_progress + data: + $ref: "#/components/schemas/MessageObject" + required: + - event + - data + description: Occurs when a [message](/docs/api-reference/messages/object) moves + to an `in_progress` state. + x-oaiMeta: + dataDescription: "`data` is a [message](/docs/api-reference/messages/object)" + - type: object + properties: + event: + type: string + enum: + - thread.message.delta + data: + $ref: "#/components/schemas/MessageDeltaObject" + required: + - event + - data + description: Occurs when parts of a + [Message](/docs/api-reference/messages/object) are being streamed. + x-oaiMeta: + dataDescription: "`data` is a [message + delta](/docs/api-reference/assistants-streaming/message-delta-obj\ + ect)" + - type: object + properties: + event: + type: string + enum: + - thread.message.completed + data: + $ref: "#/components/schemas/MessageObject" + required: + - event + - data + description: Occurs when a [message](/docs/api-reference/messages/object) is + completed. + x-oaiMeta: + dataDescription: "`data` is a [message](/docs/api-reference/messages/object)" + - type: object + properties: + event: + type: string + enum: + - thread.message.incomplete + data: + $ref: "#/components/schemas/MessageObject" + required: + - event + - data + description: Occurs when a [message](/docs/api-reference/messages/object) ends + before it is completed. + x-oaiMeta: + dataDescription: "`data` is a [message](/docs/api-reference/messages/object)" + Model: + title: Model + description: Describes an OpenAI model offering that can be used with the API. + properties: + id: + type: string + description: The model identifier, which can be referenced in the API endpoints. + created: + type: integer + description: The Unix timestamp (in seconds) when the model was created. + object: + type: string + description: The object type, which is always "model". + enum: + - model + owned_by: + type: string + description: The organization that owns the model. + required: + - id + - object + - created + - owned_by + x-oaiMeta: + name: The model object + example: | + { + "id": "VAR_model_id", + "object": "model", + "created": 1686935002, + "owned_by": "openai" + } + ModifyAssistantRequest: + type: object + additionalProperties: false + properties: + model: + description: > + ID of the model to use. You can use the [List + models](/docs/api-reference/models/list) API to see all of your + available models, or see our [Model overview](/docs/models/overview) + for descriptions of them. + anyOf: + - type: string + name: + description: | + The name of the assistant. The maximum length is 256 characters. + type: string + nullable: true + maxLength: 256 + description: + description: > + The description of the assistant. The maximum length is 512 + characters. + type: string + nullable: true + maxLength: 512 + instructions: + description: > + The system instructions that the assistant uses. The maximum length + is 256,000 characters. + type: string + nullable: true + maxLength: 256000 + tools: + description: > + A list of tool enabled on the assistant. There can be a maximum of + 128 tools per assistant. Tools can be of types `code_interpreter`, + `file_search`, or `function`. + default: [ ] + type: array + maxItems: 128 + items: + oneOf: + - $ref: "#/components/schemas/AssistantToolsCode" + - $ref: "#/components/schemas/AssistantToolsFileSearch" + - $ref: "#/components/schemas/AssistantToolsFunction" + x-oaiExpandable: true + tool_resources: + type: object + description: > + A set of resources that are used by the assistant's tools. The + resources are specific to the type of tool. For example, the + `code_interpreter` tool requires a list of file IDs, while the + `file_search` tool requires a list of vector store IDs. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + Overrides the list of [file](/docs/api-reference/files) IDs + made available to the `code_interpreter` tool. There can be + a maximum of 20 files associated with the tool. + default: [ ] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + Overrides the [vector + store](/docs/api-reference/vector-stores/object) attached to + this assistant. There can be a maximum of 1 vector store + attached to the assistant. + maxItems: 1 + items: + type: string + nullable: true + metadata: + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be useful for storing additional information about the object in + a structured format. Keys can be a maximum of 64 characters long and + values can be a maximum of 512 characters long. + type: object + x-oaiTypeLabel: map + nullable: true + temperature: + description: > + What sampling temperature to use, between 0 and 2. Higher values + like 0.8 will make the output more random, while lower values like + 0.2 will make it more focused and deterministic. + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + nullable: true + top_p: + type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + nullable: true + description: > + An alternative to sampling with temperature, called nucleus + sampling, where the model considers the results of the tokens with + top_p probability mass. So 0.1 means only the tokens comprising the + top 10% probability mass are considered. + + + We generally recommend altering this or temperature but not both. + response_format: + $ref: "#/components/schemas/AssistantsApiResponseFormatOption" + nullable: true + ModifyMessageRequest: + type: object + additionalProperties: false + properties: + metadata: + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be useful for storing additional information about the object in + a structured format. Keys can be a maximum of 64 characters long and + values can be a maximum of 512 characters long. + type: object + x-oaiTypeLabel: map + nullable: true + ModifyRunRequest: + type: object + additionalProperties: false + properties: + metadata: + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be useful for storing additional information about the object in + a structured format. Keys can be a maximum of 64 characters long and + values can be a maximum of 512 characters long. + type: object + x-oaiTypeLabel: map + nullable: true + ModifyThreadRequest: + type: object + additionalProperties: false + properties: + tool_resources: + type: object + description: > + A set of resources that are made available to the assistant's tools + in this thread. The resources are specific to the type of tool. For + example, the `code_interpreter` tool requires a list of file IDs, + while the `file_search` tool requires a list of vector store IDs. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter` tool. There can be a + maximum of 20 files associated with the tool. + default: [ ] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The [vector store](/docs/api-reference/vector-stores/object) + attached to this thread. There can be a maximum of 1 vector + store attached to the thread. + maxItems: 1 + items: + type: string + nullable: true + metadata: + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be useful for storing additional information about the object in + a structured format. Keys can be a maximum of 64 characters long and + values can be a maximum of 512 characters long. + type: object + x-oaiTypeLabel: map + nullable: true + OpenAIFile: + title: OpenAIFile + description: The `File` object represents a document that has been uploaded to OpenAI. + properties: + id: + type: string + description: The file identifier, which can be referenced in the API endpoints. + bytes: + type: integer + description: The size of the file, in bytes. + created_at: + type: integer + description: The Unix timestamp (in seconds) for when the file was created. + filename: + type: string + description: The name of the file. + object: + type: string + description: The object type, which is always `file`. + enum: + - file + purpose: + type: string + description: The intended purpose of the file. Supported values are + `assistants`, `assistants_output`, `batch`, `batch_output`, + `fine-tune`, `fine-tune-results` and `vision`. + enum: + - assistants + - assistants_output + - batch + - batch_output + - fine-tune + - fine-tune-results + - vision + status: + type: string + deprecated: true + description: Deprecated. The current status of the file, which can be either + `uploaded`, `processed`, or `error`. + enum: + - uploaded + - processed + - error + status_details: + type: string + deprecated: true + description: Deprecated. For details on why a fine-tuning training file failed + validation, see the `error` field on `fine_tuning.job`. + required: + - id + - object + - bytes + - created_at + - filename + - purpose + - status + x-oaiMeta: + name: The file object + example: | + { + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "filename": "salesOverview.pdf", + "purpose": "assistants", + } + OtherChunkingStrategyResponseParam: + type: object + title: Other Chunking Strategy + description: This is returned when the chunking strategy is unknown. Typically, + this is because the file was indexed before the `chunking_strategy` + concept was introduced in the API. + additionalProperties: false + properties: + type: + type: string + description: Always `other`. + enum: + - other + required: + - type + ParallelToolCalls: + description: Whether to enable [parallel function + calling](/docs/guides/function-calling/parallel-function-calling) during + tool use. + type: boolean + default: true + Project: + type: object + description: Represents an individual project. + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints + object: + type: string + enum: + - organization.project + description: The object type, which is always `organization.project` + name: + type: string + description: The name of the project. This appears in reporting. + created_at: + type: integer + description: The Unix timestamp (in seconds) of when the project was created. + archived_at: + type: integer + nullable: true + description: The Unix timestamp (in seconds) of when the project was archived or + `null`. + status: + type: string + enum: + - active + - archived + description: "`active` or `archived`" + required: + - id + - object + - name + - created_at + - status + x-oaiMeta: + name: The project object + example: | + { + "id": "proj_abc", + "object": "organization.project", + "name": "Project example", + "created_at": 1711471533, + "archived_at": null, + "status": "active" + } + ProjectApiKey: + type: object + description: Represents an individual API key in a project. + properties: + object: + type: string + enum: + - organization.project.api_key + description: The object type, which is always `organization.project.api_key` + redacted_value: + type: string + description: The redacted value of the API key + name: + type: string + description: The name of the API key + created_at: + type: integer + description: The Unix timestamp (in seconds) of when the API key was created + id: + type: string + description: The identifier, which can be referenced in API endpoints + owner: + type: object + properties: + type: + type: string + enum: + - user + - service_account + description: "`user` or `service_account`" + user: + $ref: "#/components/schemas/ProjectUser" + service_account: + $ref: "#/components/schemas/ProjectServiceAccount" + required: + - object + - redacted_value + - name + - created_at + - id + - owner + x-oaiMeta: + name: The project API key object + example: | + { + "object": "organization.project.api_key", + "redacted_value": "sk-abc...def", + "name": "My API Key", + "created_at": 1711471533, + "id": "key_abc", + "owner": { + "type": "user", + "user": { + "object": "organization.project.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "created_at": 1711471533 + } + } + } + ProjectApiKeyDeleteResponse: + type: object + properties: + object: + type: string + enum: + - organization.project.api_key.deleted + id: + type: string + deleted: + type: boolean + required: + - object + - id + - deleted + ProjectApiKeyListResponse: + type: object + properties: + object: + type: string + enum: + - list + data: + type: array + items: + $ref: "#/components/schemas/ProjectApiKey" + first_id: + type: string + last_id: + type: string + has_more: + type: boolean + required: + - object + - data + - first_id + - last_id + - has_more + ProjectCreateRequest: + type: object + properties: + name: + type: string + description: The friendly name of the project, this name appears in reports. + required: + - name + ProjectListResponse: + type: object + properties: + object: + type: string + enum: + - list + data: + type: array + items: + $ref: "#/components/schemas/Project" + first_id: + type: string + last_id: + type: string + has_more: + type: boolean + required: + - object + - data + - first_id + - last_id + - has_more + ProjectServiceAccount: + type: object + description: Represents an individual service account in a project. + properties: + object: + type: string + enum: + - organization.project.service_account + description: The object type, which is always + `organization.project.service_account` + id: + type: string + description: The identifier, which can be referenced in API endpoints + name: + type: string + description: The name of the service account + role: + type: string + enum: + - owner + - member + description: "`owner` or `member`" + created_at: + type: integer + description: The Unix timestamp (in seconds) of when the service account was + created + required: + - object + - id + - name + - role + - created_at + x-oaiMeta: + name: The project service account object + example: | + { + "object": "organization.project.service_account", + "id": "svc_acct_abc", + "name": "Service Account", + "role": "owner", + "created_at": 1711471533 + } + ProjectServiceAccountApiKey: + type: object + properties: + object: + type: string + enum: + - organization.project.service_account.api_key + description: The object type, which is always + `organization.project.service_account.api_key` + value: + type: string + name: + type: string + created_at: + type: integer + id: + type: string + required: + - object + - value + - name + - created_at + - id + ProjectServiceAccountCreateRequest: + type: object + properties: + name: + type: string + description: The name of the service account being created. + required: + - name + ProjectServiceAccountCreateResponse: + type: object + properties: + object: + type: string + enum: + - organization.project.service_account + id: + type: string + name: + type: string + role: + type: string + enum: + - member + description: Service accounts can only have one role of type `member` + created_at: + type: integer + api_key: + $ref: "#/components/schemas/ProjectServiceAccountApiKey" + required: + - object + - id + - name + - role + - created_at + - api_key + ProjectServiceAccountDeleteResponse: + type: object + properties: + object: + type: string + enum: + - organization.project.service_account.deleted + id: + type: string + deleted: + type: boolean + required: + - object + - id + - deleted + ProjectServiceAccountListResponse: + type: object + properties: + object: + type: string + enum: + - list + data: + type: array + items: + $ref: "#/components/schemas/ProjectServiceAccount" + first_id: + type: string + last_id: + type: string + has_more: + type: boolean + required: + - object + - data + - first_id + - last_id + - has_more + ProjectUpdateRequest: + type: object + properties: + name: + type: string + description: The updated name of the project, this name appears in reports. + required: + - name + ProjectUser: + type: object + description: Represents an individual user in a project. + properties: + object: + type: string + enum: + - organization.project.user + description: The object type, which is always `organization.project.user` + id: + type: string + description: The identifier, which can be referenced in API endpoints + name: + type: string + description: The name of the user + email: + type: string + description: The email address of the user + role: + type: string + enum: + - owner + - member + description: "`owner` or `member`" + added_at: + type: integer + description: The Unix timestamp (in seconds) of when the project was added. + required: + - object + - id + - name + - email + - role + - added_at + x-oaiMeta: + name: The project user object + example: | + { + "object": "organization.project.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + ProjectUserCreateRequest: + type: object + properties: + user_id: + type: string + description: The ID of the user. + role: + type: string + enum: + - owner + - member + description: "`owner` or `member`" + required: + - user_id + - role + ProjectUserDeleteResponse: + type: object + properties: + object: + type: string + enum: + - organization.project.user.deleted + id: + type: string + deleted: + type: boolean + required: + - object + - id + - deleted + ProjectUserListResponse: + type: object + properties: + object: + type: string + data: + type: array + items: + $ref: "#/components/schemas/ProjectUser" + first_id: + type: string + last_id: + type: string + has_more: + type: boolean + required: + - object + - data + - first_id + - last_id + - has_more + ProjectUserUpdateRequest: + type: object + properties: + role: + type: string + enum: + - owner + - member + description: "`owner` or `member`" + required: + - role + RealtimeClientEventConversationItemCreate: + type: object + description: Send this event when adding an item to the conversation. + properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: + type: string + description: The event type, must be "conversation.item.create". + previous_item_id: + type: string + description: The ID of the preceding item after which the new item will be + inserted. + item: + type: object + description: The item to add to the conversation. + properties: + id: + type: string + description: The unique ID of the item. + type: + type: string + description: The type of the item ("message", "function_call", + "function_call_output"). + status: + type: string + description: The status of the item ("completed", "in_progress", "incomplete"). + role: + type: string + description: The role of the message sender ("user", "assistant", "system"). + content: + type: array + description: The content of the message. + items: + type: object + properties: + type: + type: string + description: The content type ("input_text", "input_audio", "text", "audio"). + text: + type: string + description: The text content. + audio: + type: string + description: Base64-encoded audio bytes. + transcript: + type: string + description: The transcript of the audio. + call_id: + type: string + description: The ID of the function call (for "function_call" items). + name: + type: string + description: The name of the function being called (for "function_call" items). + arguments: + type: string + description: The arguments of the function call (for "function_call" items). + output: + type: string + description: The output of the function call (for "function_call_output" items). + required: + - type + - item + x-oaiMeta: + name: conversation.item.create + group: realtime + example: | + { + "event_id": "event_345", + "type": "conversation.item.create", + "previous_item_id": null, + "item": { + "id": "msg_001", + "type": "message", + "status": "completed", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Hello, how are you?" + } + ] + } + } + RealtimeClientEventConversationItemDelete: + type: object + description: Send this event when you want to remove any item from the + conversation history. + properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: + type: string + description: The event type, must be "conversation.item.delete". + item_id: + type: string + description: The ID of the item to delete. + required: + - type + - item_id + x-oaiMeta: + name: conversation.item.delete + group: realtime + example: | + { + "event_id": "event_901", + "type": "conversation.item.delete", + "item_id": "msg_003" + } + RealtimeClientEventConversationItemTruncate: + type: object + description: Send this event when you want to truncate a previous assistant + message’s audio. + properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: + type: string + description: The event type, must be "conversation.item.truncate". + item_id: + type: string + description: The ID of the assistant message item to truncate. + content_index: + type: integer + description: The index of the content part to truncate. + audio_end_ms: + type: integer + description: Inclusive duration up to which audio is truncated, in milliseconds. + required: + - type + - item_id + - content_index + - audio_end_ms + x-oaiMeta: + name: conversation.item.truncate + group: realtime + example: | + { + "event_id": "event_678", + "type": "conversation.item.truncate", + "item_id": "msg_002", + "content_index": 0, + "audio_end_ms": 1500 + } + RealtimeClientEventInputAudioBufferAppend: + type: object + description: Send this event to append audio bytes to the input audio buffer. + properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: + type: string + description: The event type, must be "input_audio_buffer.append". + audio: + type: string + description: Base64-encoded audio bytes. + required: + - type + - audio + x-oaiMeta: + name: input_audio_buffer.append + group: realtime + example: | + { + "event_id": "event_456", + "type": "input_audio_buffer.append", + "audio": "Base64EncodedAudioData" + } + RealtimeClientEventInputAudioBufferClear: + type: object + description: Send this event to clear the audio bytes in the buffer. + properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: + type: string + description: The event type, must be "input_audio_buffer.clear". + required: + - type + x-oaiMeta: + name: input_audio_buffer.clear + group: realtime + example: | + { + "event_id": "event_012", + "type": "input_audio_buffer.clear" + } + RealtimeClientEventInputAudioBufferCommit: + type: object + description: Send this event to commit audio bytes to a user message. + properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: + type: string + description: The event type, must be "input_audio_buffer.commit". + required: + - type + x-oaiMeta: + name: input_audio_buffer.commit + group: realtime + example: | + { + "event_id": "event_789", + "type": "input_audio_buffer.commit" + } + RealtimeClientEventResponseCancel: + type: object + description: Send this event to cancel an in-progress response. + properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: + type: string + description: The event type, must be "response.cancel". + required: + - type + x-oaiMeta: + name: response.cancel + group: realtime + example: | + { + "event_id": "event_567", + "type": "response.cancel" + } + RealtimeClientEventResponseCreate: + type: object + description: Send this event to trigger a response generation. + properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: + type: string + description: The event type, must be "response.create". + response: + type: object + description: Configuration for the response. + properties: + modalities: + type: array + items: + type: string + description: The modalities for the response. + instructions: + type: string + description: Instructions for the model. + voice: + type: string + description: The voice the model uses to respond - one of `alloy`, `echo`, or + `shimmer`. + output_audio_format: + type: string + description: The format of output audio. + tools: + type: array + description: Tools (functions) available to the model. + items: + type: object + properties: + type: + type: string + description: The type of the tool. + name: + type: string + description: The name of the function. + description: + type: string + description: The description of the function. + parameters: + type: object + description: Parameters of the function in JSON Schema. + tool_choice: + type: string + description: How the model chooses tools. + temperature: + type: number + description: Sampling temperature. + max_output_tokens: + oneOf: + - type: integer + - type: string + enum: + - inf + description: Maximum number of output tokens for a single assistant response, + inclusive of tool calls. Provide an integer between 1 and 4096 + to limit output tokens, or "inf" for the maximum available + tokens for a given model. Defaults to "inf". + required: + - type + - response + x-oaiMeta: + name: response.create + group: realtime + example: | + { + "event_id": "event_234", + "type": "response.create", + "response": { + "modalities": ["text", "audio"], + "instructions": "Please assist the user.", + "voice": "alloy", + "output_audio_format": "pcm16", + "tools": [ + { + "type": "function", + "name": "calculate_sum", + "description": "Calculates the sum of two numbers.", + "parameters": { + "type": "object", + "properties": { + "a": { "type": "number" }, + "b": { "type": "number" } + }, + "required": ["a", "b"] + } + } + ], + "tool_choice": "auto", + "temperature": 0.7, + "max_output_tokens": 150 + } + } + RealtimeClientEventSessionUpdate: + type: object + description: Send this event to update the session’s default configuration. + properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: + type: string + description: The event type, must be "session.update". + session: + type: object + description: Session configuration to update. + properties: + modalities: + type: array + items: + type: string + description: The set of modalities the model can respond with. To disable audio, + set this to ["text"]. + instructions: + type: string + description: The default system instructions prepended to model calls. + voice: + type: string + description: The voice the model uses to respond - one of `alloy`, `echo`, + or `shimmer`. Cannot be changed once the model has responded + with audio at least once. + input_audio_format: + type: string + description: The format of input audio. Options are "pcm16", "g711_ulaw", or + "g711_alaw". + output_audio_format: + type: string + description: The format of output audio. Options are "pcm16", "g711_ulaw", or + "g711_alaw". + input_audio_transcription: + type: object + description: Configuration for input audio transcription. Can be set to `null` + to turn off. + properties: + model: + type: string + description: The model to use for transcription (e.g., "whisper-1"). + turn_detection: + type: object + description: Configuration for turn detection. Can be set to `null` to turn off. + properties: + type: + type: string + description: Type of turn detection, only "server_vad" is currently supported. + threshold: + type: number + description: Activation threshold for VAD (0.0 to 1.0). + prefix_padding_ms: + type: integer + description: Amount of audio to include before speech starts (in milliseconds). + silence_duration_ms: + type: integer + description: Duration of silence to detect speech stop (in milliseconds). + tools: + type: array + description: Tools (functions) available to the model. + items: + type: object + properties: + type: + type: string + description: The type of the tool, e.g., "function". + name: + type: string + description: The name of the function. + description: + type: string + description: The description of the function. + parameters: + type: object + description: Parameters of the function in JSON Schema. + tool_choice: + type: string + description: How the model chooses tools. Options are "auto", "none", + "required", or specify a function. + temperature: + type: number + description: Sampling temperature for the model. + max_output_tokens: + oneOf: + - type: integer + - type: string + enum: + - inf + description: Maximum number of output tokens for a single assistant response, + inclusive of tool calls. Provide an integer between 1 and 4096 + to limit output tokens, or "inf" for the maximum available + tokens for a given model. Defaults to "inf". + required: + - type + - session + x-oaiMeta: + name: session.update + group: realtime + example: > + { + "event_id": "event_123", + "type": "session.update", + "session": { + "modalities": ["text", "audio"], + "instructions": "Your knowledge cutoff is 2023-10. You are a helpful assistant.", + "voice": "alloy", + "input_audio_format": "pcm16", + "output_audio_format": "pcm16", + "input_audio_transcription": { + "model": "whisper-1" + }, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200 + }, + "tools": [ + { + "type": "function", + "name": "get_weather", + "description": "Get the current weather for a location.", + "parameters": { + "type": "object", + "properties": { + "location": { "type": "string" } + }, + "required": ["location"] + } + } + ], + "tool_choice": "auto", + "temperature": 0.8, + "max_output_tokens": null + } + } + RealtimeServerEventConversationCreated: + type: object + description: Returned when a conversation is created. Emitted right after + session creation. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "conversation.created". + conversation: + type: object + description: The conversation resource. + properties: + id: + type: string + description: The unique ID of the conversation. + object: + type: string + description: The object type, must be "realtime.conversation". + required: + - event_id + - type + - conversation + x-oaiMeta: + name: conversation.created + group: realtime + example: | + { + "event_id": "event_9101", + "type": "conversation.created", + "conversation": { + "id": "conv_001", + "object": "realtime.conversation" + } + } + RealtimeServerEventConversationItemCreated: + type: object + description: Returned when a conversation item is created. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "conversation.item.created". + previous_item_id: + type: string + description: The ID of the preceding item. + item: + type: object + description: The item that was created. + properties: + id: + type: string + description: The unique ID of the item. + object: + type: string + description: The object type, must be "realtime.item". + type: + type: string + description: The type of the item ("message", "function_call", + "function_call_output"). + status: + type: string + description: The status of the item ("completed", "in_progress", "incomplete"). + role: + type: string + description: The role associated with the item ("user", "assistant", "system"). + content: + type: array + description: The content of the item. + items: + type: object + properties: + type: + type: string + description: The content type ("text", "audio", "input_text", "input_audio"). + text: + type: string + description: The text content. + audio: + type: string + description: Base64-encoded audio data. + transcript: + type: string + description: The transcript of the audio. + call_id: + type: string + description: The ID of the function call (for "function_call" items). + name: + type: string + description: The name of the function being called. + arguments: + type: string + description: The arguments of the function call. + output: + type: string + description: The output of the function call (for "function_call_output" items). + required: + - event_id + - type + - previous_item_id + - item + x-oaiMeta: + name: conversation.item.created + group: realtime + example: | + { + "event_id": "event_1920", + "type": "conversation.item.created", + "previous_item_id": "msg_002", + "item": { + "id": "msg_003", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "user", + "content": [ + { + "type": "input_audio", + "transcript": null + } + ] + } + } + RealtimeServerEventConversationItemDeleted: + type: object + description: Returned when an item in the conversation is deleted. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "conversation.item.deleted". + item_id: + type: string + description: The ID of the item that was deleted. + required: + - event_id + - type + - item_id + x-oaiMeta: + name: conversation.item.deleted + group: realtime + example: | + { + "event_id": "event_2728", + "type": "conversation.item.deleted", + "item_id": "msg_005" + } + RealtimeServerEventConversationItemInputAudioTranscriptionCompleted: + type: object + description: Returned when input audio transcription is enabled and a + transcription succeeds. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be + "conversation.item.input_audio_transcription.completed". + item_id: + type: string + description: The ID of the user message item. + content_index: + type: integer + description: The index of the content part containing the audio. + transcript: + type: string + description: The transcribed text. + required: + - event_id + - type + - item_id + - content_index + - transcript + x-oaiMeta: + name: conversation.item.input_audio_transcription.completed + group: realtime + example: | + { + "event_id": "event_2122", + "type": "conversation.item.input_audio_transcription.completed", + "item_id": "msg_003", + "content_index": 0, + "transcript": "Hello, how are you?" + } + RealtimeServerEventConversationItemInputAudioTranscriptionFailed: + type: object + description: Returned when input audio transcription is configured, and a + transcription request for a user message failed. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be + "conversation.item.input_audio_transcription.failed". + item_id: + type: string + description: The ID of the user message item. + content_index: + type: integer + description: The index of the content part containing the audio. + error: + type: object + description: Details of the transcription error. + properties: + type: + type: string + description: The type of error. + code: + type: string + description: Error code, if any. + message: + type: string + description: A human-readable error message. + param: + type: string + description: Parameter related to the error, if any. + required: + - event_id + - type + - item_id + - content_index + - error + x-oaiMeta: + name: conversation.item.input_audio_transcription.failed + group: realtime + example: | + { + "event_id": "event_2324", + "type": "conversation.item.input_audio_transcription.failed", + "item_id": "msg_003", + "content_index": 0, + "error": { + "type": "transcription_error", + "code": "audio_unintelligible", + "message": "The audio could not be transcribed.", + "param": null + } + } + RealtimeServerEventConversationItemTruncated: + type: object + description: Returned when an earlier assistant audio message item is truncated + by the client. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "conversation.item.truncated". + item_id: + type: string + description: The ID of the assistant message item that was truncated. + content_index: + type: integer + description: The index of the content part that was truncated. + audio_end_ms: + type: integer + description: The duration up to which the audio was truncated, in milliseconds. + required: + - event_id + - type + - item_id + - content_index + - audio_end_ms + x-oaiMeta: + name: conversation.item.truncated + group: realtime + example: | + { + "event_id": "event_2526", + "type": "conversation.item.truncated", + "item_id": "msg_004", + "content_index": 0, + "audio_end_ms": 1500 + } + RealtimeServerEventError: + type: object + description: Returned when an error occurs. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "error". + error: + type: object + description: Details of the error. + properties: + type: + type: string + description: The type of error (e.g., "invalid_request_error", "server_error"). + code: + type: string + description: Error code, if any. + message: + type: string + description: A human-readable error message. + param: + type: string + description: Parameter related to the error, if any. + event_id: + type: string + description: The event_id of the client event that caused the error, if + applicable. + required: + - event_id + - type + - error + x-oaiMeta: + name: error + group: realtime + example: | + { + "event_id": "event_890", + "type": "error", + "error": { + "type": "invalid_request_error", + "code": "invalid_event", + "message": "The 'type' field is missing.", + "param": null, + "event_id": "event_567" + } + } + RealtimeServerEventInputAudioBufferCleared: + type: object + description: Returned when the input audio buffer is cleared by the client. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "input_audio_buffer.cleared". + required: + - event_id + - type + x-oaiMeta: + name: input_audio_buffer.cleared + group: realtime + example: | + { + "event_id": "event_1314", + "type": "input_audio_buffer.cleared" + } + RealtimeServerEventInputAudioBufferCommitted: + type: object + description: Returned when an input audio buffer is committed, either by the + client or automatically in server VAD mode. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "input_audio_buffer.committed". + previous_item_id: + type: string + description: The ID of the preceding item after which the new item will be + inserted. + item_id: + type: string + description: The ID of the user message item that will be created. + required: + - event_id + - type + - previous_item_id + - item_id + x-oaiMeta: + name: input_audio_buffer.committed + group: realtime + example: | + { + "event_id": "event_1121", + "type": "input_audio_buffer.committed", + "previous_item_id": "msg_001", + "item_id": "msg_002" + } + RealtimeServerEventInputAudioBufferSpeechStarted: + type: object + description: Returned in server turn detection mode when speech is detected. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "input_audio_buffer.speech_started". + audio_start_ms: + type: integer + description: Milliseconds since the session started when speech was detected. + item_id: + type: string + description: The ID of the user message item that will be created when speech + stops. + required: + - event_id + - type + - audio_start_ms + - item_id + x-oaiMeta: + name: input_audio_buffer.speech_started + group: realtime + example: | + { + "event_id": "event_1516", + "type": "input_audio_buffer.speech_started", + "audio_start_ms": 1000, + "item_id": "msg_003" + } + RealtimeServerEventInputAudioBufferSpeechStopped: + type: object + description: Returned in server turn detection mode when speech stops. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "input_audio_buffer.speech_stopped". + audio_end_ms: + type: integer + description: Milliseconds since the session started when speech stopped. + item_id: + type: string + description: The ID of the user message item that will be created. + required: + - event_id + - type + - audio_end_ms + - item_id + x-oaiMeta: + name: input_audio_buffer.speech_stopped + group: realtime + example: | + { + "event_id": "event_1718", + "type": "input_audio_buffer.speech_stopped", + "audio_end_ms": 2000, + "item_id": "msg_003" + } + RealtimeServerEventRateLimitsUpdated: + type: object + description: Emitted after every "response.done" event to indicate the updated + rate limits. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "rate_limits.updated". + rate_limits: + type: array + description: List of rate limit information. + items: + type: object + properties: + name: + type: string + description: The name of the rate limit ("requests", "tokens", "input_tokens", + "output_tokens"). + limit: + type: integer + description: The maximum allowed value for the rate limit. + remaining: + type: integer + description: The remaining value before the limit is reached. + reset_seconds: + type: number + description: Seconds until the rate limit resets. + required: + - event_id + - type + - rate_limits + x-oaiMeta: + name: rate_limits.updated + group: realtime + example: | + { + "event_id": "event_5758", + "type": "rate_limits.updated", + "rate_limits": [ + { + "name": "requests", + "limit": 1000, + "remaining": 999, + "reset_seconds": 60 + }, + { + "name": "tokens", + "limit": 50000, + "remaining": 49950, + "reset_seconds": 60 + } + ] + } + RealtimeServerEventResponseAudioDelta: + type: object + description: Returned when the model-generated audio is updated. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "response.audio.delta". + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + delta: + type: string + description: Base64-encoded audio data delta. + required: + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - delta + x-oaiMeta: + name: response.audio.delta + group: realtime + example: | + { + "event_id": "event_4950", + "type": "response.audio.delta", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "delta": "Base64EncodedAudioDelta" + } + RealtimeServerEventResponseAudioDone: + type: object + description: Returned when the model-generated audio is done. Also emitted when + a Response is interrupted, incomplete, or cancelled. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "response.audio.done". + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + required: + - event_id + - type + - response_id + - item_id + - output_index + - content_index + x-oaiMeta: + name: response.audio.done + group: realtime + example: | + { + "event_id": "event_5152", + "type": "response.audio.done", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0 + } + RealtimeServerEventResponseAudioTranscriptDelta: + type: object + description: Returned when the model-generated transcription of audio output is + updated. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "response.audio_transcript.delta". + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + delta: + type: string + description: The transcript delta. + required: + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - delta + x-oaiMeta: + name: response.audio_transcript.delta + group: realtime + example: | + { + "event_id": "event_4546", + "type": "response.audio_transcript.delta", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "delta": "Hello, how can I a" + } + RealtimeServerEventResponseAudioTranscriptDone: + type: object + description: Returned when the model-generated transcription of audio output is + done streaming. Also emitted when a Response is interrupted, incomplete, + or cancelled. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "response.audio_transcript.done". + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + transcript: + type: string + description: The final transcript of the audio. + required: + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - transcript + x-oaiMeta: + name: response.audio_transcript.done + group: realtime + example: | + { + "event_id": "event_4748", + "type": "response.audio_transcript.done", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "transcript": "Hello, how can I assist you today?" + } + RealtimeServerEventResponseContentPartAdded: + type: object + description: Returned when a new content part is added to an assistant message + item during response generation. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "response.content_part.added". + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item to which the content part was added. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + part: + type: object + description: The content part that was added. + properties: + type: + type: string + description: The content type ("text", "audio"). + text: + type: string + description: The text content (if type is "text"). + audio: + type: string + description: Base64-encoded audio data (if type is "audio"). + transcript: + type: string + description: The transcript of the audio (if type is "audio"). + required: + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - part + x-oaiMeta: + name: response.content_part.added + group: realtime + example: | + { + "event_id": "event_3738", + "type": "response.content_part.added", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "part": { + "type": "text", + "text": "" + } + } + RealtimeServerEventResponseContentPartDone: + type: object + description: Returned when a content part is done streaming in an assistant + message item. Also emitted when a Response is interrupted, incomplete, + or cancelled. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "response.content_part.done". + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + part: + type: object + description: The content part that is done. + properties: + type: + type: string + description: The content type ("text", "audio"). + text: + type: string + description: The text content (if type is "text"). + audio: + type: string + description: Base64-encoded audio data (if type is "audio"). + transcript: + type: string + description: The transcript of the audio (if type is "audio"). + required: + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - part + x-oaiMeta: + name: response.content_part.done + group: realtime + example: | + { + "event_id": "event_3940", + "type": "response.content_part.done", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "part": { + "type": "text", + "text": "Sure, I can help with that." + } + } + RealtimeServerEventResponseCreated: + type: object + description: Returned when a new Response is created. The first event of + response creation, where the response is in an initial state of + "in_progress". + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "response.created". + response: + type: object + description: The response resource. + properties: + id: + type: string + description: The unique ID of the response. + object: + type: string + description: The object type, must be "realtime.response". + status: + type: string + description: The status of the response ("in_progress"). + status_details: + type: object + description: Additional details about the status. + output: + type: array + description: The list of output items generated by the response. + items: + type: object + description: An item in the response output. + usage: + type: object + description: Usage statistics for the response. + required: + - event_id + - type + - response + x-oaiMeta: + name: response.created + group: realtime + example: | + { + "event_id": "event_2930", + "type": "response.created", + "response": { + "id": "resp_001", + "object": "realtime.response", + "status": "in_progress", + "status_details": null, + "output": [], + "usage": null + } + } + RealtimeServerEventResponseDone: + type: object + description: Returned when a Response is done streaming. Always emitted, no + matter the final state. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "response.done". + response: + type: object + description: The response resource. + properties: + id: + type: string + description: The unique ID of the response. + object: + type: string + description: The object type, must be "realtime.response". + status: + type: string + description: The final status of the response ("completed", "cancelled", + "failed", "incomplete"). + status_details: + type: object + description: Additional details about the status. + output: + type: array + description: The list of output items generated by the response. + items: + type: object + description: An item in the response output. + usage: + type: object + description: Usage statistics for the response. + required: + - event_id + - type + - response + x-oaiMeta: + name: response.done + group: realtime + example: | + { + "event_id": "event_3132", + "type": "response.done", + "response": { + "id": "resp_001", + "object": "realtime.response", + "status": "completed", + "status_details": null, + "output": [ + { + "id": "msg_006", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "text", + "text": "Sure, how can I assist you today?" + } + ] + } + ], + "usage": { + "total_tokens": 50, + "input_tokens": 20, + "output_tokens": 30 + } + } + } + RealtimeServerEventResponseFunctionCallArgumentsDelta: + type: object + description: Returned when the model-generated function call arguments are updated. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "response.function_call_arguments.delta". + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the function call item. + output_index: + type: integer + description: The index of the output item in the response. + call_id: + type: string + description: The ID of the function call. + delta: + type: string + description: The arguments delta as a JSON string. + required: + - event_id + - type + - response_id + - item_id + - output_index + - call_id + - delta + x-oaiMeta: + name: response.function_call_arguments.delta + group: realtime + example: | + { + "event_id": "event_5354", + "type": "response.function_call_arguments.delta", + "response_id": "resp_002", + "item_id": "fc_001", + "output_index": 0, + "call_id": "call_001", + "delta": "{\"location\": \"San\"" + } + RealtimeServerEventResponseFunctionCallArgumentsDone: + type: object + description: Returned when the model-generated function call arguments are done + streaming. Also emitted when a Response is interrupted, incomplete, or + cancelled. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "response.function_call_arguments.done". + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the function call item. + output_index: + type: integer + description: The index of the output item in the response. + call_id: + type: string + description: The ID of the function call. + arguments: + type: string + description: The final arguments as a JSON string. + required: + - event_id + - type + - response_id + - item_id + - output_index + - call_id + - arguments + x-oaiMeta: + name: response.function_call_arguments.done + group: realtime + example: | + { + "event_id": "event_5556", + "type": "response.function_call_arguments.done", + "response_id": "resp_002", + "item_id": "fc_001", + "output_index": 0, + "call_id": "call_001", + "arguments": "{\"location\": \"San Francisco\"}" + } + RealtimeServerEventResponseOutputItemAdded: + type: object + description: Returned when a new Item is created during response generation. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "response.output_item.added". + response_id: + type: string + description: The ID of the response to which the item belongs. + output_index: + type: integer + description: The index of the output item in the response. + item: + type: object + description: The item that was added. + properties: + id: + type: string + description: The unique ID of the item. + object: + type: string + description: The object type, must be "realtime.item". + type: + type: string + description: The type of the item ("message", "function_call", + "function_call_output"). + status: + type: string + description: The status of the item ("in_progress", "completed"). + role: + type: string + description: The role associated with the item ("assistant"). + content: + type: array + description: The content of the item. + items: + type: object + properties: + type: + type: string + description: The content type ("text", "audio"). + text: + type: string + description: The text content. + audio: + type: string + description: Base64-encoded audio data. + transcript: + type: string + description: The transcript of the audio. + required: + - event_id + - type + - response_id + - output_index + - item + x-oaiMeta: + name: response.output_item.added + group: realtime + example: | + { + "event_id": "event_3334", + "type": "response.output_item.added", + "response_id": "resp_001", + "output_index": 0, + "item": { + "id": "msg_007", + "object": "realtime.item", + "type": "message", + "status": "in_progress", + "role": "assistant", + "content": [] + } + } + RealtimeServerEventResponseOutputItemDone: + type: object + description: Returned when an Item is done streaming. Also emitted when a + Response is interrupted, incomplete, or cancelled. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "response.output_item.done". + response_id: + type: string + description: The ID of the response to which the item belongs. + output_index: + type: integer + description: The index of the output item in the response. + item: + type: object + description: The completed item. + properties: + id: + type: string + description: The unique ID of the item. + object: + type: string + description: The object type, must be "realtime.item". + type: + type: string + description: The type of the item ("message", "function_call", + "function_call_output"). + status: + type: string + description: The final status of the item ("completed", "incomplete"). + role: + type: string + description: The role associated with the item ("assistant"). + content: + type: array + description: The content of the item. + items: + type: object + properties: + type: + type: string + description: The content type ("text", "audio"). + text: + type: string + description: The text content. + audio: + type: string + description: Base64-encoded audio data. + transcript: + type: string + description: The transcript of the audio. + required: + - event_id + - type + - response_id + - output_index + - item + x-oaiMeta: + name: response.output_item.done + group: realtime + example: | + { + "event_id": "event_3536", + "type": "response.output_item.done", + "response_id": "resp_001", + "output_index": 0, + "item": { + "id": "msg_007", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "text", + "text": "Sure, I can help with that." + } + ] + } + } + RealtimeServerEventResponseTextDelta: + type: object + description: Returned when the text value of a "text" content part is updated. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "response.text.delta". + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + delta: + type: string + description: The text delta. + required: + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - delta + x-oaiMeta: + name: response.text.delta + group: realtime + example: | + { + "event_id": "event_4142", + "type": "response.text.delta", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "delta": "Sure, I can h" + } + RealtimeServerEventResponseTextDone: + type: object + description: Returned when the text value of a "text" content part is done + streaming. Also emitted when a Response is interrupted, incomplete, or + cancelled. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "response.text.done". + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + text: + type: string + description: The final text content. + required: + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - text + x-oaiMeta: + name: response.text.done + group: realtime + example: | + { + "event_id": "event_4344", + "type": "response.text.done", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "text": "Sure, I can help with that." + } + RealtimeServerEventSessionCreated: + type: object + description: Returned when a session is created. Emitted automatically when a + new connection is established. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "session.created". + session: + type: object + description: The session resource. + properties: + id: + type: string + description: The unique ID of the session. + object: + type: string + description: The object type, must be "realtime.session". + model: + type: string + description: The default model used for this session. + modalities: + type: array + items: + type: string + description: The set of modalities the model can respond with. + instructions: + type: string + description: The default system instructions. + voice: + type: string + description: The voice the model uses to respond - one of `alloy`, `echo`, or + `shimmer`. + input_audio_format: + type: string + description: The format of input audio. + output_audio_format: + type: string + description: The format of output audio. + input_audio_transcription: + type: object + description: Configuration for input audio transcription. + properties: + enabled: + type: boolean + description: Whether input audio transcription is enabled. + model: + type: string + description: The model used for transcription. + turn_detection: + type: object + description: Configuration for turn detection. + properties: + type: + type: string + description: The type of turn detection ("server_vad" or "none"). + threshold: + type: number + description: Activation threshold for VAD. + prefix_padding_ms: + type: integer + description: Audio included before speech starts (in milliseconds). + silence_duration_ms: + type: integer + description: Duration of silence to detect speech stop (in milliseconds). + tools: + type: array + description: Tools (functions) available to the model. + items: + type: object + properties: + type: + type: string + description: The type of the tool. + name: + type: string + description: The name of the function. + description: + type: string + description: The description of the function. + parameters: + type: object + description: Parameters of the function in JSON Schema. + tool_choice: + type: string + description: How the model chooses tools. + temperature: + type: number + description: Sampling temperature. + max_output_tokens: + oneOf: + - type: integer + - type: string + enum: + - inf + description: Maximum number of output tokens. + required: + - event_id + - type + - session + x-oaiMeta: + name: session.created + group: realtime + example: | + { + "event_id": "event_1234", + "type": "session.created", + "session": { + "id": "sess_001", + "object": "realtime.session", + "model": "gpt-4o-realtime-preview-2024-10-01", + "modalities": ["text", "audio"], + "instructions": "", + "voice": "alloy", + "input_audio_format": "pcm16", + "output_audio_format": "pcm16", + "input_audio_transcription": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200 + }, + "tools": [], + "tool_choice": "auto", + "temperature": 0.8, + "max_output_tokens": null + } + } + RealtimeServerEventSessionUpdated: + type: object + description: Returned when a session is updated. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + description: The event type, must be "session.updated". + session: + type: object + description: The updated session resource. + properties: + id: + type: string + description: The unique ID of the session. + object: + type: string + description: The object type, must be "realtime.session". + model: + type: string + description: The default model used for this session. + modalities: + type: array + items: + type: string + description: The set of modalities the model can respond with. + instructions: + type: string + description: The default system instructions. + voice: + type: string + description: The voice the model uses to respond - one of `alloy`, `echo`, or + `shimmer`. + input_audio_format: + type: string + description: The format of input audio. + output_audio_format: + type: string + description: The format of output audio. + input_audio_transcription: + type: object + description: Configuration for input audio transcription. + properties: + enabled: + type: boolean + description: Whether input audio transcription is enabled. + model: + type: string + description: The model used for transcription. + turn_detection: + type: object + description: Configuration for turn detection. + properties: + type: + type: string + description: The type of turn detection ("server_vad" or "none"). + threshold: + type: number + description: Activation threshold for VAD. + prefix_padding_ms: + type: integer + description: Audio included before speech starts (in milliseconds). + silence_duration_ms: + type: integer + description: Duration of silence to detect speech stop (in milliseconds). + tools: + type: array + description: Tools (functions) available to the model. + items: + type: object + properties: + type: + type: string + description: The type of the tool. + name: + type: string + description: The name of the function. + description: + type: string + description: The description of the function. + parameters: + type: object + description: Parameters of the function in JSON Schema. + tool_choice: + type: string + description: How the model chooses tools. + temperature: + type: number + description: Sampling temperature. + max_output_tokens: + oneOf: + - type: integer + - type: string + enum: + - inf + description: Maximum number of output tokens. + required: + - event_id + - type + - session + x-oaiMeta: + name: session.updated + group: realtime + example: | + { + "event_id": "event_5678", + "type": "session.updated", + "session": { + "id": "sess_001", + "object": "realtime.session", + "model": "gpt-4o-realtime-preview-2024-10-01", + "modalities": ["text"], + "instructions": "New instructions", + "voice": "alloy", + "input_audio_format": "pcm16", + "output_audio_format": "pcm16", + "input_audio_transcription": { + "enabled": true, + "model": "whisper-1" + }, + "turn_detection": { + "type": "none" + }, + "tools": [], + "tool_choice": "none", + "temperature": 0.7, + "max_output_tokens": 200 + } + } + ResponseFormatJsonObject: + type: object + properties: + type: + type: string + description: "The type of response format being defined: `json_object`" + enum: + - json_object + required: + - type + ResponseFormatJsonSchema: + type: object + properties: + type: + type: string + description: "The type of response format being defined: `json_schema`" + enum: + - json_schema + json_schema: + type: object + properties: + description: + type: string + description: A description of what the response format is for, used by the model + to determine how to respond in the format. + name: + type: string + description: The name of the response format. Must be a-z, A-Z, 0-9, or contain + underscores and dashes, with a maximum length of 64. + schema: + $ref: "#/components/schemas/ResponseFormatJsonSchemaSchema" + strict: + type: boolean + nullable: true + default: false + description: Whether to enable strict schema adherence when generating the + output. If set to true, the model will always follow the exact + schema defined in the `schema` field. Only a subset of JSON + Schema is supported when `strict` is `true`. To learn more, read + the [Structured Outputs guide](/docs/guides/structured-outputs). + required: + - type + - name + required: + - type + - json_schema + ResponseFormatJsonSchemaSchema: + type: object + description: The schema for the response format, described as a JSON Schema object. + additionalProperties: true + ResponseFormatText: + type: object + properties: + type: + type: string + description: "The type of response format being defined: `text`" + enum: + - text + required: + - type + RunCompletionUsage: + type: object + description: Usage statistics related to the run. This value will be `null` if + the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.). + properties: + completion_tokens: + type: integer + description: Number of completion tokens used over the course of the run. + prompt_tokens: + type: integer + description: Number of prompt tokens used over the course of the run. + total_tokens: + type: integer + description: Total number of tokens used (prompt + completion). + required: + - prompt_tokens + - completion_tokens + - total_tokens + nullable: true + RunObject: + type: object + title: A run on a thread + description: Represents an execution run on a [thread](/docs/api-reference/threads). + properties: + id: + description: The identifier, which can be referenced in API endpoints. + type: string + object: + description: The object type, which is always `thread.run`. + type: string + enum: + - thread.run + created_at: + description: The Unix timestamp (in seconds) for when the run was created. + type: integer + thread_id: + description: The ID of the [thread](/docs/api-reference/threads) that was + executed on as a part of this run. + type: string + assistant_id: + description: The ID of the [assistant](/docs/api-reference/assistants) used for + execution of this run. + type: string + status: + description: The status of the run, which can be either `queued`, `in_progress`, + `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, + `incomplete`, or `expired`. + type: string + enum: + - queued + - in_progress + - requires_action + - cancelling + - cancelled + - failed + - completed + - incomplete + - expired + required_action: + type: object + description: Details on the action required to continue the run. Will be `null` + if no action is required. + nullable: true + properties: + type: + description: For now, this is always `submit_tool_outputs`. + type: string + enum: + - submit_tool_outputs + submit_tool_outputs: + type: object + description: Details on the tool outputs needed for this run to continue. + properties: + tool_calls: + type: array + description: A list of the relevant tool calls. + items: + $ref: "#/components/schemas/RunToolCallObject" + required: + - tool_calls + required: + - type + - submit_tool_outputs + last_error: + type: object + description: The last error associated with this run. Will be `null` if there + are no errors. + nullable: true + properties: + code: + type: string + description: One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`. + enum: + - server_error + - rate_limit_exceeded + - invalid_prompt + message: + type: string + description: A human-readable description of the error. + required: + - code + - message + expires_at: + description: The Unix timestamp (in seconds) for when the run will expire. + type: integer + nullable: true + started_at: + description: The Unix timestamp (in seconds) for when the run was started. + type: integer + nullable: true + cancelled_at: + description: The Unix timestamp (in seconds) for when the run was cancelled. + type: integer + nullable: true + failed_at: + description: The Unix timestamp (in seconds) for when the run failed. + type: integer + nullable: true + completed_at: + description: The Unix timestamp (in seconds) for when the run was completed. + type: integer + nullable: true + incomplete_details: + description: Details on why the run is incomplete. Will be `null` if the run is + not incomplete. + type: object + nullable: true + properties: + reason: + description: The reason why the run is incomplete. This will point to which + specific token limit was reached over the course of the run. + type: string + enum: + - max_completion_tokens + - max_prompt_tokens + model: + description: The model that the [assistant](/docs/api-reference/assistants) used + for this run. + type: string + instructions: + description: The instructions that the + [assistant](/docs/api-reference/assistants) used for this run. + type: string + tools: + description: The list of tools that the + [assistant](/docs/api-reference/assistants) used for this run. + default: [ ] + type: array + maxItems: 20 + items: + oneOf: + - $ref: "#/components/schemas/AssistantToolsCode" + - $ref: "#/components/schemas/AssistantToolsFileSearch" + - $ref: "#/components/schemas/AssistantToolsFunction" + x-oaiExpandable: true + metadata: + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be useful for storing additional information about the object in + a structured format. Keys can be a maximum of 64 characters long and + values can be a maximum of 512 characters long. + type: object + x-oaiTypeLabel: map + nullable: true + usage: + $ref: "#/components/schemas/RunCompletionUsage" + temperature: + description: The sampling temperature used for this run. If not set, defaults to + 1. + type: number + nullable: true + top_p: + description: The nucleus sampling value used for this run. If not set, defaults + to 1. + type: number + nullable: true + max_prompt_tokens: + type: integer + nullable: true + description: > + The maximum number of prompt tokens specified to have been used over + the course of the run. + minimum: 256 + max_completion_tokens: + type: integer + nullable: true + description: > + The maximum number of completion tokens specified to have been used + over the course of the run. + minimum: 256 + truncation_strategy: + $ref: "#/components/schemas/TruncationObject" + nullable: true + tool_choice: + $ref: "#/components/schemas/AssistantsApiToolChoiceOption" + nullable: true + parallel_tool_calls: + $ref: "#/components/schemas/ParallelToolCalls" + response_format: + $ref: "#/components/schemas/AssistantsApiResponseFormatOption" + nullable: true + required: + - id + - object + - created_at + - thread_id + - assistant_id + - status + - required_action + - last_error + - expires_at + - started_at + - cancelled_at + - failed_at + - completed_at + - model + - instructions + - tools + - metadata + - usage + - incomplete_details + - max_prompt_tokens + - max_completion_tokens + - truncation_strategy + - tool_choice + - parallel_tool_calls + - response_format + x-oaiMeta: + name: The run object + beta: true + example: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1698107661, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699073476, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699073498, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "tools": [{"type": "file_search"}, {"type": "code_interpreter"}], + "metadata": {}, + "incomplete_details": null, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + RunStepCompletionUsage: + type: object + description: Usage statistics related to the run step. This value will be `null` + while the run step's status is `in_progress`. + properties: + completion_tokens: + type: integer + description: Number of completion tokens used over the course of the run step. + prompt_tokens: + type: integer + description: Number of prompt tokens used over the course of the run step. + total_tokens: + type: integer + description: Total number of tokens used (prompt + completion). + required: + - prompt_tokens + - completion_tokens + - total_tokens + nullable: true + RunStepDeltaObject: + type: object + title: Run step delta object + description: > + Represents a run step delta i.e. any changed fields on a run step during + streaming. + properties: + id: + description: The identifier of the run step, which can be referenced in API + endpoints. + type: string + object: + description: The object type, which is always `thread.run.step.delta`. + type: string + enum: + - thread.run.step.delta + delta: + description: The delta containing the fields that have changed on the run step. + type: object + properties: + step_details: + type: object + description: The details of the run step. + oneOf: + - $ref: "#/components/schemas/RunStepDeltaStepDetailsMessageCreationObject" + - $ref: "#/components/schemas/RunStepDeltaStepDetailsToolCallsObject" + x-oaiExpandable: true + required: + - id + - object + - delta + x-oaiMeta: + name: The run step delta object + beta: true + example: | + { + "id": "step_123", + "object": "thread.run.step.delta", + "delta": { + "step_details": { + "type": "tool_calls", + "tool_calls": [ + { + "index": 0, + "id": "call_123", + "type": "code_interpreter", + "code_interpreter": { "input": "", "outputs": [] } + } + ] + } + } + } + RunStepDeltaStepDetailsMessageCreationObject: + title: Message creation + type: object + description: Details of the message creation by the run step. + properties: + type: + description: Always `message_creation`. + type: string + enum: + - message_creation + message_creation: + type: object + properties: + message_id: + type: string + description: The ID of the message that was created by this run step. + required: + - type + RunStepDeltaStepDetailsToolCallsCodeObject: + title: Code interpreter tool call + type: object + description: Details of the Code Interpreter tool call the run step was involved in. + properties: + index: + type: integer + description: The index of the tool call in the tool calls array. + id: + type: string + description: The ID of the tool call. + type: + type: string + description: The type of tool call. This is always going to be + `code_interpreter` for this type of tool call. + enum: + - code_interpreter + code_interpreter: + type: object + description: The Code Interpreter tool call definition. + properties: + input: + type: string + description: The input to the Code Interpreter tool call. + outputs: + type: array + description: The outputs from the Code Interpreter tool call. Code Interpreter + can output one or more items, including text (`logs`) or images + (`image`). Each of these are represented by a different object + type. + items: + type: object + oneOf: + - $ref: "#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeOutputLogsObjec\ + t" + - $ref: "#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeOutputImageObje\ + ct" + x-oaiExpandable: true + required: + - index + - type + RunStepDeltaStepDetailsToolCallsCodeOutputImageObject: + title: Code interpreter image output + type: object + properties: + index: + type: integer + description: The index of the output in the outputs array. + type: + description: Always `image`. + type: string + enum: + - image + image: + type: object + properties: + file_id: + description: The [file](/docs/api-reference/files) ID of the image. + type: string + required: + - index + - type + RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject: + title: Code interpreter log output + type: object + description: Text output from the Code Interpreter tool call as part of a run step. + properties: + index: + type: integer + description: The index of the output in the outputs array. + type: + description: Always `logs`. + type: string + enum: + - logs + logs: + type: string + description: The text output from the Code Interpreter tool call. + required: + - index + - type + RunStepDeltaStepDetailsToolCallsFileSearchObject: + title: File search tool call + type: object + properties: + index: + type: integer + description: The index of the tool call in the tool calls array. + id: + type: string + description: The ID of the tool call object. + type: + type: string + description: The type of tool call. This is always going to be `file_search` for + this type of tool call. + enum: + - file_search + file_search: + type: object + description: For now, this is always going to be an empty object. + x-oaiTypeLabel: map + required: + - index + - type + - file_search + RunStepDeltaStepDetailsToolCallsFunctionObject: + type: object + title: Function tool call + properties: + index: + type: integer + description: The index of the tool call in the tool calls array. + id: + type: string + description: The ID of the tool call object. + type: + type: string + description: The type of tool call. This is always going to be `function` for + this type of tool call. + enum: + - function + function: + type: object + description: The definition of the function that was called. + properties: + name: + type: string + description: The name of the function. + arguments: + type: string + description: The arguments passed to the function. + output: + type: string + description: The output of the function. This will be `null` if the outputs have + not been [submitted](/docs/api-reference/runs/submitToolOutputs) + yet. + nullable: true + required: + - index + - type + RunStepDeltaStepDetailsToolCallsObject: + title: Tool calls + type: object + description: Details of the tool call. + properties: + type: + description: Always `tool_calls`. + type: string + enum: + - tool_calls + tool_calls: + type: array + description: > + An array of tool calls the run step was involved in. These can be + associated with one of three types of tools: `code_interpreter`, + `file_search`, or `function`. + items: + oneOf: + - $ref: "#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeObject" + - $ref: "#/components/schemas/RunStepDeltaStepDetailsToolCallsFileSearchObject" + - $ref: "#/components/schemas/RunStepDeltaStepDetailsToolCallsFunctionObject" + x-oaiExpandable: true + required: + - type + RunStepDetailsMessageCreationObject: + title: Message creation + type: object + description: Details of the message creation by the run step. + properties: + type: + description: Always `message_creation`. + type: string + enum: + - message_creation + message_creation: + type: object + properties: + message_id: + type: string + description: The ID of the message that was created by this run step. + required: + - message_id + required: + - type + - message_creation + RunStepDetailsToolCallsCodeObject: + title: Code Interpreter tool call + type: object + description: Details of the Code Interpreter tool call the run step was involved in. + properties: + id: + type: string + description: The ID of the tool call. + type: + type: string + description: The type of tool call. This is always going to be + `code_interpreter` for this type of tool call. + enum: + - code_interpreter + code_interpreter: + type: object + description: The Code Interpreter tool call definition. + required: + - input + - outputs + properties: + input: + type: string + description: The input to the Code Interpreter tool call. + outputs: + type: array + description: The outputs from the Code Interpreter tool call. Code Interpreter + can output one or more items, including text (`logs`) or images + (`image`). Each of these are represented by a different object + type. + items: + type: object + oneOf: + - $ref: "#/components/schemas/RunStepDetailsToolCallsCodeOutputLogsObject" + - $ref: "#/components/schemas/RunStepDetailsToolCallsCodeOutputImageObject" + x-oaiExpandable: true + required: + - id + - type + - code_interpreter + RunStepDetailsToolCallsCodeOutputImageObject: + title: Code Interpreter image output + type: object + properties: + type: + description: Always `image`. + type: string + enum: + - image + image: + type: object + properties: + file_id: + description: The [file](/docs/api-reference/files) ID of the image. + type: string + required: + - file_id + required: + - type + - image + RunStepDetailsToolCallsCodeOutputLogsObject: + title: Code Interpreter log output + type: object + description: Text output from the Code Interpreter tool call as part of a run step. + properties: + type: + description: Always `logs`. + type: string + enum: + - logs + logs: + type: string + description: The text output from the Code Interpreter tool call. + required: + - type + - logs + RunStepDetailsToolCallsFileSearchObject: + title: File search tool call + type: object + properties: + id: + type: string + description: The ID of the tool call object. + type: + type: string + description: The type of tool call. This is always going to be `file_search` for + this type of tool call. + enum: + - file_search + file_search: + type: object + description: For now, this is always going to be an empty object. + x-oaiTypeLabel: map + properties: + ranking_options: + $ref: "#/components/schemas/RunStepDetailsToolCallsFileSearchRankingOptionsObje\ + ct" + results: + type: array + description: The results of the file search. + items: + $ref: "#/components/schemas/RunStepDetailsToolCallsFileSearchResultObject" + required: + - id + - type + - file_search + RunStepDetailsToolCallsFileSearchRankingOptionsObject: + title: File search tool call ranking options + type: object + description: The ranking options for the file search. + properties: + ranker: + type: string + description: The ranker used for the file search. + enum: + - default_2024_08_21 + score_threshold: + type: number + description: The score threshold for the file search. All values must be a + floating point number between 0 and 1. + minimum: 0 + maximum: 1 + required: + - ranker + - score_threshold + RunStepDetailsToolCallsFileSearchResultObject: + title: File search tool call result + type: object + description: A result instance of the file search. + x-oaiTypeLabel: map + properties: + file_id: + type: string + description: The ID of the file that result was found in. + file_name: + type: string + description: The name of the file that result was found in. + score: + type: number + description: The score of the result. All values must be a floating point number + between 0 and 1. + minimum: 0 + maximum: 1 + content: + type: array + description: The content of the result that was found. The content is only + included if requested via the include query parameter. + items: + type: object + properties: + type: + type: string + description: The type of the content. + enum: + - text + text: + type: string + description: The text content of the file. + required: + - file_id + - file_name + - score + RunStepDetailsToolCallsFunctionObject: + type: object + title: Function tool call + properties: + id: + type: string + description: The ID of the tool call object. + type: + type: string + description: The type of tool call. This is always going to be `function` for + this type of tool call. + enum: + - function + function: + type: object + description: The definition of the function that was called. + properties: + name: + type: string + description: The name of the function. + arguments: + type: string + description: The arguments passed to the function. + output: + type: string + description: The output of the function. This will be `null` if the outputs have + not been [submitted](/docs/api-reference/runs/submitToolOutputs) + yet. + nullable: true + required: + - name + - arguments + - output + required: + - id + - type + - function + RunStepDetailsToolCallsObject: + title: Tool calls + type: object + description: Details of the tool call. + properties: + type: + description: Always `tool_calls`. + type: string + enum: + - tool_calls + tool_calls: + type: array + description: > + An array of tool calls the run step was involved in. These can be + associated with one of three types of tools: `code_interpreter`, + `file_search`, or `function`. + items: + oneOf: + - $ref: "#/components/schemas/RunStepDetailsToolCallsCodeObject" + - $ref: "#/components/schemas/RunStepDetailsToolCallsFileSearchObject" + - $ref: "#/components/schemas/RunStepDetailsToolCallsFunctionObject" + x-oaiExpandable: true + required: + - type + - tool_calls + RunStepObject: + type: object + title: Run steps + description: | + Represents a step in execution of a run. + properties: + id: + description: The identifier of the run step, which can be referenced in API + endpoints. + type: string + object: + description: The object type, which is always `thread.run.step`. + type: string + enum: + - thread.run.step + created_at: + description: The Unix timestamp (in seconds) for when the run step was created. + type: integer + assistant_id: + description: The ID of the [assistant](/docs/api-reference/assistants) + associated with the run step. + type: string + thread_id: + description: The ID of the [thread](/docs/api-reference/threads) that was run. + type: string + run_id: + description: The ID of the [run](/docs/api-reference/runs) that this run step is + a part of. + type: string + type: + description: The type of run step, which can be either `message_creation` or + `tool_calls`. + type: string + enum: + - message_creation + - tool_calls + status: + description: The status of the run step, which can be either `in_progress`, + `cancelled`, `failed`, `completed`, or `expired`. + type: string + enum: + - in_progress + - cancelled + - failed + - completed + - expired + step_details: + type: object + description: The details of the run step. + oneOf: + - $ref: "#/components/schemas/RunStepDetailsMessageCreationObject" + - $ref: "#/components/schemas/RunStepDetailsToolCallsObject" + x-oaiExpandable: true + last_error: + type: object + description: The last error associated with this run step. Will be `null` if + there are no errors. + nullable: true + properties: + code: + type: string + description: One of `server_error` or `rate_limit_exceeded`. + enum: + - server_error + - rate_limit_exceeded + message: + type: string + description: A human-readable description of the error. + required: + - code + - message + expired_at: + description: The Unix timestamp (in seconds) for when the run step expired. A + step is considered expired if the parent run is expired. + type: integer + nullable: true + cancelled_at: + description: The Unix timestamp (in seconds) for when the run step was cancelled. + type: integer + nullable: true + failed_at: + description: The Unix timestamp (in seconds) for when the run step failed. + type: integer + nullable: true + completed_at: + description: The Unix timestamp (in seconds) for when the run step completed. + type: integer + nullable: true + metadata: + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be useful for storing additional information about the object in + a structured format. Keys can be a maximum of 64 characters long and + values can be a maximum of 512 characters long. + type: object + x-oaiTypeLabel: map + nullable: true + usage: + $ref: "#/components/schemas/RunStepCompletionUsage" + required: + - id + - object + - created_at + - assistant_id + - thread_id + - run_id + - type + - status + - step_details + - last_error + - expired_at + - cancelled_at + - failed_at + - completed_at + - metadata + - usage + x-oaiMeta: + name: The run step object + beta: true + example: | + { + "id": "step_abc123", + "object": "thread.run.step", + "created_at": 1699063291, + "run_id": "run_abc123", + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "type": "message_creation", + "status": "completed", + "cancelled_at": null, + "completed_at": 1699063291, + "expired_at": null, + "failed_at": null, + "last_error": null, + "step_details": { + "type": "message_creation", + "message_creation": { + "message_id": "msg_abc123" + } + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + } + } + RunStepStreamEvent: + oneOf: + - type: object + properties: + event: + type: string + enum: + - thread.run.step.created + data: + $ref: "#/components/schemas/RunStepObject" + required: + - event + - data + description: Occurs when a [run step](/docs/api-reference/run-steps/step-object) + is created. + x-oaiMeta: + dataDescription: "`data` is a [run step](/docs/api-reference/run-steps/step-object)" + - type: object + properties: + event: + type: string + enum: + - thread.run.step.in_progress + data: + $ref: "#/components/schemas/RunStepObject" + required: + - event + - data + description: Occurs when a [run step](/docs/api-reference/run-steps/step-object) + moves to an `in_progress` state. + x-oaiMeta: + dataDescription: "`data` is a [run step](/docs/api-reference/run-steps/step-object)" + - type: object + properties: + event: + type: string + enum: + - thread.run.step.delta + data: + $ref: "#/components/schemas/RunStepDeltaObject" + required: + - event + - data + description: Occurs when parts of a [run + step](/docs/api-reference/run-steps/step-object) are being streamed. + x-oaiMeta: + dataDescription: "`data` is a [run step + delta](/docs/api-reference/assistants-streaming/run-step-delta-ob\ + ject)" + - type: object + properties: + event: + type: string + enum: + - thread.run.step.completed + data: + $ref: "#/components/schemas/RunStepObject" + required: + - event + - data + description: Occurs when a [run step](/docs/api-reference/run-steps/step-object) + is completed. + x-oaiMeta: + dataDescription: "`data` is a [run step](/docs/api-reference/run-steps/step-object)" + - type: object + properties: + event: + type: string + enum: + - thread.run.step.failed + data: + $ref: "#/components/schemas/RunStepObject" + required: + - event + - data + description: Occurs when a [run step](/docs/api-reference/run-steps/step-object) + fails. + x-oaiMeta: + dataDescription: "`data` is a [run step](/docs/api-reference/run-steps/step-object)" + - type: object + properties: + event: + type: string + enum: + - thread.run.step.cancelled + data: + $ref: "#/components/schemas/RunStepObject" + required: + - event + - data + description: Occurs when a [run step](/docs/api-reference/run-steps/step-object) + is cancelled. + x-oaiMeta: + dataDescription: "`data` is a [run step](/docs/api-reference/run-steps/step-object)" + - type: object + properties: + event: + type: string + enum: + - thread.run.step.expired + data: + $ref: "#/components/schemas/RunStepObject" + required: + - event + - data + description: Occurs when a [run step](/docs/api-reference/run-steps/step-object) + expires. + x-oaiMeta: + dataDescription: "`data` is a [run step](/docs/api-reference/run-steps/step-object)" + RunStreamEvent: + oneOf: + - type: object + properties: + event: + type: string + enum: + - thread.run.created + data: + $ref: "#/components/schemas/RunObject" + required: + - event + - data + description: Occurs when a new [run](/docs/api-reference/runs/object) is created. + x-oaiMeta: + dataDescription: "`data` is a [run](/docs/api-reference/runs/object)" + - type: object + properties: + event: + type: string + enum: + - thread.run.queued + data: + $ref: "#/components/schemas/RunObject" + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) moves to a + `queued` status. + x-oaiMeta: + dataDescription: "`data` is a [run](/docs/api-reference/runs/object)" + - type: object + properties: + event: + type: string + enum: + - thread.run.in_progress + data: + $ref: "#/components/schemas/RunObject" + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) moves to an + `in_progress` status. + x-oaiMeta: + dataDescription: "`data` is a [run](/docs/api-reference/runs/object)" + - type: object + properties: + event: + type: string + enum: + - thread.run.requires_action + data: + $ref: "#/components/schemas/RunObject" + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) moves to a + `requires_action` status. + x-oaiMeta: + dataDescription: "`data` is a [run](/docs/api-reference/runs/object)" + - type: object + properties: + event: + type: string + enum: + - thread.run.completed + data: + $ref: "#/components/schemas/RunObject" + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) is completed. + x-oaiMeta: + dataDescription: "`data` is a [run](/docs/api-reference/runs/object)" + - type: object + properties: + event: + type: string + enum: + - thread.run.incomplete + data: + $ref: "#/components/schemas/RunObject" + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) ends with + status `incomplete`. + x-oaiMeta: + dataDescription: "`data` is a [run](/docs/api-reference/runs/object)" + - type: object + properties: + event: + type: string + enum: + - thread.run.failed + data: + $ref: "#/components/schemas/RunObject" + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) fails. + x-oaiMeta: + dataDescription: "`data` is a [run](/docs/api-reference/runs/object)" + - type: object + properties: + event: + type: string + enum: + - thread.run.cancelling + data: + $ref: "#/components/schemas/RunObject" + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) moves to a + `cancelling` status. + x-oaiMeta: + dataDescription: "`data` is a [run](/docs/api-reference/runs/object)" + - type: object + properties: + event: + type: string + enum: + - thread.run.cancelled + data: + $ref: "#/components/schemas/RunObject" + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) is cancelled. + x-oaiMeta: + dataDescription: "`data` is a [run](/docs/api-reference/runs/object)" + - type: object + properties: + event: + type: string + enum: + - thread.run.expired + data: + $ref: "#/components/schemas/RunObject" + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) expires. + x-oaiMeta: + dataDescription: "`data` is a [run](/docs/api-reference/runs/object)" + RunToolCallObject: + type: object + description: Tool call objects + properties: + id: + type: string + description: The ID of the tool call. This ID must be referenced when you submit + the tool outputs in using the [Submit tool outputs to + run](/docs/api-reference/runs/submitToolOutputs) endpoint. + type: + type: string + description: The type of tool call the output is required for. For now, this is + always `function`. + enum: + - function + function: + type: object + description: The function definition. + properties: + name: + type: string + description: The name of the function. + arguments: + type: string + description: The arguments that the model expects you to pass to the function. + required: + - name + - arguments + required: + - id + - type + - function + StaticChunkingStrategy: + type: object + additionalProperties: false + properties: + max_chunk_size_tokens: + type: integer + minimum: 100 + maximum: 4096 + description: The maximum number of tokens in each chunk. The default value is + `800`. The minimum value is `100` and the maximum value is `4096`. + chunk_overlap_tokens: + type: integer + description: > + The number of tokens that overlap between chunks. The default value + is `400`. + + + Note that the overlap must not exceed half of + `max_chunk_size_tokens`. + required: + - max_chunk_size_tokens + - chunk_overlap_tokens + StaticChunkingStrategyRequestParam: + type: object + title: Static Chunking Strategy + additionalProperties: false + properties: + type: + type: string + description: Always `static`. + enum: + - static + static: + $ref: "#/components/schemas/StaticChunkingStrategy" + required: + - type + - static + StaticChunkingStrategyResponseParam: + type: object + title: Static Chunking Strategy + additionalProperties: false + properties: + type: + type: string + description: Always `static`. + enum: + - static + static: + $ref: "#/components/schemas/StaticChunkingStrategy" + required: + - type + - static + SubmitToolOutputsRunRequest: + type: object + additionalProperties: false + properties: + tool_outputs: + description: A list of tools for which the outputs are being submitted. + type: array + items: + type: object + properties: + tool_call_id: + type: string + description: The ID of the tool call in the `required_action` object within the + run object the output is being submitted for. + output: + type: string + description: The output of the tool call to be submitted to continue the run. + stream: + type: boolean + nullable: true + description: > + If `true`, returns a stream of events that happen during the Run as + server-sent events, terminating when the Run enters a terminal state + with a `data: [DONE]` message. + required: + - tool_outputs + ThreadObject: + type: object + title: Thread + description: Represents a thread that contains + [messages](/docs/api-reference/messages). + properties: + id: + description: The identifier, which can be referenced in API endpoints. + type: string + object: + description: The object type, which is always `thread`. + type: string + enum: + - thread + created_at: + description: The Unix timestamp (in seconds) for when the thread was created. + type: integer + tool_resources: + type: object + description: > + A set of resources that are made available to the assistant's tools + in this thread. The resources are specific to the type of tool. For + example, the `code_interpreter` tool requires a list of file IDs, + while the `file_search` tool requires a list of vector store IDs. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter` tool. There can be a + maximum of 20 files associated with the tool. + default: [ ] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The [vector store](/docs/api-reference/vector-stores/object) + attached to this thread. There can be a maximum of 1 vector + store attached to the thread. + maxItems: 1 + items: + type: string + nullable: true + metadata: + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be useful for storing additional information about the object in + a structured format. Keys can be a maximum of 64 characters long and + values can be a maximum of 512 characters long. + type: object + x-oaiTypeLabel: map + nullable: true + required: + - id + - object + - created_at + - tool_resources + - metadata + x-oaiMeta: + name: The thread object + beta: true + example: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1698107661, + "metadata": {} + } + ThreadStreamEvent: + oneOf: + - type: object + properties: + enabled: + type: boolean + description: Whether to enable input audio transcription. + event: + type: string + enum: + - thread.created + data: + $ref: "#/components/schemas/ThreadObject" + required: + - event + - data + description: Occurs when a new [thread](/docs/api-reference/threads/object) is + created. + x-oaiMeta: + dataDescription: "`data` is a [thread](/docs/api-reference/threads/object)" + TranscriptionSegment: + type: object + properties: + id: + type: integer + description: Unique identifier of the segment. + seek: + type: integer + description: Seek offset of the segment. + start: + type: number + format: float + description: Start time of the segment in seconds. + end: + type: number + format: float + description: End time of the segment in seconds. + text: + type: string + description: Text content of the segment. + tokens: + type: array + items: + type: integer + description: Array of token IDs for the text content. + temperature: + type: number + format: float + description: Temperature parameter used for generating the segment. + avg_logprob: + type: number + format: float + description: Average logprob of the segment. If the value is lower than -1, + consider the logprobs failed. + compression_ratio: + type: number + format: float + description: Compression ratio of the segment. If the value is greater than 2.4, + consider the compression failed. + no_speech_prob: + type: number + format: float + description: Probability of no speech in the segment. If the value is higher + than 1.0 and the `avg_logprob` is below -1, consider this segment + silent. + required: + - id + - seek + - start + - end + - text + - tokens + - temperature + - avg_logprob + - compression_ratio + - no_speech_prob + TranscriptionWord: + type: object + properties: + word: + type: string + description: The text content of the word. + start: + type: number + format: float + description: Start time of the word in seconds. + end: + type: number + format: float + description: End time of the word in seconds. + required: + - word + - start + - end + TruncationObject: + type: object + title: Thread Truncation Controls + description: Controls for how a thread will be truncated prior to the run. Use + this to control the intial context window of the run. + properties: + type: + type: string + description: The truncation strategy to use for the thread. The default is + `auto`. If set to `last_messages`, the thread will be truncated to + the n most recent messages in the thread. When set to `auto`, + messages in the middle of the thread will be dropped to fit the + context length of the model, `max_prompt_tokens`. + enum: + - auto + - last_messages + last_messages: + type: integer + description: The number of most recent messages from the thread when + constructing the context for the run. + minimum: 1 + nullable: true + required: + - type + UpdateVectorStoreRequest: + type: object + additionalProperties: false + properties: + name: + description: The name of the vector store. + type: string + nullable: true + expires_after: + $ref: "#/components/schemas/VectorStoreExpirationAfter" + nullable: true + metadata: + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be useful for storing additional information about the object in + a structured format. Keys can be a maximum of 64 characters long and + values can be a maximum of 512 characters long. + type: object + x-oaiTypeLabel: map + nullable: true + Upload: + type: object + title: Upload + description: | + The Upload object can accept byte chunks in the form of Parts. + properties: + id: + type: string + description: The Upload unique identifier, which can be referenced in API + endpoints. + created_at: + type: integer + description: The Unix timestamp (in seconds) for when the Upload was created. + filename: + type: string + description: The name of the file to be uploaded. + bytes: + type: integer + description: The intended number of bytes to be uploaded. + purpose: + type: string + description: The intended purpose of the file. [Please refer + here](/docs/api-reference/files/object#files/object-purpose) for + acceptable values. + status: + type: string + description: The status of the Upload. + enum: + - pending + - completed + - cancelled + - expired + expires_at: + type: integer + description: The Unix timestamp (in seconds) for when the Upload was created. + object: + type: string + description: The object type, which is always "upload". + enum: + - upload + file: + $ref: "#/components/schemas/OpenAIFile" + nullable: true + description: The ready File object after the Upload is completed. + required: + - bytes + - created_at + - expires_at + - filename + - id + - purpose + - status + x-oaiMeta: + name: The upload object + example: | + { + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "completed", + "expires_at": 1719127296, + "file": { + "id": "file-xyz321", + "object": "file", + "bytes": 2147483648, + "created_at": 1719186911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + } + } + UploadPart: + type: object + title: UploadPart + description: > + The upload Part represents a chunk of bytes we can add to an Upload + object. + properties: + id: + type: string + description: The upload Part unique identifier, which can be referenced in API + endpoints. + created_at: + type: integer + description: The Unix timestamp (in seconds) for when the Part was created. + upload_id: + type: string + description: The ID of the Upload object that this Part was added to. + object: + type: string + description: The object type, which is always `upload.part`. + enum: + - upload.part + required: + - created_at + - id + - object + - upload_id + x-oaiMeta: + name: The upload part object + example: | + { + "id": "part_def456", + "object": "upload.part", + "created_at": 1719186911, + "upload_id": "upload_abc123" + } + User: + type: object + description: Represents an individual `user` within an organization. + properties: + object: + type: string + enum: + - organization.user + description: The object type, which is always `organization.user` + id: + type: string + description: The identifier, which can be referenced in API endpoints + name: + type: string + description: The name of the user + email: + type: string + description: The email address of the user + role: + type: string + enum: + - owner + - reader + description: "`owner` or `reader`" + added_at: + type: integer + description: The Unix timestamp (in seconds) of when the user was added. + required: + - object + - id + - name + - email + - role + - added_at + x-oaiMeta: + name: The user object + example: | + { + "object": "organization.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + UserDeleteResponse: + type: object + properties: + object: + type: string + enum: + - organization.user.deleted + id: + type: string + deleted: + type: boolean + required: + - object + - id + - deleted + UserListResponse: + type: object + properties: + object: + type: string + enum: + - list + data: + type: array + items: + $ref: "#/components/schemas/User" + first_id: + type: string + last_id: + type: string + has_more: + type: boolean + required: + - object + - data + - first_id + - last_id + - has_more + UserRoleUpdateRequest: + type: object + properties: + role: + type: string + enum: + - owner + - reader + description: "`owner` or `reader`" + required: + - role + VectorStoreExpirationAfter: + type: object + title: Vector store expiration policy + description: The expiration policy for a vector store. + properties: + anchor: + description: "Anchor timestamp after which the expiration policy applies. + Supported anchors: `last_active_at`." + type: string + enum: + - last_active_at + days: + description: The number of days after the anchor time that the vector store will + expire. + type: integer + minimum: 1 + maximum: 365 + required: + - anchor + - days + VectorStoreFileBatchObject: + type: object + title: Vector store file batch + description: A batch of files attached to a vector store. + properties: + id: + description: The identifier, which can be referenced in API endpoints. + type: string + object: + description: The object type, which is always `vector_store.file_batch`. + type: string + enum: + - vector_store.files_batch + created_at: + description: The Unix timestamp (in seconds) for when the vector store files + batch was created. + type: integer + vector_store_id: + description: The ID of the [vector + store](/docs/api-reference/vector-stores/object) that the + [File](/docs/api-reference/files) is attached to. + type: string + status: + description: The status of the vector store files batch, which can be either + `in_progress`, `completed`, `cancelled` or `failed`. + type: string + enum: + - in_progress + - completed + - cancelled + - failed + file_counts: + type: object + properties: + in_progress: + description: The number of files that are currently being processed. + type: integer + completed: + description: The number of files that have been processed. + type: integer + failed: + description: The number of files that have failed to process. + type: integer + cancelled: + description: The number of files that where cancelled. + type: integer + total: + description: The total number of files. + type: integer + required: + - in_progress + - completed + - cancelled + - failed + - total + required: + - id + - object + - created_at + - vector_store_id + - status + - file_counts + x-oaiMeta: + name: The vector store files batch object + beta: true + example: | + { + "id": "vsfb_123", + "object": "vector_store.files_batch", + "created_at": 1698107661, + "vector_store_id": "vs_abc123", + "status": "completed", + "file_counts": { + "in_progress": 0, + "completed": 100, + "failed": 0, + "cancelled": 0, + "total": 100 + } + } + VectorStoreFileObject: + type: object + title: Vector store files + description: A list of files attached to a vector store. + properties: + id: + description: The identifier, which can be referenced in API endpoints. + type: string + object: + description: The object type, which is always `vector_store.file`. + type: string + enum: + - vector_store.file + usage_bytes: + description: The total vector store usage in bytes. Note that this may be + different from the original file size. + type: integer + created_at: + description: The Unix timestamp (in seconds) for when the vector store file was + created. + type: integer + vector_store_id: + description: The ID of the [vector + store](/docs/api-reference/vector-stores/object) that the + [File](/docs/api-reference/files) is attached to. + type: string + status: + description: The status of the vector store file, which can be either + `in_progress`, `completed`, `cancelled`, or `failed`. The status + `completed` indicates that the vector store file is ready for use. + type: string + enum: + - in_progress + - completed + - cancelled + - failed + last_error: + type: object + description: The last error associated with this vector store file. Will be + `null` if there are no errors. + nullable: true + properties: + code: + type: string + description: One of `server_error` or `rate_limit_exceeded`. + enum: + - server_error + - unsupported_file + - invalid_file + message: + type: string + description: A human-readable description of the error. + required: + - code + - message + chunking_strategy: + type: object + description: The strategy used to chunk the file. + oneOf: + - $ref: "#/components/schemas/StaticChunkingStrategyResponseParam" + - $ref: "#/components/schemas/OtherChunkingStrategyResponseParam" + x-oaiExpandable: true + required: + - id + - object + - usage_bytes + - created_at + - vector_store_id + - status + - last_error + x-oaiMeta: + name: The vector store file object + beta: true + example: | + { + "id": "file-abc123", + "object": "vector_store.file", + "usage_bytes": 1234, + "created_at": 1698107661, + "vector_store_id": "vs_abc123", + "status": "completed", + "last_error": null, + "chunking_strategy": { + "type": "static", + "static": { + "max_chunk_size_tokens": 800, + "chunk_overlap_tokens": 400 + } + } + } + VectorStoreObject: + type: object + title: Vector store + description: A vector store is a collection of processed files can be used by + the `file_search` tool. + properties: + id: + description: The identifier, which can be referenced in API endpoints. + type: string + object: + description: The object type, which is always `vector_store`. + type: string + enum: + - vector_store + created_at: + description: The Unix timestamp (in seconds) for when the vector store was + created. + type: integer + name: + description: The name of the vector store. + type: string + usage_bytes: + description: The total number of bytes used by the files in the vector store. + type: integer + file_counts: + type: object + properties: + in_progress: + description: The number of files that are currently being processed. + type: integer + completed: + description: The number of files that have been successfully processed. + type: integer + failed: + description: The number of files that have failed to process. + type: integer + cancelled: + description: The number of files that were cancelled. + type: integer + total: + description: The total number of files. + type: integer + required: + - in_progress + - completed + - failed + - cancelled + - total + status: + description: The status of the vector store, which can be either `expired`, + `in_progress`, or `completed`. A status of `completed` indicates + that the vector store is ready for use. + type: string + enum: + - expired + - in_progress + - completed + expires_after: + $ref: "#/components/schemas/VectorStoreExpirationAfter" + expires_at: + description: The Unix timestamp (in seconds) for when the vector store will + expire. + type: integer + nullable: true + last_active_at: + description: The Unix timestamp (in seconds) for when the vector store was last + active. + type: integer + nullable: true + metadata: + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be useful for storing additional information about the object in + a structured format. Keys can be a maximum of 64 characters long and + values can be a maximum of 512 characters long. + type: object + x-oaiTypeLabel: map + nullable: true + required: + - id + - object + - usage_bytes + - created_at + - status + - last_active_at + - name + - file_counts + - metadata + x-oaiMeta: + name: The vector store object + beta: true + example: | + { + "id": "vs_123", + "object": "vector_store", + "created_at": 1698107661, + "usage_bytes": 123456, + "last_active_at": 1698107661, + "name": "my_vector_store", + "status": "completed", + "file_counts": { + "in_progress": 0, + "completed": 100, + "cancelled": 0, + "failed": 0, + "total": 100 + }, + "metadata": {}, + "last_used_at": 1698107661 + } + securitySchemes: + ApiKeyAuth: + type: http + scheme: bearer +security: + - ApiKeyAuth: [ ] +x-oaiMeta: + navigationGroups: + - id: endpoints + title: Endpoints + - id: assistants + title: Assistants + beta: true + - id: administration + title: Administration + - id: realtime + title: Realtime + beta: true + - id: legacy + title: Legacy + groups: + - id: audio + title: Audio + description: | + Learn how to turn audio into text or text into audio. + + Related guide: [Speech to text](/docs/guides/speech-to-text) + navigationGroup: endpoints + sections: + - type: endpoint + key: createSpeech + path: createSpeech + - type: endpoint + key: createTranscription + path: createTranscription + - type: endpoint + key: createTranslation + path: createTranslation + - type: object + key: CreateTranscriptionResponseJson + path: json-object + - type: object + key: CreateTranscriptionResponseVerboseJson + path: verbose-json-object + - id: chat + title: Chat + description: > + Given a list of messages comprising a conversation, the model will + return a response. + + Related guide: [Chat Completions](/docs/guides/text-generation) + navigationGroup: endpoints + sections: + - type: endpoint + key: createChatCompletion + path: create + - type: object + key: CreateChatCompletionResponse + path: object + - type: object + key: CreateChatCompletionStreamResponse + path: streaming + - id: embeddings + title: Embeddings + description: > + Get a vector representation of a given input that can be easily consumed + by machine learning models and algorithms. + + Related guide: [Embeddings](/docs/guides/embeddings) + navigationGroup: endpoints + sections: + - type: endpoint + key: createEmbedding + path: create + - type: object + key: Embedding + path: object + - id: fine-tuning + title: Fine-tuning + description: > + Manage fine-tuning jobs to tailor a model to your specific training + data. + + Related guide: [Fine-tune models](/docs/guides/fine-tuning) + navigationGroup: endpoints + sections: + - type: endpoint + key: createFineTuningJob + path: create + - type: endpoint + key: listPaginatedFineTuningJobs + path: list + - type: endpoint + key: listFineTuningEvents + path: list-events + - type: endpoint + key: listFineTuningJobCheckpoints + path: list-checkpoints + - type: endpoint + key: retrieveFineTuningJob + path: retrieve + - type: endpoint + key: cancelFineTuningJob + path: cancel + - type: object + key: FinetuneChatRequestInput + path: chat-input + - type: object + key: FinetuneCompletionRequestInput + path: completions-input + - type: object + key: FineTuningJob + path: object + - type: object + key: FineTuningJobEvent + path: event-object + - type: object + key: FineTuningJobCheckpoint + path: checkpoint-object + - id: batch + title: Batch + description: > + Create large batches of API requests for asynchronous processing. The + Batch API returns completions within 24 hours for a 50% discount. + + Related guide: [Batch](/docs/guides/batch) + navigationGroup: endpoints + sections: + - type: endpoint + key: createBatch + path: create + - type: endpoint + key: retrieveBatch + path: retrieve + - type: endpoint + key: cancelBatch + path: cancel + - type: endpoint + key: listBatches + path: list + - type: object + key: Batch + path: object + - type: object + key: BatchRequestInput + path: request-input + - type: object + key: BatchRequestOutput + path: request-output + - id: files + title: Files + description: > + Files are used to upload documents that can be used with features like + [Assistants](/docs/api-reference/assistants), + [Fine-tuning](/docs/api-reference/fine-tuning), and [Batch + API](/docs/guides/batch). + navigationGroup: endpoints + sections: + - type: endpoint + key: createFile + path: create + - type: endpoint + key: listFiles + path: list + - type: endpoint + key: retrieveFile + path: retrieve + - type: endpoint + key: deleteFile + path: delete + - type: endpoint + key: downloadFile + path: retrieve-contents + - type: object + key: OpenAIFile + path: object + - id: uploads + title: Uploads + description: | + Allows you to upload large files in multiple parts. + navigationGroup: endpoints + sections: + - type: endpoint + key: createUpload + path: create + - type: endpoint + key: addUploadPart + path: add-part + - type: endpoint + key: completeUpload + path: complete + - type: endpoint + key: cancelUpload + path: cancel + - type: object + key: Upload + path: object + - type: object + key: UploadPart + path: part-object + - id: images + title: Images + description: > + Given a prompt and/or an input image, the model will generate a new + image. + + Related guide: [Image generation](/docs/guides/images) + navigationGroup: endpoints + sections: + - type: endpoint + key: createImage + path: create + - type: endpoint + key: createImageEdit + path: createEdit + - type: endpoint + key: createImageVariation + path: createVariation + - type: object + key: Image + path: object + - id: models + title: Models + description: > + List and describe the various models available in the API. You can refer + to the [Models](/docs/models) documentation to understand what models + are available and the differences between them. + navigationGroup: endpoints + sections: + - type: endpoint + key: listModels + path: list + - type: endpoint + key: retrieveModel + path: retrieve + - type: endpoint + key: deleteModel + path: delete + - type: object + key: Model + path: object + - id: moderations + title: Moderations + description: > + Given text and/or image inputs, classifies if those inputs are + potentially harmful across several categories. + + Related guide: [Moderations](/docs/guides/moderation) + navigationGroup: endpoints + sections: + - type: endpoint + key: createModeration + path: create + - type: object + key: CreateModerationResponse + path: object + - id: assistants + title: Assistants + beta: true + description: | + Build assistants that can call models and use tools to perform tasks. + + [Get started with the Assistants API](/docs/assistants) + navigationGroup: assistants + sections: + - type: endpoint + key: createAssistant + path: createAssistant + - type: endpoint + key: listAssistants + path: listAssistants + - type: endpoint + key: getAssistant + path: getAssistant + - type: endpoint + key: modifyAssistant + path: modifyAssistant + - type: endpoint + key: deleteAssistant + path: deleteAssistant + - type: object + key: AssistantObject + path: object + - id: threads + title: Threads + beta: true + description: | + Create threads that assistants can interact with. + + Related guide: [Assistants](/docs/assistants/overview) + navigationGroup: assistants + sections: + - type: endpoint + key: createThread + path: createThread + - type: endpoint + key: getThread + path: getThread + - type: endpoint + key: modifyThread + path: modifyThread + - type: endpoint + key: deleteThread + path: deleteThread + - type: object + key: ThreadObject + path: object + - id: messages + title: Messages + beta: true + description: | + Create messages within threads + + Related guide: [Assistants](/docs/assistants/overview) + navigationGroup: assistants + sections: + - type: endpoint + key: createMessage + path: createMessage + - type: endpoint + key: listMessages + path: listMessages + - type: endpoint + key: getMessage + path: getMessage + - type: endpoint + key: modifyMessage + path: modifyMessage + - type: endpoint + key: deleteMessage + path: deleteMessage + - type: object + key: MessageObject + path: object + - id: runs + title: Runs + beta: true + description: | + Represents an execution run on a thread. + + Related guide: [Assistants](/docs/assistants/overview) + navigationGroup: assistants + sections: + - type: endpoint + key: createRun + path: createRun + - type: endpoint + key: createThreadAndRun + path: createThreadAndRun + - type: endpoint + key: listRuns + path: listRuns + - type: endpoint + key: getRun + path: getRun + - type: endpoint + key: modifyRun + path: modifyRun + - type: endpoint + key: submitToolOuputsToRun + path: submitToolOutputs + - type: endpoint + key: cancelRun + path: cancelRun + - type: object + key: RunObject + path: object + - id: run-steps + title: Run steps + beta: true + description: | + Represents the steps (model and tool calls) taken during the run. + + Related guide: [Assistants](/docs/assistants/overview) + navigationGroup: assistants + sections: + - type: endpoint + key: listRunSteps + path: listRunSteps + - type: endpoint + key: getRunStep + path: getRunStep + - type: object + key: RunStepObject + path: step-object + - id: vector-stores + title: Vector stores + beta: true + description: | + Vector stores are used to store files for use by the `file_search` tool. + + Related guide: [File Search](/docs/assistants/tools/file-search) + navigationGroup: assistants + sections: + - type: endpoint + key: createVectorStore + path: create + - type: endpoint + key: listVectorStores + path: list + - type: endpoint + key: getVectorStore + path: retrieve + - type: endpoint + key: modifyVectorStore + path: modify + - type: endpoint + key: deleteVectorStore + path: delete + - type: object + key: VectorStoreObject + path: object + - id: vector-stores-files + title: Vector store files + beta: true + description: | + Vector store files represent files inside a vector store. + + Related guide: [File Search](/docs/assistants/tools/file-search) + navigationGroup: assistants + sections: + - type: endpoint + key: createVectorStoreFile + path: createFile + - type: endpoint + key: listVectorStoreFiles + path: listFiles + - type: endpoint + key: getVectorStoreFile + path: getFile + - type: endpoint + key: deleteVectorStoreFile + path: deleteFile + - type: object + key: VectorStoreFileObject + path: file-object + - id: vector-stores-file-batches + title: Vector store file batches + beta: true + description: > + Vector store file batches represent operations to add multiple files to + a vector store. + + Related guide: [File Search](/docs/assistants/tools/file-search) + navigationGroup: assistants + sections: + - type: endpoint + key: createVectorStoreFileBatch + path: createBatch + - type: endpoint + key: getVectorStoreFileBatch + path: getBatch + - type: endpoint + key: cancelVectorStoreFileBatch + path: cancelBatch + - type: endpoint + key: listFilesInVectorStoreBatch + path: listBatchFiles + - type: object + key: VectorStoreFileBatchObject + path: batch-object + - id: assistants-streaming + title: Streaming + beta: true + description: > + Stream the result of executing a Run or resuming a Run after submitting + tool outputs. + + You can stream events from the [Create Thread and + Run](/docs/api-reference/runs/createThreadAndRun), + + [Create Run](/docs/api-reference/runs/createRun), and [Submit Tool + Outputs](/docs/api-reference/runs/submitToolOutputs) + + endpoints by passing `"stream": true`. The response will be a + [Server-Sent + events](https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events) + stream. + + Our Node and Python SDKs provide helpful utilities to make streaming + easy. Reference the + + [Assistants API quickstart](/docs/assistants/overview) to learn more. + navigationGroup: assistants + sections: + - type: object + key: MessageDeltaObject + path: message-delta-object + - type: object + key: RunStepDeltaObject + path: run-step-delta-object + - type: object + key: AssistantStreamEvent + path: events + - id: administration + title: Administration + description: > + Programmatically manage your organization. + + The Audit Logs endpoint provides a log of all actions taken in + the organization for security and monitoring purposes. + + To access these endpoints please generate an Admin API Key through the + [API Platform Organization overview](/organization/admin-keys). Admin + API keys cannot be used for non-administration endpoints. + + For best practices on setting up your organization, please refer to this + [guide](/docs/guides/production-best-practices/setting-up-your-organization) + navigationGroup: administration + - id: invite + title: Invites + description: Invite and manage invitations for an organization. Invited users + are automatically added to the Default project. + navigationGroup: administration + sections: + - type: endpoint + key: list-invites + path: list + - type: endpoint + key: inviteUser + path: create + - type: endpoint + key: retrieve-invite + path: retrieve + - type: endpoint + key: delete-invite + path: delete + - type: object + key: Invite + path: object + - id: users + title: Users + description: > + Manage users and their role in an organization. Users will be + automatically added to the Default project. + navigationGroup: administration + sections: + - type: endpoint + key: list-users + path: list + - type: endpoint + key: modify-user + path: modify + - type: endpoint + key: retrieve-user + path: retrieve + - type: endpoint + key: delete-user + path: delete + - type: object + key: User + path: object + - id: projects + title: Projects + description: > + Manage the projects within an orgnanization includes creation, updating, + and archiving or projects. + + The Default project cannot be modified or archived. + navigationGroup: administration + sections: + - type: endpoint + key: list-projects + path: list + - type: endpoint + key: create-project + path: create + - type: endpoint + key: retrieve-project + path: retrieve + - type: endpoint + key: modify-project + path: modify + - type: endpoint + key: archive-project + path: archive + - type: object + key: Project + path: object + - id: project-users + title: Project users + description: > + Manage users within a project, including adding, updating roles, and + removing users. + + Users cannot be removed from the Default project, unless they are being + removed from the organization. + navigationGroup: administration + sections: + - type: endpoint + key: list-project-users + path: list + - type: endpoint + key: create-project-user + path: creeate + - type: endpoint + key: retrieve-project-user + path: retrieve + - type: endpoint + key: modify-project-user + path: modify + - type: endpoint + key: delete-project-user + path: delete + - type: object + key: ProjectUser + path: object + - id: project-service-accounts + title: Project service accounts + description: > + Manage service accounts within a project. A service account is a bot + user that is not associated with a user. + + If a user leaves an organization, their keys and membership in projects + will no longer work. Service accounts + + do not have this limitation. However, service accounts can also be + deleted from a project. + navigationGroup: administration + sections: + - type: endpoint + key: list-project-service-accounts + path: list + - type: endpoint + key: create-project-service-account + path: create + - type: endpoint + key: retrieve-project-service-account + path: retrieve + - type: endpoint + key: delete-project-service-account + path: delete + - type: object + key: ProjectServiceAccount + path: object + - id: project-api-keys + title: Project API keys + description: > + Manage API keys for a given project. Supports listing and deleting keys + for users. + + This API does not allow issuing keys for users, as users need to + authorize themselves to generate keys. + navigationGroup: administration + sections: + - type: endpoint + key: list-project-api-keys + path: list + - type: endpoint + key: retrieve-project-api-key + path: retrieve + - type: endpoint + key: delete-project-api-key + path: delete + - type: object + key: ProjectApiKey + path: object + - id: audit-logs + title: Audit logs + description: > + Logs of user actions and configuration changes within this + organization. + + To log events, you must activate logging in the [Organization + Settings](/settings/organization/general). + + Once activated, for security reasons, logging cannot be deactivated. + navigationGroup: administration + sections: + - type: endpoint + key: list-audit-logs + path: list + - type: object + key: AuditLog + path: object + - id: realtime + title: Realtime + beta: true + description: > + Communicate with a GPT-4o class model live, in real time, over + WebSocket. + + Produces both audio and text transcriptions. + + [Learn more about the Realtime API](/docs/guides/realtime). + navigationGroup: realtime + - id: realtime-client-events + title: Client events + description: > + These are events that the OpenAI Realtime WebSocket server will accept + from the client. + navigationGroup: realtime + sections: + - type: object + key: RealtimeClientEventSessionUpdate + path: + - type: object + key: RealtimeClientEventInputAudioBufferAppend + path: + - type: object + key: RealtimeClientEventInputAudioBufferCommit + path: + - type: object + key: RealtimeClientEventInputAudioBufferClear + path: + - type: object + key: RealtimeClientEventConversationItemCreate + path: + - type: object + key: RealtimeClientEventConversationItemTruncate + path: + - type: object + key: RealtimeClientEventConversationItemDelete + path: + - type: object + key: RealtimeClientEventResponseCreate + path: + - type: object + key: RealtimeClientEventResponseCancel + path: + - id: realtime-server-events + title: Server events + description: > + These are events emitted from the OpenAI Realtime WebSocket server to + the client. + navigationGroup: realtime + sections: + - type: object + key: RealtimeServerEventError + path: + - type: object + key: RealtimeServerEventSessionCreated + path: + - type: object + key: RealtimeServerEventSessionUpdated + path: + - type: object + key: RealtimeServerEventConversationCreated + path: + - type: object + key: RealtimeServerEventConversationItemCreated + path: + - type: object + key: RealtimeServerEventConversationItemInputAudioTranscriptionCompleted + path: + - type: object + key: RealtimeServerEventConversationItemInputAudioTranscriptionFailed + path: + - type: object + key: RealtimeServerEventConversationItemTruncated + path: + - type: object + key: RealtimeServerEventConversationItemDeleted + path: + - type: object + key: RealtimeServerEventInputAudioBufferCommitted + path: + - type: object + key: RealtimeServerEventInputAudioBufferCleared + path: + - type: object + key: RealtimeServerEventInputAudioBufferSpeechStarted + path: + - type: object + key: RealtimeServerEventInputAudioBufferSpeechStopped + path: + - type: object + key: RealtimeServerEventResponseCreated + path: + - type: object + key: RealtimeServerEventResponseDone + path: + - type: object + key: RealtimeServerEventResponseOutputItemAdded + path: + - type: object + key: RealtimeServerEventResponseOutputItemDone + path: + - type: object + key: RealtimeServerEventResponseContentPartAdded + path: + - type: object + key: RealtimeServerEventResponseContentPartDone + path: + - type: object + key: RealtimeServerEventResponseTextDelta + path: + - type: object + key: RealtimeServerEventResponseTextDone + path: + - type: object + key: RealtimeServerEventResponseAudioTranscriptDelta + path: + - type: object + key: RealtimeServerEventResponseAudioTranscriptDone + path: + - type: object + key: RealtimeServerEventResponseAudioDelta + path: + - type: object + key: RealtimeServerEventResponseAudioDone + path: + - type: object + key: RealtimeServerEventResponseFunctionCallArgumentsDelta + path: + - type: object + key: RealtimeServerEventResponseFunctionCallArgumentsDone + path: + - type: object + key: RealtimeServerEventRateLimitsUpdated + path: + - id: completions + title: Completions + legacy: true + navigationGroup: legacy + description: > + Given a prompt, the model will return one or more predicted completions + along with the probabilities of alternative tokens at each position. + Most developer should use our [Chat Completions + API](/docs/guides/text-generation/text-generation-models) to leverage + our best and newest models. + sections: + - type: endpoint + key: createCompletion + path: create + - type: object + key: CreateCompletionResponse + path: object diff --git a/packages/openai_realtime_dart/pubspec.yaml b/packages/openai_realtime_dart/pubspec.yaml index 29b73f6d..08ac27b5 100644 --- a/packages/openai_realtime_dart/pubspec.yaml +++ b/packages/openai_realtime_dart/pubspec.yaml @@ -15,12 +15,18 @@ environment: sdk: ">=3.4.0 <4.0.0" dependencies: + freezed_annotation: ^2.4.2 http: ^1.2.2 json_annotation: ^4.9.0 logging: ^1.2.0 web_socket_channel: ^3.0.1 dev_dependencies: - test: ^1.25.8 - json_serializable: ^6.8.0 build_runner: ^2.4.11 + freezed: ^2.5.7 + json_serializable: ^6.8.0 + openapi_spec: + git: + ref: 5147c00db1793cbae51a16585b9c4212b92d2e7f + url: https://github.com/davidmigloz/openapi_spec.git + test: ^1.25.8 diff --git a/packages/openai_realtime_dart/test/api_test.dart b/packages/openai_realtime_dart/test/api_test.dart index 29a0fad9..26b17494 100644 --- a/packages/openai_realtime_dart/test/api_test.dart +++ b/packages/openai_realtime_dart/test/api_test.dart @@ -31,14 +31,13 @@ void main() { await apiWithoutKey.connect(); final event = await apiWithoutKey.waitForNext( - 'server.error', - timeout: const Duration(seconds: 1), - ); + RealtimeEventType.error, + timeout: const Duration(seconds: 5), + ) as RealtimeEventError?; expect(event, isNotNull); - expect(event?['error'], isNotNull); - final error = event?['error'] as Map?; - expect(error?['message'], contains('Missing bearer')); + expect(event!.error, isNotNull); + expect(event.error.message, contains('Missing bearer')); }); test('Should instantiate the RealtimeAPI', () { @@ -78,28 +77,11 @@ void main() { test('Should receive server events', () async { await realtime.connect(); - final event = await realtime.waitForNext('server.session.created'); + final event = await realtime.waitForNext(RealtimeEventType.sessionCreated) + as RealtimeEventSessionCreated?; expect(event, isNotNull); - expect(event?['session'], isNotNull); - final session = event?['session'] as Map; - expect(session['id'], isNotNull); - }); - - test('Should receive server error events', () async { - await realtime.connect(); - - final testEvent = { - 'type': 'test_event', - 'data': {'message': 'Hello, World!'}, - }; - - // Set up the listener before sending the event - final eventFuture = realtime.waitForNext('server.error'); - - realtime.send('test_event', testEvent['data'] as Map?); - - final receivedEvent = await eventFuture; - expect(receivedEvent, isNotNull); + expect(event!.session, isNotNull); + expect(event.session.id, isNotNull); }); }); } diff --git a/packages/openai_realtime_dart/test/audio_test.dart b/packages/openai_realtime_dart/test/audio_test.dart index f1163f66..df3cab4a 100644 --- a/packages/openai_realtime_dart/test/audio_test.dart +++ b/packages/openai_realtime_dart/test/audio_test.dart @@ -1,3 +1,5 @@ +// ignore_for_file: unnecessary_null_checks + import 'dart:convert'; import 'dart:io'; import 'dart:typed_data'; @@ -9,19 +11,19 @@ void main() { group('Audio samples tests', timeout: const Timeout(Duration(minutes: 5)), () { test('Toronto Audio sample test', () async { - // Should connect to the RealtimeClient - final realtimeEvents = ?>[]; + final realtimeEvents = []; final client = RealtimeClient( apiKey: Platform.environment['OPENAI_API_KEY'], - debug: false, - ) - ..updateSession( - instructions: - 'Please follow the instructions of any query you receive.\n' - 'Be concise in your responses. Speak quickly and answer shortly.', - ) - ..on('realtime.event', realtimeEvents.add); + debug: true, + ); + await client.updateSession( + instructions: + 'Please follow the instructions of any query you receive.\n' + 'Be concise in your responses. Speak quickly and answer shortly.', + ); + client.on(RealtimeEventType.all, realtimeEvents.add); + // Should connect to the RealtimeClient final isConnected = await client.connect(); expect(isConnected, isTrue); expect(client.isConnected(), isTrue); @@ -32,17 +34,13 @@ void main() { expect(realtimeEvents.length, equals(2)); final clientEvent1 = realtimeEvents[0]; - expect(clientEvent1?['source'], equals('client')); - final clientEventData1 = clientEvent1?['event'] as Map?; - expect(clientEventData1?['type'], equals('session.update')); + expect(clientEvent1, isA()); final serverEvent1 = realtimeEvents[1]; - expect(serverEvent1?['source'], equals('server')); - final serverEventData1 = serverEvent1?['event'] as Map?; - expect(serverEventData1?['type'], equals('session.created')); + expect(serverEvent1, isA()); + serverEvent1 as RealtimeEventSessionCreated; - final session = serverEventData1?['session'] as Map?; - expect(session?['id'], isNotNull); + expect(serverEvent1.session.id, isNotNull); // Should load audio samples final audioData = await readSampleAudioFile('toronto.pcm'); @@ -53,57 +51,45 @@ void main() { // Should send an audio file about toronto final audioDataBase64 = base64.encode(audioData); final content = [ - {'type': 'input_audio', 'audio': audioDataBase64}, + ContentPart.inputAudio(audio: audioDataBase64), ]; - client.sendUserMessageContent(content); - expect(realtimeEvents.length, equals(4)); + await client.sendUserMessageContent(content); + expect(realtimeEvents.length, equals(4)); final itemEvent = realtimeEvents[2]; - expect(itemEvent?['source'], equals('client')); - final itemEventData = itemEvent?['event'] as Map?; - expect(itemEventData?['type'], equals('conversation.item.create')); - + expect(itemEvent, isA()); final responseEvent = realtimeEvents[3]; - expect(responseEvent, isNotNull); - expect(responseEvent?['source'], equals('client')); - final responseEventData = - responseEvent?['event'] as Map?; - expect(responseEventData?['type'], equals('response.create')); - - // Should waitForNextItem to receive "conversation.item.created" from user - final result1 = await client.waitForNextItem(); - final item1 = result1['item'] as Map?; - - expect(item1, isNotNull); - expect(item1!['type'], equals('message')); - expect(item1['role'], equals('user')); - expect(item1['status'], equals('completed')); - final item1Formatted = item1['formatted'] as Map?; - expect(item1Formatted?['text'], equals('')); - - // Should waitForNextItem to receive "conversation.item.created" from assistant - final result2 = await client.waitForNextItem(); - final item2 = result2['item'] as Map?; - - expect(item2, isNotNull); - expect(item2!['type'], equals('message')); - expect(item2['role'], equals('assistant')); - expect(item2['status'], equals('in_progress')); - final item2Formatted = item2['formatted'] as Map?; - expect(item2Formatted?['text'], equals('')); + expect(responseEvent, isA()); + + final itemCreated = await client.waitForNextCompletedItem(); + expect(itemCreated?.item, isNotNull); + + // The assistant starts the response + final formattedItem1 = await client.waitForNextItem(); + + expect(formattedItem1?.item, isNotNull); + final item1 = formattedItem1!.item; + expect(item1, isA()); + item1 as ItemMessage; + + expect(item1.role, equals(ItemRole.assistant)); + expect(item1.status, equals(ItemStatus.inProgress)); + final item1Formatted = formattedItem1.formatted; + expect(item1Formatted?.text, equals('')); // Should waitForNextCompletedItem to receive completed item from assistant - final result3 = await client.waitForNextCompletedItem(); - final item3 = result3['item'] as Map?; - - expect(item3, isNotNull); - expect(item3!['type'], equals('message')); - expect(item3['role'], equals('assistant')); - expect(item3['status'], equals('completed')); - final item3Formatted = item3['formatted'] as Map?; - final item3Transcript = item3Formatted?['transcript'] as String?; - expect(item3Transcript?.toLowerCase(), contains('toronto')); + final formattedItem3 = await client.waitForNextCompletedItem(); + + expect(formattedItem3?.item, isNotNull); + final item3 = formattedItem3!.item; + expect(item3, isA()); + item3 as ItemMessage; + + expect(item3.role, equals(ItemRole.assistant)); + expect(item3.status, equals(ItemStatus.completed)); + final item3Formatted = formattedItem3.formatted; + expect(item3Formatted?.transcript, contains('Toronto')); // Should disconnect from the RealtimeClient await client.disconnect(); diff --git a/packages/openai_realtime_dart/test/client_test.dart b/packages/openai_realtime_dart/test/client_test.dart index a8f74634..7de75400 100644 --- a/packages/openai_realtime_dart/test/client_test.dart +++ b/packages/openai_realtime_dart/test/client_test.dart @@ -1,5 +1,3 @@ -// ignore_for_file: avoid_print - import 'dart:convert'; import 'dart:io'; @@ -9,18 +7,18 @@ import 'package:test/test.dart'; void main() { group('RealtimeClient Tests', () { test('RealtimeClient test', () async { - // Should instantiate the RealtimeClient - final realtimeEvents = ?>[]; + final realtimeEvents = []; final client = RealtimeClient( apiKey: Platform.environment['OPENAI_API_KEY'], - debug: false, - ) - ..updateSession( - instructions: 'You always, ALWAYS reference San Francisco ' - 'by name in every response. Always include the phrase "San Francisco". ' - 'This is for testing so stick to it!', - ) - ..on('realtime.event', realtimeEvents.add); + debug: true, + ); + await client.updateSession( + instructions: 'You always, ALWAYS reference San Francisco ' + 'by name in every response. Always include the phrase "San Francisco". ' + 'This is for testing so stick to it!', + ); + client.on(RealtimeEventType.all, realtimeEvents.add); + expect(client, isNotNull); expect(client.realtime, isNotNull); expect(client.conversation, isNotNull); @@ -40,69 +38,47 @@ void main() { expect(realtimeEvents.length, equals(2)); final clientEvent1 = realtimeEvents[0]; - expect(clientEvent1?['source'], equals('client')); - final clientEvent1Event = clientEvent1?['event'] as Map?; - expect(clientEvent1Event?['type'], equals('session.update')); + expect(clientEvent1, isA()); final serverEvent1 = realtimeEvents[1]; - expect(serverEvent1?['source'], equals('server')); - final serverEvent1Event = serverEvent1?['event'] as Map?; - expect(serverEvent1Event?['type'], equals('session.created')); + expect(serverEvent1, isA()); + serverEvent1 as RealtimeEventSessionCreated; - final session = serverEvent1Event?['session'] as Map?; - expect(session?['id'], isNotNull); + expect(serverEvent1.session.id, isNotNull); // Should send a simple hello message (text) final content1 = [ - {'type': 'input_text', 'text': 'How are you?'}, + const ContentPart.text(text: 'How are you?'), ]; - client.sendUserMessageContent(content1); + await client.sendUserMessageContent(content1); expect(realtimeEvents.length, equals(4)); - final itemEvent = realtimeEvents[2]; - expect(itemEvent?['source'], equals('client')); - final event = itemEvent?['event'] as Map?; - expect(event?['type'], equals('conversation.item.create')); - + expect(itemEvent, isA()); final responseEvent = realtimeEvents[3]; - expect(responseEvent?['source'], equals('client')); - final response = responseEvent?['event'] as Map?; - expect(response?['type'], equals('response.create')); - - // Should receive "conversation.item.created" from user - final userItem = await client.waitForNextItem(); - - expect(userItem['item'], isNotNull); - final userItemItem = userItem['item'] as Map; - expect(userItemItem['type'], equals('message')); - expect(userItemItem['role'], equals('user')); - expect(userItemItem['status'], equals('completed')); - final formatted1 = userItemItem['formatted'] as Map; - expect(formatted1['text'], equals('How are you?')); - - // Should receive "conversation.item.created" from assistant + expect(responseEvent, isA()); + + // The assistant starts the response final assistantItem = await client.waitForNextItem(); - expect(assistantItem['item'], isNotNull); - final assistantItemItem = assistantItem['item'] as Map; - expect(assistantItemItem['type'], equals('message')); - expect(assistantItemItem['role'], equals('assistant')); - expect(assistantItemItem['status'], equals('in_progress')); - final formatted2 = assistantItemItem['formatted'] as Map; - expect(formatted2['text'], isEmpty); + expect(assistantItem?.item, isNotNull); + final assistantItemItem = assistantItem!.item as ItemMessage; + expect(assistantItemItem.type, equals(ItemType.message)); + expect(assistantItemItem.role, equals(ItemRole.assistant)); + expect(assistantItemItem.status, equals(ItemStatus.inProgress)); + final formatted2 = assistantItem.formatted; + expect(formatted2?.text, isEmpty); // Should receive completed item from assistant final completedItem = await client.waitForNextCompletedItem(); - expect(completedItem['item'], isNotNull); - final completedItemItem = completedItem['item'] as Map; - expect(completedItemItem['type'], equals('message')); - expect(completedItemItem['role'], equals('assistant')); - expect(completedItemItem['status'], equals('completed')); - final formatted = completedItemItem['formatted'] as Map; - final transcript = formatted['transcript'] as String; - expect(transcript.toLowerCase(), contains('san francisco')); + expect(completedItem?.item, isNotNull); + final completedItemItem = completedItem!.item as ItemMessage; + expect(completedItemItem.type, equals(ItemType.message)); + expect(completedItemItem.role, equals(ItemRole.assistant)); + expect(completedItemItem.status, equals(ItemStatus.completed)); + final formatted = completedItem.formatted; + expect(formatted?.transcript.toLowerCase(), contains('san francisco')); // Should close the RealtimeClient connection await client.disconnect(); @@ -111,50 +87,50 @@ void main() { test('Tool calling test', timeout: const Timeout(Duration(minutes: 5)), () async { - final realtimeEvents = ?>[]; + final realtimeEvents = []; bool toolCalled = false; final client = RealtimeClient( apiKey: Platform.environment['OPENAI_API_KEY'], debug: true, - ) - ..addTool( - { - 'name': 'get_weather', - 'description': 'Retrieves the weather for a location ' - 'given its latitude and longitude coordinate pair.', - 'parameters': { - 'type': 'object', - 'properties': { - 'lat': { - 'type': 'number', - 'description': 'Latitude of the location', - }, - 'lng': { - 'type': 'number', - 'description': 'Longitude of the location', - }, + ); + await client.addTool( + const ToolDefinition( + name: 'get_weather', + description: 'Retrieves the weather for a location ' + 'given its latitude and longitude coordinate pair.', + parameters: { + 'type': 'object', + 'properties': { + 'lat': { + 'type': 'number', + 'description': 'Latitude of the location', + }, + 'lng': { + 'type': 'number', + 'description': 'Longitude of the location', }, - 'required': ['lat', 'lng'], }, + 'required': ['lat', 'lng'], }, - (Map params) async { - toolCalled = true; - final result = await HttpClient() - .getUrl( - Uri.parse( - 'https://api.open-meteo.com/v1/forecast?' - 'latitude=${params['lat']}&' - 'longitude=${params['lng']}&' - 'current=temperature_2m,wind_speed_10m', - ), - ) - .then((request) => request.close()) - .then((res) => res.transform(const Utf8Decoder()).join()) - .then(jsonDecode); - return result; - }, - ) - ..on('realtime.event', realtimeEvents.add); + ), + (Map params) async { + toolCalled = true; + final result = await HttpClient() + .getUrl( + Uri.parse( + 'https://api.open-meteo.com/v1/forecast?' + 'latitude=${params['lat']}&' + 'longitude=${params['lng']}&' + 'current=temperature_2m,wind_speed_10m', + ), + ) + .then((request) => request.close()) + .then((res) => res.transform(const Utf8Decoder()).join()) + .then(jsonDecode); + return result; + }, + ); + client.on(RealtimeEventType.all, realtimeEvents.add); final isConnected = await client.connect(); expect(isConnected, isTrue); @@ -164,69 +140,55 @@ void main() { expect(realtimeEvents.length, equals(2)); // Send user message - final content1 = [ - { - 'type': 'input_text', - 'text': "What's the current weather in San Francisco, CA?", - }, + const content1 = [ + ContentPart.inputText( + text: "What's the current weather in San Francisco, CA?", + ), ]; - client.sendUserMessageContent(content1); + await client.sendUserMessageContent(content1); expect(realtimeEvents.length, equals(4)); final itemEvent = realtimeEvents[2]; - expect(itemEvent?['source'], equals('client')); - final event = itemEvent?['event'] as Map?; - expect(event?['type'], equals('conversation.item.create')); + expect(itemEvent, isA()); final responseEvent = realtimeEvents[3]; - expect(responseEvent?['source'], equals('client')); - final response = responseEvent?['event'] as Map?; - expect(response?['type'], equals('response.create')); - - // Wait for user message to be received - final uItem1 = await client.waitForNextItem(); + expect(responseEvent, isA()); - expect(uItem1['item'], isNotNull); - final uItem1Data = uItem1['item'] as Map; - expect(uItem1Data['type'], equals('message')); - expect(uItem1Data['role'], equals('user')); - expect(uItem1Data['status'], equals('completed')); - final uItem1Formatted = uItem1Data['formatted'] as Map; - expect(uItem1Formatted['text'], isNotEmpty); + final itemCreated = await client.waitForNextCompletedItem(); + expect(itemCreated?.item, isNotNull); // Should receive "function_call" from assistant final aItem1 = await client.waitForNextCompletedItem(); - expect(aItem1['item'], isNotNull); - final aItem1Data = aItem1['item'] as Map; - expect(aItem1Data['type'], equals('function_call')); - expect(aItem1Data['status'], equals('completed')); - expect(aItem1Data['name'], equals('get_weather')); - expect(aItem1Data['arguments'], isNotNull); + expect(aItem1?.item, isNotNull); + final aItem1Data = aItem1!.item as ItemFunctionCall; + expect(aItem1Data.type, equals(ItemType.functionCall)); + expect(aItem1Data.status, equals(ItemStatus.completed)); + expect(aItem1Data.name, equals('get_weather')); + expect(aItem1Data.arguments, isNotNull); final aItem1Args = - jsonDecode(aItem1Data['arguments'] as String) as Map; + jsonDecode(aItem1Data.arguments) as Map; expect(aItem1Args['lat'], isNotNull); expect(aItem1Args['lng'], isNotNull); // Should sent "function_call_output" to assistant final fItem1 = await client.waitForNextCompletedItem(); - expect(fItem1['item'], isNotNull); - final fItem1Data = fItem1['item'] as Map; - expect(fItem1Data['type'], equals('function_call_output')); - expect(fItem1Data['status'], equals('completed')); - expect(fItem1Data['call_id'], isNotEmpty); - expect(fItem1Data['output'], isNotEmpty); + expect(fItem1?.item, isNotNull); + final fItem1Data = fItem1!.item as ItemFunctionCallOutput; + expect(fItem1Data.type, equals(ItemType.functionCallOutput)); + expect(fItem1Data.callId, isNotEmpty); + expect(fItem1Data.output, isNotEmpty); expect(toolCalled, isTrue); // Should receive response from assistant final aItem2 = await client.waitForNextCompletedItem(); - expect(aItem2['item'], isNotNull); - final aItem2Data = aItem2['item'] as Map; - expect(aItem2Data['type'], equals('message')); - expect(aItem1Data['status'], equals('completed')); - expect(aItem2Data['role'], equals('assistant')); - final aItem2Formatted = aItem2Data['formatted'] as Map; - expect(aItem2Formatted['transcript'], isNotEmpty); + expect(aItem2?.item, isNotNull); + final aItem2Data = aItem2!.item as ItemMessage; + expect(aItem2Data.type, equals(ItemType.message)); + expect(aItem1Data.status, equals(ItemStatus.completed)); + expect(aItem2Data.role, equals(ItemRole.assistant)); + final aItem2Formatted = aItem2.formatted; + expect(aItem2Formatted?.transcript, isNotEmpty); // Should close the RealtimeClient connection await client.disconnect();