Skip to content

Commit 1dc8887

Browse files
feat(api): add o3-mini (#195)
fix(types): correct metadata type + other fixes
1 parent 4a905a7 commit 1dc8887

24 files changed

+303
-167
lines changed

.stats.yml

+1-1
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-3904ef6b29a89c98f93a9b7da19879695f3c440564be6384db7af1b734611ede.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-6204952a29973265b9c0d66fc67ffaf53c6a90ae4d75cdacf9d147676f5274c9.yml

aliases.go

+20
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,26 @@ type FunctionDefinitionParam = shared.FunctionDefinitionParam
2929
// This is an alias to an internal type.
3030
type FunctionParameters = shared.FunctionParameters
3131

32+
// Set of 16 key-value pairs that can be attached to an object. This can be useful
33+
// for storing additional information about the object in a structured format, and
34+
// querying for objects via API or the dashboard.
35+
//
36+
// Keys are strings with a maximum length of 64 characters. Values are strings with
37+
// a maximum length of 512 characters.
38+
//
39+
// This is an alias to an internal type.
40+
type Metadata = shared.Metadata
41+
42+
// Set of 16 key-value pairs that can be attached to an object. This can be useful
43+
// for storing additional information about the object in a structured format, and
44+
// querying for objects via API or the dashboard.
45+
//
46+
// Keys are strings with a maximum length of 64 characters. Values are strings with
47+
// a maximum length of 512 characters.
48+
//
49+
// This is an alias to an internal type.
50+
type MetadataParam = shared.MetadataParam
51+
3252
// This is an alias to an internal type.
3353
type ResponseFormatJSONObjectParam = shared.ResponseFormatJSONObjectParam
3454

api.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- <a href="https://pkg.go.dev/github.com/openai/openai-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/shared#FunctionDefinitionParam">FunctionDefinitionParam</a>
44
- <a href="https://pkg.go.dev/github.com/openai/openai-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/shared#FunctionParameters">FunctionParameters</a>
5+
- <a href="https://pkg.go.dev/github.com/openai/openai-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/shared#MetadataParam">MetadataParam</a>
56
- <a href="https://pkg.go.dev/github.com/openai/openai-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/shared#ResponseFormatJSONObjectParam">ResponseFormatJSONObjectParam</a>
67
- <a href="https://pkg.go.dev/github.com/openai/openai-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/shared#ResponseFormatJSONSchemaParam">ResponseFormatJSONSchemaParam</a>
78
- <a href="https://pkg.go.dev/github.com/openai/openai-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/shared#ResponseFormatTextParam">ResponseFormatTextParam</a>
@@ -11,6 +12,7 @@
1112
- <a href="https://pkg.go.dev/github.com/openai/openai-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/shared#ErrorObject">ErrorObject</a>
1213
- <a href="https://pkg.go.dev/github.com/openai/openai-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/shared#FunctionDefinition">FunctionDefinition</a>
1314
- <a href="https://pkg.go.dev/github.com/openai/openai-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/shared#FunctionParameters">FunctionParameters</a>
15+
- <a href="https://pkg.go.dev/github.com/openai/openai-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/shared#Metadata">Metadata</a>
1416

1517
# Completions
1618

audiotranscription.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ type AudioTranscriptionNewParams struct {
7474
// Whisper V2 model) is currently available.
7575
Model param.Field[AudioModel] `json:"model,required"`
7676
// The language of the input audio. Supplying the input language in
77-
// [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will
78-
// improve accuracy and latency.
77+
// [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
78+
// format will improve accuracy and latency.
7979
Language param.Field[string] `json:"language"`
8080
// An optional text to guide the model's style or continue a previous audio
8181
// segment. The

batch.go

+14-6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/openai/openai-go/internal/requestconfig"
1616
"github.com/openai/openai-go/option"
1717
"github.com/openai/openai-go/packages/pagination"
18+
"github.com/openai/openai-go/shared"
1819
)
1920

2021
// BatchService contains methods and other services that help with interacting with
@@ -127,10 +128,12 @@ type Batch struct {
127128
// The Unix timestamp (in seconds) for when the batch started processing.
128129
InProgressAt int64 `json:"in_progress_at"`
129130
// Set of 16 key-value pairs that can be attached to an object. This can be useful
130-
// for storing additional information about the object in a structured format. Keys
131-
// can be a maximum of 64 characters long and values can be a maximum of 512
132-
// characters long.
133-
Metadata interface{} `json:"metadata,nullable"`
131+
// for storing additional information about the object in a structured format, and
132+
// querying for objects via API or the dashboard.
133+
//
134+
// Keys are strings with a maximum length of 64 characters. Values are strings with
135+
// a maximum length of 512 characters.
136+
Metadata shared.Metadata `json:"metadata,nullable"`
134137
// The ID of the file containing the outputs of successfully executed requests.
135138
OutputFileID string `json:"output_file_id"`
136139
// The request counts for different statuses within the batch.
@@ -310,8 +313,13 @@ type BatchNewParams struct {
310313
// and must be uploaded with the purpose `batch`. The file can contain up to 50,000
311314
// requests, and can be up to 200 MB in size.
312315
InputFileID param.Field[string] `json:"input_file_id,required"`
313-
// Optional custom metadata for the batch.
314-
Metadata param.Field[map[string]string] `json:"metadata"`
316+
// Set of 16 key-value pairs that can be attached to an object. This can be useful
317+
// for storing additional information about the object in a structured format, and
318+
// querying for objects via API or the dashboard.
319+
//
320+
// Keys are strings with a maximum length of 64 characters. Values are strings with
321+
// a maximum length of 512 characters.
322+
Metadata param.Field[shared.MetadataParam] `json:"metadata"`
315323
}
316324

317325
func (r BatchNewParams) MarshalJSON() (data []byte, err error) {

batch_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/openai/openai-go"
1212
"github.com/openai/openai-go/internal/testutil"
1313
"github.com/openai/openai-go/option"
14+
"github.com/openai/openai-go/shared"
1415
)
1516

1617
func TestBatchNewWithOptionalParams(t *testing.T) {
@@ -29,7 +30,7 @@ func TestBatchNewWithOptionalParams(t *testing.T) {
2930
CompletionWindow: openai.F(openai.BatchNewParamsCompletionWindow24h),
3031
Endpoint: openai.F(openai.BatchNewParamsEndpointV1ChatCompletions),
3132
InputFileID: openai.F("input_file_id"),
32-
Metadata: openai.F(map[string]string{
33+
Metadata: openai.F(shared.MetadataParam{
3334
"foo": "string",
3435
}),
3536
})

betaassistant.go

+25-17
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,12 @@ type Assistant struct {
122122
// characters.
123123
Instructions string `json:"instructions,required,nullable"`
124124
// Set of 16 key-value pairs that can be attached to an object. This can be useful
125-
// for storing additional information about the object in a structured format. Keys
126-
// can be a maximum of 64 characters long and values can be a maximum of 512
127-
// characters long.
128-
Metadata interface{} `json:"metadata,required,nullable"`
125+
// for storing additional information about the object in a structured format, and
126+
// querying for objects via API or the dashboard.
127+
//
128+
// Keys are strings with a maximum length of 64 characters. Values are strings with
129+
// a maximum length of 512 characters.
130+
Metadata shared.Metadata `json:"metadata,required,nullable"`
129131
// ID of the model to use. You can use the
130132
// [List models](https://platform.openai.com/docs/api-reference/models/list) API to
131133
// see all of your available models, or see our
@@ -2072,10 +2074,12 @@ type BetaAssistantNewParams struct {
20722074
// characters.
20732075
Instructions param.Field[string] `json:"instructions"`
20742076
// Set of 16 key-value pairs that can be attached to an object. This can be useful
2075-
// for storing additional information about the object in a structured format. Keys
2076-
// can be a maximum of 64 characters long and values can be a maximum of 512
2077-
// characters long.
2078-
Metadata param.Field[interface{}] `json:"metadata"`
2077+
// for storing additional information about the object in a structured format, and
2078+
// querying for objects via API or the dashboard.
2079+
//
2080+
// Keys are strings with a maximum length of 64 characters. Values are strings with
2081+
// a maximum length of 512 characters.
2082+
Metadata param.Field[shared.MetadataParam] `json:"metadata"`
20792083
// The name of the assistant. The maximum length is 256 characters.
20802084
Name param.Field[string] `json:"name"`
20812085
// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
@@ -2152,11 +2156,13 @@ type BetaAssistantNewParamsToolResourcesFileSearchVectorStore struct {
21522156
// add to the vector store. There can be a maximum of 10000 files in a vector
21532157
// store.
21542158
FileIDs param.Field[[]string] `json:"file_ids"`
2155-
// Set of 16 key-value pairs that can be attached to a vector store. This can be
2156-
// useful for storing additional information about the vector store in a structured
2157-
// format. Keys can be a maximum of 64 characters long and values can be a maximum
2158-
// of 512 characters long.
2159-
Metadata param.Field[interface{}] `json:"metadata"`
2159+
// Set of 16 key-value pairs that can be attached to an object. This can be useful
2160+
// for storing additional information about the object in a structured format, and
2161+
// querying for objects via API or the dashboard.
2162+
//
2163+
// Keys are strings with a maximum length of 64 characters. Values are strings with
2164+
// a maximum length of 512 characters.
2165+
Metadata param.Field[shared.MetadataParam] `json:"metadata"`
21602166
}
21612167

21622168
func (r BetaAssistantNewParamsToolResourcesFileSearchVectorStore) MarshalJSON() (data []byte, err error) {
@@ -2170,10 +2176,12 @@ type BetaAssistantUpdateParams struct {
21702176
// characters.
21712177
Instructions param.Field[string] `json:"instructions"`
21722178
// Set of 16 key-value pairs that can be attached to an object. This can be useful
2173-
// for storing additional information about the object in a structured format. Keys
2174-
// can be a maximum of 64 characters long and values can be a maximum of 512
2175-
// characters long.
2176-
Metadata param.Field[interface{}] `json:"metadata"`
2179+
// for storing additional information about the object in a structured format, and
2180+
// querying for objects via API or the dashboard.
2181+
//
2182+
// Keys are strings with a maximum length of 64 characters. Values are strings with
2183+
// a maximum length of 512 characters.
2184+
Metadata param.Field[shared.MetadataParam] `json:"metadata"`
21772185
// ID of the model to use. You can use the
21782186
// [List models](https://platform.openai.com/docs/api-reference/models/list) API to
21792187
// see all of your available models, or see our

betaassistant_test.go

+17-10
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/openai/openai-go"
1212
"github.com/openai/openai-go/internal/testutil"
1313
"github.com/openai/openai-go/option"
14+
"github.com/openai/openai-go/shared"
1415
)
1516

1617
func TestBetaAssistantNewWithOptionalParams(t *testing.T) {
@@ -26,12 +27,14 @@ func TestBetaAssistantNewWithOptionalParams(t *testing.T) {
2627
option.WithAPIKey("My API Key"),
2728
)
2829
_, err := client.Beta.Assistants.New(context.TODO(), openai.BetaAssistantNewParams{
29-
Model: openai.F(openai.ChatModelO1),
30+
Model: openai.F(openai.ChatModelO3Mini),
3031
Description: openai.F("description"),
3132
Instructions: openai.F("instructions"),
32-
Metadata: openai.F[any](map[string]interface{}{}),
33-
Name: openai.F("name"),
34-
Temperature: openai.F(1.000000),
33+
Metadata: openai.F(shared.MetadataParam{
34+
"foo": "string",
35+
}),
36+
Name: openai.F("name"),
37+
Temperature: openai.F(1.000000),
3538
ToolResources: openai.F(openai.BetaAssistantNewParamsToolResources{
3639
CodeInterpreter: openai.F(openai.BetaAssistantNewParamsToolResourcesCodeInterpreter{
3740
FileIDs: openai.F([]string{"string"}),
@@ -42,8 +45,10 @@ func TestBetaAssistantNewWithOptionalParams(t *testing.T) {
4245
ChunkingStrategy: openai.F[openai.FileChunkingStrategyParamUnion](openai.AutoFileChunkingStrategyParam{
4346
Type: openai.F(openai.AutoFileChunkingStrategyParamTypeAuto),
4447
}),
45-
FileIDs: openai.F([]string{"string"}),
46-
Metadata: openai.F[any](map[string]interface{}{}),
48+
FileIDs: openai.F([]string{"string"}),
49+
Metadata: openai.F(shared.MetadataParam{
50+
"foo": "string",
51+
}),
4752
}}),
4853
}),
4954
}),
@@ -101,10 +106,12 @@ func TestBetaAssistantUpdateWithOptionalParams(t *testing.T) {
101106
openai.BetaAssistantUpdateParams{
102107
Description: openai.F("description"),
103108
Instructions: openai.F("instructions"),
104-
Metadata: openai.F[any](map[string]interface{}{}),
105-
Model: openai.F("model"),
106-
Name: openai.F("name"),
107-
Temperature: openai.F(1.000000),
109+
Metadata: openai.F(shared.MetadataParam{
110+
"foo": "string",
111+
}),
112+
Model: openai.F("model"),
113+
Name: openai.F("name"),
114+
Temperature: openai.F(1.000000),
108115
ToolResources: openai.F(openai.BetaAssistantUpdateParamsToolResources{
109116
CodeInterpreter: openai.F(openai.BetaAssistantUpdateParamsToolResourcesCodeInterpreter{
110117
FileIDs: openai.F([]string{"string"}),

0 commit comments

Comments
 (0)