Skip to content

Commit

Permalink
fix: Rename CreateRunRequestModel factories names (#429)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmigloz authored May 20, 2024
1 parent 75b9564 commit fd15793
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,12 @@ sealed class CreateRunRequestModel with _$CreateRunRequestModel {
const CreateRunRequestModel._();

/// Available models. Mind that the list may not be exhaustive nor up-to-date.
const factory CreateRunRequestModel.enumeration(
const factory CreateRunRequestModel.model(
RunModels value,
) = CreateRunRequestModelEnumeration;

/// The ID of the model to use for this request.
const factory CreateRunRequestModel.string(
const factory CreateRunRequestModel.modelId(
String value,
) = CreateRunRequestModelString;

Expand Down
119 changes: 58 additions & 61 deletions packages/openai_dart/lib/src/generated/schema/schema.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30240,9 +30240,9 @@ abstract class _CreateRunRequest extends CreateRunRequest {
CreateRunRequestModel _$CreateRunRequestModelFromJson(
Map<String, dynamic> json) {
switch (json['runtimeType']) {
case 'enumeration':
case 'model':
return CreateRunRequestModelEnumeration.fromJson(json);
case 'string':
case 'modelId':
return CreateRunRequestModelString.fromJson(json);

default:
Expand All @@ -30259,40 +30259,39 @@ mixin _$CreateRunRequestModel {
Object get value => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(RunModels value) enumeration,
required TResult Function(String value) string,
required TResult Function(RunModels value) model,
required TResult Function(String value) modelId,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(RunModels value)? enumeration,
TResult? Function(String value)? string,
TResult? Function(RunModels value)? model,
TResult? Function(String value)? modelId,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(RunModels value)? enumeration,
TResult Function(String value)? string,
TResult Function(RunModels value)? model,
TResult Function(String value)? modelId,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(CreateRunRequestModelEnumeration value)
enumeration,
required TResult Function(CreateRunRequestModelString value) string,
required TResult Function(CreateRunRequestModelEnumeration value) model,
required TResult Function(CreateRunRequestModelString value) modelId,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(CreateRunRequestModelEnumeration value)? enumeration,
TResult? Function(CreateRunRequestModelString value)? string,
TResult? Function(CreateRunRequestModelEnumeration value)? model,
TResult? Function(CreateRunRequestModelString value)? modelId,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(CreateRunRequestModelEnumeration value)? enumeration,
TResult Function(CreateRunRequestModelString value)? string,
TResult Function(CreateRunRequestModelEnumeration value)? model,
TResult Function(CreateRunRequestModelString value)? modelId,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
Expand Down Expand Up @@ -30358,7 +30357,7 @@ class _$CreateRunRequestModelEnumerationImpl
extends CreateRunRequestModelEnumeration {
const _$CreateRunRequestModelEnumerationImpl(this.value,
{final String? $type})
: $type = $type ?? 'enumeration',
: $type = $type ?? 'model',
super._();

factory _$CreateRunRequestModelEnumerationImpl.fromJson(
Expand All @@ -30373,7 +30372,7 @@ class _$CreateRunRequestModelEnumerationImpl

@override
String toString() {
return 'CreateRunRequestModel.enumeration(value: $value)';
return 'CreateRunRequestModel.model(value: $value)';
}

@override
Expand All @@ -30399,62 +30398,61 @@ class _$CreateRunRequestModelEnumerationImpl
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(RunModels value) enumeration,
required TResult Function(String value) string,
required TResult Function(RunModels value) model,
required TResult Function(String value) modelId,
}) {
return enumeration(value);
return model(value);
}

@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(RunModels value)? enumeration,
TResult? Function(String value)? string,
TResult? Function(RunModels value)? model,
TResult? Function(String value)? modelId,
}) {
return enumeration?.call(value);
return model?.call(value);
}

@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(RunModels value)? enumeration,
TResult Function(String value)? string,
TResult Function(RunModels value)? model,
TResult Function(String value)? modelId,
required TResult orElse(),
}) {
if (enumeration != null) {
return enumeration(value);
if (model != null) {
return model(value);
}
return orElse();
}

@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(CreateRunRequestModelEnumeration value)
enumeration,
required TResult Function(CreateRunRequestModelString value) string,
required TResult Function(CreateRunRequestModelEnumeration value) model,
required TResult Function(CreateRunRequestModelString value) modelId,
}) {
return enumeration(this);
return model(this);
}

@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(CreateRunRequestModelEnumeration value)? enumeration,
TResult? Function(CreateRunRequestModelString value)? string,
TResult? Function(CreateRunRequestModelEnumeration value)? model,
TResult? Function(CreateRunRequestModelString value)? modelId,
}) {
return enumeration?.call(this);
return model?.call(this);
}

@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(CreateRunRequestModelEnumeration value)? enumeration,
TResult Function(CreateRunRequestModelString value)? string,
TResult Function(CreateRunRequestModelEnumeration value)? model,
TResult Function(CreateRunRequestModelString value)? modelId,
required TResult orElse(),
}) {
if (enumeration != null) {
return enumeration(this);
if (model != null) {
return model(this);
}
return orElse();
}
Expand Down Expand Up @@ -30521,7 +30519,7 @@ class __$$CreateRunRequestModelStringImplCopyWithImpl<$Res>
@JsonSerializable()
class _$CreateRunRequestModelStringImpl extends CreateRunRequestModelString {
const _$CreateRunRequestModelStringImpl(this.value, {final String? $type})
: $type = $type ?? 'string',
: $type = $type ?? 'modelId',
super._();

factory _$CreateRunRequestModelStringImpl.fromJson(
Expand All @@ -30536,7 +30534,7 @@ class _$CreateRunRequestModelStringImpl extends CreateRunRequestModelString {

@override
String toString() {
return 'CreateRunRequestModel.string(value: $value)';
return 'CreateRunRequestModel.modelId(value: $value)';
}

@override
Expand All @@ -30561,62 +30559,61 @@ class _$CreateRunRequestModelStringImpl extends CreateRunRequestModelString {
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(RunModels value) enumeration,
required TResult Function(String value) string,
required TResult Function(RunModels value) model,
required TResult Function(String value) modelId,
}) {
return string(value);
return modelId(value);
}

@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(RunModels value)? enumeration,
TResult? Function(String value)? string,
TResult? Function(RunModels value)? model,
TResult? Function(String value)? modelId,
}) {
return string?.call(value);
return modelId?.call(value);
}

@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(RunModels value)? enumeration,
TResult Function(String value)? string,
TResult Function(RunModels value)? model,
TResult Function(String value)? modelId,
required TResult orElse(),
}) {
if (string != null) {
return string(value);
if (modelId != null) {
return modelId(value);
}
return orElse();
}

@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(CreateRunRequestModelEnumeration value)
enumeration,
required TResult Function(CreateRunRequestModelString value) string,
required TResult Function(CreateRunRequestModelEnumeration value) model,
required TResult Function(CreateRunRequestModelString value) modelId,
}) {
return string(this);
return modelId(this);
}

