Skip to content

Commit b8e782f

Browse files
feat(api): Add detail to InputFileContent
1 parent bdc1a2b commit b8e782f

File tree

3 files changed

+105
-56
lines changed

3 files changed

+105
-56
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 139
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a6eca1bd01e0c434af356fe5275c206057216a4e626d1051d294c27016cd6d05.yml
3-
openapi_spec_hash: 68abda9122013a9ae3f084cfdbe8e8c1
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-7c540cce6eb30401259f4831ea9803b6d88501605d13734f98212cbb3b199e10.yml
3+
openapi_spec_hash: 06e656be22bbb92689954253668b42fc
44
config_hash: 3e44aa7890aa780e431ab5b767200d3b

responses/response.go

Lines changed: 102 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6269,10 +6269,9 @@ type ResponseCustomToolCallOutputOutputOutputContentListItemUnion struct {
62696269
// This field is from variant [ResponseInputText].
62706270
Text string `json:"text"`
62716271
// Any of "input_text", "input_image", "input_file".
6272-
Type string `json:"type"`
6273-
// This field is from variant [ResponseInputImage].
6274-
Detail ResponseInputImageDetail `json:"detail"`
6275-
FileID string `json:"file_id"`
6272+
Type string `json:"type"`
6273+
Detail string `json:"detail"`
6274+
FileID string `json:"file_id"`
62766275
// This field is from variant [ResponseInputImage].
62776276
ImageURL string `json:"image_url"`
62786277
// This field is from variant [ResponseInputFile].
@@ -6439,14 +6438,6 @@ func (u ResponseCustomToolCallOutputOutputOutputContentListItemUnionParam) GetTe
64396438
return nil
64406439
}
64416440

