Skip to content

Commit

Permalink
feat: make enums not nominal (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Aug 2, 2024
1 parent f085893 commit 9f77005
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 46 deletions.
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

0 comments on commit 9f77005

Please sign in to comment.