@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(CreateRunRequestModelEnumeration value)? enumeration,
TResult? Function(CreateRunRequestModelString value)? string,
TResult? Function(CreateRunRequestModelEnumeration value)? model,
TResult? Function(CreateRunRequestModelString value)? modelId,
}) {
return string?.call(this);
return modelId?.call(this);
}

@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(CreateRunRequestModelEnumeration value)? enumeration,
TResult Function(CreateRunRequestModelString value)? string,
TResult Function(CreateRunRequestModelEnumeration value)? model,
TResult Function(CreateRunRequestModelString value)? modelId,
required TResult orElse(),
}) {
if (string != null) {
return string(this);
if (modelId != null) {
return modelId(this);
}
return orElse();
}
Expand Down
74 changes: 38 additions & 36 deletions packages/openai_dart/oas/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,53 +77,55 @@ String? _onSchemaUnionFactoryName(
// Assistant
'AssistantModelEnumeration' => 'model',
'AssistantModelString' => 'modelId',
'CreateAssistantRequestResponseFormatAssistantsResponseFormat' =>
'format',
'CreateAssistantRequestResponseFormatEnumeration' => 'mode',
'CreateMessageRequestContentListMessageContent' => 'parts',
'CreateMessageRequestContentString' => 'text',
'CreateRunRequestModelEnumeration' => 'model',
'CreateRunRequestModelString' => 'modelId',
'CreateRunRequestResponseFormatAssistantsResponseFormat' => 'format',
'CreateRunRequestResponseFormatEnumeration' => 'mode',
'CreateRunRequestToolChoiceAssistantsNamedToolChoice' => 'tool',
'CreateRunRequestToolChoiceEnumeration' => 'mode',
'CreateThreadAndRunRequestResponseFormatAssistantsResponseFormat' =>
'format',
'CreateThreadAndRunRequestResponseFormatEnumeration' => 'mode',
'CreateThreadAndRunRequestToolChoiceAssistantsNamedToolChoice' => 'tool',
'CreateThreadAndRunRequestToolChoiceEnumeration' => 'mode',
'MessageContentImageFileObject' => 'imageFile',
'MessageDeltaContentImageFileObject' => 'imageFile',
'MessageContentTextObject' => 'text',
'MessageDeltaContentTextObject' => 'text',
'MessageContentImageUrlObject' => 'imageUrl',
'MessageContentTextAnnotationsFileCitationObject' => 'fileCitation',
'MessageDeltaContentTextAnnotationsFileCitationObject' => 'fileCitation',
'MessageContentTextAnnotationsFilePathObject' => 'filePath',
'MessageContentTextObject' => 'text',
'MessageDeltaContentImageFileObject' => 'imageFile',
'MessageDeltaContentTextAnnotationsFileCitationObject' => 'fileCitation',
'MessageDeltaContentTextAnnotationsFilePathObject' => 'filePath',
'MessageDeltaContentTextObject' => 'text',
'ModifyAssistantRequestResponseFormatAssistantsResponseFormat' =>
'format',
'ModifyAssistantRequestResponseFormatEnumeration' => 'mode',
'RunModelEnumeration' => 'model',
'RunModelString' => 'modelId',
'ThreadAndRunModelEnumeration' => 'model',
'ThreadAndRunModelString' => 'modelId',
'RunStepDetailsToolCallsCodeObject' => 'codeInterpreter',
'RunObjectResponseFormatAssistantsResponseFormat' => 'format',
'RunObjectResponseFormatEnumeration' => 'mode',
'RunObjectToolChoiceAssistantsNamedToolChoice' => 'tool',
'RunObjectToolChoiceEnumeration' => 'mode',
'RunStepDeltaStepDetailsMessageCreationObject' => 'messageCreation',
'RunStepDeltaStepDetailsToolCallsCodeObject' => 'codeInterpreter',
'RunStepDetailsToolCallsFileSearchObject' => 'fileSearch',
'RunStepDeltaStepDetailsToolCallsCodeOutputImageObject' => 'image',
'RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject' => 'logs',
'RunStepDeltaStepDetailsToolCallsFileSearchObject' => 'fileSearch',
'RunStepDetailsToolCallsFunctionObject' => 'function',
'RunStepDeltaStepDetailsToolCallsFunctionObject' => 'function',
'RunStepDetailsToolCallsCodeOutputLogsObject' => 'logs',
'RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject' => 'logs',
'RunStepDetailsToolCallsCodeOutputImageObject' => 'image',
'RunStepDeltaStepDetailsToolCallsCodeOutputImageObject' => 'image',
'RunStepDeltaStepDetailsToolCallsObject' => 'toolCalls',
'RunStepDetailsMessageCreationObject' => 'messageCreation',
'RunStepDeltaStepDetailsMessageCreationObject' => 'messageCreation',
'RunStepDetailsToolCallsCodeObject' => 'codeInterpreter',
'RunStepDetailsToolCallsCodeOutputImageObject' => 'image',
'RunStepDetailsToolCallsCodeOutputLogsObject' => 'logs',
'RunStepDetailsToolCallsFileSearchObject' => 'fileSearch',
'RunStepDetailsToolCallsFunctionObject' => 'function',
'RunStepDetailsToolCallsObject' => 'toolCalls',
'RunStepDeltaStepDetailsToolCallsObject' => 'toolCalls',
'CreateRunRequestResponseFormatEnumeration' => 'mode',
'CreateThreadAndRunRequestResponseFormatEnumeration' => 'mode',
'RunObjectResponseFormatEnumeration' => 'mode',
'CreateAssistantRequestResponseFormatEnumeration' => 'mode',
'ModifyAssistantRequestResponseFormatEnumeration' => 'mode',
'CreateRunRequestResponseFormatAssistantsResponseFormat' => 'format',
'CreateThreadAndRunRequestResponseFormatAssistantsResponseFormat' =>
'format',
'RunObjectResponseFormatAssistantsResponseFormat' => 'format',
'CreateAssistantRequestResponseFormatAssistantsResponseFormat' =>
'format',
'ModifyAssistantRequestResponseFormatAssistantsResponseFormat' =>
'format',
'CreateRunRequestToolChoiceEnumeration' => 'mode',
'CreateThreadAndRunRequestToolChoiceEnumeration' => 'mode',
'RunObjectToolChoiceEnumeration' => 'mode',
'CreateRunRequestToolChoiceAssistantsNamedToolChoice' => 'tool',
'CreateThreadAndRunRequestToolChoiceAssistantsNamedToolChoice' => 'tool',
'RunObjectToolChoiceAssistantsNamedToolChoice' => 'tool',
'CreateMessageRequestContentString' => 'text',
'CreateMessageRequestContentListMessageContent' => 'parts',
'ThreadAndRunModelEnumeration' => 'model',
'ThreadAndRunModelString' => 'modelId',
_ => null,
};
Loading

0 comments on commit fd15793

Please sign in to comment.