Skip to content

release: 1.4.0 #412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.3.0"
".": "1.4.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 97
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-0205acb1015d29b2312a48526734c0399f93026d4fe2dff5c7768f566e333fd2.yml
openapi_spec_hash: 1772cc9056c2f6dfb2a4e9cb77ee6343
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-4865dda2b62927bd141cbc85f81be3d88602f103e2c581e15eb1caded3e3aaa2.yml
openapi_spec_hash: 7d14a9b23ef4ac93ea46d629601b6f6b
config_hash: ed1e6b3c5f93d12b80d31167f55c557c
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 1.4.0 (2025-06-09)

Full Changelog: [v1.3.0...v1.4.0](https://github.com/openai/openai-go/compare/v1.3.0...v1.4.0)

### Features

* **client:** allow overriding unions ([27c6299](https://github.com/openai/openai-go/commit/27c6299cb4ac275c6542b5691d81b795e65eeff6))


### Bug Fixes

* **client:** cast to raw message when converting to params ([a3282b0](https://github.com/openai/openai-go/commit/a3282b01a8d9a2c0cd04f24b298bf2ffcd160ebd))

## 1.3.0 (2025-06-03)

Full Changelog: [v1.2.1...v1.3.0](https://github.com/openai/openai-go/compare/v1.2.1...v1.3.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/openai/openai-go@v1.3.0'
go get -u 'github.com/openai/openai-go@v1.4.0'
```

<!-- x-release-please-end -->
Expand Down
2 changes: 1 addition & 1 deletion audiotranscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ type AudioTranscriptionNewParamsChunkingStrategyUnion struct {
}

func (u AudioTranscriptionNewParamsChunkingStrategyUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion[AudioTranscriptionNewParamsChunkingStrategyUnion](u.OfAuto, u.OfAudioTranscriptionNewsChunkingStrategyVadConfig)
return param.MarshalUnion(u, u.OfAuto, u.OfAudioTranscriptionNewsChunkingStrategyVadConfig)
}
func (u *AudioTranscriptionNewParamsChunkingStrategyUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
Expand Down
12 changes: 6 additions & 6 deletions betaassistant.go
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,7 @@ func (r *AssistantToolUnion) UnmarshalJSON(data []byte) error {
// be used at the last possible moment before sending a request. Test for this with
// AssistantToolUnionParam.Overrides()
func (r AssistantToolUnion) ToParam() AssistantToolUnionParam {
return param.Override[AssistantToolUnionParam](r.RawJSON())
return param.Override[AssistantToolUnionParam](json.RawMessage(r.RawJSON()))
}

func AssistantToolParamOfFunction(function shared.FunctionDefinitionParam) AssistantToolUnionParam {
Expand All @@ -1427,7 +1427,7 @@ type AssistantToolUnionParam struct {
}

func (u AssistantToolUnionParam) MarshalJSON() ([]byte, error) {
return param.MarshalUnion[AssistantToolUnionParam](u.OfCodeInterpreter, u.OfFileSearch, u.OfFunction)
return param.MarshalUnion(u, u.OfCodeInterpreter, u.OfFileSearch, u.OfFunction)
}
func (u *AssistantToolUnionParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
Expand Down Expand Up @@ -1504,7 +1504,7 @@ func (r *CodeInterpreterTool) UnmarshalJSON(data []byte) error {
// be used at the last possible moment before sending a request. Test for this with
// CodeInterpreterToolParam.Overrides()
func (r CodeInterpreterTool) ToParam() CodeInterpreterToolParam {
return param.Override[CodeInterpreterToolParam](r.RawJSON())
return param.Override[CodeInterpreterToolParam](json.RawMessage(r.RawJSON()))
}

func NewCodeInterpreterToolParam() CodeInterpreterToolParam {
Expand Down Expand Up @@ -1555,7 +1555,7 @@ func (r *FileSearchTool) UnmarshalJSON(data []byte) error {
// be used at the last possible moment before sending a request. Test for this with
// FileSearchToolParam.Overrides()
func (r FileSearchTool) ToParam() FileSearchToolParam {
return param.Override[FileSearchToolParam](r.RawJSON())
return param.Override[FileSearchToolParam](json.RawMessage(r.RawJSON()))
}

// Overrides for the file search tool.
Expand Down Expand Up @@ -1728,7 +1728,7 @@ func (r *FunctionTool) UnmarshalJSON(data []byte) error {
// be used at the last possible moment before sending a request. Test for this with
// FunctionToolParam.Overrides()
func (r FunctionTool) ToParam() FunctionToolParam {
return param.Override[FunctionToolParam](r.RawJSON())
return param.Override[FunctionToolParam](json.RawMessage(r.RawJSON()))
}

// The properties Function, Type are required.
Expand Down Expand Up @@ -1922,7 +1922,7 @@ type BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUni
}

func (u BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion[BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion](u.OfAuto, u.OfStatic)
return param.MarshalUnion(u, u.OfAuto, u.OfStatic)
}
func (u *BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
Expand Down
24 changes: 12 additions & 12 deletions betathread.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (r *AssistantResponseFormatOptionUnion) UnmarshalJSON(data []byte) error {
// be used at the last possible moment before sending a request. Test for this with
// AssistantResponseFormatOptionUnionParam.Overrides()
func (r AssistantResponseFormatOptionUnion) ToParam() AssistantResponseFormatOptionUnionParam {
return param.Override[AssistantResponseFormatOptionUnionParam](r.RawJSON())
return param.Override[AssistantResponseFormatOptionUnionParam](json.RawMessage(r.RawJSON()))
}

func AssistantResponseFormatOptionParamOfAuto() AssistantResponseFormatOptionUnionParam {
Expand All @@ -211,7 +211,7 @@ type AssistantResponseFormatOptionUnionParam struct {
}

func (u AssistantResponseFormatOptionUnionParam) MarshalJSON() ([]byte, error) {
return param.MarshalUnion[AssistantResponseFormatOptionUnionParam](u.OfAuto, u.OfText, u.OfJSONObject, u.OfJSONSchema)
return param.MarshalUnion(u, u.OfAuto, u.OfText, u.OfJSONObject, u.OfJSONSchema)
}
func (u *AssistantResponseFormatOptionUnionParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
Expand Down Expand Up @@ -279,7 +279,7 @@ func (r *AssistantToolChoice) UnmarshalJSON(data []byte) error {
// be used at the last possible moment before sending a request. Test for this with
// AssistantToolChoiceParam.Overrides()
func (r AssistantToolChoice) ToParam() AssistantToolChoiceParam {
return param.Override[AssistantToolChoiceParam](r.RawJSON())
return param.Override[AssistantToolChoiceParam](json.RawMessage(r.RawJSON()))
}

// The type of the tool. If type is `function`, the function name must be set
Expand Down Expand Up @@ -336,7 +336,7 @@ func (r *AssistantToolChoiceFunction) UnmarshalJSON(data []byte) error {
// be used at the last possible moment before sending a request. Test for this with
// AssistantToolChoiceFunctionParam.Overrides()
func (r AssistantToolChoiceFunction) ToParam() AssistantToolChoiceFunctionParam {
return param.Override[AssistantToolChoiceFunctionParam](r.RawJSON())
return param.Override[AssistantToolChoiceFunctionParam](json.RawMessage(r.RawJSON()))
}

// The property Name is required.
Expand Down Expand Up @@ -400,7 +400,7 @@ func (r *AssistantToolChoiceOptionUnion) UnmarshalJSON(data []byte) error {
// be used at the last possible moment before sending a request. Test for this with
// AssistantToolChoiceOptionUnionParam.Overrides()
func (r AssistantToolChoiceOptionUnion) ToParam() AssistantToolChoiceOptionUnionParam {
return param.Override[AssistantToolChoiceOptionUnionParam](r.RawJSON())
return param.Override[AssistantToolChoiceOptionUnionParam](json.RawMessage(r.RawJSON()))
}

// `none` means the model will not call any tools and instead generates a message.
Expand Down Expand Up @@ -432,7 +432,7 @@ type AssistantToolChoiceOptionUnionParam struct {
}

func (u AssistantToolChoiceOptionUnionParam) MarshalJSON() ([]byte, error) {
return param.MarshalUnion[AssistantToolChoiceOptionUnionParam](u.OfAuto, u.OfAssistantToolChoice)
return param.MarshalUnion(u, u.OfAuto, u.OfAssistantToolChoice)
}
func (u *AssistantToolChoiceOptionUnionParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
Expand Down Expand Up @@ -643,7 +643,7 @@ type BetaThreadNewParamsMessageContentUnion struct {
}

func (u BetaThreadNewParamsMessageContentUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion[BetaThreadNewParamsMessageContentUnion](u.OfString, u.OfArrayOfContentParts)
return param.MarshalUnion(u, u.OfString, u.OfArrayOfContentParts)
}
func (u *BetaThreadNewParamsMessageContentUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
Expand Down Expand Up @@ -684,7 +684,7 @@ type BetaThreadNewParamsMessageAttachmentToolUnion struct {
}

func (u BetaThreadNewParamsMessageAttachmentToolUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion[BetaThreadNewParamsMessageAttachmentToolUnion](u.OfCodeInterpreter, u.OfFileSearch)
return param.MarshalUnion(u, u.OfCodeInterpreter, u.OfFileSearch)
}
func (u *BetaThreadNewParamsMessageAttachmentToolUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
Expand Down Expand Up @@ -831,7 +831,7 @@ type BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion
}

func (u BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion[BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion](u.OfAuto, u.OfStatic)
return param.MarshalUnion(u, u.OfAuto, u.OfStatic)
}
func (u *BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
Expand Down Expand Up @@ -1188,7 +1188,7 @@ type BetaThreadNewAndRunParamsThreadMessageContentUnion struct {
}

func (u BetaThreadNewAndRunParamsThreadMessageContentUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion[BetaThreadNewAndRunParamsThreadMessageContentUnion](u.OfString, u.OfArrayOfContentParts)
return param.MarshalUnion(u, u.OfString, u.OfArrayOfContentParts)
}
func (u *BetaThreadNewAndRunParamsThreadMessageContentUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
Expand Down Expand Up @@ -1229,7 +1229,7 @@ type BetaThreadNewAndRunParamsThreadMessageAttachmentToolUnion struct {
}

func (u BetaThreadNewAndRunParamsThreadMessageAttachmentToolUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion[BetaThreadNewAndRunParamsThreadMessageAttachmentToolUnion](u.OfCodeInterpreter, u.OfFileSearch)
return param.MarshalUnion(u, u.OfCodeInterpreter, u.OfFileSearch)
}
func (u *BetaThreadNewAndRunParamsThreadMessageAttachmentToolUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
Expand Down Expand Up @@ -1376,7 +1376,7 @@ type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingSt
}

func (u BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion[BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion](u.OfAuto, u.OfStatic)
return param.MarshalUnion(u, u.OfAuto, u.OfStatic)
}
func (u *BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
Expand Down
14 changes: 7 additions & 7 deletions betathreadmessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ func (r *ImageFile) UnmarshalJSON(data []byte) error {
// be used at the last possible moment before sending a request. Test for this with
// ImageFileParam.Overrides()
func (r ImageFile) ToParam() ImageFileParam {
return param.Override[ImageFileParam](r.RawJSON())
return param.Override[ImageFileParam](json.RawMessage(r.RawJSON()))
}

// Specifies the detail level of the image if specified by the user. `low` uses
Expand Down Expand Up @@ -573,7 +573,7 @@ func (r *ImageFileContentBlock) UnmarshalJSON(data []byte) error {
// be used at the last possible moment before sending a request. Test for this with
// ImageFileContentBlockParam.Overrides()
func (r ImageFileContentBlock) ToParam() ImageFileContentBlockParam {
return param.Override[ImageFileContentBlockParam](r.RawJSON())
return param.Override[ImageFileContentBlockParam](json.RawMessage(r.RawJSON()))
}

// References an image [File](https://platform.openai.com/docs/api-reference/files)
Expand Down Expand Up @@ -686,7 +686,7 @@ func (r *ImageURL) UnmarshalJSON(data []byte) error {
// be used at the last possible moment before sending a request. Test for this with
// ImageURLParam.Overrides()
func (r ImageURL) ToParam() ImageURLParam {
return param.Override[ImageURLParam](r.RawJSON())
return param.Override[ImageURLParam](json.RawMessage(r.RawJSON()))
}

// Specifies the detail level of the image. `low` uses fewer tokens, you can opt in
Expand Down Expand Up @@ -746,7 +746,7 @@ func (r *ImageURLContentBlock) UnmarshalJSON(data []byte) error {
// be used at the last possible moment before sending a request. Test for this with
// ImageURLContentBlockParam.Overrides()
func (r ImageURLContentBlock) ToParam() ImageURLContentBlockParam {
return param.Override[ImageURLContentBlockParam](r.RawJSON())
return param.Override[ImageURLContentBlockParam](json.RawMessage(r.RawJSON()))
}

// References an image URL in the content of a message.
Expand Down Expand Up @@ -1216,7 +1216,7 @@ type MessageContentPartParamUnion struct {
}

func (u MessageContentPartParamUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion[MessageContentPartParamUnion](u.OfImageFile, u.OfImageURL, u.OfText)
return param.MarshalUnion(u, u.OfImageFile, u.OfImageURL, u.OfText)
}
func (u *MessageContentPartParamUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
Expand Down Expand Up @@ -1541,7 +1541,7 @@ type BetaThreadMessageNewParamsContentUnion struct {
}

func (u BetaThreadMessageNewParamsContentUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion[BetaThreadMessageNewParamsContentUnion](u.OfString, u.OfArrayOfContentParts)
return param.MarshalUnion(u, u.OfString, u.OfArrayOfContentParts)
}
func (u *BetaThreadMessageNewParamsContentUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
Expand Down Expand Up @@ -1595,7 +1595,7 @@ type BetaThreadMessageNewParamsAttachmentToolUnion struct {
}

func (u BetaThreadMessageNewParamsAttachmentToolUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion[BetaThreadMessageNewParamsAttachmentToolUnion](u.OfCodeInterpreter, u.OfFileSearch)
return param.MarshalUnion(u, u.OfCodeInterpreter, u.OfFileSearch)
}
func (u *BetaThreadMessageNewParamsAttachmentToolUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
Expand Down
4 changes: 2 additions & 2 deletions betathreadrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ type BetaThreadRunNewParamsAdditionalMessageContentUnion struct {
}

func (u BetaThreadRunNewParamsAdditionalMessageContentUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion[BetaThreadRunNewParamsAdditionalMessageContentUnion](u.OfString, u.OfArrayOfContentParts)
return param.MarshalUnion(u, u.OfString, u.OfArrayOfContentParts)
}
func (u *BetaThreadRunNewParamsAdditionalMessageContentUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
Expand Down Expand Up @@ -782,7 +782,7 @@ type BetaThreadRunNewParamsAdditionalMessageAttachmentToolUnion struct {
}

func (u BetaThreadRunNewParamsAdditionalMessageAttachmentToolUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion[BetaThreadRunNewParamsAdditionalMessageAttachmentToolUnion](u.OfCodeInterpreter, u.OfFileSearch)
return param.MarshalUnion(u, u.OfCodeInterpreter, u.OfFileSearch)
}
func (u *BetaThreadRunNewParamsAdditionalMessageAttachmentToolUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
Expand Down
Loading