Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make enums not nominal #4

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 68
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-77cfff37114bc9f141c7e6107eb5f1b38d8cc99bc3d4ce03a066db2b6b649c69.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-b04761ffd2adad3cc19a6dc6fc696ac445878219972f891881a967340fa9a6b0.yml
10 changes: 1 addition & 9 deletions audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,8 @@ func NewAudioService(opts ...option.RequestOption) (r *AudioService) {
return
}

type AudioModel string
type AudioModel = string

const (
AudioModelWhisper1 AudioModel = "whisper-1"
)

func (r AudioModel) IsKnown() bool {
switch r {
case AudioModelWhisper1:
return true
}
return false
}
10 changes: 1 addition & 9 deletions audiospeech.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,13 @@ func (r *AudioSpeechService) New(ctx context.Context, body AudioSpeechNewParams,
return
}

type SpeechModel string
type SpeechModel = string

const (
SpeechModelTTS1 SpeechModel = "tts-1"
SpeechModelTTS1HD SpeechModel = "tts-1-hd"
)

func (r SpeechModel) IsKnown() bool {
switch r {
case SpeechModelTTS1, SpeechModelTTS1HD:
return true
}
return false
}

type AudioSpeechNewParams struct {
// The text to generate audio for. The maximum length is 4096 characters.
Input param.Field[string] `json:"input,required"`
Expand Down
10 changes: 1 addition & 9 deletions chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func NewChatService(opts ...option.RequestOption) (r *ChatService) {
return
}

type ChatModel string
type ChatModel = string

const (
ChatModelGPT4o ChatModel = "gpt-4o"
Expand All @@ -54,11 +54,3 @@ const (
ChatModelGPT3_5Turbo0125 ChatModel = "gpt-3.5-turbo-0125"
ChatModelGPT3_5Turbo16k0613 ChatModel = "gpt-3.5-turbo-16k-0613"
)

func (r ChatModel) IsKnown() bool {
switch r {
case ChatModelGPT4o, ChatModelGPT4o2024_05_13, ChatModelGPT4oMini, ChatModelGPT4oMini2024_07_18, ChatModelGPT4Turbo, ChatModelGPT4Turbo2024_04_09, ChatModelGPT4_0125Preview, ChatModelGPT4TurboPreview, ChatModelGPT4_1106Preview, ChatModelGPT4VisionPreview, ChatModelGPT4, ChatModelGPT4_0314, ChatModelGPT4_0613, ChatModelGPT4_32k, ChatModelGPT4_32k0314, ChatModelGPT4_32k0613, ChatModelGPT3_5Turbo, ChatModelGPT3_5Turbo16k, ChatModelGPT3_5Turbo0301, ChatModelGPT3_5Turbo0613, ChatModelGPT3_5Turbo1106, ChatModelGPT3_5Turbo0125, ChatModelGPT3_5Turbo16k0613:
return true
}
return false
}
10 changes: 1 addition & 9 deletions image.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,13 @@ func (r imageJSON) RawJSON() string {
return r.raw
}

type ImageModel string
type ImageModel = string

const (
ImageModelDallE2 ImageModel = "dall-e-2"
ImageModelDallE3 ImageModel = "dall-e-3"
)

func (r ImageModel) IsKnown() bool {
switch r {
case ImageModelDallE2, ImageModelDallE3:
return true
}
return false
}

type ImagesResponse struct {
Created int64 `json:"created,required"`
Data []Image `json:"data,required"`
Expand Down
10 changes: 1 addition & 9 deletions moderation.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,21 +185,13 @@ func (r moderationCategoryScoresJSON) RawJSON() string {
return r.raw
}

type ModerationModel string
type ModerationModel = string

const (
ModerationModelTextModerationLatest ModerationModel = "text-moderation-latest"
ModerationModelTextModerationStable ModerationModel = "text-moderation-stable"
)

func (r ModerationModel) IsKnown() bool {
switch r {
case ModerationModelTextModerationLatest, ModerationModelTextModerationStable:
return true
}
return false
}

// Represents if a given text input is potentially harmful.
type ModerationNewResponse struct {
// The unique identifier for the moderation request.
Expand Down