diff --git a/.stats.yml b/.stats.yml index 36f4b581..9a2cd3b2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-3904ef6b29a89c98f93a9b7da19879695f3c440564be6384db7af1b734611ede.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-6204952a29973265b9c0d66fc67ffaf53c6a90ae4d75cdacf9d147676f5274c9.yml diff --git a/README.md b/README.md index a08f70dc..cf51db03 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ func main() { Role: openai.F(openai.ChatCompletionUserMessageParamRoleUser), Content: openai.F([]openai.ChatCompletionContentPartUnionParam{openai.ChatCompletionContentPartTextParam{Text: openai.F("text"), Type: openai.F(openai.ChatCompletionContentPartTextTypeText)}}), }}), - Model: openai.F(openai.ChatModelO1), + Model: openai.F(openai.ChatModelO3Mini), }) if err != nil { panic(err.Error()) @@ -240,7 +240,7 @@ client.Chat.Completions.New( Role: openai.F(openai.ChatCompletionUserMessageParamRoleUser), Content: openai.F([]openai.ChatCompletionContentPartUnionParam{openai.ChatCompletionContentPartTextParam{Text: openai.F("text"), Type: openai.F(openai.ChatCompletionContentPartTextTypeText)}}), }}), - Model: openai.F(openai.ChatModelO1), + Model: openai.F(openai.ChatModelO3Mini), }, // This sets the per-retry timeout option.WithRequestTimeout(20*time.Second), @@ -303,7 +303,7 @@ client.Chat.Completions.New( Role: openai.F(openai.ChatCompletionUserMessageParamRoleUser), Content: openai.F([]openai.ChatCompletionContentPartUnionParam{openai.ChatCompletionContentPartTextParam{Text: openai.F("text"), Type: openai.F(openai.ChatCompletionContentPartTextTypeText)}}), }}), - Model: openai.F(openai.ChatModelO1), + Model: openai.F(openai.ChatModelO3Mini), }, option.WithMaxRetries(5), ) diff --git a/aliases.go b/aliases.go index 26737f46..eae9b385 100644 --- a/aliases.go +++ b/aliases.go @@ -29,6 +29,26 @@ type FunctionDefinitionParam = shared.FunctionDefinitionParam // This is an alias to an internal type. type FunctionParameters = shared.FunctionParameters +// Set of 16 key-value pairs that can be attached to an object. This can be useful +// for storing additional information about the object in a structured format, and +// querying for objects via API or the dashboard. +// +// Keys are strings with a maximum length of 64 characters. Values are strings with +// a maximum length of 512 characters. +// +// This is an alias to an internal type. +type Metadata = shared.Metadata + +// Set of 16 key-value pairs that can be attached to an object. This can be useful +// for storing additional information about the object in a structured format, and +// querying for objects via API or the dashboard. +// +// Keys are strings with a maximum length of 64 characters. Values are strings with +// a maximum length of 512 characters. +// +// This is an alias to an internal type. +type MetadataParam = shared.MetadataParam + // This is an alias to an internal type. type ResponseFormatJSONObjectParam = shared.ResponseFormatJSONObjectParam diff --git a/api.md b/api.md index 7fd6c67f..18eae07d 100644 --- a/api.md +++ b/api.md @@ -2,6 +2,7 @@ - shared.FunctionDefinitionParam - shared.FunctionParameters +- shared.MetadataParam - shared.ResponseFormatJSONObjectParam - shared.ResponseFormatJSONSchemaParam - shared.ResponseFormatTextParam @@ -11,6 +12,7 @@ - shared.ErrorObject - shared.FunctionDefinition - shared.FunctionParameters +- shared.Metadata # Completions diff --git a/audiotranscription.go b/audiotranscription.go index 483b0d11..15f5bd6a 100644 --- a/audiotranscription.go +++ b/audiotranscription.go @@ -74,8 +74,8 @@ type AudioTranscriptionNewParams struct { // Whisper V2 model) is currently available. 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. + // [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) + // format will improve accuracy and latency. Language param.Field[string] `json:"language"` // An optional text to guide the model's style or continue a previous audio // segment. The diff --git a/batch.go b/batch.go index 7becfa86..1930340d 100644 --- a/batch.go +++ b/batch.go @@ -15,6 +15,7 @@ import ( "github.com/openai/openai-go/internal/requestconfig" "github.com/openai/openai-go/option" "github.com/openai/openai-go/packages/pagination" + "github.com/openai/openai-go/shared" ) // BatchService contains methods and other services that help with interacting with @@ -127,10 +128,12 @@ type Batch struct { // The Unix timestamp (in seconds) for when the batch started processing. InProgressAt int64 `json:"in_progress_at"` // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata interface{} `json:"metadata,nullable"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata shared.Metadata `json:"metadata,nullable"` // The ID of the file containing the outputs of successfully executed requests. OutputFileID string `json:"output_file_id"` // The request counts for different statuses within the batch. @@ -310,8 +313,13 @@ type BatchNewParams struct { // and must be uploaded with the purpose `batch`. The file can contain up to 50,000 // requests, and can be up to 200 MB in size. InputFileID param.Field[string] `json:"input_file_id,required"` - // Optional custom metadata for the batch. - Metadata param.Field[map[string]string] `json:"metadata"` + // Set of 16 key-value pairs that can be attached to an object. This can be useful + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata param.Field[shared.MetadataParam] `json:"metadata"` } func (r BatchNewParams) MarshalJSON() (data []byte, err error) { diff --git a/batch_test.go b/batch_test.go index 86272d5f..6b8ecd4f 100644 --- a/batch_test.go +++ b/batch_test.go @@ -11,6 +11,7 @@ import ( "github.com/openai/openai-go" "github.com/openai/openai-go/internal/testutil" "github.com/openai/openai-go/option" + "github.com/openai/openai-go/shared" ) func TestBatchNewWithOptionalParams(t *testing.T) { @@ -29,7 +30,7 @@ func TestBatchNewWithOptionalParams(t *testing.T) { CompletionWindow: openai.F(openai.BatchNewParamsCompletionWindow24h), Endpoint: openai.F(openai.BatchNewParamsEndpointV1ChatCompletions), InputFileID: openai.F("input_file_id"), - Metadata: openai.F(map[string]string{ + Metadata: openai.F(shared.MetadataParam{ "foo": "string", }), }) diff --git a/betaassistant.go b/betaassistant.go index 4b2aee79..34373bc7 100644 --- a/betaassistant.go +++ b/betaassistant.go @@ -122,10 +122,12 @@ type Assistant struct { // characters. Instructions string `json:"instructions,required,nullable"` // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata interface{} `json:"metadata,required,nullable"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata shared.Metadata `json:"metadata,required,nullable"` // ID of the model to use. You can use the // [List models](https://platform.openai.com/docs/api-reference/models/list) API to // see all of your available models, or see our @@ -2072,10 +2074,12 @@ type BetaAssistantNewParams struct { // characters. Instructions param.Field[string] `json:"instructions"` // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata param.Field[interface{}] `json:"metadata"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata param.Field[shared.MetadataParam] `json:"metadata"` // The name of the assistant. The maximum length is 256 characters. Name param.Field[string] `json:"name"` // What sampling temperature to use, between 0 and 2. Higher values like 0.8 will @@ -2152,11 +2156,13 @@ type BetaAssistantNewParamsToolResourcesFileSearchVectorStore struct { // add to the vector store. There can be a maximum of 10000 files in a vector // store. FileIDs param.Field[[]string] `json:"file_ids"` - // Set of 16 key-value pairs that can be attached to a vector store. This can be - // useful for storing additional information about the vector store in a structured - // format. Keys can be a maximum of 64 characters long and values can be a maximum - // of 512 characters long. - Metadata param.Field[interface{}] `json:"metadata"` + // Set of 16 key-value pairs that can be attached to an object. This can be useful + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata param.Field[shared.MetadataParam] `json:"metadata"` } func (r BetaAssistantNewParamsToolResourcesFileSearchVectorStore) MarshalJSON() (data []byte, err error) { @@ -2170,10 +2176,12 @@ type BetaAssistantUpdateParams struct { // characters. Instructions param.Field[string] `json:"instructions"` // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata param.Field[interface{}] `json:"metadata"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata param.Field[shared.MetadataParam] `json:"metadata"` // ID of the model to use. You can use the // [List models](https://platform.openai.com/docs/api-reference/models/list) API to // see all of your available models, or see our diff --git a/betaassistant_test.go b/betaassistant_test.go index 8885f274..9600fdfc 100644 --- a/betaassistant_test.go +++ b/betaassistant_test.go @@ -11,6 +11,7 @@ import ( "github.com/openai/openai-go" "github.com/openai/openai-go/internal/testutil" "github.com/openai/openai-go/option" + "github.com/openai/openai-go/shared" ) func TestBetaAssistantNewWithOptionalParams(t *testing.T) { @@ -26,12 +27,14 @@ func TestBetaAssistantNewWithOptionalParams(t *testing.T) { option.WithAPIKey("My API Key"), ) _, err := client.Beta.Assistants.New(context.TODO(), openai.BetaAssistantNewParams{ - Model: openai.F(openai.ChatModelO1), + Model: openai.F(openai.ChatModelO3Mini), Description: openai.F("description"), Instructions: openai.F("instructions"), - Metadata: openai.F[any](map[string]interface{}{}), - Name: openai.F("name"), - Temperature: openai.F(1.000000), + Metadata: openai.F(shared.MetadataParam{ + "foo": "string", + }), + Name: openai.F("name"), + Temperature: openai.F(1.000000), ToolResources: openai.F(openai.BetaAssistantNewParamsToolResources{ CodeInterpreter: openai.F(openai.BetaAssistantNewParamsToolResourcesCodeInterpreter{ FileIDs: openai.F([]string{"string"}), @@ -42,8 +45,10 @@ func TestBetaAssistantNewWithOptionalParams(t *testing.T) { ChunkingStrategy: openai.F[openai.FileChunkingStrategyParamUnion](openai.AutoFileChunkingStrategyParam{ Type: openai.F(openai.AutoFileChunkingStrategyParamTypeAuto), }), - FileIDs: openai.F([]string{"string"}), - Metadata: openai.F[any](map[string]interface{}{}), + FileIDs: openai.F([]string{"string"}), + Metadata: openai.F(shared.MetadataParam{ + "foo": "string", + }), }}), }), }), @@ -101,10 +106,12 @@ func TestBetaAssistantUpdateWithOptionalParams(t *testing.T) { openai.BetaAssistantUpdateParams{ Description: openai.F("description"), Instructions: openai.F("instructions"), - Metadata: openai.F[any](map[string]interface{}{}), - Model: openai.F("model"), - Name: openai.F("name"), - Temperature: openai.F(1.000000), + Metadata: openai.F(shared.MetadataParam{ + "foo": "string", + }), + Model: openai.F("model"), + Name: openai.F("name"), + Temperature: openai.F(1.000000), ToolResources: openai.F(openai.BetaAssistantUpdateParamsToolResources{ CodeInterpreter: openai.F(openai.BetaAssistantUpdateParamsToolResourcesCodeInterpreter{ FileIDs: openai.F([]string{"string"}), diff --git a/betathread.go b/betathread.go index b5a98843..88a9d180 100644 --- a/betathread.go +++ b/betathread.go @@ -274,10 +274,12 @@ type Thread struct { // The Unix timestamp (in seconds) for when the thread was created. CreatedAt int64 `json:"created_at,required"` // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata interface{} `json:"metadata,required,nullable"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata shared.Metadata `json:"metadata,required,nullable"` // The object type, which is always `thread`. Object ThreadObject `json:"object,required"` // A set of resources that are made available to the assistant's tools in this @@ -441,10 +443,12 @@ type BetaThreadNewParams struct { // start the thread with. Messages param.Field[[]BetaThreadNewParamsMessage] `json:"messages"` // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata param.Field[interface{}] `json:"metadata"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata param.Field[shared.MetadataParam] `json:"metadata"` // A set of resources that are made available to the assistant's tools in this // thread. 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` @@ -472,10 +476,12 @@ type BetaThreadNewParamsMessage struct { // A list of files attached to the message, and the tools they should be added to. Attachments param.Field[[]BetaThreadNewParamsMessagesAttachment] `json:"attachments"` // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata param.Field[interface{}] `json:"metadata"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata param.Field[shared.MetadataParam] `json:"metadata"` } func (r BetaThreadNewParamsMessage) MarshalJSON() (data []byte, err error) { @@ -625,11 +631,13 @@ type BetaThreadNewParamsToolResourcesFileSearchVectorStore struct { // add to the vector store. There can be a maximum of 10000 files in a vector // store. FileIDs param.Field[[]string] `json:"file_ids"` - // Set of 16 key-value pairs that can be attached to a vector store. This can be - // useful for storing additional information about the vector store in a structured - // format. Keys can be a maximum of 64 characters long and values can be a maximum - // of 512 characters long. - Metadata param.Field[interface{}] `json:"metadata"` + // Set of 16 key-value pairs that can be attached to an object. This can be useful + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata param.Field[shared.MetadataParam] `json:"metadata"` } func (r BetaThreadNewParamsToolResourcesFileSearchVectorStore) MarshalJSON() (data []byte, err error) { @@ -638,10 +646,12 @@ func (r BetaThreadNewParamsToolResourcesFileSearchVectorStore) MarshalJSON() (da type BetaThreadUpdateParams struct { // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata param.Field[interface{}] `json:"metadata"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata param.Field[shared.MetadataParam] `json:"metadata"` // A set of resources that are made available to the assistant's tools in this // thread. 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` @@ -710,10 +720,12 @@ type BetaThreadNewAndRunParams struct { // `incomplete_details` for more info. MaxPromptTokens param.Field[int64] `json:"max_prompt_tokens"` // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata param.Field[interface{}] `json:"metadata"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata param.Field[shared.MetadataParam] `json:"metadata"` // The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to // 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 @@ -727,7 +739,8 @@ type BetaThreadNewAndRunParams struct { // make the output more random, while lower values like 0.2 will make it more // focused and deterministic. Temperature param.Field[float64] `json:"temperature"` - // If no thread is provided, an empty thread will be created. + // Options to create a new thread. If no thread is provided when running a request, + // an empty thread will be created. Thread param.Field[BetaThreadNewAndRunParamsThread] `json:"thread"` // Controls which (if any) tool is called by the model. `none` means the model will // not call any tools and instead generates a message. `auto` is the default value @@ -760,16 +773,19 @@ func (r BetaThreadNewAndRunParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// If no thread is provided, an empty thread will be created. +// Options to create a new thread. If no thread is provided when running a request, +// an empty thread will be created. type BetaThreadNewAndRunParamsThread struct { // A list of [messages](https://platform.openai.com/docs/api-reference/messages) to // start the thread with. Messages param.Field[[]BetaThreadNewAndRunParamsThreadMessage] `json:"messages"` // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata param.Field[interface{}] `json:"metadata"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata param.Field[shared.MetadataParam] `json:"metadata"` // A set of resources that are made available to the assistant's tools in this // thread. 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` @@ -797,10 +813,12 @@ type BetaThreadNewAndRunParamsThreadMessage struct { // A list of files attached to the message, and the tools they should be added to. Attachments param.Field[[]BetaThreadNewAndRunParamsThreadMessagesAttachment] `json:"attachments"` // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata param.Field[interface{}] `json:"metadata"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata param.Field[shared.MetadataParam] `json:"metadata"` } func (r BetaThreadNewAndRunParamsThreadMessage) MarshalJSON() (data []byte, err error) { @@ -950,11 +968,13 @@ type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStore struct { // add to the vector store. There can be a maximum of 10000 files in a vector // store. FileIDs param.Field[[]string] `json:"file_ids"` - // Set of 16 key-value pairs that can be attached to a vector store. This can be - // useful for storing additional information about the vector store in a structured - // format. Keys can be a maximum of 64 characters long and values can be a maximum - // of 512 characters long. - Metadata param.Field[interface{}] `json:"metadata"` + // Set of 16 key-value pairs that can be attached to an object. This can be useful + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata param.Field[shared.MetadataParam] `json:"metadata"` } func (r BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStore) MarshalJSON() (data []byte, err error) { diff --git a/betathread_test.go b/betathread_test.go index a9a3ef83..b3f0cc86 100644 --- a/betathread_test.go +++ b/betathread_test.go @@ -11,6 +11,7 @@ import ( "github.com/openai/openai-go" "github.com/openai/openai-go/internal/testutil" "github.com/openai/openai-go/option" + "github.com/openai/openai-go/shared" ) func TestBetaThreadNewWithOptionalParams(t *testing.T) { @@ -35,9 +36,13 @@ func TestBetaThreadNewWithOptionalParams(t *testing.T) { Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), }}), }}), - Metadata: openai.F[any](map[string]interface{}{}), + Metadata: openai.F(shared.MetadataParam{ + "foo": "string", + }), }}), - Metadata: openai.F[any](map[string]interface{}{}), + Metadata: openai.F(shared.MetadataParam{ + "foo": "string", + }), ToolResources: openai.F(openai.BetaThreadNewParamsToolResources{ CodeInterpreter: openai.F(openai.BetaThreadNewParamsToolResourcesCodeInterpreter{ FileIDs: openai.F([]string{"string"}), @@ -48,8 +53,10 @@ func TestBetaThreadNewWithOptionalParams(t *testing.T) { ChunkingStrategy: openai.F[openai.FileChunkingStrategyParamUnion](openai.AutoFileChunkingStrategyParam{ Type: openai.F(openai.AutoFileChunkingStrategyParamTypeAuto), }), - FileIDs: openai.F([]string{"string"}), - Metadata: openai.F[any](map[string]interface{}{}), + FileIDs: openai.F([]string{"string"}), + Metadata: openai.F(shared.MetadataParam{ + "foo": "string", + }), }}), }), }), @@ -101,7 +108,9 @@ func TestBetaThreadUpdateWithOptionalParams(t *testing.T) { context.TODO(), "thread_id", openai.BetaThreadUpdateParams{ - Metadata: openai.F[any](map[string]interface{}{}), + Metadata: openai.F(shared.MetadataParam{ + "foo": "string", + }), ToolResources: openai.F(openai.BetaThreadUpdateParamsToolResources{ CodeInterpreter: openai.F(openai.BetaThreadUpdateParamsToolResourcesCodeInterpreter{ FileIDs: openai.F([]string{"string"}), @@ -160,10 +169,12 @@ func TestBetaThreadNewAndRunWithOptionalParams(t *testing.T) { Instructions: openai.F("instructions"), MaxCompletionTokens: openai.F(int64(256)), MaxPromptTokens: openai.F(int64(256)), - Metadata: openai.F[any](map[string]interface{}{}), - Model: openai.F(openai.ChatModelO1), - ParallelToolCalls: openai.F(true), - Temperature: openai.F(1.000000), + Metadata: openai.F(shared.MetadataParam{ + "foo": "string", + }), + Model: openai.F(openai.ChatModelO3Mini), + ParallelToolCalls: openai.F(true), + Temperature: openai.F(1.000000), Thread: openai.F(openai.BetaThreadNewAndRunParamsThread{ Messages: openai.F([]openai.BetaThreadNewAndRunParamsThreadMessage{{ Content: openai.F([]openai.MessageContentPartParamUnion{openai.ImageFileContentBlockParam{ImageFile: openai.F(openai.ImageFileParam{FileID: openai.F("file_id"), Detail: openai.F(openai.ImageFileDetailAuto)}), Type: openai.F(openai.ImageFileContentBlockTypeImageFile)}}), @@ -174,9 +185,13 @@ func TestBetaThreadNewAndRunWithOptionalParams(t *testing.T) { Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), }}), }}), - Metadata: openai.F[any](map[string]interface{}{}), + Metadata: openai.F(shared.MetadataParam{ + "foo": "string", + }), }}), - Metadata: openai.F[any](map[string]interface{}{}), + Metadata: openai.F(shared.MetadataParam{ + "foo": "string", + }), ToolResources: openai.F(openai.BetaThreadNewAndRunParamsThreadToolResources{ CodeInterpreter: openai.F(openai.BetaThreadNewAndRunParamsThreadToolResourcesCodeInterpreter{ FileIDs: openai.F([]string{"string"}), @@ -187,8 +202,10 @@ func TestBetaThreadNewAndRunWithOptionalParams(t *testing.T) { ChunkingStrategy: openai.F[openai.FileChunkingStrategyParamUnion](openai.AutoFileChunkingStrategyParam{ Type: openai.F(openai.AutoFileChunkingStrategyParamTypeAuto), }), - FileIDs: openai.F([]string{"string"}), - Metadata: openai.F[any](map[string]interface{}{}), + FileIDs: openai.F([]string{"string"}), + Metadata: openai.F(shared.MetadataParam{ + "foo": "string", + }), }}), }), }), diff --git a/betathreadmessage.go b/betathreadmessage.go index 6f8f4e9d..a62d1343 100644 --- a/betathreadmessage.go +++ b/betathreadmessage.go @@ -16,6 +16,7 @@ import ( "github.com/openai/openai-go/internal/requestconfig" "github.com/openai/openai-go/option" "github.com/openai/openai-go/packages/pagination" + "github.com/openai/openai-go/shared" "github.com/tidwall/gjson" ) @@ -1050,10 +1051,12 @@ type Message struct { // On an incomplete message, details about why the message is incomplete. IncompleteDetails MessageIncompleteDetails `json:"incomplete_details,required,nullable"` // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata interface{} `json:"metadata,required,nullable"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata shared.Metadata `json:"metadata,required,nullable"` // The object type, which is always `thread.message`. Object MessageObject `json:"object,required"` // The entity that produced the message. One of `user` or `assistant`. @@ -1964,10 +1967,12 @@ type BetaThreadMessageNewParams struct { // A list of files attached to the message, and the tools they should be added to. Attachments param.Field[[]BetaThreadMessageNewParamsAttachment] `json:"attachments"` // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata param.Field[interface{}] `json:"metadata"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata param.Field[shared.MetadataParam] `json:"metadata"` } func (r BetaThreadMessageNewParams) MarshalJSON() (data []byte, err error) { @@ -2070,10 +2075,12 @@ func (r BetaThreadMessageNewParamsAttachmentsToolsType) IsKnown() bool { type BetaThreadMessageUpdateParams struct { // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata param.Field[interface{}] `json:"metadata"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata param.Field[shared.MetadataParam] `json:"metadata"` } func (r BetaThreadMessageUpdateParams) MarshalJSON() (data []byte, err error) { diff --git a/betathreadmessage_test.go b/betathreadmessage_test.go index facc3d70..9f995679 100644 --- a/betathreadmessage_test.go +++ b/betathreadmessage_test.go @@ -11,6 +11,7 @@ import ( "github.com/openai/openai-go" "github.com/openai/openai-go/internal/testutil" "github.com/openai/openai-go/option" + "github.com/openai/openai-go/shared" ) func TestBetaThreadMessageNewWithOptionalParams(t *testing.T) { @@ -37,7 +38,9 @@ func TestBetaThreadMessageNewWithOptionalParams(t *testing.T) { Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), }}), }}), - Metadata: openai.F[any](map[string]interface{}{}), + Metadata: openai.F(shared.MetadataParam{ + "foo": "string", + }), }, ) if err != nil { @@ -92,7 +95,9 @@ func TestBetaThreadMessageUpdateWithOptionalParams(t *testing.T) { "thread_id", "message_id", openai.BetaThreadMessageUpdateParams{ - Metadata: openai.F[any](map[string]interface{}{}), + Metadata: openai.F(shared.MetadataParam{ + "foo": "string", + }), }, ) if err != nil { diff --git a/betathreadrun.go b/betathreadrun.go index 058452c7..20875630 100644 --- a/betathreadrun.go +++ b/betathreadrun.go @@ -16,6 +16,7 @@ import ( "github.com/openai/openai-go/option" "github.com/openai/openai-go/packages/pagination" "github.com/openai/openai-go/packages/ssestream" + "github.com/openai/openai-go/shared" ) // BetaThreadRunService contains methods and other services that help with @@ -301,10 +302,12 @@ type Run struct { // of the run. MaxPromptTokens int64 `json:"max_prompt_tokens,required,nullable"` // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata interface{} `json:"metadata,required,nullable"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata shared.Metadata `json:"metadata,required,nullable"` // The model that the // [assistant](https://platform.openai.com/docs/api-reference/assistants) used for // this run. @@ -696,10 +699,12 @@ type BetaThreadRunNewParams struct { // `incomplete_details` for more info. MaxPromptTokens param.Field[int64] `json:"max_prompt_tokens"` // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata param.Field[interface{}] `json:"metadata"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata param.Field[shared.MetadataParam] `json:"metadata"` // The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to // 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 @@ -763,10 +768,12 @@ type BetaThreadRunNewParamsAdditionalMessage struct { // A list of files attached to the message, and the tools they should be added to. Attachments param.Field[[]BetaThreadRunNewParamsAdditionalMessagesAttachment] `json:"attachments"` // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata param.Field[interface{}] `json:"metadata"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata param.Field[shared.MetadataParam] `json:"metadata"` } func (r BetaThreadRunNewParamsAdditionalMessage) MarshalJSON() (data []byte, err error) { @@ -905,10 +912,12 @@ func (r BetaThreadRunNewParamsTruncationStrategyType) IsKnown() bool { type BetaThreadRunUpdateParams struct { // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata param.Field[interface{}] `json:"metadata"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata param.Field[shared.MetadataParam] `json:"metadata"` } func (r BetaThreadRunUpdateParams) MarshalJSON() (data []byte, err error) { diff --git a/betathreadrun_test.go b/betathreadrun_test.go index 7967ddf4..66a39aa5 100644 --- a/betathreadrun_test.go +++ b/betathreadrun_test.go @@ -11,6 +11,7 @@ import ( "github.com/openai/openai-go" "github.com/openai/openai-go/internal/testutil" "github.com/openai/openai-go/option" + "github.com/openai/openai-go/shared" ) func TestBetaThreadRunNewWithOptionalParams(t *testing.T) { @@ -41,16 +42,20 @@ func TestBetaThreadRunNewWithOptionalParams(t *testing.T) { Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), }}), }}), - Metadata: openai.F[any](map[string]interface{}{}), + Metadata: openai.F(shared.MetadataParam{ + "foo": "string", + }), }}), Instructions: openai.F("instructions"), MaxCompletionTokens: openai.F(int64(256)), MaxPromptTokens: openai.F(int64(256)), - Metadata: openai.F[any](map[string]interface{}{}), - Model: openai.F(openai.ChatModelO1), - ParallelToolCalls: openai.F(true), - Temperature: openai.F(1.000000), - ToolChoice: openai.F[openai.AssistantToolChoiceOptionUnionParam](openai.AssistantToolChoiceOptionAuto(openai.AssistantToolChoiceOptionAutoNone)), + Metadata: openai.F(shared.MetadataParam{ + "foo": "string", + }), + Model: openai.F(openai.ChatModelO3Mini), + ParallelToolCalls: openai.F(true), + Temperature: openai.F(1.000000), + ToolChoice: openai.F[openai.AssistantToolChoiceOptionUnionParam](openai.AssistantToolChoiceOptionAuto(openai.AssistantToolChoiceOptionAutoNone)), Tools: openai.F([]openai.AssistantToolUnionParam{openai.CodeInterpreterToolParam{ Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), }}), @@ -113,7 +118,9 @@ func TestBetaThreadRunUpdateWithOptionalParams(t *testing.T) { "thread_id", "run_id", openai.BetaThreadRunUpdateParams{ - Metadata: openai.F[any](map[string]interface{}{}), + Metadata: openai.F(shared.MetadataParam{ + "foo": "string", + }), }, ) if err != nil { diff --git a/betathreadrunstep.go b/betathreadrunstep.go index efa3dc70..8fdc27c5 100644 --- a/betathreadrunstep.go +++ b/betathreadrunstep.go @@ -16,6 +16,7 @@ import ( "github.com/openai/openai-go/internal/requestconfig" "github.com/openai/openai-go/option" "github.com/openai/openai-go/packages/pagination" + "github.com/openai/openai-go/shared" "github.com/tidwall/gjson" ) @@ -1127,10 +1128,12 @@ type RunStep struct { // errors. LastError RunStepLastError `json:"last_error,required,nullable"` // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata interface{} `json:"metadata,required,nullable"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata shared.Metadata `json:"metadata,required,nullable"` // The object type, which is always `thread.run.step`. Object RunStepObject `json:"object,required"` // The ID of the [run](https://platform.openai.com/docs/api-reference/runs) that diff --git a/betavectorstore.go b/betavectorstore.go index 08495df6..8f7930b8 100644 --- a/betavectorstore.go +++ b/betavectorstore.go @@ -16,6 +16,7 @@ import ( "github.com/openai/openai-go/internal/requestconfig" "github.com/openai/openai-go/option" "github.com/openai/openai-go/packages/pagination" + "github.com/openai/openai-go/shared" "github.com/tidwall/gjson" ) @@ -424,10 +425,12 @@ type VectorStore struct { // The Unix timestamp (in seconds) for when the vector store was last active. LastActiveAt int64 `json:"last_active_at,required,nullable"` // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata interface{} `json:"metadata,required,nullable"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata shared.Metadata `json:"metadata,required,nullable"` // The name of the vector store. Name string `json:"name,required"` // The object type, which is always `vector_store`. @@ -631,10 +634,12 @@ type BetaVectorStoreNewParams struct { // files. FileIDs param.Field[[]string] `json:"file_ids"` // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata param.Field[interface{}] `json:"metadata"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata param.Field[shared.MetadataParam] `json:"metadata"` // The name of the vector store. Name param.Field[string] `json:"name"` } @@ -676,10 +681,12 @@ type BetaVectorStoreUpdateParams struct { // The expiration policy for a vector store. ExpiresAfter param.Field[BetaVectorStoreUpdateParamsExpiresAfter] `json:"expires_after"` // Set of 16 key-value pairs that can be attached to an object. This can be useful - // for storing additional information about the object in a structured format. Keys - // can be a maximum of 64 characters long and values can be a maximum of 512 - // characters long. - Metadata param.Field[interface{}] `json:"metadata"` + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata param.Field[shared.MetadataParam] `json:"metadata"` // The name of the vector store. Name param.Field[string] `json:"name"` } diff --git a/betavectorstore_test.go b/betavectorstore_test.go index f19a530e..a8457654 100644 --- a/betavectorstore_test.go +++ b/betavectorstore_test.go @@ -11,6 +11,7 @@ import ( "github.com/openai/openai-go" "github.com/openai/openai-go/internal/testutil" "github.com/openai/openai-go/option" + "github.com/openai/openai-go/shared" ) func TestBetaVectorStoreNewWithOptionalParams(t *testing.T) { @@ -33,9 +34,11 @@ func TestBetaVectorStoreNewWithOptionalParams(t *testing.T) { Anchor: openai.F(openai.BetaVectorStoreNewParamsExpiresAfterAnchorLastActiveAt), Days: openai.F(int64(1)), }), - FileIDs: openai.F([]string{"string"}), - Metadata: openai.F[any](map[string]interface{}{}), - Name: openai.F("name"), + FileIDs: openai.F([]string{"string"}), + Metadata: openai.F(shared.MetadataParam{ + "foo": "string", + }), + Name: openai.F("name"), }) if err != nil { var apierr *openai.Error @@ -88,8 +91,10 @@ func TestBetaVectorStoreUpdateWithOptionalParams(t *testing.T) { Anchor: openai.F(openai.BetaVectorStoreUpdateParamsExpiresAfterAnchorLastActiveAt), Days: openai.F(int64(1)), }), - Metadata: openai.F[any](map[string]interface{}{}), - Name: openai.F("name"), + Metadata: openai.F(shared.MetadataParam{ + "foo": "string", + }), + Name: openai.F("name"), }, ) if err != nil { diff --git a/chat.go b/chat.go index 3e1d9dcb..0a050eb9 100644 --- a/chat.go +++ b/chat.go @@ -30,6 +30,8 @@ func NewChatService(opts ...option.RequestOption) (r *ChatService) { type ChatModel = string const ( + ChatModelO3Mini ChatModel = "o3-mini" + ChatModelO3Mini2025_01_31 ChatModel = "o3-mini-2025-01-31" ChatModelO1 ChatModel = "o1" ChatModelO1_2024_12_17 ChatModel = "o1-2024-12-17" ChatModelO1Preview ChatModel = "o1-preview" diff --git a/chatcompletion.go b/chatcompletion.go index 939abd84..8d9f6c49 100644 --- a/chatcompletion.go +++ b/chatcompletion.go @@ -1739,9 +1739,13 @@ type ChatCompletionNewParams struct { // compatible with // [o1 series models](https://platform.openai.com/docs/guides/reasoning). MaxTokens param.Field[int64] `json:"max_tokens"` - // Developer-defined tags and values used for filtering completions in the - // [dashboard](https://platform.openai.com/chat-completions). - Metadata param.Field[map[string]string] `json:"metadata"` + // Set of 16 key-value pairs that can be attached to an object. This can be useful + // for storing additional information about the object in a structured format, and + // querying for objects via API or the dashboard. + // + // Keys are strings with a maximum length of 64 characters. Values are strings with + // a maximum length of 512 characters. + Metadata param.Field[shared.MetadataParam] `json:"metadata"` // Output types that you would like the model to generate for this request. Most // models are capable of generating text, which is the default: // @@ -1806,9 +1810,9 @@ type ChatCompletionNewParams struct { // utilize scale tier credits until they are exhausted. // - If set to 'auto', and the Project is not Scale tier enabled, the request will // be processed using the default service tier with a lower uptime SLA and no - // latency guarentee. + // latency guarantee. // - If set to 'default', the request will be processed using the default service - // tier with a lower uptime SLA and no latency guarentee. + // tier with a lower uptime SLA and no latency guarantee. // - When not set, the default behavior is 'auto'. ServiceTier param.Field[ChatCompletionNewParamsServiceTier] `json:"service_tier"` // Up to 4 sequences where the API will stop generating further tokens. @@ -2003,9 +2007,9 @@ func (r ChatCompletionNewParamsResponseFormatType) IsKnown() bool { // utilize scale tier credits until they are exhausted. // - If set to 'auto', and the Project is not Scale tier enabled, the request will // be processed using the default service tier with a lower uptime SLA and no -// latency guarentee. +// latency guarantee. // - If set to 'default', the request will be processed using the default service -// tier with a lower uptime SLA and no latency guarentee. +// tier with a lower uptime SLA and no latency guarantee. // - When not set, the default behavior is 'auto'. type ChatCompletionNewParamsServiceTier string diff --git a/chatcompletion_test.go b/chatcompletion_test.go index 5804de9f..2248171e 100644 --- a/chatcompletion_test.go +++ b/chatcompletion_test.go @@ -32,7 +32,7 @@ func TestChatCompletionNewWithOptionalParams(t *testing.T) { Role: openai.F(openai.ChatCompletionDeveloperMessageParamRoleDeveloper), Name: openai.F("name"), }}), - Model: openai.F(openai.ChatModelO1), + Model: openai.F(openai.ChatModelO3Mini), Audio: openai.F(openai.ChatCompletionAudioParam{ Format: openai.F(openai.ChatCompletionAudioParamFormatWAV), Voice: openai.F(openai.ChatCompletionAudioParamVoiceAlloy), @@ -52,7 +52,7 @@ func TestChatCompletionNewWithOptionalParams(t *testing.T) { Logprobs: openai.F(true), MaxCompletionTokens: openai.F(int64(0)), MaxTokens: openai.F(int64(0)), - Metadata: openai.F(map[string]string{ + Metadata: openai.F(shared.MetadataParam{ "foo": "string", }), Modalities: openai.F([]openai.ChatCompletionModality{openai.ChatCompletionModalityText}), diff --git a/client_test.go b/client_test.go index 64aa9dd3..9be44326 100644 --- a/client_test.go +++ b/client_test.go @@ -42,7 +42,7 @@ func TestUserAgentHeader(t *testing.T) { Role: openai.F(openai.ChatCompletionUserMessageParamRoleUser), Content: openai.F([]openai.ChatCompletionContentPartUnionParam{openai.ChatCompletionContentPartTextParam{Text: openai.F("text"), Type: openai.F(openai.ChatCompletionContentPartTextTypeText)}}), }}), - Model: openai.F(openai.ChatModelO1), + Model: openai.F(openai.ChatModelO3Mini), }) if userAgent != fmt.Sprintf("OpenAI/Go %s", internal.PackageVersion) { t.Errorf("Expected User-Agent to be correct, but got: %#v", userAgent) @@ -71,7 +71,7 @@ func TestRetryAfter(t *testing.T) { Role: openai.F(openai.ChatCompletionUserMessageParamRoleUser), Content: openai.F([]openai.ChatCompletionContentPartUnionParam{openai.ChatCompletionContentPartTextParam{Text: openai.F("text"), Type: openai.F(openai.ChatCompletionContentPartTextTypeText)}}), }}), - Model: openai.F(openai.ChatModelO1), + Model: openai.F(openai.ChatModelO3Mini), }) if err == nil { t.Error("Expected there to be a cancel error") @@ -111,7 +111,7 @@ func TestDeleteRetryCountHeader(t *testing.T) { Role: openai.F(openai.ChatCompletionUserMessageParamRoleUser), Content: openai.F([]openai.ChatCompletionContentPartUnionParam{openai.ChatCompletionContentPartTextParam{Text: openai.F("text"), Type: openai.F(openai.ChatCompletionContentPartTextTypeText)}}), }}), - Model: openai.F(openai.ChatModelO1), + Model: openai.F(openai.ChatModelO3Mini), }) if err == nil { t.Error("Expected there to be a cancel error") @@ -146,7 +146,7 @@ func TestOverwriteRetryCountHeader(t *testing.T) { Role: openai.F(openai.ChatCompletionUserMessageParamRoleUser), Content: openai.F([]openai.ChatCompletionContentPartUnionParam{openai.ChatCompletionContentPartTextParam{Text: openai.F("text"), Type: openai.F(openai.ChatCompletionContentPartTextTypeText)}}), }}), - Model: openai.F(openai.ChatModelO1), + Model: openai.F(openai.ChatModelO3Mini), }) if err == nil { t.Error("Expected there to be a cancel error") @@ -180,7 +180,7 @@ func TestRetryAfterMs(t *testing.T) { Role: openai.F(openai.ChatCompletionUserMessageParamRoleUser), Content: openai.F([]openai.ChatCompletionContentPartUnionParam{openai.ChatCompletionContentPartTextParam{Text: openai.F("text"), Type: openai.F(openai.ChatCompletionContentPartTextTypeText)}}), }}), - Model: openai.F(openai.ChatModelO1), + Model: openai.F(openai.ChatModelO3Mini), }) if err == nil { t.Error("Expected there to be a cancel error") @@ -208,7 +208,7 @@ func TestContextCancel(t *testing.T) { Role: openai.F(openai.ChatCompletionUserMessageParamRoleUser), Content: openai.F([]openai.ChatCompletionContentPartUnionParam{openai.ChatCompletionContentPartTextParam{Text: openai.F("text"), Type: openai.F(openai.ChatCompletionContentPartTextTypeText)}}), }}), - Model: openai.F(openai.ChatModelO1), + Model: openai.F(openai.ChatModelO3Mini), }) if err == nil { t.Error("Expected there to be a cancel error") @@ -233,7 +233,7 @@ func TestContextCancelDelay(t *testing.T) { Role: openai.F(openai.ChatCompletionUserMessageParamRoleUser), Content: openai.F([]openai.ChatCompletionContentPartUnionParam{openai.ChatCompletionContentPartTextParam{Text: openai.F("text"), Type: openai.F(openai.ChatCompletionContentPartTextTypeText)}}), }}), - Model: openai.F(openai.ChatModelO1), + Model: openai.F(openai.ChatModelO3Mini), }) if err == nil { t.Error("expected there to be a cancel error") @@ -264,7 +264,7 @@ func TestContextDeadline(t *testing.T) { Role: openai.F(openai.ChatCompletionUserMessageParamRoleUser), Content: openai.F([]openai.ChatCompletionContentPartUnionParam{openai.ChatCompletionContentPartTextParam{Text: openai.F("text"), Type: openai.F(openai.ChatCompletionContentPartTextTypeText)}}), }}), - Model: openai.F(openai.ChatModelO1), + Model: openai.F(openai.ChatModelO3Mini), }) if err == nil { t.Error("expected there to be a deadline error") diff --git a/shared/shared.go b/shared/shared.go index 18331e27..c2df8df5 100644 --- a/shared/shared.go +++ b/shared/shared.go @@ -105,6 +105,10 @@ func (r FunctionDefinitionParam) MarshalJSON() (data []byte, err error) { type FunctionParameters map[string]interface{} +type Metadata map[string]string + +type MetadataParam map[string]string + type ResponseFormatJSONObjectParam struct { // The type of response format being defined: `json_object` Type param.Field[ResponseFormatJSONObjectType] `json:"type,required"` diff --git a/upload.go b/upload.go index 0c5f0d1c..26c52e52 100644 --- a/upload.go +++ b/upload.go @@ -118,7 +118,7 @@ type Upload struct { Purpose string `json:"purpose,required"` // The status of the Upload. Status UploadStatus `json:"status,required"` - // The ready File object after the Upload is completed. + // The `File` object represents a document that has been uploaded to OpenAI. File FileObject `json:"file,nullable"` JSON uploadJSON `json:"-"` } diff --git a/usage_test.go b/usage_test.go index 930d2d89..7d260688 100644 --- a/usage_test.go +++ b/usage_test.go @@ -29,7 +29,7 @@ func TestUsage(t *testing.T) { Role: openai.F(openai.ChatCompletionUserMessageParamRoleUser), Content: openai.F([]openai.ChatCompletionContentPartUnionParam{openai.ChatCompletionContentPartTextParam{Text: openai.F("text"), Type: openai.F(openai.ChatCompletionContentPartTextTypeText)}}), }}), - Model: openai.F(openai.ChatModelO1), + Model: openai.F(openai.ChatModelO3Mini), }) if err != nil { t.Error(err)