Skip to content

Commit 5469fed

Browse files
feat(api): add file_url, fix event ID
1 parent 32f80cd commit 5469fed

File tree

5 files changed

+79
-35
lines changed

5 files changed

+79
-35
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 97
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a473967d1766dc155994d932fbc4a5bcbd1c140a37c20d0a4065e1bf0640536d.yml
3-
openapi_spec_hash: 67cdc62b0d6c8b1de29b7dc54b265749
4-
config_hash: 7b53f96f897ca1b3407a5341a6f820db
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-2d116cda53321baa3479e628512def723207a81eb1cdaebb542bd0555e563bda.yml
3+
openapi_spec_hash: 809d958fec261a32004a4b026b718793
4+
config_hash: e74d6791681e3af1b548748ff47a22c2

audiotranscription.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,14 @@ type TranscriptionUsageUnion struct {
130130
// This field is from variant [TranscriptionUsageTokens].
131131
InputTokenDetails TranscriptionUsageTokensInputTokenDetails `json:"input_token_details"`
132132
// This field is from variant [TranscriptionUsageDuration].
133-
Duration float64 `json:"duration"`
134-
JSON struct {
133+
Seconds float64 `json:"seconds"`
134+
JSON struct {
135135
InputTokens respjson.Field
136136
OutputTokens respjson.Field
137137
TotalTokens respjson.Field
138138
Type respjson.Field
139139
InputTokenDetails respjson.Field
140-
Duration respjson.Field
140+
Seconds respjson.Field
141141
raw string
142142
} `json:"-"`
143143
}
@@ -241,12 +241,12 @@ func (r *TranscriptionUsageTokensInputTokenDetails) UnmarshalJSON(data []byte) e
241241
// Usage statistics for models billed by audio input duration.
242242
type TranscriptionUsageDuration struct {
243243
// Duration of the input audio in seconds.
244-
Duration float64 `json:"duration,required"`
244+
Seconds float64 `json:"seconds,required"`
245245
// The type of the usage object. Always `duration` for this variant.
246246
Type constant.Duration `json:"type,required"`
247247
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
248248
JSON struct {
249-
Duration respjson.Field
249+
Seconds respjson.Field
250250
Type respjson.Field
251251
ExtraFields map[string]respjson.Field
252252
raw string

file.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,11 @@ type FileObject struct {
163163
// The object type, which is always `file`.
164164
Object constant.File `json:"object,required"`
165165
// The intended purpose of the file. Supported values are `assistants`,
166-
// `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`
167-
// and `vision`.
166+
// `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`,
167+
// `vision`, and `user_data`.
168168
//
169169
// Any of "assistants", "assistants_output", "batch", "batch_output", "fine-tune",
170-
// "fine-tune-results", "vision".
170+
// "fine-tune-results", "vision", "user_data".
171171
Purpose FileObjectPurpose `json:"purpose,required"`
172172
// Deprecated. The current status of the file, which can be either `uploaded`,
173173
// `processed`, or `error`.
@@ -206,8 +206,8 @@ func (r *FileObject) UnmarshalJSON(data []byte) error {
206206
}
207207

208208
// The intended purpose of the file. Supported values are `assistants`,
209-
// `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`
210-
// and `vision`.
209+
// `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`,
210+
// `vision`, and `user_data`.
211211
type FileObjectPurpose string
212212

213213
const (
@@ -218,6 +218,7 @@ const (
218218
FileObjectPurposeFineTune FileObjectPurpose = "fine-tune"
219219
FileObjectPurposeFineTuneResults FileObjectPurpose = "fine-tune-results"
220220
FileObjectPurposeVision FileObjectPurpose = "vision"
221+
FileObjectPurposeUserData FileObjectPurpose = "user_data"
221222
)
222223

223224
// Deprecated. The current status of the file, which can be either `uploaded`,

responses/response.go

Lines changed: 59 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4381,6 +4381,8 @@ type ResponseInputContentUnion struct {
43814381
// This field is from variant [ResponseInputFile].
43824382
FileData string `json:"file_data"`
43834383
// This field is from variant [ResponseInputFile].
4384+
FileURL string `json:"file_url"`
4385+
// This field is from variant [ResponseInputFile].
43844386
Filename string `json:"filename"`
43854387
JSON struct {
43864388
Text respjson.Field
@@ -4389,6 +4391,7 @@ type ResponseInputContentUnion struct {
43894391
FileID respjson.Field
43904392
ImageURL respjson.Field
43914393
FileData respjson.Field
4394+
FileURL respjson.Field
43924395
Filename respjson.Field
43934396
raw string
43944397
} `json:"-"`
@@ -4530,6 +4533,14 @@ func (u ResponseInputContentUnionParam) GetFileData() *string {
45304533
return nil
45314534
}
45324535

4536+
// Returns a pointer to the underlying variant's property, if present.
4537+
func (u ResponseInputContentUnionParam) GetFileURL() *string {
4538+
if vt := u.OfInputFile; vt != nil && vt.FileURL.Valid() {
4539+
return &vt.FileURL.Value
4540+
}
4541+
return nil
4542+
}
4543+
45334544
// Returns a pointer to the underlying variant's property, if present.
45344545
func (u ResponseInputContentUnionParam) GetFilename() *string {
45354546
if vt := u.OfInputFile; vt != nil && vt.Filename.Valid() {
@@ -4577,13 +4588,16 @@ type ResponseInputFile struct {
45774588
FileData string `json:"file_data"`
45784589
// The ID of the file to be sent to the model.
45794590
FileID string `json:"file_id,nullable"`
4591+
// The URL of the file to be sent to the model.
4592+
FileURL string `json:"file_url"`
45804593
// The name of the file to be sent to the model.
45814594
Filename string `json:"filename"`
45824595
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
45834596
JSON struct {
45844597
Type respjson.Field
45854598
FileData respjson.Field
45864599
FileID respjson.Field
4600+
FileURL respjson.Field
45874601
Filename respjson.Field
45884602
ExtraFields map[string]respjson.Field
45894603
raw string
@@ -4613,6 +4627,8 @@ type ResponseInputFileParam struct {
46134627
FileID param.Opt[string] `json:"file_id,omitzero"`
46144628
// The content of the file to be sent to the model.
46154629
FileData param.Opt[string] `json:"file_data,omitzero"`
4630+
// The URL of the file to be sent to the model.
4631+
FileURL param.Opt[string] `json:"file_url,omitzero"`
46164632
// The name of the file to be sent to the model.
46174633
Filename param.Opt[string] `json:"filename,omitzero"`
46184634
// The type of the input item. Always `input_file`.
@@ -7597,7 +7613,7 @@ type ResponseMcpCallArgumentsDeltaEvent struct {
75977613
OutputIndex int64 `json:"output_index,required"`
75987614
// The sequence number of this event.
75997615
SequenceNumber int64 `json:"sequence_number,required"`
7600-
// The type of the event. Always 'response.mcp_call.arguments_delta'.
7616+
// The type of the event. Always 'response.mcp_call_arguments.delta'.
76017617
Type constant.ResponseMcpCallArgumentsDelta `json:"type,required"`
76027618
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
76037619
JSON struct {
@@ -7627,7 +7643,7 @@ type ResponseMcpCallArgumentsDoneEvent struct {
76277643
OutputIndex int64 `json:"output_index,required"`
76287644
// The sequence number of this event.
76297645
SequenceNumber int64 `json:"sequence_number,required"`
7630-
// The type of the event. Always 'response.mcp_call.arguments_done'.
7646+
// The type of the event. Always 'response.mcp_call_arguments.done'.
76317647
Type constant.ResponseMcpCallArgumentsDone `json:"type,required"`
76327648
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
76337649
JSON struct {
@@ -9217,7 +9233,7 @@ type ResponseOutputTextAnnotationAddedEvent struct {
92179233
OutputIndex int64 `json:"output_index,required"`
92189234
// The sequence number of this event.
92199235
SequenceNumber int64 `json:"sequence_number,required"`
9220-
// The type of the event. Always 'response.output_text_annotation.added'.
9236+
// The type of the event. Always 'response.output_text.annotation.added'.
92219237
Type constant.ResponseOutputTextAnnotationAdded `json:"type,required"`
92229238
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
92239239
JSON struct {
@@ -9296,6 +9312,8 @@ type ResponsePromptVariableUnion struct {
92969312
// This field is from variant [ResponseInputFile].
92979313
FileData string `json:"file_data"`
92989314
// This field is from variant [ResponseInputFile].
9315+
FileURL string `json:"file_url"`
9316+
// This field is from variant [ResponseInputFile].
92999317
Filename string `json:"filename"`
93009318
JSON struct {
93019319
OfString respjson.Field
@@ -9305,6 +9323,7 @@ type ResponsePromptVariableUnion struct {
93059323
FileID respjson.Field
93069324
ImageURL respjson.Field
93079325
FileData respjson.Field
9326+
FileURL respjson.Field
93089327
Filename respjson.Field
93099328
raw string
93109329
} `json:"-"`
@@ -9424,6 +9443,14 @@ func (u ResponsePromptVariableUnionParam) GetFileData() *string {
94249443
return nil
94259444
}
94269445

9446+
// Returns a pointer to the underlying variant's property, if present.
9447+
func (u ResponsePromptVariableUnionParam) GetFileURL() *string {
9448+
if vt := u.OfInputFile; vt != nil && vt.FileURL.Valid() {
9449+
return &vt.FileURL.Value
9450+
}
9451+
return nil
9452+
}
9453+
94279454
// Returns a pointer to the underlying variant's property, if present.
94289455
func (u ResponsePromptVariableUnionParam) GetFilename() *string {
94299456
if vt := u.OfInputFile; vt != nil && vt.Filename.Valid() {
@@ -10057,11 +10084,11 @@ type ResponseStreamEventUnion struct {
1005710084
// "response.image_generation_call.generating",
1005810085
// "response.image_generation_call.in_progress",
1005910086
// "response.image_generation_call.partial_image",
10060-
// "response.mcp_call.arguments_delta", "response.mcp_call.arguments_done",
10087+
// "response.mcp_call_arguments.delta", "response.mcp_call_arguments.done",
1006110088
// "response.mcp_call.completed", "response.mcp_call.failed",
1006210089
// "response.mcp_call.in_progress", "response.mcp_list_tools.completed",
1006310090
// "response.mcp_list_tools.failed", "response.mcp_list_tools.in_progress",
10064-
// "response.output_text_annotation.added", "response.queued",
10091+
// "response.output_text.annotation.added", "response.queued",
1006510092
// "response.reasoning.delta", "response.reasoning.done",
1006610093
// "response.reasoning_summary.delta", "response.reasoning_summary.done".
1006710094
Type string `json:"type"`
@@ -10321,9 +10348,9 @@ func (u ResponseStreamEventUnion) AsAny() anyResponseStreamEvent {
1032110348
return u.AsResponseImageGenerationCallInProgress()
1032210349
case "response.image_generation_call.partial_image":
1032310350
return u.AsResponseImageGenerationCallPartialImage()
10324-
case "response.mcp_call.arguments_delta":
10351+
case "response.mcp_call_arguments.delta":
1032510352
return u.AsResponseMcpCallArgumentsDelta()
10326-
case "response.mcp_call.arguments_done":
10353+
case "response.mcp_call_arguments.done":
1032710354
return u.AsResponseMcpCallArgumentsDone()
1032810355
case "response.mcp_call.completed":
1032910356
return u.AsResponseMcpCallCompleted()
@@ -10337,7 +10364,7 @@ func (u ResponseStreamEventUnion) AsAny() anyResponseStreamEvent {
1033710364
return u.AsResponseMcpListToolsFailed()
1033810365
case "response.mcp_list_tools.in_progress":
1033910366
return u.AsResponseMcpListToolsInProgress()
10340-
case "response.output_text_annotation.added":
10367+
case "response.output_text.annotation.added":
1034110368
return u.AsResponseOutputTextAnnotationAdded()
1034210369
case "response.queued":
1034310370
return u.AsResponseQueued()
@@ -11043,6 +11070,8 @@ type ToolUnion struct {
1104311070
Headers map[string]string `json:"headers"`
1104411071
// This field is from variant [ToolMcp].
1104511072
RequireApproval ToolMcpRequireApprovalUnion `json:"require_approval"`
11073+
// This field is from variant [ToolMcp].
11074+
ServerDescription string `json:"server_description"`
1104611075
// This field is from variant [ToolCodeInterpreter].
1104711076
Container ToolCodeInterpreterContainerUnion `json:"container"`
1104811077
// This field is from variant [ToolImageGeneration].
@@ -11083,6 +11112,7 @@ type ToolUnion struct {
1108311112
AllowedTools respjson.Field
1108411113
Headers respjson.Field
1108511114
RequireApproval respjson.Field
11115+
ServerDescription respjson.Field
1108611116
Container respjson.Field
1108711117
Background respjson.Field
1108811118
InputImageMask respjson.Field
@@ -11170,16 +11200,19 @@ type ToolMcp struct {
1117011200
Headers map[string]string `json:"headers,nullable"`
1117111201
// Specify which of the MCP server's tools require approval.
1117211202
RequireApproval ToolMcpRequireApprovalUnion `json:"require_approval,nullable"`
11203+
// Optional description of the MCP server, used to provide more context.
11204+
ServerDescription string `json:"server_description"`
1117311205
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
1117411206
JSON struct {
11175-
ServerLabel respjson.Field
11176-
ServerURL respjson.Field
11177-
Type respjson.Field
11178-
AllowedTools respjson.Field
11179-
Headers respjson.Field
11180-
RequireApproval respjson.Field
11181-
ExtraFields map[string]respjson.Field
11182-
raw string
11207+
ServerLabel respjson.Field
11208+
ServerURL respjson.Field
11209+
Type respjson.Field
11210+
AllowedTools respjson.Field
11211+
Headers respjson.Field
11212+
RequireApproval respjson.Field
11213+
ServerDescription respjson.Field
11214+
ExtraFields map[string]respjson.Field
11215+
raw string
1118311216
} `json:"-"`
1118411217
}
1118511218

@@ -11778,6 +11811,14 @@ func (u ToolUnionParam) GetRequireApproval() *ToolMcpRequireApprovalUnionParam {
1177811811
return nil
1177911812
}
1178011813

11814+
// Returns a pointer to the underlying variant's property, if present.
11815+
func (u ToolUnionParam) GetServerDescription() *string {
11816+
if vt := u.OfMcp; vt != nil && vt.ServerDescription.Valid() {
11817+
return &vt.ServerDescription.Value
11818+
}
11819+
return nil
11820+
}
11821+
1178111822
// Returns a pointer to the underlying variant's property, if present.
1178211823
func (u ToolUnionParam) GetContainer() *ToolCodeInterpreterContainerUnionParam {
1178311824
if vt := u.OfCodeInterpreter; vt != nil {
@@ -11905,6 +11946,8 @@ type ToolMcpParam struct {
1190511946
ServerLabel string `json:"server_label,required"`
1190611947
// The URL for the MCP server.
1190711948
ServerURL string `json:"server_url,required"`
11949+
// Optional description of the MCP server, used to provide more context.
11950+
ServerDescription param.Opt[string] `json:"server_description,omitzero"`
1190811951
// List of allowed tool names or a filter object.
1190911952
AllowedTools ToolMcpAllowedToolsUnionParam `json:"allowed_tools,omitzero"`
1191011953
// Optional HTTP headers to send to the MCP server. Use for authentication or other

shared/constant/constants.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ type ResponseImageGenerationCallInProgress string // Always "response.image_ge
128128
type ResponseImageGenerationCallPartialImage string // Always "response.image_generation_call.partial_image"
129129
type ResponseInProgress string // Always "response.in_progress"
130130
type ResponseIncomplete string // Always "response.incomplete"
131-
type ResponseMcpCallArgumentsDelta string // Always "response.mcp_call.arguments_delta"
132-
type ResponseMcpCallArgumentsDone string // Always "response.mcp_call.arguments_done"
131+
type ResponseMcpCallArgumentsDelta string // Always "response.mcp_call_arguments.delta"
132+
type ResponseMcpCallArgumentsDone string // Always "response.mcp_call_arguments.done"
133133
type ResponseMcpCallCompleted string // Always "response.mcp_call.completed"
134134
type ResponseMcpCallFailed string // Always "response.mcp_call.failed"
135135
type ResponseMcpCallInProgress string // Always "response.mcp_call.in_progress"
@@ -138,7 +138,7 @@ type ResponseMcpListToolsFailed string // Always "response.mcp_list
138138
type ResponseMcpListToolsInProgress string // Always "response.mcp_list_tools.in_progress"
139139
type ResponseOutputItemAdded string // Always "response.output_item.added"
140140
type ResponseOutputItemDone string // Always "response.output_item.done"
141-
type ResponseOutputTextAnnotationAdded string // Always "response.output_text_annotation.added"
141+
type ResponseOutputTextAnnotationAdded string // Always "response.output_text.annotation.added"
142142
type ResponseOutputTextDelta string // Always "response.output_text.delta"
143143
type ResponseOutputTextDone string // Always "response.output_text.done"
144144
type ResponseQueued string // Always "response.queued"
@@ -366,10 +366,10 @@ func (c ResponseImageGenerationCallPartialImage) Default() ResponseImageGenerati
366366
func (c ResponseInProgress) Default() ResponseInProgress { return "response.in_progress" }
367367
func (c ResponseIncomplete) Default() ResponseIncomplete { return "response.incomplete" }
368368
func (c ResponseMcpCallArgumentsDelta) Default() ResponseMcpCallArgumentsDelta {
369-
return "response.mcp_call.arguments_delta"
369+
return "response.mcp_call_arguments.delta"
370370
}
371371
func (c ResponseMcpCallArgumentsDone) Default() ResponseMcpCallArgumentsDone {
372-
return "response.mcp_call.arguments_done"
372+
return "response.mcp_call_arguments.done"
373373
}
374374
func (c ResponseMcpCallCompleted) Default() ResponseMcpCallCompleted {
375375
return "response.mcp_call.completed"
@@ -392,7 +392,7 @@ func (c ResponseOutputItemAdded) Default() ResponseOutputItemAdded {
392392
}
393393
func (c ResponseOutputItemDone) Default() ResponseOutputItemDone { return "response.output_item.done" }
394394
func (c ResponseOutputTextAnnotationAdded) Default() ResponseOutputTextAnnotationAdded {
395-
return "response.output_text_annotation.added"
395+
return "response.output_text.annotation.added"
396396
}
397397
func (c ResponseOutputTextDelta) Default() ResponseOutputTextDelta {
398398
return "response.output_text.delta"

0 commit comments

Comments
 (0)