Skip to content

Commit a559359

Browse files
feat: make enums not nominal (#4)
1 parent 4b90869 commit a559359

File tree

6 files changed

+6
-46
lines changed

6 files changed

+6
-46
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 68
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-77cfff37114bc9f141c7e6107eb5f1b38d8cc99bc3d4ce03a066db2b6b649c69.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-b04761ffd2adad3cc19a6dc6fc696ac445878219972f891881a967340fa9a6b0.yml

audio.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,8 @@ func NewAudioService(opts ...option.RequestOption) (r *AudioService) {
3131
return
3232
}
3333

34-
type AudioModel string
34+
type AudioModel = string
3535

3636
const (
3737
AudioModelWhisper1 AudioModel = "whisper-1"
3838
)
39-
40-
func (r AudioModel) IsKnown() bool {
41-
switch r {
42-
case AudioModelWhisper1:
43-
return true
44-
}
45-
return false
46-
}

audiospeech.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,13 @@ func (r *AudioSpeechService) New(ctx context.Context, body AudioSpeechNewParams,
4040
return
4141
}
4242

43-
type SpeechModel string
43+
type SpeechModel = string
4444

4545
const (
4646
SpeechModelTTS1 SpeechModel = "tts-1"
4747
SpeechModelTTS1HD SpeechModel = "tts-1-hd"
4848
)
4949

50-
func (r SpeechModel) IsKnown() bool {
51-
switch r {
52-
case SpeechModelTTS1, SpeechModelTTS1HD:
53-
return true
54-
}
55-
return false
56-
}
57-
5850
type AudioSpeechNewParams struct {
5951
// The text to generate audio for. The maximum length is 4096 characters.
6052
Input param.Field[string] `json:"input,required"`

chat.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func NewChatService(opts ...option.RequestOption) (r *ChatService) {
2727
return
2828
}
2929

30-
type ChatModel string
30+
type ChatModel = string
3131

3232
const (
3333
ChatModelGPT4o ChatModel = "gpt-4o"
@@ -54,11 +54,3 @@ const (
5454
ChatModelGPT3_5Turbo0125 ChatModel = "gpt-3.5-turbo-0125"
5555
ChatModelGPT3_5Turbo16k0613 ChatModel = "gpt-3.5-turbo-16k-0613"
5656
)
57-
58-
func (r ChatModel) IsKnown() bool {
59-
switch r {
60-
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:
61-
return true
62-
}
63-
return false
64-
}

image.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,13 @@ func (r imageJSON) RawJSON() string {
8989
return r.raw
9090
}
9191

92-
type ImageModel string
92+
type ImageModel = string
9393

9494
const (
9595
ImageModelDallE2 ImageModel = "dall-e-2"
9696
ImageModelDallE3 ImageModel = "dall-e-3"
9797
)
9898

99-
func (r ImageModel) IsKnown() bool {
100-
switch r {
101-
case ImageModelDallE2, ImageModelDallE3:
102-
return true
103-
}
104-
return false
105-
}
106-
10799
type ImagesResponse struct {
108100
Created int64 `json:"created,required"`
109101
Data []Image `json:"data,required"`

moderation.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -185,21 +185,13 @@ func (r moderationCategoryScoresJSON) RawJSON() string {
185185
return r.raw
186186
}
187187

188-
type ModerationModel string
188+
type ModerationModel = string
189189

190190
const (
191191
ModerationModelTextModerationLatest ModerationModel = "text-moderation-latest"
192192
ModerationModelTextModerationStable ModerationModel = "text-moderation-stable"
193193
)
194194

195-
func (r ModerationModel) IsKnown() bool {
196-
switch r {
197-
case ModerationModelTextModerationLatest, ModerationModelTextModerationStable:
198-
return true
199-
}
200-
return false
201-
}
202-
203195
// Represents if a given text input is potentially harmful.
204196
type ModerationNewResponse struct {
205197
// The unique identifier for the moderation request.

0 commit comments

Comments
 (0)