diff --git a/packages/openai_dart/lib/src/generated/client.dart b/packages/openai_dart/lib/src/generated/client.dart index 58f64510..2389108c 100644 --- a/packages/openai_dart/lib/src/generated/client.dart +++ b/packages/openai_dart/lib/src/generated/client.dart @@ -2055,4 +2055,158 @@ class OpenAIClient { ); return Batch.fromJson(_jsonDecode(r)); } + + // ------------------------------------------ + // METHOD: createResponse + // ------------------------------------------ + + /// Create response + /// + /// Creates a model response. + /// + /// `request`: Request object for the Create response endpoint. + /// + /// `POST` `https://api.openai.com/v1/responses` + Future createResponse({ + required CreateResponseRequest request, + }) async { + final r = await makeRequest( + baseUrl: 'https://api.openai.com/v1', + path: '/responses', + method: HttpMethod.post, + isMultipart: false, + requestType: 'application/json', + responseType: 'application/json', + body: request, + ); + return Response.fromJson(_jsonDecode(r)); + } + + // ------------------------------------------ + // METHOD: getResponse + // ------------------------------------------ + + /// Retrieve response + /// + /// Retrieves a model response. + /// + /// `responseId`: The ID of the response to retrieve. + /// + /// `include`: Additional fields to include in the response. + /// + /// `GET` `https://api.openai.com/v1/responses/{response_id}` + Future getResponse({ + required String responseId, + List? include, + }) async { + final r = await makeRequest( + baseUrl: 'https://api.openai.com/v1', + path: '/responses/$responseId', + method: HttpMethod.get, + isMultipart: false, + requestType: '', + responseType: 'application/json', + queryParams: { + if (include != null) 'include': include, + }, + ); + return Response.fromJson(_jsonDecode(r)); + } + + // ------------------------------------------ + // METHOD: deleteResponse + // ------------------------------------------ + + /// Delete response + /// + /// Deletes a model response. + /// + /// `responseId`: The ID of the response to delete. + /// + /// `DELETE` `https://api.openai.com/v1/responses/{response_id}` + Future deleteResponse({ + required String responseId, + }) async { + final r = await makeRequest( + baseUrl: 'https://api.openai.com/v1', + path: '/responses/$responseId', + method: HttpMethod.delete, + isMultipart: false, + requestType: '', + responseType: 'application/json', + ); + return DeleteResponseResponse.fromJson(_jsonDecode(r)); + } + + // ------------------------------------------ + // METHOD: cancelResponse + // ------------------------------------------ + + /// Cancel response + /// + /// Cancels a model response. + /// + /// `responseId`: The ID of the response to cancel. + /// + /// `POST` `https://api.openai.com/v1/responses/{response_id}/cancel` + Future cancelResponse({ + required String responseId, + }) async { + final r = await makeRequest( + baseUrl: 'https://api.openai.com/v1', + path: '/responses/$responseId/cancel', + method: HttpMethod.post, + isMultipart: false, + requestType: '', + responseType: 'application/json', + ); + return Response.fromJson(_jsonDecode(r)); + } + + // ------------------------------------------ + // METHOD: listResponseInputItems + // ------------------------------------------ + + /// List input items + /// + /// Returns a list of input items for a response. + /// + /// `responseId`: The ID of the response to retrieve input items for. + /// + /// `limit`: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + /// + /// `order`: Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + /// + /// `after`: 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. + /// + /// `before`: 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, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + /// + /// `include`: Additional fields to include in the response. + /// + /// `GET` `https://api.openai.com/v1/responses/{response_id}/input_items` + Future listResponseInputItems({ + required String responseId, + int limit = 20, + String order = 'desc', + String? after, + String? before, + List? include, + }) async { + final r = await makeRequest( + baseUrl: 'https://api.openai.com/v1', + path: '/responses/$responseId/input_items', + method: HttpMethod.get, + isMultipart: false, + requestType: '', + responseType: 'application/json', + queryParams: { + 'limit': limit, + 'order': order, + if (after != null) 'after': after, + if (before != null) 'before': before, + if (include != null) 'include': include, + }, + ); + return ResponseItemList.fromJson(_jsonDecode(r)); + } } diff --git a/packages/openai_dart/lib/src/generated/schema/create_response_request.dart b/packages/openai_dart/lib/src/generated/schema/create_response_request.dart new file mode 100644 index 00000000..a21978d8 --- /dev/null +++ b/packages/openai_dart/lib/src/generated/schema/create_response_request.dart @@ -0,0 +1,126 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of open_a_i_schema; + +// ========================================== +// CLASS: CreateResponseRequest +// ========================================== + +/// Request object for the Create response endpoint. +@freezed +class CreateResponseRequest with _$CreateResponseRequest { + const CreateResponseRequest._(); + + /// Factory constructor for CreateResponseRequest + const factory CreateResponseRequest({ + /// The ID of the model to use. + required String model, + + /// Text or items to generate a response for. + @_CreateResponseRequestInputConverter() + required CreateResponseRequestInput input, + + /// No Description + @JsonKey(includeIfNull: false) List>? tools, + + /// No Description + @JsonKey(includeIfNull: false) Map? metadata, + + /// No Description + @JsonKey(includeIfNull: false) bool? stream, + + /// No Description + @JsonKey(includeIfNull: false) double? temperature, + + /// No Description + @JsonKey(name: 'top_p', includeIfNull: false) double? topP, + }) = _CreateResponseRequest; + + /// Object construction from a JSON representation + factory CreateResponseRequest.fromJson(Map json) => + _$CreateResponseRequestFromJson(json); + + /// List of all property names of schema + static const List propertyNames = [ + 'model', + 'input', + 'tools', + 'metadata', + 'stream', + 'temperature', + 'top_p' + ]; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'model': model, + 'input': input, + 'tools': tools, + 'metadata': metadata, + 'stream': stream, + 'temperature': temperature, + 'top_p': topP, + }; + } +} + +// ========================================== +// CLASS: CreateResponseRequestInput +// ========================================== + +/// Text or items to generate a response for. +@freezed +sealed class CreateResponseRequestInput with _$CreateResponseRequestInput { + const CreateResponseRequestInput._(); + + /// No Description + const factory CreateResponseRequestInput.listMapStringDynamic( + List> value, + ) = CreateResponseRequestInputListMapStringDynamic; + + /// No Description + const factory CreateResponseRequestInput.string( + String value, + ) = CreateResponseRequestInputString; + + /// Object construction from a JSON representation + factory CreateResponseRequestInput.fromJson(Map json) => + _$CreateResponseRequestInputFromJson(json); +} + +/// Custom JSON converter for [CreateResponseRequestInput] +class _CreateResponseRequestInputConverter + implements JsonConverter { + const _CreateResponseRequestInputConverter(); + + @override + CreateResponseRequestInput fromJson(Object? data) { + if (data is List && data.every((item) => item is Map)) { + return CreateResponseRequestInputListMapStringDynamic(data + .map((i) => Map.fromJson(i as Map)) + .toList(growable: false)); + } + if (data is String) { + return CreateResponseRequestInputString(data); + } + throw Exception( + 'Unexpected value for CreateResponseRequestInput: $data', + ); + } + + @override + Object? toJson(CreateResponseRequestInput data) { + return switch (data) { + CreateResponseRequestInputListMapStringDynamic(value: final v) => v, + CreateResponseRequestInputString(value: final v) => v, + }; + } +} diff --git a/packages/openai_dart/lib/src/generated/schema/delete_response_response.dart b/packages/openai_dart/lib/src/generated/schema/delete_response_response.dart new file mode 100644 index 00000000..eafc447c --- /dev/null +++ b/packages/openai_dart/lib/src/generated/schema/delete_response_response.dart @@ -0,0 +1,58 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of open_a_i_schema; + +// ========================================== +// CLASS: DeleteResponseResponse +// ========================================== + +/// Represents a deleted response. +@freezed +class DeleteResponseResponse with _$DeleteResponseResponse { + const DeleteResponseResponse._(); + + /// Factory constructor for DeleteResponseResponse + const factory DeleteResponseResponse({ + /// No Description + required String id, + + /// + required DeleteResponseResponseObject object, + + /// No Description + required bool deleted, + }) = _DeleteResponseResponse; + + /// Object construction from a JSON representation + factory DeleteResponseResponse.fromJson(Map json) => + _$DeleteResponseResponseFromJson(json); + + /// List of all property names of schema + static const List propertyNames = ['id', 'object', 'deleted']; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'id': id, + 'object': object, + 'deleted': deleted, + }; + } +} + +// ========================================== +// ENUM: DeleteResponseResponseObject +// ========================================== + +/// No Description +enum DeleteResponseResponseObject { + @JsonValue('response') + response, +} diff --git a/packages/openai_dart/lib/src/generated/schema/response.dart b/packages/openai_dart/lib/src/generated/schema/response.dart new file mode 100644 index 00000000..93b3c322 --- /dev/null +++ b/packages/openai_dart/lib/src/generated/schema/response.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 open_a_i_schema; + +// ========================================== +// CLASS: Response +// ========================================== + +/// Model response. +@freezed +class Response with _$Response { + const Response._(); + + /// Factory constructor for Response + const factory Response({ + /// No Description + required String id, + + /// No Description + required String object, + + /// No Description + required String status, + + /// No Description + @JsonKey(name: 'created_at') required int createdAt, + + /// No Description + required List> output, + }) = _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', + 'created_at', + 'output' + ]; + + /// 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, + 'created_at': createdAt, + 'output': output, + }; + } +} diff --git a/packages/openai_dart/lib/src/generated/schema/response_item_list.dart b/packages/openai_dart/lib/src/generated/schema/response_item_list.dart new file mode 100644 index 00000000..d1fc003b --- /dev/null +++ b/packages/openai_dart/lib/src/generated/schema/response_item_list.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 open_a_i_schema; + +// ========================================== +// CLASS: ResponseItemList +// ========================================== + +/// List of input items returned by the List input items endpoint. +@freezed +class ResponseItemList with _$ResponseItemList { + const ResponseItemList._(); + + /// Factory constructor for ResponseItemList + const factory ResponseItemList({ + /// No Description + required String object, + + /// No Description + required List> data, + + /// No Description + @JsonKey(name: 'first_id') required String firstId, + + /// No Description + @JsonKey(name: 'last_id') required String lastId, + + /// No Description + @JsonKey(name: 'has_more') required bool hasMore, + }) = _ResponseItemList; + + /// Object construction from a JSON representation + factory ResponseItemList.fromJson(Map json) => + _$ResponseItemListFromJson(json); + + /// List of all property names of schema + static const List propertyNames = [ + 'object', + 'data', + 'first_id', + 'last_id', + 'has_more' + ]; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'object': object, + 'data': data, + 'first_id': firstId, + 'last_id': lastId, + 'has_more': hasMore, + }; + } +} diff --git a/packages/openai_dart/lib/src/generated/schema/response_stream_event.dart b/packages/openai_dart/lib/src/generated/schema/response_stream_event.dart new file mode 100644 index 00000000..3ced4a73 --- /dev/null +++ b/packages/openai_dart/lib/src/generated/schema/response_stream_event.dart @@ -0,0 +1,12 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of open_a_i_schema; + +// ========================================== +// TYPE: ResponseStreamEvent +// ========================================== + +/// Represents a streamed event for a response. +typedef ResponseStreamEvent = Map; diff --git a/packages/openai_dart/lib/src/generated/schema/schema.dart b/packages/openai_dart/lib/src/generated/schema/schema.dart index 73a5b029..a3c8be36 100644 --- a/packages/openai_dart/lib/src/generated/schema/schema.dart +++ b/packages/openai_dart/lib/src/generated/schema/schema.dart @@ -162,6 +162,11 @@ part 'chat_completion_metadata.dart'; part 'web_search_options.dart'; part 'web_search_context_size.dart'; part 'web_search_location.dart'; +part 'create_response_request.dart'; +part 'response.dart'; +part 'delete_response_response.dart'; +part 'response_item_list.dart'; +part 'response_stream_event.dart'; part 'chat_completion_message.dart'; part 'chat_completion_message_content_part.dart'; part 'response_format.dart'; diff --git a/packages/openai_dart/lib/src/generated/schema/schema.freezed.dart b/packages/openai_dart/lib/src/generated/schema/schema.freezed.dart index 924fef53..454c456a 100644 --- a/packages/openai_dart/lib/src/generated/schema/schema.freezed.dart +++ b/packages/openai_dart/lib/src/generated/schema/schema.freezed.dart @@ -59597,6 +59597,1613 @@ abstract class _WebSearchLocation extends WebSearchLocation { throw _privateConstructorUsedError; } +CreateResponseRequest _$CreateResponseRequestFromJson( + Map json) { + return _CreateResponseRequest.fromJson(json); +} + +/// @nodoc +mixin _$CreateResponseRequest { + /// The ID of the model to use. + String get model => throw _privateConstructorUsedError; + + /// Text or items to generate a response for. + @_CreateResponseRequestInputConverter() + CreateResponseRequestInput get input => throw _privateConstructorUsedError; + + /// No Description + @JsonKey(includeIfNull: false) + List>? get tools => throw _privateConstructorUsedError; + + /// No Description + @JsonKey(includeIfNull: false) + Map? get metadata => throw _privateConstructorUsedError; + + /// No Description + @JsonKey(includeIfNull: false) + bool? get stream => throw _privateConstructorUsedError; + + /// No Description + @JsonKey(includeIfNull: false) + double? get temperature => throw _privateConstructorUsedError; + + /// No Description + @JsonKey(name: 'top_p', includeIfNull: false) + double? get topP => throw _privateConstructorUsedError; + + /// Serializes this CreateResponseRequest to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of CreateResponseRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $CreateResponseRequestCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $CreateResponseRequestCopyWith<$Res> { + factory $CreateResponseRequestCopyWith(CreateResponseRequest value, + $Res Function(CreateResponseRequest) then) = + _$CreateResponseRequestCopyWithImpl<$Res, CreateResponseRequest>; + @useResult + $Res call( + {String model, + @_CreateResponseRequestInputConverter() CreateResponseRequestInput input, + @JsonKey(includeIfNull: false) List>? tools, + @JsonKey(includeIfNull: false) Map? metadata, + @JsonKey(includeIfNull: false) bool? stream, + @JsonKey(includeIfNull: false) double? temperature, + @JsonKey(name: 'top_p', includeIfNull: false) double? topP}); + + $CreateResponseRequestInputCopyWith<$Res> get input; +} + +/// @nodoc +class _$CreateResponseRequestCopyWithImpl<$Res, + $Val extends CreateResponseRequest> + implements $CreateResponseRequestCopyWith<$Res> { + _$CreateResponseRequestCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of CreateResponseRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? model = null, + Object? input = null, + Object? tools = freezed, + Object? metadata = freezed, + Object? stream = freezed, + Object? temperature = freezed, + Object? topP = freezed, + }) { + return _then(_value.copyWith( + model: null == model + ? _value.model + : model // ignore: cast_nullable_to_non_nullable + as String, + input: null == input + ? _value.input + : input // ignore: cast_nullable_to_non_nullable + as CreateResponseRequestInput, + tools: freezed == tools + ? _value.tools + : tools // ignore: cast_nullable_to_non_nullable + as List>?, + metadata: freezed == metadata + ? _value.metadata + : metadata // ignore: cast_nullable_to_non_nullable + as Map?, + stream: freezed == stream + ? _value.stream + : stream // ignore: cast_nullable_to_non_nullable + as bool?, + temperature: freezed == temperature + ? _value.temperature + : temperature // ignore: cast_nullable_to_non_nullable + as double?, + topP: freezed == topP + ? _value.topP + : topP // ignore: cast_nullable_to_non_nullable + as double?, + ) as $Val); + } + + /// Create a copy of CreateResponseRequest + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $CreateResponseRequestInputCopyWith<$Res> get input { + return $CreateResponseRequestInputCopyWith<$Res>(_value.input, (value) { + return _then(_value.copyWith(input: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$CreateResponseRequestImplCopyWith<$Res> + implements $CreateResponseRequestCopyWith<$Res> { + factory _$$CreateResponseRequestImplCopyWith( + _$CreateResponseRequestImpl value, + $Res Function(_$CreateResponseRequestImpl) then) = + __$$CreateResponseRequestImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String model, + @_CreateResponseRequestInputConverter() CreateResponseRequestInput input, + @JsonKey(includeIfNull: false) List>? tools, + @JsonKey(includeIfNull: false) Map? metadata, + @JsonKey(includeIfNull: false) bool? stream, + @JsonKey(includeIfNull: false) double? temperature, + @JsonKey(name: 'top_p', includeIfNull: false) double? topP}); + + @override + $CreateResponseRequestInputCopyWith<$Res> get input; +} + +/// @nodoc +class __$$CreateResponseRequestImplCopyWithImpl<$Res> + extends _$CreateResponseRequestCopyWithImpl<$Res, + _$CreateResponseRequestImpl> + implements _$$CreateResponseRequestImplCopyWith<$Res> { + __$$CreateResponseRequestImplCopyWithImpl(_$CreateResponseRequestImpl _value, + $Res Function(_$CreateResponseRequestImpl) _then) + : super(_value, _then); + + /// Create a copy of CreateResponseRequest + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? model = null, + Object? input = null, + Object? tools = freezed, + Object? metadata = freezed, + Object? stream = freezed, + Object? temperature = freezed, + Object? topP = freezed, + }) { + return _then(_$CreateResponseRequestImpl( + model: null == model + ? _value.model + : model // ignore: cast_nullable_to_non_nullable + as String, + input: null == input + ? _value.input + : input // ignore: cast_nullable_to_non_nullable + as CreateResponseRequestInput, + tools: freezed == tools + ? _value._tools + : tools // ignore: cast_nullable_to_non_nullable + as List>?, + metadata: freezed == metadata + ? _value._metadata + : metadata // ignore: cast_nullable_to_non_nullable + as Map?, + stream: freezed == stream + ? _value.stream + : stream // ignore: cast_nullable_to_non_nullable + as bool?, + temperature: freezed == temperature + ? _value.temperature + : temperature // ignore: cast_nullable_to_non_nullable + as double?, + topP: freezed == topP + ? _value.topP + : topP // ignore: cast_nullable_to_non_nullable + as double?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$CreateResponseRequestImpl extends _CreateResponseRequest { + const _$CreateResponseRequestImpl( + {required this.model, + @_CreateResponseRequestInputConverter() required this.input, + @JsonKey(includeIfNull: false) final List>? tools, + @JsonKey(includeIfNull: false) final Map? metadata, + @JsonKey(includeIfNull: false) this.stream, + @JsonKey(includeIfNull: false) this.temperature, + @JsonKey(name: 'top_p', includeIfNull: false) this.topP}) + : _tools = tools, + _metadata = metadata, + super._(); + + factory _$CreateResponseRequestImpl.fromJson(Map json) => + _$$CreateResponseRequestImplFromJson(json); + + /// The ID of the model to use. + @override + final String model; + + /// Text or items to generate a response for. + @override + @_CreateResponseRequestInputConverter() + final CreateResponseRequestInput input; + + /// No Description + final List>? _tools; + + /// No Description + @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); + } + + /// No Description + final Map? _metadata; + + /// No Description + @override + @JsonKey(includeIfNull: false) + Map? get metadata { + final value = _metadata; + if (value == null) return null; + if (_metadata is EqualUnmodifiableMapView) return _metadata; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + /// No Description + @override + @JsonKey(includeIfNull: false) + final bool? stream; + + /// No Description + @override + @JsonKey(includeIfNull: false) + final double? temperature; + + /// No Description + @override + @JsonKey(name: 'top_p', includeIfNull: false) + final double? topP; + + @override + String toString() { + return 'CreateResponseRequest(model: $model, input: $input, tools: $tools, metadata: $metadata, stream: $stream, temperature: $temperature, topP: $topP)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$CreateResponseRequestImpl && + (identical(other.model, model) || other.model == model) && + (identical(other.input, input) || other.input == input) && + const DeepCollectionEquality().equals(other._tools, _tools) && + const DeepCollectionEquality().equals(other._metadata, _metadata) && + (identical(other.stream, stream) || other.stream == stream) && + (identical(other.temperature, temperature) || + other.temperature == temperature) && + (identical(other.topP, topP) || other.topP == topP)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, + model, + input, + const DeepCollectionEquality().hash(_tools), + const DeepCollectionEquality().hash(_metadata), + stream, + temperature, + topP); + + /// Create a copy of CreateResponseRequest + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$CreateResponseRequestImplCopyWith<_$CreateResponseRequestImpl> + get copyWith => __$$CreateResponseRequestImplCopyWithImpl< + _$CreateResponseRequestImpl>(this, _$identity); + + @override + Map toJson() { + return _$$CreateResponseRequestImplToJson( + this, + ); + } +} + +abstract class _CreateResponseRequest extends CreateResponseRequest { + const factory _CreateResponseRequest( + {required final String model, + @_CreateResponseRequestInputConverter() + required final CreateResponseRequestInput input, + @JsonKey(includeIfNull: false) final List>? tools, + @JsonKey(includeIfNull: false) final Map? metadata, + @JsonKey(includeIfNull: false) final bool? stream, + @JsonKey(includeIfNull: false) final double? temperature, + @JsonKey(name: 'top_p', includeIfNull: false) + final double? topP}) = _$CreateResponseRequestImpl; + const _CreateResponseRequest._() : super._(); + + factory _CreateResponseRequest.fromJson(Map json) = + _$CreateResponseRequestImpl.fromJson; + + /// The ID of the model to use. + @override + String get model; + + /// Text or items to generate a response for. + @override + @_CreateResponseRequestInputConverter() + CreateResponseRequestInput get input; + + /// No Description + @override + @JsonKey(includeIfNull: false) + List>? get tools; + + /// No Description + @override + @JsonKey(includeIfNull: false) + Map? get metadata; + + /// No Description + @override + @JsonKey(includeIfNull: false) + bool? get stream; + + /// No Description + @override + @JsonKey(includeIfNull: false) + double? get temperature; + + /// No Description + @override + @JsonKey(name: 'top_p', includeIfNull: false) + double? get topP; + + /// Create a copy of CreateResponseRequest + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$CreateResponseRequestImplCopyWith<_$CreateResponseRequestImpl> + get copyWith => throw _privateConstructorUsedError; +} + +CreateResponseRequestInput _$CreateResponseRequestInputFromJson( + Map json) { + switch (json['runtimeType']) { + case 'listMapStringDynamic': + return CreateResponseRequestInputListMapStringDynamic.fromJson(json); + case 'string': + return CreateResponseRequestInputString.fromJson(json); + + default: + throw CheckedFromJsonException( + json, + 'runtimeType', + 'CreateResponseRequestInput', + 'Invalid union type "${json['runtimeType']}"!'); + } +} + +/// @nodoc +mixin _$CreateResponseRequestInput { + Object get value => throw _privateConstructorUsedError; + @optionalTypeArgs + TResult when({ + required TResult Function(List> value) + listMapStringDynamic, + required TResult Function(String value) string, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(List> value)? listMapStringDynamic, + TResult? Function(String value)? string, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(List> value)? listMapStringDynamic, + TResult Function(String value)? string, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function( + CreateResponseRequestInputListMapStringDynamic value) + listMapStringDynamic, + required TResult Function(CreateResponseRequestInputString value) string, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(CreateResponseRequestInputListMapStringDynamic value)? + listMapStringDynamic, + TResult? Function(CreateResponseRequestInputString value)? string, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(CreateResponseRequestInputListMapStringDynamic value)? + listMapStringDynamic, + TResult Function(CreateResponseRequestInputString value)? string, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + + /// Serializes this CreateResponseRequestInput to a JSON map. + Map toJson() => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $CreateResponseRequestInputCopyWith<$Res> { + factory $CreateResponseRequestInputCopyWith(CreateResponseRequestInput value, + $Res Function(CreateResponseRequestInput) then) = + _$CreateResponseRequestInputCopyWithImpl<$Res, + CreateResponseRequestInput>; +} + +/// @nodoc +class _$CreateResponseRequestInputCopyWithImpl<$Res, + $Val extends CreateResponseRequestInput> + implements $CreateResponseRequestInputCopyWith<$Res> { + _$CreateResponseRequestInputCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of CreateResponseRequestInput + /// with the given fields replaced by the non-null parameter values. +} + +/// @nodoc +abstract class _$$CreateResponseRequestInputListMapStringDynamicImplCopyWith< + $Res> { + factory _$$CreateResponseRequestInputListMapStringDynamicImplCopyWith( + _$CreateResponseRequestInputListMapStringDynamicImpl value, + $Res Function(_$CreateResponseRequestInputListMapStringDynamicImpl) + then) = + __$$CreateResponseRequestInputListMapStringDynamicImplCopyWithImpl<$Res>; + @useResult + $Res call({List> value}); +} + +/// @nodoc +class __$$CreateResponseRequestInputListMapStringDynamicImplCopyWithImpl<$Res> + extends _$CreateResponseRequestInputCopyWithImpl<$Res, + _$CreateResponseRequestInputListMapStringDynamicImpl> + implements + _$$CreateResponseRequestInputListMapStringDynamicImplCopyWith<$Res> { + __$$CreateResponseRequestInputListMapStringDynamicImplCopyWithImpl( + _$CreateResponseRequestInputListMapStringDynamicImpl _value, + $Res Function(_$CreateResponseRequestInputListMapStringDynamicImpl) _then) + : super(_value, _then); + + /// Create a copy of CreateResponseRequestInput + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_$CreateResponseRequestInputListMapStringDynamicImpl( + null == value + ? _value._value + : value // ignore: cast_nullable_to_non_nullable + as List>, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$CreateResponseRequestInputListMapStringDynamicImpl + extends CreateResponseRequestInputListMapStringDynamic { + const _$CreateResponseRequestInputListMapStringDynamicImpl( + final List> value, + {final String? $type}) + : _value = value, + $type = $type ?? 'listMapStringDynamic', + super._(); + + factory _$CreateResponseRequestInputListMapStringDynamicImpl.fromJson( + Map json) => + _$$CreateResponseRequestInputListMapStringDynamicImplFromJson(json); + + final List> _value; + @override + List> get value { + if (_value is EqualUnmodifiableListView) return _value; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_value); + } + + @JsonKey(name: 'runtimeType') + final String $type; + + @override + String toString() { + return 'CreateResponseRequestInput.listMapStringDynamic(value: $value)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$CreateResponseRequestInputListMapStringDynamicImpl && + const DeepCollectionEquality().equals(other._value, _value)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(_value)); + + /// Create a copy of CreateResponseRequestInput + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$CreateResponseRequestInputListMapStringDynamicImplCopyWith< + _$CreateResponseRequestInputListMapStringDynamicImpl> + get copyWith => + __$$CreateResponseRequestInputListMapStringDynamicImplCopyWithImpl< + _$CreateResponseRequestInputListMapStringDynamicImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(List> value) + listMapStringDynamic, + required TResult Function(String value) string, + }) { + return listMapStringDynamic(value); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(List> value)? listMapStringDynamic, + TResult? Function(String value)? string, + }) { + return listMapStringDynamic?.call(value); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(List> value)? listMapStringDynamic, + TResult Function(String value)? string, + required TResult orElse(), + }) { + if (listMapStringDynamic != null) { + return listMapStringDynamic(value); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function( + CreateResponseRequestInputListMapStringDynamic value) + listMapStringDynamic, + required TResult Function(CreateResponseRequestInputString value) string, + }) { + return listMapStringDynamic(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(CreateResponseRequestInputListMapStringDynamic value)? + listMapStringDynamic, + TResult? Function(CreateResponseRequestInputString value)? string, + }) { + return listMapStringDynamic?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(CreateResponseRequestInputListMapStringDynamic value)? + listMapStringDynamic, + TResult Function(CreateResponseRequestInputString value)? string, + required TResult orElse(), + }) { + if (listMapStringDynamic != null) { + return listMapStringDynamic(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$CreateResponseRequestInputListMapStringDynamicImplToJson( + this, + ); + } +} + +abstract class CreateResponseRequestInputListMapStringDynamic + extends CreateResponseRequestInput { + const factory CreateResponseRequestInputListMapStringDynamic( + final List> value) = + _$CreateResponseRequestInputListMapStringDynamicImpl; + const CreateResponseRequestInputListMapStringDynamic._() : super._(); + + factory CreateResponseRequestInputListMapStringDynamic.fromJson( + Map json) = + _$CreateResponseRequestInputListMapStringDynamicImpl.fromJson; + + @override + List> get value; + + /// Create a copy of CreateResponseRequestInput + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + _$$CreateResponseRequestInputListMapStringDynamicImplCopyWith< + _$CreateResponseRequestInputListMapStringDynamicImpl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$CreateResponseRequestInputStringImplCopyWith<$Res> { + factory _$$CreateResponseRequestInputStringImplCopyWith( + _$CreateResponseRequestInputStringImpl value, + $Res Function(_$CreateResponseRequestInputStringImpl) then) = + __$$CreateResponseRequestInputStringImplCopyWithImpl<$Res>; + @useResult + $Res call({String value}); +} + +/// @nodoc +class __$$CreateResponseRequestInputStringImplCopyWithImpl<$Res> + extends _$CreateResponseRequestInputCopyWithImpl<$Res, + _$CreateResponseRequestInputStringImpl> + implements _$$CreateResponseRequestInputStringImplCopyWith<$Res> { + __$$CreateResponseRequestInputStringImplCopyWithImpl( + _$CreateResponseRequestInputStringImpl _value, + $Res Function(_$CreateResponseRequestInputStringImpl) _then) + : super(_value, _then); + + /// Create a copy of CreateResponseRequestInput + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? value = null, + }) { + return _then(_$CreateResponseRequestInputStringImpl( + null == value + ? _value.value + : value // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$CreateResponseRequestInputStringImpl + extends CreateResponseRequestInputString { + const _$CreateResponseRequestInputStringImpl(this.value, + {final String? $type}) + : $type = $type ?? 'string', + super._(); + + factory _$CreateResponseRequestInputStringImpl.fromJson( + Map json) => + _$$CreateResponseRequestInputStringImplFromJson(json); + + @override + final String value; + + @JsonKey(name: 'runtimeType') + final String $type; + + @override + String toString() { + return 'CreateResponseRequestInput.string(value: $value)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$CreateResponseRequestInputStringImpl && + (identical(other.value, value) || other.value == value)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, value); + + /// Create a copy of CreateResponseRequestInput + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$CreateResponseRequestInputStringImplCopyWith< + _$CreateResponseRequestInputStringImpl> + get copyWith => __$$CreateResponseRequestInputStringImplCopyWithImpl< + _$CreateResponseRequestInputStringImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(List> value) + listMapStringDynamic, + required TResult Function(String value) string, + }) { + return string(value); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(List> value)? listMapStringDynamic, + TResult? Function(String value)? string, + }) { + return string?.call(value); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(List> value)? listMapStringDynamic, + TResult Function(String value)? string, + required TResult orElse(), + }) { + if (string != null) { + return string(value); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function( + CreateResponseRequestInputListMapStringDynamic value) + listMapStringDynamic, + required TResult Function(CreateResponseRequestInputString value) string, + }) { + return string(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(CreateResponseRequestInputListMapStringDynamic value)? + listMapStringDynamic, + TResult? Function(CreateResponseRequestInputString value)? string, + }) { + return string?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(CreateResponseRequestInputListMapStringDynamic value)? + listMapStringDynamic, + TResult Function(CreateResponseRequestInputString value)? string, + required TResult orElse(), + }) { + if (string != null) { + return string(this); + } + return orElse(); + } + + @override + Map toJson() { + return _$$CreateResponseRequestInputStringImplToJson( + this, + ); + } +} + +abstract class CreateResponseRequestInputString + extends CreateResponseRequestInput { + const factory CreateResponseRequestInputString(final String value) = + _$CreateResponseRequestInputStringImpl; + const CreateResponseRequestInputString._() : super._(); + + factory CreateResponseRequestInputString.fromJson(Map json) = + _$CreateResponseRequestInputStringImpl.fromJson; + + @override + String get value; + + /// Create a copy of CreateResponseRequestInput + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + _$$CreateResponseRequestInputStringImplCopyWith< + _$CreateResponseRequestInputStringImpl> + get copyWith => throw _privateConstructorUsedError; +} + +Response _$ResponseFromJson(Map json) { + return _Response.fromJson(json); +} + +/// @nodoc +mixin _$Response { + /// No Description + String get id => throw _privateConstructorUsedError; + + /// No Description + String get object => throw _privateConstructorUsedError; + + /// No Description + String get status => throw _privateConstructorUsedError; + + /// No Description + @JsonKey(name: 'created_at') + int get createdAt => throw _privateConstructorUsedError; + + /// No Description + List> get output => 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, + String object, + String status, + @JsonKey(name: 'created_at') int createdAt, + List> output}); +} + +/// @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? createdAt = null, + Object? output = 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 String, + status: null == status + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as int, + output: null == output + ? _value.output + : output // ignore: cast_nullable_to_non_nullable + as List>, + ) 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, + String object, + String status, + @JsonKey(name: 'created_at') int createdAt, + List> output}); +} + +/// @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? createdAt = null, + Object? output = null, + }) { + 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 String, + status: null == status + ? _value.status + : status // ignore: cast_nullable_to_non_nullable + as String, + createdAt: null == createdAt + ? _value.createdAt + : createdAt // ignore: cast_nullable_to_non_nullable + as int, + output: null == output + ? _value._output + : output // ignore: cast_nullable_to_non_nullable + as List>, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ResponseImpl extends _Response { + const _$ResponseImpl( + {required this.id, + required this.object, + required this.status, + @JsonKey(name: 'created_at') required this.createdAt, + required final List> output}) + : _output = output, + super._(); + + factory _$ResponseImpl.fromJson(Map json) => + _$$ResponseImplFromJson(json); + + /// No Description + @override + final String id; + + /// No Description + @override + final String object; + + /// No Description + @override + final String status; + + /// No Description + @override + @JsonKey(name: 'created_at') + final int createdAt; + + /// No Description + final List> _output; + + /// No Description + @override + List> get output { + if (_output is EqualUnmodifiableListView) return _output; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_output); + } + + @override + String toString() { + return 'Response(id: $id, object: $object, status: $status, createdAt: $createdAt, output: $output)'; + } + + @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.createdAt, createdAt) || + other.createdAt == createdAt) && + const DeepCollectionEquality().equals(other._output, _output)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, object, status, createdAt, + const DeepCollectionEquality().hash(_output)); + + /// 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, + required final String object, + required final String status, + @JsonKey(name: 'created_at') required final int createdAt, + required final List> output}) = _$ResponseImpl; + const _Response._() : super._(); + + factory _Response.fromJson(Map json) = + _$ResponseImpl.fromJson; + + /// No Description + @override + String get id; + + /// No Description + @override + String get object; + + /// No Description + @override + String get status; + + /// No Description + @override + @JsonKey(name: 'created_at') + int get createdAt; + + /// No Description + @override + List> get output; + + /// 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; +} + +DeleteResponseResponse _$DeleteResponseResponseFromJson( + Map json) { + return _DeleteResponseResponse.fromJson(json); +} + +/// @nodoc +mixin _$DeleteResponseResponse { + /// No Description + String get id => throw _privateConstructorUsedError; + + /// + DeleteResponseResponseObject get object => throw _privateConstructorUsedError; + + /// No Description + bool get deleted => throw _privateConstructorUsedError; + + /// Serializes this DeleteResponseResponse to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of DeleteResponseResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $DeleteResponseResponseCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $DeleteResponseResponseCopyWith<$Res> { + factory $DeleteResponseResponseCopyWith(DeleteResponseResponse value, + $Res Function(DeleteResponseResponse) then) = + _$DeleteResponseResponseCopyWithImpl<$Res, DeleteResponseResponse>; + @useResult + $Res call({String id, DeleteResponseResponseObject object, bool deleted}); +} + +/// @nodoc +class _$DeleteResponseResponseCopyWithImpl<$Res, + $Val extends DeleteResponseResponse> + implements $DeleteResponseResponseCopyWith<$Res> { + _$DeleteResponseResponseCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of DeleteResponseResponse + /// 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? deleted = 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 DeleteResponseResponseObject, + deleted: null == deleted + ? _value.deleted + : deleted // ignore: cast_nullable_to_non_nullable + as bool, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$DeleteResponseResponseImplCopyWith<$Res> + implements $DeleteResponseResponseCopyWith<$Res> { + factory _$$DeleteResponseResponseImplCopyWith( + _$DeleteResponseResponseImpl value, + $Res Function(_$DeleteResponseResponseImpl) then) = + __$$DeleteResponseResponseImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String id, DeleteResponseResponseObject object, bool deleted}); +} + +/// @nodoc +class __$$DeleteResponseResponseImplCopyWithImpl<$Res> + extends _$DeleteResponseResponseCopyWithImpl<$Res, + _$DeleteResponseResponseImpl> + implements _$$DeleteResponseResponseImplCopyWith<$Res> { + __$$DeleteResponseResponseImplCopyWithImpl( + _$DeleteResponseResponseImpl _value, + $Res Function(_$DeleteResponseResponseImpl) _then) + : super(_value, _then); + + /// Create a copy of DeleteResponseResponse + /// 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? deleted = null, + }) { + return _then(_$DeleteResponseResponseImpl( + 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 DeleteResponseResponseObject, + deleted: null == deleted + ? _value.deleted + : deleted // ignore: cast_nullable_to_non_nullable + as bool, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$DeleteResponseResponseImpl extends _DeleteResponseResponse { + const _$DeleteResponseResponseImpl( + {required this.id, required this.object, required this.deleted}) + : super._(); + + factory _$DeleteResponseResponseImpl.fromJson(Map json) => + _$$DeleteResponseResponseImplFromJson(json); + + /// No Description + @override + final String id; + + /// + @override + final DeleteResponseResponseObject object; + + /// No Description + @override + final bool deleted; + + @override + String toString() { + return 'DeleteResponseResponse(id: $id, object: $object, deleted: $deleted)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DeleteResponseResponseImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.object, object) || other.object == object) && + (identical(other.deleted, deleted) || other.deleted == deleted)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, id, object, deleted); + + /// Create a copy of DeleteResponseResponse + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$DeleteResponseResponseImplCopyWith<_$DeleteResponseResponseImpl> + get copyWith => __$$DeleteResponseResponseImplCopyWithImpl< + _$DeleteResponseResponseImpl>(this, _$identity); + + @override + Map toJson() { + return _$$DeleteResponseResponseImplToJson( + this, + ); + } +} + +abstract class _DeleteResponseResponse extends DeleteResponseResponse { + const factory _DeleteResponseResponse( + {required final String id, + required final DeleteResponseResponseObject object, + required final bool deleted}) = _$DeleteResponseResponseImpl; + const _DeleteResponseResponse._() : super._(); + + factory _DeleteResponseResponse.fromJson(Map json) = + _$DeleteResponseResponseImpl.fromJson; + + /// No Description + @override + String get id; + + /// + @override + DeleteResponseResponseObject get object; + + /// No Description + @override + bool get deleted; + + /// Create a copy of DeleteResponseResponse + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$DeleteResponseResponseImplCopyWith<_$DeleteResponseResponseImpl> + get copyWith => throw _privateConstructorUsedError; +} + +ResponseItemList _$ResponseItemListFromJson(Map json) { + return _ResponseItemList.fromJson(json); +} + +/// @nodoc +mixin _$ResponseItemList { + /// No Description + String get object => throw _privateConstructorUsedError; + + /// No Description + List> get data => throw _privateConstructorUsedError; + + /// No Description + @JsonKey(name: 'first_id') + String get firstId => throw _privateConstructorUsedError; + + /// No Description + @JsonKey(name: 'last_id') + String get lastId => throw _privateConstructorUsedError; + + /// No Description + @JsonKey(name: 'has_more') + bool get hasMore => throw _privateConstructorUsedError; + + /// Serializes this ResponseItemList to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of ResponseItemList + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $ResponseItemListCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ResponseItemListCopyWith<$Res> { + factory $ResponseItemListCopyWith( + ResponseItemList value, $Res Function(ResponseItemList) then) = + _$ResponseItemListCopyWithImpl<$Res, ResponseItemList>; + @useResult + $Res call( + {String object, + List> data, + @JsonKey(name: 'first_id') String firstId, + @JsonKey(name: 'last_id') String lastId, + @JsonKey(name: 'has_more') bool hasMore}); +} + +/// @nodoc +class _$ResponseItemListCopyWithImpl<$Res, $Val extends ResponseItemList> + implements $ResponseItemListCopyWith<$Res> { + _$ResponseItemListCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of ResponseItemList + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? object = null, + Object? data = null, + Object? firstId = null, + Object? lastId = null, + Object? hasMore = null, + }) { + return _then(_value.copyWith( + object: null == object + ? _value.object + : object // ignore: cast_nullable_to_non_nullable + as String, + data: null == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as List>, + firstId: null == firstId + ? _value.firstId + : firstId // ignore: cast_nullable_to_non_nullable + as String, + lastId: null == lastId + ? _value.lastId + : lastId // ignore: cast_nullable_to_non_nullable + as String, + hasMore: null == hasMore + ? _value.hasMore + : hasMore // ignore: cast_nullable_to_non_nullable + as bool, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$ResponseItemListImplCopyWith<$Res> + implements $ResponseItemListCopyWith<$Res> { + factory _$$ResponseItemListImplCopyWith(_$ResponseItemListImpl value, + $Res Function(_$ResponseItemListImpl) then) = + __$$ResponseItemListImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String object, + List> data, + @JsonKey(name: 'first_id') String firstId, + @JsonKey(name: 'last_id') String lastId, + @JsonKey(name: 'has_more') bool hasMore}); +} + +/// @nodoc +class __$$ResponseItemListImplCopyWithImpl<$Res> + extends _$ResponseItemListCopyWithImpl<$Res, _$ResponseItemListImpl> + implements _$$ResponseItemListImplCopyWith<$Res> { + __$$ResponseItemListImplCopyWithImpl(_$ResponseItemListImpl _value, + $Res Function(_$ResponseItemListImpl) _then) + : super(_value, _then); + + /// Create a copy of ResponseItemList + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? object = null, + Object? data = null, + Object? firstId = null, + Object? lastId = null, + Object? hasMore = null, + }) { + return _then(_$ResponseItemListImpl( + object: null == object + ? _value.object + : object // ignore: cast_nullable_to_non_nullable + as String, + data: null == data + ? _value._data + : data // ignore: cast_nullable_to_non_nullable + as List>, + firstId: null == firstId + ? _value.firstId + : firstId // ignore: cast_nullable_to_non_nullable + as String, + lastId: null == lastId + ? _value.lastId + : lastId // ignore: cast_nullable_to_non_nullable + as String, + hasMore: null == hasMore + ? _value.hasMore + : hasMore // ignore: cast_nullable_to_non_nullable + as bool, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ResponseItemListImpl extends _ResponseItemList { + const _$ResponseItemListImpl( + {required this.object, + required final List> data, + @JsonKey(name: 'first_id') required this.firstId, + @JsonKey(name: 'last_id') required this.lastId, + @JsonKey(name: 'has_more') required this.hasMore}) + : _data = data, + super._(); + + factory _$ResponseItemListImpl.fromJson(Map json) => + _$$ResponseItemListImplFromJson(json); + + /// No Description + @override + final String object; + + /// No Description + final List> _data; + + /// No Description + @override + List> get data { + if (_data is EqualUnmodifiableListView) return _data; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_data); + } + + /// No Description + @override + @JsonKey(name: 'first_id') + final String firstId; + + /// No Description + @override + @JsonKey(name: 'last_id') + final String lastId; + + /// No Description + @override + @JsonKey(name: 'has_more') + final bool hasMore; + + @override + String toString() { + return 'ResponseItemList(object: $object, data: $data, firstId: $firstId, lastId: $lastId, hasMore: $hasMore)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ResponseItemListImpl && + (identical(other.object, object) || other.object == object) && + const DeepCollectionEquality().equals(other._data, _data) && + (identical(other.firstId, firstId) || other.firstId == firstId) && + (identical(other.lastId, lastId) || other.lastId == lastId) && + (identical(other.hasMore, hasMore) || other.hasMore == hasMore)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, object, + const DeepCollectionEquality().hash(_data), firstId, lastId, hasMore); + + /// Create a copy of ResponseItemList + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ResponseItemListImplCopyWith<_$ResponseItemListImpl> get copyWith => + __$$ResponseItemListImplCopyWithImpl<_$ResponseItemListImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$ResponseItemListImplToJson( + this, + ); + } +} + +abstract class _ResponseItemList extends ResponseItemList { + const factory _ResponseItemList( + {required final String object, + required final List> data, + @JsonKey(name: 'first_id') required final String firstId, + @JsonKey(name: 'last_id') required final String lastId, + @JsonKey(name: 'has_more') required final bool hasMore}) = + _$ResponseItemListImpl; + const _ResponseItemList._() : super._(); + + factory _ResponseItemList.fromJson(Map json) = + _$ResponseItemListImpl.fromJson; + + /// No Description + @override + String get object; + + /// No Description + @override + List> get data; + + /// No Description + @override + @JsonKey(name: 'first_id') + String get firstId; + + /// No Description + @override + @JsonKey(name: 'last_id') + String get lastId; + + /// No Description + @override + @JsonKey(name: 'has_more') + bool get hasMore; + + /// Create a copy of ResponseItemList + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ResponseItemListImplCopyWith<_$ResponseItemListImpl> get copyWith => + throw _privateConstructorUsedError; +} + ChatCompletionMessage _$ChatCompletionMessageFromJson( Map json) { switch (json['role']) { diff --git a/packages/openai_dart/lib/src/generated/schema/schema.g.dart b/packages/openai_dart/lib/src/generated/schema/schema.g.dart index 68440660..a2a6922b 100644 --- a/packages/openai_dart/lib/src/generated/schema/schema.g.dart +++ b/packages/openai_dart/lib/src/generated/schema/schema.g.dart @@ -5098,6 +5098,130 @@ Map _$$WebSearchLocationImplToJson( if (instance.timezone case final value?) 'timezone': value, }; +_$CreateResponseRequestImpl _$$CreateResponseRequestImplFromJson( + Map json) => + _$CreateResponseRequestImpl( + model: json['model'] as String, + input: + const _CreateResponseRequestInputConverter().fromJson(json['input']), + tools: (json['tools'] as List?) + ?.map((e) => e as Map) + .toList(), + metadata: json['metadata'] as Map?, + stream: json['stream'] as bool?, + temperature: (json['temperature'] as num?)?.toDouble(), + topP: (json['top_p'] as num?)?.toDouble(), + ); + +Map _$$CreateResponseRequestImplToJson( + _$CreateResponseRequestImpl instance) => + { + 'model': instance.model, + 'input': + const _CreateResponseRequestInputConverter().toJson(instance.input), + if (instance.tools case final value?) 'tools': value, + if (instance.metadata case final value?) 'metadata': value, + if (instance.stream case final value?) 'stream': value, + if (instance.temperature case final value?) 'temperature': value, + if (instance.topP case final value?) 'top_p': value, + }; + +_$CreateResponseRequestInputListMapStringDynamicImpl + _$$CreateResponseRequestInputListMapStringDynamicImplFromJson( + Map json) => + _$CreateResponseRequestInputListMapStringDynamicImpl( + (json['value'] as List) + .map((e) => e as Map) + .toList(), + $type: json['runtimeType'] as String?, + ); + +Map + _$$CreateResponseRequestInputListMapStringDynamicImplToJson( + _$CreateResponseRequestInputListMapStringDynamicImpl instance) => + { + 'value': instance.value, + 'runtimeType': instance.$type, + }; + +_$CreateResponseRequestInputStringImpl + _$$CreateResponseRequestInputStringImplFromJson( + Map json) => + _$CreateResponseRequestInputStringImpl( + json['value'] as String, + $type: json['runtimeType'] as String?, + ); + +Map _$$CreateResponseRequestInputStringImplToJson( + _$CreateResponseRequestInputStringImpl instance) => + { + 'value': instance.value, + 'runtimeType': instance.$type, + }; + +_$ResponseImpl _$$ResponseImplFromJson(Map json) => + _$ResponseImpl( + id: json['id'] as String, + object: json['object'] as String, + status: json['status'] as String, + createdAt: (json['created_at'] as num).toInt(), + output: (json['output'] as List) + .map((e) => e as Map) + .toList(), + ); + +Map _$$ResponseImplToJson(_$ResponseImpl instance) => + { + 'id': instance.id, + 'object': instance.object, + 'status': instance.status, + 'created_at': instance.createdAt, + 'output': instance.output, + }; + +_$DeleteResponseResponseImpl _$$DeleteResponseResponseImplFromJson( + Map json) => + _$DeleteResponseResponseImpl( + id: json['id'] as String, + object: + $enumDecode(_$DeleteResponseResponseObjectEnumMap, json['object']), + deleted: json['deleted'] as bool, + ); + +Map _$$DeleteResponseResponseImplToJson( + _$DeleteResponseResponseImpl instance) => + { + 'id': instance.id, + 'object': _$DeleteResponseResponseObjectEnumMap[instance.object]!, + 'deleted': instance.deleted, + }; + +const _$DeleteResponseResponseObjectEnumMap = { + DeleteResponseResponseObject.response: 'response', +}; + +_$ResponseItemListImpl _$$ResponseItemListImplFromJson( + Map json) => + _$ResponseItemListImpl( + object: json['object'] as String, + data: (json['data'] as List) + .map((e) => e as Map) + .toList(), + firstId: json['first_id'] as String, + lastId: json['last_id'] as String, + hasMore: json['has_more'] as bool, + ); + +Map _$$ResponseItemListImplToJson( + _$ResponseItemListImpl instance) => + { + 'object': instance.object, + 'data': instance.data, + 'first_id': instance.firstId, + 'last_id': instance.lastId, + 'has_more': instance.hasMore, + }; + _$ChatCompletionDeveloperMessageImpl _$$ChatCompletionDeveloperMessageImplFromJson(Map json) => _$ChatCompletionDeveloperMessageImpl( diff --git a/packages/openai_dart/oas/openapi_curated.yaml b/packages/openai_dart/oas/openapi_curated.yaml index b64b192a..c972dafb 100644 --- a/packages/openai_dart/oas/openapi_curated.yaml +++ b/packages/openai_dart/oas/openapi_curated.yaml @@ -35,6 +35,8 @@ tags: 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: Responses + description: Generate model responses with text or image inputs and extend capabilities with tools. paths: /chat/completions: @@ -442,6 +444,7 @@ paths: application/json: schema: $ref: "#/components/schemas/CreateModerationResponse" + /assistants: get: operationId: listAssistants @@ -1619,7 +1622,7 @@ paths: - Batch summary: Cancel batch description: | - Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing + 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 @@ -1635,6 +1638,153 @@ paths: application/json: schema: $ref: '#/components/schemas/Batch' + + /responses: + post: + operationId: createResponse + tags: + - Responses + summary: Create response + description: Creates a model response. + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CreateResponseRequest" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Response" + + /responses/{response_id}: + get: + operationId: getResponse + tags: + - Responses + summary: Retrieve response + description: Retrieves a model response. + parameters: + - in: path + name: response_id + required: true + schema: + type: string + description: The ID of the response to retrieve. + - name: include + in: query + required: false + schema: + type: array + items: + type: string + description: Additional fields to include in the response. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Response" + delete: + operationId: deleteResponse + tags: + - Responses + summary: Delete response + description: Deletes a model response. + parameters: + - in: path + name: response_id + required: true + schema: + type: string + description: The ID of the response to delete. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/DeleteResponseResponse" + + /responses/{response_id}/cancel: + post: + operationId: cancelResponse + tags: + - Responses + summary: Cancel response + description: Cancels a model response. + parameters: + - in: path + name: response_id + required: true + schema: + type: string + description: The ID of the response to cancel. + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Response" + + /responses/{response_id}/input_items: + get: + operationId: listResponseInputItems + tags: + - Responses + summary: List input items + description: Returns a list of input items for a response. + parameters: + - in: path + name: response_id + required: true + schema: + type: string + description: The ID of the response to retrieve input items for. + - name: limit + in: query + description: *pagination_limit_param_description + required: false + schema: + type: integer + default: 20 + - name: order + in: query + description: *pagination_order_param_description + schema: + type: string + default: desc + enum: [ "asc", "desc" ] + - name: after + in: query + description: *pagination_after_param_description + schema: + type: string + - name: before + in: query + description: *pagination_before_param_description + schema: + type: string + - name: include + in: query + required: false + description: Additional fields to include in the response. + schema: + type: array + items: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/ResponseItemList" components: securitySchemes: @@ -7662,5 +7812,115 @@ components: description: | The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`. + # ============================ + # Responses API schemas + # ============================ + CreateResponseRequest: + type: object + description: Request object for the Create response endpoint. + properties: + model: + type: string + description: The ID of the model to use. + input: + description: Text or items to generate a response for. + anyOf: + - type: string + - type: array + items: + type: object + additionalProperties: true + tools: + type: array + nullable: true + items: + type: object + additionalProperties: true + metadata: + type: object + nullable: true + additionalProperties: true + stream: + type: boolean + nullable: true + temperature: + type: number + nullable: true + top_p: + type: number + nullable: true + required: + - model + - input + + Response: + type: object + description: Model response. + properties: + id: + type: string + object: + type: string + status: + type: string + created_at: + type: integer + output: + type: array + items: + type: object + additionalProperties: true + required: + - id + - object + - status + - created_at + - output + + DeleteResponseResponse: + type: object + description: Represents a deleted response. + properties: + id: + type: string + object: + type: string + enum: [ response ] + deleted: + type: boolean + required: + - id + - object + - deleted + + ResponseItemList: + type: object + description: List of input items returned by the List input items endpoint. + properties: + object: + type: string + data: + type: array + items: + type: object + additionalProperties: true + first_id: + type: string + last_id: + type: string + has_more: + type: boolean + required: + - object + - data + - first_id + - last_id + - has_more + + ResponseStreamEvent: + type: object + description: Represents a streamed event for a response. + additionalProperties: true + security: - ApiKeyAuth: [ ] diff --git a/packages/openai_dart/test/openai_client_responses_test.dart b/packages/openai_dart/test/openai_client_responses_test.dart new file mode 100644 index 00000000..31c6eb4a --- /dev/null +++ b/packages/openai_dart/test/openai_client_responses_test.dart @@ -0,0 +1,35 @@ +@TestOn('vm') +library; // Uses dart:io + +import 'dart:io'; + +import 'package:openai_dart/openai_dart.dart'; +import 'package:test/test.dart'; + +void main() { + group('OpenAI Responses API tests', () { + late OpenAIClient client; + + setUp(() { + client = OpenAIClient( + apiKey: Platform.environment['OPENAI_API_KEY'], + ); + }); + + tearDown(() { + client.endSession(); + }); + + test('Test create and retrieve response', () async { + final request = CreateResponseRequest( + model: 'gpt-4o', + input: const CreateResponseRequestInput.string('Hello'), + ); + final response = await client.createResponse(request: request); + expect(response.id, isNotEmpty); + + final retrieved = await client.getResponse(responseId: response.id); + expect(retrieved.id, response.id); + }); + }); +}