responses

package
v1.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2025 License: Apache-2.0 Imports: 19 Imported by: 36

Documentation

Index

Constants

View Source
const ChatModelChatgpt4oLatest = shared.ChatModelChatgpt4oLatest

Equals "chatgpt-4o-latest"

View Source
const ChatModelCodexMiniLatest = shared.ChatModelCodexMiniLatest

Equals "codex-mini-latest"

View Source
const ChatModelGPT3_5Turbo = shared.ChatModelGPT3_5Turbo

Equals "gpt-3.5-turbo"

View Source
const ChatModelGPT3_5Turbo0125 = shared.ChatModelGPT3_5Turbo0125

Equals "gpt-3.5-turbo-0125"

View Source
const ChatModelGPT3_5Turbo0301 = shared.ChatModelGPT3_5Turbo0301

Equals "gpt-3.5-turbo-0301"

View Source
const ChatModelGPT3_5Turbo0613 = shared.ChatModelGPT3_5Turbo0613

Equals "gpt-3.5-turbo-0613"

View Source
const ChatModelGPT3_5Turbo1106 = shared.ChatModelGPT3_5Turbo1106

Equals "gpt-3.5-turbo-1106"

View Source
const ChatModelGPT3_5Turbo16k = shared.ChatModelGPT3_5Turbo16k

Equals "gpt-3.5-turbo-16k"

View Source
const ChatModelGPT3_5Turbo16k0613 = shared.ChatModelGPT3_5Turbo16k0613

Equals "gpt-3.5-turbo-16k-0613"

View Source
const ChatModelGPT4 = shared.ChatModelGPT4

Equals "gpt-4"

View Source
const ChatModelGPT4Turbo = shared.ChatModelGPT4Turbo

Equals "gpt-4-turbo"

View Source
const ChatModelGPT4Turbo2024_04_09 = shared.ChatModelGPT4Turbo2024_04_09

Equals "gpt-4-turbo-2024-04-09"

View Source
const ChatModelGPT4TurboPreview = shared.ChatModelGPT4TurboPreview

Equals "gpt-4-turbo-preview"

View Source
const ChatModelGPT4VisionPreview = shared.ChatModelGPT4VisionPreview

Equals "gpt-4-vision-preview"

View Source
const ChatModelGPT4_0125Preview = shared.ChatModelGPT4_0125Preview

Equals "gpt-4-0125-preview"

View Source
const ChatModelGPT4_0314 = shared.ChatModelGPT4_0314

Equals "gpt-4-0314"

View Source
const ChatModelGPT4_0613 = shared.ChatModelGPT4_0613

Equals "gpt-4-0613"

View Source
const ChatModelGPT4_1 = shared.ChatModelGPT4_1

Equals "gpt-4.1"

View Source
const ChatModelGPT4_1106Preview = shared.ChatModelGPT4_1106Preview

Equals "gpt-4-1106-preview"

View Source
const ChatModelGPT4_1Mini = shared.ChatModelGPT4_1Mini

Equals "gpt-4.1-mini"

View Source
const ChatModelGPT4_1Mini2025_04_14 = shared.ChatModelGPT4_1Mini2025_04_14

Equals "gpt-4.1-mini-2025-04-14"

View Source
const ChatModelGPT4_1Nano = shared.ChatModelGPT4_1Nano

Equals "gpt-4.1-nano"

View Source
const ChatModelGPT4_1Nano2025_04_14 = shared.ChatModelGPT4_1Nano2025_04_14

Equals "gpt-4.1-nano-2025-04-14"

View Source
const ChatModelGPT4_1_2025_04_14 = shared.ChatModelGPT4_1_2025_04_14

Equals "gpt-4.1-2025-04-14"

View Source
const ChatModelGPT4_32k = shared.ChatModelGPT4_32k

Equals "gpt-4-32k"

View Source
const ChatModelGPT4_32k0314 = shared.ChatModelGPT4_32k0314

Equals "gpt-4-32k-0314"

View Source
const ChatModelGPT4_32k0613 = shared.ChatModelGPT4_32k0613

Equals "gpt-4-32k-0613"

View Source
const ChatModelGPT4o = shared.ChatModelGPT4o

Equals "gpt-4o"

View Source
const ChatModelGPT4o2024_05_13 = shared.ChatModelGPT4o2024_05_13

Equals "gpt-4o-2024-05-13"

View Source
const ChatModelGPT4o2024_08_06 = shared.ChatModelGPT4o2024_08_06

Equals "gpt-4o-2024-08-06"

View Source
const ChatModelGPT4o2024_11_20 = shared.ChatModelGPT4o2024_11_20

Equals "gpt-4o-2024-11-20"

View Source
const ChatModelGPT4oAudioPreview = shared.ChatModelGPT4oAudioPreview

Equals "gpt-4o-audio-preview"

View Source
const ChatModelGPT4oAudioPreview2024_10_01 = shared.ChatModelGPT4oAudioPreview2024_10_01

Equals "gpt-4o-audio-preview-2024-10-01"

View Source
const ChatModelGPT4oAudioPreview2024_12_17 = shared.ChatModelGPT4oAudioPreview2024_12_17

Equals "gpt-4o-audio-preview-2024-12-17"

View Source
const ChatModelGPT4oAudioPreview2025_06_03 = shared.ChatModelGPT4oAudioPreview2025_06_03

Equals "gpt-4o-audio-preview-2025-06-03"

View Source
const ChatModelGPT4oMini = shared.ChatModelGPT4oMini

Equals "gpt-4o-mini"

View Source
const ChatModelGPT4oMini2024_07_18 = shared.ChatModelGPT4oMini2024_07_18

Equals "gpt-4o-mini-2024-07-18"

View Source
const ChatModelGPT4oMiniAudioPreview = shared.ChatModelGPT4oMiniAudioPreview

Equals "gpt-4o-mini-audio-preview"

View Source
const ChatModelGPT4oMiniAudioPreview2024_12_17 = shared.ChatModelGPT4oMiniAudioPreview2024_12_17

Equals "gpt-4o-mini-audio-preview-2024-12-17"

View Source
const ChatModelGPT4oMiniSearchPreview = shared.ChatModelGPT4oMiniSearchPreview

Equals "gpt-4o-mini-search-preview"

View Source
const ChatModelGPT4oMiniSearchPreview2025_03_11 = shared.ChatModelGPT4oMiniSearchPreview2025_03_11

Equals "gpt-4o-mini-search-preview-2025-03-11"

View Source
const ChatModelGPT4oSearchPreview = shared.ChatModelGPT4oSearchPreview

Equals "gpt-4o-search-preview"

View Source
const ChatModelGPT4oSearchPreview2025_03_11 = shared.ChatModelGPT4oSearchPreview2025_03_11

Equals "gpt-4o-search-preview-2025-03-11"

View Source
const ChatModelO1 = shared.ChatModelO1

Equals "o1"

View Source
const ChatModelO1Mini = shared.ChatModelO1Mini

Equals "o1-mini"

View Source
const ChatModelO1Mini2024_09_12 = shared.ChatModelO1Mini2024_09_12

Equals "o1-mini-2024-09-12"

View Source
const ChatModelO1Preview = shared.ChatModelO1Preview

Equals "o1-preview"

View Source
const ChatModelO1Preview2024_09_12 = shared.ChatModelO1Preview2024_09_12

Equals "o1-preview-2024-09-12"

View Source
const ChatModelO1_2024_12_17 = shared.ChatModelO1_2024_12_17

Equals "o1-2024-12-17"

View Source
const ChatModelO3 = shared.ChatModelO3

Equals "o3"

View Source
const ChatModelO3Mini = shared.ChatModelO3Mini

Equals "o3-mini"

View Source
const ChatModelO3Mini2025_01_31 = shared.ChatModelO3Mini2025_01_31

Equals "o3-mini-2025-01-31"

View Source
const ChatModelO3_2025_04_16 = shared.ChatModelO3_2025_04_16

Equals "o3-2025-04-16"

View Source
const ChatModelO4Mini = shared.ChatModelO4Mini

Equals "o4-mini"

View Source
const ChatModelO4Mini2025_04_16 = shared.ChatModelO4Mini2025_04_16

Equals "o4-mini-2025-04-16"

View Source
const ComparisonFilterTypeEq = shared.ComparisonFilterTypeEq

Equals "eq"

View Source
const ComparisonFilterTypeGt = shared.ComparisonFilterTypeGt

Equals "gt"

View Source
const ComparisonFilterTypeGte = shared.ComparisonFilterTypeGte

Equals "gte"

View Source
const ComparisonFilterTypeLt = shared.ComparisonFilterTypeLt

Equals "lt"

View Source
const ComparisonFilterTypeLte = shared.ComparisonFilterTypeLte

Equals "lte"

View Source
const ComparisonFilterTypeNe = shared.ComparisonFilterTypeNe

Equals "ne"

View Source
const CompoundFilterTypeAnd = shared.CompoundFilterTypeAnd

Equals "and"

View Source
const CompoundFilterTypeOr = shared.CompoundFilterTypeOr

Equals "or"

View Source
const ReasoningEffortHigh = shared.ReasoningEffortHigh

Equals "high"

View Source
const ReasoningEffortLow = shared.ReasoningEffortLow

Equals "low"

View Source
const ReasoningEffortMedium = shared.ReasoningEffortMedium

Equals "medium"

View Source
const ReasoningGenerateSummaryAuto = shared.ReasoningGenerateSummaryAuto

Equals "auto"

View Source
const ReasoningGenerateSummaryConcise = shared.ReasoningGenerateSummaryConcise

Equals "concise"

View Source
const ReasoningGenerateSummaryDetailed = shared.ReasoningGenerateSummaryDetailed

Equals "detailed"

View Source
const ReasoningSummaryAuto = shared.ReasoningSummaryAuto

Equals "auto"

View Source
const ReasoningSummaryConcise = shared.ReasoningSummaryConcise

Equals "concise"

View Source
const ReasoningSummaryDetailed = shared.ReasoningSummaryDetailed

Equals "detailed"

View Source
const ResponsesModelComputerUsePreview = shared.ResponsesModelComputerUsePreview

Equals "computer-use-preview"

View Source
const ResponsesModelComputerUsePreview2025_03_11 = shared.ResponsesModelComputerUsePreview2025_03_11

Equals "computer-use-preview-2025-03-11"

View Source
const ResponsesModelO1Pro = shared.ResponsesModelO1Pro

Equals "o1-pro"

View Source
const ResponsesModelO1Pro2025_03_19 = shared.ResponsesModelO1Pro2025_03_19

Equals "o1-pro-2025-03-19"

View Source
const ResponsesModelO3DeepResearch = shared.ResponsesModelO3DeepResearch

Equals "o3-deep-research"

View Source
const ResponsesModelO3DeepResearch2025_06_26 = shared.ResponsesModelO3DeepResearch2025_06_26

Equals "o3-deep-research-2025-06-26"

View Source
const ResponsesModelO3Pro = shared.ResponsesModelO3Pro

Equals "o3-pro"

View Source
const ResponsesModelO3Pro2025_06_10 = shared.ResponsesModelO3Pro2025_06_10

Equals "o3-pro-2025-06-10"

View Source
const ResponsesModelO4MiniDeepResearch = shared.ResponsesModelO4MiniDeepResearch

Equals "o4-mini-deep-research"

View Source
const ResponsesModelO4MiniDeepResearch2025_06_26 = shared.ResponsesModelO4MiniDeepResearch2025_06_26

Equals "o4-mini-deep-research-2025-06-26"

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatModel

type ChatModel = shared.ChatModel

This is an alias to an internal type.

type ComparisonFilter

type ComparisonFilter = shared.ComparisonFilter

A filter used to compare a specified attribute key to a given value using a defined comparison operation.

This is an alias to an internal type.

type ComparisonFilterParam

type ComparisonFilterParam = shared.ComparisonFilterParam

A filter used to compare a specified attribute key to a given value using a defined comparison operation.

This is an alias to an internal type.

type ComparisonFilterType

type ComparisonFilterType = shared.ComparisonFilterType

Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`.

- `eq`: equals - `ne`: not equal - `gt`: greater than - `gte`: greater than or equal - `lt`: less than - `lte`: less than or equal

This is an alias to an internal type.

type ComparisonFilterValueUnion

type ComparisonFilterValueUnion = shared.ComparisonFilterValueUnion

The value to compare against the attribute key; supports string, number, or boolean types.

This is an alias to an internal type.

type ComparisonFilterValueUnionParam

type ComparisonFilterValueUnionParam = shared.ComparisonFilterValueUnionParam

The value to compare against the attribute key; supports string, number, or boolean types.

This is an alias to an internal type.

type CompoundFilter

type CompoundFilter = shared.CompoundFilter

Combine multiple filters using `and` or `or`.

This is an alias to an internal type.

type CompoundFilterParam

type CompoundFilterParam = shared.CompoundFilterParam

Combine multiple filters using `and` or `or`.

This is an alias to an internal type.

type CompoundFilterType

type CompoundFilterType = shared.CompoundFilterType

Type of operation: `and` or `or`.

This is an alias to an internal type.

type ComputerTool

type ComputerTool struct {
	// The height of the computer display.
	DisplayHeight int64 `json:"display_height,required"`
	// The width of the computer display.
	DisplayWidth int64 `json:"display_width,required"`
	// The type of computer environment to control.
	//
	// Any of "windows", "mac", "linux", "ubuntu", "browser".
	Environment ComputerToolEnvironment `json:"environment,required"`
	// The type of the computer use tool. Always `computer_use_preview`.
	Type constant.ComputerUsePreview `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DisplayHeight respjson.Field
		DisplayWidth  respjson.Field
		Environment   respjson.Field
		Type          respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).

func (ComputerTool) RawJSON

func (r ComputerTool) RawJSON() string

Returns the unmodified JSON received from the API

func (ComputerTool) ToParam

func (r ComputerTool) ToParam() ComputerToolParam

ToParam converts this ComputerTool to a ComputerToolParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ComputerToolParam.Overrides()

func (*ComputerTool) UnmarshalJSON

func (r *ComputerTool) UnmarshalJSON(data []byte) error

type ComputerToolEnvironment

type ComputerToolEnvironment string

The type of computer environment to control.

const (
	ComputerToolEnvironmentWindows ComputerToolEnvironment = "windows"
	ComputerToolEnvironmentMac     ComputerToolEnvironment = "mac"
	ComputerToolEnvironmentLinux   ComputerToolEnvironment = "linux"
	ComputerToolEnvironmentUbuntu  ComputerToolEnvironment = "ubuntu"
	ComputerToolEnvironmentBrowser ComputerToolEnvironment = "browser"
)

type ComputerToolParam

type ComputerToolParam struct {
	// The height of the computer display.
	DisplayHeight int64 `json:"display_height,required"`
	// The width of the computer display.
	DisplayWidth int64 `json:"display_width,required"`
	// The type of computer environment to control.
	//
	// Any of "windows", "mac", "linux", "ubuntu", "browser".
	Environment ComputerToolEnvironment `json:"environment,omitzero,required"`
	// The type of the computer use tool. Always `computer_use_preview`.
	//
	// This field can be elided, and will marshal its zero value as
	// "computer_use_preview".
	Type constant.ComputerUsePreview `json:"type,required"`
	// contains filtered or unexported fields
}

A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).

The properties DisplayHeight, DisplayWidth, Environment, Type are required.

func (ComputerToolParam) MarshalJSON

func (r ComputerToolParam) MarshalJSON() (data []byte, err error)

func (*ComputerToolParam) UnmarshalJSON

func (r *ComputerToolParam) UnmarshalJSON(data []byte) error

type EasyInputMessage added in v1.6.0

type EasyInputMessage struct {
	// Text, image, or audio input to the model, used to generate a response. Can also
	// contain previous assistant responses.
	Content EasyInputMessageContentUnion `json:"content,required"`
	// The role of the message input. One of `user`, `assistant`, `system`, or
	// `developer`.
	//
	// Any of "user", "assistant", "system", "developer".
	Role EasyInputMessageRole `json:"role,required"`
	// The type of the message input. Always `message`.
	//
	// Any of "message".
	Type EasyInputMessageType `json:"type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Content     respjson.Field
		Role        respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A message input to the model with a role indicating instruction following hierarchy. Instructions given with the `developer` or `system` role take precedence over instructions given with the `user` role. Messages with the `assistant` role are presumed to have been generated by the model in previous interactions.

func (EasyInputMessage) RawJSON added in v1.6.0

func (r EasyInputMessage) RawJSON() string

Returns the unmodified JSON received from the API

func (EasyInputMessage) ToParam added in v1.6.0

ToParam converts this EasyInputMessage to a EasyInputMessageParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with EasyInputMessageParam.Overrides()

func (*EasyInputMessage) UnmarshalJSON added in v1.6.0

func (r *EasyInputMessage) UnmarshalJSON(data []byte) error

type EasyInputMessageContentUnion added in v1.6.0

type EasyInputMessageContentUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [ResponseInputMessageContentList]
	// instead of an object.
	OfInputItemContentList ResponseInputMessageContentList `json:",inline"`
	JSON                   struct {
		OfString               respjson.Field
		OfInputItemContentList respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

EasyInputMessageContentUnion contains all possible properties and values from [string], ResponseInputMessageContentList.

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfInputItemContentList]

func (EasyInputMessageContentUnion) AsInputItemContentList added in v1.6.0

func (u EasyInputMessageContentUnion) AsInputItemContentList() (v ResponseInputMessageContentList)

func (EasyInputMessageContentUnion) AsString added in v1.6.0

func (u EasyInputMessageContentUnion) AsString() (v string)

func (EasyInputMessageContentUnion) RawJSON added in v1.6.0

Returns the unmodified JSON received from the API

func (*EasyInputMessageContentUnion) UnmarshalJSON added in v1.6.0

func (r *EasyInputMessageContentUnion) UnmarshalJSON(data []byte) error

type EasyInputMessageContentUnionParam

type EasyInputMessageContentUnionParam struct {
	OfString               param.Opt[string]                    `json:",omitzero,inline"`
	OfInputItemContentList ResponseInputMessageContentListParam `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (EasyInputMessageContentUnionParam) MarshalJSON

func (u EasyInputMessageContentUnionParam) MarshalJSON() ([]byte, error)

func (*EasyInputMessageContentUnionParam) UnmarshalJSON

func (u *EasyInputMessageContentUnionParam) UnmarshalJSON(data []byte) error

type EasyInputMessageParam

type EasyInputMessageParam struct {
	// Text, image, or audio input to the model, used to generate a response. Can also
	// contain previous assistant responses.
	Content EasyInputMessageContentUnionParam `json:"content,omitzero,required"`
	// The role of the message input. One of `user`, `assistant`, `system`, or
	// `developer`.
	//
	// Any of "user", "assistant", "system", "developer".
	Role EasyInputMessageRole `json:"role,omitzero,required"`
	// The type of the message input. Always `message`.
	//
	// Any of "message".
	Type EasyInputMessageType `json:"type,omitzero"`
	// contains filtered or unexported fields
}

A message input to the model with a role indicating instruction following hierarchy. Instructions given with the `developer` or `system` role take precedence over instructions given with the `user` role. Messages with the `assistant` role are presumed to have been generated by the model in previous interactions.

The properties Content, Role are required.

func (EasyInputMessageParam) MarshalJSON

func (r EasyInputMessageParam) MarshalJSON() (data []byte, err error)

func (*EasyInputMessageParam) UnmarshalJSON

func (r *EasyInputMessageParam) UnmarshalJSON(data []byte) error

type EasyInputMessageRole

type EasyInputMessageRole string

The role of the message input. One of `user`, `assistant`, `system`, or `developer`.

const (
	EasyInputMessageRoleUser      EasyInputMessageRole = "user"
	EasyInputMessageRoleAssistant EasyInputMessageRole = "assistant"
	EasyInputMessageRoleSystem    EasyInputMessageRole = "system"
	EasyInputMessageRoleDeveloper EasyInputMessageRole = "developer"
)

type EasyInputMessageType

type EasyInputMessageType string

The type of the message input. Always `message`.

const (
	EasyInputMessageTypeMessage EasyInputMessageType = "message"
)

type Error

type Error = apierror.Error

type ErrorObject added in v1.1.0

type ErrorObject = shared.ErrorObject

This is an alias to an internal type.

type FileSearchTool

type FileSearchTool struct {
	// The type of the file search tool. Always `file_search`.
	Type constant.FileSearch `json:"type,required"`
	// The IDs of the vector stores to search.
	VectorStoreIDs []string `json:"vector_store_ids,required"`
	// A filter to apply.
	Filters FileSearchToolFiltersUnion `json:"filters,nullable"`
	// The maximum number of results to return. This number should be between 1 and 50
	// inclusive.
	MaxNumResults int64 `json:"max_num_results"`
	// Ranking options for search.
	RankingOptions FileSearchToolRankingOptions `json:"ranking_options"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type           respjson.Field
		VectorStoreIDs respjson.Field
		Filters        respjson.Field
		MaxNumResults  respjson.Field
		RankingOptions respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](https://platform.openai.com/docs/guides/tools-file-search).

func (FileSearchTool) RawJSON

func (r FileSearchTool) RawJSON() string

Returns the unmodified JSON received from the API

func (FileSearchTool) ToParam

func (r FileSearchTool) ToParam() FileSearchToolParam

ToParam converts this FileSearchTool to a FileSearchToolParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with FileSearchToolParam.Overrides()

func (*FileSearchTool) UnmarshalJSON

func (r *FileSearchTool) UnmarshalJSON(data []byte) error

type FileSearchToolFiltersUnion

type FileSearchToolFiltersUnion struct {
	// This field is from variant [shared.ComparisonFilter].
	Key  string `json:"key"`
	Type string `json:"type"`
	// This field is from variant [shared.ComparisonFilter].
	Value shared.ComparisonFilterValueUnion `json:"value"`
	// This field is from variant [shared.CompoundFilter].
	Filters []shared.ComparisonFilter `json:"filters"`
	JSON    struct {
		Key     respjson.Field
		Type    respjson.Field
		Value   respjson.Field
		Filters respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FileSearchToolFiltersUnion contains all possible properties and values from shared.ComparisonFilter, shared.CompoundFilter.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (FileSearchToolFiltersUnion) AsComparisonFilter

func (u FileSearchToolFiltersUnion) AsComparisonFilter() (v shared.ComparisonFilter)

func (FileSearchToolFiltersUnion) AsCompoundFilter

func (u FileSearchToolFiltersUnion) AsCompoundFilter() (v shared.CompoundFilter)

func (FileSearchToolFiltersUnion) RawJSON

func (u FileSearchToolFiltersUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*FileSearchToolFiltersUnion) UnmarshalJSON

func (r *FileSearchToolFiltersUnion) UnmarshalJSON(data []byte) error

type FileSearchToolFiltersUnionParam

type FileSearchToolFiltersUnionParam struct {
	OfComparisonFilter *shared.ComparisonFilterParam `json:",omitzero,inline"`
	OfCompoundFilter   *shared.CompoundFilterParam   `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (FileSearchToolFiltersUnionParam) GetFilters

Returns a pointer to the underlying variant's property, if present.

func (FileSearchToolFiltersUnionParam) GetKey

Returns a pointer to the underlying variant's property, if present.

func (FileSearchToolFiltersUnionParam) GetType

Returns a pointer to the underlying variant's property, if present.

func (FileSearchToolFiltersUnionParam) GetValue

Returns a pointer to the underlying variant's property, if present.

func (FileSearchToolFiltersUnionParam) MarshalJSON

func (u FileSearchToolFiltersUnionParam) MarshalJSON() ([]byte, error)

func (*FileSearchToolFiltersUnionParam) UnmarshalJSON

func (u *FileSearchToolFiltersUnionParam) UnmarshalJSON(data []byte) error

type FileSearchToolParam

type FileSearchToolParam struct {
	// The IDs of the vector stores to search.
	VectorStoreIDs []string `json:"vector_store_ids,omitzero,required"`
	// The maximum number of results to return. This number should be between 1 and 50
	// inclusive.
	MaxNumResults param.Opt[int64] `json:"max_num_results,omitzero"`
	// A filter to apply.
	Filters FileSearchToolFiltersUnionParam `json:"filters,omitzero"`
	// Ranking options for search.
	RankingOptions FileSearchToolRankingOptionsParam `json:"ranking_options,omitzero"`
	// The type of the file search tool. Always `file_search`.
	//
	// This field can be elided, and will marshal its zero value as "file_search".
	Type constant.FileSearch `json:"type,required"`
	// contains filtered or unexported fields
}

A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](https://platform.openai.com/docs/guides/tools-file-search).

The properties Type, VectorStoreIDs are required.

func (FileSearchToolParam) MarshalJSON

func (r FileSearchToolParam) MarshalJSON() (data []byte, err error)

func (*FileSearchToolParam) UnmarshalJSON

func (r *FileSearchToolParam) UnmarshalJSON(data []byte) error

type FileSearchToolRankingOptions

type FileSearchToolRankingOptions struct {
	// The ranker to use for the file search.
	//
	// Any of "auto", "default-2024-11-15".
	Ranker string `json:"ranker"`
	// The score threshold for the file search, a number between 0 and 1. Numbers
	// closer to 1 will attempt to return only the most relevant results, but may
	// return fewer results.
	ScoreThreshold float64 `json:"score_threshold"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Ranker         respjson.Field
		ScoreThreshold respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Ranking options for search.

func (FileSearchToolRankingOptions) RawJSON

Returns the unmodified JSON received from the API

func (*FileSearchToolRankingOptions) UnmarshalJSON

func (r *FileSearchToolRankingOptions) UnmarshalJSON(data []byte) error

type FileSearchToolRankingOptionsParam

type FileSearchToolRankingOptionsParam struct {
	// The score threshold for the file search, a number between 0 and 1. Numbers
	// closer to 1 will attempt to return only the most relevant results, but may
	// return fewer results.
	ScoreThreshold param.Opt[float64] `json:"score_threshold,omitzero"`
	// The ranker to use for the file search.
	//
	// Any of "auto", "default-2024-11-15".
	Ranker string `json:"ranker,omitzero"`
	// contains filtered or unexported fields
}

Ranking options for search.

func (FileSearchToolRankingOptionsParam) MarshalJSON

func (r FileSearchToolRankingOptionsParam) MarshalJSON() (data []byte, err error)

func (*FileSearchToolRankingOptionsParam) UnmarshalJSON

func (r *FileSearchToolRankingOptionsParam) UnmarshalJSON(data []byte) error

type FunctionDefinition added in v1.1.0

type FunctionDefinition = shared.FunctionDefinition

This is an alias to an internal type.

type FunctionDefinitionParam

type FunctionDefinitionParam = shared.FunctionDefinitionParam

This is an alias to an internal type.

type FunctionParameters

type FunctionParameters = shared.FunctionParameters

The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format.

Omitting `parameters` defines a function with an empty parameter list.

This is an alias to an internal type.

type FunctionTool

type FunctionTool struct {
	// The name of the function to call.
	Name string `json:"name,required"`
	// A JSON schema object describing the parameters of the function.
	Parameters map[string]any `json:"parameters,required"`
	// Whether to enforce strict parameter validation. Default `true`.
	Strict bool `json:"strict,required"`
	// The type of the function tool. Always `function`.
	Type constant.Function `json:"type,required"`
	// A description of the function. Used by the model to determine whether or not to
	// call the function.
	Description string `json:"description,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Name        respjson.Field
		Parameters  respjson.Field
		Strict      respjson.Field
		Type        respjson.Field
		Description respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Defines a function in your own code the model can choose to call. Learn more about [function calling](https://platform.openai.com/docs/guides/function-calling).

func (FunctionTool) RawJSON

func (r FunctionTool) RawJSON() string

Returns the unmodified JSON received from the API

func (FunctionTool) ToParam

func (r FunctionTool) ToParam() FunctionToolParam

ToParam converts this FunctionTool to a FunctionToolParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with FunctionToolParam.Overrides()

func (*FunctionTool) UnmarshalJSON

func (r *FunctionTool) UnmarshalJSON(data []byte) error

type FunctionToolParam

type FunctionToolParam struct {
	// Whether to enforce strict parameter validation. Default `true`.
	Strict param.Opt[bool] `json:"strict,omitzero,required"`
	// A JSON schema object describing the parameters of the function.
	Parameters map[string]any `json:"parameters,omitzero,required"`
	// The name of the function to call.
	Name string `json:"name,required"`
	// A description of the function. Used by the model to determine whether or not to
	// call the function.
	Description param.Opt[string] `json:"description,omitzero"`
	// The type of the function tool. Always `function`.
	//
	// This field can be elided, and will marshal its zero value as "function".
	Type constant.Function `json:"type,required"`
	// contains filtered or unexported fields
}

Defines a function in your own code the model can choose to call. Learn more about [function calling](https://platform.openai.com/docs/guides/function-calling).

The properties Name, Parameters, Strict, Type are required.

func (FunctionToolParam) MarshalJSON

func (r FunctionToolParam) MarshalJSON() (data []byte, err error)

func (*FunctionToolParam) UnmarshalJSON

func (r *FunctionToolParam) UnmarshalJSON(data []byte) error

type InputItemListParams

type InputItemListParams struct {
	// An item ID to list items after, used in pagination.
	After param.Opt[string] `query:"after,omitzero" json:"-"`
	// An item ID to list items before, used in pagination.
	Before param.Opt[string] `query:"before,omitzero" json:"-"`
	// A limit on the number of objects to be returned. Limit can range between 1 and
	// 100, and the default is 20.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Additional fields to include in the response. See the `include` parameter for
	// Response creation above for more information.
	Include []ResponseIncludable `query:"include,omitzero" json:"-"`
	// The order to return the input items in. Default is `desc`.
	//
	// - `asc`: Return the input items in ascending order.
	// - `desc`: Return the input items in descending order.
	//
	// Any of "asc", "desc".
	Order InputItemListParamsOrder `query:"order,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (InputItemListParams) URLQuery

func (r InputItemListParams) URLQuery() (v url.Values, err error)

URLQuery serializes InputItemListParams's query parameters as `url.Values`.

type InputItemListParamsOrder

type InputItemListParamsOrder string

The order to return the input items in. Default is `desc`.

- `asc`: Return the input items in ascending order. - `desc`: Return the input items in descending order.

const (
	InputItemListParamsOrderAsc  InputItemListParamsOrder = "asc"
	InputItemListParamsOrderDesc InputItemListParamsOrder = "desc"
)

type InputItemService

type InputItemService struct {
	Options []option.RequestOption
}

InputItemService contains methods and other services that help with interacting with the openai API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewInputItemService method instead.

func NewInputItemService

func NewInputItemService(opts ...option.RequestOption) (r InputItemService)

NewInputItemService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*InputItemService) List

Returns a list of input items for a given response.

func (*InputItemService) ListAutoPaging

Returns a list of input items for a given response.

type Metadata

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 Reasoning

type Reasoning = shared.Reasoning

**o-series models only**

Configuration options for [reasoning models](https://platform.openai.com/docs/guides/reasoning).

This is an alias to an internal type.

type ReasoningEffort

type ReasoningEffort = shared.ReasoningEffort

**o-series models only**

Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supported values are `low`, `medium`, and `high`. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.

This is an alias to an internal type.

type ReasoningGenerateSummary

type ReasoningGenerateSummary = shared.ReasoningGenerateSummary

**Deprecated:** use `summary` instead.

A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of `auto`, `concise`, or `detailed`.

This is an alias to an internal type.

type ReasoningParam

type ReasoningParam = shared.ReasoningParam

**o-series models only**

Configuration options for [reasoning models](https://platform.openai.com/docs/guides/reasoning).

This is an alias to an internal type.

type ReasoningSummary

type ReasoningSummary = shared.ReasoningSummary

A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. One of `auto`, `concise`, or `detailed`.

This is an alias to an internal type.

type Response

type Response struct {
	// Unique identifier for this Response.
	ID string `json:"id,required"`
	// Unix timestamp (in seconds) of when this Response was created.
	CreatedAt float64 `json:"created_at,required"`
	// An error object returned when the model fails to generate a Response.
	Error ResponseError `json:"error,required"`
	// Details about why the response is incomplete.
	IncompleteDetails ResponseIncompleteDetails `json:"incomplete_details,required"`
	// A system (or developer) message inserted into the model's context.
	//
	// When using along with `previous_response_id`, the instructions from a previous
	// response will not be carried over to the next response. This makes it simple to
	// swap out system (or developer) messages in new responses.
	Instructions ResponseInstructionsUnion `json:"instructions,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, 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"`
	// Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
	// wide range of models with different capabilities, performance characteristics,
	// and price points. Refer to the
	// [model guide](https://platform.openai.com/docs/models) to browse and compare
	// available models.
	Model shared.ResponsesModel `json:"model,required"`
	// The object type of this resource - always set to `response`.
	Object constant.Response `json:"object,required"`
	// An array of content items generated by the model.
	//
	//   - The length and order of items in the `output` array is dependent on the
	//     model's response.
	//   - Rather than accessing the first item in the `output` array and assuming it's
	//     an `assistant` message with the content generated by the model, you might
	//     consider using the `output_text` property where supported in SDKs.
	Output []ResponseOutputItemUnion `json:"output,required"`
	// Whether to allow the model to run tool calls in parallel.
	ParallelToolCalls bool `json:"parallel_tool_calls,required"`
	// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
	// make the output more random, while lower values like 0.2 will make it more
	// focused and deterministic. We generally recommend altering this or `top_p` but
	// not both.
	Temperature float64 `json:"temperature,required"`
	// How the model should select which tool (or tools) to use when generating a
	// response. See the `tools` parameter to see how to specify which tools the model
	// can call.
	ToolChoice ResponseToolChoiceUnion `json:"tool_choice,required"`
	// An array of tools the model may call while generating a response. You can
	// specify which tool to use by setting the `tool_choice` parameter.
	//
	// The two categories of tools you can provide the model are:
	//
	//   - **Built-in tools**: Tools that are provided by OpenAI that extend the model's
	//     capabilities, like
	//     [web search](https://platform.openai.com/docs/guides/tools-web-search) or
	//     [file search](https://platform.openai.com/docs/guides/tools-file-search).
	//     Learn more about
	//     [built-in tools](https://platform.openai.com/docs/guides/tools).
	//   - **Function calls (custom tools)**: Functions that are defined by you, enabling
	//     the model to call your own code. Learn more about
	//     [function calling](https://platform.openai.com/docs/guides/function-calling).
	Tools []ToolUnion `json:"tools,required"`
	// An alternative to sampling with temperature, called nucleus sampling, where the
	// model considers the results of the tokens with top_p probability mass. So 0.1
	// means only the tokens comprising the top 10% probability mass are considered.
	//
	// We generally recommend altering this or `temperature` but not both.
	TopP float64 `json:"top_p,required"`
	// Whether to run the model response in the background.
	// [Learn more](https://platform.openai.com/docs/guides/background).
	Background bool `json:"background,nullable"`
	// An upper bound for the number of tokens that can be generated for a response,
	// including visible output tokens and
	// [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).
	MaxOutputTokens int64 `json:"max_output_tokens,nullable"`
	// The maximum number of total calls to built-in tools that can be processed in a
	// response. This maximum number applies across all built-in tool calls, not per
	// individual tool. Any further attempts to call a tool by the model will be
	// ignored.
	MaxToolCalls int64 `json:"max_tool_calls,nullable"`
	// The unique ID of the previous response to the model. Use this to create
	// multi-turn conversations. Learn more about
	// [conversation state](https://platform.openai.com/docs/guides/conversation-state).
	PreviousResponseID string `json:"previous_response_id,nullable"`
	// Reference to a prompt template and its variables.
	// [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
	Prompt ResponsePrompt `json:"prompt,nullable"`
	// **o-series models only**
	//
	// Configuration options for
	// [reasoning models](https://platform.openai.com/docs/guides/reasoning).
	Reasoning shared.Reasoning `json:"reasoning,nullable"`
	// Specifies the processing type used for serving the request.
	//
	//   - If set to 'auto', then the request will be processed with the service tier
	//     configured in the Project settings. Unless otherwise configured, the Project
	//     will use 'default'.
	//   - If set to 'default', then the requset will be processed with the standard
	//     pricing and performance for the selected model.
	//   - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
	//     'priority', then the request will be processed with the corresponding service
	//     tier. [Contact sales](https://openai.com/contact-sales) to learn more about
	//     Priority processing.
	//   - When not set, the default behavior is 'auto'.
	//
	// When the `service_tier` parameter is set, the response body will include the
	// `service_tier` value based on the processing mode actually used to serve the
	// request. This response value may be different from the value set in the
	// parameter.
	//
	// Any of "auto", "default", "flex", "scale", "priority".
	ServiceTier ResponseServiceTier `json:"service_tier,nullable"`
	// The status of the response generation. One of `completed`, `failed`,
	// `in_progress`, `cancelled`, `queued`, or `incomplete`.
	//
	// Any of "completed", "failed", "in_progress", "cancelled", "queued",
	// "incomplete".
	Status ResponseStatus `json:"status"`
	// Configuration options for a text response from the model. Can be plain text or
	// structured JSON data. Learn more:
	//
	// - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
	// - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
	Text ResponseTextConfig `json:"text"`
	// An integer between 0 and 20 specifying the number of most likely tokens to
	// return at each token position, each with an associated log probability.
	TopLogprobs int64 `json:"top_logprobs,nullable"`
	// The truncation strategy to use for the model response.
	//
	//   - `auto`: If the context of this response and previous ones exceeds the model's
	//     context window size, the model will truncate the response to fit the context
	//     window by dropping input items in the middle of the conversation.
	//   - `disabled` (default): If a model response will exceed the context window size
	//     for a model, the request will fail with a 400 error.
	//
	// Any of "auto", "disabled".
	Truncation ResponseTruncation `json:"truncation,nullable"`
	// Represents token usage details including input tokens, output tokens, a
	// breakdown of output tokens, and the total tokens used.
	Usage ResponseUsage `json:"usage"`
	// A stable identifier for your end-users. Used to boost cache hit rates by better
	// bucketing similar requests and to help OpenAI detect and prevent abuse.
	// [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
	User string `json:"user"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                 respjson.Field
		CreatedAt          respjson.Field
		Error              respjson.Field
		IncompleteDetails  respjson.Field
		Instructions       respjson.Field
		Metadata           respjson.Field
		Model              respjson.Field
		Object             respjson.Field
		Output             respjson.Field
		ParallelToolCalls  respjson.Field
		Temperature        respjson.Field
		ToolChoice         respjson.Field
		Tools              respjson.Field
		TopP               respjson.Field
		Background         respjson.Field
		MaxOutputTokens    respjson.Field
		MaxToolCalls       respjson.Field
		PreviousResponseID respjson.Field
		Prompt             respjson.Field
		Reasoning          respjson.Field
		ServiceTier        respjson.Field
		Status             respjson.Field
		Text               respjson.Field
		TopLogprobs        respjson.Field
		Truncation         respjson.Field
		Usage              respjson.Field
		User               respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Response) OutputText

func (r Response) OutputText() string

func (Response) RawJSON

func (r Response) RawJSON() string

Returns the unmodified JSON received from the API

func (*Response) UnmarshalJSON

func (r *Response) UnmarshalJSON(data []byte) error

type ResponseAudioDeltaEvent

type ResponseAudioDeltaEvent struct {
	// A chunk of Base64 encoded response audio bytes.
	Delta string `json:"delta,required"`
	// A sequence number for this chunk of the stream response.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.audio.delta`.
	Type constant.ResponseAudioDelta `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Delta          respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when there is a partial audio response.

func (ResponseAudioDeltaEvent) RawJSON

func (r ResponseAudioDeltaEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseAudioDeltaEvent) UnmarshalJSON

func (r *ResponseAudioDeltaEvent) UnmarshalJSON(data []byte) error

type ResponseAudioDoneEvent

type ResponseAudioDoneEvent struct {
	// The sequence number of the delta.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.audio.done`.
	Type constant.ResponseAudioDone `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when the audio response is complete.

func (ResponseAudioDoneEvent) RawJSON

func (r ResponseAudioDoneEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseAudioDoneEvent) UnmarshalJSON

func (r *ResponseAudioDoneEvent) UnmarshalJSON(data []byte) error

type ResponseAudioTranscriptDeltaEvent

type ResponseAudioTranscriptDeltaEvent struct {
	// The partial transcript of the audio response.
	Delta string `json:"delta,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.audio.transcript.delta`.
	Type constant.ResponseAudioTranscriptDelta `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Delta          respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when there is a partial transcript of audio.

func (ResponseAudioTranscriptDeltaEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseAudioTranscriptDeltaEvent) UnmarshalJSON

func (r *ResponseAudioTranscriptDeltaEvent) UnmarshalJSON(data []byte) error

type ResponseAudioTranscriptDoneEvent

type ResponseAudioTranscriptDoneEvent struct {
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.audio.transcript.done`.
	Type constant.ResponseAudioTranscriptDone `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when the full audio transcript is completed.

func (ResponseAudioTranscriptDoneEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseAudioTranscriptDoneEvent) UnmarshalJSON

func (r *ResponseAudioTranscriptDoneEvent) UnmarshalJSON(data []byte) error

type ResponseCodeInterpreterCallCodeDeltaEvent

type ResponseCodeInterpreterCallCodeDeltaEvent struct {
	// The partial code snippet being streamed by the code interpreter.
	Delta string `json:"delta,required"`
	// The unique identifier of the code interpreter tool call item.
	ItemID string `json:"item_id,required"`
	// The index of the output item in the response for which the code is being
	// streamed.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event, used to order streaming events.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.code_interpreter_call_code.delta`.
	Type constant.ResponseCodeInterpreterCallCodeDelta `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Delta          respjson.Field
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a partial code snippet is streamed by the code interpreter.

func (ResponseCodeInterpreterCallCodeDeltaEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseCodeInterpreterCallCodeDeltaEvent) UnmarshalJSON

func (r *ResponseCodeInterpreterCallCodeDeltaEvent) UnmarshalJSON(data []byte) error

type ResponseCodeInterpreterCallCodeDoneEvent

type ResponseCodeInterpreterCallCodeDoneEvent struct {
	// The final code snippet output by the code interpreter.
	Code string `json:"code,required"`
	// The unique identifier of the code interpreter tool call item.
	ItemID string `json:"item_id,required"`
	// The index of the output item in the response for which the code is finalized.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event, used to order streaming events.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.code_interpreter_call_code.done`.
	Type constant.ResponseCodeInterpreterCallCodeDone `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Code           respjson.Field
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when the code snippet is finalized by the code interpreter.

func (ResponseCodeInterpreterCallCodeDoneEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseCodeInterpreterCallCodeDoneEvent) UnmarshalJSON

func (r *ResponseCodeInterpreterCallCodeDoneEvent) UnmarshalJSON(data []byte) error

type ResponseCodeInterpreterCallCompletedEvent

type ResponseCodeInterpreterCallCompletedEvent struct {
	// The unique identifier of the code interpreter tool call item.
	ItemID string `json:"item_id,required"`
	// The index of the output item in the response for which the code interpreter call
	// is completed.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event, used to order streaming events.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.code_interpreter_call.completed`.
	Type constant.ResponseCodeInterpreterCallCompleted `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when the code interpreter call is completed.

func (ResponseCodeInterpreterCallCompletedEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseCodeInterpreterCallCompletedEvent) UnmarshalJSON

func (r *ResponseCodeInterpreterCallCompletedEvent) UnmarshalJSON(data []byte) error

type ResponseCodeInterpreterCallInProgressEvent

type ResponseCodeInterpreterCallInProgressEvent struct {
	// The unique identifier of the code interpreter tool call item.
	ItemID string `json:"item_id,required"`
	// The index of the output item in the response for which the code interpreter call
	// is in progress.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event, used to order streaming events.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.code_interpreter_call.in_progress`.
	Type constant.ResponseCodeInterpreterCallInProgress `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a code interpreter call is in progress.

func (ResponseCodeInterpreterCallInProgressEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseCodeInterpreterCallInProgressEvent) UnmarshalJSON

func (r *ResponseCodeInterpreterCallInProgressEvent) UnmarshalJSON(data []byte) error

type ResponseCodeInterpreterCallInterpretingEvent

type ResponseCodeInterpreterCallInterpretingEvent struct {
	// The unique identifier of the code interpreter tool call item.
	ItemID string `json:"item_id,required"`
	// The index of the output item in the response for which the code interpreter is
	// interpreting code.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event, used to order streaming events.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.code_interpreter_call.interpreting`.
	Type constant.ResponseCodeInterpreterCallInterpreting `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when the code interpreter is actively interpreting the code snippet.

func (ResponseCodeInterpreterCallInterpretingEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseCodeInterpreterCallInterpretingEvent) UnmarshalJSON

func (r *ResponseCodeInterpreterCallInterpretingEvent) UnmarshalJSON(data []byte) error

type ResponseCodeInterpreterToolCall

type ResponseCodeInterpreterToolCall struct {
	// The unique ID of the code interpreter tool call.
	ID string `json:"id,required"`
	// The code to run, or null if not available.
	Code string `json:"code,required"`
	// The ID of the container used to run the code.
	ContainerID string `json:"container_id,required"`
	// The outputs generated by the code interpreter, such as logs or images. Can be
	// null if no outputs are available.
	Outputs []ResponseCodeInterpreterToolCallOutputUnion `json:"outputs,required"`
	// The status of the code interpreter tool call.
	//
	// Any of "in_progress", "completed", "incomplete", "interpreting", "failed".
	Status ResponseCodeInterpreterToolCallStatus `json:"status,required"`
	// The type of the code interpreter tool call. Always `code_interpreter_call`.
	Type constant.CodeInterpreterCall `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Code        respjson.Field
		ContainerID respjson.Field
		Outputs     respjson.Field
		Status      respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A tool call to run code.

func (ResponseCodeInterpreterToolCall) RawJSON

Returns the unmodified JSON received from the API

func (ResponseCodeInterpreterToolCall) ToParam added in v1.1.0

ToParam converts this ResponseCodeInterpreterToolCall to a ResponseCodeInterpreterToolCallParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseCodeInterpreterToolCallParam.Overrides()

func (*ResponseCodeInterpreterToolCall) UnmarshalJSON

func (r *ResponseCodeInterpreterToolCall) UnmarshalJSON(data []byte) error

type ResponseCodeInterpreterToolCallOutputImage added in v1.7.0

type ResponseCodeInterpreterToolCallOutputImage struct {
	// The type of the output. Always 'image'.
	Type constant.Image `json:"type,required"`
	// The URL of the image output from the code interpreter.
	URL string `json:"url,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The image output from the code interpreter.

func (ResponseCodeInterpreterToolCallOutputImage) RawJSON added in v1.7.0

Returns the unmodified JSON received from the API

func (*ResponseCodeInterpreterToolCallOutputImage) UnmarshalJSON added in v1.7.0

func (r *ResponseCodeInterpreterToolCallOutputImage) UnmarshalJSON(data []byte) error

type ResponseCodeInterpreterToolCallOutputImageParam added in v1.7.0

type ResponseCodeInterpreterToolCallOutputImageParam struct {
	// The URL of the image output from the code interpreter.
	URL string `json:"url,required"`
	// The type of the output. Always 'image'.
	//
	// This field can be elided, and will marshal its zero value as "image".
	Type constant.Image `json:"type,required"`
	// contains filtered or unexported fields
}

The image output from the code interpreter.

The properties Type, URL are required.

func (ResponseCodeInterpreterToolCallOutputImageParam) MarshalJSON added in v1.7.0

func (r ResponseCodeInterpreterToolCallOutputImageParam) MarshalJSON() (data []byte, err error)

func (*ResponseCodeInterpreterToolCallOutputImageParam) UnmarshalJSON added in v1.7.0

type ResponseCodeInterpreterToolCallOutputLogs added in v1.7.0

type ResponseCodeInterpreterToolCallOutputLogs struct {
	// The logs output from the code interpreter.
	Logs string `json:"logs,required"`
	// The type of the output. Always 'logs'.
	Type constant.Logs `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Logs        respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The logs output from the code interpreter.

func (ResponseCodeInterpreterToolCallOutputLogs) RawJSON added in v1.7.0

Returns the unmodified JSON received from the API

func (*ResponseCodeInterpreterToolCallOutputLogs) UnmarshalJSON added in v1.7.0

func (r *ResponseCodeInterpreterToolCallOutputLogs) UnmarshalJSON(data []byte) error

type ResponseCodeInterpreterToolCallOutputLogsParam added in v1.7.0

type ResponseCodeInterpreterToolCallOutputLogsParam struct {
	// The logs output from the code interpreter.
	Logs string `json:"logs,required"`
	// The type of the output. Always 'logs'.
	//
	// This field can be elided, and will marshal its zero value as "logs".
	Type constant.Logs `json:"type,required"`
	// contains filtered or unexported fields
}

The logs output from the code interpreter.

The properties Logs, Type are required.

func (ResponseCodeInterpreterToolCallOutputLogsParam) MarshalJSON added in v1.7.0

func (r ResponseCodeInterpreterToolCallOutputLogsParam) MarshalJSON() (data []byte, err error)

func (*ResponseCodeInterpreterToolCallOutputLogsParam) UnmarshalJSON added in v1.7.0

type ResponseCodeInterpreterToolCallOutputUnion added in v1.7.0

type ResponseCodeInterpreterToolCallOutputUnion struct {
	// This field is from variant [ResponseCodeInterpreterToolCallOutputLogs].
	Logs string `json:"logs"`
	// Any of "logs", "image".
	Type string `json:"type"`
	// This field is from variant [ResponseCodeInterpreterToolCallOutputImage].
	URL  string `json:"url"`
	JSON struct {
		Logs respjson.Field
		Type respjson.Field
		URL  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseCodeInterpreterToolCallOutputUnion contains all possible properties and values from ResponseCodeInterpreterToolCallOutputLogs, ResponseCodeInterpreterToolCallOutputImage.

Use the ResponseCodeInterpreterToolCallOutputUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ResponseCodeInterpreterToolCallOutputUnion) AsAny added in v1.7.0

func (u ResponseCodeInterpreterToolCallOutputUnion) AsAny() anyResponseCodeInterpreterToolCallOutput

Use the following switch statement to find the correct variant

switch variant := ResponseCodeInterpreterToolCallOutputUnion.AsAny().(type) {
case responses.ResponseCodeInterpreterToolCallOutputLogs:
case responses.ResponseCodeInterpreterToolCallOutputImage:
default:
  fmt.Errorf("no variant present")
}

func (ResponseCodeInterpreterToolCallOutputUnion) AsImage added in v1.7.0

func (ResponseCodeInterpreterToolCallOutputUnion) AsLogs added in v1.7.0

func (ResponseCodeInterpreterToolCallOutputUnion) RawJSON added in v1.7.0

Returns the unmodified JSON received from the API

func (*ResponseCodeInterpreterToolCallOutputUnion) UnmarshalJSON added in v1.7.0

func (r *ResponseCodeInterpreterToolCallOutputUnion) UnmarshalJSON(data []byte) error

type ResponseCodeInterpreterToolCallOutputUnionParam added in v1.7.0

type ResponseCodeInterpreterToolCallOutputUnionParam struct {
	OfLogs  *ResponseCodeInterpreterToolCallOutputLogsParam  `json:",omitzero,inline"`
	OfImage *ResponseCodeInterpreterToolCallOutputImageParam `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ResponseCodeInterpreterToolCallOutputUnionParam) GetLogs added in v1.7.0

Returns a pointer to the underlying variant's property, if present.

func (ResponseCodeInterpreterToolCallOutputUnionParam) GetType added in v1.7.0

Returns a pointer to the underlying variant's property, if present.

func (ResponseCodeInterpreterToolCallOutputUnionParam) GetURL added in v1.7.0

Returns a pointer to the underlying variant's property, if present.

func (ResponseCodeInterpreterToolCallOutputUnionParam) MarshalJSON added in v1.7.0

func (*ResponseCodeInterpreterToolCallOutputUnionParam) UnmarshalJSON added in v1.7.0

type ResponseCodeInterpreterToolCallParam added in v1.1.0

type ResponseCodeInterpreterToolCallParam struct {
	// The code to run, or null if not available.
	Code param.Opt[string] `json:"code,omitzero,required"`
	// The outputs generated by the code interpreter, such as logs or images. Can be
	// null if no outputs are available.
	Outputs []ResponseCodeInterpreterToolCallOutputUnionParam `json:"outputs,omitzero,required"`
	// The unique ID of the code interpreter tool call.
	ID string `json:"id,required"`
	// The ID of the container used to run the code.
	ContainerID string `json:"container_id,required"`
	// The status of the code interpreter tool call.
	//
	// Any of "in_progress", "completed", "incomplete", "interpreting", "failed".
	Status ResponseCodeInterpreterToolCallStatus `json:"status,omitzero,required"`
	// The type of the code interpreter tool call. Always `code_interpreter_call`.
	//
	// This field can be elided, and will marshal its zero value as
	// "code_interpreter_call".
	Type constant.CodeInterpreterCall `json:"type,required"`
	// contains filtered or unexported fields
}

A tool call to run code.

The properties ID, Code, ContainerID, Outputs, Status, Type are required.

func (ResponseCodeInterpreterToolCallParam) MarshalJSON added in v1.1.0

func (r ResponseCodeInterpreterToolCallParam) MarshalJSON() (data []byte, err error)

func (*ResponseCodeInterpreterToolCallParam) UnmarshalJSON added in v1.1.0

func (r *ResponseCodeInterpreterToolCallParam) UnmarshalJSON(data []byte) error

type ResponseCodeInterpreterToolCallStatus

type ResponseCodeInterpreterToolCallStatus string

The status of the code interpreter tool call.

const (
	ResponseCodeInterpreterToolCallStatusInProgress   ResponseCodeInterpreterToolCallStatus = "in_progress"
	ResponseCodeInterpreterToolCallStatusCompleted    ResponseCodeInterpreterToolCallStatus = "completed"
	ResponseCodeInterpreterToolCallStatusIncomplete   ResponseCodeInterpreterToolCallStatus = "incomplete"
	ResponseCodeInterpreterToolCallStatusInterpreting ResponseCodeInterpreterToolCallStatus = "interpreting"
	ResponseCodeInterpreterToolCallStatusFailed       ResponseCodeInterpreterToolCallStatus = "failed"
)

type ResponseCompletedEvent

type ResponseCompletedEvent struct {
	// Properties of the completed response.
	Response Response `json:"response,required"`
	// The sequence number for this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.completed`.
	Type constant.ResponseCompleted `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Response       respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when the model response is complete.

func (ResponseCompletedEvent) RawJSON

func (r ResponseCompletedEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseCompletedEvent) UnmarshalJSON

func (r *ResponseCompletedEvent) UnmarshalJSON(data []byte) error

type ResponseComputerToolCall

type ResponseComputerToolCall struct {
	// The unique ID of the computer call.
	ID string `json:"id,required"`
	// A click action.
	Action ResponseComputerToolCallActionUnion `json:"action,required"`
	// An identifier used when responding to the tool call with output.
	CallID string `json:"call_id,required"`
	// The pending safety checks for the computer call.
	PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck `json:"pending_safety_checks,required"`
	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
	// Populated when items are returned via API.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status ResponseComputerToolCallStatus `json:"status,required"`
	// The type of the computer call. Always `computer_call`.
	//
	// Any of "computer_call".
	Type ResponseComputerToolCallType `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                  respjson.Field
		Action              respjson.Field
		CallID              respjson.Field
		PendingSafetyChecks respjson.Field
		Status              respjson.Field
		Type                respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A tool call to a computer use tool. See the [computer use guide](https://platform.openai.com/docs/guides/tools-computer-use) for more information.

func (ResponseComputerToolCall) RawJSON

func (r ResponseComputerToolCall) RawJSON() string

Returns the unmodified JSON received from the API

func (ResponseComputerToolCall) ToParam

ToParam converts this ResponseComputerToolCall to a ResponseComputerToolCallParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseComputerToolCallParam.Overrides()

func (*ResponseComputerToolCall) UnmarshalJSON

func (r *ResponseComputerToolCall) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionClick

type ResponseComputerToolCallActionClick struct {
	// Indicates which mouse button was pressed during the click. One of `left`,
	// `right`, `wheel`, `back`, or `forward`.
	//
	// Any of "left", "right", "wheel", "back", "forward".
	Button string `json:"button,required"`
	// Specifies the event type. For a click action, this property is always set to
	// `click`.
	Type constant.Click `json:"type,required"`
	// The x-coordinate where the click occurred.
	X int64 `json:"x,required"`
	// The y-coordinate where the click occurred.
	Y int64 `json:"y,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Button      respjson.Field
		Type        respjson.Field
		X           respjson.Field
		Y           respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A click action.

func (ResponseComputerToolCallActionClick) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseComputerToolCallActionClick) UnmarshalJSON

func (r *ResponseComputerToolCallActionClick) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionClickParam

type ResponseComputerToolCallActionClickParam struct {
	// Indicates which mouse button was pressed during the click. One of `left`,
	// `right`, `wheel`, `back`, or `forward`.
	//
	// Any of "left", "right", "wheel", "back", "forward".
	Button string `json:"button,omitzero,required"`
	// The x-coordinate where the click occurred.
	X int64 `json:"x,required"`
	// The y-coordinate where the click occurred.
	Y int64 `json:"y,required"`
	// Specifies the event type. For a click action, this property is always set to
	// `click`.
	//
	// This field can be elided, and will marshal its zero value as "click".
	Type constant.Click `json:"type,required"`
	// contains filtered or unexported fields
}

A click action.

The properties Button, Type, X, Y are required.

func (ResponseComputerToolCallActionClickParam) MarshalJSON

func (r ResponseComputerToolCallActionClickParam) MarshalJSON() (data []byte, err error)

func (*ResponseComputerToolCallActionClickParam) UnmarshalJSON

func (r *ResponseComputerToolCallActionClickParam) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionDoubleClick

type ResponseComputerToolCallActionDoubleClick struct {
	// Specifies the event type. For a double click action, this property is always set
	// to `double_click`.
	Type constant.DoubleClick `json:"type,required"`
	// The x-coordinate where the double click occurred.
	X int64 `json:"x,required"`
	// The y-coordinate where the double click occurred.
	Y int64 `json:"y,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		X           respjson.Field
		Y           respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A double click action.

func (ResponseComputerToolCallActionDoubleClick) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseComputerToolCallActionDoubleClick) UnmarshalJSON

func (r *ResponseComputerToolCallActionDoubleClick) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionDoubleClickParam

type ResponseComputerToolCallActionDoubleClickParam struct {
	// The x-coordinate where the double click occurred.
	X int64 `json:"x,required"`
	// The y-coordinate where the double click occurred.
	Y int64 `json:"y,required"`
	// Specifies the event type. For a double click action, this property is always set
	// to `double_click`.
	//
	// This field can be elided, and will marshal its zero value as "double_click".
	Type constant.DoubleClick `json:"type,required"`
	// contains filtered or unexported fields
}

A double click action.

The properties Type, X, Y are required.

func (ResponseComputerToolCallActionDoubleClickParam) MarshalJSON

func (r ResponseComputerToolCallActionDoubleClickParam) MarshalJSON() (data []byte, err error)

func (*ResponseComputerToolCallActionDoubleClickParam) UnmarshalJSON

type ResponseComputerToolCallActionDrag

type ResponseComputerToolCallActionDrag struct {
	// An array of coordinates representing the path of the drag action. Coordinates
	// will appear as an array of objects, eg
	//
	// “`
	// [
	//
	//	{ x: 100, y: 200 },
	//	{ x: 200, y: 300 }
	//
	// ]
	// “`
	Path []ResponseComputerToolCallActionDragPath `json:"path,required"`
	// Specifies the event type. For a drag action, this property is always set to
	// `drag`.
	Type constant.Drag `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Path        respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A drag action.

func (ResponseComputerToolCallActionDrag) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseComputerToolCallActionDrag) UnmarshalJSON

func (r *ResponseComputerToolCallActionDrag) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionDragParam

type ResponseComputerToolCallActionDragParam struct {
	// An array of coordinates representing the path of the drag action. Coordinates
	// will appear as an array of objects, eg
	//
	// “`
	// [
	//
	//	{ x: 100, y: 200 },
	//	{ x: 200, y: 300 }
	//
	// ]
	// “`
	Path []ResponseComputerToolCallActionDragPathParam `json:"path,omitzero,required"`
	// Specifies the event type. For a drag action, this property is always set to
	// `drag`.
	//
	// This field can be elided, and will marshal its zero value as "drag".
	Type constant.Drag `json:"type,required"`
	// contains filtered or unexported fields
}

A drag action.

The properties Path, Type are required.

func (ResponseComputerToolCallActionDragParam) MarshalJSON

func (r ResponseComputerToolCallActionDragParam) MarshalJSON() (data []byte, err error)

func (*ResponseComputerToolCallActionDragParam) UnmarshalJSON

func (r *ResponseComputerToolCallActionDragParam) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionDragPath

type ResponseComputerToolCallActionDragPath struct {
	// The x-coordinate.
	X int64 `json:"x,required"`
	// The y-coordinate.
	Y int64 `json:"y,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		X           respjson.Field
		Y           respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A series of x/y coordinate pairs in the drag path.

func (ResponseComputerToolCallActionDragPath) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseComputerToolCallActionDragPath) UnmarshalJSON

func (r *ResponseComputerToolCallActionDragPath) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionDragPathParam

type ResponseComputerToolCallActionDragPathParam struct {
	// The x-coordinate.
	X int64 `json:"x,required"`
	// The y-coordinate.
	Y int64 `json:"y,required"`
	// contains filtered or unexported fields
}

A series of x/y coordinate pairs in the drag path.

The properties X, Y are required.

func (ResponseComputerToolCallActionDragPathParam) MarshalJSON

func (r ResponseComputerToolCallActionDragPathParam) MarshalJSON() (data []byte, err error)

func (*ResponseComputerToolCallActionDragPathParam) UnmarshalJSON

func (r *ResponseComputerToolCallActionDragPathParam) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionKeypress

type ResponseComputerToolCallActionKeypress struct {
	// The combination of keys the model is requesting to be pressed. This is an array
	// of strings, each representing a key.
	Keys []string `json:"keys,required"`
	// Specifies the event type. For a keypress action, this property is always set to
	// `keypress`.
	Type constant.Keypress `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Keys        respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A collection of keypresses the model would like to perform.

func (ResponseComputerToolCallActionKeypress) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseComputerToolCallActionKeypress) UnmarshalJSON

func (r *ResponseComputerToolCallActionKeypress) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionKeypressParam

type ResponseComputerToolCallActionKeypressParam struct {
	// The combination of keys the model is requesting to be pressed. This is an array
	// of strings, each representing a key.
	Keys []string `json:"keys,omitzero,required"`
	// Specifies the event type. For a keypress action, this property is always set to
	// `keypress`.
	//
	// This field can be elided, and will marshal its zero value as "keypress".
	Type constant.Keypress `json:"type,required"`
	// contains filtered or unexported fields
}

A collection of keypresses the model would like to perform.

The properties Keys, Type are required.

func (ResponseComputerToolCallActionKeypressParam) MarshalJSON

func (r ResponseComputerToolCallActionKeypressParam) MarshalJSON() (data []byte, err error)

func (*ResponseComputerToolCallActionKeypressParam) UnmarshalJSON

func (r *ResponseComputerToolCallActionKeypressParam) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionMove

type ResponseComputerToolCallActionMove struct {
	// Specifies the event type. For a move action, this property is always set to
	// `move`.
	Type constant.Move `json:"type,required"`
	// The x-coordinate to move to.
	X int64 `json:"x,required"`
	// The y-coordinate to move to.
	Y int64 `json:"y,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		X           respjson.Field
		Y           respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A mouse move action.

func (ResponseComputerToolCallActionMove) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseComputerToolCallActionMove) UnmarshalJSON

func (r *ResponseComputerToolCallActionMove) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionMoveParam

type ResponseComputerToolCallActionMoveParam struct {
	// The x-coordinate to move to.
	X int64 `json:"x,required"`
	// The y-coordinate to move to.
	Y int64 `json:"y,required"`
	// Specifies the event type. For a move action, this property is always set to
	// `move`.
	//
	// This field can be elided, and will marshal its zero value as "move".
	Type constant.Move `json:"type,required"`
	// contains filtered or unexported fields
}

A mouse move action.

The properties Type, X, Y are required.

func (ResponseComputerToolCallActionMoveParam) MarshalJSON

func (r ResponseComputerToolCallActionMoveParam) MarshalJSON() (data []byte, err error)

func (*ResponseComputerToolCallActionMoveParam) UnmarshalJSON

func (r *ResponseComputerToolCallActionMoveParam) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionScreenshot

type ResponseComputerToolCallActionScreenshot struct {
	// Specifies the event type. For a screenshot action, this property is always set
	// to `screenshot`.
	Type constant.Screenshot `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A screenshot action.

func (ResponseComputerToolCallActionScreenshot) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseComputerToolCallActionScreenshot) UnmarshalJSON

func (r *ResponseComputerToolCallActionScreenshot) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionScreenshotParam

type ResponseComputerToolCallActionScreenshotParam struct {
	// Specifies the event type. For a screenshot action, this property is always set
	// to `screenshot`.
	Type constant.Screenshot `json:"type,required"`
	// contains filtered or unexported fields
}

A screenshot action.

This struct has a constant value, construct it with NewResponseComputerToolCallActionScreenshotParam.

func NewResponseComputerToolCallActionScreenshotParam

func NewResponseComputerToolCallActionScreenshotParam() ResponseComputerToolCallActionScreenshotParam

func (ResponseComputerToolCallActionScreenshotParam) MarshalJSON

func (r ResponseComputerToolCallActionScreenshotParam) MarshalJSON() (data []byte, err error)

func (*ResponseComputerToolCallActionScreenshotParam) UnmarshalJSON

func (r *ResponseComputerToolCallActionScreenshotParam) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionScroll

type ResponseComputerToolCallActionScroll struct {
	// The horizontal scroll distance.
	ScrollX int64 `json:"scroll_x,required"`
	// The vertical scroll distance.
	ScrollY int64 `json:"scroll_y,required"`
	// Specifies the event type. For a scroll action, this property is always set to
	// `scroll`.
	Type constant.Scroll `json:"type,required"`
	// The x-coordinate where the scroll occurred.
	X int64 `json:"x,required"`
	// The y-coordinate where the scroll occurred.
	Y int64 `json:"y,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ScrollX     respjson.Field
		ScrollY     respjson.Field
		Type        respjson.Field
		X           respjson.Field
		Y           respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A scroll action.

func (ResponseComputerToolCallActionScroll) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseComputerToolCallActionScroll) UnmarshalJSON

func (r *ResponseComputerToolCallActionScroll) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionScrollParam

type ResponseComputerToolCallActionScrollParam struct {
	// The horizontal scroll distance.
	ScrollX int64 `json:"scroll_x,required"`
	// The vertical scroll distance.
	ScrollY int64 `json:"scroll_y,required"`
	// The x-coordinate where the scroll occurred.
	X int64 `json:"x,required"`
	// The y-coordinate where the scroll occurred.
	Y int64 `json:"y,required"`
	// Specifies the event type. For a scroll action, this property is always set to
	// `scroll`.
	//
	// This field can be elided, and will marshal its zero value as "scroll".
	Type constant.Scroll `json:"type,required"`
	// contains filtered or unexported fields
}

A scroll action.

The properties ScrollX, ScrollY, Type, X, Y are required.

func (ResponseComputerToolCallActionScrollParam) MarshalJSON

func (r ResponseComputerToolCallActionScrollParam) MarshalJSON() (data []byte, err error)

func (*ResponseComputerToolCallActionScrollParam) UnmarshalJSON

func (r *ResponseComputerToolCallActionScrollParam) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionType

type ResponseComputerToolCallActionType struct {
	// The text to type.
	Text string `json:"text,required"`
	// Specifies the event type. For a type action, this property is always set to
	// `type`.
	Type constant.Type `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Text        respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An action to type in text.

func (ResponseComputerToolCallActionType) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseComputerToolCallActionType) UnmarshalJSON

func (r *ResponseComputerToolCallActionType) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionTypeParam

type ResponseComputerToolCallActionTypeParam struct {
	// The text to type.
	Text string `json:"text,required"`
	// Specifies the event type. For a type action, this property is always set to
	// `type`.
	//
	// This field can be elided, and will marshal its zero value as "type".
	Type constant.Type `json:"type,required"`
	// contains filtered or unexported fields
}

An action to type in text.

The properties Text, Type are required.

func (ResponseComputerToolCallActionTypeParam) MarshalJSON

func (r ResponseComputerToolCallActionTypeParam) MarshalJSON() (data []byte, err error)

func (*ResponseComputerToolCallActionTypeParam) UnmarshalJSON

func (r *ResponseComputerToolCallActionTypeParam) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionUnion

type ResponseComputerToolCallActionUnion struct {
	// This field is from variant [ResponseComputerToolCallActionClick].
	Button string `json:"button"`
	// Any of "click", "double_click", "drag", "keypress", "move", "screenshot",
	// "scroll", "type", "wait".
	Type string `json:"type"`
	X    int64  `json:"x"`
	Y    int64  `json:"y"`
	// This field is from variant [ResponseComputerToolCallActionDrag].
	Path []ResponseComputerToolCallActionDragPath `json:"path"`
	// This field is from variant [ResponseComputerToolCallActionKeypress].
	Keys []string `json:"keys"`
	// This field is from variant [ResponseComputerToolCallActionScroll].
	ScrollX int64 `json:"scroll_x"`
	// This field is from variant [ResponseComputerToolCallActionScroll].
	ScrollY int64 `json:"scroll_y"`
	// This field is from variant [ResponseComputerToolCallActionType].
	Text string `json:"text"`
	JSON struct {
		Button  respjson.Field
		Type    respjson.Field
		X       respjson.Field
		Y       respjson.Field
		Path    respjson.Field
		Keys    respjson.Field
		ScrollX respjson.Field
		ScrollY respjson.Field
		Text    respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseComputerToolCallActionUnion contains all possible properties and values from ResponseComputerToolCallActionClick, ResponseComputerToolCallActionDoubleClick, ResponseComputerToolCallActionDrag, ResponseComputerToolCallActionKeypress, ResponseComputerToolCallActionMove, ResponseComputerToolCallActionScreenshot, ResponseComputerToolCallActionScroll, ResponseComputerToolCallActionType, ResponseComputerToolCallActionWait.

Use the ResponseComputerToolCallActionUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ResponseComputerToolCallActionUnion) AsAny

func (u ResponseComputerToolCallActionUnion) AsAny() anyResponseComputerToolCallAction

Use the following switch statement to find the correct variant

switch variant := ResponseComputerToolCallActionUnion.AsAny().(type) {
case responses.ResponseComputerToolCallActionClick:
case responses.ResponseComputerToolCallActionDoubleClick:
case responses.ResponseComputerToolCallActionDrag:
case responses.ResponseComputerToolCallActionKeypress:
case responses.ResponseComputerToolCallActionMove:
case responses.ResponseComputerToolCallActionScreenshot:
case responses.ResponseComputerToolCallActionScroll:
case responses.ResponseComputerToolCallActionType:
case responses.ResponseComputerToolCallActionWait:
default:
  fmt.Errorf("no variant present")
}

func (ResponseComputerToolCallActionUnion) AsClick

func (ResponseComputerToolCallActionUnion) AsDoubleClick

func (ResponseComputerToolCallActionUnion) AsDrag

func (ResponseComputerToolCallActionUnion) AsKeypress

func (ResponseComputerToolCallActionUnion) AsMove

func (ResponseComputerToolCallActionUnion) AsScreenshot

func (ResponseComputerToolCallActionUnion) AsScroll

func (ResponseComputerToolCallActionUnion) AsType

func (ResponseComputerToolCallActionUnion) AsWait

func (ResponseComputerToolCallActionUnion) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseComputerToolCallActionUnion) UnmarshalJSON

func (r *ResponseComputerToolCallActionUnion) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionUnionParam

type ResponseComputerToolCallActionUnionParam struct {
	OfClick       *ResponseComputerToolCallActionClickParam       `json:",omitzero,inline"`
	OfDoubleClick *ResponseComputerToolCallActionDoubleClickParam `json:",omitzero,inline"`
	OfDrag        *ResponseComputerToolCallActionDragParam        `json:",omitzero,inline"`
	OfKeypress    *ResponseComputerToolCallActionKeypressParam    `json:",omitzero,inline"`
	OfMove        *ResponseComputerToolCallActionMoveParam        `json:",omitzero,inline"`
	OfScreenshot  *ResponseComputerToolCallActionScreenshotParam  `json:",omitzero,inline"`
	OfScroll      *ResponseComputerToolCallActionScrollParam      `json:",omitzero,inline"`
	OfType        *ResponseComputerToolCallActionTypeParam        `json:",omitzero,inline"`
	OfWait        *ResponseComputerToolCallActionWaitParam        `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ResponseComputerToolCallActionUnionParam) GetButton

Returns a pointer to the underlying variant's property, if present.

func (ResponseComputerToolCallActionUnionParam) GetKeys

Returns a pointer to the underlying variant's property, if present.

func (ResponseComputerToolCallActionUnionParam) GetPath

Returns a pointer to the underlying variant's property, if present.

func (ResponseComputerToolCallActionUnionParam) GetScrollX

Returns a pointer to the underlying variant's property, if present.

func (ResponseComputerToolCallActionUnionParam) GetScrollY

Returns a pointer to the underlying variant's property, if present.

func (ResponseComputerToolCallActionUnionParam) GetText

Returns a pointer to the underlying variant's property, if present.

func (ResponseComputerToolCallActionUnionParam) GetType

Returns a pointer to the underlying variant's property, if present.

func (ResponseComputerToolCallActionUnionParam) GetX

Returns a pointer to the underlying variant's property, if present.

func (ResponseComputerToolCallActionUnionParam) GetY

Returns a pointer to the underlying variant's property, if present.

func (ResponseComputerToolCallActionUnionParam) MarshalJSON

func (*ResponseComputerToolCallActionUnionParam) UnmarshalJSON

func (u *ResponseComputerToolCallActionUnionParam) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionWait

type ResponseComputerToolCallActionWait struct {
	// Specifies the event type. For a wait action, this property is always set to
	// `wait`.
	Type constant.Wait `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A wait action.

func (ResponseComputerToolCallActionWait) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseComputerToolCallActionWait) UnmarshalJSON

func (r *ResponseComputerToolCallActionWait) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallActionWaitParam

type ResponseComputerToolCallActionWaitParam struct {
	// Specifies the event type. For a wait action, this property is always set to
	// `wait`.
	Type constant.Wait `json:"type,required"`
	// contains filtered or unexported fields
}

A wait action.

This struct has a constant value, construct it with NewResponseComputerToolCallActionWaitParam.

func NewResponseComputerToolCallActionWaitParam

func NewResponseComputerToolCallActionWaitParam() ResponseComputerToolCallActionWaitParam

func (ResponseComputerToolCallActionWaitParam) MarshalJSON

func (r ResponseComputerToolCallActionWaitParam) MarshalJSON() (data []byte, err error)

func (*ResponseComputerToolCallActionWaitParam) UnmarshalJSON

func (r *ResponseComputerToolCallActionWaitParam) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallOutputItem

type ResponseComputerToolCallOutputItem struct {
	// The unique ID of the computer call tool output.
	ID string `json:"id,required"`
	// The ID of the computer tool call that produced the output.
	CallID string `json:"call_id,required"`
	// A computer screenshot image used with the computer use tool.
	Output ResponseComputerToolCallOutputScreenshot `json:"output,required"`
	// The type of the computer tool call output. Always `computer_call_output`.
	Type constant.ComputerCallOutput `json:"type,required"`
	// The safety checks reported by the API that have been acknowledged by the
	// developer.
	AcknowledgedSafetyChecks []ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck `json:"acknowledged_safety_checks"`
	// The status of the message input. One of `in_progress`, `completed`, or
	// `incomplete`. Populated when input items are returned via API.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status ResponseComputerToolCallOutputItemStatus `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                       respjson.Field
		CallID                   respjson.Field
		Output                   respjson.Field
		Type                     respjson.Field
		AcknowledgedSafetyChecks respjson.Field
		Status                   respjson.Field
		ExtraFields              map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ResponseComputerToolCallOutputItem) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseComputerToolCallOutputItem) UnmarshalJSON

func (r *ResponseComputerToolCallOutputItem) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck

type ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck struct {
	// The ID of the pending safety check.
	ID string `json:"id,required"`
	// The type of the pending safety check.
	Code string `json:"code,required"`
	// Details about the pending safety check.
	Message string `json:"message,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Code        respjson.Field
		Message     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A pending safety check for the computer call.

func (ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck) UnmarshalJSON

type ResponseComputerToolCallOutputItemStatus

type ResponseComputerToolCallOutputItemStatus string

The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API.

const (
	ResponseComputerToolCallOutputItemStatusInProgress ResponseComputerToolCallOutputItemStatus = "in_progress"
	ResponseComputerToolCallOutputItemStatusCompleted  ResponseComputerToolCallOutputItemStatus = "completed"
	ResponseComputerToolCallOutputItemStatusIncomplete ResponseComputerToolCallOutputItemStatus = "incomplete"
)

type ResponseComputerToolCallOutputScreenshot

type ResponseComputerToolCallOutputScreenshot struct {
	// Specifies the event type. For a computer screenshot, this property is always set
	// to `computer_screenshot`.
	Type constant.ComputerScreenshot `json:"type,required"`
	// The identifier of an uploaded file that contains the screenshot.
	FileID string `json:"file_id"`
	// The URL of the screenshot image.
	ImageURL string `json:"image_url"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		FileID      respjson.Field
		ImageURL    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A computer screenshot image used with the computer use tool.

func (ResponseComputerToolCallOutputScreenshot) RawJSON

Returns the unmodified JSON received from the API

func (ResponseComputerToolCallOutputScreenshot) ToParam

ToParam converts this ResponseComputerToolCallOutputScreenshot to a ResponseComputerToolCallOutputScreenshotParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseComputerToolCallOutputScreenshotParam.Overrides()

func (*ResponseComputerToolCallOutputScreenshot) UnmarshalJSON

func (r *ResponseComputerToolCallOutputScreenshot) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallOutputScreenshotParam

type ResponseComputerToolCallOutputScreenshotParam struct {
	// The identifier of an uploaded file that contains the screenshot.
	FileID param.Opt[string] `json:"file_id,omitzero"`
	// The URL of the screenshot image.
	ImageURL param.Opt[string] `json:"image_url,omitzero"`
	// Specifies the event type. For a computer screenshot, this property is always set
	// to `computer_screenshot`.
	//
	// This field can be elided, and will marshal its zero value as
	// "computer_screenshot".
	Type constant.ComputerScreenshot `json:"type,required"`
	// contains filtered or unexported fields
}

A computer screenshot image used with the computer use tool.

The property Type is required.

func (ResponseComputerToolCallOutputScreenshotParam) MarshalJSON

func (r ResponseComputerToolCallOutputScreenshotParam) MarshalJSON() (data []byte, err error)

func (*ResponseComputerToolCallOutputScreenshotParam) UnmarshalJSON

func (r *ResponseComputerToolCallOutputScreenshotParam) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallParam

type ResponseComputerToolCallParam struct {
	// The unique ID of the computer call.
	ID string `json:"id,required"`
	// A click action.
	Action ResponseComputerToolCallActionUnionParam `json:"action,omitzero,required"`
	// An identifier used when responding to the tool call with output.
	CallID string `json:"call_id,required"`
	// The pending safety checks for the computer call.
	PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheckParam `json:"pending_safety_checks,omitzero,required"`
	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
	// Populated when items are returned via API.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status ResponseComputerToolCallStatus `json:"status,omitzero,required"`
	// The type of the computer call. Always `computer_call`.
	//
	// Any of "computer_call".
	Type ResponseComputerToolCallType `json:"type,omitzero,required"`
	// contains filtered or unexported fields
}

A tool call to a computer use tool. See the [computer use guide](https://platform.openai.com/docs/guides/tools-computer-use) for more information.

The properties ID, Action, CallID, PendingSafetyChecks, Status, Type are required.

func (ResponseComputerToolCallParam) MarshalJSON

func (r ResponseComputerToolCallParam) MarshalJSON() (data []byte, err error)

func (*ResponseComputerToolCallParam) UnmarshalJSON

func (r *ResponseComputerToolCallParam) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallPendingSafetyCheck

type ResponseComputerToolCallPendingSafetyCheck struct {
	// The ID of the pending safety check.
	ID string `json:"id,required"`
	// The type of the pending safety check.
	Code string `json:"code,required"`
	// Details about the pending safety check.
	Message string `json:"message,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Code        respjson.Field
		Message     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A pending safety check for the computer call.

func (ResponseComputerToolCallPendingSafetyCheck) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseComputerToolCallPendingSafetyCheck) UnmarshalJSON

func (r *ResponseComputerToolCallPendingSafetyCheck) UnmarshalJSON(data []byte) error

type ResponseComputerToolCallPendingSafetyCheckParam

type ResponseComputerToolCallPendingSafetyCheckParam struct {
	// The ID of the pending safety check.
	ID string `json:"id,required"`
	// The type of the pending safety check.
	Code string `json:"code,required"`
	// Details about the pending safety check.
	Message string `json:"message,required"`
	// contains filtered or unexported fields
}

A pending safety check for the computer call.

The properties ID, Code, Message are required.

func (ResponseComputerToolCallPendingSafetyCheckParam) MarshalJSON

func (r ResponseComputerToolCallPendingSafetyCheckParam) MarshalJSON() (data []byte, err error)

func (*ResponseComputerToolCallPendingSafetyCheckParam) UnmarshalJSON

type ResponseComputerToolCallStatus

type ResponseComputerToolCallStatus string

The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

const (
	ResponseComputerToolCallStatusInProgress ResponseComputerToolCallStatus = "in_progress"
	ResponseComputerToolCallStatusCompleted  ResponseComputerToolCallStatus = "completed"
	ResponseComputerToolCallStatusIncomplete ResponseComputerToolCallStatus = "incomplete"
)

type ResponseComputerToolCallType

type ResponseComputerToolCallType string

The type of the computer call. Always `computer_call`.

const (
	ResponseComputerToolCallTypeComputerCall ResponseComputerToolCallType = "computer_call"
)

type ResponseContentPartAddedEvent

type ResponseContentPartAddedEvent struct {
	// The index of the content part that was added.
	ContentIndex int64 `json:"content_index,required"`
	// The ID of the output item that the content part was added to.
	ItemID string `json:"item_id,required"`
	// The index of the output item that the content part was added to.
	OutputIndex int64 `json:"output_index,required"`
	// The content part that was added.
	Part ResponseContentPartAddedEventPartUnion `json:"part,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.content_part.added`.
	Type constant.ResponseContentPartAdded `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ContentIndex   respjson.Field
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		Part           respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a new content part is added.

func (ResponseContentPartAddedEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseContentPartAddedEvent) UnmarshalJSON

func (r *ResponseContentPartAddedEvent) UnmarshalJSON(data []byte) error

type ResponseContentPartAddedEventPartUnion

type ResponseContentPartAddedEventPartUnion struct {
	// This field is from variant [ResponseOutputText].
	Annotations []ResponseOutputTextAnnotationUnion `json:"annotations"`
	// This field is from variant [ResponseOutputText].
	Text string `json:"text"`
	// Any of "output_text", "refusal".
	Type string `json:"type"`
	// This field is from variant [ResponseOutputText].
	Logprobs []ResponseOutputTextLogprob `json:"logprobs"`
	// This field is from variant [ResponseOutputRefusal].
	Refusal string `json:"refusal"`
	JSON    struct {
		Annotations respjson.Field
		Text        respjson.Field
		Type        respjson.Field
		Logprobs    respjson.Field
		Refusal     respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseContentPartAddedEventPartUnion contains all possible properties and values from ResponseOutputText, ResponseOutputRefusal.

Use the ResponseContentPartAddedEventPartUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ResponseContentPartAddedEventPartUnion) AsAny

func (u ResponseContentPartAddedEventPartUnion) AsAny() anyResponseContentPartAddedEventPart

Use the following switch statement to find the correct variant

switch variant := ResponseContentPartAddedEventPartUnion.AsAny().(type) {
case responses.ResponseOutputText:
case responses.ResponseOutputRefusal:
default:
  fmt.Errorf("no variant present")
}

func (ResponseContentPartAddedEventPartUnion) AsOutputText

func (ResponseContentPartAddedEventPartUnion) AsRefusal

func (ResponseContentPartAddedEventPartUnion) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseContentPartAddedEventPartUnion) UnmarshalJSON

func (r *ResponseContentPartAddedEventPartUnion) UnmarshalJSON(data []byte) error

type ResponseContentPartDoneEvent

type ResponseContentPartDoneEvent struct {
	// The index of the content part that is done.
	ContentIndex int64 `json:"content_index,required"`
	// The ID of the output item that the content part was added to.
	ItemID string `json:"item_id,required"`
	// The index of the output item that the content part was added to.
	OutputIndex int64 `json:"output_index,required"`
	// The content part that is done.
	Part ResponseContentPartDoneEventPartUnion `json:"part,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.content_part.done`.
	Type constant.ResponseContentPartDone `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ContentIndex   respjson.Field
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		Part           respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a content part is done.

func (ResponseContentPartDoneEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseContentPartDoneEvent) UnmarshalJSON

func (r *ResponseContentPartDoneEvent) UnmarshalJSON(data []byte) error

type ResponseContentPartDoneEventPartUnion

type ResponseContentPartDoneEventPartUnion struct {
	// This field is from variant [ResponseOutputText].
	Annotations []ResponseOutputTextAnnotationUnion `json:"annotations"`
	// This field is from variant [ResponseOutputText].
	Text string `json:"text"`
	// Any of "output_text", "refusal".
	Type string `json:"type"`
	// This field is from variant [ResponseOutputText].
	Logprobs []ResponseOutputTextLogprob `json:"logprobs"`
	// This field is from variant [ResponseOutputRefusal].
	Refusal string `json:"refusal"`
	JSON    struct {
		Annotations respjson.Field
		Text        respjson.Field
		Type        respjson.Field
		Logprobs    respjson.Field
		Refusal     respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseContentPartDoneEventPartUnion contains all possible properties and values from ResponseOutputText, ResponseOutputRefusal.

Use the ResponseContentPartDoneEventPartUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ResponseContentPartDoneEventPartUnion) AsAny

func (u ResponseContentPartDoneEventPartUnion) AsAny() anyResponseContentPartDoneEventPart

Use the following switch statement to find the correct variant

switch variant := ResponseContentPartDoneEventPartUnion.AsAny().(type) {
case responses.ResponseOutputText:
case responses.ResponseOutputRefusal:
default:
  fmt.Errorf("no variant present")
}

func (ResponseContentPartDoneEventPartUnion) AsOutputText

func (ResponseContentPartDoneEventPartUnion) AsRefusal

func (ResponseContentPartDoneEventPartUnion) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseContentPartDoneEventPartUnion) UnmarshalJSON

func (r *ResponseContentPartDoneEventPartUnion) UnmarshalJSON(data []byte) error

type ResponseCreatedEvent

type ResponseCreatedEvent struct {
	// The response that was created.
	Response Response `json:"response,required"`
	// The sequence number for this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.created`.
	Type constant.ResponseCreated `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Response       respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An event that is emitted when a response is created.

func (ResponseCreatedEvent) RawJSON

func (r ResponseCreatedEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseCreatedEvent) UnmarshalJSON

func (r *ResponseCreatedEvent) UnmarshalJSON(data []byte) error

type ResponseError

type ResponseError struct {
	// The error code for the response.
	//
	// Any of "server_error", "rate_limit_exceeded", "invalid_prompt",
	// "vector_store_timeout", "invalid_image", "invalid_image_format",
	// "invalid_base64_image", "invalid_image_url", "image_too_large",
	// "image_too_small", "image_parse_error", "image_content_policy_violation",
	// "invalid_image_mode", "image_file_too_large", "unsupported_image_media_type",
	// "empty_image_file", "failed_to_download_image", "image_file_not_found".
	Code ResponseErrorCode `json:"code,required"`
	// A human-readable description of the error.
	Message string `json:"message,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Code        respjson.Field
		Message     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An error object returned when the model fails to generate a Response.

func (ResponseError) RawJSON

func (r ResponseError) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseError) UnmarshalJSON

func (r *ResponseError) UnmarshalJSON(data []byte) error

type ResponseErrorCode

type ResponseErrorCode string

The error code for the response.

const (
	ResponseErrorCodeServerError                 ResponseErrorCode = "server_error"
	ResponseErrorCodeRateLimitExceeded           ResponseErrorCode = "rate_limit_exceeded"
	ResponseErrorCodeInvalidPrompt               ResponseErrorCode = "invalid_prompt"
	ResponseErrorCodeVectorStoreTimeout          ResponseErrorCode = "vector_store_timeout"
	ResponseErrorCodeInvalidImage                ResponseErrorCode = "invalid_image"
	ResponseErrorCodeInvalidImageFormat          ResponseErrorCode = "invalid_image_format"
	ResponseErrorCodeInvalidBase64Image          ResponseErrorCode = "invalid_base64_image"
	ResponseErrorCodeInvalidImageURL             ResponseErrorCode = "invalid_image_url"
	ResponseErrorCodeImageTooLarge               ResponseErrorCode = "image_too_large"
	ResponseErrorCodeImageTooSmall               ResponseErrorCode = "image_too_small"
	ResponseErrorCodeImageParseError             ResponseErrorCode = "image_parse_error"
	ResponseErrorCodeImageContentPolicyViolation ResponseErrorCode = "image_content_policy_violation"
	ResponseErrorCodeInvalidImageMode            ResponseErrorCode = "invalid_image_mode"
	ResponseErrorCodeImageFileTooLarge           ResponseErrorCode = "image_file_too_large"
	ResponseErrorCodeUnsupportedImageMediaType   ResponseErrorCode = "unsupported_image_media_type"
	ResponseErrorCodeEmptyImageFile              ResponseErrorCode = "empty_image_file"
	ResponseErrorCodeFailedToDownloadImage       ResponseErrorCode = "failed_to_download_image"
	ResponseErrorCodeImageFileNotFound           ResponseErrorCode = "image_file_not_found"
)

type ResponseErrorEvent

type ResponseErrorEvent struct {
	// The error code.
	Code string `json:"code,required"`
	// The error message.
	Message string `json:"message,required"`
	// The error parameter.
	Param string `json:"param,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `error`.
	Type constant.Error `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Code           respjson.Field
		Message        respjson.Field
		Param          respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when an error occurs.

func (ResponseErrorEvent) RawJSON

func (r ResponseErrorEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseErrorEvent) UnmarshalJSON

func (r *ResponseErrorEvent) UnmarshalJSON(data []byte) error

type ResponseFailedEvent

type ResponseFailedEvent struct {
	// The response that failed.
	Response Response `json:"response,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.failed`.
	Type constant.ResponseFailed `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Response       respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An event that is emitted when a response fails.

func (ResponseFailedEvent) RawJSON

func (r ResponseFailedEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseFailedEvent) UnmarshalJSON

func (r *ResponseFailedEvent) UnmarshalJSON(data []byte) error

type ResponseFileSearchCallCompletedEvent

type ResponseFileSearchCallCompletedEvent struct {
	// The ID of the output item that the file search call is initiated.
	ItemID string `json:"item_id,required"`
	// The index of the output item that the file search call is initiated.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.file_search_call.completed`.
	Type constant.ResponseFileSearchCallCompleted `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a file search call is completed (results found).

func (ResponseFileSearchCallCompletedEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseFileSearchCallCompletedEvent) UnmarshalJSON

func (r *ResponseFileSearchCallCompletedEvent) UnmarshalJSON(data []byte) error

type ResponseFileSearchCallInProgressEvent

type ResponseFileSearchCallInProgressEvent struct {
	// The ID of the output item that the file search call is initiated.
	ItemID string `json:"item_id,required"`
	// The index of the output item that the file search call is initiated.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.file_search_call.in_progress`.
	Type constant.ResponseFileSearchCallInProgress `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a file search call is initiated.

func (ResponseFileSearchCallInProgressEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseFileSearchCallInProgressEvent) UnmarshalJSON

func (r *ResponseFileSearchCallInProgressEvent) UnmarshalJSON(data []byte) error

type ResponseFileSearchCallSearchingEvent

type ResponseFileSearchCallSearchingEvent struct {
	// The ID of the output item that the file search call is initiated.
	ItemID string `json:"item_id,required"`
	// The index of the output item that the file search call is searching.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.file_search_call.searching`.
	Type constant.ResponseFileSearchCallSearching `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a file search is currently searching.

func (ResponseFileSearchCallSearchingEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseFileSearchCallSearchingEvent) UnmarshalJSON

func (r *ResponseFileSearchCallSearchingEvent) UnmarshalJSON(data []byte) error

type ResponseFileSearchToolCall

type ResponseFileSearchToolCall struct {
	// The unique ID of the file search tool call.
	ID string `json:"id,required"`
	// The queries used to search for files.
	Queries []string `json:"queries,required"`
	// The status of the file search tool call. One of `in_progress`, `searching`,
	// `incomplete` or `failed`,
	//
	// Any of "in_progress", "searching", "completed", "incomplete", "failed".
	Status ResponseFileSearchToolCallStatus `json:"status,required"`
	// The type of the file search tool call. Always `file_search_call`.
	Type constant.FileSearchCall `json:"type,required"`
	// The results of the file search tool call.
	Results []ResponseFileSearchToolCallResult `json:"results,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Queries     respjson.Field
		Status      respjson.Field
		Type        respjson.Field
		Results     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The results of a file search tool call. See the [file search guide](https://platform.openai.com/docs/guides/tools-file-search) for more information.

func (ResponseFileSearchToolCall) RawJSON

func (r ResponseFileSearchToolCall) RawJSON() string

Returns the unmodified JSON received from the API

func (ResponseFileSearchToolCall) ToParam

ToParam converts this ResponseFileSearchToolCall to a ResponseFileSearchToolCallParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseFileSearchToolCallParam.Overrides()

func (*ResponseFileSearchToolCall) UnmarshalJSON

func (r *ResponseFileSearchToolCall) UnmarshalJSON(data []byte) error

type ResponseFileSearchToolCallParam

type ResponseFileSearchToolCallParam struct {
	// The unique ID of the file search tool call.
	ID string `json:"id,required"`
	// The queries used to search for files.
	Queries []string `json:"queries,omitzero,required"`
	// The status of the file search tool call. One of `in_progress`, `searching`,
	// `incomplete` or `failed`,
	//
	// Any of "in_progress", "searching", "completed", "incomplete", "failed".
	Status ResponseFileSearchToolCallStatus `json:"status,omitzero,required"`
	// The results of the file search tool call.
	Results []ResponseFileSearchToolCallResultParam `json:"results,omitzero"`
	// The type of the file search tool call. Always `file_search_call`.
	//
	// This field can be elided, and will marshal its zero value as "file_search_call".
	Type constant.FileSearchCall `json:"type,required"`
	// contains filtered or unexported fields
}

The results of a file search tool call. See the [file search guide](https://platform.openai.com/docs/guides/tools-file-search) for more information.

The properties ID, Queries, Status, Type are required.

func (ResponseFileSearchToolCallParam) MarshalJSON

func (r ResponseFileSearchToolCallParam) MarshalJSON() (data []byte, err error)

func (*ResponseFileSearchToolCallParam) UnmarshalJSON

func (r *ResponseFileSearchToolCallParam) UnmarshalJSON(data []byte) error

type ResponseFileSearchToolCallResult

type ResponseFileSearchToolCallResult 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, 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, booleans, or numbers.
	Attributes map[string]ResponseFileSearchToolCallResultAttributeUnion `json:"attributes,nullable"`
	// The unique ID of the file.
	FileID string `json:"file_id"`
	// The name of the file.
	Filename string `json:"filename"`
	// The relevance score of the file - a value between 0 and 1.
	Score float64 `json:"score"`
	// The text that was retrieved from the file.
	Text string `json:"text"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Attributes  respjson.Field
		FileID      respjson.Field
		Filename    respjson.Field
		Score       respjson.Field
		Text        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ResponseFileSearchToolCallResult) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseFileSearchToolCallResult) UnmarshalJSON

func (r *ResponseFileSearchToolCallResult) UnmarshalJSON(data []byte) error

type ResponseFileSearchToolCallResultAttributeUnion

type ResponseFileSearchToolCallResultAttributeUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [float64] instead of an object.
	OfFloat float64 `json:",inline"`
	// This field will be present if the value is a [bool] instead of an object.
	OfBool bool `json:",inline"`
	JSON   struct {
		OfString respjson.Field
		OfFloat  respjson.Field
		OfBool   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseFileSearchToolCallResultAttributeUnion contains all possible properties and values from [string], [float64], [bool].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfFloat OfBool]

func (ResponseFileSearchToolCallResultAttributeUnion) AsBool

func (ResponseFileSearchToolCallResultAttributeUnion) AsFloat

func (ResponseFileSearchToolCallResultAttributeUnion) AsString

func (ResponseFileSearchToolCallResultAttributeUnion) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseFileSearchToolCallResultAttributeUnion) UnmarshalJSON

type ResponseFileSearchToolCallResultAttributeUnionParam

type ResponseFileSearchToolCallResultAttributeUnionParam struct {
	OfString param.Opt[string]  `json:",omitzero,inline"`
	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
	OfBool   param.Opt[bool]    `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ResponseFileSearchToolCallResultAttributeUnionParam) MarshalJSON

func (*ResponseFileSearchToolCallResultAttributeUnionParam) UnmarshalJSON

type ResponseFileSearchToolCallResultParam

type ResponseFileSearchToolCallResultParam struct {
	// The unique ID of the file.
	FileID param.Opt[string] `json:"file_id,omitzero"`
	// The name of the file.
	Filename param.Opt[string] `json:"filename,omitzero"`
	// The relevance score of the file - a value between 0 and 1.
	Score param.Opt[float64] `json:"score,omitzero"`
	// The text that was retrieved from the file.
	Text param.Opt[string] `json:"text,omitzero"`
	// 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, booleans, or numbers.
	Attributes map[string]ResponseFileSearchToolCallResultAttributeUnionParam `json:"attributes,omitzero"`
	// contains filtered or unexported fields
}

func (ResponseFileSearchToolCallResultParam) MarshalJSON

func (r ResponseFileSearchToolCallResultParam) MarshalJSON() (data []byte, err error)

func (*ResponseFileSearchToolCallResultParam) UnmarshalJSON

func (r *ResponseFileSearchToolCallResultParam) UnmarshalJSON(data []byte) error

type ResponseFileSearchToolCallStatus

type ResponseFileSearchToolCallStatus string

The status of the file search tool call. One of `in_progress`, `searching`, `incomplete` or `failed`,

const (
	ResponseFileSearchToolCallStatusInProgress ResponseFileSearchToolCallStatus = "in_progress"
	ResponseFileSearchToolCallStatusSearching  ResponseFileSearchToolCallStatus = "searching"
	ResponseFileSearchToolCallStatusCompleted  ResponseFileSearchToolCallStatus = "completed"
	ResponseFileSearchToolCallStatusIncomplete ResponseFileSearchToolCallStatus = "incomplete"
	ResponseFileSearchToolCallStatusFailed     ResponseFileSearchToolCallStatus = "failed"
)

type ResponseFormatJSONObject

type ResponseFormatJSONObject = shared.ResponseFormatJSONObject

JSON object response format. An older method of generating JSON responses. Using `json_schema` is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.

This is an alias to an internal type.

type ResponseFormatJSONObjectParam

type ResponseFormatJSONObjectParam = shared.ResponseFormatJSONObjectParam

JSON object response format. An older method of generating JSON responses. Using `json_schema` is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.

This is an alias to an internal type.

type ResponseFormatJSONSchema added in v1.1.0

type ResponseFormatJSONSchema = shared.ResponseFormatJSONSchema

JSON Schema response format. Used to generate structured JSON responses. Learn more about [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).

This is an alias to an internal type.

type ResponseFormatJSONSchemaJSONSchema added in v1.1.0

type ResponseFormatJSONSchemaJSONSchema = shared.ResponseFormatJSONSchemaJSONSchema

Structured Outputs configuration options, including a JSON Schema.

This is an alias to an internal type.

type ResponseFormatJSONSchemaJSONSchemaParam

type ResponseFormatJSONSchemaJSONSchemaParam = shared.ResponseFormatJSONSchemaJSONSchemaParam

Structured Outputs configuration options, including a JSON Schema.

This is an alias to an internal type.

type ResponseFormatJSONSchemaParam

type ResponseFormatJSONSchemaParam = shared.ResponseFormatJSONSchemaParam

JSON Schema response format. Used to generate structured JSON responses. Learn more about [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).

This is an alias to an internal type.

type ResponseFormatText

type ResponseFormatText = shared.ResponseFormatText

Default response format. Used to generate text responses.

This is an alias to an internal type.

type ResponseFormatTextConfigUnion

type ResponseFormatTextConfigUnion struct {
	// Any of "text", "json_schema", "json_object".
	Type string `json:"type"`
	// This field is from variant [ResponseFormatTextJSONSchemaConfig].
	Name string `json:"name"`
	// This field is from variant [ResponseFormatTextJSONSchemaConfig].
	Schema map[string]any `json:"schema"`
	// This field is from variant [ResponseFormatTextJSONSchemaConfig].
	Description string `json:"description"`
	// This field is from variant [ResponseFormatTextJSONSchemaConfig].
	Strict bool `json:"strict"`
	JSON   struct {
		Type        respjson.Field
		Name        respjson.Field
		Schema      respjson.Field
		Description respjson.Field
		Strict      respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseFormatTextConfigUnion contains all possible properties and values from shared.ResponseFormatText, ResponseFormatTextJSONSchemaConfig, shared.ResponseFormatJSONObject.

Use the ResponseFormatTextConfigUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ResponseFormatTextConfigUnion) AsAny

func (u ResponseFormatTextConfigUnion) AsAny() anyResponseFormatTextConfig

Use the following switch statement to find the correct variant

switch variant := ResponseFormatTextConfigUnion.AsAny().(type) {
case shared.ResponseFormatText:
case responses.ResponseFormatTextJSONSchemaConfig:
case shared.ResponseFormatJSONObject:
default:
  fmt.Errorf("no variant present")
}

func (ResponseFormatTextConfigUnion) AsJSONObject

func (ResponseFormatTextConfigUnion) AsJSONSchema

func (ResponseFormatTextConfigUnion) AsText

func (ResponseFormatTextConfigUnion) RawJSON

Returns the unmodified JSON received from the API

func (ResponseFormatTextConfigUnion) ToParam

ToParam converts this ResponseFormatTextConfigUnion to a ResponseFormatTextConfigUnionParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseFormatTextConfigUnionParam.Overrides()

func (*ResponseFormatTextConfigUnion) UnmarshalJSON

func (r *ResponseFormatTextConfigUnion) UnmarshalJSON(data []byte) error

type ResponseFormatTextConfigUnionParam

type ResponseFormatTextConfigUnionParam struct {
	OfText       *shared.ResponseFormatTextParam          `json:",omitzero,inline"`
	OfJSONSchema *ResponseFormatTextJSONSchemaConfigParam `json:",omitzero,inline"`
	OfJSONObject *shared.ResponseFormatJSONObjectParam    `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func ResponseFormatTextConfigParamOfJSONSchema

func ResponseFormatTextConfigParamOfJSONSchema(name string, schema map[string]any) ResponseFormatTextConfigUnionParam

func (ResponseFormatTextConfigUnionParam) GetDescription

func (u ResponseFormatTextConfigUnionParam) GetDescription() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseFormatTextConfigUnionParam) GetName

Returns a pointer to the underlying variant's property, if present.

func (ResponseFormatTextConfigUnionParam) GetSchema

func (u ResponseFormatTextConfigUnionParam) GetSchema() map[string]any

Returns a pointer to the underlying variant's property, if present.

func (ResponseFormatTextConfigUnionParam) GetStrict

Returns a pointer to the underlying variant's property, if present.

func (ResponseFormatTextConfigUnionParam) GetType

Returns a pointer to the underlying variant's property, if present.

func (ResponseFormatTextConfigUnionParam) MarshalJSON

func (u ResponseFormatTextConfigUnionParam) MarshalJSON() ([]byte, error)

func (*ResponseFormatTextConfigUnionParam) UnmarshalJSON

func (u *ResponseFormatTextConfigUnionParam) UnmarshalJSON(data []byte) error

type ResponseFormatTextJSONSchemaConfig

type ResponseFormatTextJSONSchemaConfig struct {
	// The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores
	// and dashes, with a maximum length of 64.
	Name string `json:"name,required"`
	// The schema for the response format, described as a JSON Schema object. Learn how
	// to build JSON schemas [here](https://json-schema.org/).
	Schema map[string]any `json:"schema,required"`
	// The type of response format being defined. Always `json_schema`.
	Type constant.JSONSchema `json:"type,required"`
	// A description of what the response format is for, used by the model to determine
	// how to respond in the format.
	Description string `json:"description"`
	// Whether to enable strict schema adherence when generating the output. If set to
	// true, the model will always follow the exact schema defined in the `schema`
	// field. Only a subset of JSON Schema is supported when `strict` is `true`. To
	// learn more, read the
	// [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
	Strict bool `json:"strict,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Name        respjson.Field
		Schema      respjson.Field
		Type        respjson.Field
		Description respjson.Field
		Strict      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

JSON Schema response format. Used to generate structured JSON responses. Learn more about [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).

func (ResponseFormatTextJSONSchemaConfig) ImplResponseFormatTextConfigUnion

func (ResponseFormatTextJSONSchemaConfig) ImplResponseFormatTextConfigUnion()

func (ResponseFormatTextJSONSchemaConfig) RawJSON

Returns the unmodified JSON received from the API

func (ResponseFormatTextJSONSchemaConfig) ToParam

ToParam converts this ResponseFormatTextJSONSchemaConfig to a ResponseFormatTextJSONSchemaConfigParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseFormatTextJSONSchemaConfigParam.Overrides()

func (*ResponseFormatTextJSONSchemaConfig) UnmarshalJSON

func (r *ResponseFormatTextJSONSchemaConfig) UnmarshalJSON(data []byte) error

type ResponseFormatTextJSONSchemaConfigParam

type ResponseFormatTextJSONSchemaConfigParam struct {
	// The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores
	// and dashes, with a maximum length of 64.
	Name string `json:"name,required"`
	// The schema for the response format, described as a JSON Schema object. Learn how
	// to build JSON schemas [here](https://json-schema.org/).
	Schema map[string]any `json:"schema,omitzero,required"`
	// Whether to enable strict schema adherence when generating the output. If set to
	// true, the model will always follow the exact schema defined in the `schema`
	// field. Only a subset of JSON Schema is supported when `strict` is `true`. To
	// learn more, read the
	// [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
	Strict param.Opt[bool] `json:"strict,omitzero"`
	// A description of what the response format is for, used by the model to determine
	// how to respond in the format.
	Description param.Opt[string] `json:"description,omitzero"`
	// The type of response format being defined. Always `json_schema`.
	//
	// This field can be elided, and will marshal its zero value as "json_schema".
	Type constant.JSONSchema `json:"type,required"`
	// contains filtered or unexported fields
}

JSON Schema response format. Used to generate structured JSON responses. Learn more about [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).

The properties Name, Schema, Type are required.

func (ResponseFormatTextJSONSchemaConfigParam) MarshalJSON

func (r ResponseFormatTextJSONSchemaConfigParam) MarshalJSON() (data []byte, err error)

func (*ResponseFormatTextJSONSchemaConfigParam) UnmarshalJSON

func (r *ResponseFormatTextJSONSchemaConfigParam) UnmarshalJSON(data []byte) error

type ResponseFormatTextParam

type ResponseFormatTextParam = shared.ResponseFormatTextParam

Default response format. Used to generate text responses.

This is an alias to an internal type.

type ResponseFunctionCallArgumentsDeltaEvent

type ResponseFunctionCallArgumentsDeltaEvent struct {
	// The function-call arguments delta that is added.
	Delta string `json:"delta,required"`
	// The ID of the output item that the function-call arguments delta is added to.
	ItemID string `json:"item_id,required"`
	// The index of the output item that the function-call arguments delta is added to.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.function_call_arguments.delta`.
	Type constant.ResponseFunctionCallArgumentsDelta `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Delta          respjson.Field
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when there is a partial function-call arguments delta.

func (ResponseFunctionCallArgumentsDeltaEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseFunctionCallArgumentsDeltaEvent) UnmarshalJSON

func (r *ResponseFunctionCallArgumentsDeltaEvent) UnmarshalJSON(data []byte) error

type ResponseFunctionCallArgumentsDoneEvent

type ResponseFunctionCallArgumentsDoneEvent struct {
	// The function-call arguments.
	Arguments string `json:"arguments,required"`
	// The ID of the item.
	ItemID string `json:"item_id,required"`
	// The index of the output item.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event.
	SequenceNumber int64                                      `json:"sequence_number,required"`
	Type           constant.ResponseFunctionCallArgumentsDone `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Arguments      respjson.Field
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when function-call arguments are finalized.

func (ResponseFunctionCallArgumentsDoneEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseFunctionCallArgumentsDoneEvent) UnmarshalJSON

func (r *ResponseFunctionCallArgumentsDoneEvent) UnmarshalJSON(data []byte) error

type ResponseFunctionToolCall

type ResponseFunctionToolCall struct {
	// A JSON string of the arguments to pass to the function.
	Arguments string `json:"arguments,required"`
	// The unique ID of the function tool call generated by the model.
	CallID string `json:"call_id,required"`
	// The name of the function to run.
	Name string `json:"name,required"`
	// The type of the function tool call. Always `function_call`.
	Type constant.FunctionCall `json:"type,required"`
	// The unique ID of the function tool call.
	ID string `json:"id"`
	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
	// Populated when items are returned via API.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status ResponseFunctionToolCallStatus `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Arguments   respjson.Field
		CallID      respjson.Field
		Name        respjson.Field
		Type        respjson.Field
		ID          respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A tool call to run a function. See the [function calling guide](https://platform.openai.com/docs/guides/function-calling) for more information.

func (ResponseFunctionToolCall) RawJSON

func (r ResponseFunctionToolCall) RawJSON() string

Returns the unmodified JSON received from the API

func (ResponseFunctionToolCall) ToParam

ToParam converts this ResponseFunctionToolCall to a ResponseFunctionToolCallParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseFunctionToolCallParam.Overrides()

func (*ResponseFunctionToolCall) UnmarshalJSON

func (r *ResponseFunctionToolCall) UnmarshalJSON(data []byte) error

type ResponseFunctionToolCallItem

type ResponseFunctionToolCallItem struct {
	// The unique ID of the function tool call.
	ID string `json:"id,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	ResponseFunctionToolCall
}

A tool call to run a function. See the [function calling guide](https://platform.openai.com/docs/guides/function-calling) for more information.

func (ResponseFunctionToolCallItem) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseFunctionToolCallItem) UnmarshalJSON

func (r *ResponseFunctionToolCallItem) UnmarshalJSON(data []byte) error

type ResponseFunctionToolCallOutputItem

type ResponseFunctionToolCallOutputItem struct {
	// The unique ID of the function call tool output.
	ID string `json:"id,required"`
	// The unique ID of the function tool call generated by the model.
	CallID string `json:"call_id,required"`
	// A JSON string of the output of the function tool call.
	Output string `json:"output,required"`
	// The type of the function tool call output. Always `function_call_output`.
	Type constant.FunctionCallOutput `json:"type,required"`
	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
	// Populated when items are returned via API.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status ResponseFunctionToolCallOutputItemStatus `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CallID      respjson.Field
		Output      respjson.Field
		Type        respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ResponseFunctionToolCallOutputItem) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseFunctionToolCallOutputItem) UnmarshalJSON

func (r *ResponseFunctionToolCallOutputItem) UnmarshalJSON(data []byte) error

type ResponseFunctionToolCallOutputItemStatus

type ResponseFunctionToolCallOutputItemStatus string

The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

const (
	ResponseFunctionToolCallOutputItemStatusInProgress ResponseFunctionToolCallOutputItemStatus = "in_progress"
	ResponseFunctionToolCallOutputItemStatusCompleted  ResponseFunctionToolCallOutputItemStatus = "completed"
	ResponseFunctionToolCallOutputItemStatusIncomplete ResponseFunctionToolCallOutputItemStatus = "incomplete"
)

type ResponseFunctionToolCallParam

type ResponseFunctionToolCallParam struct {
	// A JSON string of the arguments to pass to the function.
	Arguments string `json:"arguments,required"`
	// The unique ID of the function tool call generated by the model.
	CallID string `json:"call_id,required"`
	// The name of the function to run.
	Name string `json:"name,required"`
	// The unique ID of the function tool call.
	ID param.Opt[string] `json:"id,omitzero"`
	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
	// Populated when items are returned via API.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status ResponseFunctionToolCallStatus `json:"status,omitzero"`
	// The type of the function tool call. Always `function_call`.
	//
	// This field can be elided, and will marshal its zero value as "function_call".
	Type constant.FunctionCall `json:"type,required"`
	// contains filtered or unexported fields
}

A tool call to run a function. See the [function calling guide](https://platform.openai.com/docs/guides/function-calling) for more information.

The properties Arguments, CallID, Name, Type are required.

func (ResponseFunctionToolCallParam) MarshalJSON

func (r ResponseFunctionToolCallParam) MarshalJSON() (data []byte, err error)

func (*ResponseFunctionToolCallParam) UnmarshalJSON

func (r *ResponseFunctionToolCallParam) UnmarshalJSON(data []byte) error

type ResponseFunctionToolCallStatus

type ResponseFunctionToolCallStatus string

The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

const (
	ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
	ResponseFunctionToolCallStatusCompleted  ResponseFunctionToolCallStatus = "completed"
	ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
)

type ResponseFunctionWebSearch

type ResponseFunctionWebSearch struct {
	// The unique ID of the web search tool call.
	ID string `json:"id,required"`
	// An object describing the specific action taken in this web search call. Includes
	// details on how the model used the web (search, open_page, find).
	Action ResponseFunctionWebSearchActionUnion `json:"action,required"`
	// The status of the web search tool call.
	//
	// Any of "in_progress", "searching", "completed", "failed".
	Status ResponseFunctionWebSearchStatus `json:"status,required"`
	// The type of the web search tool call. Always `web_search_call`.
	Type constant.WebSearchCall `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Action      respjson.Field
		Status      respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The results of a web search tool call. See the [web search guide](https://platform.openai.com/docs/guides/tools-web-search) for more information.

func (ResponseFunctionWebSearch) RawJSON

func (r ResponseFunctionWebSearch) RawJSON() string

Returns the unmodified JSON received from the API

func (ResponseFunctionWebSearch) ToParam

ToParam converts this ResponseFunctionWebSearch to a ResponseFunctionWebSearchParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseFunctionWebSearchParam.Overrides()

func (*ResponseFunctionWebSearch) UnmarshalJSON

func (r *ResponseFunctionWebSearch) UnmarshalJSON(data []byte) error

type ResponseFunctionWebSearchActionFind added in v1.8.0

type ResponseFunctionWebSearchActionFind struct {
	// The pattern or text to search for within the page.
	Pattern string `json:"pattern,required"`
	// The action type.
	Type constant.Find `json:"type,required"`
	// The URL of the page searched for the pattern.
	URL string `json:"url,required" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Pattern     respjson.Field
		Type        respjson.Field
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Action type "find": Searches for a pattern within a loaded page.

func (ResponseFunctionWebSearchActionFind) RawJSON added in v1.8.0

Returns the unmodified JSON received from the API

func (*ResponseFunctionWebSearchActionFind) UnmarshalJSON added in v1.8.0

func (r *ResponseFunctionWebSearchActionFind) UnmarshalJSON(data []byte) error

type ResponseFunctionWebSearchActionFindParam added in v1.8.0

type ResponseFunctionWebSearchActionFindParam struct {
	// The pattern or text to search for within the page.
	Pattern string `json:"pattern,required"`
	// The URL of the page searched for the pattern.
	URL string `json:"url,required" format:"uri"`
	// The action type.
	//
	// This field can be elided, and will marshal its zero value as "find".
	Type constant.Find `json:"type,required"`
	// contains filtered or unexported fields
}

Action type "find": Searches for a pattern within a loaded page.

The properties Pattern, Type, URL are required.

func (ResponseFunctionWebSearchActionFindParam) MarshalJSON added in v1.8.0

func (r ResponseFunctionWebSearchActionFindParam) MarshalJSON() (data []byte, err error)

func (*ResponseFunctionWebSearchActionFindParam) UnmarshalJSON added in v1.8.0

func (r *ResponseFunctionWebSearchActionFindParam) UnmarshalJSON(data []byte) error

type ResponseFunctionWebSearchActionOpenPage added in v1.8.0

type ResponseFunctionWebSearchActionOpenPage struct {
	// The action type.
	Type constant.OpenPage `json:"type,required"`
	// The URL opened by the model.
	URL string `json:"url,required" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Action type "open_page" - Opens a specific URL from search results.

func (ResponseFunctionWebSearchActionOpenPage) RawJSON added in v1.8.0

Returns the unmodified JSON received from the API

func (*ResponseFunctionWebSearchActionOpenPage) UnmarshalJSON added in v1.8.0

func (r *ResponseFunctionWebSearchActionOpenPage) UnmarshalJSON(data []byte) error

type ResponseFunctionWebSearchActionOpenPageParam added in v1.8.0

type ResponseFunctionWebSearchActionOpenPageParam struct {
	// The URL opened by the model.
	URL string `json:"url,required" format:"uri"`
	// The action type.
	//
	// This field can be elided, and will marshal its zero value as "open_page".
	Type constant.OpenPage `json:"type,required"`
	// contains filtered or unexported fields
}

Action type "open_page" - Opens a specific URL from search results.

The properties Type, URL are required.

func (ResponseFunctionWebSearchActionOpenPageParam) MarshalJSON added in v1.8.0

func (r ResponseFunctionWebSearchActionOpenPageParam) MarshalJSON() (data []byte, err error)

func (*ResponseFunctionWebSearchActionOpenPageParam) UnmarshalJSON added in v1.8.0

func (r *ResponseFunctionWebSearchActionOpenPageParam) UnmarshalJSON(data []byte) error

type ResponseFunctionWebSearchActionSearch added in v1.8.0

type ResponseFunctionWebSearchActionSearch struct {
	// The search query.
	Query string `json:"query,required"`
	// The action type.
	Type constant.Search `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Query       respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Action type "search" - Performs a web search query.

func (ResponseFunctionWebSearchActionSearch) RawJSON added in v1.8.0

Returns the unmodified JSON received from the API

func (*ResponseFunctionWebSearchActionSearch) UnmarshalJSON added in v1.8.0

func (r *ResponseFunctionWebSearchActionSearch) UnmarshalJSON(data []byte) error

type ResponseFunctionWebSearchActionSearchParam added in v1.8.0

type ResponseFunctionWebSearchActionSearchParam struct {
	// The search query.
	Query string `json:"query,required"`
	// The action type.
	//
	// This field can be elided, and will marshal its zero value as "search".
	Type constant.Search `json:"type,required"`
	// contains filtered or unexported fields
}

Action type "search" - Performs a web search query.

The properties Query, Type are required.

func (ResponseFunctionWebSearchActionSearchParam) MarshalJSON added in v1.8.0

func (r ResponseFunctionWebSearchActionSearchParam) MarshalJSON() (data []byte, err error)

func (*ResponseFunctionWebSearchActionSearchParam) UnmarshalJSON added in v1.8.0

func (r *ResponseFunctionWebSearchActionSearchParam) UnmarshalJSON(data []byte) error

type ResponseFunctionWebSearchActionUnion added in v1.8.0

type ResponseFunctionWebSearchActionUnion struct {
	// This field is from variant [ResponseFunctionWebSearchActionSearch].
	Query string `json:"query"`
	// Any of "search", "open_page", "find".
	Type string `json:"type"`
	URL  string `json:"url"`
	// This field is from variant [ResponseFunctionWebSearchActionFind].
	Pattern string `json:"pattern"`
	JSON    struct {
		Query   respjson.Field
		Type    respjson.Field
		URL     respjson.Field
		Pattern respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseFunctionWebSearchActionUnion contains all possible properties and values from ResponseFunctionWebSearchActionSearch, ResponseFunctionWebSearchActionOpenPage, ResponseFunctionWebSearchActionFind.

Use the ResponseFunctionWebSearchActionUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ResponseFunctionWebSearchActionUnion) AsAny added in v1.8.0

func (u ResponseFunctionWebSearchActionUnion) AsAny() anyResponseFunctionWebSearchAction

Use the following switch statement to find the correct variant

switch variant := ResponseFunctionWebSearchActionUnion.AsAny().(type) {
case responses.ResponseFunctionWebSearchActionSearch:
case responses.ResponseFunctionWebSearchActionOpenPage:
case responses.ResponseFunctionWebSearchActionFind:
default:
  fmt.Errorf("no variant present")
}

func (ResponseFunctionWebSearchActionUnion) AsFind added in v1.8.0

func (ResponseFunctionWebSearchActionUnion) AsOpenPage added in v1.8.0

func (ResponseFunctionWebSearchActionUnion) AsSearch added in v1.8.0

func (ResponseFunctionWebSearchActionUnion) RawJSON added in v1.8.0

Returns the unmodified JSON received from the API

func (*ResponseFunctionWebSearchActionUnion) UnmarshalJSON added in v1.8.0

func (r *ResponseFunctionWebSearchActionUnion) UnmarshalJSON(data []byte) error

type ResponseFunctionWebSearchActionUnionParam added in v1.8.0

type ResponseFunctionWebSearchActionUnionParam struct {
	OfSearch   *ResponseFunctionWebSearchActionSearchParam   `json:",omitzero,inline"`
	OfOpenPage *ResponseFunctionWebSearchActionOpenPageParam `json:",omitzero,inline"`
	OfFind     *ResponseFunctionWebSearchActionFindParam     `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ResponseFunctionWebSearchActionUnionParam) GetPattern added in v1.8.0

Returns a pointer to the underlying variant's property, if present.

func (ResponseFunctionWebSearchActionUnionParam) GetQuery added in v1.8.0

Returns a pointer to the underlying variant's property, if present.

func (ResponseFunctionWebSearchActionUnionParam) GetType added in v1.8.0

Returns a pointer to the underlying variant's property, if present.

func (ResponseFunctionWebSearchActionUnionParam) GetURL added in v1.8.0

Returns a pointer to the underlying variant's property, if present.

func (ResponseFunctionWebSearchActionUnionParam) MarshalJSON added in v1.8.0

func (*ResponseFunctionWebSearchActionUnionParam) UnmarshalJSON added in v1.8.0

func (u *ResponseFunctionWebSearchActionUnionParam) UnmarshalJSON(data []byte) error

type ResponseFunctionWebSearchParam

type ResponseFunctionWebSearchParam struct {
	// The unique ID of the web search tool call.
	ID string `json:"id,required"`
	// An object describing the specific action taken in this web search call. Includes
	// details on how the model used the web (search, open_page, find).
	Action ResponseFunctionWebSearchActionUnionParam `json:"action,omitzero,required"`
	// The status of the web search tool call.
	//
	// Any of "in_progress", "searching", "completed", "failed".
	Status ResponseFunctionWebSearchStatus `json:"status,omitzero,required"`
	// The type of the web search tool call. Always `web_search_call`.
	//
	// This field can be elided, and will marshal its zero value as "web_search_call".
	Type constant.WebSearchCall `json:"type,required"`
	// contains filtered or unexported fields
}

The results of a web search tool call. See the [web search guide](https://platform.openai.com/docs/guides/tools-web-search) for more information.

The properties ID, Action, Status, Type are required.

func (ResponseFunctionWebSearchParam) MarshalJSON

func (r ResponseFunctionWebSearchParam) MarshalJSON() (data []byte, err error)

func (*ResponseFunctionWebSearchParam) UnmarshalJSON

func (r *ResponseFunctionWebSearchParam) UnmarshalJSON(data []byte) error

type ResponseFunctionWebSearchStatus

type ResponseFunctionWebSearchStatus string

The status of the web search tool call.

const (
	ResponseFunctionWebSearchStatusInProgress ResponseFunctionWebSearchStatus = "in_progress"
	ResponseFunctionWebSearchStatusSearching  ResponseFunctionWebSearchStatus = "searching"
	ResponseFunctionWebSearchStatusCompleted  ResponseFunctionWebSearchStatus = "completed"
	ResponseFunctionWebSearchStatusFailed     ResponseFunctionWebSearchStatus = "failed"
)

type ResponseGetParams

type ResponseGetParams struct {
	// The sequence number of the event after which to start streaming.
	StartingAfter param.Opt[int64] `query:"starting_after,omitzero" json:"-"`
	// Additional fields to include in the response. See the `include` parameter for
	// Response creation above for more information.
	Include []ResponseIncludable `query:"include,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (ResponseGetParams) URLQuery

func (r ResponseGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes ResponseGetParams's query parameters as `url.Values`.

type ResponseImageGenCallCompletedEvent added in v1.1.0

type ResponseImageGenCallCompletedEvent struct {
	// The unique identifier of the image generation item being processed.
	ItemID string `json:"item_id,required"`
	// The index of the output item in the response's output array.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always 'response.image_generation_call.completed'.
	Type constant.ResponseImageGenerationCallCompleted `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when an image generation tool call has completed and the final image is available.

func (ResponseImageGenCallCompletedEvent) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseImageGenCallCompletedEvent) UnmarshalJSON added in v1.1.0

func (r *ResponseImageGenCallCompletedEvent) UnmarshalJSON(data []byte) error

type ResponseImageGenCallGeneratingEvent added in v1.1.0

type ResponseImageGenCallGeneratingEvent struct {
	// The unique identifier of the image generation item being processed.
	ItemID string `json:"item_id,required"`
	// The index of the output item in the response's output array.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of the image generation item being processed.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always 'response.image_generation_call.generating'.
	Type constant.ResponseImageGenerationCallGenerating `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when an image generation tool call is actively generating an image (intermediate state).

func (ResponseImageGenCallGeneratingEvent) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseImageGenCallGeneratingEvent) UnmarshalJSON added in v1.1.0

func (r *ResponseImageGenCallGeneratingEvent) UnmarshalJSON(data []byte) error

type ResponseImageGenCallInProgressEvent added in v1.1.0

type ResponseImageGenCallInProgressEvent struct {
	// The unique identifier of the image generation item being processed.
	ItemID string `json:"item_id,required"`
	// The index of the output item in the response's output array.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of the image generation item being processed.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always 'response.image_generation_call.in_progress'.
	Type constant.ResponseImageGenerationCallInProgress `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when an image generation tool call is in progress.

func (ResponseImageGenCallInProgressEvent) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseImageGenCallInProgressEvent) UnmarshalJSON added in v1.1.0

func (r *ResponseImageGenCallInProgressEvent) UnmarshalJSON(data []byte) error

type ResponseImageGenCallPartialImageEvent added in v1.1.0

type ResponseImageGenCallPartialImageEvent struct {
	// The unique identifier of the image generation item being processed.
	ItemID string `json:"item_id,required"`
	// The index of the output item in the response's output array.
	OutputIndex int64 `json:"output_index,required"`
	// Base64-encoded partial image data, suitable for rendering as an image.
	PartialImageB64 string `json:"partial_image_b64,required"`
	// 0-based index for the partial image (backend is 1-based, but this is 0-based for
	// the user).
	PartialImageIndex int64 `json:"partial_image_index,required"`
	// The sequence number of the image generation item being processed.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always 'response.image_generation_call.partial_image'.
	Type constant.ResponseImageGenerationCallPartialImage `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemID            respjson.Field
		OutputIndex       respjson.Field
		PartialImageB64   respjson.Field
		PartialImageIndex respjson.Field
		SequenceNumber    respjson.Field
		Type              respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a partial image is available during image generation streaming.

func (ResponseImageGenCallPartialImageEvent) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseImageGenCallPartialImageEvent) UnmarshalJSON added in v1.1.0

func (r *ResponseImageGenCallPartialImageEvent) UnmarshalJSON(data []byte) error

type ResponseInProgressEvent

type ResponseInProgressEvent struct {
	// The response that is in progress.
	Response Response `json:"response,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.in_progress`.
	Type constant.ResponseInProgress `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Response       respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when the response is in progress.

func (ResponseInProgressEvent) RawJSON

func (r ResponseInProgressEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseInProgressEvent) UnmarshalJSON

func (r *ResponseInProgressEvent) UnmarshalJSON(data []byte) error

type ResponseIncludable

type ResponseIncludable string

Specify additional output data to include in the model response. Currently supported values are:

  • `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items.
  • `computer_call_output.output.image_url`: Include image urls from the computer call output.
  • `file_search_call.results`: Include the search results of the file search tool call.
  • `message.input_image.image_url`: Include image urls from the input message.
  • `message.output_text.logprobs`: Include logprobs with assistant messages.
  • `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the `store` parameter is set to `false`, or when an organization is enrolled in the zero data retention program).
const (
	ResponseIncludableCodeInterpreterCallOutputs       ResponseIncludable = "code_interpreter_call.outputs"
	ResponseIncludableComputerCallOutputOutputImageURL ResponseIncludable = "computer_call_output.output.image_url"
	ResponseIncludableFileSearchCallResults            ResponseIncludable = "file_search_call.results"
	ResponseIncludableMessageInputImageImageURL        ResponseIncludable = "message.input_image.image_url"
	ResponseIncludableMessageOutputTextLogprobs        ResponseIncludable = "message.output_text.logprobs"
	ResponseIncludableReasoningEncryptedContent        ResponseIncludable = "reasoning.encrypted_content"
)

type ResponseIncompleteDetails

type ResponseIncompleteDetails struct {
	// The reason why the response is incomplete.
	//
	// Any of "max_output_tokens", "content_filter".
	Reason string `json:"reason"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Reason      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Details about why the response is incomplete.

func (ResponseIncompleteDetails) RawJSON

func (r ResponseIncompleteDetails) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseIncompleteDetails) UnmarshalJSON

func (r *ResponseIncompleteDetails) UnmarshalJSON(data []byte) error

type ResponseIncompleteEvent

type ResponseIncompleteEvent struct {
	// The response that was incomplete.
	Response Response `json:"response,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.incomplete`.
	Type constant.ResponseIncomplete `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Response       respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An event that is emitted when a response finishes as incomplete.

func (ResponseIncompleteEvent) RawJSON

func (r ResponseIncompleteEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseIncompleteEvent) UnmarshalJSON

func (r *ResponseIncompleteEvent) UnmarshalJSON(data []byte) error

type ResponseInputContentUnion

type ResponseInputContentUnion struct {
	// This field is from variant [ResponseInputText].
	Text string `json:"text"`
	// Any of "input_text", "input_image", "input_file".
	Type string `json:"type"`
	// This field is from variant [ResponseInputImage].
	Detail ResponseInputImageDetail `json:"detail"`
	FileID string                   `json:"file_id"`
	// This field is from variant [ResponseInputImage].
	ImageURL string `json:"image_url"`
	// This field is from variant [ResponseInputFile].
	FileData string `json:"file_data"`
	// This field is from variant [ResponseInputFile].
	FileURL string `json:"file_url"`
	// This field is from variant [ResponseInputFile].
	Filename string `json:"filename"`
	JSON     struct {
		Text     respjson.Field
		Type     respjson.Field
		Detail   respjson.Field
		FileID   respjson.Field
		ImageURL respjson.Field
		FileData respjson.Field
		FileURL  respjson.Field
		Filename respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseInputContentUnion contains all possible properties and values from ResponseInputText, ResponseInputImage, ResponseInputFile.

Use the ResponseInputContentUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ResponseInputContentUnion) AsAny

func (u ResponseInputContentUnion) AsAny() anyResponseInputContent

Use the following switch statement to find the correct variant

switch variant := ResponseInputContentUnion.AsAny().(type) {
case responses.ResponseInputText:
case responses.ResponseInputImage:
case responses.ResponseInputFile:
default:
  fmt.Errorf("no variant present")
}

func (ResponseInputContentUnion) AsInputFile

func (u ResponseInputContentUnion) AsInputFile() (v ResponseInputFile)

func (ResponseInputContentUnion) AsInputImage

func (u ResponseInputContentUnion) AsInputImage() (v ResponseInputImage)

func (ResponseInputContentUnion) AsInputText

func (u ResponseInputContentUnion) AsInputText() (v ResponseInputText)

func (ResponseInputContentUnion) RawJSON

func (u ResponseInputContentUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (ResponseInputContentUnion) ToParam

ToParam converts this ResponseInputContentUnion to a ResponseInputContentUnionParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseInputContentUnionParam.Overrides()

func (*ResponseInputContentUnion) UnmarshalJSON

func (r *ResponseInputContentUnion) UnmarshalJSON(data []byte) error

type ResponseInputContentUnionParam

type ResponseInputContentUnionParam struct {
	OfInputText  *ResponseInputTextParam  `json:",omitzero,inline"`
	OfInputImage *ResponseInputImageParam `json:",omitzero,inline"`
	OfInputFile  *ResponseInputFileParam  `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func ResponseInputContentParamOfInputText

func ResponseInputContentParamOfInputText(text string) ResponseInputContentUnionParam

func (ResponseInputContentUnionParam) GetDetail

func (u ResponseInputContentUnionParam) GetDetail() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputContentUnionParam) GetFileData

func (u ResponseInputContentUnionParam) GetFileData() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputContentUnionParam) GetFileID

func (u ResponseInputContentUnionParam) GetFileID() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputContentUnionParam) GetFileURL added in v1.10.0

func (u ResponseInputContentUnionParam) GetFileURL() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputContentUnionParam) GetFilename

func (u ResponseInputContentUnionParam) GetFilename() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputContentUnionParam) GetImageURL

func (u ResponseInputContentUnionParam) GetImageURL() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputContentUnionParam) GetText

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputContentUnionParam) GetType

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputContentUnionParam) MarshalJSON

func (u ResponseInputContentUnionParam) MarshalJSON() ([]byte, error)

func (*ResponseInputContentUnionParam) UnmarshalJSON

func (u *ResponseInputContentUnionParam) UnmarshalJSON(data []byte) error

type ResponseInputFile

type ResponseInputFile struct {
	// The type of the input item. Always `input_file`.
	Type constant.InputFile `json:"type,required"`
	// The content of the file to be sent to the model.
	FileData string `json:"file_data"`
	// The ID of the file to be sent to the model.
	FileID string `json:"file_id,nullable"`
	// The URL of the file to be sent to the model.
	FileURL string `json:"file_url"`
	// The name of the file to be sent to the model.
	Filename string `json:"filename"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		FileData    respjson.Field
		FileID      respjson.Field
		FileURL     respjson.Field
		Filename    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A file input to the model.

func (ResponseInputFile) RawJSON

func (r ResponseInputFile) RawJSON() string

Returns the unmodified JSON received from the API

func (ResponseInputFile) ToParam

ToParam converts this ResponseInputFile to a ResponseInputFileParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseInputFileParam.Overrides()

func (*ResponseInputFile) UnmarshalJSON

func (r *ResponseInputFile) UnmarshalJSON(data []byte) error

type ResponseInputFileParam

type ResponseInputFileParam struct {
	// The ID of the file to be sent to the model.
	FileID param.Opt[string] `json:"file_id,omitzero"`
	// The content of the file to be sent to the model.
	FileData param.Opt[string] `json:"file_data,omitzero"`
	// The URL of the file to be sent to the model.
	FileURL param.Opt[string] `json:"file_url,omitzero"`
	// The name of the file to be sent to the model.
	Filename param.Opt[string] `json:"filename,omitzero"`
	// The type of the input item. Always `input_file`.
	//
	// This field can be elided, and will marshal its zero value as "input_file".
	Type constant.InputFile `json:"type,required"`
	// contains filtered or unexported fields
}

A file input to the model.

The property Type is required.

func (ResponseInputFileParam) MarshalJSON

func (r ResponseInputFileParam) MarshalJSON() (data []byte, err error)

func (*ResponseInputFileParam) UnmarshalJSON

func (r *ResponseInputFileParam) UnmarshalJSON(data []byte) error

type ResponseInputImage

type ResponseInputImage struct {
	// The detail level of the image to be sent to the model. One of `high`, `low`, or
	// `auto`. Defaults to `auto`.
	//
	// Any of "low", "high", "auto".
	Detail ResponseInputImageDetail `json:"detail,required"`
	// The type of the input item. Always `input_image`.
	Type constant.InputImage `json:"type,required"`
	// The ID of the file to be sent to the model.
	FileID string `json:"file_id,nullable"`
	// The URL of the image to be sent to the model. A fully qualified URL or base64
	// encoded image in a data URL.
	ImageURL string `json:"image_url,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Detail      respjson.Field
		Type        respjson.Field
		FileID      respjson.Field
		ImageURL    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision).

func (ResponseInputImage) RawJSON

func (r ResponseInputImage) RawJSON() string

Returns the unmodified JSON received from the API

func (ResponseInputImage) ToParam

ToParam converts this ResponseInputImage to a ResponseInputImageParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseInputImageParam.Overrides()

func (*ResponseInputImage) UnmarshalJSON

func (r *ResponseInputImage) UnmarshalJSON(data []byte) error

type ResponseInputImageDetail

type ResponseInputImageDetail string

The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.

const (
	ResponseInputImageDetailLow  ResponseInputImageDetail = "low"
	ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
	ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
)

type ResponseInputImageParam

type ResponseInputImageParam struct {
	// The detail level of the image to be sent to the model. One of `high`, `low`, or
	// `auto`. Defaults to `auto`.
	//
	// Any of "low", "high", "auto".
	Detail ResponseInputImageDetail `json:"detail,omitzero,required"`
	// The ID of the file to be sent to the model.
	FileID param.Opt[string] `json:"file_id,omitzero"`
	// The URL of the image to be sent to the model. A fully qualified URL or base64
	// encoded image in a data URL.
	ImageURL param.Opt[string] `json:"image_url,omitzero"`
	// The type of the input item. Always `input_image`.
	//
	// This field can be elided, and will marshal its zero value as "input_image".
	Type constant.InputImage `json:"type,required"`
	// contains filtered or unexported fields
}

An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision).

The properties Detail, Type are required.

func (ResponseInputImageParam) MarshalJSON

func (r ResponseInputImageParam) MarshalJSON() (data []byte, err error)

func (*ResponseInputImageParam) UnmarshalJSON

func (r *ResponseInputImageParam) UnmarshalJSON(data []byte) error

type ResponseInputItemComputerCallOutput added in v1.6.0

type ResponseInputItemComputerCallOutput struct {
	// The ID of the computer tool call that produced the output.
	CallID string `json:"call_id,required"`
	// A computer screenshot image used with the computer use tool.
	Output ResponseComputerToolCallOutputScreenshot `json:"output,required"`
	// The type of the computer tool call output. Always `computer_call_output`.
	Type constant.ComputerCallOutput `json:"type,required"`
	// The ID of the computer tool call output.
	ID string `json:"id,nullable"`
	// The safety checks reported by the API that have been acknowledged by the
	// developer.
	AcknowledgedSafetyChecks []ResponseInputItemComputerCallOutputAcknowledgedSafetyCheck `json:"acknowledged_safety_checks,nullable"`
	// The status of the message input. One of `in_progress`, `completed`, or
	// `incomplete`. Populated when input items are returned via API.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status string `json:"status,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CallID                   respjson.Field
		Output                   respjson.Field
		Type                     respjson.Field
		ID                       respjson.Field
		AcknowledgedSafetyChecks respjson.Field
		Status                   respjson.Field
		ExtraFields              map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The output of a computer tool call.

func (ResponseInputItemComputerCallOutput) RawJSON added in v1.6.0

Returns the unmodified JSON received from the API

func (*ResponseInputItemComputerCallOutput) UnmarshalJSON added in v1.6.0

func (r *ResponseInputItemComputerCallOutput) UnmarshalJSON(data []byte) error

type ResponseInputItemComputerCallOutputAcknowledgedSafetyCheck added in v1.6.0

type ResponseInputItemComputerCallOutputAcknowledgedSafetyCheck struct {
	// The ID of the pending safety check.
	ID string `json:"id,required"`
	// The type of the pending safety check.
	Code string `json:"code,nullable"`
	// Details about the pending safety check.
	Message string `json:"message,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Code        respjson.Field
		Message     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A pending safety check for the computer call.

func (ResponseInputItemComputerCallOutputAcknowledgedSafetyCheck) RawJSON added in v1.6.0

Returns the unmodified JSON received from the API

func (*ResponseInputItemComputerCallOutputAcknowledgedSafetyCheck) UnmarshalJSON added in v1.6.0

type ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam

type ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam struct {
	// The ID of the pending safety check.
	ID string `json:"id,required"`
	// The type of the pending safety check.
	Code param.Opt[string] `json:"code,omitzero"`
	// Details about the pending safety check.
	Message param.Opt[string] `json:"message,omitzero"`
	// contains filtered or unexported fields
}

A pending safety check for the computer call.

The property ID is required.

func (ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam) MarshalJSON

func (*ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam) UnmarshalJSON

type ResponseInputItemComputerCallOutputParam

type ResponseInputItemComputerCallOutputParam struct {
	// The ID of the computer tool call that produced the output.
	CallID string `json:"call_id,required"`
	// A computer screenshot image used with the computer use tool.
	Output ResponseComputerToolCallOutputScreenshotParam `json:"output,omitzero,required"`
	// The ID of the computer tool call output.
	ID param.Opt[string] `json:"id,omitzero"`
	// The safety checks reported by the API that have been acknowledged by the
	// developer.
	AcknowledgedSafetyChecks []ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam `json:"acknowledged_safety_checks,omitzero"`
	// The status of the message input. One of `in_progress`, `completed`, or
	// `incomplete`. Populated when input items are returned via API.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status string `json:"status,omitzero"`
	// The type of the computer tool call output. Always `computer_call_output`.
	//
	// This field can be elided, and will marshal its zero value as
	// "computer_call_output".
	Type constant.ComputerCallOutput `json:"type,required"`
	// contains filtered or unexported fields
}

The output of a computer tool call.

The properties CallID, Output, Type are required.

func (ResponseInputItemComputerCallOutputParam) MarshalJSON

func (r ResponseInputItemComputerCallOutputParam) MarshalJSON() (data []byte, err error)

func (*ResponseInputItemComputerCallOutputParam) UnmarshalJSON

func (r *ResponseInputItemComputerCallOutputParam) UnmarshalJSON(data []byte) error

type ResponseInputItemFunctionCallOutput added in v1.6.0

type ResponseInputItemFunctionCallOutput struct {
	// The unique ID of the function tool call generated by the model.
	CallID string `json:"call_id,required"`
	// A JSON string of the output of the function tool call.
	Output string `json:"output,required"`
	// The type of the function tool call output. Always `function_call_output`.
	Type constant.FunctionCallOutput `json:"type,required"`
	// The unique ID of the function tool call output. Populated when this item is
	// returned via API.
	ID string `json:"id,nullable"`
	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
	// Populated when items are returned via API.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status string `json:"status,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CallID      respjson.Field
		Output      respjson.Field
		Type        respjson.Field
		ID          respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The output of a function tool call.

func (ResponseInputItemFunctionCallOutput) RawJSON added in v1.6.0

Returns the unmodified JSON received from the API

func (*ResponseInputItemFunctionCallOutput) UnmarshalJSON added in v1.6.0

func (r *ResponseInputItemFunctionCallOutput) UnmarshalJSON(data []byte) error

type ResponseInputItemFunctionCallOutputParam

type ResponseInputItemFunctionCallOutputParam struct {
	// The unique ID of the function tool call generated by the model.
	CallID string `json:"call_id,required"`
	// A JSON string of the output of the function tool call.
	Output string `json:"output,required"`
	// The unique ID of the function tool call output. Populated when this item is
	// returned via API.
	ID param.Opt[string] `json:"id,omitzero"`
	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
	// Populated when items are returned via API.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status string `json:"status,omitzero"`
	// The type of the function tool call output. Always `function_call_output`.
	//
	// This field can be elided, and will marshal its zero value as
	// "function_call_output".
	Type constant.FunctionCallOutput `json:"type,required"`
	// contains filtered or unexported fields
}

The output of a function tool call.

The properties CallID, Output, Type are required.

func (ResponseInputItemFunctionCallOutputParam) MarshalJSON

func (r ResponseInputItemFunctionCallOutputParam) MarshalJSON() (data []byte, err error)

func (*ResponseInputItemFunctionCallOutputParam) UnmarshalJSON

func (r *ResponseInputItemFunctionCallOutputParam) UnmarshalJSON(data []byte) error

type ResponseInputItemImageGenerationCall added in v1.6.0

type ResponseInputItemImageGenerationCall struct {
	// The unique ID of the image generation call.
	ID string `json:"id,required"`
	// The generated image encoded in base64.
	Result string `json:"result,required"`
	// The status of the image generation call.
	//
	// Any of "in_progress", "completed", "generating", "failed".
	Status string `json:"status,required"`
	// The type of the image generation call. Always `image_generation_call`.
	Type constant.ImageGenerationCall `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Result      respjson.Field
		Status      respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An image generation request made by the model.

func (ResponseInputItemImageGenerationCall) RawJSON added in v1.6.0

Returns the unmodified JSON received from the API

func (*ResponseInputItemImageGenerationCall) UnmarshalJSON added in v1.6.0

func (r *ResponseInputItemImageGenerationCall) UnmarshalJSON(data []byte) error

type ResponseInputItemImageGenerationCallParam added in v1.1.0

type ResponseInputItemImageGenerationCallParam struct {
	// The generated image encoded in base64.
	Result param.Opt[string] `json:"result,omitzero,required"`
	// The unique ID of the image generation call.
	ID string `json:"id,required"`
	// The status of the image generation call.
	//
	// Any of "in_progress", "completed", "generating", "failed".
	Status string `json:"status,omitzero,required"`
	// The type of the image generation call. Always `image_generation_call`.
	//
	// This field can be elided, and will marshal its zero value as
	// "image_generation_call".
	Type constant.ImageGenerationCall `json:"type,required"`
	// contains filtered or unexported fields
}

An image generation request made by the model.

The properties ID, Result, Status, Type are required.

func (ResponseInputItemImageGenerationCallParam) MarshalJSON added in v1.1.0

func (r ResponseInputItemImageGenerationCallParam) MarshalJSON() (data []byte, err error)

func (*ResponseInputItemImageGenerationCallParam) UnmarshalJSON added in v1.1.0

func (r *ResponseInputItemImageGenerationCallParam) UnmarshalJSON(data []byte) error

type ResponseInputItemItemReference added in v1.6.0

type ResponseInputItemItemReference struct {
	// The ID of the item to reference.
	ID string `json:"id,required"`
	// The type of item to reference. Always `item_reference`.
	//
	// Any of "item_reference".
	Type string `json:"type,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An internal identifier for an item to reference.

func (ResponseInputItemItemReference) RawJSON added in v1.6.0

Returns the unmodified JSON received from the API

func (*ResponseInputItemItemReference) UnmarshalJSON added in v1.6.0

func (r *ResponseInputItemItemReference) UnmarshalJSON(data []byte) error

type ResponseInputItemItemReferenceParam

type ResponseInputItemItemReferenceParam struct {
	// The ID of the item to reference.
	ID string `json:"id,required"`
	// The type of item to reference. Always `item_reference`.
	//
	// Any of "item_reference".
	Type string `json:"type,omitzero"`
	// contains filtered or unexported fields
}

An internal identifier for an item to reference.

The property ID is required.

func (ResponseInputItemItemReferenceParam) MarshalJSON

func (r ResponseInputItemItemReferenceParam) MarshalJSON() (data []byte, err error)

func (*ResponseInputItemItemReferenceParam) UnmarshalJSON

func (r *ResponseInputItemItemReferenceParam) UnmarshalJSON(data []byte) error

type ResponseInputItemLocalShellCall added in v1.6.0

type ResponseInputItemLocalShellCall struct {
	// The unique ID of the local shell call.
	ID string `json:"id,required"`
	// Execute a shell command on the server.
	Action ResponseInputItemLocalShellCallAction `json:"action,required"`
	// The unique ID of the local shell tool call generated by the model.
	CallID string `json:"call_id,required"`
	// The status of the local shell call.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status string `json:"status,required"`
	// The type of the local shell call. Always `local_shell_call`.
	Type constant.LocalShellCall `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Action      respjson.Field
		CallID      respjson.Field
		Status      respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A tool call to run a command on the local shell.

func (ResponseInputItemLocalShellCall) RawJSON added in v1.6.0

Returns the unmodified JSON received from the API

func (*ResponseInputItemLocalShellCall) UnmarshalJSON added in v1.6.0

func (r *ResponseInputItemLocalShellCall) UnmarshalJSON(data []byte) error

type ResponseInputItemLocalShellCallAction added in v1.6.0

type ResponseInputItemLocalShellCallAction struct {
	// The command to run.
	Command []string `json:"command,required"`
	// Environment variables to set for the command.
	Env map[string]string `json:"env,required"`
	// The type of the local shell action. Always `exec`.
	Type constant.Exec `json:"type,required"`
	// Optional timeout in milliseconds for the command.
	TimeoutMs int64 `json:"timeout_ms,nullable"`
	// Optional user to run the command as.
	User string `json:"user,nullable"`
	// Optional working directory to run the command in.
	WorkingDirectory string `json:"working_directory,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Command          respjson.Field
		Env              respjson.Field
		Type             respjson.Field
		TimeoutMs        respjson.Field
		User             respjson.Field
		WorkingDirectory respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Execute a shell command on the server.

func (ResponseInputItemLocalShellCallAction) RawJSON added in v1.6.0

Returns the unmodified JSON received from the API

func (*ResponseInputItemLocalShellCallAction) UnmarshalJSON added in v1.6.0

func (r *ResponseInputItemLocalShellCallAction) UnmarshalJSON(data []byte) error

type ResponseInputItemLocalShellCallActionParam added in v1.1.0

type ResponseInputItemLocalShellCallActionParam struct {
	// The command to run.
	Command []string `json:"command,omitzero,required"`
	// Environment variables to set for the command.
	Env map[string]string `json:"env,omitzero,required"`
	// Optional timeout in milliseconds for the command.
	TimeoutMs param.Opt[int64] `json:"timeout_ms,omitzero"`
	// Optional user to run the command as.
	User param.Opt[string] `json:"user,omitzero"`
	// Optional working directory to run the command in.
	WorkingDirectory param.Opt[string] `json:"working_directory,omitzero"`
	// The type of the local shell action. Always `exec`.
	//
	// This field can be elided, and will marshal its zero value as "exec".
	Type constant.Exec `json:"type,required"`
	// contains filtered or unexported fields
}

Execute a shell command on the server.

The properties Command, Env, Type are required.

func (ResponseInputItemLocalShellCallActionParam) MarshalJSON added in v1.1.0

func (r ResponseInputItemLocalShellCallActionParam) MarshalJSON() (data []byte, err error)

func (*ResponseInputItemLocalShellCallActionParam) UnmarshalJSON added in v1.1.0

func (r *ResponseInputItemLocalShellCallActionParam) UnmarshalJSON(data []byte) error

type ResponseInputItemLocalShellCallOutput added in v1.6.0

type ResponseInputItemLocalShellCallOutput struct {
	// The unique ID of the local shell tool call generated by the model.
	ID string `json:"id,required"`
	// A JSON string of the output of the local shell tool call.
	Output string `json:"output,required"`
	// The type of the local shell tool call output. Always `local_shell_call_output`.
	Type constant.LocalShellCallOutput `json:"type,required"`
	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status string `json:"status,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Output      respjson.Field
		Type        respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The output of a local shell tool call.

func (ResponseInputItemLocalShellCallOutput) RawJSON added in v1.6.0

Returns the unmodified JSON received from the API

func (*ResponseInputItemLocalShellCallOutput) UnmarshalJSON added in v1.6.0

func (r *ResponseInputItemLocalShellCallOutput) UnmarshalJSON(data []byte) error

type ResponseInputItemLocalShellCallOutputParam added in v1.1.0

type ResponseInputItemLocalShellCallOutputParam struct {
	// The unique ID of the local shell tool call generated by the model.
	ID string `json:"id,required"`
	// A JSON string of the output of the local shell tool call.
	Output string `json:"output,required"`
	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status string `json:"status,omitzero"`
	// The type of the local shell tool call output. Always `local_shell_call_output`.
	//
	// This field can be elided, and will marshal its zero value as
	// "local_shell_call_output".
	Type constant.LocalShellCallOutput `json:"type,required"`
	// contains filtered or unexported fields
}

The output of a local shell tool call.

The properties ID, Output, Type are required.

func (ResponseInputItemLocalShellCallOutputParam) MarshalJSON added in v1.1.0

func (r ResponseInputItemLocalShellCallOutputParam) MarshalJSON() (data []byte, err error)

func (*ResponseInputItemLocalShellCallOutputParam) UnmarshalJSON added in v1.1.0

func (r *ResponseInputItemLocalShellCallOutputParam) UnmarshalJSON(data []byte) error

type ResponseInputItemLocalShellCallParam added in v1.1.0

type ResponseInputItemLocalShellCallParam struct {
	// The unique ID of the local shell call.
	ID string `json:"id,required"`
	// Execute a shell command on the server.
	Action ResponseInputItemLocalShellCallActionParam `json:"action,omitzero,required"`
	// The unique ID of the local shell tool call generated by the model.
	CallID string `json:"call_id,required"`
	// The status of the local shell call.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status string `json:"status,omitzero,required"`
	// The type of the local shell call. Always `local_shell_call`.
	//
	// This field can be elided, and will marshal its zero value as "local_shell_call".
	Type constant.LocalShellCall `json:"type,required"`
	// contains filtered or unexported fields
}

A tool call to run a command on the local shell.

The properties ID, Action, CallID, Status, Type are required.

func (ResponseInputItemLocalShellCallParam) MarshalJSON added in v1.1.0

func (r ResponseInputItemLocalShellCallParam) MarshalJSON() (data []byte, err error)

func (*ResponseInputItemLocalShellCallParam) UnmarshalJSON added in v1.1.0

func (r *ResponseInputItemLocalShellCallParam) UnmarshalJSON(data []byte) error

type ResponseInputItemMcpApprovalRequest added in v1.6.0

type ResponseInputItemMcpApprovalRequest struct {
	// The unique ID of the approval request.
	ID string `json:"id,required"`
	// A JSON string of arguments for the tool.
	Arguments string `json:"arguments,required"`
	// The name of the tool to run.
	Name string `json:"name,required"`
	// The label of the MCP server making the request.
	ServerLabel string `json:"server_label,required"`
	// The type of the item. Always `mcp_approval_request`.
	Type constant.McpApprovalRequest `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Arguments   respjson.Field
		Name        respjson.Field
		ServerLabel respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A request for human approval of a tool invocation.

func (ResponseInputItemMcpApprovalRequest) RawJSON added in v1.6.0

Returns the unmodified JSON received from the API

func (*ResponseInputItemMcpApprovalRequest) UnmarshalJSON added in v1.6.0

func (r *ResponseInputItemMcpApprovalRequest) UnmarshalJSON(data []byte) error

type ResponseInputItemMcpApprovalRequestParam added in v1.1.0

type ResponseInputItemMcpApprovalRequestParam struct {
	// The unique ID of the approval request.
	ID string `json:"id,required"`
	// A JSON string of arguments for the tool.
	Arguments string `json:"arguments,required"`
	// The name of the tool to run.
	Name string `json:"name,required"`
	// The label of the MCP server making the request.
	ServerLabel string `json:"server_label,required"`
	// The type of the item. Always `mcp_approval_request`.
	//
	// This field can be elided, and will marshal its zero value as
	// "mcp_approval_request".
	Type constant.McpApprovalRequest `json:"type,required"`
	// contains filtered or unexported fields
}

A request for human approval of a tool invocation.

The properties ID, Arguments, Name, ServerLabel, Type are required.

func (ResponseInputItemMcpApprovalRequestParam) MarshalJSON added in v1.1.0

func (r ResponseInputItemMcpApprovalRequestParam) MarshalJSON() (data []byte, err error)

func (*ResponseInputItemMcpApprovalRequestParam) UnmarshalJSON added in v1.1.0

func (r *ResponseInputItemMcpApprovalRequestParam) UnmarshalJSON(data []byte) error

type ResponseInputItemMcpApprovalResponse added in v1.6.0

type ResponseInputItemMcpApprovalResponse struct {
	// The ID of the approval request being answered.
	ApprovalRequestID string `json:"approval_request_id,required"`
	// Whether the request was approved.
	Approve bool `json:"approve,required"`
	// The type of the item. Always `mcp_approval_response`.
	Type constant.McpApprovalResponse `json:"type,required"`
	// The unique ID of the approval response
	ID string `json:"id,nullable"`
	// Optional reason for the decision.
	Reason string `json:"reason,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ApprovalRequestID respjson.Field
		Approve           respjson.Field
		Type              respjson.Field
		ID                respjson.Field
		Reason            respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A response to an MCP approval request.

func (ResponseInputItemMcpApprovalResponse) RawJSON added in v1.6.0

Returns the unmodified JSON received from the API

func (*ResponseInputItemMcpApprovalResponse) UnmarshalJSON added in v1.6.0

func (r *ResponseInputItemMcpApprovalResponse) UnmarshalJSON(data []byte) error

type ResponseInputItemMcpApprovalResponseParam added in v1.1.0

type ResponseInputItemMcpApprovalResponseParam struct {
	// The ID of the approval request being answered.
	ApprovalRequestID string `json:"approval_request_id,required"`
	// Whether the request was approved.
	Approve bool `json:"approve,required"`
	// The unique ID of the approval response
	ID param.Opt[string] `json:"id,omitzero"`
	// Optional reason for the decision.
	Reason param.Opt[string] `json:"reason,omitzero"`
	// The type of the item. Always `mcp_approval_response`.
	//
	// This field can be elided, and will marshal its zero value as
	// "mcp_approval_response".
	Type constant.McpApprovalResponse `json:"type,required"`
	// contains filtered or unexported fields
}

A response to an MCP approval request.

The properties ApprovalRequestID, Approve, Type are required.

func (ResponseInputItemMcpApprovalResponseParam) MarshalJSON added in v1.1.0

func (r ResponseInputItemMcpApprovalResponseParam) MarshalJSON() (data []byte, err error)

func (*ResponseInputItemMcpApprovalResponseParam) UnmarshalJSON added in v1.1.0

func (r *ResponseInputItemMcpApprovalResponseParam) UnmarshalJSON(data []byte) error

type ResponseInputItemMcpCall added in v1.6.0

type ResponseInputItemMcpCall struct {
	// The unique ID of the tool call.
	ID string `json:"id,required"`
	// A JSON string of the arguments passed to the tool.
	Arguments string `json:"arguments,required"`
	// The name of the tool that was run.
	Name string `json:"name,required"`
	// The label of the MCP server running the tool.
	ServerLabel string `json:"server_label,required"`
	// The type of the item. Always `mcp_call`.
	Type constant.McpCall `json:"type,required"`
	// The error from the tool call, if any.
	Error string `json:"error,nullable"`
	// The output from the tool call.
	Output string `json:"output,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Arguments   respjson.Field
		Name        respjson.Field
		ServerLabel respjson.Field
		Type        respjson.Field
		Error       respjson.Field
		Output      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An invocation of a tool on an MCP server.

func (ResponseInputItemMcpCall) RawJSON added in v1.6.0

func (r ResponseInputItemMcpCall) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseInputItemMcpCall) UnmarshalJSON added in v1.6.0

func (r *ResponseInputItemMcpCall) UnmarshalJSON(data []byte) error

type ResponseInputItemMcpCallParam added in v1.1.0

type ResponseInputItemMcpCallParam struct {
	// The unique ID of the tool call.
	ID string `json:"id,required"`
	// A JSON string of the arguments passed to the tool.
	Arguments string `json:"arguments,required"`
	// The name of the tool that was run.
	Name string `json:"name,required"`
	// The label of the MCP server running the tool.
	ServerLabel string `json:"server_label,required"`
	// The error from the tool call, if any.
	Error param.Opt[string] `json:"error,omitzero"`
	// The output from the tool call.
	Output param.Opt[string] `json:"output,omitzero"`
	// The type of the item. Always `mcp_call`.
	//
	// This field can be elided, and will marshal its zero value as "mcp_call".
	Type constant.McpCall `json:"type,required"`
	// contains filtered or unexported fields
}

An invocation of a tool on an MCP server.

The properties ID, Arguments, Name, ServerLabel, Type are required.

func (ResponseInputItemMcpCallParam) MarshalJSON added in v1.1.0

func (r ResponseInputItemMcpCallParam) MarshalJSON() (data []byte, err error)

func (*ResponseInputItemMcpCallParam) UnmarshalJSON added in v1.1.0

func (r *ResponseInputItemMcpCallParam) UnmarshalJSON(data []byte) error

type ResponseInputItemMcpListTools added in v1.6.0

type ResponseInputItemMcpListTools struct {
	// The unique ID of the list.
	ID string `json:"id,required"`
	// The label of the MCP server.
	ServerLabel string `json:"server_label,required"`
	// The tools available on the server.
	Tools []ResponseInputItemMcpListToolsTool `json:"tools,required"`
	// The type of the item. Always `mcp_list_tools`.
	Type constant.McpListTools `json:"type,required"`
	// Error message if the server could not list tools.
	Error string `json:"error,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ServerLabel respjson.Field
		Tools       respjson.Field
		Type        respjson.Field
		Error       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A list of tools available on an MCP server.

func (ResponseInputItemMcpListTools) RawJSON added in v1.6.0

Returns the unmodified JSON received from the API

func (*ResponseInputItemMcpListTools) UnmarshalJSON added in v1.6.0

func (r *ResponseInputItemMcpListTools) UnmarshalJSON(data []byte) error

type ResponseInputItemMcpListToolsParam added in v1.1.0

type ResponseInputItemMcpListToolsParam struct {
	// The unique ID of the list.
	ID string `json:"id,required"`
	// The label of the MCP server.
	ServerLabel string `json:"server_label,required"`
	// The tools available on the server.
	Tools []ResponseInputItemMcpListToolsToolParam `json:"tools,omitzero,required"`
	// Error message if the server could not list tools.
	Error param.Opt[string] `json:"error,omitzero"`
	// The type of the item. Always `mcp_list_tools`.
	//
	// This field can be elided, and will marshal its zero value as "mcp_list_tools".
	Type constant.McpListTools `json:"type,required"`
	// contains filtered or unexported fields
}

A list of tools available on an MCP server.

The properties ID, ServerLabel, Tools, Type are required.

func (ResponseInputItemMcpListToolsParam) MarshalJSON added in v1.1.0

func (r ResponseInputItemMcpListToolsParam) MarshalJSON() (data []byte, err error)

func (*ResponseInputItemMcpListToolsParam) UnmarshalJSON added in v1.1.0

func (r *ResponseInputItemMcpListToolsParam) UnmarshalJSON(data []byte) error

type ResponseInputItemMcpListToolsTool added in v1.6.0

type ResponseInputItemMcpListToolsTool struct {
	// The JSON schema describing the tool's input.
	InputSchema any `json:"input_schema,required"`
	// The name of the tool.
	Name string `json:"name,required"`
	// Additional annotations about the tool.
	Annotations any `json:"annotations,nullable"`
	// The description of the tool.
	Description string `json:"description,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		InputSchema respjson.Field
		Name        respjson.Field
		Annotations respjson.Field
		Description respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A tool available on an MCP server.

func (ResponseInputItemMcpListToolsTool) RawJSON added in v1.6.0

Returns the unmodified JSON received from the API

func (*ResponseInputItemMcpListToolsTool) UnmarshalJSON added in v1.6.0

func (r *ResponseInputItemMcpListToolsTool) UnmarshalJSON(data []byte) error

type ResponseInputItemMcpListToolsToolParam added in v1.1.0

type ResponseInputItemMcpListToolsToolParam struct {
	// The JSON schema describing the tool's input.
	InputSchema any `json:"input_schema,omitzero,required"`
	// The name of the tool.
	Name string `json:"name,required"`
	// The description of the tool.
	Description param.Opt[string] `json:"description,omitzero"`
	// Additional annotations about the tool.
	Annotations any `json:"annotations,omitzero"`
	// contains filtered or unexported fields
}

A tool available on an MCP server.

The properties InputSchema, Name are required.

func (ResponseInputItemMcpListToolsToolParam) MarshalJSON added in v1.1.0

func (r ResponseInputItemMcpListToolsToolParam) MarshalJSON() (data []byte, err error)

func (*ResponseInputItemMcpListToolsToolParam) UnmarshalJSON added in v1.1.0

func (r *ResponseInputItemMcpListToolsToolParam) UnmarshalJSON(data []byte) error

type ResponseInputItemMessage added in v1.6.0

type ResponseInputItemMessage struct {
	// A list of one or many input items to the model, containing different content
	// types.
	Content ResponseInputMessageContentList `json:"content,required"`
	// The role of the message input. One of `user`, `system`, or `developer`.
	//
	// Any of "user", "system", "developer".
	Role string `json:"role,required"`
	// The status of item. One of `in_progress`, `completed`, or `incomplete`.
	// Populated when items are returned via API.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status string `json:"status"`
	// The type of the message input. Always set to `message`.
	//
	// Any of "message".
	Type string `json:"type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Content     respjson.Field
		Role        respjson.Field
		Status      respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A message input to the model with a role indicating instruction following hierarchy. Instructions given with the `developer` or `system` role take precedence over instructions given with the `user` role.

func (ResponseInputItemMessage) RawJSON added in v1.6.0

func (r ResponseInputItemMessage) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseInputItemMessage) UnmarshalJSON added in v1.6.0

func (r *ResponseInputItemMessage) UnmarshalJSON(data []byte) error

type ResponseInputItemMessageParam

type ResponseInputItemMessageParam struct {
	// A list of one or many input items to the model, containing different content
	// types.
	Content ResponseInputMessageContentListParam `json:"content,omitzero,required"`
	// The role of the message input. One of `user`, `system`, or `developer`.
	//
	// Any of "user", "system", "developer".
	Role string `json:"role,omitzero,required"`
	// The status of item. One of `in_progress`, `completed`, or `incomplete`.
	// Populated when items are returned via API.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status string `json:"status,omitzero"`
	// The type of the message input. Always set to `message`.
	//
	// Any of "message".
	Type string `json:"type,omitzero"`
	// contains filtered or unexported fields
}

A message input to the model with a role indicating instruction following hierarchy. Instructions given with the `developer` or `system` role take precedence over instructions given with the `user` role.

The properties Content, Role are required.

func (ResponseInputItemMessageParam) MarshalJSON

func (r ResponseInputItemMessageParam) MarshalJSON() (data []byte, err error)

func (*ResponseInputItemMessageParam) UnmarshalJSON

func (r *ResponseInputItemMessageParam) UnmarshalJSON(data []byte) error

type ResponseInputItemUnion added in v1.6.0

type ResponseInputItemUnion struct {
	// This field is a union of [EasyInputMessageContentUnion],
	// [ResponseInputMessageContentList], [[]ResponseOutputMessageContentUnion]
	Content ResponseInputItemUnionContent `json:"content"`
	Role    string                        `json:"role"`
	// Any of "message", "message", "message", "file_search_call", "computer_call",
	// "computer_call_output", "web_search_call", "function_call",
	// "function_call_output", "reasoning", "image_generation_call",
	// "code_interpreter_call", "local_shell_call", "local_shell_call_output",
	// "mcp_list_tools", "mcp_approval_request", "mcp_approval_response", "mcp_call",
	// "item_reference".
	Type   string `json:"type"`
	Status string `json:"status"`
	ID     string `json:"id"`
	// This field is from variant [ResponseFileSearchToolCall].
	Queries []string `json:"queries"`
	// This field is from variant [ResponseFileSearchToolCall].
	Results []ResponseFileSearchToolCallResult `json:"results"`
	// This field is a union of [ResponseComputerToolCallActionUnion],
	// [ResponseFunctionWebSearchActionUnion], [ResponseInputItemLocalShellCallAction]
	Action ResponseInputItemUnionAction `json:"action"`
	CallID string                       `json:"call_id"`
	// This field is from variant [ResponseComputerToolCall].
	PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck `json:"pending_safety_checks"`
	// This field is a union of [ResponseComputerToolCallOutputScreenshot], [string],
	// [string], [string]
	Output ResponseInputItemUnionOutput `json:"output"`
	// This field is from variant [ResponseInputItemComputerCallOutput].
	AcknowledgedSafetyChecks []ResponseInputItemComputerCallOutputAcknowledgedSafetyCheck `json:"acknowledged_safety_checks"`
	Arguments                string                                                       `json:"arguments"`
	Name                     string                                                       `json:"name"`
	// This field is from variant [ResponseReasoningItem].
	Summary []ResponseReasoningItemSummary `json:"summary"`
	// This field is from variant [ResponseReasoningItem].
	EncryptedContent string `json:"encrypted_content"`
	// This field is from variant [ResponseInputItemImageGenerationCall].
	Result string `json:"result"`
	// This field is from variant [ResponseCodeInterpreterToolCall].
	Code string `json:"code"`
	// This field is from variant [ResponseCodeInterpreterToolCall].
	ContainerID string `json:"container_id"`
	// This field is from variant [ResponseCodeInterpreterToolCall].
	Outputs     []ResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
	ServerLabel string                                       `json:"server_label"`
	// This field is from variant [ResponseInputItemMcpListTools].
	Tools []ResponseInputItemMcpListToolsTool `json:"tools"`
	Error string                              `json:"error"`
	// This field is from variant [ResponseInputItemMcpApprovalResponse].
	ApprovalRequestID string `json:"approval_request_id"`
	// This field is from variant [ResponseInputItemMcpApprovalResponse].
	Approve bool `json:"approve"`
	// This field is from variant [ResponseInputItemMcpApprovalResponse].
	Reason string `json:"reason"`
	JSON   struct {
		Content                  respjson.Field
		Role                     respjson.Field
		Type                     respjson.Field
		Status                   respjson.Field
		ID                       respjson.Field
		Queries                  respjson.Field
		Results                  respjson.Field
		Action                   respjson.Field
		CallID                   respjson.Field
		PendingSafetyChecks      respjson.Field
		Output                   respjson.Field
		AcknowledgedSafetyChecks respjson.Field
		Arguments                respjson.Field
		Name                     respjson.Field
		Summary                  respjson.Field
		EncryptedContent         respjson.Field
		Result                   respjson.Field
		Code                     respjson.Field
		ContainerID              respjson.Field
		Outputs                  respjson.Field
		ServerLabel              respjson.Field
		Tools                    respjson.Field
		Error                    respjson.Field
		ApprovalRequestID        respjson.Field
		Approve                  respjson.Field
		Reason                   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseInputItemUnion contains all possible properties and values from EasyInputMessage, ResponseInputItemMessage, ResponseOutputMessage, ResponseFileSearchToolCall, ResponseComputerToolCall, ResponseInputItemComputerCallOutput, ResponseFunctionWebSearch, ResponseFunctionToolCall, ResponseInputItemFunctionCallOutput, ResponseReasoningItem, ResponseInputItemImageGenerationCall, ResponseCodeInterpreterToolCall, ResponseInputItemLocalShellCall, ResponseInputItemLocalShellCallOutput, ResponseInputItemMcpListTools, ResponseInputItemMcpApprovalRequest, ResponseInputItemMcpApprovalResponse, ResponseInputItemMcpCall, ResponseInputItemItemReference.

Use the ResponseInputItemUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ResponseInputItemUnion) AsAny added in v1.6.0

func (u ResponseInputItemUnion) AsAny() anyResponseInputItem

Use the following switch statement to find the correct variant

switch variant := ResponseInputItemUnion.AsAny().(type) {
case responses.EasyInputMessage:
case responses.ResponseInputItemMessage:
case responses.ResponseOutputMessage:
case responses.ResponseFileSearchToolCall:
case responses.ResponseComputerToolCall:
case responses.ResponseInputItemComputerCallOutput:
case responses.ResponseFunctionWebSearch:
case responses.ResponseFunctionToolCall:
case responses.ResponseInputItemFunctionCallOutput:
case responses.ResponseReasoningItem:
case responses.ResponseInputItemImageGenerationCall:
case responses.ResponseCodeInterpreterToolCall:
case responses.ResponseInputItemLocalShellCall:
case responses.ResponseInputItemLocalShellCallOutput:
case responses.ResponseInputItemMcpListTools:
case responses.ResponseInputItemMcpApprovalRequest:
case responses.ResponseInputItemMcpApprovalResponse:
case responses.ResponseInputItemMcpCall:
case responses.ResponseInputItemItemReference:
default:
  fmt.Errorf("no variant present")
}

func (ResponseInputItemUnion) AsCodeInterpreterCall added in v1.6.0

func (u ResponseInputItemUnion) AsCodeInterpreterCall() (v ResponseCodeInterpreterToolCall)

func (ResponseInputItemUnion) AsComputerCall added in v1.6.0

func (u ResponseInputItemUnion) AsComputerCall() (v ResponseComputerToolCall)

func (ResponseInputItemUnion) AsComputerCallOutput added in v1.6.0

func (u ResponseInputItemUnion) AsComputerCallOutput() (v ResponseInputItemComputerCallOutput)

func (ResponseInputItemUnion) AsFileSearchCall added in v1.6.0

func (u ResponseInputItemUnion) AsFileSearchCall() (v ResponseFileSearchToolCall)

func (ResponseInputItemUnion) AsFunctionCall added in v1.6.0

func (u ResponseInputItemUnion) AsFunctionCall() (v ResponseFunctionToolCall)

func (ResponseInputItemUnion) AsFunctionCallOutput added in v1.6.0

func (u ResponseInputItemUnion) AsFunctionCallOutput() (v ResponseInputItemFunctionCallOutput)

func (ResponseInputItemUnion) AsImageGenerationCall added in v1.6.0

func (u ResponseInputItemUnion) AsImageGenerationCall() (v ResponseInputItemImageGenerationCall)

func (ResponseInputItemUnion) AsInputMessage added in v1.6.0

func (u ResponseInputItemUnion) AsInputMessage() (v ResponseInputItemMessage)

func (ResponseInputItemUnion) AsItemReference added in v1.6.0

func (ResponseInputItemUnion) AsLocalShellCall added in v1.6.0

func (ResponseInputItemUnion) AsLocalShellCallOutput added in v1.6.0

func (u ResponseInputItemUnion) AsLocalShellCallOutput() (v ResponseInputItemLocalShellCallOutput)

func (ResponseInputItemUnion) AsMcpApprovalRequest added in v1.6.0

func (u ResponseInputItemUnion) AsMcpApprovalRequest() (v ResponseInputItemMcpApprovalRequest)

func (ResponseInputItemUnion) AsMcpApprovalResponse added in v1.6.0

func (u ResponseInputItemUnion) AsMcpApprovalResponse() (v ResponseInputItemMcpApprovalResponse)

func (ResponseInputItemUnion) AsMcpCall added in v1.6.0

func (ResponseInputItemUnion) AsMcpListTools added in v1.6.0

func (ResponseInputItemUnion) AsMessage added in v1.6.0

func (u ResponseInputItemUnion) AsMessage() (v EasyInputMessage)

func (ResponseInputItemUnion) AsOutputMessage added in v1.6.0

func (u ResponseInputItemUnion) AsOutputMessage() (v ResponseOutputMessage)

func (ResponseInputItemUnion) AsReasoning added in v1.6.0

func (u ResponseInputItemUnion) AsReasoning() (v ResponseReasoningItem)

func (ResponseInputItemUnion) AsWebSearchCall added in v1.6.0

func (u ResponseInputItemUnion) AsWebSearchCall() (v ResponseFunctionWebSearch)

func (ResponseInputItemUnion) RawJSON added in v1.6.0

func (u ResponseInputItemUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (ResponseInputItemUnion) ToParam added in v1.6.0

ToParam converts this ResponseInputItemUnion to a ResponseInputItemUnionParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseInputItemUnionParam.Overrides()

func (*ResponseInputItemUnion) UnmarshalJSON added in v1.6.0

func (r *ResponseInputItemUnion) UnmarshalJSON(data []byte) error

type ResponseInputItemUnionAction added in v1.6.0

type ResponseInputItemUnionAction struct {
	// This field is from variant [ResponseComputerToolCallActionUnion].
	Button string `json:"button"`
	Type   string `json:"type"`
	X      int64  `json:"x"`
	Y      int64  `json:"y"`
	// This field is from variant [ResponseComputerToolCallActionUnion].
	Path []ResponseComputerToolCallActionDragPath `json:"path"`
	// This field is from variant [ResponseComputerToolCallActionUnion].
	Keys []string `json:"keys"`
	// This field is from variant [ResponseComputerToolCallActionUnion].
	ScrollX int64 `json:"scroll_x"`
	// This field is from variant [ResponseComputerToolCallActionUnion].
	ScrollY int64 `json:"scroll_y"`
	// This field is from variant [ResponseComputerToolCallActionUnion].
	Text string `json:"text"`
	// This field is from variant [ResponseFunctionWebSearchActionUnion].
	Query string `json:"query"`
	URL   string `json:"url"`
	// This field is from variant [ResponseFunctionWebSearchActionUnion].
	Pattern string `json:"pattern"`
	// This field is from variant [ResponseInputItemLocalShellCallAction].
	Command []string `json:"command"`
	// This field is from variant [ResponseInputItemLocalShellCallAction].
	Env map[string]string `json:"env"`
	// This field is from variant [ResponseInputItemLocalShellCallAction].
	TimeoutMs int64 `json:"timeout_ms"`
	// This field is from variant [ResponseInputItemLocalShellCallAction].
	User string `json:"user"`
	// This field is from variant [ResponseInputItemLocalShellCallAction].
	WorkingDirectory string `json:"working_directory"`
	JSON             struct {
		Button           respjson.Field
		Type             respjson.Field
		X                respjson.Field
		Y                respjson.Field
		Path             respjson.Field
		Keys             respjson.Field
		ScrollX          respjson.Field
		ScrollY          respjson.Field
		Text             respjson.Field
		Query            respjson.Field
		URL              respjson.Field
		Pattern          respjson.Field
		Command          respjson.Field
		Env              respjson.Field
		TimeoutMs        respjson.Field
		User             respjson.Field
		WorkingDirectory respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseInputItemUnionAction is an implicit subunion of ResponseInputItemUnion. ResponseInputItemUnionAction provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the ResponseInputItemUnion.

func (*ResponseInputItemUnionAction) UnmarshalJSON added in v1.6.0

func (r *ResponseInputItemUnionAction) UnmarshalJSON(data []byte) error

type ResponseInputItemUnionContent added in v1.6.0

type ResponseInputItemUnionContent struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [ResponseInputMessageContentList]
	// instead of an object.
	OfInputItemContentList ResponseInputMessageContentList `json:",inline"`
	// This field will be present if the value is a
	// [[]ResponseOutputMessageContentUnion] instead of an object.
	OfResponseOutputMessageContentArray []ResponseOutputMessageContentUnion `json:",inline"`
	JSON                                struct {
		OfString                            respjson.Field
		OfInputItemContentList              respjson.Field
		OfResponseOutputMessageContentArray respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseInputItemUnionContent is an implicit subunion of ResponseInputItemUnion. ResponseInputItemUnionContent provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the ResponseInputItemUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfInputItemContentList OfResponseOutputMessageContentArray]

func (*ResponseInputItemUnionContent) UnmarshalJSON added in v1.6.0

func (r *ResponseInputItemUnionContent) UnmarshalJSON(data []byte) error

type ResponseInputItemUnionOutput added in v1.6.0

type ResponseInputItemUnionOutput struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field is from variant [ResponseComputerToolCallOutputScreenshot].
	Type constant.ComputerScreenshot `json:"type"`
	// This field is from variant [ResponseComputerToolCallOutputScreenshot].
	FileID string `json:"file_id"`
	// This field is from variant [ResponseComputerToolCallOutputScreenshot].
	ImageURL string `json:"image_url"`
	JSON     struct {
		OfString respjson.Field
		Type     respjson.Field
		FileID   respjson.Field
		ImageURL respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseInputItemUnionOutput is an implicit subunion of ResponseInputItemUnion. ResponseInputItemUnionOutput provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the ResponseInputItemUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfString]

func (*ResponseInputItemUnionOutput) UnmarshalJSON added in v1.6.0

func (r *ResponseInputItemUnionOutput) UnmarshalJSON(data []byte) error

type ResponseInputItemUnionParam

type ResponseInputItemUnionParam struct {
	OfMessage              *EasyInputMessageParam                      `json:",omitzero,inline"`
	OfInputMessage         *ResponseInputItemMessageParam              `json:",omitzero,inline"`
	OfOutputMessage        *ResponseOutputMessageParam                 `json:",omitzero,inline"`
	OfFileSearchCall       *ResponseFileSearchToolCallParam            `json:",omitzero,inline"`
	OfComputerCall         *ResponseComputerToolCallParam              `json:",omitzero,inline"`
	OfComputerCallOutput   *ResponseInputItemComputerCallOutputParam   `json:",omitzero,inline"`
	OfWebSearchCall        *ResponseFunctionWebSearchParam             `json:",omitzero,inline"`
	OfFunctionCall         *ResponseFunctionToolCallParam              `json:",omitzero,inline"`
	OfFunctionCallOutput   *ResponseInputItemFunctionCallOutputParam   `json:",omitzero,inline"`
	OfReasoning            *ResponseReasoningItemParam                 `json:",omitzero,inline"`
	OfImageGenerationCall  *ResponseInputItemImageGenerationCallParam  `json:",omitzero,inline"`
	OfCodeInterpreterCall  *ResponseCodeInterpreterToolCallParam       `json:",omitzero,inline"`
	OfLocalShellCall       *ResponseInputItemLocalShellCallParam       `json:",omitzero,inline"`
	OfLocalShellCallOutput *ResponseInputItemLocalShellCallOutputParam `json:",omitzero,inline"`
	OfMcpListTools         *ResponseInputItemMcpListToolsParam         `json:",omitzero,inline"`
	OfMcpApprovalRequest   *ResponseInputItemMcpApprovalRequestParam   `json:",omitzero,inline"`
	OfMcpApprovalResponse  *ResponseInputItemMcpApprovalResponseParam  `json:",omitzero,inline"`
	OfMcpCall              *ResponseInputItemMcpCallParam              `json:",omitzero,inline"`
	OfItemReference        *ResponseInputItemItemReferenceParam        `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func ResponseInputItemParamOfFileSearchCall

func ResponseInputItemParamOfFileSearchCall(id string, queries []string, status ResponseFileSearchToolCallStatus) ResponseInputItemUnionParam

func ResponseInputItemParamOfFunctionCall

func ResponseInputItemParamOfFunctionCall(arguments string, callID string, name string) ResponseInputItemUnionParam

func ResponseInputItemParamOfFunctionCallOutput

func ResponseInputItemParamOfFunctionCallOutput(callID string, output string) ResponseInputItemUnionParam

func ResponseInputItemParamOfImageGenerationCall added in v1.1.0

func ResponseInputItemParamOfImageGenerationCall(id string, result string, status string) ResponseInputItemUnionParam

func ResponseInputItemParamOfItemReference

func ResponseInputItemParamOfItemReference(id string) ResponseInputItemUnionParam

func ResponseInputItemParamOfLocalShellCallOutput added in v1.1.0

func ResponseInputItemParamOfLocalShellCallOutput(id string, output string) ResponseInputItemUnionParam

func ResponseInputItemParamOfMcpApprovalResponse added in v1.1.0

func ResponseInputItemParamOfMcpApprovalResponse(approvalRequestID string, approve bool) ResponseInputItemUnionParam

func ResponseInputItemParamOfMcpListTools added in v1.1.0

func ResponseInputItemParamOfMcpListTools(id string, serverLabel string, tools []ResponseInputItemMcpListToolsToolParam) ResponseInputItemUnionParam

func (ResponseInputItemUnionParam) GetAcknowledgedSafetyChecks

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetAction

func (u ResponseInputItemUnionParam) GetAction() (res responseInputItemUnionParamAction)

Returns a subunion which exports methods to access subproperties

Or use AsAny() to get the underlying value

func (ResponseInputItemUnionParam) GetApprovalRequestID added in v1.1.0

func (u ResponseInputItemUnionParam) GetApprovalRequestID() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetApprove added in v1.1.0

func (u ResponseInputItemUnionParam) GetApprove() *bool

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetArguments

func (u ResponseInputItemUnionParam) GetArguments() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetCallID

func (u ResponseInputItemUnionParam) GetCallID() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetCode added in v1.1.0

func (u ResponseInputItemUnionParam) GetCode() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetContainerID added in v1.1.0

func (u ResponseInputItemUnionParam) GetContainerID() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetContent

func (u ResponseInputItemUnionParam) GetContent() (res responseInputItemUnionParamContent)

Returns a subunion which exports methods to access subproperties

Or use AsAny() to get the underlying value

func (ResponseInputItemUnionParam) GetEncryptedContent

func (u ResponseInputItemUnionParam) GetEncryptedContent() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetError added in v1.1.0

func (u ResponseInputItemUnionParam) GetError() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetID

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetName

func (u ResponseInputItemUnionParam) GetName() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetOutput

func (u ResponseInputItemUnionParam) GetOutput() (res responseInputItemUnionParamOutput)

Returns a subunion which exports methods to access subproperties

Or use AsAny() to get the underlying value

func (ResponseInputItemUnionParam) GetOutputs added in v1.7.0

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetPendingSafetyChecks

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetQueries

func (u ResponseInputItemUnionParam) GetQueries() []string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetReason added in v1.1.0

func (u ResponseInputItemUnionParam) GetReason() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetResult added in v1.1.0

func (u ResponseInputItemUnionParam) GetResult() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetResults

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetRole

func (u ResponseInputItemUnionParam) GetRole() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetServerLabel added in v1.1.0

func (u ResponseInputItemUnionParam) GetServerLabel() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetStatus

func (u ResponseInputItemUnionParam) GetStatus() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetSummary

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetTools added in v1.1.0

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) GetType

func (u ResponseInputItemUnionParam) GetType() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseInputItemUnionParam) MarshalJSON

func (u ResponseInputItemUnionParam) MarshalJSON() ([]byte, error)

func (*ResponseInputItemUnionParam) UnmarshalJSON

func (u *ResponseInputItemUnionParam) UnmarshalJSON(data []byte) error

type ResponseInputMessageContentList

type ResponseInputMessageContentList []ResponseInputContentUnion

type ResponseInputMessageContentListParam

type ResponseInputMessageContentListParam []ResponseInputContentUnionParam

type ResponseInputMessageItem

type ResponseInputMessageItem struct {
	// The unique ID of the message input.
	ID string `json:"id,required"`
	// A list of one or many input items to the model, containing different content
	// types.
	Content ResponseInputMessageContentList `json:"content,required"`
	// The role of the message input. One of `user`, `system`, or `developer`.
	//
	// Any of "user", "system", "developer".
	Role ResponseInputMessageItemRole `json:"role,required"`
	// The status of item. One of `in_progress`, `completed`, or `incomplete`.
	// Populated when items are returned via API.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status ResponseInputMessageItemStatus `json:"status"`
	// The type of the message input. Always set to `message`.
	//
	// Any of "message".
	Type ResponseInputMessageItemType `json:"type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Content     respjson.Field
		Role        respjson.Field
		Status      respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ResponseInputMessageItem) RawJSON

func (r ResponseInputMessageItem) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseInputMessageItem) UnmarshalJSON

func (r *ResponseInputMessageItem) UnmarshalJSON(data []byte) error

type ResponseInputMessageItemRole

type ResponseInputMessageItemRole string

The role of the message input. One of `user`, `system`, or `developer`.

const (
	ResponseInputMessageItemRoleUser      ResponseInputMessageItemRole = "user"
	ResponseInputMessageItemRoleSystem    ResponseInputMessageItemRole = "system"
	ResponseInputMessageItemRoleDeveloper ResponseInputMessageItemRole = "developer"
)

type ResponseInputMessageItemStatus

type ResponseInputMessageItemStatus string

The status of item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

const (
	ResponseInputMessageItemStatusInProgress ResponseInputMessageItemStatus = "in_progress"
	ResponseInputMessageItemStatusCompleted  ResponseInputMessageItemStatus = "completed"
	ResponseInputMessageItemStatusIncomplete ResponseInputMessageItemStatus = "incomplete"
)

type ResponseInputMessageItemType

type ResponseInputMessageItemType string

The type of the message input. Always set to `message`.

const (
	ResponseInputMessageItemTypeMessage ResponseInputMessageItemType = "message"
)

type ResponseInputParam

type ResponseInputParam []ResponseInputItemUnionParam

type ResponseInputText

type ResponseInputText struct {
	// The text input to the model.
	Text string `json:"text,required"`
	// The type of the input item. Always `input_text`.
	Type constant.InputText `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Text        respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A text input to the model.

func (ResponseInputText) RawJSON

func (r ResponseInputText) RawJSON() string

Returns the unmodified JSON received from the API

func (ResponseInputText) ToParam

ToParam converts this ResponseInputText to a ResponseInputTextParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseInputTextParam.Overrides()

func (*ResponseInputText) UnmarshalJSON

func (r *ResponseInputText) UnmarshalJSON(data []byte) error

type ResponseInputTextParam

type ResponseInputTextParam struct {
	// The text input to the model.
	Text string `json:"text,required"`
	// The type of the input item. Always `input_text`.
	//
	// This field can be elided, and will marshal its zero value as "input_text".
	Type constant.InputText `json:"type,required"`
	// contains filtered or unexported fields
}

A text input to the model.

The properties Text, Type are required.

func (ResponseInputTextParam) MarshalJSON

func (r ResponseInputTextParam) MarshalJSON() (data []byte, err error)

func (*ResponseInputTextParam) UnmarshalJSON

func (r *ResponseInputTextParam) UnmarshalJSON(data []byte) error

type ResponseInstructionsUnion added in v1.6.0

type ResponseInstructionsUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [[]ResponseInputItemUnion] instead
	// of an object.
	OfInputItemList []ResponseInputItemUnion `json:",inline"`
	JSON            struct {
		OfString        respjson.Field
		OfInputItemList respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseInstructionsUnion contains all possible properties and values from [string], [[]ResponseInputItemUnion].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfInputItemList]

func (ResponseInstructionsUnion) AsInputItemList added in v1.6.0

func (u ResponseInstructionsUnion) AsInputItemList() (v []ResponseInputItemUnion)

func (ResponseInstructionsUnion) AsString added in v1.6.0

func (u ResponseInstructionsUnion) AsString() (v string)

func (ResponseInstructionsUnion) RawJSON added in v1.6.0

func (u ResponseInstructionsUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseInstructionsUnion) UnmarshalJSON added in v1.6.0

func (r *ResponseInstructionsUnion) UnmarshalJSON(data []byte) error

type ResponseItemImageGenerationCall added in v1.1.0

type ResponseItemImageGenerationCall struct {
	// The unique ID of the image generation call.
	ID string `json:"id,required"`
	// The generated image encoded in base64.
	Result string `json:"result,required"`
	// The status of the image generation call.
	//
	// Any of "in_progress", "completed", "generating", "failed".
	Status string `json:"status,required"`
	// The type of the image generation call. Always `image_generation_call`.
	Type constant.ImageGenerationCall `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Result      respjson.Field
		Status      respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An image generation request made by the model.

func (ResponseItemImageGenerationCall) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseItemImageGenerationCall) UnmarshalJSON added in v1.1.0

func (r *ResponseItemImageGenerationCall) UnmarshalJSON(data []byte) error

type ResponseItemList

type ResponseItemList struct {
	// A list of items used to generate this response.
	Data []ResponseItemUnion `json:"data,required"`
	// The ID of the first item in the list.
	FirstID string `json:"first_id,required"`
	// Whether there are more items available.
	HasMore bool `json:"has_more,required"`
	// The ID of the last item in the list.
	LastID string `json:"last_id,required"`
	// The type of object returned, must be `list`.
	Object constant.List `json:"object,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		FirstID     respjson.Field
		HasMore     respjson.Field
		LastID      respjson.Field
		Object      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A list of Response items.

func (ResponseItemList) RawJSON

func (r ResponseItemList) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseItemList) UnmarshalJSON

func (r *ResponseItemList) UnmarshalJSON(data []byte) error

type ResponseItemLocalShellCall added in v1.1.0

type ResponseItemLocalShellCall struct {
	// The unique ID of the local shell call.
	ID string `json:"id,required"`
	// Execute a shell command on the server.
	Action ResponseItemLocalShellCallAction `json:"action,required"`
	// The unique ID of the local shell tool call generated by the model.
	CallID string `json:"call_id,required"`
	// The status of the local shell call.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status string `json:"status,required"`
	// The type of the local shell call. Always `local_shell_call`.
	Type constant.LocalShellCall `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Action      respjson.Field
		CallID      respjson.Field
		Status      respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A tool call to run a command on the local shell.

func (ResponseItemLocalShellCall) RawJSON added in v1.1.0

func (r ResponseItemLocalShellCall) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseItemLocalShellCall) UnmarshalJSON added in v1.1.0

func (r *ResponseItemLocalShellCall) UnmarshalJSON(data []byte) error

type ResponseItemLocalShellCallAction added in v1.1.0

type ResponseItemLocalShellCallAction struct {
	// The command to run.
	Command []string `json:"command,required"`
	// Environment variables to set for the command.
	Env map[string]string `json:"env,required"`
	// The type of the local shell action. Always `exec`.
	Type constant.Exec `json:"type,required"`
	// Optional timeout in milliseconds for the command.
	TimeoutMs int64 `json:"timeout_ms,nullable"`
	// Optional user to run the command as.
	User string `json:"user,nullable"`
	// Optional working directory to run the command in.
	WorkingDirectory string `json:"working_directory,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Command          respjson.Field
		Env              respjson.Field
		Type             respjson.Field
		TimeoutMs        respjson.Field
		User             respjson.Field
		WorkingDirectory respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Execute a shell command on the server.

func (ResponseItemLocalShellCallAction) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseItemLocalShellCallAction) UnmarshalJSON added in v1.1.0

func (r *ResponseItemLocalShellCallAction) UnmarshalJSON(data []byte) error

type ResponseItemLocalShellCallOutput added in v1.1.0

type ResponseItemLocalShellCallOutput struct {
	// The unique ID of the local shell tool call generated by the model.
	ID string `json:"id,required"`
	// A JSON string of the output of the local shell tool call.
	Output string `json:"output,required"`
	// The type of the local shell tool call output. Always `local_shell_call_output`.
	Type constant.LocalShellCallOutput `json:"type,required"`
	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status string `json:"status,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Output      respjson.Field
		Type        respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The output of a local shell tool call.

func (ResponseItemLocalShellCallOutput) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseItemLocalShellCallOutput) UnmarshalJSON added in v1.1.0

func (r *ResponseItemLocalShellCallOutput) UnmarshalJSON(data []byte) error

type ResponseItemMcpApprovalRequest added in v1.1.0

type ResponseItemMcpApprovalRequest struct {
	// The unique ID of the approval request.
	ID string `json:"id,required"`
	// A JSON string of arguments for the tool.
	Arguments string `json:"arguments,required"`
	// The name of the tool to run.
	Name string `json:"name,required"`
	// The label of the MCP server making the request.
	ServerLabel string `json:"server_label,required"`
	// The type of the item. Always `mcp_approval_request`.
	Type constant.McpApprovalRequest `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Arguments   respjson.Field
		Name        respjson.Field
		ServerLabel respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A request for human approval of a tool invocation.

func (ResponseItemMcpApprovalRequest) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseItemMcpApprovalRequest) UnmarshalJSON added in v1.1.0

func (r *ResponseItemMcpApprovalRequest) UnmarshalJSON(data []byte) error

type ResponseItemMcpApprovalResponse added in v1.1.0

type ResponseItemMcpApprovalResponse struct {
	// The unique ID of the approval response
	ID string `json:"id,required"`
	// The ID of the approval request being answered.
	ApprovalRequestID string `json:"approval_request_id,required"`
	// Whether the request was approved.
	Approve bool `json:"approve,required"`
	// The type of the item. Always `mcp_approval_response`.
	Type constant.McpApprovalResponse `json:"type,required"`
	// Optional reason for the decision.
	Reason string `json:"reason,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                respjson.Field
		ApprovalRequestID respjson.Field
		Approve           respjson.Field
		Type              respjson.Field
		Reason            respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A response to an MCP approval request.

func (ResponseItemMcpApprovalResponse) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseItemMcpApprovalResponse) UnmarshalJSON added in v1.1.0

func (r *ResponseItemMcpApprovalResponse) UnmarshalJSON(data []byte) error

type ResponseItemMcpCall added in v1.1.0

type ResponseItemMcpCall struct {
	// The unique ID of the tool call.
	ID string `json:"id,required"`
	// A JSON string of the arguments passed to the tool.
	Arguments string `json:"arguments,required"`
	// The name of the tool that was run.
	Name string `json:"name,required"`
	// The label of the MCP server running the tool.
	ServerLabel string `json:"server_label,required"`
	// The type of the item. Always `mcp_call`.
	Type constant.McpCall `json:"type,required"`
	// The error from the tool call, if any.
	Error string `json:"error,nullable"`
	// The output from the tool call.
	Output string `json:"output,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Arguments   respjson.Field
		Name        respjson.Field
		ServerLabel respjson.Field
		Type        respjson.Field
		Error       respjson.Field
		Output      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An invocation of a tool on an MCP server.

func (ResponseItemMcpCall) RawJSON added in v1.1.0

func (r ResponseItemMcpCall) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseItemMcpCall) UnmarshalJSON added in v1.1.0

func (r *ResponseItemMcpCall) UnmarshalJSON(data []byte) error

type ResponseItemMcpListTools added in v1.1.0

type ResponseItemMcpListTools struct {
	// The unique ID of the list.
	ID string `json:"id,required"`
	// The label of the MCP server.
	ServerLabel string `json:"server_label,required"`
	// The tools available on the server.
	Tools []ResponseItemMcpListToolsTool `json:"tools,required"`
	// The type of the item. Always `mcp_list_tools`.
	Type constant.McpListTools `json:"type,required"`
	// Error message if the server could not list tools.
	Error string `json:"error,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ServerLabel respjson.Field
		Tools       respjson.Field
		Type        respjson.Field
		Error       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A list of tools available on an MCP server.

func (ResponseItemMcpListTools) RawJSON added in v1.1.0

func (r ResponseItemMcpListTools) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseItemMcpListTools) UnmarshalJSON added in v1.1.0

func (r *ResponseItemMcpListTools) UnmarshalJSON(data []byte) error

type ResponseItemMcpListToolsTool added in v1.1.0

type ResponseItemMcpListToolsTool struct {
	// The JSON schema describing the tool's input.
	InputSchema any `json:"input_schema,required"`
	// The name of the tool.
	Name string `json:"name,required"`
	// Additional annotations about the tool.
	Annotations any `json:"annotations,nullable"`
	// The description of the tool.
	Description string `json:"description,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		InputSchema respjson.Field
		Name        respjson.Field
		Annotations respjson.Field
		Description respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A tool available on an MCP server.

func (ResponseItemMcpListToolsTool) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseItemMcpListToolsTool) UnmarshalJSON added in v1.1.0

func (r *ResponseItemMcpListToolsTool) UnmarshalJSON(data []byte) error

type ResponseItemUnion

type ResponseItemUnion struct {
	ID string `json:"id"`
	// This field is a union of [ResponseInputMessageContentList],
	// [[]ResponseOutputMessageContentUnion]
	Content ResponseItemUnionContent `json:"content"`
	Role    string                   `json:"role"`
	Status  string                   `json:"status"`
	// Any of "message", "message", "file_search_call", "computer_call",
	// "computer_call_output", "web_search_call", "function_call",
	// "function_call_output", "image_generation_call", "code_interpreter_call",
	// "local_shell_call", "local_shell_call_output", "mcp_list_tools",
	// "mcp_approval_request", "mcp_approval_response", "mcp_call".
	Type string `json:"type"`
	// This field is from variant [ResponseFileSearchToolCall].
	Queries []string `json:"queries"`
	// This field is from variant [ResponseFileSearchToolCall].
	Results []ResponseFileSearchToolCallResult `json:"results"`
	// This field is a union of [ResponseComputerToolCallActionUnion],
	// [ResponseFunctionWebSearchActionUnion], [ResponseItemLocalShellCallAction]
	Action ResponseItemUnionAction `json:"action"`
	CallID string                  `json:"call_id"`
	// This field is from variant [ResponseComputerToolCall].
	PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck `json:"pending_safety_checks"`
	// This field is a union of [ResponseComputerToolCallOutputScreenshot], [string],
	// [string], [string]
	Output ResponseItemUnionOutput `json:"output"`
	// This field is from variant [ResponseComputerToolCallOutputItem].
	AcknowledgedSafetyChecks []ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck `json:"acknowledged_safety_checks"`
	Arguments                string                                                      `json:"arguments"`
	Name                     string                                                      `json:"name"`
	// This field is from variant [ResponseItemImageGenerationCall].
	Result string `json:"result"`
	// This field is from variant [ResponseCodeInterpreterToolCall].
	Code string `json:"code"`
	// This field is from variant [ResponseCodeInterpreterToolCall].
	ContainerID string `json:"container_id"`
	// This field is from variant [ResponseCodeInterpreterToolCall].
	Outputs     []ResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
	ServerLabel string                                       `json:"server_label"`
	// This field is from variant [ResponseItemMcpListTools].
	Tools []ResponseItemMcpListToolsTool `json:"tools"`
	Error string                         `json:"error"`
	// This field is from variant [ResponseItemMcpApprovalResponse].
	ApprovalRequestID string `json:"approval_request_id"`
	// This field is from variant [ResponseItemMcpApprovalResponse].
	Approve bool `json:"approve"`
	// This field is from variant [ResponseItemMcpApprovalResponse].
	Reason string `json:"reason"`
	JSON   struct {
		ID                       respjson.Field
		Content                  respjson.Field
		Role                     respjson.Field
		Status                   respjson.Field
		Type                     respjson.Field
		Queries                  respjson.Field
		Results                  respjson.Field
		Action                   respjson.Field
		CallID                   respjson.Field
		PendingSafetyChecks      respjson.Field
		Output                   respjson.Field
		AcknowledgedSafetyChecks respjson.Field
		Arguments                respjson.Field
		Name                     respjson.Field
		Result                   respjson.Field
		Code                     respjson.Field
		ContainerID              respjson.Field
		Outputs                  respjson.Field
		ServerLabel              respjson.Field
		Tools                    respjson.Field
		Error                    respjson.Field
		ApprovalRequestID        respjson.Field
		Approve                  respjson.Field
		Reason                   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseItemUnion contains all possible properties and values from ResponseInputMessageItem, ResponseOutputMessage, ResponseFileSearchToolCall, ResponseComputerToolCall, ResponseComputerToolCallOutputItem, ResponseFunctionWebSearch, ResponseFunctionToolCallItem, ResponseFunctionToolCallOutputItem, ResponseItemImageGenerationCall, ResponseCodeInterpreterToolCall, ResponseItemLocalShellCall, ResponseItemLocalShellCallOutput, ResponseItemMcpListTools, ResponseItemMcpApprovalRequest, ResponseItemMcpApprovalResponse, ResponseItemMcpCall.

Use the ResponseItemUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ResponseItemUnion) AsAny

func (u ResponseItemUnion) AsAny() anyResponseItem

Use the following switch statement to find the correct variant

switch variant := ResponseItemUnion.AsAny().(type) {
case responses.ResponseInputMessageItem:
case responses.ResponseOutputMessage:
case responses.ResponseFileSearchToolCall:
case responses.ResponseComputerToolCall:
case responses.ResponseComputerToolCallOutputItem:
case responses.ResponseFunctionWebSearch:
case responses.ResponseFunctionToolCallItem:
case responses.ResponseFunctionToolCallOutputItem:
case responses.ResponseItemImageGenerationCall:
case responses.ResponseCodeInterpreterToolCall:
case responses.ResponseItemLocalShellCall:
case responses.ResponseItemLocalShellCallOutput:
case responses.ResponseItemMcpListTools:
case responses.ResponseItemMcpApprovalRequest:
case responses.ResponseItemMcpApprovalResponse:
case responses.ResponseItemMcpCall:
default:
  fmt.Errorf("no variant present")
}

func (ResponseItemUnion) AsCodeInterpreterCall added in v1.1.0

func (u ResponseItemUnion) AsCodeInterpreterCall() (v ResponseCodeInterpreterToolCall)

func (ResponseItemUnion) AsComputerCall

func (u ResponseItemUnion) AsComputerCall() (v ResponseComputerToolCall)

func (ResponseItemUnion) AsComputerCallOutput

func (u ResponseItemUnion) AsComputerCallOutput() (v ResponseComputerToolCallOutputItem)

func (ResponseItemUnion) AsFileSearchCall

func (u ResponseItemUnion) AsFileSearchCall() (v ResponseFileSearchToolCall)

func (ResponseItemUnion) AsFunctionCall

func (u ResponseItemUnion) AsFunctionCall() (v ResponseFunctionToolCallItem)

func (ResponseItemUnion) AsFunctionCallOutput

func (u ResponseItemUnion) AsFunctionCallOutput() (v ResponseFunctionToolCallOutputItem)

func (ResponseItemUnion) AsImageGenerationCall added in v1.1.0

func (u ResponseItemUnion) AsImageGenerationCall() (v ResponseItemImageGenerationCall)

func (ResponseItemUnion) AsLocalShellCall added in v1.1.0

func (u ResponseItemUnion) AsLocalShellCall() (v ResponseItemLocalShellCall)

func (ResponseItemUnion) AsLocalShellCallOutput added in v1.1.0

func (u ResponseItemUnion) AsLocalShellCallOutput() (v ResponseItemLocalShellCallOutput)

func (ResponseItemUnion) AsMcpApprovalRequest added in v1.1.0

func (u ResponseItemUnion) AsMcpApprovalRequest() (v ResponseItemMcpApprovalRequest)

func (ResponseItemUnion) AsMcpApprovalResponse added in v1.1.0

func (u ResponseItemUnion) AsMcpApprovalResponse() (v ResponseItemMcpApprovalResponse)

func (ResponseItemUnion) AsMcpCall added in v1.1.0

func (u ResponseItemUnion) AsMcpCall() (v ResponseItemMcpCall)

func (ResponseItemUnion) AsMcpListTools added in v1.1.0

func (u ResponseItemUnion) AsMcpListTools() (v ResponseItemMcpListTools)

func (ResponseItemUnion) AsMessage

func (u ResponseItemUnion) AsMessage() (v ResponseInputMessageItem)

func (ResponseItemUnion) AsOutputMessage

func (u ResponseItemUnion) AsOutputMessage() (v ResponseOutputMessage)

func (ResponseItemUnion) AsWebSearchCall

func (u ResponseItemUnion) AsWebSearchCall() (v ResponseFunctionWebSearch)

func (ResponseItemUnion) RawJSON

func (u ResponseItemUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseItemUnion) UnmarshalJSON

func (r *ResponseItemUnion) UnmarshalJSON(data []byte) error

type ResponseItemUnionAction added in v1.1.0

type ResponseItemUnionAction struct {
	// This field is from variant [ResponseComputerToolCallActionUnion].
	Button string `json:"button"`
	Type   string `json:"type"`
	X      int64  `json:"x"`
	Y      int64  `json:"y"`
	// This field is from variant [ResponseComputerToolCallActionUnion].
	Path []ResponseComputerToolCallActionDragPath `json:"path"`
	// This field is from variant [ResponseComputerToolCallActionUnion].
	Keys []string `json:"keys"`
	// This field is from variant [ResponseComputerToolCallActionUnion].
	ScrollX int64 `json:"scroll_x"`
	// This field is from variant [ResponseComputerToolCallActionUnion].
	ScrollY int64 `json:"scroll_y"`
	// This field is from variant [ResponseComputerToolCallActionUnion].
	Text string `json:"text"`
	// This field is from variant [ResponseFunctionWebSearchActionUnion].
	Query string `json:"query"`
	URL   string `json:"url"`
	// This field is from variant [ResponseFunctionWebSearchActionUnion].
	Pattern string `json:"pattern"`
	// This field is from variant [ResponseItemLocalShellCallAction].
	Command []string `json:"command"`
	// This field is from variant [ResponseItemLocalShellCallAction].
	Env map[string]string `json:"env"`
	// This field is from variant [ResponseItemLocalShellCallAction].
	TimeoutMs int64 `json:"timeout_ms"`
	// This field is from variant [ResponseItemLocalShellCallAction].
	User string `json:"user"`
	// This field is from variant [ResponseItemLocalShellCallAction].
	WorkingDirectory string `json:"working_directory"`
	JSON             struct {
		Button           respjson.Field
		Type             respjson.Field
		X                respjson.Field
		Y                respjson.Field
		Path             respjson.Field
		Keys             respjson.Field
		ScrollX          respjson.Field
		ScrollY          respjson.Field
		Text             respjson.Field
		Query            respjson.Field
		URL              respjson.Field
		Pattern          respjson.Field
		Command          respjson.Field
		Env              respjson.Field
		TimeoutMs        respjson.Field
		User             respjson.Field
		WorkingDirectory respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseItemUnionAction is an implicit subunion of ResponseItemUnion. ResponseItemUnionAction provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the ResponseItemUnion.

func (*ResponseItemUnionAction) UnmarshalJSON added in v1.1.0

func (r *ResponseItemUnionAction) UnmarshalJSON(data []byte) error

type ResponseItemUnionContent

type ResponseItemUnionContent struct {
	// This field will be present if the value is a [ResponseInputMessageContentList]
	// instead of an object.
	OfInputItemContentList ResponseInputMessageContentList `json:",inline"`
	// This field will be present if the value is a
	// [[]ResponseOutputMessageContentUnion] instead of an object.
	OfResponseOutputMessageContentArray []ResponseOutputMessageContentUnion `json:",inline"`
	JSON                                struct {
		OfInputItemContentList              respjson.Field
		OfResponseOutputMessageContentArray respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseItemUnionContent is an implicit subunion of ResponseItemUnion. ResponseItemUnionContent provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the ResponseItemUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfInputItemContentList OfResponseOutputMessageContentArray]

func (*ResponseItemUnionContent) UnmarshalJSON

func (r *ResponseItemUnionContent) UnmarshalJSON(data []byte) error

type ResponseItemUnionOutput

type ResponseItemUnionOutput struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field is from variant [ResponseComputerToolCallOutputScreenshot].
	Type constant.ComputerScreenshot `json:"type"`
	// This field is from variant [ResponseComputerToolCallOutputScreenshot].
	FileID string `json:"file_id"`
	// This field is from variant [ResponseComputerToolCallOutputScreenshot].
	ImageURL string `json:"image_url"`
	JSON     struct {
		OfString respjson.Field
		Type     respjson.Field
		FileID   respjson.Field
		ImageURL respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseItemUnionOutput is an implicit subunion of ResponseItemUnion. ResponseItemUnionOutput provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the ResponseItemUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfString]

func (*ResponseItemUnionOutput) UnmarshalJSON

func (r *ResponseItemUnionOutput) UnmarshalJSON(data []byte) error

type ResponseMcpCallArgumentsDeltaEvent added in v1.1.0

type ResponseMcpCallArgumentsDeltaEvent struct {
	// The partial update to the arguments for the MCP tool call.
	Delta any `json:"delta,required"`
	// The unique identifier of the MCP tool call item being processed.
	ItemID string `json:"item_id,required"`
	// The index of the output item in the response's output array.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always 'response.mcp_call_arguments.delta'.
	Type constant.ResponseMcpCallArgumentsDelta `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Delta          respjson.Field
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when there is a delta (partial update) to the arguments of an MCP tool call.

func (ResponseMcpCallArgumentsDeltaEvent) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseMcpCallArgumentsDeltaEvent) UnmarshalJSON added in v1.1.0

func (r *ResponseMcpCallArgumentsDeltaEvent) UnmarshalJSON(data []byte) error

type ResponseMcpCallArgumentsDoneEvent added in v1.1.0

type ResponseMcpCallArgumentsDoneEvent struct {
	// The finalized arguments for the MCP tool call.
	Arguments any `json:"arguments,required"`
	// The unique identifier of the MCP tool call item being processed.
	ItemID string `json:"item_id,required"`
	// The index of the output item in the response's output array.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always 'response.mcp_call_arguments.done'.
	Type constant.ResponseMcpCallArgumentsDone `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Arguments      respjson.Field
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when the arguments for an MCP tool call are finalized.

func (ResponseMcpCallArgumentsDoneEvent) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseMcpCallArgumentsDoneEvent) UnmarshalJSON added in v1.1.0

func (r *ResponseMcpCallArgumentsDoneEvent) UnmarshalJSON(data []byte) error

type ResponseMcpCallCompletedEvent added in v1.1.0

type ResponseMcpCallCompletedEvent struct {
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always 'response.mcp_call.completed'.
	Type constant.ResponseMcpCallCompleted `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when an MCP tool call has completed successfully.

func (ResponseMcpCallCompletedEvent) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseMcpCallCompletedEvent) UnmarshalJSON added in v1.1.0

func (r *ResponseMcpCallCompletedEvent) UnmarshalJSON(data []byte) error

type ResponseMcpCallFailedEvent added in v1.1.0

type ResponseMcpCallFailedEvent struct {
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always 'response.mcp_call.failed'.
	Type constant.ResponseMcpCallFailed `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when an MCP tool call has failed.

func (ResponseMcpCallFailedEvent) RawJSON added in v1.1.0

func (r ResponseMcpCallFailedEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseMcpCallFailedEvent) UnmarshalJSON added in v1.1.0

func (r *ResponseMcpCallFailedEvent) UnmarshalJSON(data []byte) error

type ResponseMcpCallInProgressEvent added in v1.1.0

type ResponseMcpCallInProgressEvent struct {
	// The unique identifier of the MCP tool call item being processed.
	ItemID string `json:"item_id,required"`
	// The index of the output item in the response's output array.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always 'response.mcp_call.in_progress'.
	Type constant.ResponseMcpCallInProgress `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when an MCP tool call is in progress.

func (ResponseMcpCallInProgressEvent) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseMcpCallInProgressEvent) UnmarshalJSON added in v1.1.0

func (r *ResponseMcpCallInProgressEvent) UnmarshalJSON(data []byte) error

type ResponseMcpListToolsCompletedEvent added in v1.1.0

type ResponseMcpListToolsCompletedEvent struct {
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always 'response.mcp_list_tools.completed'.
	Type constant.ResponseMcpListToolsCompleted `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when the list of available MCP tools has been successfully retrieved.

func (ResponseMcpListToolsCompletedEvent) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseMcpListToolsCompletedEvent) UnmarshalJSON added in v1.1.0

func (r *ResponseMcpListToolsCompletedEvent) UnmarshalJSON(data []byte) error

type ResponseMcpListToolsFailedEvent added in v1.1.0

type ResponseMcpListToolsFailedEvent struct {
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always 'response.mcp_list_tools.failed'.
	Type constant.ResponseMcpListToolsFailed `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when the attempt to list available MCP tools has failed.

func (ResponseMcpListToolsFailedEvent) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseMcpListToolsFailedEvent) UnmarshalJSON added in v1.1.0

func (r *ResponseMcpListToolsFailedEvent) UnmarshalJSON(data []byte) error

type ResponseMcpListToolsInProgressEvent added in v1.1.0

type ResponseMcpListToolsInProgressEvent struct {
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always 'response.mcp_list_tools.in_progress'.
	Type constant.ResponseMcpListToolsInProgress `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when the system is in the process of retrieving the list of available MCP tools.

func (ResponseMcpListToolsInProgressEvent) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseMcpListToolsInProgressEvent) UnmarshalJSON added in v1.1.0

func (r *ResponseMcpListToolsInProgressEvent) UnmarshalJSON(data []byte) error

type ResponseNewParams

type ResponseNewParams struct {
	// Whether to run the model response in the background.
	// [Learn more](https://platform.openai.com/docs/guides/background).
	Background param.Opt[bool] `json:"background,omitzero"`
	// A system (or developer) message inserted into the model's context.
	//
	// When using along with `previous_response_id`, the instructions from a previous
	// response will not be carried over to the next response. This makes it simple to
	// swap out system (or developer) messages in new responses.
	Instructions param.Opt[string] `json:"instructions,omitzero"`
	// An upper bound for the number of tokens that can be generated for a response,
	// including visible output tokens and
	// [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).
	MaxOutputTokens param.Opt[int64] `json:"max_output_tokens,omitzero"`
	// The maximum number of total calls to built-in tools that can be processed in a
	// response. This maximum number applies across all built-in tool calls, not per
	// individual tool. Any further attempts to call a tool by the model will be
	// ignored.
	MaxToolCalls param.Opt[int64] `json:"max_tool_calls,omitzero"`
	// Whether to allow the model to run tool calls in parallel.
	ParallelToolCalls param.Opt[bool] `json:"parallel_tool_calls,omitzero"`
	// The unique ID of the previous response to the model. Use this to create
	// multi-turn conversations. Learn more about
	// [conversation state](https://platform.openai.com/docs/guides/conversation-state).
	PreviousResponseID param.Opt[string] `json:"previous_response_id,omitzero"`
	// Whether to store the generated model response for later retrieval via API.
	Store param.Opt[bool] `json:"store,omitzero"`
	// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
	// make the output more random, while lower values like 0.2 will make it more
	// focused and deterministic. We generally recommend altering this or `top_p` but
	// not both.
	Temperature param.Opt[float64] `json:"temperature,omitzero"`
	// An integer between 0 and 20 specifying the number of most likely tokens to
	// return at each token position, each with an associated log probability.
	TopLogprobs param.Opt[int64] `json:"top_logprobs,omitzero"`
	// An alternative to sampling with temperature, called nucleus sampling, where the
	// model considers the results of the tokens with top_p probability mass. So 0.1
	// means only the tokens comprising the top 10% probability mass are considered.
	//
	// We generally recommend altering this or `temperature` but not both.
	TopP param.Opt[float64] `json:"top_p,omitzero"`
	// A stable identifier for your end-users. Used to boost cache hit rates by better
	// bucketing similar requests and to help OpenAI detect and prevent abuse.
	// [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
	User param.Opt[string] `json:"user,omitzero"`
	// Specify additional output data to include in the model response. Currently
	// supported values are:
	//
	//   - `code_interpreter_call.outputs`: Includes the outputs of python code execution
	//     in code interpreter tool call items.
	//   - `computer_call_output.output.image_url`: Include image urls from the computer
	//     call output.
	//   - `file_search_call.results`: Include the search results of the file search tool
	//     call.
	//   - `message.input_image.image_url`: Include image urls from the input message.
	//   - `message.output_text.logprobs`: Include logprobs with assistant messages.
	//   - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
	//     tokens in reasoning item outputs. This enables reasoning items to be used in
	//     multi-turn conversations when using the Responses API statelessly (like when
	//     the `store` parameter is set to `false`, or when an organization is enrolled
	//     in the zero data retention program).
	Include []ResponseIncludable `json:"include,omitzero"`
	// 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 shared.Metadata `json:"metadata,omitzero"`
	// Reference to a prompt template and its variables.
	// [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
	Prompt ResponsePromptParam `json:"prompt,omitzero"`
	// Specifies the processing type used for serving the request.
	//
	//   - If set to 'auto', then the request will be processed with the service tier
	//     configured in the Project settings. Unless otherwise configured, the Project
	//     will use 'default'.
	//   - If set to 'default', then the requset will be processed with the standard
	//     pricing and performance for the selected model.
	//   - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
	//     'priority', then the request will be processed with the corresponding service
	//     tier. [Contact sales](https://openai.com/contact-sales) to learn more about
	//     Priority processing.
	//   - When not set, the default behavior is 'auto'.
	//
	// When the `service_tier` parameter is set, the response body will include the
	// `service_tier` value based on the processing mode actually used to serve the
	// request. This response value may be different from the value set in the
	// parameter.
	//
	// Any of "auto", "default", "flex", "scale", "priority".
	ServiceTier ResponseNewParamsServiceTier `json:"service_tier,omitzero"`
	// The truncation strategy to use for the model response.
	//
	//   - `auto`: If the context of this response and previous ones exceeds the model's
	//     context window size, the model will truncate the response to fit the context
	//     window by dropping input items in the middle of the conversation.
	//   - `disabled` (default): If a model response will exceed the context window size
	//     for a model, the request will fail with a 400 error.
	//
	// Any of "auto", "disabled".
	Truncation ResponseNewParamsTruncation `json:"truncation,omitzero"`
	// Text, image, or file inputs to the model, used to generate a response.
	//
	// Learn more:
	//
	// - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
	// - [Image inputs](https://platform.openai.com/docs/guides/images)
	// - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
	// - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
	// - [Function calling](https://platform.openai.com/docs/guides/function-calling)
	Input ResponseNewParamsInputUnion `json:"input,omitzero"`
	// Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
	// wide range of models with different capabilities, performance characteristics,
	// and price points. Refer to the
	// [model guide](https://platform.openai.com/docs/models) to browse and compare
	// available models.
	Model shared.ResponsesModel `json:"model,omitzero"`
	// **o-series models only**
	//
	// Configuration options for
	// [reasoning models](https://platform.openai.com/docs/guides/reasoning).
	Reasoning shared.ReasoningParam `json:"reasoning,omitzero"`
	// Configuration options for a text response from the model. Can be plain text or
	// structured JSON data. Learn more:
	//
	// - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
	// - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
	Text ResponseTextConfigParam `json:"text,omitzero"`
	// How the model should select which tool (or tools) to use when generating a
	// response. See the `tools` parameter to see how to specify which tools the model
	// can call.
	ToolChoice ResponseNewParamsToolChoiceUnion `json:"tool_choice,omitzero"`
	// An array of tools the model may call while generating a response. You can
	// specify which tool to use by setting the `tool_choice` parameter.
	//
	// The two categories of tools you can provide the model are:
	//
	//   - **Built-in tools**: Tools that are provided by OpenAI that extend the model's
	//     capabilities, like
	//     [web search](https://platform.openai.com/docs/guides/tools-web-search) or
	//     [file search](https://platform.openai.com/docs/guides/tools-file-search).
	//     Learn more about
	//     [built-in tools](https://platform.openai.com/docs/guides/tools).
	//   - **Function calls (custom tools)**: Functions that are defined by you, enabling
	//     the model to call your own code. Learn more about
	//     [function calling](https://platform.openai.com/docs/guides/function-calling).
	Tools []ToolUnionParam `json:"tools,omitzero"`
	// contains filtered or unexported fields
}

func (ResponseNewParams) MarshalJSON

func (r ResponseNewParams) MarshalJSON() (data []byte, err error)

func (*ResponseNewParams) UnmarshalJSON

func (r *ResponseNewParams) UnmarshalJSON(data []byte) error

type ResponseNewParamsInputUnion

type ResponseNewParamsInputUnion struct {
	OfString        param.Opt[string]  `json:",omitzero,inline"`
	OfInputItemList ResponseInputParam `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ResponseNewParamsInputUnion) MarshalJSON

func (u ResponseNewParamsInputUnion) MarshalJSON() ([]byte, error)

func (*ResponseNewParamsInputUnion) UnmarshalJSON

func (u *ResponseNewParamsInputUnion) UnmarshalJSON(data []byte) error

type ResponseNewParamsServiceTier

type ResponseNewParamsServiceTier string

Specifies the processing type used for serving the request.

  • If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
  • If set to 'default', then the requset will be processed with the standard pricing and performance for the selected model.
  • If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or 'priority', then the request will be processed with the corresponding service tier. [Contact sales](https://openai.com/contact-sales) to learn more about Priority processing.
  • When not set, the default behavior is 'auto'.

When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

const (
	ResponseNewParamsServiceTierAuto     ResponseNewParamsServiceTier = "auto"
	ResponseNewParamsServiceTierDefault  ResponseNewParamsServiceTier = "default"
	ResponseNewParamsServiceTierFlex     ResponseNewParamsServiceTier = "flex"
	ResponseNewParamsServiceTierScale    ResponseNewParamsServiceTier = "scale"
	ResponseNewParamsServiceTierPriority ResponseNewParamsServiceTier = "priority"
)

type ResponseNewParamsToolChoiceUnion

type ResponseNewParamsToolChoiceUnion struct {
	// Check if union is this variant with !param.IsOmitted(union.OfToolChoiceMode)
	OfToolChoiceMode param.Opt[ToolChoiceOptions] `json:",omitzero,inline"`
	OfHostedTool     *ToolChoiceTypesParam        `json:",omitzero,inline"`
	OfFunctionTool   *ToolChoiceFunctionParam     `json:",omitzero,inline"`
	OfMcpTool        *ToolChoiceMcpParam          `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ResponseNewParamsToolChoiceUnion) GetName

Returns a pointer to the underlying variant's property, if present.

func (ResponseNewParamsToolChoiceUnion) GetServerLabel added in v1.8.0

func (u ResponseNewParamsToolChoiceUnion) GetServerLabel() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseNewParamsToolChoiceUnion) GetType

Returns a pointer to the underlying variant's property, if present.

func (ResponseNewParamsToolChoiceUnion) MarshalJSON

func (u ResponseNewParamsToolChoiceUnion) MarshalJSON() ([]byte, error)

func (*ResponseNewParamsToolChoiceUnion) UnmarshalJSON

func (u *ResponseNewParamsToolChoiceUnion) UnmarshalJSON(data []byte) error

type ResponseNewParamsTruncation

type ResponseNewParamsTruncation string

The truncation strategy to use for the model response.

  • `auto`: If the context of this response and previous ones exceeds the model's context window size, the model will truncate the response to fit the context window by dropping input items in the middle of the conversation.
  • `disabled` (default): If a model response will exceed the context window size for a model, the request will fail with a 400 error.
const (
	ResponseNewParamsTruncationAuto     ResponseNewParamsTruncation = "auto"
	ResponseNewParamsTruncationDisabled ResponseNewParamsTruncation = "disabled"
)

type ResponseOutputItemAddedEvent

type ResponseOutputItemAddedEvent struct {
	// The output item that was added.
	Item ResponseOutputItemUnion `json:"item,required"`
	// The index of the output item that was added.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.output_item.added`.
	Type constant.ResponseOutputItemAdded `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Item           respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a new output item is added.

func (ResponseOutputItemAddedEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseOutputItemAddedEvent) UnmarshalJSON

func (r *ResponseOutputItemAddedEvent) UnmarshalJSON(data []byte) error

type ResponseOutputItemDoneEvent

type ResponseOutputItemDoneEvent struct {
	// The output item that was marked done.
	Item ResponseOutputItemUnion `json:"item,required"`
	// The index of the output item that was marked done.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.output_item.done`.
	Type constant.ResponseOutputItemDone `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Item           respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when an output item is marked done.

func (ResponseOutputItemDoneEvent) RawJSON

func (r ResponseOutputItemDoneEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseOutputItemDoneEvent) UnmarshalJSON

func (r *ResponseOutputItemDoneEvent) UnmarshalJSON(data []byte) error

type ResponseOutputItemImageGenerationCall added in v1.1.0

type ResponseOutputItemImageGenerationCall struct {
	// The unique ID of the image generation call.
	ID string `json:"id,required"`
	// The generated image encoded in base64.
	Result string `json:"result,required"`
	// The status of the image generation call.
	//
	// Any of "in_progress", "completed", "generating", "failed".
	Status string `json:"status,required"`
	// The type of the image generation call. Always `image_generation_call`.
	Type constant.ImageGenerationCall `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Result      respjson.Field
		Status      respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An image generation request made by the model.

func (ResponseOutputItemImageGenerationCall) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseOutputItemImageGenerationCall) UnmarshalJSON added in v1.1.0

func (r *ResponseOutputItemImageGenerationCall) UnmarshalJSON(data []byte) error

type ResponseOutputItemLocalShellCall added in v1.1.0

type ResponseOutputItemLocalShellCall struct {
	// The unique ID of the local shell call.
	ID string `json:"id,required"`
	// Execute a shell command on the server.
	Action ResponseOutputItemLocalShellCallAction `json:"action,required"`
	// The unique ID of the local shell tool call generated by the model.
	CallID string `json:"call_id,required"`
	// The status of the local shell call.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status string `json:"status,required"`
	// The type of the local shell call. Always `local_shell_call`.
	Type constant.LocalShellCall `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Action      respjson.Field
		CallID      respjson.Field
		Status      respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A tool call to run a command on the local shell.

func (ResponseOutputItemLocalShellCall) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseOutputItemLocalShellCall) UnmarshalJSON added in v1.1.0

func (r *ResponseOutputItemLocalShellCall) UnmarshalJSON(data []byte) error

type ResponseOutputItemLocalShellCallAction added in v1.1.0

type ResponseOutputItemLocalShellCallAction struct {
	// The command to run.
	Command []string `json:"command,required"`
	// Environment variables to set for the command.
	Env map[string]string `json:"env,required"`
	// The type of the local shell action. Always `exec`.
	Type constant.Exec `json:"type,required"`
	// Optional timeout in milliseconds for the command.
	TimeoutMs int64 `json:"timeout_ms,nullable"`
	// Optional user to run the command as.
	User string `json:"user,nullable"`
	// Optional working directory to run the command in.
	WorkingDirectory string `json:"working_directory,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Command          respjson.Field
		Env              respjson.Field
		Type             respjson.Field
		TimeoutMs        respjson.Field
		User             respjson.Field
		WorkingDirectory respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Execute a shell command on the server.

func (ResponseOutputItemLocalShellCallAction) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseOutputItemLocalShellCallAction) UnmarshalJSON added in v1.1.0

func (r *ResponseOutputItemLocalShellCallAction) UnmarshalJSON(data []byte) error

type ResponseOutputItemMcpApprovalRequest added in v1.1.0

type ResponseOutputItemMcpApprovalRequest struct {
	// The unique ID of the approval request.
	ID string `json:"id,required"`
	// A JSON string of arguments for the tool.
	Arguments string `json:"arguments,required"`
	// The name of the tool to run.
	Name string `json:"name,required"`
	// The label of the MCP server making the request.
	ServerLabel string `json:"server_label,required"`
	// The type of the item. Always `mcp_approval_request`.
	Type constant.McpApprovalRequest `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Arguments   respjson.Field
		Name        respjson.Field
		ServerLabel respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A request for human approval of a tool invocation.

func (ResponseOutputItemMcpApprovalRequest) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseOutputItemMcpApprovalRequest) UnmarshalJSON added in v1.1.0

func (r *ResponseOutputItemMcpApprovalRequest) UnmarshalJSON(data []byte) error

type ResponseOutputItemMcpCall added in v1.1.0

type ResponseOutputItemMcpCall struct {
	// The unique ID of the tool call.
	ID string `json:"id,required"`
	// A JSON string of the arguments passed to the tool.
	Arguments string `json:"arguments,required"`
	// The name of the tool that was run.
	Name string `json:"name,required"`
	// The label of the MCP server running the tool.
	ServerLabel string `json:"server_label,required"`
	// The type of the item. Always `mcp_call`.
	Type constant.McpCall `json:"type,required"`
	// The error from the tool call, if any.
	Error string `json:"error,nullable"`
	// The output from the tool call.
	Output string `json:"output,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Arguments   respjson.Field
		Name        respjson.Field
		ServerLabel respjson.Field
		Type        respjson.Field
		Error       respjson.Field
		Output      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An invocation of a tool on an MCP server.

func (ResponseOutputItemMcpCall) RawJSON added in v1.1.0

func (r ResponseOutputItemMcpCall) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseOutputItemMcpCall) UnmarshalJSON added in v1.1.0

func (r *ResponseOutputItemMcpCall) UnmarshalJSON(data []byte) error

type ResponseOutputItemMcpListTools added in v1.1.0

type ResponseOutputItemMcpListTools struct {
	// The unique ID of the list.
	ID string `json:"id,required"`
	// The label of the MCP server.
	ServerLabel string `json:"server_label,required"`
	// The tools available on the server.
	Tools []ResponseOutputItemMcpListToolsTool `json:"tools,required"`
	// The type of the item. Always `mcp_list_tools`.
	Type constant.McpListTools `json:"type,required"`
	// Error message if the server could not list tools.
	Error string `json:"error,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ServerLabel respjson.Field
		Tools       respjson.Field
		Type        respjson.Field
		Error       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A list of tools available on an MCP server.

func (ResponseOutputItemMcpListTools) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseOutputItemMcpListTools) UnmarshalJSON added in v1.1.0

func (r *ResponseOutputItemMcpListTools) UnmarshalJSON(data []byte) error

type ResponseOutputItemMcpListToolsTool added in v1.1.0

type ResponseOutputItemMcpListToolsTool struct {
	// The JSON schema describing the tool's input.
	InputSchema any `json:"input_schema,required"`
	// The name of the tool.
	Name string `json:"name,required"`
	// Additional annotations about the tool.
	Annotations any `json:"annotations,nullable"`
	// The description of the tool.
	Description string `json:"description,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		InputSchema respjson.Field
		Name        respjson.Field
		Annotations respjson.Field
		Description respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A tool available on an MCP server.

func (ResponseOutputItemMcpListToolsTool) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseOutputItemMcpListToolsTool) UnmarshalJSON added in v1.1.0

func (r *ResponseOutputItemMcpListToolsTool) UnmarshalJSON(data []byte) error

type ResponseOutputItemUnion

type ResponseOutputItemUnion struct {
	ID string `json:"id"`
	// This field is from variant [ResponseOutputMessage].
	Content []ResponseOutputMessageContentUnion `json:"content"`
	// This field is from variant [ResponseOutputMessage].
	Role   constant.Assistant `json:"role"`
	Status string             `json:"status"`
	// Any of "message", "file_search_call", "function_call", "web_search_call",
	// "computer_call", "reasoning", "image_generation_call", "code_interpreter_call",
	// "local_shell_call", "mcp_call", "mcp_list_tools", "mcp_approval_request".
	Type string `json:"type"`
	// This field is from variant [ResponseFileSearchToolCall].
	Queries []string `json:"queries"`
	// This field is from variant [ResponseFileSearchToolCall].
	Results   []ResponseFileSearchToolCallResult `json:"results"`
	Arguments string                             `json:"arguments"`
	CallID    string                             `json:"call_id"`
	Name      string                             `json:"name"`
	// This field is a union of [ResponseFunctionWebSearchActionUnion],
	// [ResponseComputerToolCallActionUnion], [ResponseOutputItemLocalShellCallAction]
	Action ResponseOutputItemUnionAction `json:"action"`
	// This field is from variant [ResponseComputerToolCall].
	PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck `json:"pending_safety_checks"`
	// This field is from variant [ResponseReasoningItem].
	Summary []ResponseReasoningItemSummary `json:"summary"`
	// This field is from variant [ResponseReasoningItem].
	EncryptedContent string `json:"encrypted_content"`
	// This field is from variant [ResponseOutputItemImageGenerationCall].
	Result string `json:"result"`
	// This field is from variant [ResponseCodeInterpreterToolCall].
	Code string `json:"code"`
	// This field is from variant [ResponseCodeInterpreterToolCall].
	ContainerID string `json:"container_id"`
	// This field is from variant [ResponseCodeInterpreterToolCall].
	Outputs     []ResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
	ServerLabel string                                       `json:"server_label"`
	Error       string                                       `json:"error"`
	// This field is from variant [ResponseOutputItemMcpCall].
	Output string `json:"output"`
	// This field is from variant [ResponseOutputItemMcpListTools].
	Tools []ResponseOutputItemMcpListToolsTool `json:"tools"`
	JSON  struct {
		ID                  respjson.Field
		Content             respjson.Field
		Role                respjson.Field
		Status              respjson.Field
		Type                respjson.Field
		Queries             respjson.Field
		Results             respjson.Field
		Arguments           respjson.Field
		CallID              respjson.Field
		Name                respjson.Field
		Action              respjson.Field
		PendingSafetyChecks respjson.Field
		Summary             respjson.Field
		EncryptedContent    respjson.Field
		Result              respjson.Field
		Code                respjson.Field
		ContainerID         respjson.Field
		Outputs             respjson.Field
		ServerLabel         respjson.Field
		Error               respjson.Field
		Output              respjson.Field
		Tools               respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseOutputItemUnion contains all possible properties and values from ResponseOutputMessage, ResponseFileSearchToolCall, ResponseFunctionToolCall, ResponseFunctionWebSearch, ResponseComputerToolCall, ResponseReasoningItem, ResponseOutputItemImageGenerationCall, ResponseCodeInterpreterToolCall, ResponseOutputItemLocalShellCall, ResponseOutputItemMcpCall, ResponseOutputItemMcpListTools, ResponseOutputItemMcpApprovalRequest.

Use the ResponseOutputItemUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ResponseOutputItemUnion) AsAny

func (u ResponseOutputItemUnion) AsAny() anyResponseOutputItem

Use the following switch statement to find the correct variant

switch variant := ResponseOutputItemUnion.AsAny().(type) {
case responses.ResponseOutputMessage:
case responses.ResponseFileSearchToolCall:
case responses.ResponseFunctionToolCall:
case responses.ResponseFunctionWebSearch:
case responses.ResponseComputerToolCall:
case responses.ResponseReasoningItem:
case responses.ResponseOutputItemImageGenerationCall:
case responses.ResponseCodeInterpreterToolCall:
case responses.ResponseOutputItemLocalShellCall:
case responses.ResponseOutputItemMcpCall:
case responses.ResponseOutputItemMcpListTools:
case responses.ResponseOutputItemMcpApprovalRequest:
default:
  fmt.Errorf("no variant present")
}

func (ResponseOutputItemUnion) AsCodeInterpreterCall added in v1.1.0

func (u ResponseOutputItemUnion) AsCodeInterpreterCall() (v ResponseCodeInterpreterToolCall)

func (ResponseOutputItemUnion) AsComputerCall

func (u ResponseOutputItemUnion) AsComputerCall() (v ResponseComputerToolCall)

func (ResponseOutputItemUnion) AsFileSearchCall

func (u ResponseOutputItemUnion) AsFileSearchCall() (v ResponseFileSearchToolCall)

func (ResponseOutputItemUnion) AsFunctionCall

func (u ResponseOutputItemUnion) AsFunctionCall() (v ResponseFunctionToolCall)

func (ResponseOutputItemUnion) AsImageGenerationCall added in v1.1.0

func (u ResponseOutputItemUnion) AsImageGenerationCall() (v ResponseOutputItemImageGenerationCall)

func (ResponseOutputItemUnion) AsLocalShellCall added in v1.1.0

func (ResponseOutputItemUnion) AsMcpApprovalRequest added in v1.1.0

func (ResponseOutputItemUnion) AsMcpCall added in v1.1.0

func (ResponseOutputItemUnion) AsMcpListTools added in v1.1.0

func (ResponseOutputItemUnion) AsMessage

func (ResponseOutputItemUnion) AsReasoning

func (u ResponseOutputItemUnion) AsReasoning() (v ResponseReasoningItem)

func (ResponseOutputItemUnion) AsWebSearchCall

func (u ResponseOutputItemUnion) AsWebSearchCall() (v ResponseFunctionWebSearch)

func (ResponseOutputItemUnion) RawJSON

func (u ResponseOutputItemUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseOutputItemUnion) UnmarshalJSON

func (r *ResponseOutputItemUnion) UnmarshalJSON(data []byte) error

type ResponseOutputItemUnionAction added in v1.1.0

type ResponseOutputItemUnionAction struct {
	// This field is from variant [ResponseFunctionWebSearchActionUnion].
	Query string `json:"query"`
	Type  string `json:"type"`
	URL   string `json:"url"`
	// This field is from variant [ResponseFunctionWebSearchActionUnion].
	Pattern string `json:"pattern"`
	// This field is from variant [ResponseComputerToolCallActionUnion].
	Button string `json:"button"`
	X      int64  `json:"x"`
	Y      int64  `json:"y"`
	// This field is from variant [ResponseComputerToolCallActionUnion].
	Path []ResponseComputerToolCallActionDragPath `json:"path"`
	// This field is from variant [ResponseComputerToolCallActionUnion].
	Keys []string `json:"keys"`
	// This field is from variant [ResponseComputerToolCallActionUnion].
	ScrollX int64 `json:"scroll_x"`
	// This field is from variant [ResponseComputerToolCallActionUnion].
	ScrollY int64 `json:"scroll_y"`
	// This field is from variant [ResponseComputerToolCallActionUnion].
	Text string `json:"text"`
	// This field is from variant [ResponseOutputItemLocalShellCallAction].
	Command []string `json:"command"`
	// This field is from variant [ResponseOutputItemLocalShellCallAction].
	Env map[string]string `json:"env"`
	// This field is from variant [ResponseOutputItemLocalShellCallAction].
	TimeoutMs int64 `json:"timeout_ms"`
	// This field is from variant [ResponseOutputItemLocalShellCallAction].
	User string `json:"user"`
	// This field is from variant [ResponseOutputItemLocalShellCallAction].
	WorkingDirectory string `json:"working_directory"`
	JSON             struct {
		Query            respjson.Field
		Type             respjson.Field
		URL              respjson.Field
		Pattern          respjson.Field
		Button           respjson.Field
		X                respjson.Field
		Y                respjson.Field
		Path             respjson.Field
		Keys             respjson.Field
		ScrollX          respjson.Field
		ScrollY          respjson.Field
		Text             respjson.Field
		Command          respjson.Field
		Env              respjson.Field
		TimeoutMs        respjson.Field
		User             respjson.Field
		WorkingDirectory respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseOutputItemUnionAction is an implicit subunion of ResponseOutputItemUnion. ResponseOutputItemUnionAction provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the ResponseOutputItemUnion.

func (*ResponseOutputItemUnionAction) UnmarshalJSON added in v1.1.0

func (r *ResponseOutputItemUnionAction) UnmarshalJSON(data []byte) error

type ResponseOutputMessage

type ResponseOutputMessage struct {
	// The unique ID of the output message.
	ID string `json:"id,required"`
	// The content of the output message.
	Content []ResponseOutputMessageContentUnion `json:"content,required"`
	// The role of the output message. Always `assistant`.
	Role constant.Assistant `json:"role,required"`
	// The status of the message input. One of `in_progress`, `completed`, or
	// `incomplete`. Populated when input items are returned via API.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status ResponseOutputMessageStatus `json:"status,required"`
	// The type of the output message. Always `message`.
	Type constant.Message `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Content     respjson.Field
		Role        respjson.Field
		Status      respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An output message from the model.

func (ResponseOutputMessage) RawJSON

func (r ResponseOutputMessage) RawJSON() string

Returns the unmodified JSON received from the API

func (ResponseOutputMessage) ToParam

ToParam converts this ResponseOutputMessage to a ResponseOutputMessageParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseOutputMessageParam.Overrides()

func (*ResponseOutputMessage) UnmarshalJSON

func (r *ResponseOutputMessage) UnmarshalJSON(data []byte) error

type ResponseOutputMessageContentUnion

type ResponseOutputMessageContentUnion struct {
	// This field is from variant [ResponseOutputText].
	Annotations []ResponseOutputTextAnnotationUnion `json:"annotations"`
	// This field is from variant [ResponseOutputText].
	Text string `json:"text"`
	// Any of "output_text", "refusal".
	Type string `json:"type"`
	// This field is from variant [ResponseOutputText].
	Logprobs []ResponseOutputTextLogprob `json:"logprobs"`
	// This field is from variant [ResponseOutputRefusal].
	Refusal string `json:"refusal"`
	JSON    struct {
		Annotations respjson.Field
		Text        respjson.Field
		Type        respjson.Field
		Logprobs    respjson.Field
		Refusal     respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseOutputMessageContentUnion contains all possible properties and values from ResponseOutputText, ResponseOutputRefusal.

Use the ResponseOutputMessageContentUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ResponseOutputMessageContentUnion) AsAny

func (u ResponseOutputMessageContentUnion) AsAny() anyResponseOutputMessageContent

Use the following switch statement to find the correct variant

switch variant := ResponseOutputMessageContentUnion.AsAny().(type) {
case responses.ResponseOutputText:
case responses.ResponseOutputRefusal:
default:
  fmt.Errorf("no variant present")
}

func (ResponseOutputMessageContentUnion) AsOutputText

func (ResponseOutputMessageContentUnion) AsRefusal

func (ResponseOutputMessageContentUnion) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseOutputMessageContentUnion) UnmarshalJSON

func (r *ResponseOutputMessageContentUnion) UnmarshalJSON(data []byte) error

type ResponseOutputMessageContentUnionParam

type ResponseOutputMessageContentUnionParam struct {
	OfOutputText *ResponseOutputTextParam    `json:",omitzero,inline"`
	OfRefusal    *ResponseOutputRefusalParam `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ResponseOutputMessageContentUnionParam) GetAnnotations

Returns a pointer to the underlying variant's property, if present.

func (ResponseOutputMessageContentUnionParam) GetLogprobs added in v1.2.0

Returns a pointer to the underlying variant's property, if present.

func (ResponseOutputMessageContentUnionParam) GetRefusal

Returns a pointer to the underlying variant's property, if present.

func (ResponseOutputMessageContentUnionParam) GetText

Returns a pointer to the underlying variant's property, if present.

func (ResponseOutputMessageContentUnionParam) GetType

Returns a pointer to the underlying variant's property, if present.

func (ResponseOutputMessageContentUnionParam) MarshalJSON

func (u ResponseOutputMessageContentUnionParam) MarshalJSON() ([]byte, error)

func (*ResponseOutputMessageContentUnionParam) UnmarshalJSON

func (u *ResponseOutputMessageContentUnionParam) UnmarshalJSON(data []byte) error

type ResponseOutputMessageParam

type ResponseOutputMessageParam struct {
	// The unique ID of the output message.
	ID string `json:"id,omitzero,required"`
	// The content of the output message.
	Content []ResponseOutputMessageContentUnionParam `json:"content,omitzero,required"`
	// The status of the message input. One of `in_progress`, `completed`, or
	// `incomplete`. Populated when input items are returned via API.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status ResponseOutputMessageStatus `json:"status,omitzero,required"`
	// The role of the output message. Always `assistant`.
	//
	// This field can be elided, and will marshal its zero value as "assistant".
	Role constant.Assistant `json:"role,required"`
	// The type of the output message. Always `message`.
	//
	// This field can be elided, and will marshal its zero value as "message".
	Type constant.Message `json:"type,required"`
	// contains filtered or unexported fields
}

An output message from the model.

The properties ID, Content, Role, Status, Type are required.

func (ResponseOutputMessageParam) MarshalJSON

func (r ResponseOutputMessageParam) MarshalJSON() (data []byte, err error)

func (*ResponseOutputMessageParam) UnmarshalJSON

func (r *ResponseOutputMessageParam) UnmarshalJSON(data []byte) error

type ResponseOutputMessageStatus

type ResponseOutputMessageStatus string

The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API.

const (
	ResponseOutputMessageStatusInProgress ResponseOutputMessageStatus = "in_progress"
	ResponseOutputMessageStatusCompleted  ResponseOutputMessageStatus = "completed"
	ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete"
)

type ResponseOutputRefusal

type ResponseOutputRefusal struct {
	// The refusal explanation from the model.
	Refusal string `json:"refusal,required"`
	// The type of the refusal. Always `refusal`.
	Type constant.Refusal `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Refusal     respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A refusal from the model.

func (ResponseOutputRefusal) RawJSON

func (r ResponseOutputRefusal) RawJSON() string

Returns the unmodified JSON received from the API

func (ResponseOutputRefusal) ToParam

ToParam converts this ResponseOutputRefusal to a ResponseOutputRefusalParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseOutputRefusalParam.Overrides()

func (*ResponseOutputRefusal) UnmarshalJSON

func (r *ResponseOutputRefusal) UnmarshalJSON(data []byte) error

type ResponseOutputRefusalParam

type ResponseOutputRefusalParam struct {
	// The refusal explanation from the model.
	Refusal string `json:"refusal,required"`
	// The type of the refusal. Always `refusal`.
	//
	// This field can be elided, and will marshal its zero value as "refusal".
	Type constant.Refusal `json:"type,required"`
	// contains filtered or unexported fields
}

A refusal from the model.

The properties Refusal, Type are required.

func (ResponseOutputRefusalParam) MarshalJSON

func (r ResponseOutputRefusalParam) MarshalJSON() (data []byte, err error)

func (*ResponseOutputRefusalParam) UnmarshalJSON

func (r *ResponseOutputRefusalParam) UnmarshalJSON(data []byte) error

type ResponseOutputText

type ResponseOutputText struct {
	// The annotations of the text output.
	Annotations []ResponseOutputTextAnnotationUnion `json:"annotations,required"`
	// The text output from the model.
	Text string `json:"text,required"`
	// The type of the output text. Always `output_text`.
	Type     constant.OutputText         `json:"type,required"`
	Logprobs []ResponseOutputTextLogprob `json:"logprobs"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Annotations respjson.Field
		Text        respjson.Field
		Type        respjson.Field
		Logprobs    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A text output from the model.

func (ResponseOutputText) RawJSON

func (r ResponseOutputText) RawJSON() string

Returns the unmodified JSON received from the API

func (ResponseOutputText) ToParam

ToParam converts this ResponseOutputText to a ResponseOutputTextParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseOutputTextParam.Overrides()

func (*ResponseOutputText) UnmarshalJSON

func (r *ResponseOutputText) UnmarshalJSON(data []byte) error

type ResponseOutputTextAnnotationAddedEvent added in v1.1.0

type ResponseOutputTextAnnotationAddedEvent struct {
	// The annotation object being added. (See annotation schema for details.)
	Annotation any `json:"annotation,required"`
	// The index of the annotation within the content part.
	AnnotationIndex int64 `json:"annotation_index,required"`
	// The index of the content part within the output item.
	ContentIndex int64 `json:"content_index,required"`
	// The unique identifier of the item to which the annotation is being added.
	ItemID string `json:"item_id,required"`
	// The index of the output item in the response's output array.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always 'response.output_text.annotation.added'.
	Type constant.ResponseOutputTextAnnotationAdded `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Annotation      respjson.Field
		AnnotationIndex respjson.Field
		ContentIndex    respjson.Field
		ItemID          respjson.Field
		OutputIndex     respjson.Field
		SequenceNumber  respjson.Field
		Type            respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when an annotation is added to output text content.

func (ResponseOutputTextAnnotationAddedEvent) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseOutputTextAnnotationAddedEvent) UnmarshalJSON added in v1.1.0

func (r *ResponseOutputTextAnnotationAddedEvent) UnmarshalJSON(data []byte) error

type ResponseOutputTextAnnotationContainerFileCitation added in v1.2.1

type ResponseOutputTextAnnotationContainerFileCitation struct {
	// The ID of the container file.
	ContainerID string `json:"container_id,required"`
	// The index of the last character of the container file citation in the message.
	EndIndex int64 `json:"end_index,required"`
	// The ID of the file.
	FileID string `json:"file_id,required"`
	// The filename of the container file cited.
	Filename string `json:"filename,required"`
	// The index of the first character of the container file citation in the message.
	StartIndex int64 `json:"start_index,required"`
	// The type of the container file citation. Always `container_file_citation`.
	Type constant.ContainerFileCitation `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ContainerID respjson.Field
		EndIndex    respjson.Field
		FileID      respjson.Field
		Filename    respjson.Field
		StartIndex  respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A citation for a container file used to generate a model response.

func (ResponseOutputTextAnnotationContainerFileCitation) RawJSON added in v1.2.1

Returns the unmodified JSON received from the API

func (*ResponseOutputTextAnnotationContainerFileCitation) UnmarshalJSON added in v1.2.1

type ResponseOutputTextAnnotationContainerFileCitationParam added in v1.2.1

type ResponseOutputTextAnnotationContainerFileCitationParam struct {
	// The ID of the container file.
	ContainerID string `json:"container_id,required"`
	// The index of the last character of the container file citation in the message.
	EndIndex int64 `json:"end_index,required"`
	// The ID of the file.
	FileID string `json:"file_id,required"`
	// The filename of the container file cited.
	Filename string `json:"filename,required"`
	// The index of the first character of the container file citation in the message.
	StartIndex int64 `json:"start_index,required"`
	// The type of the container file citation. Always `container_file_citation`.
	//
	// This field can be elided, and will marshal its zero value as
	// "container_file_citation".
	Type constant.ContainerFileCitation `json:"type,required"`
	// contains filtered or unexported fields
}

A citation for a container file used to generate a model response.

The properties ContainerID, EndIndex, FileID, Filename, StartIndex, Type are required.

func (ResponseOutputTextAnnotationContainerFileCitationParam) MarshalJSON added in v1.2.1

func (*ResponseOutputTextAnnotationContainerFileCitationParam) UnmarshalJSON added in v1.2.1

type ResponseOutputTextAnnotationFileCitation

type ResponseOutputTextAnnotationFileCitation struct {
	// The ID of the file.
	FileID string `json:"file_id,required"`
	// The filename of the file cited.
	Filename string `json:"filename,required"`
	// The index of the file in the list of files.
	Index int64 `json:"index,required"`
	// The type of the file citation. Always `file_citation`.
	Type constant.FileCitation `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FileID      respjson.Field
		Filename    respjson.Field
		Index       respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A citation to a file.

func (ResponseOutputTextAnnotationFileCitation) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseOutputTextAnnotationFileCitation) UnmarshalJSON

func (r *ResponseOutputTextAnnotationFileCitation) UnmarshalJSON(data []byte) error

type ResponseOutputTextAnnotationFileCitationParam

type ResponseOutputTextAnnotationFileCitationParam struct {
	// The ID of the file.
	FileID string `json:"file_id,required"`
	// The filename of the file cited.
	Filename string `json:"filename,required"`
	// The index of the file in the list of files.
	Index int64 `json:"index,required"`
	// The type of the file citation. Always `file_citation`.
	//
	// This field can be elided, and will marshal its zero value as "file_citation".
	Type constant.FileCitation `json:"type,required"`
	// contains filtered or unexported fields
}

A citation to a file.

The properties FileID, Filename, Index, Type are required.

func (ResponseOutputTextAnnotationFileCitationParam) MarshalJSON

func (r ResponseOutputTextAnnotationFileCitationParam) MarshalJSON() (data []byte, err error)

func (*ResponseOutputTextAnnotationFileCitationParam) UnmarshalJSON

func (r *ResponseOutputTextAnnotationFileCitationParam) UnmarshalJSON(data []byte) error

type ResponseOutputTextAnnotationFilePath

type ResponseOutputTextAnnotationFilePath struct {
	// The ID of the file.
	FileID string `json:"file_id,required"`
	// The index of the file in the list of files.
	Index int64 `json:"index,required"`
	// The type of the file path. Always `file_path`.
	Type constant.FilePath `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FileID      respjson.Field
		Index       respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A path to a file.

func (ResponseOutputTextAnnotationFilePath) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseOutputTextAnnotationFilePath) UnmarshalJSON

func (r *ResponseOutputTextAnnotationFilePath) UnmarshalJSON(data []byte) error

type ResponseOutputTextAnnotationFilePathParam

type ResponseOutputTextAnnotationFilePathParam struct {
	// The ID of the file.
	FileID string `json:"file_id,required"`
	// The index of the file in the list of files.
	Index int64 `json:"index,required"`
	// The type of the file path. Always `file_path`.
	//
	// This field can be elided, and will marshal its zero value as "file_path".
	Type constant.FilePath `json:"type,required"`
	// contains filtered or unexported fields
}

A path to a file.

The properties FileID, Index, Type are required.

func (ResponseOutputTextAnnotationFilePathParam) MarshalJSON

func (r ResponseOutputTextAnnotationFilePathParam) MarshalJSON() (data []byte, err error)

func (*ResponseOutputTextAnnotationFilePathParam) UnmarshalJSON

func (r *ResponseOutputTextAnnotationFilePathParam) UnmarshalJSON(data []byte) error

type ResponseOutputTextAnnotationURLCitation

type ResponseOutputTextAnnotationURLCitation struct {
	// The index of the last character of the URL citation in the message.
	EndIndex int64 `json:"end_index,required"`
	// The index of the first character of the URL citation in the message.
	StartIndex int64 `json:"start_index,required"`
	// The title of the web resource.
	Title string `json:"title,required"`
	// The type of the URL citation. Always `url_citation`.
	Type constant.URLCitation `json:"type,required"`
	// The URL of the web resource.
	URL string `json:"url,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EndIndex    respjson.Field
		StartIndex  respjson.Field
		Title       respjson.Field
		Type        respjson.Field
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A citation for a web resource used to generate a model response.

func (ResponseOutputTextAnnotationURLCitation) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseOutputTextAnnotationURLCitation) UnmarshalJSON

func (r *ResponseOutputTextAnnotationURLCitation) UnmarshalJSON(data []byte) error

type ResponseOutputTextAnnotationURLCitationParam

type ResponseOutputTextAnnotationURLCitationParam struct {
	// The index of the last character of the URL citation in the message.
	EndIndex int64 `json:"end_index,required"`
	// The index of the first character of the URL citation in the message.
	StartIndex int64 `json:"start_index,required"`
	// The title of the web resource.
	Title string `json:"title,required"`
	// The URL of the web resource.
	URL string `json:"url,required"`
	// The type of the URL citation. Always `url_citation`.
	//
	// This field can be elided, and will marshal its zero value as "url_citation".
	Type constant.URLCitation `json:"type,required"`
	// contains filtered or unexported fields
}

A citation for a web resource used to generate a model response.

The properties EndIndex, StartIndex, Title, Type, URL are required.

func (ResponseOutputTextAnnotationURLCitationParam) MarshalJSON

func (r ResponseOutputTextAnnotationURLCitationParam) MarshalJSON() (data []byte, err error)

func (*ResponseOutputTextAnnotationURLCitationParam) UnmarshalJSON

func (r *ResponseOutputTextAnnotationURLCitationParam) UnmarshalJSON(data []byte) error

type ResponseOutputTextAnnotationUnion

type ResponseOutputTextAnnotationUnion struct {
	FileID   string `json:"file_id"`
	Filename string `json:"filename"`
	Index    int64  `json:"index"`
	// Any of "file_citation", "url_citation", "container_file_citation", "file_path".
	Type       string `json:"type"`
	EndIndex   int64  `json:"end_index"`
	StartIndex int64  `json:"start_index"`
	// This field is from variant [ResponseOutputTextAnnotationURLCitation].
	Title string `json:"title"`
	// This field is from variant [ResponseOutputTextAnnotationURLCitation].
	URL string `json:"url"`
	// This field is from variant [ResponseOutputTextAnnotationContainerFileCitation].
	ContainerID string `json:"container_id"`
	JSON        struct {
		FileID      respjson.Field
		Filename    respjson.Field
		Index       respjson.Field
		Type        respjson.Field
		EndIndex    respjson.Field
		StartIndex  respjson.Field
		Title       respjson.Field
		URL         respjson.Field
		ContainerID respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseOutputTextAnnotationUnion contains all possible properties and values from ResponseOutputTextAnnotationFileCitation, ResponseOutputTextAnnotationURLCitation, ResponseOutputTextAnnotationContainerFileCitation, ResponseOutputTextAnnotationFilePath.

Use the ResponseOutputTextAnnotationUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ResponseOutputTextAnnotationUnion) AsAny

func (u ResponseOutputTextAnnotationUnion) AsAny() anyResponseOutputTextAnnotation

Use the following switch statement to find the correct variant

switch variant := ResponseOutputTextAnnotationUnion.AsAny().(type) {
case responses.ResponseOutputTextAnnotationFileCitation:
case responses.ResponseOutputTextAnnotationURLCitation:
case responses.ResponseOutputTextAnnotationContainerFileCitation:
case responses.ResponseOutputTextAnnotationFilePath:
default:
  fmt.Errorf("no variant present")
}

func (ResponseOutputTextAnnotationUnion) AsContainerFileCitation added in v1.2.1

func (ResponseOutputTextAnnotationUnion) AsFileCitation

func (ResponseOutputTextAnnotationUnion) AsFilePath

func (ResponseOutputTextAnnotationUnion) AsURLCitation

func (ResponseOutputTextAnnotationUnion) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseOutputTextAnnotationUnion) UnmarshalJSON

func (r *ResponseOutputTextAnnotationUnion) UnmarshalJSON(data []byte) error

type ResponseOutputTextAnnotationUnionParam

type ResponseOutputTextAnnotationUnionParam struct {
	OfFileCitation          *ResponseOutputTextAnnotationFileCitationParam          `json:",omitzero,inline"`
	OfURLCitation           *ResponseOutputTextAnnotationURLCitationParam           `json:",omitzero,inline"`
	OfContainerFileCitation *ResponseOutputTextAnnotationContainerFileCitationParam `json:",omitzero,inline"`
	OfFilePath              *ResponseOutputTextAnnotationFilePathParam              `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ResponseOutputTextAnnotationUnionParam) GetContainerID added in v1.2.1

func (u ResponseOutputTextAnnotationUnionParam) GetContainerID() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponseOutputTextAnnotationUnionParam) GetEndIndex

Returns a pointer to the underlying variant's property, if present.

func (ResponseOutputTextAnnotationUnionParam) GetFileID

Returns a pointer to the underlying variant's property, if present.

func (ResponseOutputTextAnnotationUnionParam) GetFilename added in v1.7.0

Returns a pointer to the underlying variant's property, if present.

func (ResponseOutputTextAnnotationUnionParam) GetIndex

Returns a pointer to the underlying variant's property, if present.

func (ResponseOutputTextAnnotationUnionParam) GetStartIndex

func (u ResponseOutputTextAnnotationUnionParam) GetStartIndex() *int64

Returns a pointer to the underlying variant's property, if present.

func (ResponseOutputTextAnnotationUnionParam) GetTitle

Returns a pointer to the underlying variant's property, if present.

func (ResponseOutputTextAnnotationUnionParam) GetType

Returns a pointer to the underlying variant's property, if present.

func (ResponseOutputTextAnnotationUnionParam) GetURL

Returns a pointer to the underlying variant's property, if present.

func (ResponseOutputTextAnnotationUnionParam) MarshalJSON

func (u ResponseOutputTextAnnotationUnionParam) MarshalJSON() ([]byte, error)

func (*ResponseOutputTextAnnotationUnionParam) UnmarshalJSON

func (u *ResponseOutputTextAnnotationUnionParam) UnmarshalJSON(data []byte) error

type ResponseOutputTextLogprob added in v1.2.0

type ResponseOutputTextLogprob struct {
	Token       string                                `json:"token,required"`
	Bytes       []int64                               `json:"bytes,required"`
	Logprob     float64                               `json:"logprob,required"`
	TopLogprobs []ResponseOutputTextLogprobTopLogprob `json:"top_logprobs,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Token       respjson.Field
		Bytes       respjson.Field
		Logprob     respjson.Field
		TopLogprobs respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The log probability of a token.

func (ResponseOutputTextLogprob) RawJSON added in v1.2.0

func (r ResponseOutputTextLogprob) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseOutputTextLogprob) UnmarshalJSON added in v1.2.0

func (r *ResponseOutputTextLogprob) UnmarshalJSON(data []byte) error

type ResponseOutputTextLogprobParam added in v1.2.0

type ResponseOutputTextLogprobParam struct {
	Token       string                                     `json:"token,required"`
	Bytes       []int64                                    `json:"bytes,omitzero,required"`
	Logprob     float64                                    `json:"logprob,required"`
	TopLogprobs []ResponseOutputTextLogprobTopLogprobParam `json:"top_logprobs,omitzero,required"`
	// contains filtered or unexported fields
}

The log probability of a token.

The properties Token, Bytes, Logprob, TopLogprobs are required.

func (ResponseOutputTextLogprobParam) MarshalJSON added in v1.2.0

func (r ResponseOutputTextLogprobParam) MarshalJSON() (data []byte, err error)

func (*ResponseOutputTextLogprobParam) UnmarshalJSON added in v1.2.0

func (r *ResponseOutputTextLogprobParam) UnmarshalJSON(data []byte) error

type ResponseOutputTextLogprobTopLogprob added in v1.2.0

type ResponseOutputTextLogprobTopLogprob struct {
	Token   string  `json:"token,required"`
	Bytes   []int64 `json:"bytes,required"`
	Logprob float64 `json:"logprob,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Token       respjson.Field
		Bytes       respjson.Field
		Logprob     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The top log probability of a token.

func (ResponseOutputTextLogprobTopLogprob) RawJSON added in v1.2.0

Returns the unmodified JSON received from the API

func (*ResponseOutputTextLogprobTopLogprob) UnmarshalJSON added in v1.2.0

func (r *ResponseOutputTextLogprobTopLogprob) UnmarshalJSON(data []byte) error

type ResponseOutputTextLogprobTopLogprobParam added in v1.2.0

type ResponseOutputTextLogprobTopLogprobParam struct {
	Token   string  `json:"token,required"`
	Bytes   []int64 `json:"bytes,omitzero,required"`
	Logprob float64 `json:"logprob,required"`
	// contains filtered or unexported fields
}

The top log probability of a token.

The properties Token, Bytes, Logprob are required.

func (ResponseOutputTextLogprobTopLogprobParam) MarshalJSON added in v1.2.0

func (r ResponseOutputTextLogprobTopLogprobParam) MarshalJSON() (data []byte, err error)

func (*ResponseOutputTextLogprobTopLogprobParam) UnmarshalJSON added in v1.2.0

func (r *ResponseOutputTextLogprobTopLogprobParam) UnmarshalJSON(data []byte) error

type ResponseOutputTextParam

type ResponseOutputTextParam struct {
	// The annotations of the text output.
	Annotations []ResponseOutputTextAnnotationUnionParam `json:"annotations,omitzero,required"`
	// The text output from the model.
	Text     string                           `json:"text,required"`
	Logprobs []ResponseOutputTextLogprobParam `json:"logprobs,omitzero"`
	// The type of the output text. Always `output_text`.
	//
	// This field can be elided, and will marshal its zero value as "output_text".
	Type constant.OutputText `json:"type,required"`
	// contains filtered or unexported fields
}

A text output from the model.

The properties Annotations, Text, Type are required.

func (ResponseOutputTextParam) MarshalJSON

func (r ResponseOutputTextParam) MarshalJSON() (data []byte, err error)

func (*ResponseOutputTextParam) UnmarshalJSON

func (r *ResponseOutputTextParam) UnmarshalJSON(data []byte) error

type ResponsePrompt added in v1.6.0

type ResponsePrompt struct {
	// The unique identifier of the prompt template to use.
	ID string `json:"id,required"`
	// Optional map of values to substitute in for variables in your prompt. The
	// substitution values can either be strings, or other Response input types like
	// images or files.
	Variables map[string]ResponsePromptVariableUnion `json:"variables,nullable"`
	// Optional version of the prompt template.
	Version string `json:"version,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Variables   respjson.Field
		Version     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Reference to a prompt template and its variables. [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).

func (ResponsePrompt) RawJSON added in v1.6.0

func (r ResponsePrompt) RawJSON() string

Returns the unmodified JSON received from the API

func (ResponsePrompt) ToParam added in v1.6.0

func (r ResponsePrompt) ToParam() ResponsePromptParam

ToParam converts this ResponsePrompt to a ResponsePromptParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponsePromptParam.Overrides()

func (*ResponsePrompt) UnmarshalJSON added in v1.6.0

func (r *ResponsePrompt) UnmarshalJSON(data []byte) error

type ResponsePromptParam added in v1.6.0

type ResponsePromptParam struct {
	// The unique identifier of the prompt template to use.
	ID string `json:"id,required"`
	// Optional version of the prompt template.
	Version param.Opt[string] `json:"version,omitzero"`
	// Optional map of values to substitute in for variables in your prompt. The
	// substitution values can either be strings, or other Response input types like
	// images or files.
	Variables map[string]ResponsePromptVariableUnionParam `json:"variables,omitzero"`
	// contains filtered or unexported fields
}

Reference to a prompt template and its variables. [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).

The property ID is required.

func (ResponsePromptParam) MarshalJSON added in v1.6.0

func (r ResponsePromptParam) MarshalJSON() (data []byte, err error)

func (*ResponsePromptParam) UnmarshalJSON added in v1.6.0

func (r *ResponsePromptParam) UnmarshalJSON(data []byte) error

type ResponsePromptVariableUnion added in v1.6.0

type ResponsePromptVariableUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field is from variant [ResponseInputText].
	Text string `json:"text"`
	Type string `json:"type"`
	// This field is from variant [ResponseInputImage].
	Detail ResponseInputImageDetail `json:"detail"`
	FileID string                   `json:"file_id"`
	// This field is from variant [ResponseInputImage].
	ImageURL string `json:"image_url"`
	// This field is from variant [ResponseInputFile].
	FileData string `json:"file_data"`
	// This field is from variant [ResponseInputFile].
	FileURL string `json:"file_url"`
	// This field is from variant [ResponseInputFile].
	Filename string `json:"filename"`
	JSON     struct {
		OfString respjson.Field
		Text     respjson.Field
		Type     respjson.Field
		Detail   respjson.Field
		FileID   respjson.Field
		ImageURL respjson.Field
		FileData respjson.Field
		FileURL  respjson.Field
		Filename respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponsePromptVariableUnion contains all possible properties and values from [string], ResponseInputText, ResponseInputImage, ResponseInputFile.

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString]

func (ResponsePromptVariableUnion) AsInputFile added in v1.6.0

func (u ResponsePromptVariableUnion) AsInputFile() (v ResponseInputFile)

func (ResponsePromptVariableUnion) AsInputImage added in v1.6.0

func (u ResponsePromptVariableUnion) AsInputImage() (v ResponseInputImage)

func (ResponsePromptVariableUnion) AsInputText added in v1.6.0

func (u ResponsePromptVariableUnion) AsInputText() (v ResponseInputText)

func (ResponsePromptVariableUnion) AsString added in v1.6.0

func (u ResponsePromptVariableUnion) AsString() (v string)

func (ResponsePromptVariableUnion) RawJSON added in v1.6.0

func (u ResponsePromptVariableUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponsePromptVariableUnion) UnmarshalJSON added in v1.6.0

func (r *ResponsePromptVariableUnion) UnmarshalJSON(data []byte) error

type ResponsePromptVariableUnionParam added in v1.6.0

type ResponsePromptVariableUnionParam struct {
	OfString     param.Opt[string]        `json:",omitzero,inline"`
	OfInputText  *ResponseInputTextParam  `json:",omitzero,inline"`
	OfInputImage *ResponseInputImageParam `json:",omitzero,inline"`
	OfInputFile  *ResponseInputFileParam  `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ResponsePromptVariableUnionParam) GetDetail added in v1.6.0

Returns a pointer to the underlying variant's property, if present.

func (ResponsePromptVariableUnionParam) GetFileData added in v1.6.0

func (u ResponsePromptVariableUnionParam) GetFileData() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponsePromptVariableUnionParam) GetFileID added in v1.6.0

Returns a pointer to the underlying variant's property, if present.

func (ResponsePromptVariableUnionParam) GetFileURL added in v1.10.0

func (u ResponsePromptVariableUnionParam) GetFileURL() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponsePromptVariableUnionParam) GetFilename added in v1.6.0

func (u ResponsePromptVariableUnionParam) GetFilename() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponsePromptVariableUnionParam) GetImageURL added in v1.6.0

func (u ResponsePromptVariableUnionParam) GetImageURL() *string

Returns a pointer to the underlying variant's property, if present.

func (ResponsePromptVariableUnionParam) GetText added in v1.6.0

Returns a pointer to the underlying variant's property, if present.

func (ResponsePromptVariableUnionParam) GetType added in v1.6.0

Returns a pointer to the underlying variant's property, if present.

func (ResponsePromptVariableUnionParam) MarshalJSON added in v1.6.0

func (u ResponsePromptVariableUnionParam) MarshalJSON() ([]byte, error)

func (*ResponsePromptVariableUnionParam) UnmarshalJSON added in v1.6.0

func (u *ResponsePromptVariableUnionParam) UnmarshalJSON(data []byte) error

type ResponseQueuedEvent added in v1.1.0

type ResponseQueuedEvent struct {
	// The full response object that is queued.
	Response Response `json:"response,required"`
	// The sequence number for this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always 'response.queued'.
	Type constant.ResponseQueued `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Response       respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a response is queued and waiting to be processed.

func (ResponseQueuedEvent) RawJSON added in v1.1.0

func (r ResponseQueuedEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseQueuedEvent) UnmarshalJSON added in v1.1.0

func (r *ResponseQueuedEvent) UnmarshalJSON(data []byte) error

type ResponseReasoningDeltaEvent added in v1.1.0

type ResponseReasoningDeltaEvent struct {
	// The index of the reasoning content part within the output item.
	ContentIndex int64 `json:"content_index,required"`
	// The partial update to the reasoning content.
	Delta any `json:"delta,required"`
	// The unique identifier of the item for which reasoning is being updated.
	ItemID string `json:"item_id,required"`
	// The index of the output item in the response's output array.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always 'response.reasoning.delta'.
	Type constant.ResponseReasoningDelta `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ContentIndex   respjson.Field
		Delta          respjson.Field
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when there is a delta (partial update) to the reasoning content.

func (ResponseReasoningDeltaEvent) RawJSON added in v1.1.0

func (r ResponseReasoningDeltaEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseReasoningDeltaEvent) UnmarshalJSON added in v1.1.0

func (r *ResponseReasoningDeltaEvent) UnmarshalJSON(data []byte) error

type ResponseReasoningDoneEvent added in v1.1.0

type ResponseReasoningDoneEvent struct {
	// The index of the reasoning content part within the output item.
	ContentIndex int64 `json:"content_index,required"`
	// The unique identifier of the item for which reasoning is finalized.
	ItemID string `json:"item_id,required"`
	// The index of the output item in the response's output array.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The finalized reasoning text.
	Text string `json:"text,required"`
	// The type of the event. Always 'response.reasoning.done'.
	Type constant.ResponseReasoningDone `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ContentIndex   respjson.Field
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Text           respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when the reasoning content is finalized for an item.

func (ResponseReasoningDoneEvent) RawJSON added in v1.1.0

func (r ResponseReasoningDoneEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseReasoningDoneEvent) UnmarshalJSON added in v1.1.0

func (r *ResponseReasoningDoneEvent) UnmarshalJSON(data []byte) error

type ResponseReasoningItem

type ResponseReasoningItem struct {
	// The unique identifier of the reasoning content.
	ID string `json:"id,required"`
	// Reasoning text contents.
	Summary []ResponseReasoningItemSummary `json:"summary,required"`
	// The type of the object. Always `reasoning`.
	Type constant.Reasoning `json:"type,required"`
	// The encrypted content of the reasoning item - populated when a response is
	// generated with `reasoning.encrypted_content` in the `include` parameter.
	EncryptedContent string `json:"encrypted_content,nullable"`
	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
	// Populated when items are returned via API.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status ResponseReasoningItemStatus `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID               respjson.Field
		Summary          respjson.Field
		Type             respjson.Field
		EncryptedContent respjson.Field
		Status           respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A description of the chain of thought used by a reasoning model while generating a response. Be sure to include these items in your `input` to the Responses API for subsequent turns of a conversation if you are manually [managing context](https://platform.openai.com/docs/guides/conversation-state).

func (ResponseReasoningItem) RawJSON

func (r ResponseReasoningItem) RawJSON() string

Returns the unmodified JSON received from the API

func (ResponseReasoningItem) ToParam

ToParam converts this ResponseReasoningItem to a ResponseReasoningItemParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseReasoningItemParam.Overrides()

func (*ResponseReasoningItem) UnmarshalJSON

func (r *ResponseReasoningItem) UnmarshalJSON(data []byte) error

type ResponseReasoningItemParam

type ResponseReasoningItemParam struct {
	// The unique identifier of the reasoning content.
	ID string `json:"id,required"`
	// Reasoning text contents.
	Summary []ResponseReasoningItemSummaryParam `json:"summary,omitzero,required"`
	// The encrypted content of the reasoning item - populated when a response is
	// generated with `reasoning.encrypted_content` in the `include` parameter.
	EncryptedContent param.Opt[string] `json:"encrypted_content,omitzero"`
	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
	// Populated when items are returned via API.
	//
	// Any of "in_progress", "completed", "incomplete".
	Status ResponseReasoningItemStatus `json:"status,omitzero"`
	// The type of the object. Always `reasoning`.
	//
	// This field can be elided, and will marshal its zero value as "reasoning".
	Type constant.Reasoning `json:"type,required"`
	// contains filtered or unexported fields
}

A description of the chain of thought used by a reasoning model while generating a response. Be sure to include these items in your `input` to the Responses API for subsequent turns of a conversation if you are manually [managing context](https://platform.openai.com/docs/guides/conversation-state).

The properties ID, Summary, Type are required.

func (ResponseReasoningItemParam) MarshalJSON

func (r ResponseReasoningItemParam) MarshalJSON() (data []byte, err error)

func (*ResponseReasoningItemParam) UnmarshalJSON

func (r *ResponseReasoningItemParam) UnmarshalJSON(data []byte) error

type ResponseReasoningItemStatus

type ResponseReasoningItemStatus string

The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

const (
	ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress"
	ResponseReasoningItemStatusCompleted  ResponseReasoningItemStatus = "completed"
	ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete"
)

type ResponseReasoningItemSummary

type ResponseReasoningItemSummary struct {
	// A short summary of the reasoning used by the model when generating the response.
	Text string `json:"text,required"`
	// The type of the object. Always `summary_text`.
	Type constant.SummaryText `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Text        respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ResponseReasoningItemSummary) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseReasoningItemSummary) UnmarshalJSON

func (r *ResponseReasoningItemSummary) UnmarshalJSON(data []byte) error

type ResponseReasoningItemSummaryParam

type ResponseReasoningItemSummaryParam struct {
	// A short summary of the reasoning used by the model when generating the response.
	Text string `json:"text,required"`
	// The type of the object. Always `summary_text`.
	//
	// This field can be elided, and will marshal its zero value as "summary_text".
	Type constant.SummaryText `json:"type,required"`
	// contains filtered or unexported fields
}

The properties Text, Type are required.

func (ResponseReasoningItemSummaryParam) MarshalJSON

func (r ResponseReasoningItemSummaryParam) MarshalJSON() (data []byte, err error)

func (*ResponseReasoningItemSummaryParam) UnmarshalJSON

func (r *ResponseReasoningItemSummaryParam) UnmarshalJSON(data []byte) error

type ResponseReasoningSummaryDeltaEvent added in v1.1.0

type ResponseReasoningSummaryDeltaEvent struct {
	// The partial update to the reasoning summary content.
	Delta any `json:"delta,required"`
	// The unique identifier of the item for which the reasoning summary is being
	// updated.
	ItemID string `json:"item_id,required"`
	// The index of the output item in the response's output array.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The index of the summary part within the output item.
	SummaryIndex int64 `json:"summary_index,required"`
	// The type of the event. Always 'response.reasoning_summary.delta'.
	Type constant.ResponseReasoningSummaryDelta `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Delta          respjson.Field
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		SummaryIndex   respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when there is a delta (partial update) to the reasoning summary content.

func (ResponseReasoningSummaryDeltaEvent) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseReasoningSummaryDeltaEvent) UnmarshalJSON added in v1.1.0

func (r *ResponseReasoningSummaryDeltaEvent) UnmarshalJSON(data []byte) error

type ResponseReasoningSummaryDoneEvent added in v1.1.0

type ResponseReasoningSummaryDoneEvent struct {
	// The unique identifier of the item for which the reasoning summary is finalized.
	ItemID string `json:"item_id,required"`
	// The index of the output item in the response's output array.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The index of the summary part within the output item.
	SummaryIndex int64 `json:"summary_index,required"`
	// The finalized reasoning summary text.
	Text string `json:"text,required"`
	// The type of the event. Always 'response.reasoning_summary.done'.
	Type constant.ResponseReasoningSummaryDone `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		SummaryIndex   respjson.Field
		Text           respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when the reasoning summary content is finalized for an item.

func (ResponseReasoningSummaryDoneEvent) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ResponseReasoningSummaryDoneEvent) UnmarshalJSON added in v1.1.0

func (r *ResponseReasoningSummaryDoneEvent) UnmarshalJSON(data []byte) error

type ResponseReasoningSummaryPartAddedEvent

type ResponseReasoningSummaryPartAddedEvent struct {
	// The ID of the item this summary part is associated with.
	ItemID string `json:"item_id,required"`
	// The index of the output item this summary part is associated with.
	OutputIndex int64 `json:"output_index,required"`
	// The summary part that was added.
	Part ResponseReasoningSummaryPartAddedEventPart `json:"part,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The index of the summary part within the reasoning summary.
	SummaryIndex int64 `json:"summary_index,required"`
	// The type of the event. Always `response.reasoning_summary_part.added`.
	Type constant.ResponseReasoningSummaryPartAdded `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		Part           respjson.Field
		SequenceNumber respjson.Field
		SummaryIndex   respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a new reasoning summary part is added.

func (ResponseReasoningSummaryPartAddedEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseReasoningSummaryPartAddedEvent) UnmarshalJSON

func (r *ResponseReasoningSummaryPartAddedEvent) UnmarshalJSON(data []byte) error

type ResponseReasoningSummaryPartAddedEventPart

type ResponseReasoningSummaryPartAddedEventPart struct {
	// The text of the summary part.
	Text string `json:"text,required"`
	// The type of the summary part. Always `summary_text`.
	Type constant.SummaryText `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Text        respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The summary part that was added.

func (ResponseReasoningSummaryPartAddedEventPart) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseReasoningSummaryPartAddedEventPart) UnmarshalJSON

func (r *ResponseReasoningSummaryPartAddedEventPart) UnmarshalJSON(data []byte) error

type ResponseReasoningSummaryPartDoneEvent

type ResponseReasoningSummaryPartDoneEvent struct {
	// The ID of the item this summary part is associated with.
	ItemID string `json:"item_id,required"`
	// The index of the output item this summary part is associated with.
	OutputIndex int64 `json:"output_index,required"`
	// The completed summary part.
	Part ResponseReasoningSummaryPartDoneEventPart `json:"part,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The index of the summary part within the reasoning summary.
	SummaryIndex int64 `json:"summary_index,required"`
	// The type of the event. Always `response.reasoning_summary_part.done`.
	Type constant.ResponseReasoningSummaryPartDone `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		Part           respjson.Field
		SequenceNumber respjson.Field
		SummaryIndex   respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a reasoning summary part is completed.

func (ResponseReasoningSummaryPartDoneEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseReasoningSummaryPartDoneEvent) UnmarshalJSON

func (r *ResponseReasoningSummaryPartDoneEvent) UnmarshalJSON(data []byte) error

type ResponseReasoningSummaryPartDoneEventPart

type ResponseReasoningSummaryPartDoneEventPart struct {
	// The text of the summary part.
	Text string `json:"text,required"`
	// The type of the summary part. Always `summary_text`.
	Type constant.SummaryText `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Text        respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The completed summary part.

func (ResponseReasoningSummaryPartDoneEventPart) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseReasoningSummaryPartDoneEventPart) UnmarshalJSON

func (r *ResponseReasoningSummaryPartDoneEventPart) UnmarshalJSON(data []byte) error

type ResponseReasoningSummaryTextDeltaEvent

type ResponseReasoningSummaryTextDeltaEvent struct {
	// The text delta that was added to the summary.
	Delta string `json:"delta,required"`
	// The ID of the item this summary text delta is associated with.
	ItemID string `json:"item_id,required"`
	// The index of the output item this summary text delta is associated with.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The index of the summary part within the reasoning summary.
	SummaryIndex int64 `json:"summary_index,required"`
	// The type of the event. Always `response.reasoning_summary_text.delta`.
	Type constant.ResponseReasoningSummaryTextDelta `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Delta          respjson.Field
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		SummaryIndex   respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a delta is added to a reasoning summary text.

func (ResponseReasoningSummaryTextDeltaEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseReasoningSummaryTextDeltaEvent) UnmarshalJSON

func (r *ResponseReasoningSummaryTextDeltaEvent) UnmarshalJSON(data []byte) error

type ResponseReasoningSummaryTextDoneEvent

type ResponseReasoningSummaryTextDoneEvent struct {
	// The ID of the item this summary text is associated with.
	ItemID string `json:"item_id,required"`
	// The index of the output item this summary text is associated with.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The index of the summary part within the reasoning summary.
	SummaryIndex int64 `json:"summary_index,required"`
	// The full text of the completed reasoning summary.
	Text string `json:"text,required"`
	// The type of the event. Always `response.reasoning_summary_text.done`.
	Type constant.ResponseReasoningSummaryTextDone `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		SummaryIndex   respjson.Field
		Text           respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a reasoning summary text is completed.

func (ResponseReasoningSummaryTextDoneEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseReasoningSummaryTextDoneEvent) UnmarshalJSON

func (r *ResponseReasoningSummaryTextDoneEvent) UnmarshalJSON(data []byte) error

type ResponseRefusalDeltaEvent

type ResponseRefusalDeltaEvent struct {
	// The index of the content part that the refusal text is added to.
	ContentIndex int64 `json:"content_index,required"`
	// The refusal text that is added.
	Delta string `json:"delta,required"`
	// The ID of the output item that the refusal text is added to.
	ItemID string `json:"item_id,required"`
	// The index of the output item that the refusal text is added to.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.refusal.delta`.
	Type constant.ResponseRefusalDelta `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ContentIndex   respjson.Field
		Delta          respjson.Field
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when there is a partial refusal text.

func (ResponseRefusalDeltaEvent) RawJSON

func (r ResponseRefusalDeltaEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseRefusalDeltaEvent) UnmarshalJSON

func (r *ResponseRefusalDeltaEvent) UnmarshalJSON(data []byte) error

type ResponseRefusalDoneEvent

type ResponseRefusalDoneEvent struct {
	// The index of the content part that the refusal text is finalized.
	ContentIndex int64 `json:"content_index,required"`
	// The ID of the output item that the refusal text is finalized.
	ItemID string `json:"item_id,required"`
	// The index of the output item that the refusal text is finalized.
	OutputIndex int64 `json:"output_index,required"`
	// The refusal text that is finalized.
	Refusal string `json:"refusal,required"`
	// The sequence number of this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.refusal.done`.
	Type constant.ResponseRefusalDone `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ContentIndex   respjson.Field
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		Refusal        respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when refusal text is finalized.

func (ResponseRefusalDoneEvent) RawJSON

func (r ResponseRefusalDoneEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseRefusalDoneEvent) UnmarshalJSON

func (r *ResponseRefusalDoneEvent) UnmarshalJSON(data []byte) error

type ResponseService

type ResponseService struct {
	Options    []option.RequestOption
	InputItems InputItemService
}

ResponseService contains methods and other services that help with interacting with the openai API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewResponseService method instead.

func NewResponseService

func NewResponseService(opts ...option.RequestOption) (r ResponseService)

NewResponseService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ResponseService) Cancel added in v1.1.0

func (r *ResponseService) Cancel(ctx context.Context, responseID string, opts ...option.RequestOption) (res *Response, err error)

Cancels a model response with the given ID. Only responses created with the `background` parameter set to `true` can be cancelled. [Learn more](https://platform.openai.com/docs/guides/background).

func (*ResponseService) Delete

func (r *ResponseService) Delete(ctx context.Context, responseID string, opts ...option.RequestOption) (err error)

Deletes a model response with the given ID.

func (*ResponseService) Get

func (r *ResponseService) Get(ctx context.Context, responseID string, query ResponseGetParams, opts ...option.RequestOption) (res *Response, err error)

Retrieves a model response with the given ID.

func (*ResponseService) GetStreaming added in v1.2.0

func (r *ResponseService) GetStreaming(ctx context.Context, responseID string, query ResponseGetParams, opts ...option.RequestOption) (stream *ssestream.Stream[ResponseStreamEventUnion])

Retrieves a model response with the given ID.

func (*ResponseService) New

func (r *ResponseService) New(ctx context.Context, body ResponseNewParams, opts ...option.RequestOption) (res *Response, err error)

Creates a model response. Provide [text](https://platform.openai.com/docs/guides/text) or image(https://platform.openai.com/docs/guides/images) inputs to generate [text](https://platform.openai.com/docs/guides/text) or [JSON](https://platform.openai.com/docs/guides/structured-outputs) outputs. Have the model call your own [custom code](https://platform.openai.com/docs/guides/function-calling) or use built-in [tools](https://platform.openai.com/docs/guides/tools) like [web search](https://platform.openai.com/docs/guides/tools-web-search) or [file search](https://platform.openai.com/docs/guides/tools-file-search) to use your own data as input for the model's response.

func (*ResponseService) NewStreaming

Creates a model response. Provide [text](https://platform.openai.com/docs/guides/text) or image(https://platform.openai.com/docs/guides/images) inputs to generate [text](https://platform.openai.com/docs/guides/text) or [JSON](https://platform.openai.com/docs/guides/structured-outputs) outputs. Have the model call your own [custom code](https://platform.openai.com/docs/guides/function-calling) or use built-in [tools](https://platform.openai.com/docs/guides/tools) like [web search](https://platform.openai.com/docs/guides/tools-web-search) or [file search](https://platform.openai.com/docs/guides/tools-file-search) to use your own data as input for the model's response.

type ResponseServiceTier

type ResponseServiceTier string

Specifies the processing type used for serving the request.

  • If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
  • If set to 'default', then the requset will be processed with the standard pricing and performance for the selected model.
  • If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or 'priority', then the request will be processed with the corresponding service tier. [Contact sales](https://openai.com/contact-sales) to learn more about Priority processing.
  • When not set, the default behavior is 'auto'.

When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.

const (
	ResponseServiceTierAuto     ResponseServiceTier = "auto"
	ResponseServiceTierDefault  ResponseServiceTier = "default"
	ResponseServiceTierFlex     ResponseServiceTier = "flex"
	ResponseServiceTierScale    ResponseServiceTier = "scale"
	ResponseServiceTierPriority ResponseServiceTier = "priority"
)

type ResponseStatus

type ResponseStatus string

The status of the response generation. One of `completed`, `failed`, `in_progress`, `cancelled`, `queued`, or `incomplete`.

const (
	ResponseStatusCompleted  ResponseStatus = "completed"
	ResponseStatusFailed     ResponseStatus = "failed"
	ResponseStatusInProgress ResponseStatus = "in_progress"
	ResponseStatusCancelled  ResponseStatus = "cancelled"
	ResponseStatusQueued     ResponseStatus = "queued"
	ResponseStatusIncomplete ResponseStatus = "incomplete"
)

type ResponseStreamEventUnion

type ResponseStreamEventUnion struct {
	// This field is a union of [string], [string], [string], [string], [string],
	// [string], [string], [any], [any], [any]
	Delta          ResponseStreamEventUnionDelta `json:"delta"`
	SequenceNumber int64                         `json:"sequence_number"`
	// Any of "response.audio.delta", "response.audio.done",
	// "response.audio.transcript.delta", "response.audio.transcript.done",
	// "response.code_interpreter_call_code.delta",
	// "response.code_interpreter_call_code.done",
	// "response.code_interpreter_call.completed",
	// "response.code_interpreter_call.in_progress",
	// "response.code_interpreter_call.interpreting", "response.completed",
	// "response.content_part.added", "response.content_part.done", "response.created",
	// "error", "response.file_search_call.completed",
	// "response.file_search_call.in_progress", "response.file_search_call.searching",
	// "response.function_call_arguments.delta",
	// "response.function_call_arguments.done", "response.in_progress",
	// "response.failed", "response.incomplete", "response.output_item.added",
	// "response.output_item.done", "response.reasoning_summary_part.added",
	// "response.reasoning_summary_part.done", "response.reasoning_summary_text.delta",
	// "response.reasoning_summary_text.done", "response.refusal.delta",
	// "response.refusal.done", "response.output_text.delta",
	// "response.output_text.done", "response.web_search_call.completed",
	// "response.web_search_call.in_progress", "response.web_search_call.searching",
	// "response.image_generation_call.completed",
	// "response.image_generation_call.generating",
	// "response.image_generation_call.in_progress",
	// "response.image_generation_call.partial_image",
	// "response.mcp_call_arguments.delta", "response.mcp_call_arguments.done",
	// "response.mcp_call.completed", "response.mcp_call.failed",
	// "response.mcp_call.in_progress", "response.mcp_list_tools.completed",
	// "response.mcp_list_tools.failed", "response.mcp_list_tools.in_progress",
	// "response.output_text.annotation.added", "response.queued",
	// "response.reasoning.delta", "response.reasoning.done",
	// "response.reasoning_summary.delta", "response.reasoning_summary.done".
	Type        string `json:"type"`
	ItemID      string `json:"item_id"`
	OutputIndex int64  `json:"output_index"`
	Code        string `json:"code"`
	// This field is from variant [ResponseCompletedEvent].
	Response     Response `json:"response"`
	ContentIndex int64    `json:"content_index"`
	// This field is a union of [ResponseContentPartAddedEventPartUnion],
	// [ResponseContentPartDoneEventPartUnion],
	// [ResponseReasoningSummaryPartAddedEventPart],
	// [ResponseReasoningSummaryPartDoneEventPart]
	Part ResponseStreamEventUnionPart `json:"part"`
	// This field is from variant [ResponseErrorEvent].
	Message string `json:"message"`
	// This field is from variant [ResponseErrorEvent].
	Param string `json:"param"`
	// This field is a union of [string], [any]
	Arguments ResponseStreamEventUnionArguments `json:"arguments"`
	// This field is from variant [ResponseOutputItemAddedEvent].
	Item         ResponseOutputItemUnion `json:"item"`
	SummaryIndex int64                   `json:"summary_index"`
	Text         string                  `json:"text"`
	// This field is from variant [ResponseRefusalDoneEvent].
	Refusal string `json:"refusal"`
	// This field is from variant [ResponseImageGenCallPartialImageEvent].
	PartialImageB64 string `json:"partial_image_b64"`
	// This field is from variant [ResponseImageGenCallPartialImageEvent].
	PartialImageIndex int64 `json:"partial_image_index"`
	// This field is from variant [ResponseOutputTextAnnotationAddedEvent].
	Annotation any `json:"annotation"`
	// This field is from variant [ResponseOutputTextAnnotationAddedEvent].
	AnnotationIndex int64 `json:"annotation_index"`
	JSON            struct {
		Delta             respjson.Field
		SequenceNumber    respjson.Field
		Type              respjson.Field
		ItemID            respjson.Field
		OutputIndex       respjson.Field
		Code              respjson.Field
		Response          respjson.Field
		ContentIndex      respjson.Field
		Part              respjson.Field
		Message           respjson.Field
		Param             respjson.Field
		Arguments         respjson.Field
		Item              respjson.Field
		SummaryIndex      respjson.Field
		Text              respjson.Field
		Refusal           respjson.Field
		PartialImageB64   respjson.Field
		PartialImageIndex respjson.Field
		Annotation        respjson.Field
		AnnotationIndex   respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseStreamEventUnion contains all possible properties and values from ResponseAudioDeltaEvent, ResponseAudioDoneEvent, ResponseAudioTranscriptDeltaEvent, ResponseAudioTranscriptDoneEvent, ResponseCodeInterpreterCallCodeDeltaEvent, ResponseCodeInterpreterCallCodeDoneEvent, ResponseCodeInterpreterCallCompletedEvent, ResponseCodeInterpreterCallInProgressEvent, ResponseCodeInterpreterCallInterpretingEvent, ResponseCompletedEvent, ResponseContentPartAddedEvent, ResponseContentPartDoneEvent, ResponseCreatedEvent, ResponseErrorEvent, ResponseFileSearchCallCompletedEvent, ResponseFileSearchCallInProgressEvent, ResponseFileSearchCallSearchingEvent, ResponseFunctionCallArgumentsDeltaEvent, ResponseFunctionCallArgumentsDoneEvent, ResponseInProgressEvent, ResponseFailedEvent, ResponseIncompleteEvent, ResponseOutputItemAddedEvent, ResponseOutputItemDoneEvent, ResponseReasoningSummaryPartAddedEvent, ResponseReasoningSummaryPartDoneEvent, ResponseReasoningSummaryTextDeltaEvent, ResponseReasoningSummaryTextDoneEvent, ResponseRefusalDeltaEvent, ResponseRefusalDoneEvent, ResponseTextDeltaEvent, ResponseTextDoneEvent, ResponseWebSearchCallCompletedEvent, ResponseWebSearchCallInProgressEvent, ResponseWebSearchCallSearchingEvent, ResponseImageGenCallCompletedEvent, ResponseImageGenCallGeneratingEvent, ResponseImageGenCallInProgressEvent, ResponseImageGenCallPartialImageEvent, ResponseMcpCallArgumentsDeltaEvent, ResponseMcpCallArgumentsDoneEvent, ResponseMcpCallCompletedEvent, ResponseMcpCallFailedEvent, ResponseMcpCallInProgressEvent, ResponseMcpListToolsCompletedEvent, ResponseMcpListToolsFailedEvent, ResponseMcpListToolsInProgressEvent, ResponseOutputTextAnnotationAddedEvent, ResponseQueuedEvent, ResponseReasoningDeltaEvent, ResponseReasoningDoneEvent, ResponseReasoningSummaryDeltaEvent, ResponseReasoningSummaryDoneEvent.

Use the ResponseStreamEventUnion.AsAny method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ResponseStreamEventUnion) AsAny

func (u ResponseStreamEventUnion) AsAny() anyResponseStreamEvent

Use the following switch statement to find the correct variant

switch variant := ResponseStreamEventUnion.AsAny().(type) {
case responses.ResponseAudioDeltaEvent:
case responses.ResponseAudioDoneEvent:
case responses.ResponseAudioTranscriptDeltaEvent:
case responses.ResponseAudioTranscriptDoneEvent:
case responses.ResponseCodeInterpreterCallCodeDeltaEvent:
case responses.ResponseCodeInterpreterCallCodeDoneEvent:
case responses.ResponseCodeInterpreterCallCompletedEvent:
case responses.ResponseCodeInterpreterCallInProgressEvent:
case responses.ResponseCodeInterpreterCallInterpretingEvent:
case responses.ResponseCompletedEvent:
case responses.ResponseContentPartAddedEvent:
case responses.ResponseContentPartDoneEvent:
case responses.ResponseCreatedEvent:
case responses.ResponseErrorEvent:
case responses.ResponseFileSearchCallCompletedEvent:
case responses.ResponseFileSearchCallInProgressEvent:
case responses.ResponseFileSearchCallSearchingEvent:
case responses.ResponseFunctionCallArgumentsDeltaEvent:
case responses.ResponseFunctionCallArgumentsDoneEvent:
case responses.ResponseInProgressEvent:
case responses.ResponseFailedEvent:
case responses.ResponseIncompleteEvent:
case responses.ResponseOutputItemAddedEvent:
case responses.ResponseOutputItemDoneEvent:
case responses.ResponseReasoningSummaryPartAddedEvent:
case responses.ResponseReasoningSummaryPartDoneEvent:
case responses.ResponseReasoningSummaryTextDeltaEvent:
case responses.ResponseReasoningSummaryTextDoneEvent:
case responses.ResponseRefusalDeltaEvent:
case responses.ResponseRefusalDoneEvent:
case responses.ResponseTextDeltaEvent:
case responses.ResponseTextDoneEvent:
case responses.ResponseWebSearchCallCompletedEvent:
case responses.ResponseWebSearchCallInProgressEvent:
case responses.ResponseWebSearchCallSearchingEvent:
case responses.ResponseImageGenCallCompletedEvent:
case responses.ResponseImageGenCallGeneratingEvent:
case responses.ResponseImageGenCallInProgressEvent:
case responses.ResponseImageGenCallPartialImageEvent:
case responses.ResponseMcpCallArgumentsDeltaEvent:
case responses.ResponseMcpCallArgumentsDoneEvent:
case responses.ResponseMcpCallCompletedEvent:
case responses.ResponseMcpCallFailedEvent:
case responses.ResponseMcpCallInProgressEvent:
case responses.ResponseMcpListToolsCompletedEvent:
case responses.ResponseMcpListToolsFailedEvent:
case responses.ResponseMcpListToolsInProgressEvent:
case responses.ResponseOutputTextAnnotationAddedEvent:
case responses.ResponseQueuedEvent:
case responses.ResponseReasoningDeltaEvent:
case responses.ResponseReasoningDoneEvent:
case responses.ResponseReasoningSummaryDeltaEvent:
case responses.ResponseReasoningSummaryDoneEvent:
default:
  fmt.Errorf("no variant present")
}

func (ResponseStreamEventUnion) AsError

func (ResponseStreamEventUnion) AsResponseAudioDelta

func (u ResponseStreamEventUnion) AsResponseAudioDelta() (v ResponseAudioDeltaEvent)

func (ResponseStreamEventUnion) AsResponseAudioDone

func (u ResponseStreamEventUnion) AsResponseAudioDone() (v ResponseAudioDoneEvent)

func (ResponseStreamEventUnion) AsResponseAudioTranscriptDelta

func (u ResponseStreamEventUnion) AsResponseAudioTranscriptDelta() (v ResponseAudioTranscriptDeltaEvent)

func (ResponseStreamEventUnion) AsResponseAudioTranscriptDone

func (u ResponseStreamEventUnion) AsResponseAudioTranscriptDone() (v ResponseAudioTranscriptDoneEvent)

func (ResponseStreamEventUnion) AsResponseCodeInterpreterCallCodeDelta

func (u ResponseStreamEventUnion) AsResponseCodeInterpreterCallCodeDelta() (v ResponseCodeInterpreterCallCodeDeltaEvent)

func (ResponseStreamEventUnion) AsResponseCodeInterpreterCallCodeDone

func (u ResponseStreamEventUnion) AsResponseCodeInterpreterCallCodeDone() (v ResponseCodeInterpreterCallCodeDoneEvent)

func (ResponseStreamEventUnion) AsResponseCodeInterpreterCallCompleted

func (u ResponseStreamEventUnion) AsResponseCodeInterpreterCallCompleted() (v ResponseCodeInterpreterCallCompletedEvent)

func (ResponseStreamEventUnion) AsResponseCodeInterpreterCallInProgress

func (u ResponseStreamEventUnion) AsResponseCodeInterpreterCallInProgress() (v ResponseCodeInterpreterCallInProgressEvent)

func (ResponseStreamEventUnion) AsResponseCodeInterpreterCallInterpreting

func (u ResponseStreamEventUnion) AsResponseCodeInterpreterCallInterpreting() (v ResponseCodeInterpreterCallInterpretingEvent)

func (ResponseStreamEventUnion) AsResponseCompleted

func (u ResponseStreamEventUnion) AsResponseCompleted() (v ResponseCompletedEvent)

func (ResponseStreamEventUnion) AsResponseContentPartAdded

func (u ResponseStreamEventUnion) AsResponseContentPartAdded() (v ResponseContentPartAddedEvent)

func (ResponseStreamEventUnion) AsResponseContentPartDone

func (u ResponseStreamEventUnion) AsResponseContentPartDone() (v ResponseContentPartDoneEvent)

func (ResponseStreamEventUnion) AsResponseCreated

func (u ResponseStreamEventUnion) AsResponseCreated() (v ResponseCreatedEvent)

func (ResponseStreamEventUnion) AsResponseFailed

func (u ResponseStreamEventUnion) AsResponseFailed() (v ResponseFailedEvent)

func (ResponseStreamEventUnion) AsResponseFileSearchCallCompleted

func (u ResponseStreamEventUnion) AsResponseFileSearchCallCompleted() (v ResponseFileSearchCallCompletedEvent)

func (ResponseStreamEventUnion) AsResponseFileSearchCallInProgress

func (u ResponseStreamEventUnion) AsResponseFileSearchCallInProgress() (v ResponseFileSearchCallInProgressEvent)

func (ResponseStreamEventUnion) AsResponseFileSearchCallSearching

func (u ResponseStreamEventUnion) AsResponseFileSearchCallSearching() (v ResponseFileSearchCallSearchingEvent)

func (ResponseStreamEventUnion) AsResponseFunctionCallArgumentsDelta

func (u ResponseStreamEventUnion) AsResponseFunctionCallArgumentsDelta() (v ResponseFunctionCallArgumentsDeltaEvent)

func (ResponseStreamEventUnion) AsResponseFunctionCallArgumentsDone

func (u ResponseStreamEventUnion) AsResponseFunctionCallArgumentsDone() (v ResponseFunctionCallArgumentsDoneEvent)

func (ResponseStreamEventUnion) AsResponseImageGenerationCallCompleted added in v1.1.0

func (u ResponseStreamEventUnion) AsResponseImageGenerationCallCompleted() (v ResponseImageGenCallCompletedEvent)

func (ResponseStreamEventUnion) AsResponseImageGenerationCallGenerating added in v1.1.0

func (u ResponseStreamEventUnion) AsResponseImageGenerationCallGenerating() (v ResponseImageGenCallGeneratingEvent)

func (ResponseStreamEventUnion) AsResponseImageGenerationCallInProgress added in v1.1.0

func (u ResponseStreamEventUnion) AsResponseImageGenerationCallInProgress() (v ResponseImageGenCallInProgressEvent)

func (ResponseStreamEventUnion) AsResponseImageGenerationCallPartialImage added in v1.1.0

func (u ResponseStreamEventUnion) AsResponseImageGenerationCallPartialImage() (v ResponseImageGenCallPartialImageEvent)

func (ResponseStreamEventUnion) AsResponseInProgress

func (u ResponseStreamEventUnion) AsResponseInProgress() (v ResponseInProgressEvent)

func (ResponseStreamEventUnion) AsResponseIncomplete

func (u ResponseStreamEventUnion) AsResponseIncomplete() (v ResponseIncompleteEvent)

func (ResponseStreamEventUnion) AsResponseMcpCallArgumentsDelta added in v1.1.0

func (u ResponseStreamEventUnion) AsResponseMcpCallArgumentsDelta() (v ResponseMcpCallArgumentsDeltaEvent)

func (ResponseStreamEventUnion) AsResponseMcpCallArgumentsDone added in v1.1.0

func (u ResponseStreamEventUnion) AsResponseMcpCallArgumentsDone() (v ResponseMcpCallArgumentsDoneEvent)

func (ResponseStreamEventUnion) AsResponseMcpCallCompleted added in v1.1.0

func (u ResponseStreamEventUnion) AsResponseMcpCallCompleted() (v ResponseMcpCallCompletedEvent)

func (ResponseStreamEventUnion) AsResponseMcpCallFailed added in v1.1.0

func (u ResponseStreamEventUnion) AsResponseMcpCallFailed() (v ResponseMcpCallFailedEvent)

func (ResponseStreamEventUnion) AsResponseMcpCallInProgress added in v1.1.0

func (u ResponseStreamEventUnion) AsResponseMcpCallInProgress() (v ResponseMcpCallInProgressEvent)

func (ResponseStreamEventUnion) AsResponseMcpListToolsCompleted added in v1.1.0

func (u ResponseStreamEventUnion) AsResponseMcpListToolsCompleted() (v ResponseMcpListToolsCompletedEvent)

func (ResponseStreamEventUnion) AsResponseMcpListToolsFailed added in v1.1.0

func (u ResponseStreamEventUnion) AsResponseMcpListToolsFailed() (v ResponseMcpListToolsFailedEvent)

func (ResponseStreamEventUnion) AsResponseMcpListToolsInProgress added in v1.1.0

func (u ResponseStreamEventUnion) AsResponseMcpListToolsInProgress() (v ResponseMcpListToolsInProgressEvent)

func (ResponseStreamEventUnion) AsResponseOutputItemAdded

func (u ResponseStreamEventUnion) AsResponseOutputItemAdded() (v ResponseOutputItemAddedEvent)

func (ResponseStreamEventUnion) AsResponseOutputItemDone

func (u ResponseStreamEventUnion) AsResponseOutputItemDone() (v ResponseOutputItemDoneEvent)

func (ResponseStreamEventUnion) AsResponseOutputTextAnnotationAdded

func (u ResponseStreamEventUnion) AsResponseOutputTextAnnotationAdded() (v ResponseOutputTextAnnotationAddedEvent)

func (ResponseStreamEventUnion) AsResponseOutputTextDelta

func (u ResponseStreamEventUnion) AsResponseOutputTextDelta() (v ResponseTextDeltaEvent)

func (ResponseStreamEventUnion) AsResponseOutputTextDone

func (u ResponseStreamEventUnion) AsResponseOutputTextDone() (v ResponseTextDoneEvent)

func (ResponseStreamEventUnion) AsResponseQueued added in v1.1.0

func (u ResponseStreamEventUnion) AsResponseQueued() (v ResponseQueuedEvent)

func (ResponseStreamEventUnion) AsResponseReasoningDelta added in v1.1.0

func (u ResponseStreamEventUnion) AsResponseReasoningDelta() (v ResponseReasoningDeltaEvent)

func (ResponseStreamEventUnion) AsResponseReasoningDone added in v1.1.0

func (u ResponseStreamEventUnion) AsResponseReasoningDone() (v ResponseReasoningDoneEvent)

func (ResponseStreamEventUnion) AsResponseReasoningSummaryDelta added in v1.1.0

func (u ResponseStreamEventUnion) AsResponseReasoningSummaryDelta() (v ResponseReasoningSummaryDeltaEvent)

func (ResponseStreamEventUnion) AsResponseReasoningSummaryDone added in v1.1.0

func (u ResponseStreamEventUnion) AsResponseReasoningSummaryDone() (v ResponseReasoningSummaryDoneEvent)

func (ResponseStreamEventUnion) AsResponseReasoningSummaryPartAdded

func (u ResponseStreamEventUnion) AsResponseReasoningSummaryPartAdded() (v ResponseReasoningSummaryPartAddedEvent)

func (ResponseStreamEventUnion) AsResponseReasoningSummaryPartDone

func (u ResponseStreamEventUnion) AsResponseReasoningSummaryPartDone() (v ResponseReasoningSummaryPartDoneEvent)

func (ResponseStreamEventUnion) AsResponseReasoningSummaryTextDelta

func (u ResponseStreamEventUnion) AsResponseReasoningSummaryTextDelta() (v ResponseReasoningSummaryTextDeltaEvent)

func (ResponseStreamEventUnion) AsResponseReasoningSummaryTextDone

func (u ResponseStreamEventUnion) AsResponseReasoningSummaryTextDone() (v ResponseReasoningSummaryTextDoneEvent)

func (ResponseStreamEventUnion) AsResponseRefusalDelta

func (u ResponseStreamEventUnion) AsResponseRefusalDelta() (v ResponseRefusalDeltaEvent)

func (ResponseStreamEventUnion) AsResponseRefusalDone

func (u ResponseStreamEventUnion) AsResponseRefusalDone() (v ResponseRefusalDoneEvent)

func (ResponseStreamEventUnion) AsResponseWebSearchCallCompleted

func (u ResponseStreamEventUnion) AsResponseWebSearchCallCompleted() (v ResponseWebSearchCallCompletedEvent)

func (ResponseStreamEventUnion) AsResponseWebSearchCallInProgress

func (u ResponseStreamEventUnion) AsResponseWebSearchCallInProgress() (v ResponseWebSearchCallInProgressEvent)

func (ResponseStreamEventUnion) AsResponseWebSearchCallSearching

func (u ResponseStreamEventUnion) AsResponseWebSearchCallSearching() (v ResponseWebSearchCallSearchingEvent)

func (ResponseStreamEventUnion) RawJSON

func (u ResponseStreamEventUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseStreamEventUnion) UnmarshalJSON

func (r *ResponseStreamEventUnion) UnmarshalJSON(data []byte) error

type ResponseStreamEventUnionArguments added in v1.1.0

type ResponseStreamEventUnionArguments struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [any] instead of an object.
	OfResponseMcpCallArgumentsDoneEventArguments any `json:",inline"`
	JSON                                         struct {
		OfString                                     respjson.Field
		OfResponseMcpCallArgumentsDoneEventArguments respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseStreamEventUnionArguments is an implicit subunion of ResponseStreamEventUnion. ResponseStreamEventUnionArguments provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the ResponseStreamEventUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfResponseMcpCallArgumentsDoneEventArguments]

func (*ResponseStreamEventUnionArguments) UnmarshalJSON added in v1.1.0

func (r *ResponseStreamEventUnionArguments) UnmarshalJSON(data []byte) error

type ResponseStreamEventUnionDelta added in v1.1.0

type ResponseStreamEventUnionDelta struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [any] instead of an object.
	OfResponseReasoningSummaryDeltaEventDelta any `json:",inline"`
	JSON                                      struct {
		OfString                                  respjson.Field
		OfResponseReasoningSummaryDeltaEventDelta respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseStreamEventUnionDelta is an implicit subunion of ResponseStreamEventUnion. ResponseStreamEventUnionDelta provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the ResponseStreamEventUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfResponseReasoningSummaryDeltaEventDelta]

func (*ResponseStreamEventUnionDelta) UnmarshalJSON added in v1.1.0

func (r *ResponseStreamEventUnionDelta) UnmarshalJSON(data []byte) error

type ResponseStreamEventUnionPart

type ResponseStreamEventUnionPart struct {
	// This field is from variant [ResponseContentPartAddedEventPartUnion],
	// [ResponseContentPartDoneEventPartUnion].
	Annotations []ResponseOutputTextAnnotationUnion `json:"annotations"`
	Text        string                              `json:"text"`
	Type        string                              `json:"type"`
	// This field is from variant [ResponseContentPartAddedEventPartUnion],
	// [ResponseContentPartDoneEventPartUnion].
	Logprobs []ResponseOutputTextLogprob `json:"logprobs"`
	// This field is from variant [ResponseContentPartAddedEventPartUnion],
	// [ResponseContentPartDoneEventPartUnion].
	Refusal string `json:"refusal"`
	JSON    struct {
		Annotations respjson.Field
		Text        respjson.Field
		Type        respjson.Field
		Logprobs    respjson.Field
		Refusal     respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseStreamEventUnionPart is an implicit subunion of ResponseStreamEventUnion. ResponseStreamEventUnionPart provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the ResponseStreamEventUnion.

func (*ResponseStreamEventUnionPart) UnmarshalJSON

func (r *ResponseStreamEventUnionPart) UnmarshalJSON(data []byte) error

type ResponseTextConfig

type ResponseTextConfig struct {
	// An object specifying the format that the model must output.
	//
	// Configuring `{ "type": "json_schema" }` enables Structured Outputs, which
	// ensures the model will match your supplied JSON schema. Learn more in the
	// [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
	//
	// The default format is `{ "type": "text" }` with no additional options.
	//
	// **Not recommended for gpt-4o and newer models:**
	//
	// Setting to `{ "type": "json_object" }` enables the older JSON mode, which
	// ensures the message the model generates is valid JSON. Using `json_schema` is
	// preferred for models that support it.
	Format ResponseFormatTextConfigUnion `json:"format"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Format      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:

- [Text inputs and outputs](https://platform.openai.com/docs/guides/text) - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)

func (ResponseTextConfig) RawJSON

func (r ResponseTextConfig) RawJSON() string

Returns the unmodified JSON received from the API

func (ResponseTextConfig) ToParam

ToParam converts this ResponseTextConfig to a ResponseTextConfigParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ResponseTextConfigParam.Overrides()

func (*ResponseTextConfig) UnmarshalJSON

func (r *ResponseTextConfig) UnmarshalJSON(data []byte) error

type ResponseTextConfigParam

type ResponseTextConfigParam struct {
	// An object specifying the format that the model must output.
	//
	// Configuring `{ "type": "json_schema" }` enables Structured Outputs, which
	// ensures the model will match your supplied JSON schema. Learn more in the
	// [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
	//
	// The default format is `{ "type": "text" }` with no additional options.
	//
	// **Not recommended for gpt-4o and newer models:**
	//
	// Setting to `{ "type": "json_object" }` enables the older JSON mode, which
	// ensures the message the model generates is valid JSON. Using `json_schema` is
	// preferred for models that support it.
	Format ResponseFormatTextConfigUnionParam `json:"format,omitzero"`
	// contains filtered or unexported fields
}

Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:

- [Text inputs and outputs](https://platform.openai.com/docs/guides/text) - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)

func (ResponseTextConfigParam) MarshalJSON

func (r ResponseTextConfigParam) MarshalJSON() (data []byte, err error)

func (*ResponseTextConfigParam) UnmarshalJSON

func (r *ResponseTextConfigParam) UnmarshalJSON(data []byte) error

type ResponseTextDeltaEvent

type ResponseTextDeltaEvent struct {
	// The index of the content part that the text delta was added to.
	ContentIndex int64 `json:"content_index,required"`
	// The text delta that was added.
	Delta string `json:"delta,required"`
	// The ID of the output item that the text delta was added to.
	ItemID string `json:"item_id,required"`
	// The index of the output item that the text delta was added to.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number for this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.output_text.delta`.
	Type constant.ResponseOutputTextDelta `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ContentIndex   respjson.Field
		Delta          respjson.Field
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when there is an additional text delta.

func (ResponseTextDeltaEvent) RawJSON

func (r ResponseTextDeltaEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseTextDeltaEvent) UnmarshalJSON

func (r *ResponseTextDeltaEvent) UnmarshalJSON(data []byte) error

type ResponseTextDoneEvent

type ResponseTextDoneEvent struct {
	// The index of the content part that the text content is finalized.
	ContentIndex int64 `json:"content_index,required"`
	// The ID of the output item that the text content is finalized.
	ItemID string `json:"item_id,required"`
	// The index of the output item that the text content is finalized.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number for this event.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The text content that is finalized.
	Text string `json:"text,required"`
	// The type of the event. Always `response.output_text.done`.
	Type constant.ResponseOutputTextDone `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ContentIndex   respjson.Field
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Text           respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when text content is finalized.

func (ResponseTextDoneEvent) RawJSON

func (r ResponseTextDoneEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseTextDoneEvent) UnmarshalJSON

func (r *ResponseTextDoneEvent) UnmarshalJSON(data []byte) error

type ResponseToolChoiceUnion

type ResponseToolChoiceUnion struct {
	// This field will be present if the value is a [ToolChoiceOptions] instead of an
	// object.
	OfToolChoiceMode ToolChoiceOptions `json:",inline"`
	Type             string            `json:"type"`
	Name             string            `json:"name"`
	// This field is from variant [ToolChoiceMcp].
	ServerLabel string `json:"server_label"`
	JSON        struct {
		OfToolChoiceMode respjson.Field
		Type             respjson.Field
		Name             respjson.Field
		ServerLabel      respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseToolChoiceUnion contains all possible properties and values from ToolChoiceOptions, ToolChoiceTypes, ToolChoiceFunction, ToolChoiceMcp.

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfToolChoiceMode]

func (ResponseToolChoiceUnion) AsFunctionTool

func (u ResponseToolChoiceUnion) AsFunctionTool() (v ToolChoiceFunction)

func (ResponseToolChoiceUnion) AsHostedTool

func (u ResponseToolChoiceUnion) AsHostedTool() (v ToolChoiceTypes)

func (ResponseToolChoiceUnion) AsMcpTool added in v1.8.0

func (u ResponseToolChoiceUnion) AsMcpTool() (v ToolChoiceMcp)

func (ResponseToolChoiceUnion) AsToolChoiceMode

func (u ResponseToolChoiceUnion) AsToolChoiceMode() (v ToolChoiceOptions)

func (ResponseToolChoiceUnion) RawJSON

func (u ResponseToolChoiceUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseToolChoiceUnion) UnmarshalJSON

func (r *ResponseToolChoiceUnion) UnmarshalJSON(data []byte) error

type ResponseTruncation

type ResponseTruncation string

The truncation strategy to use for the model response.

  • `auto`: If the context of this response and previous ones exceeds the model's context window size, the model will truncate the response to fit the context window by dropping input items in the middle of the conversation.
  • `disabled` (default): If a model response will exceed the context window size for a model, the request will fail with a 400 error.
const (
	ResponseTruncationAuto     ResponseTruncation = "auto"
	ResponseTruncationDisabled ResponseTruncation = "disabled"
)

type ResponseUsage

type ResponseUsage struct {
	// The number of input tokens.
	InputTokens int64 `json:"input_tokens,required"`
	// A detailed breakdown of the input tokens.
	InputTokensDetails ResponseUsageInputTokensDetails `json:"input_tokens_details,required"`
	// The number of output tokens.
	OutputTokens int64 `json:"output_tokens,required"`
	// A detailed breakdown of the output tokens.
	OutputTokensDetails ResponseUsageOutputTokensDetails `json:"output_tokens_details,required"`
	// The total number of tokens used.
	TotalTokens int64 `json:"total_tokens,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		InputTokens         respjson.Field
		InputTokensDetails  respjson.Field
		OutputTokens        respjson.Field
		OutputTokensDetails respjson.Field
		TotalTokens         respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Represents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used.

func (ResponseUsage) RawJSON

func (r ResponseUsage) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseUsage) UnmarshalJSON

func (r *ResponseUsage) UnmarshalJSON(data []byte) error

type ResponseUsageInputTokensDetails

type ResponseUsageInputTokensDetails struct {
	// The number of tokens that were retrieved from the cache.
	// [More on prompt caching](https://platform.openai.com/docs/guides/prompt-caching).
	CachedTokens int64 `json:"cached_tokens,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CachedTokens respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A detailed breakdown of the input tokens.

func (ResponseUsageInputTokensDetails) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseUsageInputTokensDetails) UnmarshalJSON

func (r *ResponseUsageInputTokensDetails) UnmarshalJSON(data []byte) error

type ResponseUsageOutputTokensDetails

type ResponseUsageOutputTokensDetails struct {
	// The number of reasoning tokens.
	ReasoningTokens int64 `json:"reasoning_tokens,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ReasoningTokens respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A detailed breakdown of the output tokens.

func (ResponseUsageOutputTokensDetails) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseUsageOutputTokensDetails) UnmarshalJSON

func (r *ResponseUsageOutputTokensDetails) UnmarshalJSON(data []byte) error

type ResponseWebSearchCallCompletedEvent

type ResponseWebSearchCallCompletedEvent struct {
	// Unique ID for the output item associated with the web search call.
	ItemID string `json:"item_id,required"`
	// The index of the output item that the web search call is associated with.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of the web search call being processed.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.web_search_call.completed`.
	Type constant.ResponseWebSearchCallCompleted `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a web search call is completed.

func (ResponseWebSearchCallCompletedEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseWebSearchCallCompletedEvent) UnmarshalJSON

func (r *ResponseWebSearchCallCompletedEvent) UnmarshalJSON(data []byte) error

type ResponseWebSearchCallInProgressEvent

type ResponseWebSearchCallInProgressEvent struct {
	// Unique ID for the output item associated with the web search call.
	ItemID string `json:"item_id,required"`
	// The index of the output item that the web search call is associated with.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of the web search call being processed.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.web_search_call.in_progress`.
	Type constant.ResponseWebSearchCallInProgress `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a web search call is initiated.

func (ResponseWebSearchCallInProgressEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseWebSearchCallInProgressEvent) UnmarshalJSON

func (r *ResponseWebSearchCallInProgressEvent) UnmarshalJSON(data []byte) error

type ResponseWebSearchCallSearchingEvent

type ResponseWebSearchCallSearchingEvent struct {
	// Unique ID for the output item associated with the web search call.
	ItemID string `json:"item_id,required"`
	// The index of the output item that the web search call is associated with.
	OutputIndex int64 `json:"output_index,required"`
	// The sequence number of the web search call being processed.
	SequenceNumber int64 `json:"sequence_number,required"`
	// The type of the event. Always `response.web_search_call.searching`.
	Type constant.ResponseWebSearchCallSearching `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemID         respjson.Field
		OutputIndex    respjson.Field
		SequenceNumber respjson.Field
		Type           respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Emitted when a web search call is executing.

func (ResponseWebSearchCallSearchingEvent) RawJSON

Returns the unmodified JSON received from the API

func (*ResponseWebSearchCallSearchingEvent) UnmarshalJSON

func (r *ResponseWebSearchCallSearchingEvent) UnmarshalJSON(data []byte) error

type ResponsesModel

type ResponsesModel = shared.ResponsesModel

This is an alias to an internal type.

type ToolChoiceFunction

type ToolChoiceFunction struct {
	// The name of the function to call.
	Name string `json:"name,required"`
	// For function calling, the type is always `function`.
	Type constant.Function `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Name        respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Use this option to force the model to call a specific function.

func (ToolChoiceFunction) RawJSON

func (r ToolChoiceFunction) RawJSON() string

Returns the unmodified JSON received from the API

func (ToolChoiceFunction) ToParam

ToParam converts this ToolChoiceFunction to a ToolChoiceFunctionParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ToolChoiceFunctionParam.Overrides()

func (*ToolChoiceFunction) UnmarshalJSON

func (r *ToolChoiceFunction) UnmarshalJSON(data []byte) error

type ToolChoiceFunctionParam

type ToolChoiceFunctionParam struct {
	// The name of the function to call.
	Name string `json:"name,required"`
	// For function calling, the type is always `function`.
	//
	// This field can be elided, and will marshal its zero value as "function".
	Type constant.Function `json:"type,required"`
	// contains filtered or unexported fields
}

Use this option to force the model to call a specific function.

The properties Name, Type are required.

func (ToolChoiceFunctionParam) MarshalJSON

func (r ToolChoiceFunctionParam) MarshalJSON() (data []byte, err error)

func (*ToolChoiceFunctionParam) UnmarshalJSON

func (r *ToolChoiceFunctionParam) UnmarshalJSON(data []byte) error

type ToolChoiceMcp added in v1.8.0

type ToolChoiceMcp struct {
	// The label of the MCP server to use.
	ServerLabel string `json:"server_label,required"`
	// For MCP tools, the type is always `mcp`.
	Type constant.Mcp `json:"type,required"`
	// The name of the tool to call on the server.
	Name string `json:"name,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ServerLabel respjson.Field
		Type        respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Use this option to force the model to call a specific tool on a remote MCP server.

func (ToolChoiceMcp) RawJSON added in v1.8.0

func (r ToolChoiceMcp) RawJSON() string

Returns the unmodified JSON received from the API

func (ToolChoiceMcp) ToParam added in v1.8.0

func (r ToolChoiceMcp) ToParam() ToolChoiceMcpParam

ToParam converts this ToolChoiceMcp to a ToolChoiceMcpParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ToolChoiceMcpParam.Overrides()

func (*ToolChoiceMcp) UnmarshalJSON added in v1.8.0

func (r *ToolChoiceMcp) UnmarshalJSON(data []byte) error

type ToolChoiceMcpParam added in v1.8.0

type ToolChoiceMcpParam struct {
	// The label of the MCP server to use.
	ServerLabel string `json:"server_label,required"`
	// The name of the tool to call on the server.
	Name param.Opt[string] `json:"name,omitzero"`
	// For MCP tools, the type is always `mcp`.
	//
	// This field can be elided, and will marshal its zero value as "mcp".
	Type constant.Mcp `json:"type,required"`
	// contains filtered or unexported fields
}

Use this option to force the model to call a specific tool on a remote MCP server.

The properties ServerLabel, Type are required.

func (ToolChoiceMcpParam) MarshalJSON added in v1.8.0

func (r ToolChoiceMcpParam) MarshalJSON() (data []byte, err error)

func (*ToolChoiceMcpParam) UnmarshalJSON added in v1.8.0

func (r *ToolChoiceMcpParam) UnmarshalJSON(data []byte) error

type ToolChoiceOptions

type ToolChoiceOptions string

Controls which (if any) tool is called by the model.

`none` means the model will not call any tool and instead generates a message.

`auto` means the model can pick between generating a message or calling one or more tools.

`required` means the model must call one or more tools.

const (
	ToolChoiceOptionsNone     ToolChoiceOptions = "none"
	ToolChoiceOptionsAuto     ToolChoiceOptions = "auto"
	ToolChoiceOptionsRequired ToolChoiceOptions = "required"
)

type ToolChoiceTypes

type ToolChoiceTypes struct {
	// The type of hosted tool the model should to use. Learn more about
	// [built-in tools](https://platform.openai.com/docs/guides/tools).
	//
	// Allowed values are:
	//
	// - `file_search`
	// - `web_search_preview`
	// - `computer_use_preview`
	// - `code_interpreter`
	// - `image_generation`
	//
	// Any of "file_search", "web_search_preview", "computer_use_preview",
	// "web_search_preview_2025_03_11", "image_generation", "code_interpreter".
	Type ToolChoiceTypesType `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Indicates that the model should use a built-in tool to generate a response. [Learn more about built-in tools](https://platform.openai.com/docs/guides/tools).

func (ToolChoiceTypes) RawJSON

func (r ToolChoiceTypes) RawJSON() string

Returns the unmodified JSON received from the API

func (ToolChoiceTypes) ToParam

ToParam converts this ToolChoiceTypes to a ToolChoiceTypesParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ToolChoiceTypesParam.Overrides()

func (*ToolChoiceTypes) UnmarshalJSON

func (r *ToolChoiceTypes) UnmarshalJSON(data []byte) error

type ToolChoiceTypesParam

type ToolChoiceTypesParam struct {
	// The type of hosted tool the model should to use. Learn more about
	// [built-in tools](https://platform.openai.com/docs/guides/tools).
	//
	// Allowed values are:
	//
	// - `file_search`
	// - `web_search_preview`
	// - `computer_use_preview`
	// - `code_interpreter`
	// - `image_generation`
	//
	// Any of "file_search", "web_search_preview", "computer_use_preview",
	// "web_search_preview_2025_03_11", "image_generation", "code_interpreter".
	Type ToolChoiceTypesType `json:"type,omitzero,required"`
	// contains filtered or unexported fields
}

Indicates that the model should use a built-in tool to generate a response. [Learn more about built-in tools](https://platform.openai.com/docs/guides/tools).

The property Type is required.

func (ToolChoiceTypesParam) MarshalJSON

func (r ToolChoiceTypesParam) MarshalJSON() (data []byte, err error)

func (*ToolChoiceTypesParam) UnmarshalJSON

func (r *ToolChoiceTypesParam) UnmarshalJSON(data []byte) error

type ToolChoiceTypesType

type ToolChoiceTypesType string

The type of hosted tool the model should to use. Learn more about [built-in tools](https://platform.openai.com/docs/guides/tools).

Allowed values are:

- `file_search` - `web_search_preview` - `computer_use_preview` - `code_interpreter` - `image_generation`

const (
	ToolChoiceTypesTypeFileSearch                 ToolChoiceTypesType = "file_search"
	ToolChoiceTypesTypeWebSearchPreview           ToolChoiceTypesType = "web_search_preview"
	ToolChoiceTypesTypeComputerUsePreview         ToolChoiceTypesType = "computer_use_preview"
	ToolChoiceTypesTypeWebSearchPreview2025_03_11 ToolChoiceTypesType = "web_search_preview_2025_03_11"
	ToolChoiceTypesTypeImageGeneration            ToolChoiceTypesType = "image_generation"
	ToolChoiceTypesTypeCodeInterpreter            ToolChoiceTypesType = "code_interpreter"
)

type ToolCodeInterpreter added in v1.1.0

type ToolCodeInterpreter struct {
	// The code interpreter container. Can be a container ID or an object that
	// specifies uploaded file IDs to make available to your code.
	Container ToolCodeInterpreterContainerUnion `json:"container,required"`
	// The type of the code interpreter tool. Always `code_interpreter`.
	Type constant.CodeInterpreter `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Container   respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A tool that runs Python code to help generate a response to a prompt.

func (ToolCodeInterpreter) RawJSON added in v1.1.0

func (r ToolCodeInterpreter) RawJSON() string

Returns the unmodified JSON received from the API

func (*ToolCodeInterpreter) UnmarshalJSON added in v1.1.0

func (r *ToolCodeInterpreter) UnmarshalJSON(data []byte) error

type ToolCodeInterpreterContainerCodeInterpreterContainerAuto added in v1.1.0

type ToolCodeInterpreterContainerCodeInterpreterContainerAuto struct {
	// Always `auto`.
	Type constant.Auto `json:"type,required"`
	// An optional list of uploaded files to make available to your code.
	FileIDs []string `json:"file_ids"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		FileIDs     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

func (ToolCodeInterpreterContainerCodeInterpreterContainerAuto) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ToolCodeInterpreterContainerCodeInterpreterContainerAuto) UnmarshalJSON added in v1.1.0

type ToolCodeInterpreterContainerCodeInterpreterContainerAutoParam added in v1.1.0

type ToolCodeInterpreterContainerCodeInterpreterContainerAutoParam struct {
	// An optional list of uploaded files to make available to your code.
	FileIDs []string `json:"file_ids,omitzero"`
	// Always `auto`.
	//
	// This field can be elided, and will marshal its zero value as "auto".
	Type constant.Auto `json:"type,required"`
	// contains filtered or unexported fields
}

Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

The property Type is required.

func (ToolCodeInterpreterContainerCodeInterpreterContainerAutoParam) MarshalJSON added in v1.1.0

func (*ToolCodeInterpreterContainerCodeInterpreterContainerAutoParam) UnmarshalJSON added in v1.1.0

type ToolCodeInterpreterContainerUnion added in v1.1.0

type ToolCodeInterpreterContainerUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field is from variant
	// [ToolCodeInterpreterContainerCodeInterpreterContainerAuto].
	Type constant.Auto `json:"type"`
	// This field is from variant
	// [ToolCodeInterpreterContainerCodeInterpreterContainerAuto].
	FileIDs []string `json:"file_ids"`
	JSON    struct {
		OfString respjson.Field
		Type     respjson.Field
		FileIDs  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ToolCodeInterpreterContainerUnion contains all possible properties and values from [string], ToolCodeInterpreterContainerCodeInterpreterContainerAuto.

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString]

func (ToolCodeInterpreterContainerUnion) AsCodeInterpreterContainerAuto added in v1.1.0

func (ToolCodeInterpreterContainerUnion) AsString added in v1.1.0

func (u ToolCodeInterpreterContainerUnion) AsString() (v string)

func (ToolCodeInterpreterContainerUnion) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ToolCodeInterpreterContainerUnion) UnmarshalJSON added in v1.1.0

func (r *ToolCodeInterpreterContainerUnion) UnmarshalJSON(data []byte) error

type ToolCodeInterpreterContainerUnionParam added in v1.1.0

type ToolCodeInterpreterContainerUnionParam struct {
	OfString                       param.Opt[string]                                              `json:",omitzero,inline"`
	OfCodeInterpreterContainerAuto *ToolCodeInterpreterContainerCodeInterpreterContainerAutoParam `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ToolCodeInterpreterContainerUnionParam) MarshalJSON added in v1.1.0

func (u ToolCodeInterpreterContainerUnionParam) MarshalJSON() ([]byte, error)

func (*ToolCodeInterpreterContainerUnionParam) UnmarshalJSON added in v1.1.0

func (u *ToolCodeInterpreterContainerUnionParam) UnmarshalJSON(data []byte) error

type ToolCodeInterpreterParam added in v1.1.0

type ToolCodeInterpreterParam struct {
	// The code interpreter container. Can be a container ID or an object that
	// specifies uploaded file IDs to make available to your code.
	Container ToolCodeInterpreterContainerUnionParam `json:"container,omitzero,required"`
	// The type of the code interpreter tool. Always `code_interpreter`.
	//
	// This field can be elided, and will marshal its zero value as "code_interpreter".
	Type constant.CodeInterpreter `json:"type,required"`
	// contains filtered or unexported fields
}

A tool that runs Python code to help generate a response to a prompt.

The properties Container, Type are required.

func (ToolCodeInterpreterParam) MarshalJSON added in v1.1.0

func (r ToolCodeInterpreterParam) MarshalJSON() (data []byte, err error)

func (*ToolCodeInterpreterParam) UnmarshalJSON added in v1.1.0

func (r *ToolCodeInterpreterParam) UnmarshalJSON(data []byte) error

type ToolImageGeneration added in v1.1.0

type ToolImageGeneration struct {
	// The type of the image generation tool. Always `image_generation`.
	Type constant.ImageGeneration `json:"type,required"`
	// Background type for the generated image. One of `transparent`, `opaque`, or
	// `auto`. Default: `auto`.
	//
	// Any of "transparent", "opaque", "auto".
	Background string `json:"background"`
	// Control how much effort the model will exert to match the style and features,
	// especially facial features, of input images. This parameter is only supported
	// for `gpt-image-1`. Supports `high` and `low`. Defaults to `low`.
	//
	// Any of "high", "low".
	InputFidelity string `json:"input_fidelity,nullable"`
	// Optional mask for inpainting. Contains `image_url` (string, optional) and
	// `file_id` (string, optional).
	InputImageMask ToolImageGenerationInputImageMask `json:"input_image_mask"`
	// The image generation model to use. Default: `gpt-image-1`.
	//
	// Any of "gpt-image-1".
	Model string `json:"model"`
	// Moderation level for the generated image. Default: `auto`.
	//
	// Any of "auto", "low".
	Moderation string `json:"moderation"`
	// Compression level for the output image. Default: 100.
	OutputCompression int64 `json:"output_compression"`
	// The output format of the generated image. One of `png`, `webp`, or `jpeg`.
	// Default: `png`.
	//
	// Any of "png", "webp", "jpeg".
	OutputFormat string `json:"output_format"`
	// Number of partial images to generate in streaming mode, from 0 (default value)
	// to 3.
	PartialImages int64 `json:"partial_images"`
	// The quality of the generated image. One of `low`, `medium`, `high`, or `auto`.
	// Default: `auto`.
	//
	// Any of "low", "medium", "high", "auto".
	Quality string `json:"quality"`
	// The size of the generated image. One of `1024x1024`, `1024x1536`, `1536x1024`,
	// or `auto`. Default: `auto`.
	//
	// Any of "1024x1024", "1024x1536", "1536x1024", "auto".
	Size string `json:"size"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type              respjson.Field
		Background        respjson.Field
		InputFidelity     respjson.Field
		InputImageMask    respjson.Field
		Model             respjson.Field
		Moderation        respjson.Field
		OutputCompression respjson.Field
		OutputFormat      respjson.Field
		PartialImages     respjson.Field
		Quality           respjson.Field
		Size              respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A tool that generates images using a model like `gpt-image-1`.

func (ToolImageGeneration) RawJSON added in v1.1.0

func (r ToolImageGeneration) RawJSON() string

Returns the unmodified JSON received from the API

func (*ToolImageGeneration) UnmarshalJSON added in v1.1.0

func (r *ToolImageGeneration) UnmarshalJSON(data []byte) error

type ToolImageGenerationInputImageMask added in v1.1.0

type ToolImageGenerationInputImageMask struct {
	// File ID for the mask image.
	FileID string `json:"file_id"`
	// Base64-encoded mask image.
	ImageURL string `json:"image_url"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FileID      respjson.Field
		ImageURL    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Optional mask for inpainting. Contains `image_url` (string, optional) and `file_id` (string, optional).

func (ToolImageGenerationInputImageMask) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ToolImageGenerationInputImageMask) UnmarshalJSON added in v1.1.0

func (r *ToolImageGenerationInputImageMask) UnmarshalJSON(data []byte) error

type ToolImageGenerationInputImageMaskParam added in v1.1.0

type ToolImageGenerationInputImageMaskParam struct {
	// File ID for the mask image.
	FileID param.Opt[string] `json:"file_id,omitzero"`
	// Base64-encoded mask image.
	ImageURL param.Opt[string] `json:"image_url,omitzero"`
	// contains filtered or unexported fields
}

Optional mask for inpainting. Contains `image_url` (string, optional) and `file_id` (string, optional).

func (ToolImageGenerationInputImageMaskParam) MarshalJSON added in v1.1.0

func (r ToolImageGenerationInputImageMaskParam) MarshalJSON() (data []byte, err error)

func (*ToolImageGenerationInputImageMaskParam) UnmarshalJSON added in v1.1.0

func (r *ToolImageGenerationInputImageMaskParam) UnmarshalJSON(data []byte) error

type ToolImageGenerationParam added in v1.1.0

type ToolImageGenerationParam struct {
	// Compression level for the output image. Default: 100.
	OutputCompression param.Opt[int64] `json:"output_compression,omitzero"`
	// Number of partial images to generate in streaming mode, from 0 (default value)
	// to 3.
	PartialImages param.Opt[int64] `json:"partial_images,omitzero"`
	// Control how much effort the model will exert to match the style and features,
	// especially facial features, of input images. This parameter is only supported
	// for `gpt-image-1`. Supports `high` and `low`. Defaults to `low`.
	//
	// Any of "high", "low".
	InputFidelity string `json:"input_fidelity,omitzero"`
	// Background type for the generated image. One of `transparent`, `opaque`, or
	// `auto`. Default: `auto`.
	//
	// Any of "transparent", "opaque", "auto".
	Background string `json:"background,omitzero"`
	// Optional mask for inpainting. Contains `image_url` (string, optional) and
	// `file_id` (string, optional).
	InputImageMask ToolImageGenerationInputImageMaskParam `json:"input_image_mask,omitzero"`
	// The image generation model to use. Default: `gpt-image-1`.
	//
	// Any of "gpt-image-1".
	Model string `json:"model,omitzero"`
	// Moderation level for the generated image. Default: `auto`.
	//
	// Any of "auto", "low".
	Moderation string `json:"moderation,omitzero"`
	// The output format of the generated image. One of `png`, `webp`, or `jpeg`.
	// Default: `png`.
	//
	// Any of "png", "webp", "jpeg".
	OutputFormat string `json:"output_format,omitzero"`
	// The quality of the generated image. One of `low`, `medium`, `high`, or `auto`.
	// Default: `auto`.
	//
	// Any of "low", "medium", "high", "auto".
	Quality string `json:"quality,omitzero"`
	// The size of the generated image. One of `1024x1024`, `1024x1536`, `1536x1024`,
	// or `auto`. Default: `auto`.
	//
	// Any of "1024x1024", "1024x1536", "1536x1024", "auto".
	Size string `json:"size,omitzero"`
	// The type of the image generation tool. Always `image_generation`.
	//
	// This field can be elided, and will marshal its zero value as "image_generation".
	Type constant.ImageGeneration `json:"type,required"`
	// contains filtered or unexported fields
}

A tool that generates images using a model like `gpt-image-1`.

The property Type is required.

func (ToolImageGenerationParam) MarshalJSON added in v1.1.0

func (r ToolImageGenerationParam) MarshalJSON() (data []byte, err error)

func (*ToolImageGenerationParam) UnmarshalJSON added in v1.1.0

func (r *ToolImageGenerationParam) UnmarshalJSON(data []byte) error

type ToolLocalShell added in v1.1.0

type ToolLocalShell struct {
	// The type of the local shell tool. Always `local_shell`.
	Type constant.LocalShell `json:"type,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A tool that allows the model to execute shell commands in a local environment.

func (ToolLocalShell) RawJSON added in v1.1.0

func (r ToolLocalShell) RawJSON() string

Returns the unmodified JSON received from the API

func (*ToolLocalShell) UnmarshalJSON added in v1.1.0

func (r *ToolLocalShell) UnmarshalJSON(data []byte) error

type ToolLocalShellParam added in v1.1.0

type ToolLocalShellParam struct {
	// The type of the local shell tool. Always `local_shell`.
	Type constant.LocalShell `json:"type,required"`
	// contains filtered or unexported fields
}

A tool that allows the model to execute shell commands in a local environment.

This struct has a constant value, construct it with NewToolLocalShellParam.

func NewToolLocalShellParam added in v1.1.0

func NewToolLocalShellParam() ToolLocalShellParam

func (ToolLocalShellParam) MarshalJSON added in v1.1.0

func (r ToolLocalShellParam) MarshalJSON() (data []byte, err error)

func (*ToolLocalShellParam) UnmarshalJSON added in v1.1.0

func (r *ToolLocalShellParam) UnmarshalJSON(data []byte) error

type ToolMcp added in v1.1.0

type ToolMcp struct {
	// A label for this MCP server, used to identify it in tool calls.
	ServerLabel string `json:"server_label,required"`
	// The URL for the MCP server.
	ServerURL string `json:"server_url,required"`
	// The type of the MCP tool. Always `mcp`.
	Type constant.Mcp `json:"type,required"`
	// List of allowed tool names or a filter object.
	AllowedTools ToolMcpAllowedToolsUnion `json:"allowed_tools,nullable"`
	// Optional HTTP headers to send to the MCP server. Use for authentication or other
	// purposes.
	Headers map[string]string `json:"headers,nullable"`
	// Specify which of the MCP server's tools require approval.
	RequireApproval ToolMcpRequireApprovalUnion `json:"require_approval,nullable"`
	// Optional description of the MCP server, used to provide more context.
	ServerDescription string `json:"server_description"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ServerLabel       respjson.Field
		ServerURL         respjson.Field
		Type              respjson.Field
		AllowedTools      respjson.Field
		Headers           respjson.Field
		RequireApproval   respjson.Field
		ServerDescription respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Give the model access to additional tools via remote Model Context Protocol (MCP) servers. [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).

func (ToolMcp) RawJSON added in v1.1.0

func (r ToolMcp) RawJSON() string

Returns the unmodified JSON received from the API

func (*ToolMcp) UnmarshalJSON added in v1.1.0

func (r *ToolMcp) UnmarshalJSON(data []byte) error

type ToolMcpAllowedToolsMcpAllowedToolsFilter added in v1.1.0

type ToolMcpAllowedToolsMcpAllowedToolsFilter struct {
	// List of allowed tool names.
	ToolNames []string `json:"tool_names"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ToolNames   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A filter object to specify which tools are allowed.

func (ToolMcpAllowedToolsMcpAllowedToolsFilter) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ToolMcpAllowedToolsMcpAllowedToolsFilter) UnmarshalJSON added in v1.1.0

func (r *ToolMcpAllowedToolsMcpAllowedToolsFilter) UnmarshalJSON(data []byte) error

type ToolMcpAllowedToolsMcpAllowedToolsFilterParam added in v1.1.0

type ToolMcpAllowedToolsMcpAllowedToolsFilterParam struct {
	// List of allowed tool names.
	ToolNames []string `json:"tool_names,omitzero"`
	// contains filtered or unexported fields
}

A filter object to specify which tools are allowed.

func (ToolMcpAllowedToolsMcpAllowedToolsFilterParam) MarshalJSON added in v1.1.0

func (r ToolMcpAllowedToolsMcpAllowedToolsFilterParam) MarshalJSON() (data []byte, err error)

func (*ToolMcpAllowedToolsMcpAllowedToolsFilterParam) UnmarshalJSON added in v1.1.0

func (r *ToolMcpAllowedToolsMcpAllowedToolsFilterParam) UnmarshalJSON(data []byte) error

type ToolMcpAllowedToolsUnion added in v1.1.0

type ToolMcpAllowedToolsUnion struct {
	// This field will be present if the value is a [[]string] instead of an object.
	OfMcpAllowedTools []string `json:",inline"`
	// This field is from variant [ToolMcpAllowedToolsMcpAllowedToolsFilter].
	ToolNames []string `json:"tool_names"`
	JSON      struct {
		OfMcpAllowedTools respjson.Field
		ToolNames         respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ToolMcpAllowedToolsUnion contains all possible properties and values from [[]string], ToolMcpAllowedToolsMcpAllowedToolsFilter.

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfMcpAllowedTools]

func (ToolMcpAllowedToolsUnion) AsMcpAllowedTools added in v1.1.0

func (u ToolMcpAllowedToolsUnion) AsMcpAllowedTools() (v []string)

func (ToolMcpAllowedToolsUnion) AsMcpAllowedToolsFilter added in v1.1.0

func (ToolMcpAllowedToolsUnion) RawJSON added in v1.1.0

func (u ToolMcpAllowedToolsUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*ToolMcpAllowedToolsUnion) UnmarshalJSON added in v1.1.0

func (r *ToolMcpAllowedToolsUnion) UnmarshalJSON(data []byte) error

type ToolMcpAllowedToolsUnionParam added in v1.1.0

type ToolMcpAllowedToolsUnionParam struct {
	OfMcpAllowedTools       []string                                       `json:",omitzero,inline"`
	OfMcpAllowedToolsFilter *ToolMcpAllowedToolsMcpAllowedToolsFilterParam `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ToolMcpAllowedToolsUnionParam) MarshalJSON added in v1.1.0

func (u ToolMcpAllowedToolsUnionParam) MarshalJSON() ([]byte, error)

func (*ToolMcpAllowedToolsUnionParam) UnmarshalJSON added in v1.1.0

func (u *ToolMcpAllowedToolsUnionParam) UnmarshalJSON(data []byte) error

type ToolMcpParam added in v1.1.0

type ToolMcpParam struct {
	// A label for this MCP server, used to identify it in tool calls.
	ServerLabel string `json:"server_label,required"`
	// The URL for the MCP server.
	ServerURL string `json:"server_url,required"`
	// Optional description of the MCP server, used to provide more context.
	ServerDescription param.Opt[string] `json:"server_description,omitzero"`
	// List of allowed tool names or a filter object.
	AllowedTools ToolMcpAllowedToolsUnionParam `json:"allowed_tools,omitzero"`
	// Optional HTTP headers to send to the MCP server. Use for authentication or other
	// purposes.
	Headers map[string]string `json:"headers,omitzero"`
	// Specify which of the MCP server's tools require approval.
	RequireApproval ToolMcpRequireApprovalUnionParam `json:"require_approval,omitzero"`
	// The type of the MCP tool. Always `mcp`.
	//
	// This field can be elided, and will marshal its zero value as "mcp".
	Type constant.Mcp `json:"type,required"`
	// contains filtered or unexported fields
}

Give the model access to additional tools via remote Model Context Protocol (MCP) servers. [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).

The properties ServerLabel, ServerURL, Type are required.

func (ToolMcpParam) MarshalJSON added in v1.1.0

func (r ToolMcpParam) MarshalJSON() (data []byte, err error)

func (*ToolMcpParam) UnmarshalJSON added in v1.1.0

func (r *ToolMcpParam) UnmarshalJSON(data []byte) error

type ToolMcpRequireApprovalMcpToolApprovalFilter added in v1.1.0

type ToolMcpRequireApprovalMcpToolApprovalFilter struct {
	// A list of tools that always require approval.
	Always ToolMcpRequireApprovalMcpToolApprovalFilterAlways `json:"always"`
	// A list of tools that never require approval.
	Never ToolMcpRequireApprovalMcpToolApprovalFilterNever `json:"never"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Always      respjson.Field
		Never       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ToolMcpRequireApprovalMcpToolApprovalFilter) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ToolMcpRequireApprovalMcpToolApprovalFilter) UnmarshalJSON added in v1.1.0

func (r *ToolMcpRequireApprovalMcpToolApprovalFilter) UnmarshalJSON(data []byte) error

type ToolMcpRequireApprovalMcpToolApprovalFilterAlways added in v1.1.0

type ToolMcpRequireApprovalMcpToolApprovalFilterAlways struct {
	// List of tools that require approval.
	ToolNames []string `json:"tool_names"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ToolNames   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A list of tools that always require approval.

func (ToolMcpRequireApprovalMcpToolApprovalFilterAlways) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ToolMcpRequireApprovalMcpToolApprovalFilterAlways) UnmarshalJSON added in v1.1.0

type ToolMcpRequireApprovalMcpToolApprovalFilterAlwaysParam added in v1.1.0

type ToolMcpRequireApprovalMcpToolApprovalFilterAlwaysParam struct {
	// List of tools that require approval.
	ToolNames []string `json:"tool_names,omitzero"`
	// contains filtered or unexported fields
}

A list of tools that always require approval.

func (ToolMcpRequireApprovalMcpToolApprovalFilterAlwaysParam) MarshalJSON added in v1.1.0

func (*ToolMcpRequireApprovalMcpToolApprovalFilterAlwaysParam) UnmarshalJSON added in v1.1.0

type ToolMcpRequireApprovalMcpToolApprovalFilterNever added in v1.1.0

type ToolMcpRequireApprovalMcpToolApprovalFilterNever struct {
	// List of tools that do not require approval.
	ToolNames []string `json:"tool_names"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ToolNames   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A list of tools that never require approval.

func (ToolMcpRequireApprovalMcpToolApprovalFilterNever) RawJSON added in v1.1.0

Returns the unmodified JSON received from the API

func (*ToolMcpRequireApprovalMcpToolApprovalFilterNever) UnmarshalJSON added in v1.1.0

type ToolMcpRequireApprovalMcpToolApprovalFilterNeverParam added in v1.1.0

type ToolMcpRequireApprovalMcpToolApprovalFilterNeverParam struct {
	// List of tools that do not require approval.
	ToolNames []string `json:"tool_names,omitzero"`
	// contains filtered or unexported fields
}

A list of tools that never require approval.

func (ToolMcpRequireApprovalMcpToolApprovalFilterNeverParam) MarshalJSON added in v1.1.0

func (*ToolMcpRequireApprovalMcpToolApprovalFilterNeverParam) UnmarshalJSON added in v1.1.0

type ToolMcpRequireApprovalMcpToolApprovalFilterParam added in v1.1.0

type ToolMcpRequireApprovalMcpToolApprovalFilterParam struct {
	// A list of tools that always require approval.
	Always ToolMcpRequireApprovalMcpToolApprovalFilterAlwaysParam `json:"always,omitzero"`
	// A list of tools that never require approval.
	Never ToolMcpRequireApprovalMcpToolApprovalFilterNeverParam `json:"never,omitzero"`
	// contains filtered or unexported fields
}

func (ToolMcpRequireApprovalMcpToolApprovalFilterParam) MarshalJSON added in v1.1.0

func (r ToolMcpRequireApprovalMcpToolApprovalFilterParam) MarshalJSON() (data []byte, err error)

func (*ToolMcpRequireApprovalMcpToolApprovalFilterParam) UnmarshalJSON added in v1.1.0

type ToolMcpRequireApprovalMcpToolApprovalSetting added in v1.1.0

type ToolMcpRequireApprovalMcpToolApprovalSetting string

Specify a single approval policy for all tools. One of `always` or `never`. When set to `always`, all tools will require approval. When set to `never`, all tools will not require approval.

const (
	ToolMcpRequireApprovalMcpToolApprovalSettingAlways ToolMcpRequireApprovalMcpToolApprovalSetting = "always"
	ToolMcpRequireApprovalMcpToolApprovalSettingNever  ToolMcpRequireApprovalMcpToolApprovalSetting = "never"
)

type ToolMcpRequireApprovalUnion added in v1.1.0

type ToolMcpRequireApprovalUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfMcpToolApprovalSetting string `json:",inline"`
	// This field is from variant [ToolMcpRequireApprovalMcpToolApprovalFilter].
	Always ToolMcpRequireApprovalMcpToolApprovalFilterAlways `json:"always"`
	// This field is from variant [ToolMcpRequireApprovalMcpToolApprovalFilter].
	Never ToolMcpRequireApprovalMcpToolApprovalFilterNever `json:"never"`
	JSON  struct {
		OfMcpToolApprovalSetting respjson.Field
		Always                   respjson.Field
		Never                    respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ToolMcpRequireApprovalUnion contains all possible properties and values from ToolMcpRequireApprovalMcpToolApprovalFilter, [string].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfMcpToolApprovalSetting]

func (ToolMcpRequireApprovalUnion) AsMcpToolApprovalFilter added in v1.1.0

func (ToolMcpRequireApprovalUnion) AsMcpToolApprovalSetting added in v1.1.0

func (u ToolMcpRequireApprovalUnion) AsMcpToolApprovalSetting() (v string)

func (ToolMcpRequireApprovalUnion) RawJSON added in v1.1.0

func (u ToolMcpRequireApprovalUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*ToolMcpRequireApprovalUnion) UnmarshalJSON added in v1.1.0

func (r *ToolMcpRequireApprovalUnion) UnmarshalJSON(data []byte) error

type ToolMcpRequireApprovalUnionParam added in v1.1.0

type ToolMcpRequireApprovalUnionParam struct {
	OfMcpToolApprovalFilter *ToolMcpRequireApprovalMcpToolApprovalFilterParam `json:",omitzero,inline"`
	// Check if union is this variant with
	// !param.IsOmitted(union.OfMcpToolApprovalSetting)
	OfMcpToolApprovalSetting param.Opt[string] `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (ToolMcpRequireApprovalUnionParam) MarshalJSON added in v1.1.0

func (u ToolMcpRequireApprovalUnionParam) MarshalJSON() ([]byte, error)

func (*ToolMcpRequireApprovalUnionParam) UnmarshalJSON added in v1.1.0

func (u *ToolMcpRequireApprovalUnionParam) UnmarshalJSON(data []byte) error

type ToolUnion

type ToolUnion struct {
	// This field is from variant [FunctionTool].
	Name string `json:"name"`
	// This field is from variant [FunctionTool].
	Parameters map[string]any `json:"parameters"`
	// This field is from variant [FunctionTool].
	Strict bool `json:"strict"`
	// Any of "function", "file_search", nil, "computer_use_preview", "mcp",
	// "code_interpreter", "image_generation", "local_shell".
	Type string `json:"type"`
	// This field is from variant [FunctionTool].
	Description string `json:"description"`
	// This field is from variant [FileSearchTool].
	VectorStoreIDs []string `json:"vector_store_ids"`
	// This field is from variant [FileSearchTool].
	Filters FileSearchToolFiltersUnion `json:"filters"`
	// This field is from variant [FileSearchTool].
	MaxNumResults int64 `json:"max_num_results"`
	// This field is from variant [FileSearchTool].
	RankingOptions FileSearchToolRankingOptions `json:"ranking_options"`
	// This field is from variant [WebSearchTool].
	SearchContextSize WebSearchToolSearchContextSize `json:"search_context_size"`
	// This field is from variant [WebSearchTool].
	UserLocation WebSearchToolUserLocation `json:"user_location"`
	// This field is from variant [ComputerTool].
	DisplayHeight int64 `json:"display_height"`
	// This field is from variant [ComputerTool].
	DisplayWidth int64 `json:"display_width"`
	// This field is from variant [ComputerTool].
	Environment ComputerToolEnvironment `json:"environment"`
	// This field is from variant [ToolMcp].
	ServerLabel string `json:"server_label"`
	// This field is from variant [ToolMcp].
	ServerURL string `json:"server_url"`
	// This field is from variant [ToolMcp].
	AllowedTools ToolMcpAllowedToolsUnion `json:"allowed_tools"`
	// This field is from variant [ToolMcp].
	Headers map[string]string `json:"headers"`
	// This field is from variant [ToolMcp].
	RequireApproval ToolMcpRequireApprovalUnion `json:"require_approval"`
	// This field is from variant [ToolMcp].
	ServerDescription string `json:"server_description"`
	// This field is from variant [ToolCodeInterpreter].
	Container ToolCodeInterpreterContainerUnion `json:"container"`
	// This field is from variant [ToolImageGeneration].
	Background string `json:"background"`
	// This field is from variant [ToolImageGeneration].
	InputFidelity string `json:"input_fidelity"`
	// This field is from variant [ToolImageGeneration].
	InputImageMask ToolImageGenerationInputImageMask `json:"input_image_mask"`
	// This field is from variant [ToolImageGeneration].
	Model string `json:"model"`
	// This field is from variant [ToolImageGeneration].
	Moderation string `json:"moderation"`
	// This field is from variant [ToolImageGeneration].
	OutputCompression int64 `json:"output_compression"`
	// This field is from variant [ToolImageGeneration].
	OutputFormat string `json:"output_format"`
	// This field is from variant [ToolImageGeneration].
	PartialImages int64 `json:"partial_images"`
	// This field is from variant [ToolImageGeneration].
	Quality string `json:"quality"`
	// This field is from variant [ToolImageGeneration].
	Size string `json:"size"`
	JSON struct {
		Name              respjson.Field
		Parameters        respjson.Field
		Strict            respjson.Field
		Type              respjson.Field
		Description       respjson.Field
		VectorStoreIDs    respjson.Field
		Filters           respjson.Field
		MaxNumResults     respjson.Field
		RankingOptions    respjson.Field
		SearchContextSize respjson.Field
		UserLocation      respjson.Field
		DisplayHeight     respjson.Field
		DisplayWidth      respjson.Field
		Environment       respjson.Field
		ServerLabel       respjson.Field
		ServerURL         respjson.Field
		AllowedTools      respjson.Field
		Headers           respjson.Field
		RequireApproval   respjson.Field
		ServerDescription respjson.Field
		Container         respjson.Field
		Background        respjson.Field
		InputFidelity     respjson.Field
		InputImageMask    respjson.Field
		Model             respjson.Field
		Moderation        respjson.Field
		OutputCompression respjson.Field
		OutputFormat      respjson.Field
		PartialImages     respjson.Field
		Quality           respjson.Field
		Size              respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ToolUnion contains all possible properties and values from FunctionTool, FileSearchTool, WebSearchTool, ComputerTool, ToolMcp, ToolCodeInterpreter, ToolImageGeneration, ToolLocalShell.

Use the [ToolUnion.AsAny] method to switch on the variant.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ToolUnion) AsCodeInterpreter added in v1.1.0

func (u ToolUnion) AsCodeInterpreter() (v ToolCodeInterpreter)

func (ToolUnion) AsComputerUsePreview

func (u ToolUnion) AsComputerUsePreview() (v ComputerTool)

func (ToolUnion) AsFileSearch

func (u ToolUnion) AsFileSearch() (v FileSearchTool)

func (ToolUnion) AsFunction

func (u ToolUnion) AsFunction() (v FunctionTool)

func (ToolUnion) AsImageGeneration added in v1.1.0

func (u ToolUnion) AsImageGeneration() (v ToolImageGeneration)

func (ToolUnion) AsLocalShell added in v1.1.0

func (u ToolUnion) AsLocalShell() (v ToolLocalShell)

func (ToolUnion) AsMcp added in v1.1.0

func (u ToolUnion) AsMcp() (v ToolMcp)

func (ToolUnion) AsWebSearchPreview

func (u ToolUnion) AsWebSearchPreview() (v WebSearchTool)

func (ToolUnion) RawJSON

func (u ToolUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (ToolUnion) ToParam

func (r ToolUnion) ToParam() ToolUnionParam

ToParam converts this ToolUnion to a ToolUnionParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with ToolUnionParam.Overrides()

func (*ToolUnion) UnmarshalJSON

func (r *ToolUnion) UnmarshalJSON(data []byte) error

type ToolUnionParam

type ToolUnionParam struct {
	OfFunction           *FunctionToolParam        `json:",omitzero,inline"`
	OfFileSearch         *FileSearchToolParam      `json:",omitzero,inline"`
	OfWebSearchPreview   *WebSearchToolParam       `json:",omitzero,inline"`
	OfComputerUsePreview *ComputerToolParam        `json:",omitzero,inline"`
	OfMcp                *ToolMcpParam             `json:",omitzero,inline"`
	OfCodeInterpreter    *ToolCodeInterpreterParam `json:",omitzero,inline"`
	OfImageGeneration    *ToolImageGenerationParam `json:",omitzero,inline"`
	OfLocalShell         *ToolLocalShellParam      `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func ToolParamOfCodeInterpreter added in v1.1.0

func ToolParamOfCodeInterpreter[
	T string | ToolCodeInterpreterContainerCodeInterpreterContainerAutoParam,
](container T) ToolUnionParam

func ToolParamOfComputerUsePreview

func ToolParamOfComputerUsePreview(displayHeight int64, displayWidth int64, environment ComputerToolEnvironment) ToolUnionParam

func ToolParamOfFileSearch

func ToolParamOfFileSearch(vectorStoreIDs []string) ToolUnionParam

func ToolParamOfFunction

func ToolParamOfFunction(name string, parameters map[string]any, strict bool) ToolUnionParam

func ToolParamOfMcp added in v1.1.0

func ToolParamOfMcp(serverLabel string, serverURL string) ToolUnionParam

func ToolParamOfWebSearchPreview

func ToolParamOfWebSearchPreview(type_ WebSearchToolType) ToolUnionParam

func (ToolUnionParam) GetAllowedTools added in v1.1.0

func (u ToolUnionParam) GetAllowedTools() *ToolMcpAllowedToolsUnionParam

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetBackground added in v1.1.0

func (u ToolUnionParam) GetBackground() *string

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetContainer added in v1.1.0

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetDescription

func (u ToolUnionParam) GetDescription() *string

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetDisplayHeight

func (u ToolUnionParam) GetDisplayHeight() *int64

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetDisplayWidth

func (u ToolUnionParam) GetDisplayWidth() *int64

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetEnvironment

func (u ToolUnionParam) GetEnvironment() *string

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetFilters

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetHeaders added in v1.1.0

func (u ToolUnionParam) GetHeaders() map[string]string

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetInputFidelity added in v1.11.0

func (u ToolUnionParam) GetInputFidelity() *string

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetInputImageMask added in v1.1.0

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetMaxNumResults

func (u ToolUnionParam) GetMaxNumResults() *int64

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetModel added in v1.1.0

func (u ToolUnionParam) GetModel() *string

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetModeration added in v1.1.0

func (u ToolUnionParam) GetModeration() *string

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetName

func (u ToolUnionParam) GetName() *string

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetOutputCompression added in v1.1.0

func (u ToolUnionParam) GetOutputCompression() *int64

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetOutputFormat added in v1.1.0

func (u ToolUnionParam) GetOutputFormat() *string

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetParameters

func (u ToolUnionParam) GetParameters() map[string]any

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetPartialImages added in v1.1.0

func (u ToolUnionParam) GetPartialImages() *int64

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetQuality added in v1.1.0

func (u ToolUnionParam) GetQuality() *string

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetRankingOptions

func (u ToolUnionParam) GetRankingOptions() *FileSearchToolRankingOptionsParam

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetRequireApproval added in v1.1.0

func (u ToolUnionParam) GetRequireApproval() *ToolMcpRequireApprovalUnionParam

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetSearchContextSize

func (u ToolUnionParam) GetSearchContextSize() *string

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetServerDescription added in v1.10.0

func (u ToolUnionParam) GetServerDescription() *string

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetServerLabel added in v1.1.0

func (u ToolUnionParam) GetServerLabel() *string

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetServerURL added in v1.1.0

func (u ToolUnionParam) GetServerURL() *string

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetSize added in v1.1.0

func (u ToolUnionParam) GetSize() *string

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetStrict

func (u ToolUnionParam) GetStrict() *bool

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetType

func (u ToolUnionParam) GetType() *string

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetUserLocation

func (u ToolUnionParam) GetUserLocation() *WebSearchToolUserLocationParam

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) GetVectorStoreIDs

func (u ToolUnionParam) GetVectorStoreIDs() []string

Returns a pointer to the underlying variant's property, if present.

func (ToolUnionParam) MarshalJSON

func (u ToolUnionParam) MarshalJSON() ([]byte, error)

func (*ToolUnionParam) UnmarshalJSON

func (u *ToolUnionParam) UnmarshalJSON(data []byte) error

type WebSearchTool

type WebSearchTool struct {
	// The type of the web search tool. One of `web_search_preview` or
	// `web_search_preview_2025_03_11`.
	//
	// Any of "web_search_preview", "web_search_preview_2025_03_11".
	Type WebSearchToolType `json:"type,required"`
	// High level guidance for the amount of context window space to use for the
	// search. One of `low`, `medium`, or `high`. `medium` is the default.
	//
	// Any of "low", "medium", "high".
	SearchContextSize WebSearchToolSearchContextSize `json:"search_context_size"`
	// The user's location.
	UserLocation WebSearchToolUserLocation `json:"user_location,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type              respjson.Field
		SearchContextSize respjson.Field
		UserLocation      respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](https://platform.openai.com/docs/guides/tools-web-search).

func (WebSearchTool) RawJSON

func (r WebSearchTool) RawJSON() string

Returns the unmodified JSON received from the API

func (WebSearchTool) ToParam

func (r WebSearchTool) ToParam() WebSearchToolParam

ToParam converts this WebSearchTool to a WebSearchToolParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with WebSearchToolParam.Overrides()

func (*WebSearchTool) UnmarshalJSON

func (r *WebSearchTool) UnmarshalJSON(data []byte) error

type WebSearchToolParam

type WebSearchToolParam struct {
	// The type of the web search tool. One of `web_search_preview` or
	// `web_search_preview_2025_03_11`.
	//
	// Any of "web_search_preview", "web_search_preview_2025_03_11".
	Type WebSearchToolType `json:"type,omitzero,required"`
	// The user's location.
	UserLocation WebSearchToolUserLocationParam `json:"user_location,omitzero"`
	// High level guidance for the amount of context window space to use for the
	// search. One of `low`, `medium`, or `high`. `medium` is the default.
	//
	// Any of "low", "medium", "high".
	SearchContextSize WebSearchToolSearchContextSize `json:"search_context_size,omitzero"`
	// contains filtered or unexported fields
}

This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](https://platform.openai.com/docs/guides/tools-web-search).

The property Type is required.

func (WebSearchToolParam) MarshalJSON

func (r WebSearchToolParam) MarshalJSON() (data []byte, err error)

func (*WebSearchToolParam) UnmarshalJSON

func (r *WebSearchToolParam) UnmarshalJSON(data []byte) error

type WebSearchToolSearchContextSize

type WebSearchToolSearchContextSize string

High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default.

const (
	WebSearchToolSearchContextSizeLow    WebSearchToolSearchContextSize = "low"
	WebSearchToolSearchContextSizeMedium WebSearchToolSearchContextSize = "medium"
	WebSearchToolSearchContextSizeHigh   WebSearchToolSearchContextSize = "high"
)

type WebSearchToolType

type WebSearchToolType string

The type of the web search tool. One of `web_search_preview` or `web_search_preview_2025_03_11`.

const (
	WebSearchToolTypeWebSearchPreview           WebSearchToolType = "web_search_preview"
	WebSearchToolTypeWebSearchPreview2025_03_11 WebSearchToolType = "web_search_preview_2025_03_11"
)

type WebSearchToolUserLocation

type WebSearchToolUserLocation struct {
	// The type of location approximation. Always `approximate`.
	Type constant.Approximate `json:"type,required"`
	// Free text input for the city of the user, e.g. `San Francisco`.
	City string `json:"city,nullable"`
	// The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of
	// the user, e.g. `US`.
	Country string `json:"country,nullable"`
	// Free text input for the region of the user, e.g. `California`.
	Region string `json:"region,nullable"`
	// The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the
	// user, e.g. `America/Los_Angeles`.
	Timezone string `json:"timezone,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		City        respjson.Field
		Country     respjson.Field
		Region      respjson.Field
		Timezone    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The user's location.

func (WebSearchToolUserLocation) RawJSON

func (r WebSearchToolUserLocation) RawJSON() string

Returns the unmodified JSON received from the API

func (*WebSearchToolUserLocation) UnmarshalJSON

func (r *WebSearchToolUserLocation) UnmarshalJSON(data []byte) error

type WebSearchToolUserLocationParam

type WebSearchToolUserLocationParam struct {
	// Free text input for the city of the user, e.g. `San Francisco`.
	City param.Opt[string] `json:"city,omitzero"`
	// The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of
	// the user, e.g. `US`.
	Country param.Opt[string] `json:"country,omitzero"`
	// Free text input for the region of the user, e.g. `California`.
	Region param.Opt[string] `json:"region,omitzero"`
	// The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the
	// user, e.g. `America/Los_Angeles`.
	Timezone param.Opt[string] `json:"timezone,omitzero"`
	// The type of location approximation. Always `approximate`.
	//
	// This field can be elided, and will marshal its zero value as "approximate".
	Type constant.Approximate `json:"type,required"`
	// contains filtered or unexported fields
}

The user's location.

The property Type is required.

func (WebSearchToolUserLocationParam) MarshalJSON

func (r WebSearchToolUserLocationParam) MarshalJSON() (data []byte, err error)

func (*WebSearchToolUserLocationParam) UnmarshalJSON

func (r *WebSearchToolUserLocationParam) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL