Skip to content

Commit 86fa6f3

Browse files
chore(api): updates to supported Voice IDs (#325)
1 parent df4b19b commit 86fa6f3

8 files changed

+41
-74
lines changed

.stats.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 80
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-5ad6884898c07591750dde560118baf7074a59aecd1f367f930c5e42b04e848a.yml
3-
openapi_spec_hash: 0c255269b89767eae26f4d4dc22d3cbd
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-6663c59193eb95b201e492de17dcbd5e126ba03d18ce66287a3e2c632ca56fe7.yml
3+
openapi_spec_hash: 7996d2c34cc44fe2ce9ffe93c0ab774e
44
config_hash: d36e491b0afc4f79e3afad4b3c9bec70

audiospeech.go

+3-24
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,10 @@ type AudioSpeechNewParams struct {
5454
// `tts-1`, `tts-1-hd` or `gpt-4o-mini-tts`.
5555
Model SpeechModel `json:"model,omitzero,required"`
5656
// The voice to use when generating the audio. Supported voices are `alloy`, `ash`,
57-
// `coral`, `echo`, `fable`, `onyx`, `nova`, `sage` and `shimmer`. Previews of the
58-
// voices are available in the
57+
// `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, and
58+
// `verse`. Previews of the voices are available in the
5959
// [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options).
60-
//
61-
// Any of "alloy", "ash", "coral", "echo", "fable", "onyx", "nova", "sage",
62-
// "shimmer".
63-
Voice AudioSpeechNewParamsVoice `json:"voice,omitzero,required"`
60+
Voice string `json:"voice,omitzero,required"`
6461
// Control the voice of your generated audio with additional instructions. Does not
6562
// work with `tts-1` or `tts-1-hd`.
6663
Instructions param.Opt[string] `json:"instructions,omitzero"`
@@ -84,24 +81,6 @@ func (r AudioSpeechNewParams) MarshalJSON() (data []byte, err error) {
8481
return param.MarshalObject(r, (*shadow)(&r))
8582
}
8683

87-
// The voice to use when generating the audio. Supported voices are `alloy`, `ash`,
88-
// `coral`, `echo`, `fable`, `onyx`, `nova`, `sage` and `shimmer`. Previews of the
89-
// voices are available in the
90-
// [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options).
91-
type AudioSpeechNewParamsVoice string
92-
93-
const (
94-
AudioSpeechNewParamsVoiceAlloy AudioSpeechNewParamsVoice = "alloy"
95-
AudioSpeechNewParamsVoiceAsh AudioSpeechNewParamsVoice = "ash"
96-
AudioSpeechNewParamsVoiceCoral AudioSpeechNewParamsVoice = "coral"
97-
AudioSpeechNewParamsVoiceEcho AudioSpeechNewParamsVoice = "echo"
98-
AudioSpeechNewParamsVoiceFable AudioSpeechNewParamsVoice = "fable"
99-
AudioSpeechNewParamsVoiceOnyx AudioSpeechNewParamsVoice = "onyx"
100-
AudioSpeechNewParamsVoiceNova AudioSpeechNewParamsVoice = "nova"
101-
AudioSpeechNewParamsVoiceSage AudioSpeechNewParamsVoice = "sage"
102-
AudioSpeechNewParamsVoiceShimmer AudioSpeechNewParamsVoice = "shimmer"
103-
)
104-
10584
// The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`,
10685
// `wav`, and `pcm`.
10786
type AudioSpeechNewParamsResponseFormat string

audiospeech_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestAudioSpeechNewWithOptionalParams(t *testing.T) {
2929
resp, err := client.Audio.Speech.New(context.TODO(), openai.AudioSpeechNewParams{
3030
Input: "input",
3131
Model: openai.SpeechModelTTS1,
32-
Voice: openai.AudioSpeechNewParamsVoiceAlloy,
32+
Voice: "alloy",
3333
Instructions: openai.String("instructions"),
3434
ResponseFormat: openai.AudioSpeechNewParamsResponseFormatMP3,
3535
Speed: openai.Float(0.25),

chatcompletion.go

+1-18
Original file line numberDiff line numberDiff line change
@@ -500,9 +500,7 @@ type ChatCompletionAudioParam struct {
500500
Format ChatCompletionAudioParamFormat `json:"format,omitzero,required"`
501501
// The voice the model uses to respond. Supported voices are `alloy`, `ash`,
502502
// `ballad`, `coral`, `echo`, `sage`, and `shimmer`.
503-
//
504-
// Any of "alloy", "ash", "ballad", "coral", "echo", "sage", "shimmer", "verse".
505-
Voice ChatCompletionAudioParamVoice `json:"voice,omitzero,required"`
503+
Voice string `json:"voice,omitzero,required"`
506504
paramObj
507505
}
508506

@@ -526,21 +524,6 @@ const (
526524
ChatCompletionAudioParamFormatPcm16 ChatCompletionAudioParamFormat = "pcm16"
527525
)
528526

529-
// The voice the model uses to respond. Supported voices are `alloy`, `ash`,
530-
// `ballad`, `coral`, `echo`, `sage`, and `shimmer`.
531-
type ChatCompletionAudioParamVoice string
532-
533-
const (
534-
ChatCompletionAudioParamVoiceAlloy ChatCompletionAudioParamVoice = "alloy"
535-
ChatCompletionAudioParamVoiceAsh ChatCompletionAudioParamVoice = "ash"
536-
ChatCompletionAudioParamVoiceBallad ChatCompletionAudioParamVoice = "ballad"
537-
ChatCompletionAudioParamVoiceCoral ChatCompletionAudioParamVoice = "coral"
538-
ChatCompletionAudioParamVoiceEcho ChatCompletionAudioParamVoice = "echo"
539-
ChatCompletionAudioParamVoiceSage ChatCompletionAudioParamVoice = "sage"
540-
ChatCompletionAudioParamVoiceShimmer ChatCompletionAudioParamVoice = "shimmer"
541-
ChatCompletionAudioParamVoiceVerse ChatCompletionAudioParamVoice = "verse"
542-
)
543-
544527
// Represents a streamed chunk of a chat completion response returned by the model,
545528
// based on the provided input.
546529
// [Learn more](https://platform.openai.com/docs/guides/streaming-responses).

chatcompletion_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func TestChatCompletionNewWithOptionalParams(t *testing.T) {
3838
Model: shared.ChatModelO3Mini,
3939
Audio: openai.ChatCompletionAudioParam{
4040
Format: openai.ChatCompletionAudioParamFormatWAV,
41-
Voice: openai.ChatCompletionAudioParamVoiceAlloy,
41+
Voice: "alloy",
4242
},
4343
FrequencyPenalty: openai.Float(-2),
4444
FunctionCall: openai.ChatCompletionNewParamsFunctionCallUnion{

responses/inputitem.go

+3
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ type InputItemListParams struct {
104104
// A limit on the number of objects to be returned. Limit can range between 1 and
105105
// 100, and the default is 20.
106106
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
107+
// Additional fields to include in the response. See the `include` parameter for
108+
// Response creation above for more information.
109+
Include []ResponseIncludable `query:"include,omitzero" json:"-"`
107110
// The order to return the input items in. Default is `asc`.
108111
//
109112
// - `asc`: Return the input items in ascending order.

responses/inputitem_test.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ func TestInputItemListWithOptionalParams(t *testing.T) {
3030
context.TODO(),
3131
"response_id",
3232
responses.InputItemListParams{
33-
After: openai.String("after"),
34-
Before: openai.String("before"),
35-
Limit: openai.Int(0),
36-
Order: responses.InputItemListParamsOrderAsc,
33+
After: openai.String("after"),
34+
Before: openai.String("before"),
35+
Include: []responses.ResponseIncludable{responses.ResponseIncludableFileSearchCallResults},
36+
Limit: openai.Int(0),
37+
Order: responses.InputItemListParamsOrderAsc,
3738
},
3839
)
3940
if err != nil {

responses/response.go

+25-24
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,8 @@ type Response struct {
576576
// context.
577577
//
578578
// When using along with `previous_response_id`, the instructions from a previous
579-
// response will be not be carried over to the next response. This makes it simple
580-
// to swap out system (or developer) messages in new responses.
579+
// response will not be carried over to the next response. This makes it simple to
580+
// swap out system (or developer) messages in new responses.
581581
Instructions string `json:"instructions,required"`
582582
// Set of 16 key-value pairs that can be attached to an object. This can be useful
583583
// for storing additional information about the object in a structured format, and
@@ -2958,18 +2958,18 @@ type ResponseFormatTextConfigUnion struct {
29582958
// Any of "text", "json_schema", "json_object".
29592959
Type string `json:"type"`
29602960
// This field is from variant [ResponseFormatTextJSONSchemaConfig].
2961+
Name string `json:"name"`
2962+
// This field is from variant [ResponseFormatTextJSONSchemaConfig].
29612963
Schema map[string]interface{} `json:"schema"`
29622964
// This field is from variant [ResponseFormatTextJSONSchemaConfig].
29632965
Description string `json:"description"`
29642966
// This field is from variant [ResponseFormatTextJSONSchemaConfig].
2965-
Name string `json:"name"`
2966-
// This field is from variant [ResponseFormatTextJSONSchemaConfig].
29672967
Strict bool `json:"strict"`
29682968
JSON struct {
29692969
Type resp.Field
2970+
Name resp.Field
29702971
Schema resp.Field
29712972
Description resp.Field
2972-
Name resp.Field
29732973
Strict resp.Field
29742974
raw string
29752975
} `json:"-"`
@@ -3028,8 +3028,9 @@ func (r ResponseFormatTextConfigUnion) ToParam() ResponseFormatTextConfigUnionPa
30283028
return param.OverrideObj[ResponseFormatTextConfigUnionParam](r.RawJSON())
30293029
}
30303030

3031-
func ResponseFormatTextConfigParamOfJSONSchema(schema map[string]interface{}) ResponseFormatTextConfigUnionParam {
3031+
func ResponseFormatTextConfigParamOfJSONSchema(name string, schema map[string]interface{}) ResponseFormatTextConfigUnionParam {
30323032
var jsonSchema ResponseFormatTextJSONSchemaConfigParam
3033+
jsonSchema.Name = name
30333034
jsonSchema.Schema = schema
30343035
return ResponseFormatTextConfigUnionParam{OfJSONSchema: &jsonSchema}
30353036
}
@@ -3065,25 +3066,25 @@ func (u *ResponseFormatTextConfigUnionParam) asAny() any {
30653066
}
30663067

30673068
// Returns a pointer to the underlying variant's property, if present.
3068-
func (u ResponseFormatTextConfigUnionParam) GetSchema() map[string]interface{} {
3069+
func (u ResponseFormatTextConfigUnionParam) GetName() *string {
30693070
if vt := u.OfJSONSchema; vt != nil {
3070-
return vt.Schema
3071+
return &vt.Name
30713072
}
30723073
return nil
30733074
}
30743075

30753076
// Returns a pointer to the underlying variant's property, if present.
3076-
func (u ResponseFormatTextConfigUnionParam) GetDescription() *string {
3077-
if vt := u.OfJSONSchema; vt != nil && vt.Description.IsPresent() {
3078-
return &vt.Description.Value
3077+
func (u ResponseFormatTextConfigUnionParam) GetSchema() map[string]interface{} {
3078+
if vt := u.OfJSONSchema; vt != nil {
3079+
return vt.Schema
30793080
}
30803081
return nil
30813082
}
30823083

30833084
// Returns a pointer to the underlying variant's property, if present.
3084-
func (u ResponseFormatTextConfigUnionParam) GetName() *string {
3085-
if vt := u.OfJSONSchema; vt != nil && vt.Name.IsPresent() {
3086-
return &vt.Name.Value
3085+
func (u ResponseFormatTextConfigUnionParam) GetDescription() *string {
3086+
if vt := u.OfJSONSchema; vt != nil && vt.Description.IsPresent() {
3087+
return &vt.Description.Value
30873088
}
30883089
return nil
30893090
}
@@ -3133,6 +3134,9 @@ func init() {
31333134
// more about
31343135
// [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).
31353136
type ResponseFormatTextJSONSchemaConfig struct {
3137+
// The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores
3138+
// and dashes, with a maximum length of 64.
3139+
Name string `json:"name,required"`
31363140
// The schema for the response format, described as a JSON Schema object. Learn how
31373141
// to build JSON schemas [here](https://json-schema.org/).
31383142
Schema map[string]interface{} `json:"schema,required"`
@@ -3141,9 +3145,6 @@ type ResponseFormatTextJSONSchemaConfig struct {
31413145
// A description of what the response format is for, used by the model to determine
31423146
// how to respond in the format.
31433147
Description string `json:"description"`
3144-
// The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores
3145-
// and dashes, with a maximum length of 64.
3146-
Name string `json:"name"`
31473148
// Whether to enable strict schema adherence when generating the output. If set to
31483149
// true, the model will always follow the exact schema defined in the `schema`
31493150
// field. Only a subset of JSON Schema is supported when `strict` is `true`. To
@@ -3153,10 +3154,10 @@ type ResponseFormatTextJSONSchemaConfig struct {
31533154
// Metadata for the response, check the presence of optional fields with the
31543155
// [resp.Field.IsPresent] method.
31553156
JSON struct {
3157+
Name resp.Field
31563158
Schema resp.Field
31573159
Type resp.Field
31583160
Description resp.Field
3159-
Name resp.Field
31603161
Strict resp.Field
31613162
ExtraFields map[string]resp.Field
31623163
raw string
@@ -3183,8 +3184,11 @@ func (r ResponseFormatTextJSONSchemaConfig) ToParam() ResponseFormatTextJSONSche
31833184
// more about
31843185
// [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).
31853186
//
3186-
// The properties Schema, Type are required.
3187+
// The properties Name, Schema, Type are required.
31873188
type ResponseFormatTextJSONSchemaConfigParam struct {
3189+
// The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores
3190+
// and dashes, with a maximum length of 64.
3191+
Name string `json:"name,required"`
31883192
// The schema for the response format, described as a JSON Schema object. Learn how
31893193
// to build JSON schemas [here](https://json-schema.org/).
31903194
Schema map[string]interface{} `json:"schema,omitzero,required"`
@@ -3197,9 +3201,6 @@ type ResponseFormatTextJSONSchemaConfigParam struct {
31973201
// A description of what the response format is for, used by the model to determine
31983202
// how to respond in the format.
31993203
Description param.Opt[string] `json:"description,omitzero"`
3200-
// The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores
3201-
// and dashes, with a maximum length of 64.
3202-
Name param.Opt[string] `json:"name,omitzero"`
32033204
// The type of response format being defined. Always `json_schema`.
32043205
//
32053206
// This field can be elided, and will marshal its zero value as "json_schema".
@@ -7425,8 +7426,8 @@ type ResponseNewParams struct {
74257426
// context.
74267427
//
74277428
// When using along with `previous_response_id`, the instructions from a previous
7428-
// response will be not be carried over to the next response. This makes it simple
7429-
// to swap out system (or developer) messages in new responses.
7429+
// response will not be carried over to the next response. This makes it simple to
7430+
// swap out system (or developer) messages in new responses.
74307431
Instructions param.Opt[string] `json:"instructions,omitzero"`
74317432
// An upper bound for the number of tokens that can be generated for a response,
74327433
// including visible output tokens and

0 commit comments

Comments
 (0)