6442-
// Returns a pointer to the underlying variant's property, if present.
6443-
func (u ResponseCustomToolCallOutputOutputOutputContentListItemUnionParam) GetDetail() *string {
6444-
if vt := u.OfInputImage; vt != nil {
6445-
return (*string)(&vt.Detail)
6446-
}
6447-
return nil
6448-
}
6449-
64506441
// Returns a pointer to the underlying variant's property, if present.
64516442
func (u ResponseCustomToolCallOutputOutputOutputContentListItemUnionParam) GetImageURL() *string {
64526443
if vt := u.OfInputImage; vt != nil && vt.ImageURL.Valid() {
@@ -6491,6 +6482,16 @@ func (u ResponseCustomToolCallOutputOutputOutputContentListItemUnionParam) GetTy
64916482
return nil
64926483
}
64936484

6485+
// Returns a pointer to the underlying variant's property, if present.
6486+
func (u ResponseCustomToolCallOutputOutputOutputContentListItemUnionParam) GetDetail() *string {
6487+
if vt := u.OfInputImage; vt != nil {
6488+
return (*string)(&vt.Detail)
6489+
} else if vt := u.OfInputFile; vt != nil {
6490+
return (*string)(&vt.Detail)
6491+
}
6492+
return nil
6493+
}
6494+
64946495
// Returns a pointer to the underlying variant's property, if present.
64956496
func (u ResponseCustomToolCallOutputOutputOutputContentListItemUnionParam) GetFileID() *string {
64966497
if vt := u.OfInputImage; vt != nil && vt.FileID.Valid() {
@@ -7284,10 +7285,9 @@ type ResponseFunctionCallOutputItemUnion struct {
72847285
// This field is from variant [ResponseInputTextContent].
72857286
Text string `json:"text"`
72867287
// Any of "input_text", "input_image", "input_file".
7287-
Type string `json:"type"`
7288-
// This field is from variant [ResponseInputImageContent].
7289-
Detail ResponseInputImageContentDetail `json:"detail"`
7290-
FileID string `json:"file_id"`
7288+
Type string `json:"type"`
7289+
Detail string `json:"detail"`
7290+
FileID string `json:"file_id"`
72917291
// This field is from variant [ResponseInputImageContent].
72927292
ImageURL string `json:"image_url"`
72937293
// This field is from variant [ResponseInputFileContent].
@@ -7415,14 +7415,6 @@ func (u ResponseFunctionCallOutputItemUnionParam) GetText() *string {
74157415
return nil
74167416
}
74177417

7418-
// Returns a pointer to the underlying variant's property, if present.
7419-
func (u ResponseFunctionCallOutputItemUnionParam) GetDetail() *string {
7420-
if vt := u.OfInputImage; vt != nil {
7421-
return (*string)(&vt.Detail)
7422-
}
7423-
return nil
7424-
}
7425-
74267418
// Returns a pointer to the underlying variant's property, if present.
74277419
func (u ResponseFunctionCallOutputItemUnionParam) GetImageURL() *string {
74287420
if vt := u.OfInputImage; vt != nil && vt.ImageURL.Valid() {
@@ -7467,6 +7459,16 @@ func (u ResponseFunctionCallOutputItemUnionParam) GetType() *string {
74677459
return nil
74687460
}
74697461

7462+
// Returns a pointer to the underlying variant's property, if present.
7463+
func (u ResponseFunctionCallOutputItemUnionParam) GetDetail() *string {
7464+
if vt := u.OfInputImage; vt != nil {
7465+
return (*string)(&vt.Detail)
7466+
} else if vt := u.OfInputFile; vt != nil {
7467+
return (*string)(&vt.Detail)
7468+
}
7469+
return nil
7470+
}
7471+
74707472
// Returns a pointer to the underlying variant's property, if present.
74717473
func (u ResponseFunctionCallOutputItemUnionParam) GetFileID() *string {
74727474
if vt := u.OfInputImage; vt != nil && vt.FileID.Valid() {
@@ -8296,10 +8298,9 @@ type ResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion struct {
82968298
// This field is from variant [ResponseInputText].
82978299
Text string `json:"text"`
82988300
// Any of "input_text", "input_image", "input_file".
8299-
Type string `json:"type"`
8300-
// This field is from variant [ResponseInputImage].
8301-
Detail ResponseInputImageDetail `json:"detail"`
8302-
FileID string `json:"file_id"`
8301+
Type string `json:"type"`
8302+
Detail string `json:"detail"`
8303+
FileID string `json:"file_id"`
83038304
// This field is from variant [ResponseInputImage].
83048305
ImageURL string `json:"image_url"`
83058306
// This field is from variant [ResponseInputFile].
@@ -9137,10 +9138,9 @@ type ResponseInputContentUnion struct {
91379138
// This field is from variant [ResponseInputText].
91389139
Text string `json:"text"`
91399140
// Any of "input_text", "input_image", "input_file".
9140-
Type string `json:"type"`
9141-
// This field is from variant [ResponseInputImage].
9142-
Detail ResponseInputImageDetail `json:"detail"`
9143-
FileID string `json:"file_id"`
9141+
Type string `json:"type"`
9142+
Detail string `json:"detail"`
9143+
FileID string `json:"file_id"`
91449144
// This field is from variant [ResponseInputImage].
91459145
ImageURL string `json:"image_url"`
91469146
// This field is from variant [ResponseInputFile].
@@ -9274,14 +9274,6 @@ func (u ResponseInputContentUnionParam) GetText() *string {
92749274
return nil
92759275
}
92769276

9277-
// Returns a pointer to the underlying variant's property, if present.
9278-
func (u ResponseInputContentUnionParam) GetDetail() *string {
9279-
if vt := u.OfInputImage; vt != nil {
9280-
return (*string)(&vt.Detail)
9281-
}
9282-
return nil
9283-
}
9284-
92859277
// Returns a pointer to the underlying variant's property, if present.
92869278
func (u ResponseInputContentUnionParam) GetImageURL() *string {
92879279
if vt := u.OfInputImage; vt != nil && vt.ImageURL.Valid() {
@@ -9326,6 +9318,16 @@ func (u ResponseInputContentUnionParam) GetType() *string {
93269318
return nil
93279319
}
93289320

9321+
// Returns a pointer to the underlying variant's property, if present.
9322+
func (u ResponseInputContentUnionParam) GetDetail() *string {
9323+
if vt := u.OfInputImage; vt != nil {
9324+
return (*string)(&vt.Detail)
9325+
} else if vt := u.OfInputFile; vt != nil {
9326+
return (*string)(&vt.Detail)
9327+
}
9328+
return nil
9329+
}
9330+
93299331
// Returns a pointer to the underlying variant's property, if present.
93309332
func (u ResponseInputContentUnionParam) GetFileID() *string {
93319333
if vt := u.OfInputImage; vt != nil && vt.FileID.Valid() {
@@ -9349,6 +9351,12 @@ func init() {
93499351
type ResponseInputFile struct {
93509352
// The type of the input item. Always `input_file`.
93519353
Type constant.InputFile `json:"type" default:"input_file"`
9354+
// The detail level of the file to be sent to the model. Use `low` for the default
9355+
// rendering behavior, or `high` to render the file at higher quality. Defaults to
9356+
// `low`.
9357+
//
9358+
// Any of "low", "high".
9359+
Detail ResponseInputFileDetail `json:"detail"`
93529360
// The content of the file to be sent to the model.
93539361
FileData string `json:"file_data"`
93549362
// The ID of the file to be sent to the model.
@@ -9360,6 +9368,7 @@ type ResponseInputFile struct {
93609368
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
93619369
JSON struct {
93629370
Type respjson.Field
9371+
Detail respjson.Field
93639372
FileData respjson.Field
93649373
FileID respjson.Field
93659374
FileURL respjson.Field
@@ -9386,6 +9395,16 @@ func (r ResponseInputFile) ToParam() ResponseInputFileParam {
93869395
return param.Override[ResponseInputFileParam](json.RawMessage(r.RawJSON()))
93879396
}
93889397

9398+
// The detail level of the file to be sent to the model. Use `low` for the default
9399+
// rendering behavior, or `high` to render the file at higher quality. Defaults to
9400+
// `low`.
9401+
type ResponseInputFileDetail string
9402+
9403+
const (
9404+
ResponseInputFileDetailLow ResponseInputFileDetail = "low"
9405+
ResponseInputFileDetailHigh ResponseInputFileDetail = "high"
9406+
)
9407+
93899408
// A file input to the model.
93909409
//
93919410
// The property Type is required.
@@ -9398,6 +9417,12 @@ type ResponseInputFileParam struct {
93989417
FileURL param.Opt[string] `json:"file_url,omitzero"`
93999418
// The name of the file to be sent to the model.
94009419
Filename param.Opt[string] `json:"filename,omitzero"`
9420+
// The detail level of the file to be sent to the model. Use `low` for the default
9421+
// rendering behavior, or `high` to render the file at higher quality. Defaults to
9422+
// `low`.
9423+
//
9424+
// Any of "low", "high".
9425+
Detail ResponseInputFileDetail `json:"detail,omitzero"`
94019426
// The type of the input item. Always `input_file`.
94029427
//
94039428
// This field can be elided, and will marshal its zero value as "input_file".
@@ -9417,6 +9442,12 @@ func (r *ResponseInputFileParam) UnmarshalJSON(data []byte) error {
94179442
type ResponseInputFileContent struct {
94189443
// The type of the input item. Always `input_file`.
94199444
Type constant.InputFile `json:"type" default:"input_file"`
9445+
// The detail level of the file to be sent to the model. Use `low` for the default
9446+
// rendering behavior, or `high` to render the file at higher quality. Defaults to
9447+
// `low`.
9448+
//
9449+
// Any of "low", "high".
9450+
Detail ResponseInputFileContentDetail `json:"detail"`
94209451
// The base64-encoded data of the file to be sent to the model.
94219452
FileData string `json:"file_data" api:"nullable"`
94229453
// The ID of the file to be sent to the model.
@@ -9428,6 +9459,7 @@ type ResponseInputFileContent struct {
94289459
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
94299460
JSON struct {
94309461
Type respjson.Field
9462+
Detail respjson.Field
94319463
FileData respjson.Field
94329464
FileID respjson.Field
94339465
FileURL respjson.Field
@@ -9453,6 +9485,16 @@ func (r ResponseInputFileContent) ToParam() ResponseInputFileContentParam {
94539485
return param.Override[ResponseInputFileContentParam](json.RawMessage(r.RawJSON()))
94549486
}
94559487

9488+
// The detail level of the file to be sent to the model. Use `low` for the default
9489+
// rendering behavior, or `high` to render the file at higher quality. Defaults to
9490+
// `low`.
9491+
type ResponseInputFileContentDetail string
9492+
9493+
const (
9494+
ResponseInputFileContentDetailLow ResponseInputFileContentDetail = "low"
9495+
ResponseInputFileContentDetailHigh ResponseInputFileContentDetail = "high"
9496+
)
9497+
94569498
// A file input to the model.
94579499
//
94589500
// The property Type is required.
@@ -9465,6 +9507,12 @@ type ResponseInputFileContentParam struct {
94659507
FileURL param.Opt[string] `json:"file_url,omitzero"`
94669508
// The name of the file to be sent to the model.
94679509
Filename param.Opt[string] `json:"filename,omitzero"`
9510+
// The detail level of the file to be sent to the model. Use `low` for the default
9511+
// rendering behavior, or `high` to render the file at higher quality. Defaults to
9512+
// `low`.
9513+
//
9514+
// Any of "low", "high".
9515+
Detail ResponseInputFileContentDetail `json:"detail,omitzero"`
94689516
// The type of the input item. Always `input_file`.
94699517
//
94709518
// This field can be elided, and will marshal its zero value as "input_file".
@@ -16377,11 +16425,10 @@ type ResponsePromptVariableUnion struct {
1637716425
// This field will be present if the value is a [string] instead of an object.
1637816426
OfString string `json:",inline"`
1637916427
// This field is from variant [ResponseInputText].
16380-
Text string `json:"text"`
16381-
Type string `json:"type"`
16382-
// This field is from variant [ResponseInputImage].
16383-
Detail ResponseInputImageDetail `json:"detail"`
16384-
FileID string `json:"file_id"`
16428+
Text string `json:"text"`
16429+
Type string `json:"type"`
16430+
Detail string `json:"detail"`
16431+
FileID string `json:"file_id"`
1638516432
// This field is from variant [ResponseInputImage].
1638616433
ImageURL string `json:"image_url"`
1638716434
// This field is from variant [ResponseInputFile].
@@ -16494,14 +16541,6 @@ func (u ResponsePromptVariableUnionParam) GetText() *string {
1649416541
return nil
1649516542
}
1649616543

16497-
// Returns a pointer to the underlying variant's property, if present.
16498-
func (u ResponsePromptVariableUnionParam) GetDetail() *string {
16499-
if vt := u.OfInputImage; vt != nil {
16500-
return (*string)(&vt.Detail)
16501-
}
16502-
return nil
16503-
}
16504-
1650516544
// Returns a pointer to the underlying variant's property, if present.
1650616545
func (u ResponsePromptVariableUnionParam) GetImageURL() *string {
1650716546
if vt := u.OfInputImage; vt != nil && vt.ImageURL.Valid() {
@@ -16546,6 +16585,16 @@ func (u ResponsePromptVariableUnionParam) GetType() *string {
1654616585
return nil
1654716586
}
1654816587

16588+
// Returns a pointer to the underlying variant's property, if present.
16589+
func (u ResponsePromptVariableUnionParam) GetDetail() *string {
16590+
if vt := u.OfInputImage; vt != nil {
16591+
return (*string)(&vt.Detail)
16592+
} else if vt := u.OfInputFile; vt != nil {
16593+
return (*string)(&vt.Detail)
16594+
}
16595+
return nil
16596+
}
16597+
1654916598
// Returns a pointer to the underlying variant's property, if present.
1655016599
func (u ResponsePromptVariableUnionParam) GetFileID() *string {
1655116600
if vt := u.OfInputImage; vt != nil && vt.FileID.Valid() {

responses/response_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func TestResponseNewWithOptionalParams(t *testing.T) {
4141
OfString: openai.String("string"),
4242
},
4343
Instructions: openai.String("instructions"),
44-
MaxOutputTokens: openai.Int(0),
44+
MaxOutputTokens: openai.Int(16),
4545
MaxToolCalls: openai.Int(0),
4646
Metadata: shared.Metadata{
4747
"foo": "string",

0 commit comments

Comments
 (0)