diff --git a/api.md b/api.md
index 6ee3cc5..6b26f16 100644
--- a/api.md
+++ b/api.md
@@ -87,6 +87,10 @@ Methods:
# Images
+Params Types:
+
+- openai.ImageModel
+
Response Types:
- openai.Image
@@ -100,6 +104,10 @@ Methods:
# Audio
+Params Types:
+
+- openai.AudioModel
+
## Transcriptions
Response Types:
@@ -122,12 +130,20 @@ Methods:
## Speech
+Params Types:
+
+- openai.SpeechModel
+
Methods:
- client.Audio.Speech.New(ctx context.Context, body openai.AudioSpeechNewParams) (http.Response, error)
# Moderations
+Params Types:
+
+- openai.ModerationModel
+
Response Types:
- openai.Moderation
diff --git a/audio.go b/audio.go
index 9ea966d..3828a8b 100644
--- a/audio.go
+++ b/audio.go
@@ -30,3 +30,17 @@ func NewAudioService(opts ...option.RequestOption) (r *AudioService) {
r.Speech = NewAudioSpeechService(opts...)
return
}
+
+type AudioModel string
+
+const (
+ AudioModelWhisper1 AudioModel = "whisper-1"
+)
+
+func (r AudioModel) IsKnown() bool {
+ switch r {
+ case AudioModelWhisper1:
+ return true
+ }
+ return false
+}
diff --git a/audiospeech.go b/audiospeech.go
index 1412ea1..2f97f16 100644
--- a/audiospeech.go
+++ b/audiospeech.go
@@ -40,12 +40,27 @@ func (r *AudioSpeechService) New(ctx context.Context, body AudioSpeechNewParams,
return
}
+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"`
// One of the available [TTS models](https://platform.openai.com/docs/models/tts):
// `tts-1` or `tts-1-hd`
- Model param.Field[AudioSpeechNewParamsModel] `json:"model,required"`
+ Model param.Field[SpeechModel] `json:"model,required"`
// The voice to use when generating the audio. Supported voices are `alloy`,
// `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of the voices are
// available in the
@@ -63,21 +78,6 @@ func (r AudioSpeechNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
-type AudioSpeechNewParamsModel string
-
-const (
- AudioSpeechNewParamsModelTTS1 AudioSpeechNewParamsModel = "tts-1"
- AudioSpeechNewParamsModelTTS1HD AudioSpeechNewParamsModel = "tts-1-hd"
-)
-
-func (r AudioSpeechNewParamsModel) IsKnown() bool {
- switch r {
- case AudioSpeechNewParamsModelTTS1, AudioSpeechNewParamsModelTTS1HD:
- return true
- }
- return false
-}
-
// The voice to use when generating the audio. Supported voices are `alloy`,
// `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of the voices are
// available in the
diff --git a/audiospeech_test.go b/audiospeech_test.go
index 14f334a..4672869 100644
--- a/audiospeech_test.go
+++ b/audiospeech_test.go
@@ -28,7 +28,7 @@ func TestAudioSpeechNewWithOptionalParams(t *testing.T) {
)
resp, err := client.Audio.Speech.New(context.TODO(), openai.AudioSpeechNewParams{
Input: openai.F("input"),
- Model: openai.F(openai.AudioSpeechNewParamsModelTTS1),
+ Model: openai.F(openai.SpeechModelTTS1),
Voice: openai.F(openai.AudioSpeechNewParamsVoiceAlloy),
ResponseFormat: openai.F(openai.AudioSpeechNewParamsResponseFormatMP3),
Speed: openai.F(0.250000),
diff --git a/audiotranscription.go b/audiotranscription.go
index df5f27e..3acabe7 100644
--- a/audiotranscription.go
+++ b/audiotranscription.go
@@ -72,7 +72,7 @@ type AudioTranscriptionNewParams struct {
File param.Field[io.Reader] `json:"file,required" format:"binary"`
// ID of the model to use. Only `whisper-1` (which is powered by our open source
// Whisper V2 model) is currently available.
- Model param.Field[AudioTranscriptionNewParamsModel] `json:"model,required"`
+ Model param.Field[AudioModel] `json:"model,required"`
// The language of the input audio. Supplying the input language in
// [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will
// improve accuracy and latency.
@@ -114,20 +114,6 @@ func (r AudioTranscriptionNewParams) MarshalMultipart() (data []byte, contentTyp
return buf.Bytes(), writer.FormDataContentType(), nil
}
-type AudioTranscriptionNewParamsModel string
-
-const (
- AudioTranscriptionNewParamsModelWhisper1 AudioTranscriptionNewParamsModel = "whisper-1"
-)
-
-func (r AudioTranscriptionNewParamsModel) IsKnown() bool {
- switch r {
- case AudioTranscriptionNewParamsModelWhisper1:
- return true
- }
- return false
-}
-
// The format of the transcript output, in one of these options: `json`, `text`,
// `srt`, `verbose_json`, or `vtt`.
type AudioTranscriptionNewParamsResponseFormat string
diff --git a/audiotranscription_test.go b/audiotranscription_test.go
index 55ebbc5..9411fdc 100644
--- a/audiotranscription_test.go
+++ b/audiotranscription_test.go
@@ -29,7 +29,7 @@ func TestAudioTranscriptionNewWithOptionalParams(t *testing.T) {
)
_, err := client.Audio.Transcriptions.New(context.TODO(), openai.AudioTranscriptionNewParams{
File: openai.F(io.Reader(bytes.NewBuffer([]byte("some file contents")))),
- Model: openai.F(openai.AudioTranscriptionNewParamsModelWhisper1),
+ Model: openai.F(openai.AudioModelWhisper1),
Language: openai.F("language"),
Prompt: openai.F("prompt"),
ResponseFormat: openai.F(openai.AudioTranscriptionNewParamsResponseFormatJSON),
diff --git a/audiotranslation.go b/audiotranslation.go
index b50733c..4c81eb1 100644
--- a/audiotranslation.go
+++ b/audiotranslation.go
@@ -69,7 +69,7 @@ type AudioTranslationNewParams struct {
File param.Field[io.Reader] `json:"file,required" format:"binary"`
// ID of the model to use. Only `whisper-1` (which is powered by our open source
// Whisper V2 model) is currently available.
- Model param.Field[AudioTranslationNewParamsModel] `json:"model,required"`
+ Model param.Field[AudioModel] `json:"model,required"`
// An optional text to guide the model's style or continue a previous audio
// segment. The
// [prompt](https://platform.openai.com/docs/guides/speech-to-text/prompting)
@@ -100,17 +100,3 @@ func (r AudioTranslationNewParams) MarshalMultipart() (data []byte, contentType
}
return buf.Bytes(), writer.FormDataContentType(), nil
}
-
-type AudioTranslationNewParamsModel string
-
-const (
- AudioTranslationNewParamsModelWhisper1 AudioTranslationNewParamsModel = "whisper-1"
-)
-
-func (r AudioTranslationNewParamsModel) IsKnown() bool {
- switch r {
- case AudioTranslationNewParamsModelWhisper1:
- return true
- }
- return false
-}
diff --git a/audiotranslation_test.go b/audiotranslation_test.go
index e5634aa..db9681d 100644
--- a/audiotranslation_test.go
+++ b/audiotranslation_test.go
@@ -29,7 +29,7 @@ func TestAudioTranslationNewWithOptionalParams(t *testing.T) {
)
_, err := client.Audio.Translations.New(context.TODO(), openai.AudioTranslationNewParams{
File: openai.F(io.Reader(bytes.NewBuffer([]byte("some file contents")))),
- Model: openai.F(openai.AudioTranslationNewParamsModelWhisper1),
+ Model: openai.F(openai.AudioModelWhisper1),
Prompt: openai.F("prompt"),
ResponseFormat: openai.F("response_format"),
Temperature: openai.F(0.000000),
diff --git a/betaassistant.go b/betaassistant.go
index f6a4b76..6ac3c1c 100644
--- a/betaassistant.go
+++ b/betaassistant.go
@@ -1988,7 +1988,7 @@ type BetaAssistantNewParams struct {
// see all of your available models, or see our
// [Model overview](https://platform.openai.com/docs/models/overview) for
// descriptions of them.
- Model param.Field[BetaAssistantNewParamsModel] `json:"model,required"`
+ Model param.Field[ChatModel] `json:"model,required"`
// The description of the assistant. The maximum length is 512 characters.
Description param.Field[string] `json:"description"`
// The system instructions that the assistant uses. The maximum length is 256,000
@@ -2042,41 +2042,6 @@ func (r BetaAssistantNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
-type BetaAssistantNewParamsModel string
-
-const (
- BetaAssistantNewParamsModelGPT4o BetaAssistantNewParamsModel = "gpt-4o"
- BetaAssistantNewParamsModelGPT4o2024_05_13 BetaAssistantNewParamsModel = "gpt-4o-2024-05-13"
- BetaAssistantNewParamsModelGPT4oMini BetaAssistantNewParamsModel = "gpt-4o-mini"
- BetaAssistantNewParamsModelGPT4oMini2024_07_18 BetaAssistantNewParamsModel = "gpt-4o-mini-2024-07-18"
- BetaAssistantNewParamsModelGPT4Turbo BetaAssistantNewParamsModel = "gpt-4-turbo"
- BetaAssistantNewParamsModelGPT4Turbo2024_04_09 BetaAssistantNewParamsModel = "gpt-4-turbo-2024-04-09"
- BetaAssistantNewParamsModelGPT4_0125Preview BetaAssistantNewParamsModel = "gpt-4-0125-preview"
- BetaAssistantNewParamsModelGPT4TurboPreview BetaAssistantNewParamsModel = "gpt-4-turbo-preview"
- BetaAssistantNewParamsModelGPT4_1106Preview BetaAssistantNewParamsModel = "gpt-4-1106-preview"
- BetaAssistantNewParamsModelGPT4VisionPreview BetaAssistantNewParamsModel = "gpt-4-vision-preview"
- BetaAssistantNewParamsModelGPT4 BetaAssistantNewParamsModel = "gpt-4"
- BetaAssistantNewParamsModelGPT4_0314 BetaAssistantNewParamsModel = "gpt-4-0314"
- BetaAssistantNewParamsModelGPT4_0613 BetaAssistantNewParamsModel = "gpt-4-0613"
- BetaAssistantNewParamsModelGPT4_32k BetaAssistantNewParamsModel = "gpt-4-32k"
- BetaAssistantNewParamsModelGPT4_32k0314 BetaAssistantNewParamsModel = "gpt-4-32k-0314"
- BetaAssistantNewParamsModelGPT4_32k0613 BetaAssistantNewParamsModel = "gpt-4-32k-0613"
- BetaAssistantNewParamsModelGPT3_5Turbo BetaAssistantNewParamsModel = "gpt-3.5-turbo"
- BetaAssistantNewParamsModelGPT3_5Turbo16k BetaAssistantNewParamsModel = "gpt-3.5-turbo-16k"
- BetaAssistantNewParamsModelGPT3_5Turbo0613 BetaAssistantNewParamsModel = "gpt-3.5-turbo-0613"
- BetaAssistantNewParamsModelGPT3_5Turbo1106 BetaAssistantNewParamsModel = "gpt-3.5-turbo-1106"
- BetaAssistantNewParamsModelGPT3_5Turbo0125 BetaAssistantNewParamsModel = "gpt-3.5-turbo-0125"
- BetaAssistantNewParamsModelGPT3_5Turbo16k0613 BetaAssistantNewParamsModel = "gpt-3.5-turbo-16k-0613"
-)
-
-func (r BetaAssistantNewParamsModel) IsKnown() bool {
- switch r {
- case BetaAssistantNewParamsModelGPT4o, BetaAssistantNewParamsModelGPT4o2024_05_13, BetaAssistantNewParamsModelGPT4oMini, BetaAssistantNewParamsModelGPT4oMini2024_07_18, BetaAssistantNewParamsModelGPT4Turbo, BetaAssistantNewParamsModelGPT4Turbo2024_04_09, BetaAssistantNewParamsModelGPT4_0125Preview, BetaAssistantNewParamsModelGPT4TurboPreview, BetaAssistantNewParamsModelGPT4_1106Preview, BetaAssistantNewParamsModelGPT4VisionPreview, BetaAssistantNewParamsModelGPT4, BetaAssistantNewParamsModelGPT4_0314, BetaAssistantNewParamsModelGPT4_0613, BetaAssistantNewParamsModelGPT4_32k, BetaAssistantNewParamsModelGPT4_32k0314, BetaAssistantNewParamsModelGPT4_32k0613, BetaAssistantNewParamsModelGPT3_5Turbo, BetaAssistantNewParamsModelGPT3_5Turbo16k, BetaAssistantNewParamsModelGPT3_5Turbo0613, BetaAssistantNewParamsModelGPT3_5Turbo1106, BetaAssistantNewParamsModelGPT3_5Turbo0125, BetaAssistantNewParamsModelGPT3_5Turbo16k0613:
- return true
- }
- return false
-}
-
// A set of resources that are used by the assistant's tools. The resources are
// specific to the type of tool. For example, the `code_interpreter` tool requires
// a list of file IDs, while the `file_search` tool requires a list of vector store
diff --git a/betaassistant_test.go b/betaassistant_test.go
index 1c6f29f..3082757 100644
--- a/betaassistant_test.go
+++ b/betaassistant_test.go
@@ -26,7 +26,7 @@ func TestBetaAssistantNewWithOptionalParams(t *testing.T) {
option.WithAPIKey("My API Key"),
)
_, err := client.Beta.Assistants.New(context.TODO(), openai.BetaAssistantNewParams{
- Model: openai.F(openai.BetaAssistantNewParamsModelGPT4o),
+ Model: openai.F(openai.ChatModelGPT4o),
Description: openai.F("description"),
Instructions: openai.F("instructions"),
Metadata: openai.F[any](map[string]interface{}{}),
diff --git a/betathread.go b/betathread.go
index 0c5f281..70587ae 100644
--- a/betathread.go
+++ b/betathread.go
@@ -972,7 +972,7 @@ type BetaThreadNewAndRunParams struct {
// be used to execute this run. If a value is provided here, it will override the
// model associated with the assistant. If not, the model associated with the
// assistant will be used.
- Model param.Field[BetaThreadNewAndRunParamsModel] `json:"model"`
+ Model param.Field[ChatModel] `json:"model"`
// Whether to enable
// [parallel function calling](https://platform.openai.com/docs/guides/function-calling/parallel-function-calling)
// during tool use.
@@ -1030,41 +1030,6 @@ func (r BetaThreadNewAndRunParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
-type BetaThreadNewAndRunParamsModel string
-
-const (
- BetaThreadNewAndRunParamsModelGPT4o BetaThreadNewAndRunParamsModel = "gpt-4o"
- BetaThreadNewAndRunParamsModelGPT4o2024_05_13 BetaThreadNewAndRunParamsModel = "gpt-4o-2024-05-13"
- BetaThreadNewAndRunParamsModelGPT4oMini BetaThreadNewAndRunParamsModel = "gpt-4o-mini"
- BetaThreadNewAndRunParamsModelGPT4oMini2024_07_18 BetaThreadNewAndRunParamsModel = "gpt-4o-mini-2024-07-18"
- BetaThreadNewAndRunParamsModelGPT4Turbo BetaThreadNewAndRunParamsModel = "gpt-4-turbo"
- BetaThreadNewAndRunParamsModelGPT4Turbo2024_04_09 BetaThreadNewAndRunParamsModel = "gpt-4-turbo-2024-04-09"
- BetaThreadNewAndRunParamsModelGPT4_0125Preview BetaThreadNewAndRunParamsModel = "gpt-4-0125-preview"
- BetaThreadNewAndRunParamsModelGPT4TurboPreview BetaThreadNewAndRunParamsModel = "gpt-4-turbo-preview"
- BetaThreadNewAndRunParamsModelGPT4_1106Preview BetaThreadNewAndRunParamsModel = "gpt-4-1106-preview"
- BetaThreadNewAndRunParamsModelGPT4VisionPreview BetaThreadNewAndRunParamsModel = "gpt-4-vision-preview"
- BetaThreadNewAndRunParamsModelGPT4 BetaThreadNewAndRunParamsModel = "gpt-4"
- BetaThreadNewAndRunParamsModelGPT4_0314 BetaThreadNewAndRunParamsModel = "gpt-4-0314"
- BetaThreadNewAndRunParamsModelGPT4_0613 BetaThreadNewAndRunParamsModel = "gpt-4-0613"
- BetaThreadNewAndRunParamsModelGPT4_32k BetaThreadNewAndRunParamsModel = "gpt-4-32k"
- BetaThreadNewAndRunParamsModelGPT4_32k0314 BetaThreadNewAndRunParamsModel = "gpt-4-32k-0314"
- BetaThreadNewAndRunParamsModelGPT4_32k0613 BetaThreadNewAndRunParamsModel = "gpt-4-32k-0613"
- BetaThreadNewAndRunParamsModelGPT3_5Turbo BetaThreadNewAndRunParamsModel = "gpt-3.5-turbo"
- BetaThreadNewAndRunParamsModelGPT3_5Turbo16k BetaThreadNewAndRunParamsModel = "gpt-3.5-turbo-16k"
- BetaThreadNewAndRunParamsModelGPT3_5Turbo0613 BetaThreadNewAndRunParamsModel = "gpt-3.5-turbo-0613"
- BetaThreadNewAndRunParamsModelGPT3_5Turbo1106 BetaThreadNewAndRunParamsModel = "gpt-3.5-turbo-1106"
- BetaThreadNewAndRunParamsModelGPT3_5Turbo0125 BetaThreadNewAndRunParamsModel = "gpt-3.5-turbo-0125"
- BetaThreadNewAndRunParamsModelGPT3_5Turbo16k0613 BetaThreadNewAndRunParamsModel = "gpt-3.5-turbo-16k-0613"
-)
-
-func (r BetaThreadNewAndRunParamsModel) IsKnown() bool {
- switch r {
- case BetaThreadNewAndRunParamsModelGPT4o, BetaThreadNewAndRunParamsModelGPT4o2024_05_13, BetaThreadNewAndRunParamsModelGPT4oMini, BetaThreadNewAndRunParamsModelGPT4oMini2024_07_18, BetaThreadNewAndRunParamsModelGPT4Turbo, BetaThreadNewAndRunParamsModelGPT4Turbo2024_04_09, BetaThreadNewAndRunParamsModelGPT4_0125Preview, BetaThreadNewAndRunParamsModelGPT4TurboPreview, BetaThreadNewAndRunParamsModelGPT4_1106Preview, BetaThreadNewAndRunParamsModelGPT4VisionPreview, BetaThreadNewAndRunParamsModelGPT4, BetaThreadNewAndRunParamsModelGPT4_0314, BetaThreadNewAndRunParamsModelGPT4_0613, BetaThreadNewAndRunParamsModelGPT4_32k, BetaThreadNewAndRunParamsModelGPT4_32k0314, BetaThreadNewAndRunParamsModelGPT4_32k0613, BetaThreadNewAndRunParamsModelGPT3_5Turbo, BetaThreadNewAndRunParamsModelGPT3_5Turbo16k, BetaThreadNewAndRunParamsModelGPT3_5Turbo0613, BetaThreadNewAndRunParamsModelGPT3_5Turbo1106, BetaThreadNewAndRunParamsModelGPT3_5Turbo0125, BetaThreadNewAndRunParamsModelGPT3_5Turbo16k0613:
- return true
- }
- return false
-}
-
// If no thread is provided, an empty thread will be created.
type BetaThreadNewAndRunParamsThread struct {
// A list of [messages](https://platform.openai.com/docs/api-reference/messages) to
diff --git a/betathread_test.go b/betathread_test.go
index e1acb0e..7a5baed 100644
--- a/betathread_test.go
+++ b/betathread_test.go
@@ -248,7 +248,7 @@ func TestBetaThreadNewAndRunWithOptionalParams(t *testing.T) {
MaxCompletionTokens: openai.F(int64(256)),
MaxPromptTokens: openai.F(int64(256)),
Metadata: openai.F[any](map[string]interface{}{}),
- Model: openai.F(openai.BetaThreadNewAndRunParamsModelGPT4o),
+ Model: openai.F(openai.ChatModelGPT4o),
ParallelToolCalls: openai.F(true),
ResponseFormat: openai.F[openai.AssistantResponseFormatOptionUnionParam](openai.AssistantResponseFormatOptionString(openai.AssistantResponseFormatOptionStringNone)),
Temperature: openai.F(1.000000),
diff --git a/betathreadrun.go b/betathreadrun.go
index 507dd30..2d08951 100644
--- a/betathreadrun.go
+++ b/betathreadrun.go
@@ -708,7 +708,7 @@ type BetaThreadRunNewParams struct {
// be used to execute this run. If a value is provided here, it will override the
// model associated with the assistant. If not, the model associated with the
// assistant will be used.
- Model param.Field[BetaThreadRunNewParamsModel] `json:"model"`
+ Model param.Field[ChatModel] `json:"model"`
// Whether to enable
// [parallel function calling](https://platform.openai.com/docs/guides/function-calling/parallel-function-calling)
// during tool use.
@@ -889,41 +889,6 @@ func (r BetaThreadRunNewParamsAdditionalMessagesAttachmentsToolsType) IsKnown()
return false
}
-type BetaThreadRunNewParamsModel string
-
-const (
- BetaThreadRunNewParamsModelGPT4o BetaThreadRunNewParamsModel = "gpt-4o"
- BetaThreadRunNewParamsModelGPT4o2024_05_13 BetaThreadRunNewParamsModel = "gpt-4o-2024-05-13"
- BetaThreadRunNewParamsModelGPT4oMini BetaThreadRunNewParamsModel = "gpt-4o-mini"
- BetaThreadRunNewParamsModelGPT4oMini2024_07_18 BetaThreadRunNewParamsModel = "gpt-4o-mini-2024-07-18"
- BetaThreadRunNewParamsModelGPT4Turbo BetaThreadRunNewParamsModel = "gpt-4-turbo"
- BetaThreadRunNewParamsModelGPT4Turbo2024_04_09 BetaThreadRunNewParamsModel = "gpt-4-turbo-2024-04-09"
- BetaThreadRunNewParamsModelGPT4_0125Preview BetaThreadRunNewParamsModel = "gpt-4-0125-preview"
- BetaThreadRunNewParamsModelGPT4TurboPreview BetaThreadRunNewParamsModel = "gpt-4-turbo-preview"
- BetaThreadRunNewParamsModelGPT4_1106Preview BetaThreadRunNewParamsModel = "gpt-4-1106-preview"
- BetaThreadRunNewParamsModelGPT4VisionPreview BetaThreadRunNewParamsModel = "gpt-4-vision-preview"
- BetaThreadRunNewParamsModelGPT4 BetaThreadRunNewParamsModel = "gpt-4"
- BetaThreadRunNewParamsModelGPT4_0314 BetaThreadRunNewParamsModel = "gpt-4-0314"
- BetaThreadRunNewParamsModelGPT4_0613 BetaThreadRunNewParamsModel = "gpt-4-0613"
- BetaThreadRunNewParamsModelGPT4_32k BetaThreadRunNewParamsModel = "gpt-4-32k"
- BetaThreadRunNewParamsModelGPT4_32k0314 BetaThreadRunNewParamsModel = "gpt-4-32k-0314"
- BetaThreadRunNewParamsModelGPT4_32k0613 BetaThreadRunNewParamsModel = "gpt-4-32k-0613"
- BetaThreadRunNewParamsModelGPT3_5Turbo BetaThreadRunNewParamsModel = "gpt-3.5-turbo"
- BetaThreadRunNewParamsModelGPT3_5Turbo16k BetaThreadRunNewParamsModel = "gpt-3.5-turbo-16k"
- BetaThreadRunNewParamsModelGPT3_5Turbo0613 BetaThreadRunNewParamsModel = "gpt-3.5-turbo-0613"
- BetaThreadRunNewParamsModelGPT3_5Turbo1106 BetaThreadRunNewParamsModel = "gpt-3.5-turbo-1106"
- BetaThreadRunNewParamsModelGPT3_5Turbo0125 BetaThreadRunNewParamsModel = "gpt-3.5-turbo-0125"
- BetaThreadRunNewParamsModelGPT3_5Turbo16k0613 BetaThreadRunNewParamsModel = "gpt-3.5-turbo-16k-0613"
-)
-
-func (r BetaThreadRunNewParamsModel) IsKnown() bool {
- switch r {
- case BetaThreadRunNewParamsModelGPT4o, BetaThreadRunNewParamsModelGPT4o2024_05_13, BetaThreadRunNewParamsModelGPT4oMini, BetaThreadRunNewParamsModelGPT4oMini2024_07_18, BetaThreadRunNewParamsModelGPT4Turbo, BetaThreadRunNewParamsModelGPT4Turbo2024_04_09, BetaThreadRunNewParamsModelGPT4_0125Preview, BetaThreadRunNewParamsModelGPT4TurboPreview, BetaThreadRunNewParamsModelGPT4_1106Preview, BetaThreadRunNewParamsModelGPT4VisionPreview, BetaThreadRunNewParamsModelGPT4, BetaThreadRunNewParamsModelGPT4_0314, BetaThreadRunNewParamsModelGPT4_0613, BetaThreadRunNewParamsModelGPT4_32k, BetaThreadRunNewParamsModelGPT4_32k0314, BetaThreadRunNewParamsModelGPT4_32k0613, BetaThreadRunNewParamsModelGPT3_5Turbo, BetaThreadRunNewParamsModelGPT3_5Turbo16k, BetaThreadRunNewParamsModelGPT3_5Turbo0613, BetaThreadRunNewParamsModelGPT3_5Turbo1106, BetaThreadRunNewParamsModelGPT3_5Turbo0125, BetaThreadRunNewParamsModelGPT3_5Turbo16k0613:
- return true
- }
- return false
-}
-
// Controls for how a thread will be truncated prior to the run. Use this to
// control the intial context window of the run.
type BetaThreadRunNewParamsTruncationStrategy struct {
diff --git a/betathreadrun_test.go b/betathreadrun_test.go
index 791e429..e2976e8 100644
--- a/betathreadrun_test.go
+++ b/betathreadrun_test.go
@@ -133,7 +133,7 @@ func TestBetaThreadRunNewWithOptionalParams(t *testing.T) {
MaxCompletionTokens: openai.F(int64(256)),
MaxPromptTokens: openai.F(int64(256)),
Metadata: openai.F[any](map[string]interface{}{}),
- Model: openai.F(openai.BetaThreadRunNewParamsModelGPT4o),
+ Model: openai.F(openai.ChatModelGPT4o),
ParallelToolCalls: openai.F(true),
ResponseFormat: openai.F[openai.AssistantResponseFormatOptionUnionParam](openai.AssistantResponseFormatOptionString(openai.AssistantResponseFormatOptionStringNone)),
Temperature: openai.F(1.000000),
diff --git a/image.go b/image.go
index 89af593..73b0c3f 100644
--- a/image.go
+++ b/image.go
@@ -89,6 +89,21 @@ func (r imageJSON) RawJSON() string {
return r.raw
}
+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"`
@@ -117,7 +132,7 @@ type ImageNewVariationParams struct {
Image param.Field[io.Reader] `json:"image,required" format:"binary"`
// The model to use for image generation. Only `dall-e-2` is supported at this
// time.
- Model param.Field[ImageNewVariationParamsModel] `json:"model"`
+ Model param.Field[ImageModel] `json:"model"`
// The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only
// `n=1` is supported.
N param.Field[int64] `json:"n"`
@@ -149,20 +164,6 @@ func (r ImageNewVariationParams) MarshalMultipart() (data []byte, contentType st
return buf.Bytes(), writer.FormDataContentType(), nil
}
-type ImageNewVariationParamsModel string
-
-const (
- ImageNewVariationParamsModelDallE2 ImageNewVariationParamsModel = "dall-e-2"
-)
-
-func (r ImageNewVariationParamsModel) IsKnown() bool {
- switch r {
- case ImageNewVariationParamsModelDallE2:
- return true
- }
- return false
-}
-
// The format in which the generated images are returned. Must be one of `url` or
// `b64_json`. URLs are only valid for 60 minutes after the image has been
// generated.
@@ -212,7 +213,7 @@ type ImageEditParams struct {
Mask param.Field[io.Reader] `json:"mask" format:"binary"`
// The model to use for image generation. Only `dall-e-2` is supported at this
// time.
- Model param.Field[ImageEditParamsModel] `json:"model"`
+ Model param.Field[ImageModel] `json:"model"`
// The number of images to generate. Must be between 1 and 10.
N param.Field[int64] `json:"n"`
// The format in which the generated images are returned. Must be one of `url` or
@@ -243,20 +244,6 @@ func (r ImageEditParams) MarshalMultipart() (data []byte, contentType string, er
return buf.Bytes(), writer.FormDataContentType(), nil
}
-type ImageEditParamsModel string
-
-const (
- ImageEditParamsModelDallE2 ImageEditParamsModel = "dall-e-2"
-)
-
-func (r ImageEditParamsModel) IsKnown() bool {
- switch r {
- case ImageEditParamsModelDallE2:
- return true
- }
- return false
-}
-
// The format in which the generated images are returned. Must be one of `url` or
// `b64_json`. URLs are only valid for 60 minutes after the image has been
// generated.
@@ -298,7 +285,7 @@ type ImageGenerateParams struct {
// characters for `dall-e-2` and 4000 characters for `dall-e-3`.
Prompt param.Field[string] `json:"prompt,required"`
// The model to use for image generation.
- Model param.Field[ImageGenerateParamsModel] `json:"model"`
+ Model param.Field[ImageModel] `json:"model"`
// The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only
// `n=1` is supported.
N param.Field[int64] `json:"n"`
@@ -329,21 +316,6 @@ func (r ImageGenerateParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
-type ImageGenerateParamsModel string
-
-const (
- ImageGenerateParamsModelDallE2 ImageGenerateParamsModel = "dall-e-2"
- ImageGenerateParamsModelDallE3 ImageGenerateParamsModel = "dall-e-3"
-)
-
-func (r ImageGenerateParamsModel) IsKnown() bool {
- switch r {
- case ImageGenerateParamsModelDallE2, ImageGenerateParamsModelDallE3:
- return true
- }
- return false
-}
-
// The quality of the image that will be generated. `hd` creates images with finer
// details and greater consistency across the image. This param is only supported
// for `dall-e-3`.
diff --git a/image_test.go b/image_test.go
index 755003d..308a93d 100644
--- a/image_test.go
+++ b/image_test.go
@@ -29,7 +29,7 @@ func TestImageNewVariationWithOptionalParams(t *testing.T) {
)
_, err := client.Images.NewVariation(context.TODO(), openai.ImageNewVariationParams{
Image: openai.F(io.Reader(bytes.NewBuffer([]byte("some file contents")))),
- Model: openai.F(openai.ImageNewVariationParamsModelDallE2),
+ Model: openai.F(openai.ImageModelDallE2),
N: openai.F(int64(1)),
ResponseFormat: openai.F(openai.ImageNewVariationParamsResponseFormatURL),
Size: openai.F(openai.ImageNewVariationParamsSize1024x1024),
@@ -60,7 +60,7 @@ func TestImageEditWithOptionalParams(t *testing.T) {
Image: openai.F(io.Reader(bytes.NewBuffer([]byte("some file contents")))),
Prompt: openai.F("A cute baby sea otter wearing a beret"),
Mask: openai.F(io.Reader(bytes.NewBuffer([]byte("some file contents")))),
- Model: openai.F(openai.ImageEditParamsModelDallE2),
+ Model: openai.F(openai.ImageModelDallE2),
N: openai.F(int64(1)),
ResponseFormat: openai.F(openai.ImageEditParamsResponseFormatURL),
Size: openai.F(openai.ImageEditParamsSize1024x1024),
@@ -89,7 +89,7 @@ func TestImageGenerateWithOptionalParams(t *testing.T) {
)
_, err := client.Images.Generate(context.TODO(), openai.ImageGenerateParams{
Prompt: openai.F("A cute baby sea otter"),
- Model: openai.F(openai.ImageGenerateParamsModelDallE2),
+ Model: openai.F(openai.ImageModelDallE2),
N: openai.F(int64(1)),
Quality: openai.F(openai.ImageGenerateParamsQualityStandard),
ResponseFormat: openai.F(openai.ImageGenerateParamsResponseFormatURL),
diff --git a/moderation.go b/moderation.go
index 3870493..d42ad21 100644
--- a/moderation.go
+++ b/moderation.go
@@ -185,6 +185,21 @@ func (r moderationCategoryScoresJSON) RawJSON() string {
return r.raw
}
+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.
@@ -225,7 +240,7 @@ type ModerationNewParams struct {
// `text-moderation-stable`, we will provide advanced notice before updating the
// model. Accuracy of `text-moderation-stable` may be slightly lower than for
// `text-moderation-latest`.
- Model param.Field[ModerationNewParamsModel] `json:"model"`
+ Model param.Field[ModerationModel] `json:"model"`
}
func (r ModerationNewParams) MarshalJSON() (data []byte, err error) {
@@ -242,18 +257,3 @@ type ModerationNewParamsInputUnion interface {
type ModerationNewParamsInputArray []string
func (r ModerationNewParamsInputArray) ImplementsModerationNewParamsInputUnion() {}
-
-type ModerationNewParamsModel string
-
-const (
- ModerationNewParamsModelTextModerationLatest ModerationNewParamsModel = "text-moderation-latest"
- ModerationNewParamsModelTextModerationStable ModerationNewParamsModel = "text-moderation-stable"
-)
-
-func (r ModerationNewParamsModel) IsKnown() bool {
- switch r {
- case ModerationNewParamsModelTextModerationLatest, ModerationNewParamsModelTextModerationStable:
- return true
- }
- return false
-}
diff --git a/moderation_test.go b/moderation_test.go
index 80000e2..9d0b8f2 100644
--- a/moderation_test.go
+++ b/moderation_test.go
@@ -28,7 +28,7 @@ func TestModerationNewWithOptionalParams(t *testing.T) {
)
_, err := client.Moderations.New(context.TODO(), openai.ModerationNewParams{
Input: openai.F[openai.ModerationNewParamsInputUnion](shared.UnionString("I want to kill them.")),
- Model: openai.F(openai.ModerationNewParamsModelTextModerationLatest),
+ Model: openai.F(openai.ModerationModelTextModerationLatest),
})
if err != nil {
var apierr *openai.Error