response.go

    1// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
    2
    3package responses
    4
    5import (
    6	"context"
    7	"encoding/json"
    8	"errors"
    9	"fmt"
   10	"net/http"
   11	"net/url"
   12	"strings"
   13
   14	"github.com/openai/openai-go/internal/apijson"
   15	"github.com/openai/openai-go/internal/apiquery"
   16	"github.com/openai/openai-go/internal/paramutil"
   17	"github.com/openai/openai-go/internal/requestconfig"
   18	"github.com/openai/openai-go/option"
   19	"github.com/openai/openai-go/packages/param"
   20	"github.com/openai/openai-go/packages/respjson"
   21	"github.com/openai/openai-go/packages/ssestream"
   22	"github.com/openai/openai-go/shared"
   23	"github.com/openai/openai-go/shared/constant"
   24)
   25
   26// ResponseService contains methods and other services that help with interacting
   27// with the openai API.
   28//
   29// Note, unlike clients, this service does not read variables from the environment
   30// automatically. You should not instantiate this service directly, and instead use
   31// the [NewResponseService] method instead.
   32type ResponseService struct {
   33	Options    []option.RequestOption
   34	InputItems InputItemService
   35}
   36
   37// NewResponseService generates a new service that applies the given options to
   38// each request. These options are applied after the parent client's options (if
   39// there is one), and before any request-specific options.
   40func NewResponseService(opts ...option.RequestOption) (r ResponseService) {
   41	r = ResponseService{}
   42	r.Options = opts
   43	r.InputItems = NewInputItemService(opts...)
   44	return
   45}
   46
   47// Creates a model response. Provide
   48// [text](https://platform.openai.com/docs/guides/text) or
   49// [image](https://platform.openai.com/docs/guides/images) inputs to generate
   50// [text](https://platform.openai.com/docs/guides/text) or
   51// [JSON](https://platform.openai.com/docs/guides/structured-outputs) outputs. Have
   52// the model call your own
   53// [custom code](https://platform.openai.com/docs/guides/function-calling) or use
   54// built-in [tools](https://platform.openai.com/docs/guides/tools) like
   55// [web search](https://platform.openai.com/docs/guides/tools-web-search) or
   56// [file search](https://platform.openai.com/docs/guides/tools-file-search) to use
   57// your own data as input for the model's response.
   58func (r *ResponseService) New(ctx context.Context, body ResponseNewParams, opts ...option.RequestOption) (res *Response, err error) {
   59	opts = append(r.Options[:], opts...)
   60	path := "responses"
   61	err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
   62	return
   63}
   64
   65// Creates a model response. Provide
   66// [text](https://platform.openai.com/docs/guides/text) or
   67// [image](https://platform.openai.com/docs/guides/images) inputs to generate
   68// [text](https://platform.openai.com/docs/guides/text) or
   69// [JSON](https://platform.openai.com/docs/guides/structured-outputs) outputs. Have
   70// the model call your own
   71// [custom code](https://platform.openai.com/docs/guides/function-calling) or use
   72// built-in [tools](https://platform.openai.com/docs/guides/tools) like
   73// [web search](https://platform.openai.com/docs/guides/tools-web-search) or
   74// [file search](https://platform.openai.com/docs/guides/tools-file-search) to use
   75// your own data as input for the model's response.
   76func (r *ResponseService) NewStreaming(ctx context.Context, body ResponseNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[ResponseStreamEventUnion]) {
   77	var (
   78		raw *http.Response
   79		err error
   80	)
   81	opts = append(r.Options[:], opts...)
   82	opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
   83	path := "responses"
   84	err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &raw, opts...)
   85	return ssestream.NewStream[ResponseStreamEventUnion](ssestream.NewDecoder(raw), err)
   86}
   87
   88// Retrieves a model response with the given ID.
   89func (r *ResponseService) Get(ctx context.Context, responseID string, query ResponseGetParams, opts ...option.RequestOption) (res *Response, err error) {
   90	opts = append(r.Options[:], opts...)
   91	if responseID == "" {
   92		err = errors.New("missing required response_id parameter")
   93		return
   94	}
   95	path := fmt.Sprintf("responses/%s", responseID)
   96	err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
   97	return
   98}
   99
  100// Retrieves a model response with the given ID.
  101func (r *ResponseService) GetStreaming(ctx context.Context, responseID string, query ResponseGetParams, opts ...option.RequestOption) (stream *ssestream.Stream[ResponseStreamEventUnion]) {
  102	var (
  103		raw *http.Response
  104		err error
  105	)
  106	opts = append(r.Options[:], opts...)
  107	opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
  108	if responseID == "" {
  109		err = errors.New("missing required response_id parameter")
  110		return
  111	}
  112	path := fmt.Sprintf("responses/%s", responseID)
  113	err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &raw, opts...)
  114	return ssestream.NewStream[ResponseStreamEventUnion](ssestream.NewDecoder(raw), err)
  115}
  116
  117// Deletes a model response with the given ID.
  118func (r *ResponseService) Delete(ctx context.Context, responseID string, opts ...option.RequestOption) (err error) {
  119	opts = append(r.Options[:], opts...)
  120	opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
  121	if responseID == "" {
  122		err = errors.New("missing required response_id parameter")
  123		return
  124	}
  125	path := fmt.Sprintf("responses/%s", responseID)
  126	err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...)
  127	return
  128}
  129
  130// Cancels a model response with the given ID. Only responses created with the
  131// `background` parameter set to `true` can be cancelled.
  132// [Learn more](https://platform.openai.com/docs/guides/background).
  133func (r *ResponseService) Cancel(ctx context.Context, responseID string, opts ...option.RequestOption) (res *Response, err error) {
  134	opts = append(r.Options[:], opts...)
  135	if responseID == "" {
  136		err = errors.New("missing required response_id parameter")
  137		return
  138	}
  139	path := fmt.Sprintf("responses/%s/cancel", responseID)
  140	err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
  141	return
  142}
  143
  144// A tool that controls a virtual computer. Learn more about the
  145// [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).
  146type ComputerTool struct {
  147	// The height of the computer display.
  148	DisplayHeight int64 `json:"display_height,required"`
  149	// The width of the computer display.
  150	DisplayWidth int64 `json:"display_width,required"`
  151	// The type of computer environment to control.
  152	//
  153	// Any of "windows", "mac", "linux", "ubuntu", "browser".
  154	Environment ComputerToolEnvironment `json:"environment,required"`
  155	// The type of the computer use tool. Always `computer_use_preview`.
  156	Type constant.ComputerUsePreview `json:"type,required"`
  157	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  158	JSON struct {
  159		DisplayHeight respjson.Field
  160		DisplayWidth  respjson.Field
  161		Environment   respjson.Field
  162		Type          respjson.Field
  163		ExtraFields   map[string]respjson.Field
  164		raw           string
  165	} `json:"-"`
  166}
  167
  168// Returns the unmodified JSON received from the API
  169func (r ComputerTool) RawJSON() string { return r.JSON.raw }
  170func (r *ComputerTool) UnmarshalJSON(data []byte) error {
  171	return apijson.UnmarshalRoot(data, r)
  172}
  173
  174// ToParam converts this ComputerTool to a ComputerToolParam.
  175//
  176// Warning: the fields of the param type will not be present. ToParam should only
  177// be used at the last possible moment before sending a request. Test for this with
  178// ComputerToolParam.Overrides()
  179func (r ComputerTool) ToParam() ComputerToolParam {
  180	return param.Override[ComputerToolParam](json.RawMessage(r.RawJSON()))
  181}
  182
  183// The type of computer environment to control.
  184type ComputerToolEnvironment string
  185
  186const (
  187	ComputerToolEnvironmentWindows ComputerToolEnvironment = "windows"
  188	ComputerToolEnvironmentMac     ComputerToolEnvironment = "mac"
  189	ComputerToolEnvironmentLinux   ComputerToolEnvironment = "linux"
  190	ComputerToolEnvironmentUbuntu  ComputerToolEnvironment = "ubuntu"
  191	ComputerToolEnvironmentBrowser ComputerToolEnvironment = "browser"
  192)
  193
  194// A tool that controls a virtual computer. Learn more about the
  195// [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).
  196//
  197// The properties DisplayHeight, DisplayWidth, Environment, Type are required.
  198type ComputerToolParam struct {
  199	// The height of the computer display.
  200	DisplayHeight int64 `json:"display_height,required"`
  201	// The width of the computer display.
  202	DisplayWidth int64 `json:"display_width,required"`
  203	// The type of computer environment to control.
  204	//
  205	// Any of "windows", "mac", "linux", "ubuntu", "browser".
  206	Environment ComputerToolEnvironment `json:"environment,omitzero,required"`
  207	// The type of the computer use tool. Always `computer_use_preview`.
  208	//
  209	// This field can be elided, and will marshal its zero value as
  210	// "computer_use_preview".
  211	Type constant.ComputerUsePreview `json:"type,required"`
  212	paramObj
  213}
  214
  215func (r ComputerToolParam) MarshalJSON() (data []byte, err error) {
  216	type shadow ComputerToolParam
  217	return param.MarshalObject(r, (*shadow)(&r))
  218}
  219func (r *ComputerToolParam) UnmarshalJSON(data []byte) error {
  220	return apijson.UnmarshalRoot(data, r)
  221}
  222
  223// A message input to the model with a role indicating instruction following
  224// hierarchy. Instructions given with the `developer` or `system` role take
  225// precedence over instructions given with the `user` role. Messages with the
  226// `assistant` role are presumed to have been generated by the model in previous
  227// interactions.
  228type EasyInputMessage struct {
  229	// Text, image, or audio input to the model, used to generate a response. Can also
  230	// contain previous assistant responses.
  231	Content EasyInputMessageContentUnion `json:"content,required"`
  232	// The role of the message input. One of `user`, `assistant`, `system`, or
  233	// `developer`.
  234	//
  235	// Any of "user", "assistant", "system", "developer".
  236	Role EasyInputMessageRole `json:"role,required"`
  237	// The type of the message input. Always `message`.
  238	//
  239	// Any of "message".
  240	Type EasyInputMessageType `json:"type"`
  241	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  242	JSON struct {
  243		Content     respjson.Field
  244		Role        respjson.Field
  245		Type        respjson.Field
  246		ExtraFields map[string]respjson.Field
  247		raw         string
  248	} `json:"-"`
  249}
  250
  251// Returns the unmodified JSON received from the API
  252func (r EasyInputMessage) RawJSON() string { return r.JSON.raw }
  253func (r *EasyInputMessage) UnmarshalJSON(data []byte) error {
  254	return apijson.UnmarshalRoot(data, r)
  255}
  256
  257// ToParam converts this EasyInputMessage to a EasyInputMessageParam.
  258//
  259// Warning: the fields of the param type will not be present. ToParam should only
  260// be used at the last possible moment before sending a request. Test for this with
  261// EasyInputMessageParam.Overrides()
  262func (r EasyInputMessage) ToParam() EasyInputMessageParam {
  263	return param.Override[EasyInputMessageParam](json.RawMessage(r.RawJSON()))
  264}
  265
  266// EasyInputMessageContentUnion contains all possible properties and values from
  267// [string], [ResponseInputMessageContentList].
  268//
  269// Use the methods beginning with 'As' to cast the union to one of its variants.
  270//
  271// If the underlying value is not a json object, one of the following properties
  272// will be valid: OfString OfInputItemContentList]
  273type EasyInputMessageContentUnion struct {
  274	// This field will be present if the value is a [string] instead of an object.
  275	OfString string `json:",inline"`
  276	// This field will be present if the value is a [ResponseInputMessageContentList]
  277	// instead of an object.
  278	OfInputItemContentList ResponseInputMessageContentList `json:",inline"`
  279	JSON                   struct {
  280		OfString               respjson.Field
  281		OfInputItemContentList respjson.Field
  282		raw                    string
  283	} `json:"-"`
  284}
  285
  286func (u EasyInputMessageContentUnion) AsString() (v string) {
  287	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  288	return
  289}
  290
  291func (u EasyInputMessageContentUnion) AsInputItemContentList() (v ResponseInputMessageContentList) {
  292	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  293	return
  294}
  295
  296// Returns the unmodified JSON received from the API
  297func (u EasyInputMessageContentUnion) RawJSON() string { return u.JSON.raw }
  298
  299func (r *EasyInputMessageContentUnion) UnmarshalJSON(data []byte) error {
  300	return apijson.UnmarshalRoot(data, r)
  301}
  302
  303// The role of the message input. One of `user`, `assistant`, `system`, or
  304// `developer`.
  305type EasyInputMessageRole string
  306
  307const (
  308	EasyInputMessageRoleUser      EasyInputMessageRole = "user"
  309	EasyInputMessageRoleAssistant EasyInputMessageRole = "assistant"
  310	EasyInputMessageRoleSystem    EasyInputMessageRole = "system"
  311	EasyInputMessageRoleDeveloper EasyInputMessageRole = "developer"
  312)
  313
  314// The type of the message input. Always `message`.
  315type EasyInputMessageType string
  316
  317const (
  318	EasyInputMessageTypeMessage EasyInputMessageType = "message"
  319)
  320
  321// A message input to the model with a role indicating instruction following
  322// hierarchy. Instructions given with the `developer` or `system` role take
  323// precedence over instructions given with the `user` role. Messages with the
  324// `assistant` role are presumed to have been generated by the model in previous
  325// interactions.
  326//
  327// The properties Content, Role are required.
  328type EasyInputMessageParam struct {
  329	// Text, image, or audio input to the model, used to generate a response. Can also
  330	// contain previous assistant responses.
  331	Content EasyInputMessageContentUnionParam `json:"content,omitzero,required"`
  332	// The role of the message input. One of `user`, `assistant`, `system`, or
  333	// `developer`.
  334	//
  335	// Any of "user", "assistant", "system", "developer".
  336	Role EasyInputMessageRole `json:"role,omitzero,required"`
  337	// The type of the message input. Always `message`.
  338	//
  339	// Any of "message".
  340	Type EasyInputMessageType `json:"type,omitzero"`
  341	paramObj
  342}
  343
  344func (r EasyInputMessageParam) MarshalJSON() (data []byte, err error) {
  345	type shadow EasyInputMessageParam
  346	return param.MarshalObject(r, (*shadow)(&r))
  347}
  348func (r *EasyInputMessageParam) UnmarshalJSON(data []byte) error {
  349	return apijson.UnmarshalRoot(data, r)
  350}
  351
  352// Only one field can be non-zero.
  353//
  354// Use [param.IsOmitted] to confirm if a field is set.
  355type EasyInputMessageContentUnionParam struct {
  356	OfString               param.Opt[string]                    `json:",omitzero,inline"`
  357	OfInputItemContentList ResponseInputMessageContentListParam `json:",omitzero,inline"`
  358	paramUnion
  359}
  360
  361func (u EasyInputMessageContentUnionParam) MarshalJSON() ([]byte, error) {
  362	return param.MarshalUnion(u, u.OfString, u.OfInputItemContentList)
  363}
  364func (u *EasyInputMessageContentUnionParam) UnmarshalJSON(data []byte) error {
  365	return apijson.UnmarshalRoot(data, u)
  366}
  367
  368func (u *EasyInputMessageContentUnionParam) asAny() any {
  369	if !param.IsOmitted(u.OfString) {
  370		return &u.OfString.Value
  371	} else if !param.IsOmitted(u.OfInputItemContentList) {
  372		return &u.OfInputItemContentList
  373	}
  374	return nil
  375}
  376
  377// A tool that searches for relevant content from uploaded files. Learn more about
  378// the
  379// [file search tool](https://platform.openai.com/docs/guides/tools-file-search).
  380type FileSearchTool struct {
  381	// The type of the file search tool. Always `file_search`.
  382	Type constant.FileSearch `json:"type,required"`
  383	// The IDs of the vector stores to search.
  384	VectorStoreIDs []string `json:"vector_store_ids,required"`
  385	// A filter to apply.
  386	Filters FileSearchToolFiltersUnion `json:"filters,nullable"`
  387	// The maximum number of results to return. This number should be between 1 and 50
  388	// inclusive.
  389	MaxNumResults int64 `json:"max_num_results"`
  390	// Ranking options for search.
  391	RankingOptions FileSearchToolRankingOptions `json:"ranking_options"`
  392	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  393	JSON struct {
  394		Type           respjson.Field
  395		VectorStoreIDs respjson.Field
  396		Filters        respjson.Field
  397		MaxNumResults  respjson.Field
  398		RankingOptions respjson.Field
  399		ExtraFields    map[string]respjson.Field
  400		raw            string
  401	} `json:"-"`
  402}
  403
  404// Returns the unmodified JSON received from the API
  405func (r FileSearchTool) RawJSON() string { return r.JSON.raw }
  406func (r *FileSearchTool) UnmarshalJSON(data []byte) error {
  407	return apijson.UnmarshalRoot(data, r)
  408}
  409
  410// ToParam converts this FileSearchTool to a FileSearchToolParam.
  411//
  412// Warning: the fields of the param type will not be present. ToParam should only
  413// be used at the last possible moment before sending a request. Test for this with
  414// FileSearchToolParam.Overrides()
  415func (r FileSearchTool) ToParam() FileSearchToolParam {
  416	return param.Override[FileSearchToolParam](json.RawMessage(r.RawJSON()))
  417}
  418
  419// FileSearchToolFiltersUnion contains all possible properties and values from
  420// [shared.ComparisonFilter], [shared.CompoundFilter].
  421//
  422// Use the methods beginning with 'As' to cast the union to one of its variants.
  423type FileSearchToolFiltersUnion struct {
  424	// This field is from variant [shared.ComparisonFilter].
  425	Key  string `json:"key"`
  426	Type string `json:"type"`
  427	// This field is from variant [shared.ComparisonFilter].
  428	Value shared.ComparisonFilterValueUnion `json:"value"`
  429	// This field is from variant [shared.CompoundFilter].
  430	Filters []shared.ComparisonFilter `json:"filters"`
  431	JSON    struct {
  432		Key     respjson.Field
  433		Type    respjson.Field
  434		Value   respjson.Field
  435		Filters respjson.Field
  436		raw     string
  437	} `json:"-"`
  438}
  439
  440func (u FileSearchToolFiltersUnion) AsComparisonFilter() (v shared.ComparisonFilter) {
  441	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  442	return
  443}
  444
  445func (u FileSearchToolFiltersUnion) AsCompoundFilter() (v shared.CompoundFilter) {
  446	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  447	return
  448}
  449
  450// Returns the unmodified JSON received from the API
  451func (u FileSearchToolFiltersUnion) RawJSON() string { return u.JSON.raw }
  452
  453func (r *FileSearchToolFiltersUnion) UnmarshalJSON(data []byte) error {
  454	return apijson.UnmarshalRoot(data, r)
  455}
  456
  457// Ranking options for search.
  458type FileSearchToolRankingOptions struct {
  459	// The ranker to use for the file search.
  460	//
  461	// Any of "auto", "default-2024-11-15".
  462	Ranker string `json:"ranker"`
  463	// The score threshold for the file search, a number between 0 and 1. Numbers
  464	// closer to 1 will attempt to return only the most relevant results, but may
  465	// return fewer results.
  466	ScoreThreshold float64 `json:"score_threshold"`
  467	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  468	JSON struct {
  469		Ranker         respjson.Field
  470		ScoreThreshold respjson.Field
  471		ExtraFields    map[string]respjson.Field
  472		raw            string
  473	} `json:"-"`
  474}
  475
  476// Returns the unmodified JSON received from the API
  477func (r FileSearchToolRankingOptions) RawJSON() string { return r.JSON.raw }
  478func (r *FileSearchToolRankingOptions) UnmarshalJSON(data []byte) error {
  479	return apijson.UnmarshalRoot(data, r)
  480}
  481
  482// A tool that searches for relevant content from uploaded files. Learn more about
  483// the
  484// [file search tool](https://platform.openai.com/docs/guides/tools-file-search).
  485//
  486// The properties Type, VectorStoreIDs are required.
  487type FileSearchToolParam struct {
  488	// The IDs of the vector stores to search.
  489	VectorStoreIDs []string `json:"vector_store_ids,omitzero,required"`
  490	// The maximum number of results to return. This number should be between 1 and 50
  491	// inclusive.
  492	MaxNumResults param.Opt[int64] `json:"max_num_results,omitzero"`
  493	// A filter to apply.
  494	Filters FileSearchToolFiltersUnionParam `json:"filters,omitzero"`
  495	// Ranking options for search.
  496	RankingOptions FileSearchToolRankingOptionsParam `json:"ranking_options,omitzero"`
  497	// The type of the file search tool. Always `file_search`.
  498	//
  499	// This field can be elided, and will marshal its zero value as "file_search".
  500	Type constant.FileSearch `json:"type,required"`
  501	paramObj
  502}
  503
  504func (r FileSearchToolParam) MarshalJSON() (data []byte, err error) {
  505	type shadow FileSearchToolParam
  506	return param.MarshalObject(r, (*shadow)(&r))
  507}
  508func (r *FileSearchToolParam) UnmarshalJSON(data []byte) error {
  509	return apijson.UnmarshalRoot(data, r)
  510}
  511
  512// Only one field can be non-zero.
  513//
  514// Use [param.IsOmitted] to confirm if a field is set.
  515type FileSearchToolFiltersUnionParam struct {
  516	OfComparisonFilter *shared.ComparisonFilterParam `json:",omitzero,inline"`
  517	OfCompoundFilter   *shared.CompoundFilterParam   `json:",omitzero,inline"`
  518	paramUnion
  519}
  520
  521func (u FileSearchToolFiltersUnionParam) MarshalJSON() ([]byte, error) {
  522	return param.MarshalUnion(u, u.OfComparisonFilter, u.OfCompoundFilter)
  523}
  524func (u *FileSearchToolFiltersUnionParam) UnmarshalJSON(data []byte) error {
  525	return apijson.UnmarshalRoot(data, u)
  526}
  527
  528func (u *FileSearchToolFiltersUnionParam) asAny() any {
  529	if !param.IsOmitted(u.OfComparisonFilter) {
  530		return u.OfComparisonFilter
  531	} else if !param.IsOmitted(u.OfCompoundFilter) {
  532		return u.OfCompoundFilter
  533	}
  534	return nil
  535}
  536
  537// Returns a pointer to the underlying variant's property, if present.
  538func (u FileSearchToolFiltersUnionParam) GetKey() *string {
  539	if vt := u.OfComparisonFilter; vt != nil {
  540		return &vt.Key
  541	}
  542	return nil
  543}
  544
  545// Returns a pointer to the underlying variant's property, if present.
  546func (u FileSearchToolFiltersUnionParam) GetValue() *shared.ComparisonFilterValueUnionParam {
  547	if vt := u.OfComparisonFilter; vt != nil {
  548		return &vt.Value
  549	}
  550	return nil
  551}
  552
  553// Returns a pointer to the underlying variant's property, if present.
  554func (u FileSearchToolFiltersUnionParam) GetFilters() []shared.ComparisonFilterParam {
  555	if vt := u.OfCompoundFilter; vt != nil {
  556		return vt.Filters
  557	}
  558	return nil
  559}
  560
  561// Returns a pointer to the underlying variant's property, if present.
  562func (u FileSearchToolFiltersUnionParam) GetType() *string {
  563	if vt := u.OfComparisonFilter; vt != nil {
  564		return (*string)(&vt.Type)
  565	} else if vt := u.OfCompoundFilter; vt != nil {
  566		return (*string)(&vt.Type)
  567	}
  568	return nil
  569}
  570
  571// Ranking options for search.
  572type FileSearchToolRankingOptionsParam struct {
  573	// The score threshold for the file search, a number between 0 and 1. Numbers
  574	// closer to 1 will attempt to return only the most relevant results, but may
  575	// return fewer results.
  576	ScoreThreshold param.Opt[float64] `json:"score_threshold,omitzero"`
  577	// The ranker to use for the file search.
  578	//
  579	// Any of "auto", "default-2024-11-15".
  580	Ranker string `json:"ranker,omitzero"`
  581	paramObj
  582}
  583
  584func (r FileSearchToolRankingOptionsParam) MarshalJSON() (data []byte, err error) {
  585	type shadow FileSearchToolRankingOptionsParam
  586	return param.MarshalObject(r, (*shadow)(&r))
  587}
  588func (r *FileSearchToolRankingOptionsParam) UnmarshalJSON(data []byte) error {
  589	return apijson.UnmarshalRoot(data, r)
  590}
  591
  592func init() {
  593	apijson.RegisterFieldValidator[FileSearchToolRankingOptionsParam](
  594		"ranker", "auto", "default-2024-11-15",
  595	)
  596}
  597
  598// Defines a function in your own code the model can choose to call. Learn more
  599// about
  600// [function calling](https://platform.openai.com/docs/guides/function-calling).
  601type FunctionTool struct {
  602	// The name of the function to call.
  603	Name string `json:"name,required"`
  604	// A JSON schema object describing the parameters of the function.
  605	Parameters map[string]any `json:"parameters,required"`
  606	// Whether to enforce strict parameter validation. Default `true`.
  607	Strict bool `json:"strict,required"`
  608	// The type of the function tool. Always `function`.
  609	Type constant.Function `json:"type,required"`
  610	// A description of the function. Used by the model to determine whether or not to
  611	// call the function.
  612	Description string `json:"description,nullable"`
  613	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  614	JSON struct {
  615		Name        respjson.Field
  616		Parameters  respjson.Field
  617		Strict      respjson.Field
  618		Type        respjson.Field
  619		Description respjson.Field
  620		ExtraFields map[string]respjson.Field
  621		raw         string
  622	} `json:"-"`
  623}
  624
  625// Returns the unmodified JSON received from the API
  626func (r FunctionTool) RawJSON() string { return r.JSON.raw }
  627func (r *FunctionTool) UnmarshalJSON(data []byte) error {
  628	return apijson.UnmarshalRoot(data, r)
  629}
  630
  631// ToParam converts this FunctionTool to a FunctionToolParam.
  632//
  633// Warning: the fields of the param type will not be present. ToParam should only
  634// be used at the last possible moment before sending a request. Test for this with
  635// FunctionToolParam.Overrides()
  636func (r FunctionTool) ToParam() FunctionToolParam {
  637	return param.Override[FunctionToolParam](json.RawMessage(r.RawJSON()))
  638}
  639
  640// Defines a function in your own code the model can choose to call. Learn more
  641// about
  642// [function calling](https://platform.openai.com/docs/guides/function-calling).
  643//
  644// The properties Name, Parameters, Strict, Type are required.
  645type FunctionToolParam struct {
  646	// Whether to enforce strict parameter validation. Default `true`.
  647	Strict param.Opt[bool] `json:"strict,omitzero,required"`
  648	// A JSON schema object describing the parameters of the function.
  649	Parameters map[string]any `json:"parameters,omitzero,required"`
  650	// The name of the function to call.
  651	Name string `json:"name,required"`
  652	// A description of the function. Used by the model to determine whether or not to
  653	// call the function.
  654	Description param.Opt[string] `json:"description,omitzero"`
  655	// The type of the function tool. Always `function`.
  656	//
  657	// This field can be elided, and will marshal its zero value as "function".
  658	Type constant.Function `json:"type,required"`
  659	paramObj
  660}
  661
  662func (r FunctionToolParam) MarshalJSON() (data []byte, err error) {
  663	type shadow FunctionToolParam
  664	return param.MarshalObject(r, (*shadow)(&r))
  665}
  666func (r *FunctionToolParam) UnmarshalJSON(data []byte) error {
  667	return apijson.UnmarshalRoot(data, r)
  668}
  669
  670type Response struct {
  671	// Unique identifier for this Response.
  672	ID string `json:"id,required"`
  673	// Unix timestamp (in seconds) of when this Response was created.
  674	CreatedAt float64 `json:"created_at,required"`
  675	// An error object returned when the model fails to generate a Response.
  676	Error ResponseError `json:"error,required"`
  677	// Details about why the response is incomplete.
  678	IncompleteDetails ResponseIncompleteDetails `json:"incomplete_details,required"`
  679	// A system (or developer) message inserted into the model's context.
  680	//
  681	// When using along with `previous_response_id`, the instructions from a previous
  682	// response will not be carried over to the next response. This makes it simple to
  683	// swap out system (or developer) messages in new responses.
  684	Instructions ResponseInstructionsUnion `json:"instructions,required"`
  685	// Set of 16 key-value pairs that can be attached to an object. This can be useful
  686	// for storing additional information about the object in a structured format, and
  687	// querying for objects via API or the dashboard.
  688	//
  689	// Keys are strings with a maximum length of 64 characters. Values are strings with
  690	// a maximum length of 512 characters.
  691	Metadata shared.Metadata `json:"metadata,required"`
  692	// Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
  693	// wide range of models with different capabilities, performance characteristics,
  694	// and price points. Refer to the
  695	// [model guide](https://platform.openai.com/docs/models) to browse and compare
  696	// available models.
  697	Model shared.ResponsesModel `json:"model,required"`
  698	// The object type of this resource - always set to `response`.
  699	Object constant.Response `json:"object,required"`
  700	// An array of content items generated by the model.
  701	//
  702	//   - The length and order of items in the `output` array is dependent on the
  703	//     model's response.
  704	//   - Rather than accessing the first item in the `output` array and assuming it's
  705	//     an `assistant` message with the content generated by the model, you might
  706	//     consider using the `output_text` property where supported in SDKs.
  707	Output []ResponseOutputItemUnion `json:"output,required"`
  708	// Whether to allow the model to run tool calls in parallel.
  709	ParallelToolCalls bool `json:"parallel_tool_calls,required"`
  710	// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
  711	// make the output more random, while lower values like 0.2 will make it more
  712	// focused and deterministic. We generally recommend altering this or `top_p` but
  713	// not both.
  714	Temperature float64 `json:"temperature,required"`
  715	// How the model should select which tool (or tools) to use when generating a
  716	// response. See the `tools` parameter to see how to specify which tools the model
  717	// can call.
  718	ToolChoice ResponseToolChoiceUnion `json:"tool_choice,required"`
  719	// An array of tools the model may call while generating a response. You can
  720	// specify which tool to use by setting the `tool_choice` parameter.
  721	//
  722	// The two categories of tools you can provide the model are:
  723	//
  724	//   - **Built-in tools**: Tools that are provided by OpenAI that extend the model's
  725	//     capabilities, like
  726	//     [web search](https://platform.openai.com/docs/guides/tools-web-search) or
  727	//     [file search](https://platform.openai.com/docs/guides/tools-file-search).
  728	//     Learn more about
  729	//     [built-in tools](https://platform.openai.com/docs/guides/tools).
  730	//   - **Function calls (custom tools)**: Functions that are defined by you, enabling
  731	//     the model to call your own code. Learn more about
  732	//     [function calling](https://platform.openai.com/docs/guides/function-calling).
  733	Tools []ToolUnion `json:"tools,required"`
  734	// An alternative to sampling with temperature, called nucleus sampling, where the
  735	// model considers the results of the tokens with top_p probability mass. So 0.1
  736	// means only the tokens comprising the top 10% probability mass are considered.
  737	//
  738	// We generally recommend altering this or `temperature` but not both.
  739	TopP float64 `json:"top_p,required"`
  740	// Whether to run the model response in the background.
  741	// [Learn more](https://platform.openai.com/docs/guides/background).
  742	Background bool `json:"background,nullable"`
  743	// An upper bound for the number of tokens that can be generated for a response,
  744	// including visible output tokens and
  745	// [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).
  746	MaxOutputTokens int64 `json:"max_output_tokens,nullable"`
  747	// The maximum number of total calls to built-in tools that can be processed in a
  748	// response. This maximum number applies across all built-in tool calls, not per
  749	// individual tool. Any further attempts to call a tool by the model will be
  750	// ignored.
  751	MaxToolCalls int64 `json:"max_tool_calls,nullable"`
  752	// The unique ID of the previous response to the model. Use this to create
  753	// multi-turn conversations. Learn more about
  754	// [conversation state](https://platform.openai.com/docs/guides/conversation-state).
  755	PreviousResponseID string `json:"previous_response_id,nullable"`
  756	// Reference to a prompt template and its variables.
  757	// [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
  758	Prompt ResponsePrompt `json:"prompt,nullable"`
  759	// **o-series models only**
  760	//
  761	// Configuration options for
  762	// [reasoning models](https://platform.openai.com/docs/guides/reasoning).
  763	Reasoning shared.Reasoning `json:"reasoning,nullable"`
  764	// Specifies the processing type used for serving the request.
  765	//
  766	//   - If set to 'auto', then the request will be processed with the service tier
  767	//     configured in the Project settings. Unless otherwise configured, the Project
  768	//     will use 'default'.
  769	//   - If set to 'default', then the requset will be processed with the standard
  770	//     pricing and performance for the selected model.
  771	//   - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
  772	//     'priority', then the request will be processed with the corresponding service
  773	//     tier. [Contact sales](https://openai.com/contact-sales) to learn more about
  774	//     Priority processing.
  775	//   - When not set, the default behavior is 'auto'.
  776	//
  777	// When the `service_tier` parameter is set, the response body will include the
  778	// `service_tier` value based on the processing mode actually used to serve the
  779	// request. This response value may be different from the value set in the
  780	// parameter.
  781	//
  782	// Any of "auto", "default", "flex", "scale", "priority".
  783	ServiceTier ResponseServiceTier `json:"service_tier,nullable"`
  784	// The status of the response generation. One of `completed`, `failed`,
  785	// `in_progress`, `cancelled`, `queued`, or `incomplete`.
  786	//
  787	// Any of "completed", "failed", "in_progress", "cancelled", "queued",
  788	// "incomplete".
  789	Status ResponseStatus `json:"status"`
  790	// Configuration options for a text response from the model. Can be plain text or
  791	// structured JSON data. Learn more:
  792	//
  793	// - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
  794	// - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
  795	Text ResponseTextConfig `json:"text"`
  796	// An integer between 0 and 20 specifying the number of most likely tokens to
  797	// return at each token position, each with an associated log probability.
  798	TopLogprobs int64 `json:"top_logprobs,nullable"`
  799	// The truncation strategy to use for the model response.
  800	//
  801	//   - `auto`: If the context of this response and previous ones exceeds the model's
  802	//     context window size, the model will truncate the response to fit the context
  803	//     window by dropping input items in the middle of the conversation.
  804	//   - `disabled` (default): If a model response will exceed the context window size
  805	//     for a model, the request will fail with a 400 error.
  806	//
  807	// Any of "auto", "disabled".
  808	Truncation ResponseTruncation `json:"truncation,nullable"`
  809	// Represents token usage details including input tokens, output tokens, a
  810	// breakdown of output tokens, and the total tokens used.
  811	Usage ResponseUsage `json:"usage"`
  812	// A stable identifier for your end-users. Used to boost cache hit rates by better
  813	// bucketing similar requests and to help OpenAI detect and prevent abuse.
  814	// [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
  815	User string `json:"user"`
  816	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  817	JSON struct {
  818		ID                 respjson.Field
  819		CreatedAt          respjson.Field
  820		Error              respjson.Field
  821		IncompleteDetails  respjson.Field
  822		Instructions       respjson.Field
  823		Metadata           respjson.Field
  824		Model              respjson.Field
  825		Object             respjson.Field
  826		Output             respjson.Field
  827		ParallelToolCalls  respjson.Field
  828		Temperature        respjson.Field
  829		ToolChoice         respjson.Field
  830		Tools              respjson.Field
  831		TopP               respjson.Field
  832		Background         respjson.Field
  833		MaxOutputTokens    respjson.Field
  834		MaxToolCalls       respjson.Field
  835		PreviousResponseID respjson.Field
  836		Prompt             respjson.Field
  837		Reasoning          respjson.Field
  838		ServiceTier        respjson.Field
  839		Status             respjson.Field
  840		Text               respjson.Field
  841		TopLogprobs        respjson.Field
  842		Truncation         respjson.Field
  843		Usage              respjson.Field
  844		User               respjson.Field
  845		ExtraFields        map[string]respjson.Field
  846		raw                string
  847	} `json:"-"`
  848}
  849
  850func (r Response) OutputText() string {
  851	var outputText strings.Builder
  852	for _, item := range r.Output {
  853		for _, content := range item.Content {
  854			if content.Type == "output_text" {
  855				outputText.WriteString(content.Text)
  856			}
  857		}
  858	}
  859	return outputText.String()
  860}
  861
  862// Returns the unmodified JSON received from the API
  863func (r Response) RawJSON() string { return r.JSON.raw }
  864func (r *Response) UnmarshalJSON(data []byte) error {
  865	return apijson.UnmarshalRoot(data, r)
  866}
  867
  868// Details about why the response is incomplete.
  869type ResponseIncompleteDetails struct {
  870	// The reason why the response is incomplete.
  871	//
  872	// Any of "max_output_tokens", "content_filter".
  873	Reason string `json:"reason"`
  874	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  875	JSON struct {
  876		Reason      respjson.Field
  877		ExtraFields map[string]respjson.Field
  878		raw         string
  879	} `json:"-"`
  880}
  881
  882// Returns the unmodified JSON received from the API
  883func (r ResponseIncompleteDetails) RawJSON() string { return r.JSON.raw }
  884func (r *ResponseIncompleteDetails) UnmarshalJSON(data []byte) error {
  885	return apijson.UnmarshalRoot(data, r)
  886}
  887
  888// ResponseInstructionsUnion contains all possible properties and values from
  889// [string], [[]ResponseInputItemUnion].
  890//
  891// Use the methods beginning with 'As' to cast the union to one of its variants.
  892//
  893// If the underlying value is not a json object, one of the following properties
  894// will be valid: OfString OfInputItemList]
  895type ResponseInstructionsUnion struct {
  896	// This field will be present if the value is a [string] instead of an object.
  897	OfString string `json:",inline"`
  898	// This field will be present if the value is a [[]ResponseInputItemUnion] instead
  899	// of an object.
  900	OfInputItemList []ResponseInputItemUnion `json:",inline"`
  901	JSON            struct {
  902		OfString        respjson.Field
  903		OfInputItemList respjson.Field
  904		raw             string
  905	} `json:"-"`
  906}
  907
  908func (u ResponseInstructionsUnion) AsString() (v string) {
  909	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  910	return
  911}
  912
  913func (u ResponseInstructionsUnion) AsInputItemList() (v []ResponseInputItemUnion) {
  914	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  915	return
  916}
  917
  918// Returns the unmodified JSON received from the API
  919func (u ResponseInstructionsUnion) RawJSON() string { return u.JSON.raw }
  920
  921func (r *ResponseInstructionsUnion) UnmarshalJSON(data []byte) error {
  922	return apijson.UnmarshalRoot(data, r)
  923}
  924
  925// ResponseToolChoiceUnion contains all possible properties and values from
  926// [ToolChoiceOptions], [ToolChoiceTypes], [ToolChoiceFunction], [ToolChoiceMcp].
  927//
  928// Use the methods beginning with 'As' to cast the union to one of its variants.
  929//
  930// If the underlying value is not a json object, one of the following properties
  931// will be valid: OfToolChoiceMode]
  932type ResponseToolChoiceUnion struct {
  933	// This field will be present if the value is a [ToolChoiceOptions] instead of an
  934	// object.
  935	OfToolChoiceMode ToolChoiceOptions `json:",inline"`
  936	Type             string            `json:"type"`
  937	Name             string            `json:"name"`
  938	// This field is from variant [ToolChoiceMcp].
  939	ServerLabel string `json:"server_label"`
  940	JSON        struct {
  941		OfToolChoiceMode respjson.Field
  942		Type             respjson.Field
  943		Name             respjson.Field
  944		ServerLabel      respjson.Field
  945		raw              string
  946	} `json:"-"`
  947}
  948
  949func (u ResponseToolChoiceUnion) AsToolChoiceMode() (v ToolChoiceOptions) {
  950	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  951	return
  952}
  953
  954func (u ResponseToolChoiceUnion) AsHostedTool() (v ToolChoiceTypes) {
  955	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  956	return
  957}
  958
  959func (u ResponseToolChoiceUnion) AsFunctionTool() (v ToolChoiceFunction) {
  960	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  961	return
  962}
  963
  964func (u ResponseToolChoiceUnion) AsMcpTool() (v ToolChoiceMcp) {
  965	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  966	return
  967}
  968
  969// Returns the unmodified JSON received from the API
  970func (u ResponseToolChoiceUnion) RawJSON() string { return u.JSON.raw }
  971
  972func (r *ResponseToolChoiceUnion) UnmarshalJSON(data []byte) error {
  973	return apijson.UnmarshalRoot(data, r)
  974}
  975
  976// Specifies the processing type used for serving the request.
  977//
  978//   - If set to 'auto', then the request will be processed with the service tier
  979//     configured in the Project settings. Unless otherwise configured, the Project
  980//     will use 'default'.
  981//   - If set to 'default', then the requset will be processed with the standard
  982//     pricing and performance for the selected model.
  983//   - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
  984//     'priority', then the request will be processed with the corresponding service
  985//     tier. [Contact sales](https://openai.com/contact-sales) to learn more about
  986//     Priority processing.
  987//   - When not set, the default behavior is 'auto'.
  988//
  989// When the `service_tier` parameter is set, the response body will include the
  990// `service_tier` value based on the processing mode actually used to serve the
  991// request. This response value may be different from the value set in the
  992// parameter.
  993type ResponseServiceTier string
  994
  995const (
  996	ResponseServiceTierAuto     ResponseServiceTier = "auto"
  997	ResponseServiceTierDefault  ResponseServiceTier = "default"
  998	ResponseServiceTierFlex     ResponseServiceTier = "flex"
  999	ResponseServiceTierScale    ResponseServiceTier = "scale"
 1000	ResponseServiceTierPriority ResponseServiceTier = "priority"
 1001)
 1002
 1003// The truncation strategy to use for the model response.
 1004//
 1005//   - `auto`: If the context of this response and previous ones exceeds the model's
 1006//     context window size, the model will truncate the response to fit the context
 1007//     window by dropping input items in the middle of the conversation.
 1008//   - `disabled` (default): If a model response will exceed the context window size
 1009//     for a model, the request will fail with a 400 error.
 1010type ResponseTruncation string
 1011
 1012const (
 1013	ResponseTruncationAuto     ResponseTruncation = "auto"
 1014	ResponseTruncationDisabled ResponseTruncation = "disabled"
 1015)
 1016
 1017// Emitted when there is a partial audio response.
 1018type ResponseAudioDeltaEvent struct {
 1019	// A chunk of Base64 encoded response audio bytes.
 1020	Delta string `json:"delta,required"`
 1021	// A sequence number for this chunk of the stream response.
 1022	SequenceNumber int64 `json:"sequence_number,required"`
 1023	// The type of the event. Always `response.audio.delta`.
 1024	Type constant.ResponseAudioDelta `json:"type,required"`
 1025	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1026	JSON struct {
 1027		Delta          respjson.Field
 1028		SequenceNumber respjson.Field
 1029		Type           respjson.Field
 1030		ExtraFields    map[string]respjson.Field
 1031		raw            string
 1032	} `json:"-"`
 1033}
 1034
 1035// Returns the unmodified JSON received from the API
 1036func (r ResponseAudioDeltaEvent) RawJSON() string { return r.JSON.raw }
 1037func (r *ResponseAudioDeltaEvent) UnmarshalJSON(data []byte) error {
 1038	return apijson.UnmarshalRoot(data, r)
 1039}
 1040
 1041// Emitted when the audio response is complete.
 1042type ResponseAudioDoneEvent struct {
 1043	// The sequence number of the delta.
 1044	SequenceNumber int64 `json:"sequence_number,required"`
 1045	// The type of the event. Always `response.audio.done`.
 1046	Type constant.ResponseAudioDone `json:"type,required"`
 1047	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1048	JSON struct {
 1049		SequenceNumber respjson.Field
 1050		Type           respjson.Field
 1051		ExtraFields    map[string]respjson.Field
 1052		raw            string
 1053	} `json:"-"`
 1054}
 1055
 1056// Returns the unmodified JSON received from the API
 1057func (r ResponseAudioDoneEvent) RawJSON() string { return r.JSON.raw }
 1058func (r *ResponseAudioDoneEvent) UnmarshalJSON(data []byte) error {
 1059	return apijson.UnmarshalRoot(data, r)
 1060}
 1061
 1062// Emitted when there is a partial transcript of audio.
 1063type ResponseAudioTranscriptDeltaEvent struct {
 1064	// The partial transcript of the audio response.
 1065	Delta string `json:"delta,required"`
 1066	// The sequence number of this event.
 1067	SequenceNumber int64 `json:"sequence_number,required"`
 1068	// The type of the event. Always `response.audio.transcript.delta`.
 1069	Type constant.ResponseAudioTranscriptDelta `json:"type,required"`
 1070	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1071	JSON struct {
 1072		Delta          respjson.Field
 1073		SequenceNumber respjson.Field
 1074		Type           respjson.Field
 1075		ExtraFields    map[string]respjson.Field
 1076		raw            string
 1077	} `json:"-"`
 1078}
 1079
 1080// Returns the unmodified JSON received from the API
 1081func (r ResponseAudioTranscriptDeltaEvent) RawJSON() string { return r.JSON.raw }
 1082func (r *ResponseAudioTranscriptDeltaEvent) UnmarshalJSON(data []byte) error {
 1083	return apijson.UnmarshalRoot(data, r)
 1084}
 1085
 1086// Emitted when the full audio transcript is completed.
 1087type ResponseAudioTranscriptDoneEvent struct {
 1088	// The sequence number of this event.
 1089	SequenceNumber int64 `json:"sequence_number,required"`
 1090	// The type of the event. Always `response.audio.transcript.done`.
 1091	Type constant.ResponseAudioTranscriptDone `json:"type,required"`
 1092	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1093	JSON struct {
 1094		SequenceNumber respjson.Field
 1095		Type           respjson.Field
 1096		ExtraFields    map[string]respjson.Field
 1097		raw            string
 1098	} `json:"-"`
 1099}
 1100
 1101// Returns the unmodified JSON received from the API
 1102func (r ResponseAudioTranscriptDoneEvent) RawJSON() string { return r.JSON.raw }
 1103func (r *ResponseAudioTranscriptDoneEvent) UnmarshalJSON(data []byte) error {
 1104	return apijson.UnmarshalRoot(data, r)
 1105}
 1106
 1107// Emitted when a partial code snippet is streamed by the code interpreter.
 1108type ResponseCodeInterpreterCallCodeDeltaEvent struct {
 1109	// The partial code snippet being streamed by the code interpreter.
 1110	Delta string `json:"delta,required"`
 1111	// The unique identifier of the code interpreter tool call item.
 1112	ItemID string `json:"item_id,required"`
 1113	// The index of the output item in the response for which the code is being
 1114	// streamed.
 1115	OutputIndex int64 `json:"output_index,required"`
 1116	// The sequence number of this event, used to order streaming events.
 1117	SequenceNumber int64 `json:"sequence_number,required"`
 1118	// The type of the event. Always `response.code_interpreter_call_code.delta`.
 1119	Type constant.ResponseCodeInterpreterCallCodeDelta `json:"type,required"`
 1120	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1121	JSON struct {
 1122		Delta          respjson.Field
 1123		ItemID         respjson.Field
 1124		OutputIndex    respjson.Field
 1125		SequenceNumber respjson.Field
 1126		Type           respjson.Field
 1127		ExtraFields    map[string]respjson.Field
 1128		raw            string
 1129	} `json:"-"`
 1130}
 1131
 1132// Returns the unmodified JSON received from the API
 1133func (r ResponseCodeInterpreterCallCodeDeltaEvent) RawJSON() string { return r.JSON.raw }
 1134func (r *ResponseCodeInterpreterCallCodeDeltaEvent) UnmarshalJSON(data []byte) error {
 1135	return apijson.UnmarshalRoot(data, r)
 1136}
 1137
 1138// Emitted when the code snippet is finalized by the code interpreter.
 1139type ResponseCodeInterpreterCallCodeDoneEvent struct {
 1140	// The final code snippet output by the code interpreter.
 1141	Code string `json:"code,required"`
 1142	// The unique identifier of the code interpreter tool call item.
 1143	ItemID string `json:"item_id,required"`
 1144	// The index of the output item in the response for which the code is finalized.
 1145	OutputIndex int64 `json:"output_index,required"`
 1146	// The sequence number of this event, used to order streaming events.
 1147	SequenceNumber int64 `json:"sequence_number,required"`
 1148	// The type of the event. Always `response.code_interpreter_call_code.done`.
 1149	Type constant.ResponseCodeInterpreterCallCodeDone `json:"type,required"`
 1150	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1151	JSON struct {
 1152		Code           respjson.Field
 1153		ItemID         respjson.Field
 1154		OutputIndex    respjson.Field
 1155		SequenceNumber respjson.Field
 1156		Type           respjson.Field
 1157		ExtraFields    map[string]respjson.Field
 1158		raw            string
 1159	} `json:"-"`
 1160}
 1161
 1162// Returns the unmodified JSON received from the API
 1163func (r ResponseCodeInterpreterCallCodeDoneEvent) RawJSON() string { return r.JSON.raw }
 1164func (r *ResponseCodeInterpreterCallCodeDoneEvent) UnmarshalJSON(data []byte) error {
 1165	return apijson.UnmarshalRoot(data, r)
 1166}
 1167
 1168// Emitted when the code interpreter call is completed.
 1169type ResponseCodeInterpreterCallCompletedEvent struct {
 1170	// The unique identifier of the code interpreter tool call item.
 1171	ItemID string `json:"item_id,required"`
 1172	// The index of the output item in the response for which the code interpreter call
 1173	// is completed.
 1174	OutputIndex int64 `json:"output_index,required"`
 1175	// The sequence number of this event, used to order streaming events.
 1176	SequenceNumber int64 `json:"sequence_number,required"`
 1177	// The type of the event. Always `response.code_interpreter_call.completed`.
 1178	Type constant.ResponseCodeInterpreterCallCompleted `json:"type,required"`
 1179	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1180	JSON struct {
 1181		ItemID         respjson.Field
 1182		OutputIndex    respjson.Field
 1183		SequenceNumber respjson.Field
 1184		Type           respjson.Field
 1185		ExtraFields    map[string]respjson.Field
 1186		raw            string
 1187	} `json:"-"`
 1188}
 1189
 1190// Returns the unmodified JSON received from the API
 1191func (r ResponseCodeInterpreterCallCompletedEvent) RawJSON() string { return r.JSON.raw }
 1192func (r *ResponseCodeInterpreterCallCompletedEvent) UnmarshalJSON(data []byte) error {
 1193	return apijson.UnmarshalRoot(data, r)
 1194}
 1195
 1196// Emitted when a code interpreter call is in progress.
 1197type ResponseCodeInterpreterCallInProgressEvent struct {
 1198	// The unique identifier of the code interpreter tool call item.
 1199	ItemID string `json:"item_id,required"`
 1200	// The index of the output item in the response for which the code interpreter call
 1201	// is in progress.
 1202	OutputIndex int64 `json:"output_index,required"`
 1203	// The sequence number of this event, used to order streaming events.
 1204	SequenceNumber int64 `json:"sequence_number,required"`
 1205	// The type of the event. Always `response.code_interpreter_call.in_progress`.
 1206	Type constant.ResponseCodeInterpreterCallInProgress `json:"type,required"`
 1207	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1208	JSON struct {
 1209		ItemID         respjson.Field
 1210		OutputIndex    respjson.Field
 1211		SequenceNumber respjson.Field
 1212		Type           respjson.Field
 1213		ExtraFields    map[string]respjson.Field
 1214		raw            string
 1215	} `json:"-"`
 1216}
 1217
 1218// Returns the unmodified JSON received from the API
 1219func (r ResponseCodeInterpreterCallInProgressEvent) RawJSON() string { return r.JSON.raw }
 1220func (r *ResponseCodeInterpreterCallInProgressEvent) UnmarshalJSON(data []byte) error {
 1221	return apijson.UnmarshalRoot(data, r)
 1222}
 1223
 1224// Emitted when the code interpreter is actively interpreting the code snippet.
 1225type ResponseCodeInterpreterCallInterpretingEvent struct {
 1226	// The unique identifier of the code interpreter tool call item.
 1227	ItemID string `json:"item_id,required"`
 1228	// The index of the output item in the response for which the code interpreter is
 1229	// interpreting code.
 1230	OutputIndex int64 `json:"output_index,required"`
 1231	// The sequence number of this event, used to order streaming events.
 1232	SequenceNumber int64 `json:"sequence_number,required"`
 1233	// The type of the event. Always `response.code_interpreter_call.interpreting`.
 1234	Type constant.ResponseCodeInterpreterCallInterpreting `json:"type,required"`
 1235	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1236	JSON struct {
 1237		ItemID         respjson.Field
 1238		OutputIndex    respjson.Field
 1239		SequenceNumber respjson.Field
 1240		Type           respjson.Field
 1241		ExtraFields    map[string]respjson.Field
 1242		raw            string
 1243	} `json:"-"`
 1244}
 1245
 1246// Returns the unmodified JSON received from the API
 1247func (r ResponseCodeInterpreterCallInterpretingEvent) RawJSON() string { return r.JSON.raw }
 1248func (r *ResponseCodeInterpreterCallInterpretingEvent) UnmarshalJSON(data []byte) error {
 1249	return apijson.UnmarshalRoot(data, r)
 1250}
 1251
 1252// A tool call to run code.
 1253type ResponseCodeInterpreterToolCall struct {
 1254	// The unique ID of the code interpreter tool call.
 1255	ID string `json:"id,required"`
 1256	// The code to run, or null if not available.
 1257	Code string `json:"code,required"`
 1258	// The ID of the container used to run the code.
 1259	ContainerID string `json:"container_id,required"`
 1260	// The outputs generated by the code interpreter, such as logs or images. Can be
 1261	// null if no outputs are available.
 1262	Outputs []ResponseCodeInterpreterToolCallOutputUnion `json:"outputs,required"`
 1263	// The status of the code interpreter tool call.
 1264	//
 1265	// Any of "in_progress", "completed", "incomplete", "interpreting", "failed".
 1266	Status ResponseCodeInterpreterToolCallStatus `json:"status,required"`
 1267	// The type of the code interpreter tool call. Always `code_interpreter_call`.
 1268	Type constant.CodeInterpreterCall `json:"type,required"`
 1269	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1270	JSON struct {
 1271		ID          respjson.Field
 1272		Code        respjson.Field
 1273		ContainerID respjson.Field
 1274		Outputs     respjson.Field
 1275		Status      respjson.Field
 1276		Type        respjson.Field
 1277		ExtraFields map[string]respjson.Field
 1278		raw         string
 1279	} `json:"-"`
 1280}
 1281
 1282// Returns the unmodified JSON received from the API
 1283func (r ResponseCodeInterpreterToolCall) RawJSON() string { return r.JSON.raw }
 1284func (r *ResponseCodeInterpreterToolCall) UnmarshalJSON(data []byte) error {
 1285	return apijson.UnmarshalRoot(data, r)
 1286}
 1287
 1288// ToParam converts this ResponseCodeInterpreterToolCall to a
 1289// ResponseCodeInterpreterToolCallParam.
 1290//
 1291// Warning: the fields of the param type will not be present. ToParam should only
 1292// be used at the last possible moment before sending a request. Test for this with
 1293// ResponseCodeInterpreterToolCallParam.Overrides()
 1294func (r ResponseCodeInterpreterToolCall) ToParam() ResponseCodeInterpreterToolCallParam {
 1295	return param.Override[ResponseCodeInterpreterToolCallParam](json.RawMessage(r.RawJSON()))
 1296}
 1297
 1298// ResponseCodeInterpreterToolCallOutputUnion contains all possible properties and
 1299// values from [ResponseCodeInterpreterToolCallOutputLogs],
 1300// [ResponseCodeInterpreterToolCallOutputImage].
 1301//
 1302// Use the [ResponseCodeInterpreterToolCallOutputUnion.AsAny] method to switch on
 1303// the variant.
 1304//
 1305// Use the methods beginning with 'As' to cast the union to one of its variants.
 1306type ResponseCodeInterpreterToolCallOutputUnion struct {
 1307	// This field is from variant [ResponseCodeInterpreterToolCallOutputLogs].
 1308	Logs string `json:"logs"`
 1309	// Any of "logs", "image".
 1310	Type string `json:"type"`
 1311	// This field is from variant [ResponseCodeInterpreterToolCallOutputImage].
 1312	URL  string `json:"url"`
 1313	JSON struct {
 1314		Logs respjson.Field
 1315		Type respjson.Field
 1316		URL  respjson.Field
 1317		raw  string
 1318	} `json:"-"`
 1319}
 1320
 1321// anyResponseCodeInterpreterToolCallOutput is implemented by each variant of
 1322// [ResponseCodeInterpreterToolCallOutputUnion] to add type safety for the return
 1323// type of [ResponseCodeInterpreterToolCallOutputUnion.AsAny]
 1324type anyResponseCodeInterpreterToolCallOutput interface {
 1325	implResponseCodeInterpreterToolCallOutputUnion()
 1326}
 1327
 1328func (ResponseCodeInterpreterToolCallOutputLogs) implResponseCodeInterpreterToolCallOutputUnion()  {}
 1329func (ResponseCodeInterpreterToolCallOutputImage) implResponseCodeInterpreterToolCallOutputUnion() {}
 1330
 1331// Use the following switch statement to find the correct variant
 1332//
 1333//	switch variant := ResponseCodeInterpreterToolCallOutputUnion.AsAny().(type) {
 1334//	case responses.ResponseCodeInterpreterToolCallOutputLogs:
 1335//	case responses.ResponseCodeInterpreterToolCallOutputImage:
 1336//	default:
 1337//	  fmt.Errorf("no variant present")
 1338//	}
 1339func (u ResponseCodeInterpreterToolCallOutputUnion) AsAny() anyResponseCodeInterpreterToolCallOutput {
 1340	switch u.Type {
 1341	case "logs":
 1342		return u.AsLogs()
 1343	case "image":
 1344		return u.AsImage()
 1345	}
 1346	return nil
 1347}
 1348
 1349func (u ResponseCodeInterpreterToolCallOutputUnion) AsLogs() (v ResponseCodeInterpreterToolCallOutputLogs) {
 1350	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 1351	return
 1352}
 1353
 1354func (u ResponseCodeInterpreterToolCallOutputUnion) AsImage() (v ResponseCodeInterpreterToolCallOutputImage) {
 1355	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 1356	return
 1357}
 1358
 1359// Returns the unmodified JSON received from the API
 1360func (u ResponseCodeInterpreterToolCallOutputUnion) RawJSON() string { return u.JSON.raw }
 1361
 1362func (r *ResponseCodeInterpreterToolCallOutputUnion) UnmarshalJSON(data []byte) error {
 1363	return apijson.UnmarshalRoot(data, r)
 1364}
 1365
 1366// The logs output from the code interpreter.
 1367type ResponseCodeInterpreterToolCallOutputLogs struct {
 1368	// The logs output from the code interpreter.
 1369	Logs string `json:"logs,required"`
 1370	// The type of the output. Always 'logs'.
 1371	Type constant.Logs `json:"type,required"`
 1372	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1373	JSON struct {
 1374		Logs        respjson.Field
 1375		Type        respjson.Field
 1376		ExtraFields map[string]respjson.Field
 1377		raw         string
 1378	} `json:"-"`
 1379}
 1380
 1381// Returns the unmodified JSON received from the API
 1382func (r ResponseCodeInterpreterToolCallOutputLogs) RawJSON() string { return r.JSON.raw }
 1383func (r *ResponseCodeInterpreterToolCallOutputLogs) UnmarshalJSON(data []byte) error {
 1384	return apijson.UnmarshalRoot(data, r)
 1385}
 1386
 1387// The image output from the code interpreter.
 1388type ResponseCodeInterpreterToolCallOutputImage struct {
 1389	// The type of the output. Always 'image'.
 1390	Type constant.Image `json:"type,required"`
 1391	// The URL of the image output from the code interpreter.
 1392	URL string `json:"url,required"`
 1393	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1394	JSON struct {
 1395		Type        respjson.Field
 1396		URL         respjson.Field
 1397		ExtraFields map[string]respjson.Field
 1398		raw         string
 1399	} `json:"-"`
 1400}
 1401
 1402// Returns the unmodified JSON received from the API
 1403func (r ResponseCodeInterpreterToolCallOutputImage) RawJSON() string { return r.JSON.raw }
 1404func (r *ResponseCodeInterpreterToolCallOutputImage) UnmarshalJSON(data []byte) error {
 1405	return apijson.UnmarshalRoot(data, r)
 1406}
 1407
 1408// The status of the code interpreter tool call.
 1409type ResponseCodeInterpreterToolCallStatus string
 1410
 1411const (
 1412	ResponseCodeInterpreterToolCallStatusInProgress   ResponseCodeInterpreterToolCallStatus = "in_progress"
 1413	ResponseCodeInterpreterToolCallStatusCompleted    ResponseCodeInterpreterToolCallStatus = "completed"
 1414	ResponseCodeInterpreterToolCallStatusIncomplete   ResponseCodeInterpreterToolCallStatus = "incomplete"
 1415	ResponseCodeInterpreterToolCallStatusInterpreting ResponseCodeInterpreterToolCallStatus = "interpreting"
 1416	ResponseCodeInterpreterToolCallStatusFailed       ResponseCodeInterpreterToolCallStatus = "failed"
 1417)
 1418
 1419// A tool call to run code.
 1420//
 1421// The properties ID, Code, ContainerID, Outputs, Status, Type are required.
 1422type ResponseCodeInterpreterToolCallParam struct {
 1423	// The code to run, or null if not available.
 1424	Code param.Opt[string] `json:"code,omitzero,required"`
 1425	// The outputs generated by the code interpreter, such as logs or images. Can be
 1426	// null if no outputs are available.
 1427	Outputs []ResponseCodeInterpreterToolCallOutputUnionParam `json:"outputs,omitzero,required"`
 1428	// The unique ID of the code interpreter tool call.
 1429	ID string `json:"id,required"`
 1430	// The ID of the container used to run the code.
 1431	ContainerID string `json:"container_id,required"`
 1432	// The status of the code interpreter tool call.
 1433	//
 1434	// Any of "in_progress", "completed", "incomplete", "interpreting", "failed".
 1435	Status ResponseCodeInterpreterToolCallStatus `json:"status,omitzero,required"`
 1436	// The type of the code interpreter tool call. Always `code_interpreter_call`.
 1437	//
 1438	// This field can be elided, and will marshal its zero value as
 1439	// "code_interpreter_call".
 1440	Type constant.CodeInterpreterCall `json:"type,required"`
 1441	paramObj
 1442}
 1443
 1444func (r ResponseCodeInterpreterToolCallParam) MarshalJSON() (data []byte, err error) {
 1445	type shadow ResponseCodeInterpreterToolCallParam
 1446	return param.MarshalObject(r, (*shadow)(&r))
 1447}
 1448func (r *ResponseCodeInterpreterToolCallParam) UnmarshalJSON(data []byte) error {
 1449	return apijson.UnmarshalRoot(data, r)
 1450}
 1451
 1452// Only one field can be non-zero.
 1453//
 1454// Use [param.IsOmitted] to confirm if a field is set.
 1455type ResponseCodeInterpreterToolCallOutputUnionParam struct {
 1456	OfLogs  *ResponseCodeInterpreterToolCallOutputLogsParam  `json:",omitzero,inline"`
 1457	OfImage *ResponseCodeInterpreterToolCallOutputImageParam `json:",omitzero,inline"`
 1458	paramUnion
 1459}
 1460
 1461func (u ResponseCodeInterpreterToolCallOutputUnionParam) MarshalJSON() ([]byte, error) {
 1462	return param.MarshalUnion(u, u.OfLogs, u.OfImage)
 1463}
 1464func (u *ResponseCodeInterpreterToolCallOutputUnionParam) UnmarshalJSON(data []byte) error {
 1465	return apijson.UnmarshalRoot(data, u)
 1466}
 1467
 1468func (u *ResponseCodeInterpreterToolCallOutputUnionParam) asAny() any {
 1469	if !param.IsOmitted(u.OfLogs) {
 1470		return u.OfLogs
 1471	} else if !param.IsOmitted(u.OfImage) {
 1472		return u.OfImage
 1473	}
 1474	return nil
 1475}
 1476
 1477// Returns a pointer to the underlying variant's property, if present.
 1478func (u ResponseCodeInterpreterToolCallOutputUnionParam) GetLogs() *string {
 1479	if vt := u.OfLogs; vt != nil {
 1480		return &vt.Logs
 1481	}
 1482	return nil
 1483}
 1484
 1485// Returns a pointer to the underlying variant's property, if present.
 1486func (u ResponseCodeInterpreterToolCallOutputUnionParam) GetURL() *string {
 1487	if vt := u.OfImage; vt != nil {
 1488		return &vt.URL
 1489	}
 1490	return nil
 1491}
 1492
 1493// Returns a pointer to the underlying variant's property, if present.
 1494func (u ResponseCodeInterpreterToolCallOutputUnionParam) GetType() *string {
 1495	if vt := u.OfLogs; vt != nil {
 1496		return (*string)(&vt.Type)
 1497	} else if vt := u.OfImage; vt != nil {
 1498		return (*string)(&vt.Type)
 1499	}
 1500	return nil
 1501}
 1502
 1503func init() {
 1504	apijson.RegisterUnion[ResponseCodeInterpreterToolCallOutputUnionParam](
 1505		"type",
 1506		apijson.Discriminator[ResponseCodeInterpreterToolCallOutputLogsParam]("logs"),
 1507		apijson.Discriminator[ResponseCodeInterpreterToolCallOutputImageParam]("image"),
 1508	)
 1509}
 1510
 1511// The logs output from the code interpreter.
 1512//
 1513// The properties Logs, Type are required.
 1514type ResponseCodeInterpreterToolCallOutputLogsParam struct {
 1515	// The logs output from the code interpreter.
 1516	Logs string `json:"logs,required"`
 1517	// The type of the output. Always 'logs'.
 1518	//
 1519	// This field can be elided, and will marshal its zero value as "logs".
 1520	Type constant.Logs `json:"type,required"`
 1521	paramObj
 1522}
 1523
 1524func (r ResponseCodeInterpreterToolCallOutputLogsParam) MarshalJSON() (data []byte, err error) {
 1525	type shadow ResponseCodeInterpreterToolCallOutputLogsParam
 1526	return param.MarshalObject(r, (*shadow)(&r))
 1527}
 1528func (r *ResponseCodeInterpreterToolCallOutputLogsParam) UnmarshalJSON(data []byte) error {
 1529	return apijson.UnmarshalRoot(data, r)
 1530}
 1531
 1532// The image output from the code interpreter.
 1533//
 1534// The properties Type, URL are required.
 1535type ResponseCodeInterpreterToolCallOutputImageParam struct {
 1536	// The URL of the image output from the code interpreter.
 1537	URL string `json:"url,required"`
 1538	// The type of the output. Always 'image'.
 1539	//
 1540	// This field can be elided, and will marshal its zero value as "image".
 1541	Type constant.Image `json:"type,required"`
 1542	paramObj
 1543}
 1544
 1545func (r ResponseCodeInterpreterToolCallOutputImageParam) MarshalJSON() (data []byte, err error) {
 1546	type shadow ResponseCodeInterpreterToolCallOutputImageParam
 1547	return param.MarshalObject(r, (*shadow)(&r))
 1548}
 1549func (r *ResponseCodeInterpreterToolCallOutputImageParam) UnmarshalJSON(data []byte) error {
 1550	return apijson.UnmarshalRoot(data, r)
 1551}
 1552
 1553// Emitted when the model response is complete.
 1554type ResponseCompletedEvent struct {
 1555	// Properties of the completed response.
 1556	Response Response `json:"response,required"`
 1557	// The sequence number for this event.
 1558	SequenceNumber int64 `json:"sequence_number,required"`
 1559	// The type of the event. Always `response.completed`.
 1560	Type constant.ResponseCompleted `json:"type,required"`
 1561	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1562	JSON struct {
 1563		Response       respjson.Field
 1564		SequenceNumber respjson.Field
 1565		Type           respjson.Field
 1566		ExtraFields    map[string]respjson.Field
 1567		raw            string
 1568	} `json:"-"`
 1569}
 1570
 1571// Returns the unmodified JSON received from the API
 1572func (r ResponseCompletedEvent) RawJSON() string { return r.JSON.raw }
 1573func (r *ResponseCompletedEvent) UnmarshalJSON(data []byte) error {
 1574	return apijson.UnmarshalRoot(data, r)
 1575}
 1576
 1577// A tool call to a computer use tool. See the
 1578// [computer use guide](https://platform.openai.com/docs/guides/tools-computer-use)
 1579// for more information.
 1580type ResponseComputerToolCall struct {
 1581	// The unique ID of the computer call.
 1582	ID string `json:"id,required"`
 1583	// A click action.
 1584	Action ResponseComputerToolCallActionUnion `json:"action,required"`
 1585	// An identifier used when responding to the tool call with output.
 1586	CallID string `json:"call_id,required"`
 1587	// The pending safety checks for the computer call.
 1588	PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck `json:"pending_safety_checks,required"`
 1589	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
 1590	// Populated when items are returned via API.
 1591	//
 1592	// Any of "in_progress", "completed", "incomplete".
 1593	Status ResponseComputerToolCallStatus `json:"status,required"`
 1594	// The type of the computer call. Always `computer_call`.
 1595	//
 1596	// Any of "computer_call".
 1597	Type ResponseComputerToolCallType `json:"type,required"`
 1598	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1599	JSON struct {
 1600		ID                  respjson.Field
 1601		Action              respjson.Field
 1602		CallID              respjson.Field
 1603		PendingSafetyChecks respjson.Field
 1604		Status              respjson.Field
 1605		Type                respjson.Field
 1606		ExtraFields         map[string]respjson.Field
 1607		raw                 string
 1608	} `json:"-"`
 1609}
 1610
 1611// Returns the unmodified JSON received from the API
 1612func (r ResponseComputerToolCall) RawJSON() string { return r.JSON.raw }
 1613func (r *ResponseComputerToolCall) UnmarshalJSON(data []byte) error {
 1614	return apijson.UnmarshalRoot(data, r)
 1615}
 1616
 1617// ToParam converts this ResponseComputerToolCall to a
 1618// ResponseComputerToolCallParam.
 1619//
 1620// Warning: the fields of the param type will not be present. ToParam should only
 1621// be used at the last possible moment before sending a request. Test for this with
 1622// ResponseComputerToolCallParam.Overrides()
 1623func (r ResponseComputerToolCall) ToParam() ResponseComputerToolCallParam {
 1624	return param.Override[ResponseComputerToolCallParam](json.RawMessage(r.RawJSON()))
 1625}
 1626
 1627// ResponseComputerToolCallActionUnion contains all possible properties and values
 1628// from [ResponseComputerToolCallActionClick],
 1629// [ResponseComputerToolCallActionDoubleClick],
 1630// [ResponseComputerToolCallActionDrag], [ResponseComputerToolCallActionKeypress],
 1631// [ResponseComputerToolCallActionMove],
 1632// [ResponseComputerToolCallActionScreenshot],
 1633// [ResponseComputerToolCallActionScroll], [ResponseComputerToolCallActionType],
 1634// [ResponseComputerToolCallActionWait].
 1635//
 1636// Use the [ResponseComputerToolCallActionUnion.AsAny] method to switch on the
 1637// variant.
 1638//
 1639// Use the methods beginning with 'As' to cast the union to one of its variants.
 1640type ResponseComputerToolCallActionUnion struct {
 1641	// This field is from variant [ResponseComputerToolCallActionClick].
 1642	Button string `json:"button"`
 1643	// Any of "click", "double_click", "drag", "keypress", "move", "screenshot",
 1644	// "scroll", "type", "wait".
 1645	Type string `json:"type"`
 1646	X    int64  `json:"x"`
 1647	Y    int64  `json:"y"`
 1648	// This field is from variant [ResponseComputerToolCallActionDrag].
 1649	Path []ResponseComputerToolCallActionDragPath `json:"path"`
 1650	// This field is from variant [ResponseComputerToolCallActionKeypress].
 1651	Keys []string `json:"keys"`
 1652	// This field is from variant [ResponseComputerToolCallActionScroll].
 1653	ScrollX int64 `json:"scroll_x"`
 1654	// This field is from variant [ResponseComputerToolCallActionScroll].
 1655	ScrollY int64 `json:"scroll_y"`
 1656	// This field is from variant [ResponseComputerToolCallActionType].
 1657	Text string `json:"text"`
 1658	JSON struct {
 1659		Button  respjson.Field
 1660		Type    respjson.Field
 1661		X       respjson.Field
 1662		Y       respjson.Field
 1663		Path    respjson.Field
 1664		Keys    respjson.Field
 1665		ScrollX respjson.Field
 1666		ScrollY respjson.Field
 1667		Text    respjson.Field
 1668		raw     string
 1669	} `json:"-"`
 1670}
 1671
 1672// anyResponseComputerToolCallAction is implemented by each variant of
 1673// [ResponseComputerToolCallActionUnion] to add type safety for the return type of
 1674// [ResponseComputerToolCallActionUnion.AsAny]
 1675type anyResponseComputerToolCallAction interface {
 1676	implResponseComputerToolCallActionUnion()
 1677}
 1678
 1679func (ResponseComputerToolCallActionClick) implResponseComputerToolCallActionUnion()       {}
 1680func (ResponseComputerToolCallActionDoubleClick) implResponseComputerToolCallActionUnion() {}
 1681func (ResponseComputerToolCallActionDrag) implResponseComputerToolCallActionUnion()        {}
 1682func (ResponseComputerToolCallActionKeypress) implResponseComputerToolCallActionUnion()    {}
 1683func (ResponseComputerToolCallActionMove) implResponseComputerToolCallActionUnion()        {}
 1684func (ResponseComputerToolCallActionScreenshot) implResponseComputerToolCallActionUnion()  {}
 1685func (ResponseComputerToolCallActionScroll) implResponseComputerToolCallActionUnion()      {}
 1686func (ResponseComputerToolCallActionType) implResponseComputerToolCallActionUnion()        {}
 1687func (ResponseComputerToolCallActionWait) implResponseComputerToolCallActionUnion()        {}
 1688
 1689// Use the following switch statement to find the correct variant
 1690//
 1691//	switch variant := ResponseComputerToolCallActionUnion.AsAny().(type) {
 1692//	case responses.ResponseComputerToolCallActionClick:
 1693//	case responses.ResponseComputerToolCallActionDoubleClick:
 1694//	case responses.ResponseComputerToolCallActionDrag:
 1695//	case responses.ResponseComputerToolCallActionKeypress:
 1696//	case responses.ResponseComputerToolCallActionMove:
 1697//	case responses.ResponseComputerToolCallActionScreenshot:
 1698//	case responses.ResponseComputerToolCallActionScroll:
 1699//	case responses.ResponseComputerToolCallActionType:
 1700//	case responses.ResponseComputerToolCallActionWait:
 1701//	default:
 1702//	  fmt.Errorf("no variant present")
 1703//	}
 1704func (u ResponseComputerToolCallActionUnion) AsAny() anyResponseComputerToolCallAction {
 1705	switch u.Type {
 1706	case "click":
 1707		return u.AsClick()
 1708	case "double_click":
 1709		return u.AsDoubleClick()
 1710	case "drag":
 1711		return u.AsDrag()
 1712	case "keypress":
 1713		return u.AsKeypress()
 1714	case "move":
 1715		return u.AsMove()
 1716	case "screenshot":
 1717		return u.AsScreenshot()
 1718	case "scroll":
 1719		return u.AsScroll()
 1720	case "type":
 1721		return u.AsType()
 1722	case "wait":
 1723		return u.AsWait()
 1724	}
 1725	return nil
 1726}
 1727
 1728func (u ResponseComputerToolCallActionUnion) AsClick() (v ResponseComputerToolCallActionClick) {
 1729	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 1730	return
 1731}
 1732
 1733func (u ResponseComputerToolCallActionUnion) AsDoubleClick() (v ResponseComputerToolCallActionDoubleClick) {
 1734	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 1735	return
 1736}
 1737
 1738func (u ResponseComputerToolCallActionUnion) AsDrag() (v ResponseComputerToolCallActionDrag) {
 1739	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 1740	return
 1741}
 1742
 1743func (u ResponseComputerToolCallActionUnion) AsKeypress() (v ResponseComputerToolCallActionKeypress) {
 1744	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 1745	return
 1746}
 1747
 1748func (u ResponseComputerToolCallActionUnion) AsMove() (v ResponseComputerToolCallActionMove) {
 1749	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 1750	return
 1751}
 1752
 1753func (u ResponseComputerToolCallActionUnion) AsScreenshot() (v ResponseComputerToolCallActionScreenshot) {
 1754	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 1755	return
 1756}
 1757
 1758func (u ResponseComputerToolCallActionUnion) AsScroll() (v ResponseComputerToolCallActionScroll) {
 1759	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 1760	return
 1761}
 1762
 1763func (u ResponseComputerToolCallActionUnion) AsType() (v ResponseComputerToolCallActionType) {
 1764	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 1765	return
 1766}
 1767
 1768func (u ResponseComputerToolCallActionUnion) AsWait() (v ResponseComputerToolCallActionWait) {
 1769	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 1770	return
 1771}
 1772
 1773// Returns the unmodified JSON received from the API
 1774func (u ResponseComputerToolCallActionUnion) RawJSON() string { return u.JSON.raw }
 1775
 1776func (r *ResponseComputerToolCallActionUnion) UnmarshalJSON(data []byte) error {
 1777	return apijson.UnmarshalRoot(data, r)
 1778}
 1779
 1780// A click action.
 1781type ResponseComputerToolCallActionClick struct {
 1782	// Indicates which mouse button was pressed during the click. One of `left`,
 1783	// `right`, `wheel`, `back`, or `forward`.
 1784	//
 1785	// Any of "left", "right", "wheel", "back", "forward".
 1786	Button string `json:"button,required"`
 1787	// Specifies the event type. For a click action, this property is always set to
 1788	// `click`.
 1789	Type constant.Click `json:"type,required"`
 1790	// The x-coordinate where the click occurred.
 1791	X int64 `json:"x,required"`
 1792	// The y-coordinate where the click occurred.
 1793	Y int64 `json:"y,required"`
 1794	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1795	JSON struct {
 1796		Button      respjson.Field
 1797		Type        respjson.Field
 1798		X           respjson.Field
 1799		Y           respjson.Field
 1800		ExtraFields map[string]respjson.Field
 1801		raw         string
 1802	} `json:"-"`
 1803}
 1804
 1805// Returns the unmodified JSON received from the API
 1806func (r ResponseComputerToolCallActionClick) RawJSON() string { return r.JSON.raw }
 1807func (r *ResponseComputerToolCallActionClick) UnmarshalJSON(data []byte) error {
 1808	return apijson.UnmarshalRoot(data, r)
 1809}
 1810
 1811// A double click action.
 1812type ResponseComputerToolCallActionDoubleClick struct {
 1813	// Specifies the event type. For a double click action, this property is always set
 1814	// to `double_click`.
 1815	Type constant.DoubleClick `json:"type,required"`
 1816	// The x-coordinate where the double click occurred.
 1817	X int64 `json:"x,required"`
 1818	// The y-coordinate where the double click occurred.
 1819	Y int64 `json:"y,required"`
 1820	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1821	JSON struct {
 1822		Type        respjson.Field
 1823		X           respjson.Field
 1824		Y           respjson.Field
 1825		ExtraFields map[string]respjson.Field
 1826		raw         string
 1827	} `json:"-"`
 1828}
 1829
 1830// Returns the unmodified JSON received from the API
 1831func (r ResponseComputerToolCallActionDoubleClick) RawJSON() string { return r.JSON.raw }
 1832func (r *ResponseComputerToolCallActionDoubleClick) UnmarshalJSON(data []byte) error {
 1833	return apijson.UnmarshalRoot(data, r)
 1834}
 1835
 1836// A drag action.
 1837type ResponseComputerToolCallActionDrag struct {
 1838	// An array of coordinates representing the path of the drag action. Coordinates
 1839	// will appear as an array of objects, eg
 1840	//
 1841	// ```
 1842	// [
 1843	//
 1844	//	{ x: 100, y: 200 },
 1845	//	{ x: 200, y: 300 }
 1846	//
 1847	// ]
 1848	// ```
 1849	Path []ResponseComputerToolCallActionDragPath `json:"path,required"`
 1850	// Specifies the event type. For a drag action, this property is always set to
 1851	// `drag`.
 1852	Type constant.Drag `json:"type,required"`
 1853	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1854	JSON struct {
 1855		Path        respjson.Field
 1856		Type        respjson.Field
 1857		ExtraFields map[string]respjson.Field
 1858		raw         string
 1859	} `json:"-"`
 1860}
 1861
 1862// Returns the unmodified JSON received from the API
 1863func (r ResponseComputerToolCallActionDrag) RawJSON() string { return r.JSON.raw }
 1864func (r *ResponseComputerToolCallActionDrag) UnmarshalJSON(data []byte) error {
 1865	return apijson.UnmarshalRoot(data, r)
 1866}
 1867
 1868// A series of x/y coordinate pairs in the drag path.
 1869type ResponseComputerToolCallActionDragPath struct {
 1870	// The x-coordinate.
 1871	X int64 `json:"x,required"`
 1872	// The y-coordinate.
 1873	Y int64 `json:"y,required"`
 1874	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1875	JSON struct {
 1876		X           respjson.Field
 1877		Y           respjson.Field
 1878		ExtraFields map[string]respjson.Field
 1879		raw         string
 1880	} `json:"-"`
 1881}
 1882
 1883// Returns the unmodified JSON received from the API
 1884func (r ResponseComputerToolCallActionDragPath) RawJSON() string { return r.JSON.raw }
 1885func (r *ResponseComputerToolCallActionDragPath) UnmarshalJSON(data []byte) error {
 1886	return apijson.UnmarshalRoot(data, r)
 1887}
 1888
 1889// A collection of keypresses the model would like to perform.
 1890type ResponseComputerToolCallActionKeypress struct {
 1891	// The combination of keys the model is requesting to be pressed. This is an array
 1892	// of strings, each representing a key.
 1893	Keys []string `json:"keys,required"`
 1894	// Specifies the event type. For a keypress action, this property is always set to
 1895	// `keypress`.
 1896	Type constant.Keypress `json:"type,required"`
 1897	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1898	JSON struct {
 1899		Keys        respjson.Field
 1900		Type        respjson.Field
 1901		ExtraFields map[string]respjson.Field
 1902		raw         string
 1903	} `json:"-"`
 1904}
 1905
 1906// Returns the unmodified JSON received from the API
 1907func (r ResponseComputerToolCallActionKeypress) RawJSON() string { return r.JSON.raw }
 1908func (r *ResponseComputerToolCallActionKeypress) UnmarshalJSON(data []byte) error {
 1909	return apijson.UnmarshalRoot(data, r)
 1910}
 1911
 1912// A mouse move action.
 1913type ResponseComputerToolCallActionMove struct {
 1914	// Specifies the event type. For a move action, this property is always set to
 1915	// `move`.
 1916	Type constant.Move `json:"type,required"`
 1917	// The x-coordinate to move to.
 1918	X int64 `json:"x,required"`
 1919	// The y-coordinate to move to.
 1920	Y int64 `json:"y,required"`
 1921	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1922	JSON struct {
 1923		Type        respjson.Field
 1924		X           respjson.Field
 1925		Y           respjson.Field
 1926		ExtraFields map[string]respjson.Field
 1927		raw         string
 1928	} `json:"-"`
 1929}
 1930
 1931// Returns the unmodified JSON received from the API
 1932func (r ResponseComputerToolCallActionMove) RawJSON() string { return r.JSON.raw }
 1933func (r *ResponseComputerToolCallActionMove) UnmarshalJSON(data []byte) error {
 1934	return apijson.UnmarshalRoot(data, r)
 1935}
 1936
 1937// A screenshot action.
 1938type ResponseComputerToolCallActionScreenshot struct {
 1939	// Specifies the event type. For a screenshot action, this property is always set
 1940	// to `screenshot`.
 1941	Type constant.Screenshot `json:"type,required"`
 1942	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1943	JSON struct {
 1944		Type        respjson.Field
 1945		ExtraFields map[string]respjson.Field
 1946		raw         string
 1947	} `json:"-"`
 1948}
 1949
 1950// Returns the unmodified JSON received from the API
 1951func (r ResponseComputerToolCallActionScreenshot) RawJSON() string { return r.JSON.raw }
 1952func (r *ResponseComputerToolCallActionScreenshot) UnmarshalJSON(data []byte) error {
 1953	return apijson.UnmarshalRoot(data, r)
 1954}
 1955
 1956// A scroll action.
 1957type ResponseComputerToolCallActionScroll struct {
 1958	// The horizontal scroll distance.
 1959	ScrollX int64 `json:"scroll_x,required"`
 1960	// The vertical scroll distance.
 1961	ScrollY int64 `json:"scroll_y,required"`
 1962	// Specifies the event type. For a scroll action, this property is always set to
 1963	// `scroll`.
 1964	Type constant.Scroll `json:"type,required"`
 1965	// The x-coordinate where the scroll occurred.
 1966	X int64 `json:"x,required"`
 1967	// The y-coordinate where the scroll occurred.
 1968	Y int64 `json:"y,required"`
 1969	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1970	JSON struct {
 1971		ScrollX     respjson.Field
 1972		ScrollY     respjson.Field
 1973		Type        respjson.Field
 1974		X           respjson.Field
 1975		Y           respjson.Field
 1976		ExtraFields map[string]respjson.Field
 1977		raw         string
 1978	} `json:"-"`
 1979}
 1980
 1981// Returns the unmodified JSON received from the API
 1982func (r ResponseComputerToolCallActionScroll) RawJSON() string { return r.JSON.raw }
 1983func (r *ResponseComputerToolCallActionScroll) UnmarshalJSON(data []byte) error {
 1984	return apijson.UnmarshalRoot(data, r)
 1985}
 1986
 1987// An action to type in text.
 1988type ResponseComputerToolCallActionType struct {
 1989	// The text to type.
 1990	Text string `json:"text,required"`
 1991	// Specifies the event type. For a type action, this property is always set to
 1992	// `type`.
 1993	Type constant.Type `json:"type,required"`
 1994	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 1995	JSON struct {
 1996		Text        respjson.Field
 1997		Type        respjson.Field
 1998		ExtraFields map[string]respjson.Field
 1999		raw         string
 2000	} `json:"-"`
 2001}
 2002
 2003// Returns the unmodified JSON received from the API
 2004func (r ResponseComputerToolCallActionType) RawJSON() string { return r.JSON.raw }
 2005func (r *ResponseComputerToolCallActionType) UnmarshalJSON(data []byte) error {
 2006	return apijson.UnmarshalRoot(data, r)
 2007}
 2008
 2009// A wait action.
 2010type ResponseComputerToolCallActionWait struct {
 2011	// Specifies the event type. For a wait action, this property is always set to
 2012	// `wait`.
 2013	Type constant.Wait `json:"type,required"`
 2014	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 2015	JSON struct {
 2016		Type        respjson.Field
 2017		ExtraFields map[string]respjson.Field
 2018		raw         string
 2019	} `json:"-"`
 2020}
 2021
 2022// Returns the unmodified JSON received from the API
 2023func (r ResponseComputerToolCallActionWait) RawJSON() string { return r.JSON.raw }
 2024func (r *ResponseComputerToolCallActionWait) UnmarshalJSON(data []byte) error {
 2025	return apijson.UnmarshalRoot(data, r)
 2026}
 2027
 2028// A pending safety check for the computer call.
 2029type ResponseComputerToolCallPendingSafetyCheck struct {
 2030	// The ID of the pending safety check.
 2031	ID string `json:"id,required"`
 2032	// The type of the pending safety check.
 2033	Code string `json:"code,required"`
 2034	// Details about the pending safety check.
 2035	Message string `json:"message,required"`
 2036	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 2037	JSON struct {
 2038		ID          respjson.Field
 2039		Code        respjson.Field
 2040		Message     respjson.Field
 2041		ExtraFields map[string]respjson.Field
 2042		raw         string
 2043	} `json:"-"`
 2044}
 2045
 2046// Returns the unmodified JSON received from the API
 2047func (r ResponseComputerToolCallPendingSafetyCheck) RawJSON() string { return r.JSON.raw }
 2048func (r *ResponseComputerToolCallPendingSafetyCheck) UnmarshalJSON(data []byte) error {
 2049	return apijson.UnmarshalRoot(data, r)
 2050}
 2051
 2052// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
 2053// Populated when items are returned via API.
 2054type ResponseComputerToolCallStatus string
 2055
 2056const (
 2057	ResponseComputerToolCallStatusInProgress ResponseComputerToolCallStatus = "in_progress"
 2058	ResponseComputerToolCallStatusCompleted  ResponseComputerToolCallStatus = "completed"
 2059	ResponseComputerToolCallStatusIncomplete ResponseComputerToolCallStatus = "incomplete"
 2060)
 2061
 2062// The type of the computer call. Always `computer_call`.
 2063type ResponseComputerToolCallType string
 2064
 2065const (
 2066	ResponseComputerToolCallTypeComputerCall ResponseComputerToolCallType = "computer_call"
 2067)
 2068
 2069// A tool call to a computer use tool. See the
 2070// [computer use guide](https://platform.openai.com/docs/guides/tools-computer-use)
 2071// for more information.
 2072//
 2073// The properties ID, Action, CallID, PendingSafetyChecks, Status, Type are
 2074// required.
 2075type ResponseComputerToolCallParam struct {
 2076	// The unique ID of the computer call.
 2077	ID string `json:"id,required"`
 2078	// A click action.
 2079	Action ResponseComputerToolCallActionUnionParam `json:"action,omitzero,required"`
 2080	// An identifier used when responding to the tool call with output.
 2081	CallID string `json:"call_id,required"`
 2082	// The pending safety checks for the computer call.
 2083	PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheckParam `json:"pending_safety_checks,omitzero,required"`
 2084	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
 2085	// Populated when items are returned via API.
 2086	//
 2087	// Any of "in_progress", "completed", "incomplete".
 2088	Status ResponseComputerToolCallStatus `json:"status,omitzero,required"`
 2089	// The type of the computer call. Always `computer_call`.
 2090	//
 2091	// Any of "computer_call".
 2092	Type ResponseComputerToolCallType `json:"type,omitzero,required"`
 2093	paramObj
 2094}
 2095
 2096func (r ResponseComputerToolCallParam) MarshalJSON() (data []byte, err error) {
 2097	type shadow ResponseComputerToolCallParam
 2098	return param.MarshalObject(r, (*shadow)(&r))
 2099}
 2100func (r *ResponseComputerToolCallParam) UnmarshalJSON(data []byte) error {
 2101	return apijson.UnmarshalRoot(data, r)
 2102}
 2103
 2104// Only one field can be non-zero.
 2105//
 2106// Use [param.IsOmitted] to confirm if a field is set.
 2107type ResponseComputerToolCallActionUnionParam struct {
 2108	OfClick       *ResponseComputerToolCallActionClickParam       `json:",omitzero,inline"`
 2109	OfDoubleClick *ResponseComputerToolCallActionDoubleClickParam `json:",omitzero,inline"`
 2110	OfDrag        *ResponseComputerToolCallActionDragParam        `json:",omitzero,inline"`
 2111	OfKeypress    *ResponseComputerToolCallActionKeypressParam    `json:",omitzero,inline"`
 2112	OfMove        *ResponseComputerToolCallActionMoveParam        `json:",omitzero,inline"`
 2113	OfScreenshot  *ResponseComputerToolCallActionScreenshotParam  `json:",omitzero,inline"`
 2114	OfScroll      *ResponseComputerToolCallActionScrollParam      `json:",omitzero,inline"`
 2115	OfType        *ResponseComputerToolCallActionTypeParam        `json:",omitzero,inline"`
 2116	OfWait        *ResponseComputerToolCallActionWaitParam        `json:",omitzero,inline"`
 2117	paramUnion
 2118}
 2119
 2120func (u ResponseComputerToolCallActionUnionParam) MarshalJSON() ([]byte, error) {
 2121	return param.MarshalUnion(u, u.OfClick,
 2122		u.OfDoubleClick,
 2123		u.OfDrag,
 2124		u.OfKeypress,
 2125		u.OfMove,
 2126		u.OfScreenshot,
 2127		u.OfScroll,
 2128		u.OfType,
 2129		u.OfWait)
 2130}
 2131func (u *ResponseComputerToolCallActionUnionParam) UnmarshalJSON(data []byte) error {
 2132	return apijson.UnmarshalRoot(data, u)
 2133}
 2134
 2135func (u *ResponseComputerToolCallActionUnionParam) asAny() any {
 2136	if !param.IsOmitted(u.OfClick) {
 2137		return u.OfClick
 2138	} else if !param.IsOmitted(u.OfDoubleClick) {
 2139		return u.OfDoubleClick
 2140	} else if !param.IsOmitted(u.OfDrag) {
 2141		return u.OfDrag
 2142	} else if !param.IsOmitted(u.OfKeypress) {
 2143		return u.OfKeypress
 2144	} else if !param.IsOmitted(u.OfMove) {
 2145		return u.OfMove
 2146	} else if !param.IsOmitted(u.OfScreenshot) {
 2147		return u.OfScreenshot
 2148	} else if !param.IsOmitted(u.OfScroll) {
 2149		return u.OfScroll
 2150	} else if !param.IsOmitted(u.OfType) {
 2151		return u.OfType
 2152	} else if !param.IsOmitted(u.OfWait) {
 2153		return u.OfWait
 2154	}
 2155	return nil
 2156}
 2157
 2158// Returns a pointer to the underlying variant's property, if present.
 2159func (u ResponseComputerToolCallActionUnionParam) GetButton() *string {
 2160	if vt := u.OfClick; vt != nil {
 2161		return &vt.Button
 2162	}
 2163	return nil
 2164}
 2165
 2166// Returns a pointer to the underlying variant's property, if present.
 2167func (u ResponseComputerToolCallActionUnionParam) GetPath() []ResponseComputerToolCallActionDragPathParam {
 2168	if vt := u.OfDrag; vt != nil {
 2169		return vt.Path
 2170	}
 2171	return nil
 2172}
 2173
 2174// Returns a pointer to the underlying variant's property, if present.
 2175func (u ResponseComputerToolCallActionUnionParam) GetKeys() []string {
 2176	if vt := u.OfKeypress; vt != nil {
 2177		return vt.Keys
 2178	}
 2179	return nil
 2180}
 2181
 2182// Returns a pointer to the underlying variant's property, if present.
 2183func (u ResponseComputerToolCallActionUnionParam) GetScrollX() *int64 {
 2184	if vt := u.OfScroll; vt != nil {
 2185		return &vt.ScrollX
 2186	}
 2187	return nil
 2188}
 2189
 2190// Returns a pointer to the underlying variant's property, if present.
 2191func (u ResponseComputerToolCallActionUnionParam) GetScrollY() *int64 {
 2192	if vt := u.OfScroll; vt != nil {
 2193		return &vt.ScrollY
 2194	}
 2195	return nil
 2196}
 2197
 2198// Returns a pointer to the underlying variant's property, if present.
 2199func (u ResponseComputerToolCallActionUnionParam) GetText() *string {
 2200	if vt := u.OfType; vt != nil {
 2201		return &vt.Text
 2202	}
 2203	return nil
 2204}
 2205
 2206// Returns a pointer to the underlying variant's property, if present.
 2207func (u ResponseComputerToolCallActionUnionParam) GetType() *string {
 2208	if vt := u.OfClick; vt != nil {
 2209		return (*string)(&vt.Type)
 2210	} else if vt := u.OfDoubleClick; vt != nil {
 2211		return (*string)(&vt.Type)
 2212	} else if vt := u.OfDrag; vt != nil {
 2213		return (*string)(&vt.Type)
 2214	} else if vt := u.OfKeypress; vt != nil {
 2215		return (*string)(&vt.Type)
 2216	} else if vt := u.OfMove; vt != nil {
 2217		return (*string)(&vt.Type)
 2218	} else if vt := u.OfScreenshot; vt != nil {
 2219		return (*string)(&vt.Type)
 2220	} else if vt := u.OfScroll; vt != nil {
 2221		return (*string)(&vt.Type)
 2222	} else if vt := u.OfType; vt != nil {
 2223		return (*string)(&vt.Type)
 2224	} else if vt := u.OfWait; vt != nil {
 2225		return (*string)(&vt.Type)
 2226	}
 2227	return nil
 2228}
 2229
 2230// Returns a pointer to the underlying variant's property, if present.
 2231func (u ResponseComputerToolCallActionUnionParam) GetX() *int64 {
 2232	if vt := u.OfClick; vt != nil {
 2233		return (*int64)(&vt.X)
 2234	} else if vt := u.OfDoubleClick; vt != nil {
 2235		return (*int64)(&vt.X)
 2236	} else if vt := u.OfMove; vt != nil {
 2237		return (*int64)(&vt.X)
 2238	} else if vt := u.OfScroll; vt != nil {
 2239		return (*int64)(&vt.X)
 2240	}
 2241	return nil
 2242}
 2243
 2244// Returns a pointer to the underlying variant's property, if present.
 2245func (u ResponseComputerToolCallActionUnionParam) GetY() *int64 {
 2246	if vt := u.OfClick; vt != nil {
 2247		return (*int64)(&vt.Y)
 2248	} else if vt := u.OfDoubleClick; vt != nil {
 2249		return (*int64)(&vt.Y)
 2250	} else if vt := u.OfMove; vt != nil {
 2251		return (*int64)(&vt.Y)
 2252	} else if vt := u.OfScroll; vt != nil {
 2253		return (*int64)(&vt.Y)
 2254	}
 2255	return nil
 2256}
 2257
 2258func init() {
 2259	apijson.RegisterUnion[ResponseComputerToolCallActionUnionParam](
 2260		"type",
 2261		apijson.Discriminator[ResponseComputerToolCallActionClickParam]("click"),
 2262		apijson.Discriminator[ResponseComputerToolCallActionDoubleClickParam]("double_click"),
 2263		apijson.Discriminator[ResponseComputerToolCallActionDragParam]("drag"),
 2264		apijson.Discriminator[ResponseComputerToolCallActionKeypressParam]("keypress"),
 2265		apijson.Discriminator[ResponseComputerToolCallActionMoveParam]("move"),
 2266		apijson.Discriminator[ResponseComputerToolCallActionScreenshotParam]("screenshot"),
 2267		apijson.Discriminator[ResponseComputerToolCallActionScrollParam]("scroll"),
 2268		apijson.Discriminator[ResponseComputerToolCallActionTypeParam]("type"),
 2269		apijson.Discriminator[ResponseComputerToolCallActionWaitParam]("wait"),
 2270	)
 2271}
 2272
 2273// A click action.
 2274//
 2275// The properties Button, Type, X, Y are required.
 2276type ResponseComputerToolCallActionClickParam struct {
 2277	// Indicates which mouse button was pressed during the click. One of `left`,
 2278	// `right`, `wheel`, `back`, or `forward`.
 2279	//
 2280	// Any of "left", "right", "wheel", "back", "forward".
 2281	Button string `json:"button,omitzero,required"`
 2282	// The x-coordinate where the click occurred.
 2283	X int64 `json:"x,required"`
 2284	// The y-coordinate where the click occurred.
 2285	Y int64 `json:"y,required"`
 2286	// Specifies the event type. For a click action, this property is always set to
 2287	// `click`.
 2288	//
 2289	// This field can be elided, and will marshal its zero value as "click".
 2290	Type constant.Click `json:"type,required"`
 2291	paramObj
 2292}
 2293
 2294func (r ResponseComputerToolCallActionClickParam) MarshalJSON() (data []byte, err error) {
 2295	type shadow ResponseComputerToolCallActionClickParam
 2296	return param.MarshalObject(r, (*shadow)(&r))
 2297}
 2298func (r *ResponseComputerToolCallActionClickParam) UnmarshalJSON(data []byte) error {
 2299	return apijson.UnmarshalRoot(data, r)
 2300}
 2301
 2302func init() {
 2303	apijson.RegisterFieldValidator[ResponseComputerToolCallActionClickParam](
 2304		"button", "left", "right", "wheel", "back", "forward",
 2305	)
 2306}
 2307
 2308// A double click action.
 2309//
 2310// The properties Type, X, Y are required.
 2311type ResponseComputerToolCallActionDoubleClickParam struct {
 2312	// The x-coordinate where the double click occurred.
 2313	X int64 `json:"x,required"`
 2314	// The y-coordinate where the double click occurred.
 2315	Y int64 `json:"y,required"`
 2316	// Specifies the event type. For a double click action, this property is always set
 2317	// to `double_click`.
 2318	//
 2319	// This field can be elided, and will marshal its zero value as "double_click".
 2320	Type constant.DoubleClick `json:"type,required"`
 2321	paramObj
 2322}
 2323
 2324func (r ResponseComputerToolCallActionDoubleClickParam) MarshalJSON() (data []byte, err error) {
 2325	type shadow ResponseComputerToolCallActionDoubleClickParam
 2326	return param.MarshalObject(r, (*shadow)(&r))
 2327}
 2328func (r *ResponseComputerToolCallActionDoubleClickParam) UnmarshalJSON(data []byte) error {
 2329	return apijson.UnmarshalRoot(data, r)
 2330}
 2331
 2332// A drag action.
 2333//
 2334// The properties Path, Type are required.
 2335type ResponseComputerToolCallActionDragParam struct {
 2336	// An array of coordinates representing the path of the drag action. Coordinates
 2337	// will appear as an array of objects, eg
 2338	//
 2339	// ```
 2340	// [
 2341	//
 2342	//	{ x: 100, y: 200 },
 2343	//	{ x: 200, y: 300 }
 2344	//
 2345	// ]
 2346	// ```
 2347	Path []ResponseComputerToolCallActionDragPathParam `json:"path,omitzero,required"`
 2348	// Specifies the event type. For a drag action, this property is always set to
 2349	// `drag`.
 2350	//
 2351	// This field can be elided, and will marshal its zero value as "drag".
 2352	Type constant.Drag `json:"type,required"`
 2353	paramObj
 2354}
 2355
 2356func (r ResponseComputerToolCallActionDragParam) MarshalJSON() (data []byte, err error) {
 2357	type shadow ResponseComputerToolCallActionDragParam
 2358	return param.MarshalObject(r, (*shadow)(&r))
 2359}
 2360func (r *ResponseComputerToolCallActionDragParam) UnmarshalJSON(data []byte) error {
 2361	return apijson.UnmarshalRoot(data, r)
 2362}
 2363
 2364// A series of x/y coordinate pairs in the drag path.
 2365//
 2366// The properties X, Y are required.
 2367type ResponseComputerToolCallActionDragPathParam struct {
 2368	// The x-coordinate.
 2369	X int64 `json:"x,required"`
 2370	// The y-coordinate.
 2371	Y int64 `json:"y,required"`
 2372	paramObj
 2373}
 2374
 2375func (r ResponseComputerToolCallActionDragPathParam) MarshalJSON() (data []byte, err error) {
 2376	type shadow ResponseComputerToolCallActionDragPathParam
 2377	return param.MarshalObject(r, (*shadow)(&r))
 2378}
 2379func (r *ResponseComputerToolCallActionDragPathParam) UnmarshalJSON(data []byte) error {
 2380	return apijson.UnmarshalRoot(data, r)
 2381}
 2382
 2383// A collection of keypresses the model would like to perform.
 2384//
 2385// The properties Keys, Type are required.
 2386type ResponseComputerToolCallActionKeypressParam struct {
 2387	// The combination of keys the model is requesting to be pressed. This is an array
 2388	// of strings, each representing a key.
 2389	Keys []string `json:"keys,omitzero,required"`
 2390	// Specifies the event type. For a keypress action, this property is always set to
 2391	// `keypress`.
 2392	//
 2393	// This field can be elided, and will marshal its zero value as "keypress".
 2394	Type constant.Keypress `json:"type,required"`
 2395	paramObj
 2396}
 2397
 2398func (r ResponseComputerToolCallActionKeypressParam) MarshalJSON() (data []byte, err error) {
 2399	type shadow ResponseComputerToolCallActionKeypressParam
 2400	return param.MarshalObject(r, (*shadow)(&r))
 2401}
 2402func (r *ResponseComputerToolCallActionKeypressParam) UnmarshalJSON(data []byte) error {
 2403	return apijson.UnmarshalRoot(data, r)
 2404}
 2405
 2406// A mouse move action.
 2407//
 2408// The properties Type, X, Y are required.
 2409type ResponseComputerToolCallActionMoveParam struct {
 2410	// The x-coordinate to move to.
 2411	X int64 `json:"x,required"`
 2412	// The y-coordinate to move to.
 2413	Y int64 `json:"y,required"`
 2414	// Specifies the event type. For a move action, this property is always set to
 2415	// `move`.
 2416	//
 2417	// This field can be elided, and will marshal its zero value as "move".
 2418	Type constant.Move `json:"type,required"`
 2419	paramObj
 2420}
 2421
 2422func (r ResponseComputerToolCallActionMoveParam) MarshalJSON() (data []byte, err error) {
 2423	type shadow ResponseComputerToolCallActionMoveParam
 2424	return param.MarshalObject(r, (*shadow)(&r))
 2425}
 2426func (r *ResponseComputerToolCallActionMoveParam) UnmarshalJSON(data []byte) error {
 2427	return apijson.UnmarshalRoot(data, r)
 2428}
 2429
 2430func NewResponseComputerToolCallActionScreenshotParam() ResponseComputerToolCallActionScreenshotParam {
 2431	return ResponseComputerToolCallActionScreenshotParam{
 2432		Type: "screenshot",
 2433	}
 2434}
 2435
 2436// A screenshot action.
 2437//
 2438// This struct has a constant value, construct it with
 2439// [NewResponseComputerToolCallActionScreenshotParam].
 2440type ResponseComputerToolCallActionScreenshotParam struct {
 2441	// Specifies the event type. For a screenshot action, this property is always set
 2442	// to `screenshot`.
 2443	Type constant.Screenshot `json:"type,required"`
 2444	paramObj
 2445}
 2446
 2447func (r ResponseComputerToolCallActionScreenshotParam) MarshalJSON() (data []byte, err error) {
 2448	type shadow ResponseComputerToolCallActionScreenshotParam
 2449	return param.MarshalObject(r, (*shadow)(&r))
 2450}
 2451func (r *ResponseComputerToolCallActionScreenshotParam) UnmarshalJSON(data []byte) error {
 2452	return apijson.UnmarshalRoot(data, r)
 2453}
 2454
 2455// A scroll action.
 2456//
 2457// The properties ScrollX, ScrollY, Type, X, Y are required.
 2458type ResponseComputerToolCallActionScrollParam struct {
 2459	// The horizontal scroll distance.
 2460	ScrollX int64 `json:"scroll_x,required"`
 2461	// The vertical scroll distance.
 2462	ScrollY int64 `json:"scroll_y,required"`
 2463	// The x-coordinate where the scroll occurred.
 2464	X int64 `json:"x,required"`
 2465	// The y-coordinate where the scroll occurred.
 2466	Y int64 `json:"y,required"`
 2467	// Specifies the event type. For a scroll action, this property is always set to
 2468	// `scroll`.
 2469	//
 2470	// This field can be elided, and will marshal its zero value as "scroll".
 2471	Type constant.Scroll `json:"type,required"`
 2472	paramObj
 2473}
 2474
 2475func (r ResponseComputerToolCallActionScrollParam) MarshalJSON() (data []byte, err error) {
 2476	type shadow ResponseComputerToolCallActionScrollParam
 2477	return param.MarshalObject(r, (*shadow)(&r))
 2478}
 2479func (r *ResponseComputerToolCallActionScrollParam) UnmarshalJSON(data []byte) error {
 2480	return apijson.UnmarshalRoot(data, r)
 2481}
 2482
 2483// An action to type in text.
 2484//
 2485// The properties Text, Type are required.
 2486type ResponseComputerToolCallActionTypeParam struct {
 2487	// The text to type.
 2488	Text string `json:"text,required"`
 2489	// Specifies the event type. For a type action, this property is always set to
 2490	// `type`.
 2491	//
 2492	// This field can be elided, and will marshal its zero value as "type".
 2493	Type constant.Type `json:"type,required"`
 2494	paramObj
 2495}
 2496
 2497func (r ResponseComputerToolCallActionTypeParam) MarshalJSON() (data []byte, err error) {
 2498	type shadow ResponseComputerToolCallActionTypeParam
 2499	return param.MarshalObject(r, (*shadow)(&r))
 2500}
 2501func (r *ResponseComputerToolCallActionTypeParam) UnmarshalJSON(data []byte) error {
 2502	return apijson.UnmarshalRoot(data, r)
 2503}
 2504
 2505func NewResponseComputerToolCallActionWaitParam() ResponseComputerToolCallActionWaitParam {
 2506	return ResponseComputerToolCallActionWaitParam{
 2507		Type: "wait",
 2508	}
 2509}
 2510
 2511// A wait action.
 2512//
 2513// This struct has a constant value, construct it with
 2514// [NewResponseComputerToolCallActionWaitParam].
 2515type ResponseComputerToolCallActionWaitParam struct {
 2516	// Specifies the event type. For a wait action, this property is always set to
 2517	// `wait`.
 2518	Type constant.Wait `json:"type,required"`
 2519	paramObj
 2520}
 2521
 2522func (r ResponseComputerToolCallActionWaitParam) MarshalJSON() (data []byte, err error) {
 2523	type shadow ResponseComputerToolCallActionWaitParam
 2524	return param.MarshalObject(r, (*shadow)(&r))
 2525}
 2526func (r *ResponseComputerToolCallActionWaitParam) UnmarshalJSON(data []byte) error {
 2527	return apijson.UnmarshalRoot(data, r)
 2528}
 2529
 2530// A pending safety check for the computer call.
 2531//
 2532// The properties ID, Code, Message are required.
 2533type ResponseComputerToolCallPendingSafetyCheckParam struct {
 2534	// The ID of the pending safety check.
 2535	ID string `json:"id,required"`
 2536	// The type of the pending safety check.
 2537	Code string `json:"code,required"`
 2538	// Details about the pending safety check.
 2539	Message string `json:"message,required"`
 2540	paramObj
 2541}
 2542
 2543func (r ResponseComputerToolCallPendingSafetyCheckParam) MarshalJSON() (data []byte, err error) {
 2544	type shadow ResponseComputerToolCallPendingSafetyCheckParam
 2545	return param.MarshalObject(r, (*shadow)(&r))
 2546}
 2547func (r *ResponseComputerToolCallPendingSafetyCheckParam) UnmarshalJSON(data []byte) error {
 2548	return apijson.UnmarshalRoot(data, r)
 2549}
 2550
 2551type ResponseComputerToolCallOutputItem struct {
 2552	// The unique ID of the computer call tool output.
 2553	ID string `json:"id,required"`
 2554	// The ID of the computer tool call that produced the output.
 2555	CallID string `json:"call_id,required"`
 2556	// A computer screenshot image used with the computer use tool.
 2557	Output ResponseComputerToolCallOutputScreenshot `json:"output,required"`
 2558	// The type of the computer tool call output. Always `computer_call_output`.
 2559	Type constant.ComputerCallOutput `json:"type,required"`
 2560	// The safety checks reported by the API that have been acknowledged by the
 2561	// developer.
 2562	AcknowledgedSafetyChecks []ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck `json:"acknowledged_safety_checks"`
 2563	// The status of the message input. One of `in_progress`, `completed`, or
 2564	// `incomplete`. Populated when input items are returned via API.
 2565	//
 2566	// Any of "in_progress", "completed", "incomplete".
 2567	Status ResponseComputerToolCallOutputItemStatus `json:"status"`
 2568	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 2569	JSON struct {
 2570		ID                       respjson.Field
 2571		CallID                   respjson.Field
 2572		Output                   respjson.Field
 2573		Type                     respjson.Field
 2574		AcknowledgedSafetyChecks respjson.Field
 2575		Status                   respjson.Field
 2576		ExtraFields              map[string]respjson.Field
 2577		raw                      string
 2578	} `json:"-"`
 2579}
 2580
 2581// Returns the unmodified JSON received from the API
 2582func (r ResponseComputerToolCallOutputItem) RawJSON() string { return r.JSON.raw }
 2583func (r *ResponseComputerToolCallOutputItem) UnmarshalJSON(data []byte) error {
 2584	return apijson.UnmarshalRoot(data, r)
 2585}
 2586
 2587// A pending safety check for the computer call.
 2588type ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck struct {
 2589	// The ID of the pending safety check.
 2590	ID string `json:"id,required"`
 2591	// The type of the pending safety check.
 2592	Code string `json:"code,required"`
 2593	// Details about the pending safety check.
 2594	Message string `json:"message,required"`
 2595	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 2596	JSON struct {
 2597		ID          respjson.Field
 2598		Code        respjson.Field
 2599		Message     respjson.Field
 2600		ExtraFields map[string]respjson.Field
 2601		raw         string
 2602	} `json:"-"`
 2603}
 2604
 2605// Returns the unmodified JSON received from the API
 2606func (r ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck) RawJSON() string {
 2607	return r.JSON.raw
 2608}
 2609func (r *ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck) UnmarshalJSON(data []byte) error {
 2610	return apijson.UnmarshalRoot(data, r)
 2611}
 2612
 2613// The status of the message input. One of `in_progress`, `completed`, or
 2614// `incomplete`. Populated when input items are returned via API.
 2615type ResponseComputerToolCallOutputItemStatus string
 2616
 2617const (
 2618	ResponseComputerToolCallOutputItemStatusInProgress ResponseComputerToolCallOutputItemStatus = "in_progress"
 2619	ResponseComputerToolCallOutputItemStatusCompleted  ResponseComputerToolCallOutputItemStatus = "completed"
 2620	ResponseComputerToolCallOutputItemStatusIncomplete ResponseComputerToolCallOutputItemStatus = "incomplete"
 2621)
 2622
 2623// A computer screenshot image used with the computer use tool.
 2624type ResponseComputerToolCallOutputScreenshot struct {
 2625	// Specifies the event type. For a computer screenshot, this property is always set
 2626	// to `computer_screenshot`.
 2627	Type constant.ComputerScreenshot `json:"type,required"`
 2628	// The identifier of an uploaded file that contains the screenshot.
 2629	FileID string `json:"file_id"`
 2630	// The URL of the screenshot image.
 2631	ImageURL string `json:"image_url"`
 2632	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 2633	JSON struct {
 2634		Type        respjson.Field
 2635		FileID      respjson.Field
 2636		ImageURL    respjson.Field
 2637		ExtraFields map[string]respjson.Field
 2638		raw         string
 2639	} `json:"-"`
 2640}
 2641
 2642// Returns the unmodified JSON received from the API
 2643func (r ResponseComputerToolCallOutputScreenshot) RawJSON() string { return r.JSON.raw }
 2644func (r *ResponseComputerToolCallOutputScreenshot) UnmarshalJSON(data []byte) error {
 2645	return apijson.UnmarshalRoot(data, r)
 2646}
 2647
 2648// ToParam converts this ResponseComputerToolCallOutputScreenshot to a
 2649// ResponseComputerToolCallOutputScreenshotParam.
 2650//
 2651// Warning: the fields of the param type will not be present. ToParam should only
 2652// be used at the last possible moment before sending a request. Test for this with
 2653// ResponseComputerToolCallOutputScreenshotParam.Overrides()
 2654func (r ResponseComputerToolCallOutputScreenshot) ToParam() ResponseComputerToolCallOutputScreenshotParam {
 2655	return param.Override[ResponseComputerToolCallOutputScreenshotParam](json.RawMessage(r.RawJSON()))
 2656}
 2657
 2658// A computer screenshot image used with the computer use tool.
 2659//
 2660// The property Type is required.
 2661type ResponseComputerToolCallOutputScreenshotParam struct {
 2662	// The identifier of an uploaded file that contains the screenshot.
 2663	FileID param.Opt[string] `json:"file_id,omitzero"`
 2664	// The URL of the screenshot image.
 2665	ImageURL param.Opt[string] `json:"image_url,omitzero"`
 2666	// Specifies the event type. For a computer screenshot, this property is always set
 2667	// to `computer_screenshot`.
 2668	//
 2669	// This field can be elided, and will marshal its zero value as
 2670	// "computer_screenshot".
 2671	Type constant.ComputerScreenshot `json:"type,required"`
 2672	paramObj
 2673}
 2674
 2675func (r ResponseComputerToolCallOutputScreenshotParam) MarshalJSON() (data []byte, err error) {
 2676	type shadow ResponseComputerToolCallOutputScreenshotParam
 2677	return param.MarshalObject(r, (*shadow)(&r))
 2678}
 2679func (r *ResponseComputerToolCallOutputScreenshotParam) UnmarshalJSON(data []byte) error {
 2680	return apijson.UnmarshalRoot(data, r)
 2681}
 2682
 2683// Emitted when a new content part is added.
 2684type ResponseContentPartAddedEvent struct {
 2685	// The index of the content part that was added.
 2686	ContentIndex int64 `json:"content_index,required"`
 2687	// The ID of the output item that the content part was added to.
 2688	ItemID string `json:"item_id,required"`
 2689	// The index of the output item that the content part was added to.
 2690	OutputIndex int64 `json:"output_index,required"`
 2691	// The content part that was added.
 2692	Part ResponseContentPartAddedEventPartUnion `json:"part,required"`
 2693	// The sequence number of this event.
 2694	SequenceNumber int64 `json:"sequence_number,required"`
 2695	// The type of the event. Always `response.content_part.added`.
 2696	Type constant.ResponseContentPartAdded `json:"type,required"`
 2697	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 2698	JSON struct {
 2699		ContentIndex   respjson.Field
 2700		ItemID         respjson.Field
 2701		OutputIndex    respjson.Field
 2702		Part           respjson.Field
 2703		SequenceNumber respjson.Field
 2704		Type           respjson.Field
 2705		ExtraFields    map[string]respjson.Field
 2706		raw            string
 2707	} `json:"-"`
 2708}
 2709
 2710// Returns the unmodified JSON received from the API
 2711func (r ResponseContentPartAddedEvent) RawJSON() string { return r.JSON.raw }
 2712func (r *ResponseContentPartAddedEvent) UnmarshalJSON(data []byte) error {
 2713	return apijson.UnmarshalRoot(data, r)
 2714}
 2715
 2716// ResponseContentPartAddedEventPartUnion contains all possible properties and
 2717// values from [ResponseOutputText], [ResponseOutputRefusal].
 2718//
 2719// Use the [ResponseContentPartAddedEventPartUnion.AsAny] method to switch on the
 2720// variant.
 2721//
 2722// Use the methods beginning with 'As' to cast the union to one of its variants.
 2723type ResponseContentPartAddedEventPartUnion struct {
 2724	// This field is from variant [ResponseOutputText].
 2725	Annotations []ResponseOutputTextAnnotationUnion `json:"annotations"`
 2726	// This field is from variant [ResponseOutputText].
 2727	Text string `json:"text"`
 2728	// Any of "output_text", "refusal".
 2729	Type string `json:"type"`
 2730	// This field is from variant [ResponseOutputText].
 2731	Logprobs []ResponseOutputTextLogprob `json:"logprobs"`
 2732	// This field is from variant [ResponseOutputRefusal].
 2733	Refusal string `json:"refusal"`
 2734	JSON    struct {
 2735		Annotations respjson.Field
 2736		Text        respjson.Field
 2737		Type        respjson.Field
 2738		Logprobs    respjson.Field
 2739		Refusal     respjson.Field
 2740		raw         string
 2741	} `json:"-"`
 2742}
 2743
 2744// anyResponseContentPartAddedEventPart is implemented by each variant of
 2745// [ResponseContentPartAddedEventPartUnion] to add type safety for the return type
 2746// of [ResponseContentPartAddedEventPartUnion.AsAny]
 2747type anyResponseContentPartAddedEventPart interface {
 2748	implResponseContentPartAddedEventPartUnion()
 2749}
 2750
 2751func (ResponseOutputText) implResponseContentPartAddedEventPartUnion()    {}
 2752func (ResponseOutputRefusal) implResponseContentPartAddedEventPartUnion() {}
 2753
 2754// Use the following switch statement to find the correct variant
 2755//
 2756//	switch variant := ResponseContentPartAddedEventPartUnion.AsAny().(type) {
 2757//	case responses.ResponseOutputText:
 2758//	case responses.ResponseOutputRefusal:
 2759//	default:
 2760//	  fmt.Errorf("no variant present")
 2761//	}
 2762func (u ResponseContentPartAddedEventPartUnion) AsAny() anyResponseContentPartAddedEventPart {
 2763	switch u.Type {
 2764	case "output_text":
 2765		return u.AsOutputText()
 2766	case "refusal":
 2767		return u.AsRefusal()
 2768	}
 2769	return nil
 2770}
 2771
 2772func (u ResponseContentPartAddedEventPartUnion) AsOutputText() (v ResponseOutputText) {
 2773	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 2774	return
 2775}
 2776
 2777func (u ResponseContentPartAddedEventPartUnion) AsRefusal() (v ResponseOutputRefusal) {
 2778	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 2779	return
 2780}
 2781
 2782// Returns the unmodified JSON received from the API
 2783func (u ResponseContentPartAddedEventPartUnion) RawJSON() string { return u.JSON.raw }
 2784
 2785func (r *ResponseContentPartAddedEventPartUnion) UnmarshalJSON(data []byte) error {
 2786	return apijson.UnmarshalRoot(data, r)
 2787}
 2788
 2789// Emitted when a content part is done.
 2790type ResponseContentPartDoneEvent struct {
 2791	// The index of the content part that is done.
 2792	ContentIndex int64 `json:"content_index,required"`
 2793	// The ID of the output item that the content part was added to.
 2794	ItemID string `json:"item_id,required"`
 2795	// The index of the output item that the content part was added to.
 2796	OutputIndex int64 `json:"output_index,required"`
 2797	// The content part that is done.
 2798	Part ResponseContentPartDoneEventPartUnion `json:"part,required"`
 2799	// The sequence number of this event.
 2800	SequenceNumber int64 `json:"sequence_number,required"`
 2801	// The type of the event. Always `response.content_part.done`.
 2802	Type constant.ResponseContentPartDone `json:"type,required"`
 2803	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 2804	JSON struct {
 2805		ContentIndex   respjson.Field
 2806		ItemID         respjson.Field
 2807		OutputIndex    respjson.Field
 2808		Part           respjson.Field
 2809		SequenceNumber respjson.Field
 2810		Type           respjson.Field
 2811		ExtraFields    map[string]respjson.Field
 2812		raw            string
 2813	} `json:"-"`
 2814}
 2815
 2816// Returns the unmodified JSON received from the API
 2817func (r ResponseContentPartDoneEvent) RawJSON() string { return r.JSON.raw }
 2818func (r *ResponseContentPartDoneEvent) UnmarshalJSON(data []byte) error {
 2819	return apijson.UnmarshalRoot(data, r)
 2820}
 2821
 2822// ResponseContentPartDoneEventPartUnion contains all possible properties and
 2823// values from [ResponseOutputText], [ResponseOutputRefusal].
 2824//
 2825// Use the [ResponseContentPartDoneEventPartUnion.AsAny] method to switch on the
 2826// variant.
 2827//
 2828// Use the methods beginning with 'As' to cast the union to one of its variants.
 2829type ResponseContentPartDoneEventPartUnion struct {
 2830	// This field is from variant [ResponseOutputText].
 2831	Annotations []ResponseOutputTextAnnotationUnion `json:"annotations"`
 2832	// This field is from variant [ResponseOutputText].
 2833	Text string `json:"text"`
 2834	// Any of "output_text", "refusal".
 2835	Type string `json:"type"`
 2836	// This field is from variant [ResponseOutputText].
 2837	Logprobs []ResponseOutputTextLogprob `json:"logprobs"`
 2838	// This field is from variant [ResponseOutputRefusal].
 2839	Refusal string `json:"refusal"`
 2840	JSON    struct {
 2841		Annotations respjson.Field
 2842		Text        respjson.Field
 2843		Type        respjson.Field
 2844		Logprobs    respjson.Field
 2845		Refusal     respjson.Field
 2846		raw         string
 2847	} `json:"-"`
 2848}
 2849
 2850// anyResponseContentPartDoneEventPart is implemented by each variant of
 2851// [ResponseContentPartDoneEventPartUnion] to add type safety for the return type
 2852// of [ResponseContentPartDoneEventPartUnion.AsAny]
 2853type anyResponseContentPartDoneEventPart interface {
 2854	implResponseContentPartDoneEventPartUnion()
 2855}
 2856
 2857func (ResponseOutputText) implResponseContentPartDoneEventPartUnion()    {}
 2858func (ResponseOutputRefusal) implResponseContentPartDoneEventPartUnion() {}
 2859
 2860// Use the following switch statement to find the correct variant
 2861//
 2862//	switch variant := ResponseContentPartDoneEventPartUnion.AsAny().(type) {
 2863//	case responses.ResponseOutputText:
 2864//	case responses.ResponseOutputRefusal:
 2865//	default:
 2866//	  fmt.Errorf("no variant present")
 2867//	}
 2868func (u ResponseContentPartDoneEventPartUnion) AsAny() anyResponseContentPartDoneEventPart {
 2869	switch u.Type {
 2870	case "output_text":
 2871		return u.AsOutputText()
 2872	case "refusal":
 2873		return u.AsRefusal()
 2874	}
 2875	return nil
 2876}
 2877
 2878func (u ResponseContentPartDoneEventPartUnion) AsOutputText() (v ResponseOutputText) {
 2879	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 2880	return
 2881}
 2882
 2883func (u ResponseContentPartDoneEventPartUnion) AsRefusal() (v ResponseOutputRefusal) {
 2884	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 2885	return
 2886}
 2887
 2888// Returns the unmodified JSON received from the API
 2889func (u ResponseContentPartDoneEventPartUnion) RawJSON() string { return u.JSON.raw }
 2890
 2891func (r *ResponseContentPartDoneEventPartUnion) UnmarshalJSON(data []byte) error {
 2892	return apijson.UnmarshalRoot(data, r)
 2893}
 2894
 2895// An event that is emitted when a response is created.
 2896type ResponseCreatedEvent struct {
 2897	// The response that was created.
 2898	Response Response `json:"response,required"`
 2899	// The sequence number for this event.
 2900	SequenceNumber int64 `json:"sequence_number,required"`
 2901	// The type of the event. Always `response.created`.
 2902	Type constant.ResponseCreated `json:"type,required"`
 2903	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 2904	JSON struct {
 2905		Response       respjson.Field
 2906		SequenceNumber respjson.Field
 2907		Type           respjson.Field
 2908		ExtraFields    map[string]respjson.Field
 2909		raw            string
 2910	} `json:"-"`
 2911}
 2912
 2913// Returns the unmodified JSON received from the API
 2914func (r ResponseCreatedEvent) RawJSON() string { return r.JSON.raw }
 2915func (r *ResponseCreatedEvent) UnmarshalJSON(data []byte) error {
 2916	return apijson.UnmarshalRoot(data, r)
 2917}
 2918
 2919// An error object returned when the model fails to generate a Response.
 2920type ResponseError struct {
 2921	// The error code for the response.
 2922	//
 2923	// Any of "server_error", "rate_limit_exceeded", "invalid_prompt",
 2924	// "vector_store_timeout", "invalid_image", "invalid_image_format",
 2925	// "invalid_base64_image", "invalid_image_url", "image_too_large",
 2926	// "image_too_small", "image_parse_error", "image_content_policy_violation",
 2927	// "invalid_image_mode", "image_file_too_large", "unsupported_image_media_type",
 2928	// "empty_image_file", "failed_to_download_image", "image_file_not_found".
 2929	Code ResponseErrorCode `json:"code,required"`
 2930	// A human-readable description of the error.
 2931	Message string `json:"message,required"`
 2932	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 2933	JSON struct {
 2934		Code        respjson.Field
 2935		Message     respjson.Field
 2936		ExtraFields map[string]respjson.Field
 2937		raw         string
 2938	} `json:"-"`
 2939}
 2940
 2941// Returns the unmodified JSON received from the API
 2942func (r ResponseError) RawJSON() string { return r.JSON.raw }
 2943func (r *ResponseError) UnmarshalJSON(data []byte) error {
 2944	return apijson.UnmarshalRoot(data, r)
 2945}
 2946
 2947// The error code for the response.
 2948type ResponseErrorCode string
 2949
 2950const (
 2951	ResponseErrorCodeServerError                 ResponseErrorCode = "server_error"
 2952	ResponseErrorCodeRateLimitExceeded           ResponseErrorCode = "rate_limit_exceeded"
 2953	ResponseErrorCodeInvalidPrompt               ResponseErrorCode = "invalid_prompt"
 2954	ResponseErrorCodeVectorStoreTimeout          ResponseErrorCode = "vector_store_timeout"
 2955	ResponseErrorCodeInvalidImage                ResponseErrorCode = "invalid_image"
 2956	ResponseErrorCodeInvalidImageFormat          ResponseErrorCode = "invalid_image_format"
 2957	ResponseErrorCodeInvalidBase64Image          ResponseErrorCode = "invalid_base64_image"
 2958	ResponseErrorCodeInvalidImageURL             ResponseErrorCode = "invalid_image_url"
 2959	ResponseErrorCodeImageTooLarge               ResponseErrorCode = "image_too_large"
 2960	ResponseErrorCodeImageTooSmall               ResponseErrorCode = "image_too_small"
 2961	ResponseErrorCodeImageParseError             ResponseErrorCode = "image_parse_error"
 2962	ResponseErrorCodeImageContentPolicyViolation ResponseErrorCode = "image_content_policy_violation"
 2963	ResponseErrorCodeInvalidImageMode            ResponseErrorCode = "invalid_image_mode"
 2964	ResponseErrorCodeImageFileTooLarge           ResponseErrorCode = "image_file_too_large"
 2965	ResponseErrorCodeUnsupportedImageMediaType   ResponseErrorCode = "unsupported_image_media_type"
 2966	ResponseErrorCodeEmptyImageFile              ResponseErrorCode = "empty_image_file"
 2967	ResponseErrorCodeFailedToDownloadImage       ResponseErrorCode = "failed_to_download_image"
 2968	ResponseErrorCodeImageFileNotFound           ResponseErrorCode = "image_file_not_found"
 2969)
 2970
 2971// Emitted when an error occurs.
 2972type ResponseErrorEvent struct {
 2973	// The error code.
 2974	Code string `json:"code,required"`
 2975	// The error message.
 2976	Message string `json:"message,required"`
 2977	// The error parameter.
 2978	Param string `json:"param,required"`
 2979	// The sequence number of this event.
 2980	SequenceNumber int64 `json:"sequence_number,required"`
 2981	// The type of the event. Always `error`.
 2982	Type constant.Error `json:"type,required"`
 2983	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 2984	JSON struct {
 2985		Code           respjson.Field
 2986		Message        respjson.Field
 2987		Param          respjson.Field
 2988		SequenceNumber respjson.Field
 2989		Type           respjson.Field
 2990		ExtraFields    map[string]respjson.Field
 2991		raw            string
 2992	} `json:"-"`
 2993}
 2994
 2995// Returns the unmodified JSON received from the API
 2996func (r ResponseErrorEvent) RawJSON() string { return r.JSON.raw }
 2997func (r *ResponseErrorEvent) UnmarshalJSON(data []byte) error {
 2998	return apijson.UnmarshalRoot(data, r)
 2999}
 3000
 3001// An event that is emitted when a response fails.
 3002type ResponseFailedEvent struct {
 3003	// The response that failed.
 3004	Response Response `json:"response,required"`
 3005	// The sequence number of this event.
 3006	SequenceNumber int64 `json:"sequence_number,required"`
 3007	// The type of the event. Always `response.failed`.
 3008	Type constant.ResponseFailed `json:"type,required"`
 3009	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 3010	JSON struct {
 3011		Response       respjson.Field
 3012		SequenceNumber respjson.Field
 3013		Type           respjson.Field
 3014		ExtraFields    map[string]respjson.Field
 3015		raw            string
 3016	} `json:"-"`
 3017}
 3018
 3019// Returns the unmodified JSON received from the API
 3020func (r ResponseFailedEvent) RawJSON() string { return r.JSON.raw }
 3021func (r *ResponseFailedEvent) UnmarshalJSON(data []byte) error {
 3022	return apijson.UnmarshalRoot(data, r)
 3023}
 3024
 3025// Emitted when a file search call is completed (results found).
 3026type ResponseFileSearchCallCompletedEvent struct {
 3027	// The ID of the output item that the file search call is initiated.
 3028	ItemID string `json:"item_id,required"`
 3029	// The index of the output item that the file search call is initiated.
 3030	OutputIndex int64 `json:"output_index,required"`
 3031	// The sequence number of this event.
 3032	SequenceNumber int64 `json:"sequence_number,required"`
 3033	// The type of the event. Always `response.file_search_call.completed`.
 3034	Type constant.ResponseFileSearchCallCompleted `json:"type,required"`
 3035	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 3036	JSON struct {
 3037		ItemID         respjson.Field
 3038		OutputIndex    respjson.Field
 3039		SequenceNumber respjson.Field
 3040		Type           respjson.Field
 3041		ExtraFields    map[string]respjson.Field
 3042		raw            string
 3043	} `json:"-"`
 3044}
 3045
 3046// Returns the unmodified JSON received from the API
 3047func (r ResponseFileSearchCallCompletedEvent) RawJSON() string { return r.JSON.raw }
 3048func (r *ResponseFileSearchCallCompletedEvent) UnmarshalJSON(data []byte) error {
 3049	return apijson.UnmarshalRoot(data, r)
 3050}
 3051
 3052// Emitted when a file search call is initiated.
 3053type ResponseFileSearchCallInProgressEvent struct {
 3054	// The ID of the output item that the file search call is initiated.
 3055	ItemID string `json:"item_id,required"`
 3056	// The index of the output item that the file search call is initiated.
 3057	OutputIndex int64 `json:"output_index,required"`
 3058	// The sequence number of this event.
 3059	SequenceNumber int64 `json:"sequence_number,required"`
 3060	// The type of the event. Always `response.file_search_call.in_progress`.
 3061	Type constant.ResponseFileSearchCallInProgress `json:"type,required"`
 3062	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 3063	JSON struct {
 3064		ItemID         respjson.Field
 3065		OutputIndex    respjson.Field
 3066		SequenceNumber respjson.Field
 3067		Type           respjson.Field
 3068		ExtraFields    map[string]respjson.Field
 3069		raw            string
 3070	} `json:"-"`
 3071}
 3072
 3073// Returns the unmodified JSON received from the API
 3074func (r ResponseFileSearchCallInProgressEvent) RawJSON() string { return r.JSON.raw }
 3075func (r *ResponseFileSearchCallInProgressEvent) UnmarshalJSON(data []byte) error {
 3076	return apijson.UnmarshalRoot(data, r)
 3077}
 3078
 3079// Emitted when a file search is currently searching.
 3080type ResponseFileSearchCallSearchingEvent struct {
 3081	// The ID of the output item that the file search call is initiated.
 3082	ItemID string `json:"item_id,required"`
 3083	// The index of the output item that the file search call is searching.
 3084	OutputIndex int64 `json:"output_index,required"`
 3085	// The sequence number of this event.
 3086	SequenceNumber int64 `json:"sequence_number,required"`
 3087	// The type of the event. Always `response.file_search_call.searching`.
 3088	Type constant.ResponseFileSearchCallSearching `json:"type,required"`
 3089	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 3090	JSON struct {
 3091		ItemID         respjson.Field
 3092		OutputIndex    respjson.Field
 3093		SequenceNumber respjson.Field
 3094		Type           respjson.Field
 3095		ExtraFields    map[string]respjson.Field
 3096		raw            string
 3097	} `json:"-"`
 3098}
 3099
 3100// Returns the unmodified JSON received from the API
 3101func (r ResponseFileSearchCallSearchingEvent) RawJSON() string { return r.JSON.raw }
 3102func (r *ResponseFileSearchCallSearchingEvent) UnmarshalJSON(data []byte) error {
 3103	return apijson.UnmarshalRoot(data, r)
 3104}
 3105
 3106// The results of a file search tool call. See the
 3107// [file search guide](https://platform.openai.com/docs/guides/tools-file-search)
 3108// for more information.
 3109type ResponseFileSearchToolCall struct {
 3110	// The unique ID of the file search tool call.
 3111	ID string `json:"id,required"`
 3112	// The queries used to search for files.
 3113	Queries []string `json:"queries,required"`
 3114	// The status of the file search tool call. One of `in_progress`, `searching`,
 3115	// `incomplete` or `failed`,
 3116	//
 3117	// Any of "in_progress", "searching", "completed", "incomplete", "failed".
 3118	Status ResponseFileSearchToolCallStatus `json:"status,required"`
 3119	// The type of the file search tool call. Always `file_search_call`.
 3120	Type constant.FileSearchCall `json:"type,required"`
 3121	// The results of the file search tool call.
 3122	Results []ResponseFileSearchToolCallResult `json:"results,nullable"`
 3123	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 3124	JSON struct {
 3125		ID          respjson.Field
 3126		Queries     respjson.Field
 3127		Status      respjson.Field
 3128		Type        respjson.Field
 3129		Results     respjson.Field
 3130		ExtraFields map[string]respjson.Field
 3131		raw         string
 3132	} `json:"-"`
 3133}
 3134
 3135// Returns the unmodified JSON received from the API
 3136func (r ResponseFileSearchToolCall) RawJSON() string { return r.JSON.raw }
 3137func (r *ResponseFileSearchToolCall) UnmarshalJSON(data []byte) error {
 3138	return apijson.UnmarshalRoot(data, r)
 3139}
 3140
 3141// ToParam converts this ResponseFileSearchToolCall to a
 3142// ResponseFileSearchToolCallParam.
 3143//
 3144// Warning: the fields of the param type will not be present. ToParam should only
 3145// be used at the last possible moment before sending a request. Test for this with
 3146// ResponseFileSearchToolCallParam.Overrides()
 3147func (r ResponseFileSearchToolCall) ToParam() ResponseFileSearchToolCallParam {
 3148	return param.Override[ResponseFileSearchToolCallParam](json.RawMessage(r.RawJSON()))
 3149}
 3150
 3151// The status of the file search tool call. One of `in_progress`, `searching`,
 3152// `incomplete` or `failed`,
 3153type ResponseFileSearchToolCallStatus string
 3154
 3155const (
 3156	ResponseFileSearchToolCallStatusInProgress ResponseFileSearchToolCallStatus = "in_progress"
 3157	ResponseFileSearchToolCallStatusSearching  ResponseFileSearchToolCallStatus = "searching"
 3158	ResponseFileSearchToolCallStatusCompleted  ResponseFileSearchToolCallStatus = "completed"
 3159	ResponseFileSearchToolCallStatusIncomplete ResponseFileSearchToolCallStatus = "incomplete"
 3160	ResponseFileSearchToolCallStatusFailed     ResponseFileSearchToolCallStatus = "failed"
 3161)
 3162
 3163type ResponseFileSearchToolCallResult struct {
 3164	// Set of 16 key-value pairs that can be attached to an object. This can be useful
 3165	// for storing additional information about the object in a structured format, and
 3166	// querying for objects via API or the dashboard. Keys are strings with a maximum
 3167	// length of 64 characters. Values are strings with a maximum length of 512
 3168	// characters, booleans, or numbers.
 3169	Attributes map[string]ResponseFileSearchToolCallResultAttributeUnion `json:"attributes,nullable"`
 3170	// The unique ID of the file.
 3171	FileID string `json:"file_id"`
 3172	// The name of the file.
 3173	Filename string `json:"filename"`
 3174	// The relevance score of the file - a value between 0 and 1.
 3175	Score float64 `json:"score"`
 3176	// The text that was retrieved from the file.
 3177	Text string `json:"text"`
 3178	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 3179	JSON struct {
 3180		Attributes  respjson.Field
 3181		FileID      respjson.Field
 3182		Filename    respjson.Field
 3183		Score       respjson.Field
 3184		Text        respjson.Field
 3185		ExtraFields map[string]respjson.Field
 3186		raw         string
 3187	} `json:"-"`
 3188}
 3189
 3190// Returns the unmodified JSON received from the API
 3191func (r ResponseFileSearchToolCallResult) RawJSON() string { return r.JSON.raw }
 3192func (r *ResponseFileSearchToolCallResult) UnmarshalJSON(data []byte) error {
 3193	return apijson.UnmarshalRoot(data, r)
 3194}
 3195
 3196// ResponseFileSearchToolCallResultAttributeUnion contains all possible properties
 3197// and values from [string], [float64], [bool].
 3198//
 3199// Use the methods beginning with 'As' to cast the union to one of its variants.
 3200//
 3201// If the underlying value is not a json object, one of the following properties
 3202// will be valid: OfString OfFloat OfBool]
 3203type ResponseFileSearchToolCallResultAttributeUnion struct {
 3204	// This field will be present if the value is a [string] instead of an object.
 3205	OfString string `json:",inline"`
 3206	// This field will be present if the value is a [float64] instead of an object.
 3207	OfFloat float64 `json:",inline"`
 3208	// This field will be present if the value is a [bool] instead of an object.
 3209	OfBool bool `json:",inline"`
 3210	JSON   struct {
 3211		OfString respjson.Field
 3212		OfFloat  respjson.Field
 3213		OfBool   respjson.Field
 3214		raw      string
 3215	} `json:"-"`
 3216}
 3217
 3218func (u ResponseFileSearchToolCallResultAttributeUnion) AsString() (v string) {
 3219	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 3220	return
 3221}
 3222
 3223func (u ResponseFileSearchToolCallResultAttributeUnion) AsFloat() (v float64) {
 3224	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 3225	return
 3226}
 3227
 3228func (u ResponseFileSearchToolCallResultAttributeUnion) AsBool() (v bool) {
 3229	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 3230	return
 3231}
 3232
 3233// Returns the unmodified JSON received from the API
 3234func (u ResponseFileSearchToolCallResultAttributeUnion) RawJSON() string { return u.JSON.raw }
 3235
 3236func (r *ResponseFileSearchToolCallResultAttributeUnion) UnmarshalJSON(data []byte) error {
 3237	return apijson.UnmarshalRoot(data, r)
 3238}
 3239
 3240// The results of a file search tool call. See the
 3241// [file search guide](https://platform.openai.com/docs/guides/tools-file-search)
 3242// for more information.
 3243//
 3244// The properties ID, Queries, Status, Type are required.
 3245type ResponseFileSearchToolCallParam struct {
 3246	// The unique ID of the file search tool call.
 3247	ID string `json:"id,required"`
 3248	// The queries used to search for files.
 3249	Queries []string `json:"queries,omitzero,required"`
 3250	// The status of the file search tool call. One of `in_progress`, `searching`,
 3251	// `incomplete` or `failed`,
 3252	//
 3253	// Any of "in_progress", "searching", "completed", "incomplete", "failed".
 3254	Status ResponseFileSearchToolCallStatus `json:"status,omitzero,required"`
 3255	// The results of the file search tool call.
 3256	Results []ResponseFileSearchToolCallResultParam `json:"results,omitzero"`
 3257	// The type of the file search tool call. Always `file_search_call`.
 3258	//
 3259	// This field can be elided, and will marshal its zero value as "file_search_call".
 3260	Type constant.FileSearchCall `json:"type,required"`
 3261	paramObj
 3262}
 3263
 3264func (r ResponseFileSearchToolCallParam) MarshalJSON() (data []byte, err error) {
 3265	type shadow ResponseFileSearchToolCallParam
 3266	return param.MarshalObject(r, (*shadow)(&r))
 3267}
 3268func (r *ResponseFileSearchToolCallParam) UnmarshalJSON(data []byte) error {
 3269	return apijson.UnmarshalRoot(data, r)
 3270}
 3271
 3272type ResponseFileSearchToolCallResultParam struct {
 3273	// The unique ID of the file.
 3274	FileID param.Opt[string] `json:"file_id,omitzero"`
 3275	// The name of the file.
 3276	Filename param.Opt[string] `json:"filename,omitzero"`
 3277	// The relevance score of the file - a value between 0 and 1.
 3278	Score param.Opt[float64] `json:"score,omitzero"`
 3279	// The text that was retrieved from the file.
 3280	Text param.Opt[string] `json:"text,omitzero"`
 3281	// Set of 16 key-value pairs that can be attached to an object. This can be useful
 3282	// for storing additional information about the object in a structured format, and
 3283	// querying for objects via API or the dashboard. Keys are strings with a maximum
 3284	// length of 64 characters. Values are strings with a maximum length of 512
 3285	// characters, booleans, or numbers.
 3286	Attributes map[string]ResponseFileSearchToolCallResultAttributeUnionParam `json:"attributes,omitzero"`
 3287	paramObj
 3288}
 3289
 3290func (r ResponseFileSearchToolCallResultParam) MarshalJSON() (data []byte, err error) {
 3291	type shadow ResponseFileSearchToolCallResultParam
 3292	return param.MarshalObject(r, (*shadow)(&r))
 3293}
 3294func (r *ResponseFileSearchToolCallResultParam) UnmarshalJSON(data []byte) error {
 3295	return apijson.UnmarshalRoot(data, r)
 3296}
 3297
 3298// Only one field can be non-zero.
 3299//
 3300// Use [param.IsOmitted] to confirm if a field is set.
 3301type ResponseFileSearchToolCallResultAttributeUnionParam struct {
 3302	OfString param.Opt[string]  `json:",omitzero,inline"`
 3303	OfFloat  param.Opt[float64] `json:",omitzero,inline"`
 3304	OfBool   param.Opt[bool]    `json:",omitzero,inline"`
 3305	paramUnion
 3306}
 3307
 3308func (u ResponseFileSearchToolCallResultAttributeUnionParam) MarshalJSON() ([]byte, error) {
 3309	return param.MarshalUnion(u, u.OfString, u.OfFloat, u.OfBool)
 3310}
 3311func (u *ResponseFileSearchToolCallResultAttributeUnionParam) UnmarshalJSON(data []byte) error {
 3312	return apijson.UnmarshalRoot(data, u)
 3313}
 3314
 3315func (u *ResponseFileSearchToolCallResultAttributeUnionParam) asAny() any {
 3316	if !param.IsOmitted(u.OfString) {
 3317		return &u.OfString.Value
 3318	} else if !param.IsOmitted(u.OfFloat) {
 3319		return &u.OfFloat.Value
 3320	} else if !param.IsOmitted(u.OfBool) {
 3321		return &u.OfBool.Value
 3322	}
 3323	return nil
 3324}
 3325
 3326// ResponseFormatTextConfigUnion contains all possible properties and values from
 3327// [shared.ResponseFormatText], [ResponseFormatTextJSONSchemaConfig],
 3328// [shared.ResponseFormatJSONObject].
 3329//
 3330// Use the [ResponseFormatTextConfigUnion.AsAny] method to switch on the variant.
 3331//
 3332// Use the methods beginning with 'As' to cast the union to one of its variants.
 3333type ResponseFormatTextConfigUnion struct {
 3334	// Any of "text", "json_schema", "json_object".
 3335	Type string `json:"type"`
 3336	// This field is from variant [ResponseFormatTextJSONSchemaConfig].
 3337	Name string `json:"name"`
 3338	// This field is from variant [ResponseFormatTextJSONSchemaConfig].
 3339	Schema map[string]any `json:"schema"`
 3340	// This field is from variant [ResponseFormatTextJSONSchemaConfig].
 3341	Description string `json:"description"`
 3342	// This field is from variant [ResponseFormatTextJSONSchemaConfig].
 3343	Strict bool `json:"strict"`
 3344	JSON   struct {
 3345		Type        respjson.Field
 3346		Name        respjson.Field
 3347		Schema      respjson.Field
 3348		Description respjson.Field
 3349		Strict      respjson.Field
 3350		raw         string
 3351	} `json:"-"`
 3352}
 3353
 3354// anyResponseFormatTextConfig is implemented by each variant of
 3355// [ResponseFormatTextConfigUnion] to add type safety for the return type of
 3356// [ResponseFormatTextConfigUnion.AsAny]
 3357type anyResponseFormatTextConfig interface {
 3358	ImplResponseFormatTextConfigUnion()
 3359}
 3360
 3361func (ResponseFormatTextJSONSchemaConfig) ImplResponseFormatTextConfigUnion() {}
 3362
 3363// Use the following switch statement to find the correct variant
 3364//
 3365//	switch variant := ResponseFormatTextConfigUnion.AsAny().(type) {
 3366//	case shared.ResponseFormatText:
 3367//	case responses.ResponseFormatTextJSONSchemaConfig:
 3368//	case shared.ResponseFormatJSONObject:
 3369//	default:
 3370//	  fmt.Errorf("no variant present")
 3371//	}
 3372func (u ResponseFormatTextConfigUnion) AsAny() anyResponseFormatTextConfig {
 3373	switch u.Type {
 3374	case "text":
 3375		return u.AsText()
 3376	case "json_schema":
 3377		return u.AsJSONSchema()
 3378	case "json_object":
 3379		return u.AsJSONObject()
 3380	}
 3381	return nil
 3382}
 3383
 3384func (u ResponseFormatTextConfigUnion) AsText() (v shared.ResponseFormatText) {
 3385	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 3386	return
 3387}
 3388
 3389func (u ResponseFormatTextConfigUnion) AsJSONSchema() (v ResponseFormatTextJSONSchemaConfig) {
 3390	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 3391	return
 3392}
 3393
 3394func (u ResponseFormatTextConfigUnion) AsJSONObject() (v shared.ResponseFormatJSONObject) {
 3395	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 3396	return
 3397}
 3398
 3399// Returns the unmodified JSON received from the API
 3400func (u ResponseFormatTextConfigUnion) RawJSON() string { return u.JSON.raw }
 3401
 3402func (r *ResponseFormatTextConfigUnion) UnmarshalJSON(data []byte) error {
 3403	return apijson.UnmarshalRoot(data, r)
 3404}
 3405
 3406// ToParam converts this ResponseFormatTextConfigUnion to a
 3407// ResponseFormatTextConfigUnionParam.
 3408//
 3409// Warning: the fields of the param type will not be present. ToParam should only
 3410// be used at the last possible moment before sending a request. Test for this with
 3411// ResponseFormatTextConfigUnionParam.Overrides()
 3412func (r ResponseFormatTextConfigUnion) ToParam() ResponseFormatTextConfigUnionParam {
 3413	return param.Override[ResponseFormatTextConfigUnionParam](json.RawMessage(r.RawJSON()))
 3414}
 3415
 3416func ResponseFormatTextConfigParamOfJSONSchema(name string, schema map[string]any) ResponseFormatTextConfigUnionParam {
 3417	var jsonSchema ResponseFormatTextJSONSchemaConfigParam
 3418	jsonSchema.Name = name
 3419	jsonSchema.Schema = schema
 3420	return ResponseFormatTextConfigUnionParam{OfJSONSchema: &jsonSchema}
 3421}
 3422
 3423// Only one field can be non-zero.
 3424//
 3425// Use [param.IsOmitted] to confirm if a field is set.
 3426type ResponseFormatTextConfigUnionParam struct {
 3427	OfText       *shared.ResponseFormatTextParam          `json:",omitzero,inline"`
 3428	OfJSONSchema *ResponseFormatTextJSONSchemaConfigParam `json:",omitzero,inline"`
 3429	OfJSONObject *shared.ResponseFormatJSONObjectParam    `json:",omitzero,inline"`
 3430	paramUnion
 3431}
 3432
 3433func (u ResponseFormatTextConfigUnionParam) MarshalJSON() ([]byte, error) {
 3434	return param.MarshalUnion(u, u.OfText, u.OfJSONSchema, u.OfJSONObject)
 3435}
 3436func (u *ResponseFormatTextConfigUnionParam) UnmarshalJSON(data []byte) error {
 3437	return apijson.UnmarshalRoot(data, u)
 3438}
 3439
 3440func (u *ResponseFormatTextConfigUnionParam) asAny() any {
 3441	if !param.IsOmitted(u.OfText) {
 3442		return u.OfText
 3443	} else if !param.IsOmitted(u.OfJSONSchema) {
 3444		return u.OfJSONSchema
 3445	} else if !param.IsOmitted(u.OfJSONObject) {
 3446		return u.OfJSONObject
 3447	}
 3448	return nil
 3449}
 3450
 3451// Returns a pointer to the underlying variant's property, if present.
 3452func (u ResponseFormatTextConfigUnionParam) GetName() *string {
 3453	if vt := u.OfJSONSchema; vt != nil {
 3454		return &vt.Name
 3455	}
 3456	return nil
 3457}
 3458
 3459// Returns a pointer to the underlying variant's property, if present.
 3460func (u ResponseFormatTextConfigUnionParam) GetSchema() map[string]any {
 3461	if vt := u.OfJSONSchema; vt != nil {
 3462		return vt.Schema
 3463	}
 3464	return nil
 3465}
 3466
 3467// Returns a pointer to the underlying variant's property, if present.
 3468func (u ResponseFormatTextConfigUnionParam) GetDescription() *string {
 3469	if vt := u.OfJSONSchema; vt != nil && vt.Description.Valid() {
 3470		return &vt.Description.Value
 3471	}
 3472	return nil
 3473}
 3474
 3475// Returns a pointer to the underlying variant's property, if present.
 3476func (u ResponseFormatTextConfigUnionParam) GetStrict() *bool {
 3477	if vt := u.OfJSONSchema; vt != nil && vt.Strict.Valid() {
 3478		return &vt.Strict.Value
 3479	}
 3480	return nil
 3481}
 3482
 3483// Returns a pointer to the underlying variant's property, if present.
 3484func (u ResponseFormatTextConfigUnionParam) GetType() *string {
 3485	if vt := u.OfText; vt != nil {
 3486		return (*string)(&vt.Type)
 3487	} else if vt := u.OfJSONSchema; vt != nil {
 3488		return (*string)(&vt.Type)
 3489	} else if vt := u.OfJSONObject; vt != nil {
 3490		return (*string)(&vt.Type)
 3491	}
 3492	return nil
 3493}
 3494
 3495func init() {
 3496	apijson.RegisterUnion[ResponseFormatTextConfigUnionParam](
 3497		"type",
 3498		apijson.Discriminator[shared.ResponseFormatTextParam]("text"),
 3499		apijson.Discriminator[ResponseFormatTextJSONSchemaConfigParam]("json_schema"),
 3500		apijson.Discriminator[shared.ResponseFormatJSONObjectParam]("json_object"),
 3501	)
 3502}
 3503
 3504// JSON Schema response format. Used to generate structured JSON responses. Learn
 3505// more about
 3506// [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).
 3507type ResponseFormatTextJSONSchemaConfig struct {
 3508	// The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores
 3509	// and dashes, with a maximum length of 64.
 3510	Name string `json:"name,required"`
 3511	// The schema for the response format, described as a JSON Schema object. Learn how
 3512	// to build JSON schemas [here](https://json-schema.org/).
 3513	Schema map[string]any `json:"schema,required"`
 3514	// The type of response format being defined. Always `json_schema`.
 3515	Type constant.JSONSchema `json:"type,required"`
 3516	// A description of what the response format is for, used by the model to determine
 3517	// how to respond in the format.
 3518	Description string `json:"description"`
 3519	// Whether to enable strict schema adherence when generating the output. If set to
 3520	// true, the model will always follow the exact schema defined in the `schema`
 3521	// field. Only a subset of JSON Schema is supported when `strict` is `true`. To
 3522	// learn more, read the
 3523	// [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
 3524	Strict bool `json:"strict,nullable"`
 3525	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 3526	JSON struct {
 3527		Name        respjson.Field
 3528		Schema      respjson.Field
 3529		Type        respjson.Field
 3530		Description respjson.Field
 3531		Strict      respjson.Field
 3532		ExtraFields map[string]respjson.Field
 3533		raw         string
 3534	} `json:"-"`
 3535}
 3536
 3537// Returns the unmodified JSON received from the API
 3538func (r ResponseFormatTextJSONSchemaConfig) RawJSON() string { return r.JSON.raw }
 3539func (r *ResponseFormatTextJSONSchemaConfig) UnmarshalJSON(data []byte) error {
 3540	return apijson.UnmarshalRoot(data, r)
 3541}
 3542
 3543// ToParam converts this ResponseFormatTextJSONSchemaConfig to a
 3544// ResponseFormatTextJSONSchemaConfigParam.
 3545//
 3546// Warning: the fields of the param type will not be present. ToParam should only
 3547// be used at the last possible moment before sending a request. Test for this with
 3548// ResponseFormatTextJSONSchemaConfigParam.Overrides()
 3549func (r ResponseFormatTextJSONSchemaConfig) ToParam() ResponseFormatTextJSONSchemaConfigParam {
 3550	return param.Override[ResponseFormatTextJSONSchemaConfigParam](json.RawMessage(r.RawJSON()))
 3551}
 3552
 3553// JSON Schema response format. Used to generate structured JSON responses. Learn
 3554// more about
 3555// [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).
 3556//
 3557// The properties Name, Schema, Type are required.
 3558type ResponseFormatTextJSONSchemaConfigParam struct {
 3559	// The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores
 3560	// and dashes, with a maximum length of 64.
 3561	Name string `json:"name,required"`
 3562	// The schema for the response format, described as a JSON Schema object. Learn how
 3563	// to build JSON schemas [here](https://json-schema.org/).
 3564	Schema map[string]any `json:"schema,omitzero,required"`
 3565	// Whether to enable strict schema adherence when generating the output. If set to
 3566	// true, the model will always follow the exact schema defined in the `schema`
 3567	// field. Only a subset of JSON Schema is supported when `strict` is `true`. To
 3568	// learn more, read the
 3569	// [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
 3570	Strict param.Opt[bool] `json:"strict,omitzero"`
 3571	// A description of what the response format is for, used by the model to determine
 3572	// how to respond in the format.
 3573	Description param.Opt[string] `json:"description,omitzero"`
 3574	// The type of response format being defined. Always `json_schema`.
 3575	//
 3576	// This field can be elided, and will marshal its zero value as "json_schema".
 3577	Type constant.JSONSchema `json:"type,required"`
 3578	paramObj
 3579}
 3580
 3581func (r ResponseFormatTextJSONSchemaConfigParam) MarshalJSON() (data []byte, err error) {
 3582	type shadow ResponseFormatTextJSONSchemaConfigParam
 3583	return param.MarshalObject(r, (*shadow)(&r))
 3584}
 3585func (r *ResponseFormatTextJSONSchemaConfigParam) UnmarshalJSON(data []byte) error {
 3586	return apijson.UnmarshalRoot(data, r)
 3587}
 3588
 3589// Emitted when there is a partial function-call arguments delta.
 3590type ResponseFunctionCallArgumentsDeltaEvent struct {
 3591	// The function-call arguments delta that is added.
 3592	Delta string `json:"delta,required"`
 3593	// The ID of the output item that the function-call arguments delta is added to.
 3594	ItemID string `json:"item_id,required"`
 3595	// The index of the output item that the function-call arguments delta is added to.
 3596	OutputIndex int64 `json:"output_index,required"`
 3597	// The sequence number of this event.
 3598	SequenceNumber int64 `json:"sequence_number,required"`
 3599	// The type of the event. Always `response.function_call_arguments.delta`.
 3600	Type constant.ResponseFunctionCallArgumentsDelta `json:"type,required"`
 3601	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 3602	JSON struct {
 3603		Delta          respjson.Field
 3604		ItemID         respjson.Field
 3605		OutputIndex    respjson.Field
 3606		SequenceNumber respjson.Field
 3607		Type           respjson.Field
 3608		ExtraFields    map[string]respjson.Field
 3609		raw            string
 3610	} `json:"-"`
 3611}
 3612
 3613// Returns the unmodified JSON received from the API
 3614func (r ResponseFunctionCallArgumentsDeltaEvent) RawJSON() string { return r.JSON.raw }
 3615func (r *ResponseFunctionCallArgumentsDeltaEvent) UnmarshalJSON(data []byte) error {
 3616	return apijson.UnmarshalRoot(data, r)
 3617}
 3618
 3619// Emitted when function-call arguments are finalized.
 3620type ResponseFunctionCallArgumentsDoneEvent struct {
 3621	// The function-call arguments.
 3622	Arguments string `json:"arguments,required"`
 3623	// The ID of the item.
 3624	ItemID string `json:"item_id,required"`
 3625	// The index of the output item.
 3626	OutputIndex int64 `json:"output_index,required"`
 3627	// The sequence number of this event.
 3628	SequenceNumber int64                                      `json:"sequence_number,required"`
 3629	Type           constant.ResponseFunctionCallArgumentsDone `json:"type,required"`
 3630	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 3631	JSON struct {
 3632		Arguments      respjson.Field
 3633		ItemID         respjson.Field
 3634		OutputIndex    respjson.Field
 3635		SequenceNumber respjson.Field
 3636		Type           respjson.Field
 3637		ExtraFields    map[string]respjson.Field
 3638		raw            string
 3639	} `json:"-"`
 3640}
 3641
 3642// Returns the unmodified JSON received from the API
 3643func (r ResponseFunctionCallArgumentsDoneEvent) RawJSON() string { return r.JSON.raw }
 3644func (r *ResponseFunctionCallArgumentsDoneEvent) UnmarshalJSON(data []byte) error {
 3645	return apijson.UnmarshalRoot(data, r)
 3646}
 3647
 3648// A tool call to run a function. See the
 3649// [function calling guide](https://platform.openai.com/docs/guides/function-calling)
 3650// for more information.
 3651type ResponseFunctionToolCall struct {
 3652	// A JSON string of the arguments to pass to the function.
 3653	Arguments string `json:"arguments,required"`
 3654	// The unique ID of the function tool call generated by the model.
 3655	CallID string `json:"call_id,required"`
 3656	// The name of the function to run.
 3657	Name string `json:"name,required"`
 3658	// The type of the function tool call. Always `function_call`.
 3659	Type constant.FunctionCall `json:"type,required"`
 3660	// The unique ID of the function tool call.
 3661	ID string `json:"id"`
 3662	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
 3663	// Populated when items are returned via API.
 3664	//
 3665	// Any of "in_progress", "completed", "incomplete".
 3666	Status ResponseFunctionToolCallStatus `json:"status"`
 3667	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 3668	JSON struct {
 3669		Arguments   respjson.Field
 3670		CallID      respjson.Field
 3671		Name        respjson.Field
 3672		Type        respjson.Field
 3673		ID          respjson.Field
 3674		Status      respjson.Field
 3675		ExtraFields map[string]respjson.Field
 3676		raw         string
 3677	} `json:"-"`
 3678}
 3679
 3680// Returns the unmodified JSON received from the API
 3681func (r ResponseFunctionToolCall) RawJSON() string { return r.JSON.raw }
 3682func (r *ResponseFunctionToolCall) UnmarshalJSON(data []byte) error {
 3683	return apijson.UnmarshalRoot(data, r)
 3684}
 3685
 3686// ToParam converts this ResponseFunctionToolCall to a
 3687// ResponseFunctionToolCallParam.
 3688//
 3689// Warning: the fields of the param type will not be present. ToParam should only
 3690// be used at the last possible moment before sending a request. Test for this with
 3691// ResponseFunctionToolCallParam.Overrides()
 3692func (r ResponseFunctionToolCall) ToParam() ResponseFunctionToolCallParam {
 3693	return param.Override[ResponseFunctionToolCallParam](json.RawMessage(r.RawJSON()))
 3694}
 3695
 3696// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
 3697// Populated when items are returned via API.
 3698type ResponseFunctionToolCallStatus string
 3699
 3700const (
 3701	ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
 3702	ResponseFunctionToolCallStatusCompleted  ResponseFunctionToolCallStatus = "completed"
 3703	ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
 3704)
 3705
 3706// A tool call to run a function. See the
 3707// [function calling guide](https://platform.openai.com/docs/guides/function-calling)
 3708// for more information.
 3709//
 3710// The properties Arguments, CallID, Name, Type are required.
 3711type ResponseFunctionToolCallParam struct {
 3712	// A JSON string of the arguments to pass to the function.
 3713	Arguments string `json:"arguments,required"`
 3714	// The unique ID of the function tool call generated by the model.
 3715	CallID string `json:"call_id,required"`
 3716	// The name of the function to run.
 3717	Name string `json:"name,required"`
 3718	// The unique ID of the function tool call.
 3719	ID param.Opt[string] `json:"id,omitzero"`
 3720	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
 3721	// Populated when items are returned via API.
 3722	//
 3723	// Any of "in_progress", "completed", "incomplete".
 3724	Status ResponseFunctionToolCallStatus `json:"status,omitzero"`
 3725	// The type of the function tool call. Always `function_call`.
 3726	//
 3727	// This field can be elided, and will marshal its zero value as "function_call".
 3728	Type constant.FunctionCall `json:"type,required"`
 3729	paramObj
 3730}
 3731
 3732func (r ResponseFunctionToolCallParam) MarshalJSON() (data []byte, err error) {
 3733	type shadow ResponseFunctionToolCallParam
 3734	return param.MarshalObject(r, (*shadow)(&r))
 3735}
 3736func (r *ResponseFunctionToolCallParam) UnmarshalJSON(data []byte) error {
 3737	return apijson.UnmarshalRoot(data, r)
 3738}
 3739
 3740// A tool call to run a function. See the
 3741// [function calling guide](https://platform.openai.com/docs/guides/function-calling)
 3742// for more information.
 3743type ResponseFunctionToolCallItem struct {
 3744	// The unique ID of the function tool call.
 3745	ID string `json:"id,required"`
 3746	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 3747	JSON struct {
 3748		ID          respjson.Field
 3749		ExtraFields map[string]respjson.Field
 3750		raw         string
 3751	} `json:"-"`
 3752	ResponseFunctionToolCall
 3753}
 3754
 3755// Returns the unmodified JSON received from the API
 3756func (r ResponseFunctionToolCallItem) RawJSON() string { return r.JSON.raw }
 3757func (r *ResponseFunctionToolCallItem) UnmarshalJSON(data []byte) error {
 3758	return apijson.UnmarshalRoot(data, r)
 3759}
 3760
 3761type ResponseFunctionToolCallOutputItem struct {
 3762	// The unique ID of the function call tool output.
 3763	ID string `json:"id,required"`
 3764	// The unique ID of the function tool call generated by the model.
 3765	CallID string `json:"call_id,required"`
 3766	// A JSON string of the output of the function tool call.
 3767	Output string `json:"output,required"`
 3768	// The type of the function tool call output. Always `function_call_output`.
 3769	Type constant.FunctionCallOutput `json:"type,required"`
 3770	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
 3771	// Populated when items are returned via API.
 3772	//
 3773	// Any of "in_progress", "completed", "incomplete".
 3774	Status ResponseFunctionToolCallOutputItemStatus `json:"status"`
 3775	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 3776	JSON struct {
 3777		ID          respjson.Field
 3778		CallID      respjson.Field
 3779		Output      respjson.Field
 3780		Type        respjson.Field
 3781		Status      respjson.Field
 3782		ExtraFields map[string]respjson.Field
 3783		raw         string
 3784	} `json:"-"`
 3785}
 3786
 3787// Returns the unmodified JSON received from the API
 3788func (r ResponseFunctionToolCallOutputItem) RawJSON() string { return r.JSON.raw }
 3789func (r *ResponseFunctionToolCallOutputItem) UnmarshalJSON(data []byte) error {
 3790	return apijson.UnmarshalRoot(data, r)
 3791}
 3792
 3793// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
 3794// Populated when items are returned via API.
 3795type ResponseFunctionToolCallOutputItemStatus string
 3796
 3797const (
 3798	ResponseFunctionToolCallOutputItemStatusInProgress ResponseFunctionToolCallOutputItemStatus = "in_progress"
 3799	ResponseFunctionToolCallOutputItemStatusCompleted  ResponseFunctionToolCallOutputItemStatus = "completed"
 3800	ResponseFunctionToolCallOutputItemStatusIncomplete ResponseFunctionToolCallOutputItemStatus = "incomplete"
 3801)
 3802
 3803// The results of a web search tool call. See the
 3804// [web search guide](https://platform.openai.com/docs/guides/tools-web-search) for
 3805// more information.
 3806type ResponseFunctionWebSearch struct {
 3807	// The unique ID of the web search tool call.
 3808	ID string `json:"id,required"`
 3809	// An object describing the specific action taken in this web search call. Includes
 3810	// details on how the model used the web (search, open_page, find).
 3811	Action ResponseFunctionWebSearchActionUnion `json:"action,required"`
 3812	// The status of the web search tool call.
 3813	//
 3814	// Any of "in_progress", "searching", "completed", "failed".
 3815	Status ResponseFunctionWebSearchStatus `json:"status,required"`
 3816	// The type of the web search tool call. Always `web_search_call`.
 3817	Type constant.WebSearchCall `json:"type,required"`
 3818	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 3819	JSON struct {
 3820		ID          respjson.Field
 3821		Action      respjson.Field
 3822		Status      respjson.Field
 3823		Type        respjson.Field
 3824		ExtraFields map[string]respjson.Field
 3825		raw         string
 3826	} `json:"-"`
 3827}
 3828
 3829// Returns the unmodified JSON received from the API
 3830func (r ResponseFunctionWebSearch) RawJSON() string { return r.JSON.raw }
 3831func (r *ResponseFunctionWebSearch) UnmarshalJSON(data []byte) error {
 3832	return apijson.UnmarshalRoot(data, r)
 3833}
 3834
 3835// ToParam converts this ResponseFunctionWebSearch to a
 3836// ResponseFunctionWebSearchParam.
 3837//
 3838// Warning: the fields of the param type will not be present. ToParam should only
 3839// be used at the last possible moment before sending a request. Test for this with
 3840// ResponseFunctionWebSearchParam.Overrides()
 3841func (r ResponseFunctionWebSearch) ToParam() ResponseFunctionWebSearchParam {
 3842	return param.Override[ResponseFunctionWebSearchParam](json.RawMessage(r.RawJSON()))
 3843}
 3844
 3845// ResponseFunctionWebSearchActionUnion contains all possible properties and values
 3846// from [ResponseFunctionWebSearchActionSearch],
 3847// [ResponseFunctionWebSearchActionOpenPage],
 3848// [ResponseFunctionWebSearchActionFind].
 3849//
 3850// Use the [ResponseFunctionWebSearchActionUnion.AsAny] method to switch on the
 3851// variant.
 3852//
 3853// Use the methods beginning with 'As' to cast the union to one of its variants.
 3854type ResponseFunctionWebSearchActionUnion struct {
 3855	// This field is from variant [ResponseFunctionWebSearchActionSearch].
 3856	Query string `json:"query"`
 3857	// Any of "search", "open_page", "find".
 3858	Type string `json:"type"`
 3859	URL  string `json:"url"`
 3860	// This field is from variant [ResponseFunctionWebSearchActionFind].
 3861	Pattern string `json:"pattern"`
 3862	JSON    struct {
 3863		Query   respjson.Field
 3864		Type    respjson.Field
 3865		URL     respjson.Field
 3866		Pattern respjson.Field
 3867		raw     string
 3868	} `json:"-"`
 3869}
 3870
 3871// anyResponseFunctionWebSearchAction is implemented by each variant of
 3872// [ResponseFunctionWebSearchActionUnion] to add type safety for the return type of
 3873// [ResponseFunctionWebSearchActionUnion.AsAny]
 3874type anyResponseFunctionWebSearchAction interface {
 3875	implResponseFunctionWebSearchActionUnion()
 3876}
 3877
 3878func (ResponseFunctionWebSearchActionSearch) implResponseFunctionWebSearchActionUnion()   {}
 3879func (ResponseFunctionWebSearchActionOpenPage) implResponseFunctionWebSearchActionUnion() {}
 3880func (ResponseFunctionWebSearchActionFind) implResponseFunctionWebSearchActionUnion()     {}
 3881
 3882// Use the following switch statement to find the correct variant
 3883//
 3884//	switch variant := ResponseFunctionWebSearchActionUnion.AsAny().(type) {
 3885//	case responses.ResponseFunctionWebSearchActionSearch:
 3886//	case responses.ResponseFunctionWebSearchActionOpenPage:
 3887//	case responses.ResponseFunctionWebSearchActionFind:
 3888//	default:
 3889//	  fmt.Errorf("no variant present")
 3890//	}
 3891func (u ResponseFunctionWebSearchActionUnion) AsAny() anyResponseFunctionWebSearchAction {
 3892	switch u.Type {
 3893	case "search":
 3894		return u.AsSearch()
 3895	case "open_page":
 3896		return u.AsOpenPage()
 3897	case "find":
 3898		return u.AsFind()
 3899	}
 3900	return nil
 3901}
 3902
 3903func (u ResponseFunctionWebSearchActionUnion) AsSearch() (v ResponseFunctionWebSearchActionSearch) {
 3904	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 3905	return
 3906}
 3907
 3908func (u ResponseFunctionWebSearchActionUnion) AsOpenPage() (v ResponseFunctionWebSearchActionOpenPage) {
 3909	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 3910	return
 3911}
 3912
 3913func (u ResponseFunctionWebSearchActionUnion) AsFind() (v ResponseFunctionWebSearchActionFind) {
 3914	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 3915	return
 3916}
 3917
 3918// Returns the unmodified JSON received from the API
 3919func (u ResponseFunctionWebSearchActionUnion) RawJSON() string { return u.JSON.raw }
 3920
 3921func (r *ResponseFunctionWebSearchActionUnion) UnmarshalJSON(data []byte) error {
 3922	return apijson.UnmarshalRoot(data, r)
 3923}
 3924
 3925// Action type "search" - Performs a web search query.
 3926type ResponseFunctionWebSearchActionSearch struct {
 3927	// The search query.
 3928	Query string `json:"query,required"`
 3929	// The action type.
 3930	Type constant.Search `json:"type,required"`
 3931	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 3932	JSON struct {
 3933		Query       respjson.Field
 3934		Type        respjson.Field
 3935		ExtraFields map[string]respjson.Field
 3936		raw         string
 3937	} `json:"-"`
 3938}
 3939
 3940// Returns the unmodified JSON received from the API
 3941func (r ResponseFunctionWebSearchActionSearch) RawJSON() string { return r.JSON.raw }
 3942func (r *ResponseFunctionWebSearchActionSearch) UnmarshalJSON(data []byte) error {
 3943	return apijson.UnmarshalRoot(data, r)
 3944}
 3945
 3946// Action type "open_page" - Opens a specific URL from search results.
 3947type ResponseFunctionWebSearchActionOpenPage struct {
 3948	// The action type.
 3949	Type constant.OpenPage `json:"type,required"`
 3950	// The URL opened by the model.
 3951	URL string `json:"url,required" format:"uri"`
 3952	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 3953	JSON struct {
 3954		Type        respjson.Field
 3955		URL         respjson.Field
 3956		ExtraFields map[string]respjson.Field
 3957		raw         string
 3958	} `json:"-"`
 3959}
 3960
 3961// Returns the unmodified JSON received from the API
 3962func (r ResponseFunctionWebSearchActionOpenPage) RawJSON() string { return r.JSON.raw }
 3963func (r *ResponseFunctionWebSearchActionOpenPage) UnmarshalJSON(data []byte) error {
 3964	return apijson.UnmarshalRoot(data, r)
 3965}
 3966
 3967// Action type "find": Searches for a pattern within a loaded page.
 3968type ResponseFunctionWebSearchActionFind struct {
 3969	// The pattern or text to search for within the page.
 3970	Pattern string `json:"pattern,required"`
 3971	// The action type.
 3972	Type constant.Find `json:"type,required"`
 3973	// The URL of the page searched for the pattern.
 3974	URL string `json:"url,required" format:"uri"`
 3975	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 3976	JSON struct {
 3977		Pattern     respjson.Field
 3978		Type        respjson.Field
 3979		URL         respjson.Field
 3980		ExtraFields map[string]respjson.Field
 3981		raw         string
 3982	} `json:"-"`
 3983}
 3984
 3985// Returns the unmodified JSON received from the API
 3986func (r ResponseFunctionWebSearchActionFind) RawJSON() string { return r.JSON.raw }
 3987func (r *ResponseFunctionWebSearchActionFind) UnmarshalJSON(data []byte) error {
 3988	return apijson.UnmarshalRoot(data, r)
 3989}
 3990
 3991// The status of the web search tool call.
 3992type ResponseFunctionWebSearchStatus string
 3993
 3994const (
 3995	ResponseFunctionWebSearchStatusInProgress ResponseFunctionWebSearchStatus = "in_progress"
 3996	ResponseFunctionWebSearchStatusSearching  ResponseFunctionWebSearchStatus = "searching"
 3997	ResponseFunctionWebSearchStatusCompleted  ResponseFunctionWebSearchStatus = "completed"
 3998	ResponseFunctionWebSearchStatusFailed     ResponseFunctionWebSearchStatus = "failed"
 3999)
 4000
 4001// The results of a web search tool call. See the
 4002// [web search guide](https://platform.openai.com/docs/guides/tools-web-search) for
 4003// more information.
 4004//
 4005// The properties ID, Action, Status, Type are required.
 4006type ResponseFunctionWebSearchParam struct {
 4007	// The unique ID of the web search tool call.
 4008	ID string `json:"id,required"`
 4009	// An object describing the specific action taken in this web search call. Includes
 4010	// details on how the model used the web (search, open_page, find).
 4011	Action ResponseFunctionWebSearchActionUnionParam `json:"action,omitzero,required"`
 4012	// The status of the web search tool call.
 4013	//
 4014	// Any of "in_progress", "searching", "completed", "failed".
 4015	Status ResponseFunctionWebSearchStatus `json:"status,omitzero,required"`
 4016	// The type of the web search tool call. Always `web_search_call`.
 4017	//
 4018	// This field can be elided, and will marshal its zero value as "web_search_call".
 4019	Type constant.WebSearchCall `json:"type,required"`
 4020	paramObj
 4021}
 4022
 4023func (r ResponseFunctionWebSearchParam) MarshalJSON() (data []byte, err error) {
 4024	type shadow ResponseFunctionWebSearchParam
 4025	return param.MarshalObject(r, (*shadow)(&r))
 4026}
 4027func (r *ResponseFunctionWebSearchParam) UnmarshalJSON(data []byte) error {
 4028	return apijson.UnmarshalRoot(data, r)
 4029}
 4030
 4031// Only one field can be non-zero.
 4032//
 4033// Use [param.IsOmitted] to confirm if a field is set.
 4034type ResponseFunctionWebSearchActionUnionParam struct {
 4035	OfSearch   *ResponseFunctionWebSearchActionSearchParam   `json:",omitzero,inline"`
 4036	OfOpenPage *ResponseFunctionWebSearchActionOpenPageParam `json:",omitzero,inline"`
 4037	OfFind     *ResponseFunctionWebSearchActionFindParam     `json:",omitzero,inline"`
 4038	paramUnion
 4039}
 4040
 4041func (u ResponseFunctionWebSearchActionUnionParam) MarshalJSON() ([]byte, error) {
 4042	return param.MarshalUnion(u, u.OfSearch, u.OfOpenPage, u.OfFind)
 4043}
 4044func (u *ResponseFunctionWebSearchActionUnionParam) UnmarshalJSON(data []byte) error {
 4045	return apijson.UnmarshalRoot(data, u)
 4046}
 4047
 4048func (u *ResponseFunctionWebSearchActionUnionParam) asAny() any {
 4049	if !param.IsOmitted(u.OfSearch) {
 4050		return u.OfSearch
 4051	} else if !param.IsOmitted(u.OfOpenPage) {
 4052		return u.OfOpenPage
 4053	} else if !param.IsOmitted(u.OfFind) {
 4054		return u.OfFind
 4055	}
 4056	return nil
 4057}
 4058
 4059// Returns a pointer to the underlying variant's property, if present.
 4060func (u ResponseFunctionWebSearchActionUnionParam) GetQuery() *string {
 4061	if vt := u.OfSearch; vt != nil {
 4062		return &vt.Query
 4063	}
 4064	return nil
 4065}
 4066
 4067// Returns a pointer to the underlying variant's property, if present.
 4068func (u ResponseFunctionWebSearchActionUnionParam) GetPattern() *string {
 4069	if vt := u.OfFind; vt != nil {
 4070		return &vt.Pattern
 4071	}
 4072	return nil
 4073}
 4074
 4075// Returns a pointer to the underlying variant's property, if present.
 4076func (u ResponseFunctionWebSearchActionUnionParam) GetType() *string {
 4077	if vt := u.OfSearch; vt != nil {
 4078		return (*string)(&vt.Type)
 4079	} else if vt := u.OfOpenPage; vt != nil {
 4080		return (*string)(&vt.Type)
 4081	} else if vt := u.OfFind; vt != nil {
 4082		return (*string)(&vt.Type)
 4083	}
 4084	return nil
 4085}
 4086
 4087// Returns a pointer to the underlying variant's property, if present.
 4088func (u ResponseFunctionWebSearchActionUnionParam) GetURL() *string {
 4089	if vt := u.OfOpenPage; vt != nil {
 4090		return (*string)(&vt.URL)
 4091	} else if vt := u.OfFind; vt != nil {
 4092		return (*string)(&vt.URL)
 4093	}
 4094	return nil
 4095}
 4096
 4097func init() {
 4098	apijson.RegisterUnion[ResponseFunctionWebSearchActionUnionParam](
 4099		"type",
 4100		apijson.Discriminator[ResponseFunctionWebSearchActionSearchParam]("search"),
 4101		apijson.Discriminator[ResponseFunctionWebSearchActionOpenPageParam]("open_page"),
 4102		apijson.Discriminator[ResponseFunctionWebSearchActionFindParam]("find"),
 4103	)
 4104}
 4105
 4106// Action type "search" - Performs a web search query.
 4107//
 4108// The properties Query, Type are required.
 4109type ResponseFunctionWebSearchActionSearchParam struct {
 4110	// The search query.
 4111	Query string `json:"query,required"`
 4112	// The action type.
 4113	//
 4114	// This field can be elided, and will marshal its zero value as "search".
 4115	Type constant.Search `json:"type,required"`
 4116	paramObj
 4117}
 4118
 4119func (r ResponseFunctionWebSearchActionSearchParam) MarshalJSON() (data []byte, err error) {
 4120	type shadow ResponseFunctionWebSearchActionSearchParam
 4121	return param.MarshalObject(r, (*shadow)(&r))
 4122}
 4123func (r *ResponseFunctionWebSearchActionSearchParam) UnmarshalJSON(data []byte) error {
 4124	return apijson.UnmarshalRoot(data, r)
 4125}
 4126
 4127// Action type "open_page" - Opens a specific URL from search results.
 4128//
 4129// The properties Type, URL are required.
 4130type ResponseFunctionWebSearchActionOpenPageParam struct {
 4131	// The URL opened by the model.
 4132	URL string `json:"url,required" format:"uri"`
 4133	// The action type.
 4134	//
 4135	// This field can be elided, and will marshal its zero value as "open_page".
 4136	Type constant.OpenPage `json:"type,required"`
 4137	paramObj
 4138}
 4139
 4140func (r ResponseFunctionWebSearchActionOpenPageParam) MarshalJSON() (data []byte, err error) {
 4141	type shadow ResponseFunctionWebSearchActionOpenPageParam
 4142	return param.MarshalObject(r, (*shadow)(&r))
 4143}
 4144func (r *ResponseFunctionWebSearchActionOpenPageParam) UnmarshalJSON(data []byte) error {
 4145	return apijson.UnmarshalRoot(data, r)
 4146}
 4147
 4148// Action type "find": Searches for a pattern within a loaded page.
 4149//
 4150// The properties Pattern, Type, URL are required.
 4151type ResponseFunctionWebSearchActionFindParam struct {
 4152	// The pattern or text to search for within the page.
 4153	Pattern string `json:"pattern,required"`
 4154	// The URL of the page searched for the pattern.
 4155	URL string `json:"url,required" format:"uri"`
 4156	// The action type.
 4157	//
 4158	// This field can be elided, and will marshal its zero value as "find".
 4159	Type constant.Find `json:"type,required"`
 4160	paramObj
 4161}
 4162
 4163func (r ResponseFunctionWebSearchActionFindParam) MarshalJSON() (data []byte, err error) {
 4164	type shadow ResponseFunctionWebSearchActionFindParam
 4165	return param.MarshalObject(r, (*shadow)(&r))
 4166}
 4167func (r *ResponseFunctionWebSearchActionFindParam) UnmarshalJSON(data []byte) error {
 4168	return apijson.UnmarshalRoot(data, r)
 4169}
 4170
 4171// Emitted when an image generation tool call has completed and the final image is
 4172// available.
 4173type ResponseImageGenCallCompletedEvent struct {
 4174	// The unique identifier of the image generation item being processed.
 4175	ItemID string `json:"item_id,required"`
 4176	// The index of the output item in the response's output array.
 4177	OutputIndex int64 `json:"output_index,required"`
 4178	// The sequence number of this event.
 4179	SequenceNumber int64 `json:"sequence_number,required"`
 4180	// The type of the event. Always 'response.image_generation_call.completed'.
 4181	Type constant.ResponseImageGenerationCallCompleted `json:"type,required"`
 4182	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 4183	JSON struct {
 4184		ItemID         respjson.Field
 4185		OutputIndex    respjson.Field
 4186		SequenceNumber respjson.Field
 4187		Type           respjson.Field
 4188		ExtraFields    map[string]respjson.Field
 4189		raw            string
 4190	} `json:"-"`
 4191}
 4192
 4193// Returns the unmodified JSON received from the API
 4194func (r ResponseImageGenCallCompletedEvent) RawJSON() string { return r.JSON.raw }
 4195func (r *ResponseImageGenCallCompletedEvent) UnmarshalJSON(data []byte) error {
 4196	return apijson.UnmarshalRoot(data, r)
 4197}
 4198
 4199// Emitted when an image generation tool call is actively generating an image
 4200// (intermediate state).
 4201type ResponseImageGenCallGeneratingEvent struct {
 4202	// The unique identifier of the image generation item being processed.
 4203	ItemID string `json:"item_id,required"`
 4204	// The index of the output item in the response's output array.
 4205	OutputIndex int64 `json:"output_index,required"`
 4206	// The sequence number of the image generation item being processed.
 4207	SequenceNumber int64 `json:"sequence_number,required"`
 4208	// The type of the event. Always 'response.image_generation_call.generating'.
 4209	Type constant.ResponseImageGenerationCallGenerating `json:"type,required"`
 4210	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 4211	JSON struct {
 4212		ItemID         respjson.Field
 4213		OutputIndex    respjson.Field
 4214		SequenceNumber respjson.Field
 4215		Type           respjson.Field
 4216		ExtraFields    map[string]respjson.Field
 4217		raw            string
 4218	} `json:"-"`
 4219}
 4220
 4221// Returns the unmodified JSON received from the API
 4222func (r ResponseImageGenCallGeneratingEvent) RawJSON() string { return r.JSON.raw }
 4223func (r *ResponseImageGenCallGeneratingEvent) UnmarshalJSON(data []byte) error {
 4224	return apijson.UnmarshalRoot(data, r)
 4225}
 4226
 4227// Emitted when an image generation tool call is in progress.
 4228type ResponseImageGenCallInProgressEvent struct {
 4229	// The unique identifier of the image generation item being processed.
 4230	ItemID string `json:"item_id,required"`
 4231	// The index of the output item in the response's output array.
 4232	OutputIndex int64 `json:"output_index,required"`
 4233	// The sequence number of the image generation item being processed.
 4234	SequenceNumber int64 `json:"sequence_number,required"`
 4235	// The type of the event. Always 'response.image_generation_call.in_progress'.
 4236	Type constant.ResponseImageGenerationCallInProgress `json:"type,required"`
 4237	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 4238	JSON struct {
 4239		ItemID         respjson.Field
 4240		OutputIndex    respjson.Field
 4241		SequenceNumber respjson.Field
 4242		Type           respjson.Field
 4243		ExtraFields    map[string]respjson.Field
 4244		raw            string
 4245	} `json:"-"`
 4246}
 4247
 4248// Returns the unmodified JSON received from the API
 4249func (r ResponseImageGenCallInProgressEvent) RawJSON() string { return r.JSON.raw }
 4250func (r *ResponseImageGenCallInProgressEvent) UnmarshalJSON(data []byte) error {
 4251	return apijson.UnmarshalRoot(data, r)
 4252}
 4253
 4254// Emitted when a partial image is available during image generation streaming.
 4255type ResponseImageGenCallPartialImageEvent struct {
 4256	// The unique identifier of the image generation item being processed.
 4257	ItemID string `json:"item_id,required"`
 4258	// The index of the output item in the response's output array.
 4259	OutputIndex int64 `json:"output_index,required"`
 4260	// Base64-encoded partial image data, suitable for rendering as an image.
 4261	PartialImageB64 string `json:"partial_image_b64,required"`
 4262	// 0-based index for the partial image (backend is 1-based, but this is 0-based for
 4263	// the user).
 4264	PartialImageIndex int64 `json:"partial_image_index,required"`
 4265	// The sequence number of the image generation item being processed.
 4266	SequenceNumber int64 `json:"sequence_number,required"`
 4267	// The type of the event. Always 'response.image_generation_call.partial_image'.
 4268	Type constant.ResponseImageGenerationCallPartialImage `json:"type,required"`
 4269	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 4270	JSON struct {
 4271		ItemID            respjson.Field
 4272		OutputIndex       respjson.Field
 4273		PartialImageB64   respjson.Field
 4274		PartialImageIndex respjson.Field
 4275		SequenceNumber    respjson.Field
 4276		Type              respjson.Field
 4277		ExtraFields       map[string]respjson.Field
 4278		raw               string
 4279	} `json:"-"`
 4280}
 4281
 4282// Returns the unmodified JSON received from the API
 4283func (r ResponseImageGenCallPartialImageEvent) RawJSON() string { return r.JSON.raw }
 4284func (r *ResponseImageGenCallPartialImageEvent) UnmarshalJSON(data []byte) error {
 4285	return apijson.UnmarshalRoot(data, r)
 4286}
 4287
 4288// Emitted when the response is in progress.
 4289type ResponseInProgressEvent struct {
 4290	// The response that is in progress.
 4291	Response Response `json:"response,required"`
 4292	// The sequence number of this event.
 4293	SequenceNumber int64 `json:"sequence_number,required"`
 4294	// The type of the event. Always `response.in_progress`.
 4295	Type constant.ResponseInProgress `json:"type,required"`
 4296	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 4297	JSON struct {
 4298		Response       respjson.Field
 4299		SequenceNumber respjson.Field
 4300		Type           respjson.Field
 4301		ExtraFields    map[string]respjson.Field
 4302		raw            string
 4303	} `json:"-"`
 4304}
 4305
 4306// Returns the unmodified JSON received from the API
 4307func (r ResponseInProgressEvent) RawJSON() string { return r.JSON.raw }
 4308func (r *ResponseInProgressEvent) UnmarshalJSON(data []byte) error {
 4309	return apijson.UnmarshalRoot(data, r)
 4310}
 4311
 4312// Specify additional output data to include in the model response. Currently
 4313// supported values are:
 4314//
 4315//   - `code_interpreter_call.outputs`: Includes the outputs of python code execution
 4316//     in code interpreter tool call items.
 4317//   - `computer_call_output.output.image_url`: Include image urls from the computer
 4318//     call output.
 4319//   - `file_search_call.results`: Include the search results of the file search tool
 4320//     call.
 4321//   - `message.input_image.image_url`: Include image urls from the input message.
 4322//   - `message.output_text.logprobs`: Include logprobs with assistant messages.
 4323//   - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
 4324//     tokens in reasoning item outputs. This enables reasoning items to be used in
 4325//     multi-turn conversations when using the Responses API statelessly (like when
 4326//     the `store` parameter is set to `false`, or when an organization is enrolled
 4327//     in the zero data retention program).
 4328type ResponseIncludable string
 4329
 4330const (
 4331	ResponseIncludableCodeInterpreterCallOutputs       ResponseIncludable = "code_interpreter_call.outputs"
 4332	ResponseIncludableComputerCallOutputOutputImageURL ResponseIncludable = "computer_call_output.output.image_url"
 4333	ResponseIncludableFileSearchCallResults            ResponseIncludable = "file_search_call.results"
 4334	ResponseIncludableMessageInputImageImageURL        ResponseIncludable = "message.input_image.image_url"
 4335	ResponseIncludableMessageOutputTextLogprobs        ResponseIncludable = "message.output_text.logprobs"
 4336	ResponseIncludableReasoningEncryptedContent        ResponseIncludable = "reasoning.encrypted_content"
 4337)
 4338
 4339// An event that is emitted when a response finishes as incomplete.
 4340type ResponseIncompleteEvent struct {
 4341	// The response that was incomplete.
 4342	Response Response `json:"response,required"`
 4343	// The sequence number of this event.
 4344	SequenceNumber int64 `json:"sequence_number,required"`
 4345	// The type of the event. Always `response.incomplete`.
 4346	Type constant.ResponseIncomplete `json:"type,required"`
 4347	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 4348	JSON struct {
 4349		Response       respjson.Field
 4350		SequenceNumber respjson.Field
 4351		Type           respjson.Field
 4352		ExtraFields    map[string]respjson.Field
 4353		raw            string
 4354	} `json:"-"`
 4355}
 4356
 4357// Returns the unmodified JSON received from the API
 4358func (r ResponseIncompleteEvent) RawJSON() string { return r.JSON.raw }
 4359func (r *ResponseIncompleteEvent) UnmarshalJSON(data []byte) error {
 4360	return apijson.UnmarshalRoot(data, r)
 4361}
 4362
 4363type ResponseInputParam []ResponseInputItemUnionParam
 4364
 4365// ResponseInputContentUnion contains all possible properties and values from
 4366// [ResponseInputText], [ResponseInputImage], [ResponseInputFile].
 4367//
 4368// Use the [ResponseInputContentUnion.AsAny] method to switch on the variant.
 4369//
 4370// Use the methods beginning with 'As' to cast the union to one of its variants.
 4371type ResponseInputContentUnion struct {
 4372	// This field is from variant [ResponseInputText].
 4373	Text string `json:"text"`
 4374	// Any of "input_text", "input_image", "input_file".
 4375	Type string `json:"type"`
 4376	// This field is from variant [ResponseInputImage].
 4377	Detail ResponseInputImageDetail `json:"detail"`
 4378	FileID string                   `json:"file_id"`
 4379	// This field is from variant [ResponseInputImage].
 4380	ImageURL string `json:"image_url"`
 4381	// This field is from variant [ResponseInputFile].
 4382	FileData string `json:"file_data"`
 4383	// This field is from variant [ResponseInputFile].
 4384	Filename string `json:"filename"`
 4385	JSON     struct {
 4386		Text     respjson.Field
 4387		Type     respjson.Field
 4388		Detail   respjson.Field
 4389		FileID   respjson.Field
 4390		ImageURL respjson.Field
 4391		FileData respjson.Field
 4392		Filename respjson.Field
 4393		raw      string
 4394	} `json:"-"`
 4395}
 4396
 4397// anyResponseInputContent is implemented by each variant of
 4398// [ResponseInputContentUnion] to add type safety for the return type of
 4399// [ResponseInputContentUnion.AsAny]
 4400type anyResponseInputContent interface {
 4401	implResponseInputContentUnion()
 4402}
 4403
 4404func (ResponseInputText) implResponseInputContentUnion()  {}
 4405func (ResponseInputImage) implResponseInputContentUnion() {}
 4406func (ResponseInputFile) implResponseInputContentUnion()  {}
 4407
 4408// Use the following switch statement to find the correct variant
 4409//
 4410//	switch variant := ResponseInputContentUnion.AsAny().(type) {
 4411//	case responses.ResponseInputText:
 4412//	case responses.ResponseInputImage:
 4413//	case responses.ResponseInputFile:
 4414//	default:
 4415//	  fmt.Errorf("no variant present")
 4416//	}
 4417func (u ResponseInputContentUnion) AsAny() anyResponseInputContent {
 4418	switch u.Type {
 4419	case "input_text":
 4420		return u.AsInputText()
 4421	case "input_image":
 4422		return u.AsInputImage()
 4423	case "input_file":
 4424		return u.AsInputFile()
 4425	}
 4426	return nil
 4427}
 4428
 4429func (u ResponseInputContentUnion) AsInputText() (v ResponseInputText) {
 4430	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4431	return
 4432}
 4433
 4434func (u ResponseInputContentUnion) AsInputImage() (v ResponseInputImage) {
 4435	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4436	return
 4437}
 4438
 4439func (u ResponseInputContentUnion) AsInputFile() (v ResponseInputFile) {
 4440	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4441	return
 4442}
 4443
 4444// Returns the unmodified JSON received from the API
 4445func (u ResponseInputContentUnion) RawJSON() string { return u.JSON.raw }
 4446
 4447func (r *ResponseInputContentUnion) UnmarshalJSON(data []byte) error {
 4448	return apijson.UnmarshalRoot(data, r)
 4449}
 4450
 4451// ToParam converts this ResponseInputContentUnion to a
 4452// ResponseInputContentUnionParam.
 4453//
 4454// Warning: the fields of the param type will not be present. ToParam should only
 4455// be used at the last possible moment before sending a request. Test for this with
 4456// ResponseInputContentUnionParam.Overrides()
 4457func (r ResponseInputContentUnion) ToParam() ResponseInputContentUnionParam {
 4458	return param.Override[ResponseInputContentUnionParam](json.RawMessage(r.RawJSON()))
 4459}
 4460
 4461func ResponseInputContentParamOfInputText(text string) ResponseInputContentUnionParam {
 4462	var inputText ResponseInputTextParam
 4463	inputText.Text = text
 4464	return ResponseInputContentUnionParam{OfInputText: &inputText}
 4465}
 4466
 4467func ResponseInputContentParamOfInputImage(detail ResponseInputImageDetail) ResponseInputContentUnionParam {
 4468	var inputImage ResponseInputImageParam
 4469	inputImage.Detail = detail
 4470	return ResponseInputContentUnionParam{OfInputImage: &inputImage}
 4471}
 4472
 4473// Only one field can be non-zero.
 4474//
 4475// Use [param.IsOmitted] to confirm if a field is set.
 4476type ResponseInputContentUnionParam struct {
 4477	OfInputText  *ResponseInputTextParam  `json:",omitzero,inline"`
 4478	OfInputImage *ResponseInputImageParam `json:",omitzero,inline"`
 4479	OfInputFile  *ResponseInputFileParam  `json:",omitzero,inline"`
 4480	paramUnion
 4481}
 4482
 4483func (u ResponseInputContentUnionParam) MarshalJSON() ([]byte, error) {
 4484	return param.MarshalUnion(u, u.OfInputText, u.OfInputImage, u.OfInputFile)
 4485}
 4486func (u *ResponseInputContentUnionParam) UnmarshalJSON(data []byte) error {
 4487	return apijson.UnmarshalRoot(data, u)
 4488}
 4489
 4490func (u *ResponseInputContentUnionParam) asAny() any {
 4491	if !param.IsOmitted(u.OfInputText) {
 4492		return u.OfInputText
 4493	} else if !param.IsOmitted(u.OfInputImage) {
 4494		return u.OfInputImage
 4495	} else if !param.IsOmitted(u.OfInputFile) {
 4496		return u.OfInputFile
 4497	}
 4498	return nil
 4499}
 4500
 4501// Returns a pointer to the underlying variant's property, if present.
 4502func (u ResponseInputContentUnionParam) GetText() *string {
 4503	if vt := u.OfInputText; vt != nil {
 4504		return &vt.Text
 4505	}
 4506	return nil
 4507}
 4508
 4509// Returns a pointer to the underlying variant's property, if present.
 4510func (u ResponseInputContentUnionParam) GetDetail() *string {
 4511	if vt := u.OfInputImage; vt != nil {
 4512		return (*string)(&vt.Detail)
 4513	}
 4514	return nil
 4515}
 4516
 4517// Returns a pointer to the underlying variant's property, if present.
 4518func (u ResponseInputContentUnionParam) GetImageURL() *string {
 4519	if vt := u.OfInputImage; vt != nil && vt.ImageURL.Valid() {
 4520		return &vt.ImageURL.Value
 4521	}
 4522	return nil
 4523}
 4524
 4525// Returns a pointer to the underlying variant's property, if present.
 4526func (u ResponseInputContentUnionParam) GetFileData() *string {
 4527	if vt := u.OfInputFile; vt != nil && vt.FileData.Valid() {
 4528		return &vt.FileData.Value
 4529	}
 4530	return nil
 4531}
 4532
 4533// Returns a pointer to the underlying variant's property, if present.
 4534func (u ResponseInputContentUnionParam) GetFilename() *string {
 4535	if vt := u.OfInputFile; vt != nil && vt.Filename.Valid() {
 4536		return &vt.Filename.Value
 4537	}
 4538	return nil
 4539}
 4540
 4541// Returns a pointer to the underlying variant's property, if present.
 4542func (u ResponseInputContentUnionParam) GetType() *string {
 4543	if vt := u.OfInputText; vt != nil {
 4544		return (*string)(&vt.Type)
 4545	} else if vt := u.OfInputImage; vt != nil {
 4546		return (*string)(&vt.Type)
 4547	} else if vt := u.OfInputFile; vt != nil {
 4548		return (*string)(&vt.Type)
 4549	}
 4550	return nil
 4551}
 4552
 4553// Returns a pointer to the underlying variant's property, if present.
 4554func (u ResponseInputContentUnionParam) GetFileID() *string {
 4555	if vt := u.OfInputImage; vt != nil && vt.FileID.Valid() {
 4556		return &vt.FileID.Value
 4557	} else if vt := u.OfInputFile; vt != nil && vt.FileID.Valid() {
 4558		return &vt.FileID.Value
 4559	}
 4560	return nil
 4561}
 4562
 4563func init() {
 4564	apijson.RegisterUnion[ResponseInputContentUnionParam](
 4565		"type",
 4566		apijson.Discriminator[ResponseInputTextParam]("input_text"),
 4567		apijson.Discriminator[ResponseInputImageParam]("input_image"),
 4568		apijson.Discriminator[ResponseInputFileParam]("input_file"),
 4569	)
 4570}
 4571
 4572// A file input to the model.
 4573type ResponseInputFile struct {
 4574	// The type of the input item. Always `input_file`.
 4575	Type constant.InputFile `json:"type,required"`
 4576	// The content of the file to be sent to the model.
 4577	FileData string `json:"file_data"`
 4578	// The ID of the file to be sent to the model.
 4579	FileID string `json:"file_id,nullable"`
 4580	// The name of the file to be sent to the model.
 4581	Filename string `json:"filename"`
 4582	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 4583	JSON struct {
 4584		Type        respjson.Field
 4585		FileData    respjson.Field
 4586		FileID      respjson.Field
 4587		Filename    respjson.Field
 4588		ExtraFields map[string]respjson.Field
 4589		raw         string
 4590	} `json:"-"`
 4591}
 4592
 4593// Returns the unmodified JSON received from the API
 4594func (r ResponseInputFile) RawJSON() string { return r.JSON.raw }
 4595func (r *ResponseInputFile) UnmarshalJSON(data []byte) error {
 4596	return apijson.UnmarshalRoot(data, r)
 4597}
 4598
 4599// ToParam converts this ResponseInputFile to a ResponseInputFileParam.
 4600//
 4601// Warning: the fields of the param type will not be present. ToParam should only
 4602// be used at the last possible moment before sending a request. Test for this with
 4603// ResponseInputFileParam.Overrides()
 4604func (r ResponseInputFile) ToParam() ResponseInputFileParam {
 4605	return param.Override[ResponseInputFileParam](json.RawMessage(r.RawJSON()))
 4606}
 4607
 4608// A file input to the model.
 4609//
 4610// The property Type is required.
 4611type ResponseInputFileParam struct {
 4612	// The ID of the file to be sent to the model.
 4613	FileID param.Opt[string] `json:"file_id,omitzero"`
 4614	// The content of the file to be sent to the model.
 4615	FileData param.Opt[string] `json:"file_data,omitzero"`
 4616	// The name of the file to be sent to the model.
 4617	Filename param.Opt[string] `json:"filename,omitzero"`
 4618	// The type of the input item. Always `input_file`.
 4619	//
 4620	// This field can be elided, and will marshal its zero value as "input_file".
 4621	Type constant.InputFile `json:"type,required"`
 4622	paramObj
 4623}
 4624
 4625func (r ResponseInputFileParam) MarshalJSON() (data []byte, err error) {
 4626	type shadow ResponseInputFileParam
 4627	return param.MarshalObject(r, (*shadow)(&r))
 4628}
 4629func (r *ResponseInputFileParam) UnmarshalJSON(data []byte) error {
 4630	return apijson.UnmarshalRoot(data, r)
 4631}
 4632
 4633// An image input to the model. Learn about
 4634// [image inputs](https://platform.openai.com/docs/guides/vision).
 4635type ResponseInputImage struct {
 4636	// The detail level of the image to be sent to the model. One of `high`, `low`, or
 4637	// `auto`. Defaults to `auto`.
 4638	//
 4639	// Any of "low", "high", "auto".
 4640	Detail ResponseInputImageDetail `json:"detail,required"`
 4641	// The type of the input item. Always `input_image`.
 4642	Type constant.InputImage `json:"type,required"`
 4643	// The ID of the file to be sent to the model.
 4644	FileID string `json:"file_id,nullable"`
 4645	// The URL of the image to be sent to the model. A fully qualified URL or base64
 4646	// encoded image in a data URL.
 4647	ImageURL string `json:"image_url,nullable"`
 4648	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 4649	JSON struct {
 4650		Detail      respjson.Field
 4651		Type        respjson.Field
 4652		FileID      respjson.Field
 4653		ImageURL    respjson.Field
 4654		ExtraFields map[string]respjson.Field
 4655		raw         string
 4656	} `json:"-"`
 4657}
 4658
 4659// Returns the unmodified JSON received from the API
 4660func (r ResponseInputImage) RawJSON() string { return r.JSON.raw }
 4661func (r *ResponseInputImage) UnmarshalJSON(data []byte) error {
 4662	return apijson.UnmarshalRoot(data, r)
 4663}
 4664
 4665// ToParam converts this ResponseInputImage to a ResponseInputImageParam.
 4666//
 4667// Warning: the fields of the param type will not be present. ToParam should only
 4668// be used at the last possible moment before sending a request. Test for this with
 4669// ResponseInputImageParam.Overrides()
 4670func (r ResponseInputImage) ToParam() ResponseInputImageParam {
 4671	return param.Override[ResponseInputImageParam](json.RawMessage(r.RawJSON()))
 4672}
 4673
 4674// The detail level of the image to be sent to the model. One of `high`, `low`, or
 4675// `auto`. Defaults to `auto`.
 4676type ResponseInputImageDetail string
 4677
 4678const (
 4679	ResponseInputImageDetailLow  ResponseInputImageDetail = "low"
 4680	ResponseInputImageDetailHigh ResponseInputImageDetail = "high"
 4681	ResponseInputImageDetailAuto ResponseInputImageDetail = "auto"
 4682)
 4683
 4684// An image input to the model. Learn about
 4685// [image inputs](https://platform.openai.com/docs/guides/vision).
 4686//
 4687// The properties Detail, Type are required.
 4688type ResponseInputImageParam struct {
 4689	// The detail level of the image to be sent to the model. One of `high`, `low`, or
 4690	// `auto`. Defaults to `auto`.
 4691	//
 4692	// Any of "low", "high", "auto".
 4693	Detail ResponseInputImageDetail `json:"detail,omitzero,required"`
 4694	// The ID of the file to be sent to the model.
 4695	FileID param.Opt[string] `json:"file_id,omitzero"`
 4696	// The URL of the image to be sent to the model. A fully qualified URL or base64
 4697	// encoded image in a data URL.
 4698	ImageURL param.Opt[string] `json:"image_url,omitzero"`
 4699	// The type of the input item. Always `input_image`.
 4700	//
 4701	// This field can be elided, and will marshal its zero value as "input_image".
 4702	Type constant.InputImage `json:"type,required"`
 4703	paramObj
 4704}
 4705
 4706func (r ResponseInputImageParam) MarshalJSON() (data []byte, err error) {
 4707	type shadow ResponseInputImageParam
 4708	return param.MarshalObject(r, (*shadow)(&r))
 4709}
 4710func (r *ResponseInputImageParam) UnmarshalJSON(data []byte) error {
 4711	return apijson.UnmarshalRoot(data, r)
 4712}
 4713
 4714// ResponseInputItemUnion contains all possible properties and values from
 4715// [EasyInputMessage], [ResponseInputItemMessage], [ResponseOutputMessage],
 4716// [ResponseFileSearchToolCall], [ResponseComputerToolCall],
 4717// [ResponseInputItemComputerCallOutput], [ResponseFunctionWebSearch],
 4718// [ResponseFunctionToolCall], [ResponseInputItemFunctionCallOutput],
 4719// [ResponseReasoningItem], [ResponseInputItemImageGenerationCall],
 4720// [ResponseCodeInterpreterToolCall], [ResponseInputItemLocalShellCall],
 4721// [ResponseInputItemLocalShellCallOutput], [ResponseInputItemMcpListTools],
 4722// [ResponseInputItemMcpApprovalRequest], [ResponseInputItemMcpApprovalResponse],
 4723// [ResponseInputItemMcpCall], [ResponseInputItemItemReference].
 4724//
 4725// Use the [ResponseInputItemUnion.AsAny] method to switch on the variant.
 4726//
 4727// Use the methods beginning with 'As' to cast the union to one of its variants.
 4728type ResponseInputItemUnion struct {
 4729	// This field is a union of [EasyInputMessageContentUnion],
 4730	// [ResponseInputMessageContentList], [[]ResponseOutputMessageContentUnion]
 4731	Content ResponseInputItemUnionContent `json:"content"`
 4732	Role    string                        `json:"role"`
 4733	// Any of "message", "message", "message", "file_search_call", "computer_call",
 4734	// "computer_call_output", "web_search_call", "function_call",
 4735	// "function_call_output", "reasoning", "image_generation_call",
 4736	// "code_interpreter_call", "local_shell_call", "local_shell_call_output",
 4737	// "mcp_list_tools", "mcp_approval_request", "mcp_approval_response", "mcp_call",
 4738	// "item_reference".
 4739	Type   string `json:"type"`
 4740	Status string `json:"status"`
 4741	ID     string `json:"id"`
 4742	// This field is from variant [ResponseFileSearchToolCall].
 4743	Queries []string `json:"queries"`
 4744	// This field is from variant [ResponseFileSearchToolCall].
 4745	Results []ResponseFileSearchToolCallResult `json:"results"`
 4746	// This field is a union of [ResponseComputerToolCallActionUnion],
 4747	// [ResponseFunctionWebSearchActionUnion], [ResponseInputItemLocalShellCallAction]
 4748	Action ResponseInputItemUnionAction `json:"action"`
 4749	CallID string                       `json:"call_id"`
 4750	// This field is from variant [ResponseComputerToolCall].
 4751	PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck `json:"pending_safety_checks"`
 4752	// This field is a union of [ResponseComputerToolCallOutputScreenshot], [string],
 4753	// [string], [string]
 4754	Output ResponseInputItemUnionOutput `json:"output"`
 4755	// This field is from variant [ResponseInputItemComputerCallOutput].
 4756	AcknowledgedSafetyChecks []ResponseInputItemComputerCallOutputAcknowledgedSafetyCheck `json:"acknowledged_safety_checks"`
 4757	Arguments                string                                                       `json:"arguments"`
 4758	Name                     string                                                       `json:"name"`
 4759	// This field is from variant [ResponseReasoningItem].
 4760	Summary []ResponseReasoningItemSummary `json:"summary"`
 4761	// This field is from variant [ResponseReasoningItem].
 4762	EncryptedContent string `json:"encrypted_content"`
 4763	// This field is from variant [ResponseInputItemImageGenerationCall].
 4764	Result string `json:"result"`
 4765	// This field is from variant [ResponseCodeInterpreterToolCall].
 4766	Code string `json:"code"`
 4767	// This field is from variant [ResponseCodeInterpreterToolCall].
 4768	ContainerID string `json:"container_id"`
 4769	// This field is from variant [ResponseCodeInterpreterToolCall].
 4770	Outputs     []ResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
 4771	ServerLabel string                                       `json:"server_label"`
 4772	// This field is from variant [ResponseInputItemMcpListTools].
 4773	Tools []ResponseInputItemMcpListToolsTool `json:"tools"`
 4774	Error string                              `json:"error"`
 4775	// This field is from variant [ResponseInputItemMcpApprovalResponse].
 4776	ApprovalRequestID string `json:"approval_request_id"`
 4777	// This field is from variant [ResponseInputItemMcpApprovalResponse].
 4778	Approve bool `json:"approve"`
 4779	// This field is from variant [ResponseInputItemMcpApprovalResponse].
 4780	Reason string `json:"reason"`
 4781	JSON   struct {
 4782		Content                  respjson.Field
 4783		Role                     respjson.Field
 4784		Type                     respjson.Field
 4785		Status                   respjson.Field
 4786		ID                       respjson.Field
 4787		Queries                  respjson.Field
 4788		Results                  respjson.Field
 4789		Action                   respjson.Field
 4790		CallID                   respjson.Field
 4791		PendingSafetyChecks      respjson.Field
 4792		Output                   respjson.Field
 4793		AcknowledgedSafetyChecks respjson.Field
 4794		Arguments                respjson.Field
 4795		Name                     respjson.Field
 4796		Summary                  respjson.Field
 4797		EncryptedContent         respjson.Field
 4798		Result                   respjson.Field
 4799		Code                     respjson.Field
 4800		ContainerID              respjson.Field
 4801		Outputs                  respjson.Field
 4802		ServerLabel              respjson.Field
 4803		Tools                    respjson.Field
 4804		Error                    respjson.Field
 4805		ApprovalRequestID        respjson.Field
 4806		Approve                  respjson.Field
 4807		Reason                   respjson.Field
 4808		raw                      string
 4809	} `json:"-"`
 4810}
 4811
 4812// anyResponseInputItem is implemented by each variant of [ResponseInputItemUnion]
 4813// to add type safety for the return type of [ResponseInputItemUnion.AsAny]
 4814type anyResponseInputItem interface {
 4815	implResponseInputItemUnion()
 4816}
 4817
 4818func (EasyInputMessage) implResponseInputItemUnion()                      {}
 4819func (ResponseInputItemMessage) implResponseInputItemUnion()              {}
 4820func (ResponseOutputMessage) implResponseInputItemUnion()                 {}
 4821func (ResponseFileSearchToolCall) implResponseInputItemUnion()            {}
 4822func (ResponseComputerToolCall) implResponseInputItemUnion()              {}
 4823func (ResponseInputItemComputerCallOutput) implResponseInputItemUnion()   {}
 4824func (ResponseFunctionWebSearch) implResponseInputItemUnion()             {}
 4825func (ResponseFunctionToolCall) implResponseInputItemUnion()              {}
 4826func (ResponseInputItemFunctionCallOutput) implResponseInputItemUnion()   {}
 4827func (ResponseReasoningItem) implResponseInputItemUnion()                 {}
 4828func (ResponseInputItemImageGenerationCall) implResponseInputItemUnion()  {}
 4829func (ResponseCodeInterpreterToolCall) implResponseInputItemUnion()       {}
 4830func (ResponseInputItemLocalShellCall) implResponseInputItemUnion()       {}
 4831func (ResponseInputItemLocalShellCallOutput) implResponseInputItemUnion() {}
 4832func (ResponseInputItemMcpListTools) implResponseInputItemUnion()         {}
 4833func (ResponseInputItemMcpApprovalRequest) implResponseInputItemUnion()   {}
 4834func (ResponseInputItemMcpApprovalResponse) implResponseInputItemUnion()  {}
 4835func (ResponseInputItemMcpCall) implResponseInputItemUnion()              {}
 4836func (ResponseInputItemItemReference) implResponseInputItemUnion()        {}
 4837
 4838// Use the following switch statement to find the correct variant
 4839//
 4840//	switch variant := ResponseInputItemUnion.AsAny().(type) {
 4841//	case responses.EasyInputMessage:
 4842//	case responses.ResponseInputItemMessage:
 4843//	case responses.ResponseOutputMessage:
 4844//	case responses.ResponseFileSearchToolCall:
 4845//	case responses.ResponseComputerToolCall:
 4846//	case responses.ResponseInputItemComputerCallOutput:
 4847//	case responses.ResponseFunctionWebSearch:
 4848//	case responses.ResponseFunctionToolCall:
 4849//	case responses.ResponseInputItemFunctionCallOutput:
 4850//	case responses.ResponseReasoningItem:
 4851//	case responses.ResponseInputItemImageGenerationCall:
 4852//	case responses.ResponseCodeInterpreterToolCall:
 4853//	case responses.ResponseInputItemLocalShellCall:
 4854//	case responses.ResponseInputItemLocalShellCallOutput:
 4855//	case responses.ResponseInputItemMcpListTools:
 4856//	case responses.ResponseInputItemMcpApprovalRequest:
 4857//	case responses.ResponseInputItemMcpApprovalResponse:
 4858//	case responses.ResponseInputItemMcpCall:
 4859//	case responses.ResponseInputItemItemReference:
 4860//	default:
 4861//	  fmt.Errorf("no variant present")
 4862//	}
 4863func (u ResponseInputItemUnion) AsAny() anyResponseInputItem {
 4864	switch u.Type {
 4865	case "message":
 4866		return u.AsOutputMessage()
 4867	case "file_search_call":
 4868		return u.AsFileSearchCall()
 4869	case "computer_call":
 4870		return u.AsComputerCall()
 4871	case "computer_call_output":
 4872		return u.AsComputerCallOutput()
 4873	case "web_search_call":
 4874		return u.AsWebSearchCall()
 4875	case "function_call":
 4876		return u.AsFunctionCall()
 4877	case "function_call_output":
 4878		return u.AsFunctionCallOutput()
 4879	case "reasoning":
 4880		return u.AsReasoning()
 4881	case "image_generation_call":
 4882		return u.AsImageGenerationCall()
 4883	case "code_interpreter_call":
 4884		return u.AsCodeInterpreterCall()
 4885	case "local_shell_call":
 4886		return u.AsLocalShellCall()
 4887	case "local_shell_call_output":
 4888		return u.AsLocalShellCallOutput()
 4889	case "mcp_list_tools":
 4890		return u.AsMcpListTools()
 4891	case "mcp_approval_request":
 4892		return u.AsMcpApprovalRequest()
 4893	case "mcp_approval_response":
 4894		return u.AsMcpApprovalResponse()
 4895	case "mcp_call":
 4896		return u.AsMcpCall()
 4897	case "item_reference":
 4898		return u.AsItemReference()
 4899	}
 4900	return nil
 4901}
 4902
 4903func (u ResponseInputItemUnion) AsMessage() (v EasyInputMessage) {
 4904	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4905	return
 4906}
 4907
 4908func (u ResponseInputItemUnion) AsInputMessage() (v ResponseInputItemMessage) {
 4909	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4910	return
 4911}
 4912
 4913func (u ResponseInputItemUnion) AsOutputMessage() (v ResponseOutputMessage) {
 4914	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4915	return
 4916}
 4917
 4918func (u ResponseInputItemUnion) AsFileSearchCall() (v ResponseFileSearchToolCall) {
 4919	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4920	return
 4921}
 4922
 4923func (u ResponseInputItemUnion) AsComputerCall() (v ResponseComputerToolCall) {
 4924	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4925	return
 4926}
 4927
 4928func (u ResponseInputItemUnion) AsComputerCallOutput() (v ResponseInputItemComputerCallOutput) {
 4929	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4930	return
 4931}
 4932
 4933func (u ResponseInputItemUnion) AsWebSearchCall() (v ResponseFunctionWebSearch) {
 4934	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4935	return
 4936}
 4937
 4938func (u ResponseInputItemUnion) AsFunctionCall() (v ResponseFunctionToolCall) {
 4939	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4940	return
 4941}
 4942
 4943func (u ResponseInputItemUnion) AsFunctionCallOutput() (v ResponseInputItemFunctionCallOutput) {
 4944	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4945	return
 4946}
 4947
 4948func (u ResponseInputItemUnion) AsReasoning() (v ResponseReasoningItem) {
 4949	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4950	return
 4951}
 4952
 4953func (u ResponseInputItemUnion) AsImageGenerationCall() (v ResponseInputItemImageGenerationCall) {
 4954	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4955	return
 4956}
 4957
 4958func (u ResponseInputItemUnion) AsCodeInterpreterCall() (v ResponseCodeInterpreterToolCall) {
 4959	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4960	return
 4961}
 4962
 4963func (u ResponseInputItemUnion) AsLocalShellCall() (v ResponseInputItemLocalShellCall) {
 4964	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4965	return
 4966}
 4967
 4968func (u ResponseInputItemUnion) AsLocalShellCallOutput() (v ResponseInputItemLocalShellCallOutput) {
 4969	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4970	return
 4971}
 4972
 4973func (u ResponseInputItemUnion) AsMcpListTools() (v ResponseInputItemMcpListTools) {
 4974	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4975	return
 4976}
 4977
 4978func (u ResponseInputItemUnion) AsMcpApprovalRequest() (v ResponseInputItemMcpApprovalRequest) {
 4979	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4980	return
 4981}
 4982
 4983func (u ResponseInputItemUnion) AsMcpApprovalResponse() (v ResponseInputItemMcpApprovalResponse) {
 4984	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4985	return
 4986}
 4987
 4988func (u ResponseInputItemUnion) AsMcpCall() (v ResponseInputItemMcpCall) {
 4989	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4990	return
 4991}
 4992
 4993func (u ResponseInputItemUnion) AsItemReference() (v ResponseInputItemItemReference) {
 4994	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 4995	return
 4996}
 4997
 4998// Returns the unmodified JSON received from the API
 4999func (u ResponseInputItemUnion) RawJSON() string { return u.JSON.raw }
 5000
 5001func (r *ResponseInputItemUnion) UnmarshalJSON(data []byte) error {
 5002	return apijson.UnmarshalRoot(data, r)
 5003}
 5004
 5005// ResponseInputItemUnionContent is an implicit subunion of
 5006// [ResponseInputItemUnion]. ResponseInputItemUnionContent provides convenient
 5007// access to the sub-properties of the union.
 5008//
 5009// For type safety it is recommended to directly use a variant of the
 5010// [ResponseInputItemUnion].
 5011//
 5012// If the underlying value is not a json object, one of the following properties
 5013// will be valid: OfString OfInputItemContentList
 5014// OfResponseOutputMessageContentArray]
 5015type ResponseInputItemUnionContent struct {
 5016	// This field will be present if the value is a [string] instead of an object.
 5017	OfString string `json:",inline"`
 5018	// This field will be present if the value is a [ResponseInputMessageContentList]
 5019	// instead of an object.
 5020	OfInputItemContentList ResponseInputMessageContentList `json:",inline"`
 5021	// This field will be present if the value is a
 5022	// [[]ResponseOutputMessageContentUnion] instead of an object.
 5023	OfResponseOutputMessageContentArray []ResponseOutputMessageContentUnion `json:",inline"`
 5024	JSON                                struct {
 5025		OfString                            respjson.Field
 5026		OfInputItemContentList              respjson.Field
 5027		OfResponseOutputMessageContentArray respjson.Field
 5028		raw                                 string
 5029	} `json:"-"`
 5030}
 5031
 5032func (r *ResponseInputItemUnionContent) UnmarshalJSON(data []byte) error {
 5033	return apijson.UnmarshalRoot(data, r)
 5034}
 5035
 5036// ResponseInputItemUnionAction is an implicit subunion of
 5037// [ResponseInputItemUnion]. ResponseInputItemUnionAction provides convenient
 5038// access to the sub-properties of the union.
 5039//
 5040// For type safety it is recommended to directly use a variant of the
 5041// [ResponseInputItemUnion].
 5042type ResponseInputItemUnionAction struct {
 5043	// This field is from variant [ResponseComputerToolCallActionUnion].
 5044	Button string `json:"button"`
 5045	Type   string `json:"type"`
 5046	X      int64  `json:"x"`
 5047	Y      int64  `json:"y"`
 5048	// This field is from variant [ResponseComputerToolCallActionUnion].
 5049	Path []ResponseComputerToolCallActionDragPath `json:"path"`
 5050	// This field is from variant [ResponseComputerToolCallActionUnion].
 5051	Keys []string `json:"keys"`
 5052	// This field is from variant [ResponseComputerToolCallActionUnion].
 5053	ScrollX int64 `json:"scroll_x"`
 5054	// This field is from variant [ResponseComputerToolCallActionUnion].
 5055	ScrollY int64 `json:"scroll_y"`
 5056	// This field is from variant [ResponseComputerToolCallActionUnion].
 5057	Text string `json:"text"`
 5058	// This field is from variant [ResponseFunctionWebSearchActionUnion].
 5059	Query string `json:"query"`
 5060	URL   string `json:"url"`
 5061	// This field is from variant [ResponseFunctionWebSearchActionUnion].
 5062	Pattern string `json:"pattern"`
 5063	// This field is from variant [ResponseInputItemLocalShellCallAction].
 5064	Command []string `json:"command"`
 5065	// This field is from variant [ResponseInputItemLocalShellCallAction].
 5066	Env map[string]string `json:"env"`
 5067	// This field is from variant [ResponseInputItemLocalShellCallAction].
 5068	TimeoutMs int64 `json:"timeout_ms"`
 5069	// This field is from variant [ResponseInputItemLocalShellCallAction].
 5070	User string `json:"user"`
 5071	// This field is from variant [ResponseInputItemLocalShellCallAction].
 5072	WorkingDirectory string `json:"working_directory"`
 5073	JSON             struct {
 5074		Button           respjson.Field
 5075		Type             respjson.Field
 5076		X                respjson.Field
 5077		Y                respjson.Field
 5078		Path             respjson.Field
 5079		Keys             respjson.Field
 5080		ScrollX          respjson.Field
 5081		ScrollY          respjson.Field
 5082		Text             respjson.Field
 5083		Query            respjson.Field
 5084		URL              respjson.Field
 5085		Pattern          respjson.Field
 5086		Command          respjson.Field
 5087		Env              respjson.Field
 5088		TimeoutMs        respjson.Field
 5089		User             respjson.Field
 5090		WorkingDirectory respjson.Field
 5091		raw              string
 5092	} `json:"-"`
 5093}
 5094
 5095func (r *ResponseInputItemUnionAction) UnmarshalJSON(data []byte) error {
 5096	return apijson.UnmarshalRoot(data, r)
 5097}
 5098
 5099// ResponseInputItemUnionOutput is an implicit subunion of
 5100// [ResponseInputItemUnion]. ResponseInputItemUnionOutput provides convenient
 5101// access to the sub-properties of the union.
 5102//
 5103// For type safety it is recommended to directly use a variant of the
 5104// [ResponseInputItemUnion].
 5105//
 5106// If the underlying value is not a json object, one of the following properties
 5107// will be valid: OfString]
 5108type ResponseInputItemUnionOutput struct {
 5109	// This field will be present if the value is a [string] instead of an object.
 5110	OfString string `json:",inline"`
 5111	// This field is from variant [ResponseComputerToolCallOutputScreenshot].
 5112	Type constant.ComputerScreenshot `json:"type"`
 5113	// This field is from variant [ResponseComputerToolCallOutputScreenshot].
 5114	FileID string `json:"file_id"`
 5115	// This field is from variant [ResponseComputerToolCallOutputScreenshot].
 5116	ImageURL string `json:"image_url"`
 5117	JSON     struct {
 5118		OfString respjson.Field
 5119		Type     respjson.Field
 5120		FileID   respjson.Field
 5121		ImageURL respjson.Field
 5122		raw      string
 5123	} `json:"-"`
 5124}
 5125
 5126func (r *ResponseInputItemUnionOutput) UnmarshalJSON(data []byte) error {
 5127	return apijson.UnmarshalRoot(data, r)
 5128}
 5129
 5130// ToParam converts this ResponseInputItemUnion to a ResponseInputItemUnionParam.
 5131//
 5132// Warning: the fields of the param type will not be present. ToParam should only
 5133// be used at the last possible moment before sending a request. Test for this with
 5134// ResponseInputItemUnionParam.Overrides()
 5135func (r ResponseInputItemUnion) ToParam() ResponseInputItemUnionParam {
 5136	return param.Override[ResponseInputItemUnionParam](json.RawMessage(r.RawJSON()))
 5137}
 5138
 5139// A message input to the model with a role indicating instruction following
 5140// hierarchy. Instructions given with the `developer` or `system` role take
 5141// precedence over instructions given with the `user` role.
 5142type ResponseInputItemMessage struct {
 5143	// A list of one or many input items to the model, containing different content
 5144	// types.
 5145	Content ResponseInputMessageContentList `json:"content,required"`
 5146	// The role of the message input. One of `user`, `system`, or `developer`.
 5147	//
 5148	// Any of "user", "system", "developer".
 5149	Role string `json:"role,required"`
 5150	// The status of item. One of `in_progress`, `completed`, or `incomplete`.
 5151	// Populated when items are returned via API.
 5152	//
 5153	// Any of "in_progress", "completed", "incomplete".
 5154	Status string `json:"status"`
 5155	// The type of the message input. Always set to `message`.
 5156	//
 5157	// Any of "message".
 5158	Type string `json:"type"`
 5159	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 5160	JSON struct {
 5161		Content     respjson.Field
 5162		Role        respjson.Field
 5163		Status      respjson.Field
 5164		Type        respjson.Field
 5165		ExtraFields map[string]respjson.Field
 5166		raw         string
 5167	} `json:"-"`
 5168}
 5169
 5170// Returns the unmodified JSON received from the API
 5171func (r ResponseInputItemMessage) RawJSON() string { return r.JSON.raw }
 5172func (r *ResponseInputItemMessage) UnmarshalJSON(data []byte) error {
 5173	return apijson.UnmarshalRoot(data, r)
 5174}
 5175
 5176// The output of a computer tool call.
 5177type ResponseInputItemComputerCallOutput struct {
 5178	// The ID of the computer tool call that produced the output.
 5179	CallID string `json:"call_id,required"`
 5180	// A computer screenshot image used with the computer use tool.
 5181	Output ResponseComputerToolCallOutputScreenshot `json:"output,required"`
 5182	// The type of the computer tool call output. Always `computer_call_output`.
 5183	Type constant.ComputerCallOutput `json:"type,required"`
 5184	// The ID of the computer tool call output.
 5185	ID string `json:"id,nullable"`
 5186	// The safety checks reported by the API that have been acknowledged by the
 5187	// developer.
 5188	AcknowledgedSafetyChecks []ResponseInputItemComputerCallOutputAcknowledgedSafetyCheck `json:"acknowledged_safety_checks,nullable"`
 5189	// The status of the message input. One of `in_progress`, `completed`, or
 5190	// `incomplete`. Populated when input items are returned via API.
 5191	//
 5192	// Any of "in_progress", "completed", "incomplete".
 5193	Status string `json:"status,nullable"`
 5194	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 5195	JSON struct {
 5196		CallID                   respjson.Field
 5197		Output                   respjson.Field
 5198		Type                     respjson.Field
 5199		ID                       respjson.Field
 5200		AcknowledgedSafetyChecks respjson.Field
 5201		Status                   respjson.Field
 5202		ExtraFields              map[string]respjson.Field
 5203		raw                      string
 5204	} `json:"-"`
 5205}
 5206
 5207// Returns the unmodified JSON received from the API
 5208func (r ResponseInputItemComputerCallOutput) RawJSON() string { return r.JSON.raw }
 5209func (r *ResponseInputItemComputerCallOutput) UnmarshalJSON(data []byte) error {
 5210	return apijson.UnmarshalRoot(data, r)
 5211}
 5212
 5213// A pending safety check for the computer call.
 5214type ResponseInputItemComputerCallOutputAcknowledgedSafetyCheck struct {
 5215	// The ID of the pending safety check.
 5216	ID string `json:"id,required"`
 5217	// The type of the pending safety check.
 5218	Code string `json:"code,nullable"`
 5219	// Details about the pending safety check.
 5220	Message string `json:"message,nullable"`
 5221	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 5222	JSON struct {
 5223		ID          respjson.Field
 5224		Code        respjson.Field
 5225		Message     respjson.Field
 5226		ExtraFields map[string]respjson.Field
 5227		raw         string
 5228	} `json:"-"`
 5229}
 5230
 5231// Returns the unmodified JSON received from the API
 5232func (r ResponseInputItemComputerCallOutputAcknowledgedSafetyCheck) RawJSON() string {
 5233	return r.JSON.raw
 5234}
 5235func (r *ResponseInputItemComputerCallOutputAcknowledgedSafetyCheck) UnmarshalJSON(data []byte) error {
 5236	return apijson.UnmarshalRoot(data, r)
 5237}
 5238
 5239// The output of a function tool call.
 5240type ResponseInputItemFunctionCallOutput struct {
 5241	// The unique ID of the function tool call generated by the model.
 5242	CallID string `json:"call_id,required"`
 5243	// A JSON string of the output of the function tool call.
 5244	Output string `json:"output,required"`
 5245	// The type of the function tool call output. Always `function_call_output`.
 5246	Type constant.FunctionCallOutput `json:"type,required"`
 5247	// The unique ID of the function tool call output. Populated when this item is
 5248	// returned via API.
 5249	ID string `json:"id,nullable"`
 5250	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
 5251	// Populated when items are returned via API.
 5252	//
 5253	// Any of "in_progress", "completed", "incomplete".
 5254	Status string `json:"status,nullable"`
 5255	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 5256	JSON struct {
 5257		CallID      respjson.Field
 5258		Output      respjson.Field
 5259		Type        respjson.Field
 5260		ID          respjson.Field
 5261		Status      respjson.Field
 5262		ExtraFields map[string]respjson.Field
 5263		raw         string
 5264	} `json:"-"`
 5265}
 5266
 5267// Returns the unmodified JSON received from the API
 5268func (r ResponseInputItemFunctionCallOutput) RawJSON() string { return r.JSON.raw }
 5269func (r *ResponseInputItemFunctionCallOutput) UnmarshalJSON(data []byte) error {
 5270	return apijson.UnmarshalRoot(data, r)
 5271}
 5272
 5273// An image generation request made by the model.
 5274type ResponseInputItemImageGenerationCall struct {
 5275	// The unique ID of the image generation call.
 5276	ID string `json:"id,required"`
 5277	// The generated image encoded in base64.
 5278	Result string `json:"result,required"`
 5279	// The status of the image generation call.
 5280	//
 5281	// Any of "in_progress", "completed", "generating", "failed".
 5282	Status string `json:"status,required"`
 5283	// The type of the image generation call. Always `image_generation_call`.
 5284	Type constant.ImageGenerationCall `json:"type,required"`
 5285	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 5286	JSON struct {
 5287		ID          respjson.Field
 5288		Result      respjson.Field
 5289		Status      respjson.Field
 5290		Type        respjson.Field
 5291		ExtraFields map[string]respjson.Field
 5292		raw         string
 5293	} `json:"-"`
 5294}
 5295
 5296// Returns the unmodified JSON received from the API
 5297func (r ResponseInputItemImageGenerationCall) RawJSON() string { return r.JSON.raw }
 5298func (r *ResponseInputItemImageGenerationCall) UnmarshalJSON(data []byte) error {
 5299	return apijson.UnmarshalRoot(data, r)
 5300}
 5301
 5302// A tool call to run a command on the local shell.
 5303type ResponseInputItemLocalShellCall struct {
 5304	// The unique ID of the local shell call.
 5305	ID string `json:"id,required"`
 5306	// Execute a shell command on the server.
 5307	Action ResponseInputItemLocalShellCallAction `json:"action,required"`
 5308	// The unique ID of the local shell tool call generated by the model.
 5309	CallID string `json:"call_id,required"`
 5310	// The status of the local shell call.
 5311	//
 5312	// Any of "in_progress", "completed", "incomplete".
 5313	Status string `json:"status,required"`
 5314	// The type of the local shell call. Always `local_shell_call`.
 5315	Type constant.LocalShellCall `json:"type,required"`
 5316	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 5317	JSON struct {
 5318		ID          respjson.Field
 5319		Action      respjson.Field
 5320		CallID      respjson.Field
 5321		Status      respjson.Field
 5322		Type        respjson.Field
 5323		ExtraFields map[string]respjson.Field
 5324		raw         string
 5325	} `json:"-"`
 5326}
 5327
 5328// Returns the unmodified JSON received from the API
 5329func (r ResponseInputItemLocalShellCall) RawJSON() string { return r.JSON.raw }
 5330func (r *ResponseInputItemLocalShellCall) UnmarshalJSON(data []byte) error {
 5331	return apijson.UnmarshalRoot(data, r)
 5332}
 5333
 5334// Execute a shell command on the server.
 5335type ResponseInputItemLocalShellCallAction struct {
 5336	// The command to run.
 5337	Command []string `json:"command,required"`
 5338	// Environment variables to set for the command.
 5339	Env map[string]string `json:"env,required"`
 5340	// The type of the local shell action. Always `exec`.
 5341	Type constant.Exec `json:"type,required"`
 5342	// Optional timeout in milliseconds for the command.
 5343	TimeoutMs int64 `json:"timeout_ms,nullable"`
 5344	// Optional user to run the command as.
 5345	User string `json:"user,nullable"`
 5346	// Optional working directory to run the command in.
 5347	WorkingDirectory string `json:"working_directory,nullable"`
 5348	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 5349	JSON struct {
 5350		Command          respjson.Field
 5351		Env              respjson.Field
 5352		Type             respjson.Field
 5353		TimeoutMs        respjson.Field
 5354		User             respjson.Field
 5355		WorkingDirectory respjson.Field
 5356		ExtraFields      map[string]respjson.Field
 5357		raw              string
 5358	} `json:"-"`
 5359}
 5360
 5361// Returns the unmodified JSON received from the API
 5362func (r ResponseInputItemLocalShellCallAction) RawJSON() string { return r.JSON.raw }
 5363func (r *ResponseInputItemLocalShellCallAction) UnmarshalJSON(data []byte) error {
 5364	return apijson.UnmarshalRoot(data, r)
 5365}
 5366
 5367// The output of a local shell tool call.
 5368type ResponseInputItemLocalShellCallOutput struct {
 5369	// The unique ID of the local shell tool call generated by the model.
 5370	ID string `json:"id,required"`
 5371	// A JSON string of the output of the local shell tool call.
 5372	Output string `json:"output,required"`
 5373	// The type of the local shell tool call output. Always `local_shell_call_output`.
 5374	Type constant.LocalShellCallOutput `json:"type,required"`
 5375	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
 5376	//
 5377	// Any of "in_progress", "completed", "incomplete".
 5378	Status string `json:"status,nullable"`
 5379	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 5380	JSON struct {
 5381		ID          respjson.Field
 5382		Output      respjson.Field
 5383		Type        respjson.Field
 5384		Status      respjson.Field
 5385		ExtraFields map[string]respjson.Field
 5386		raw         string
 5387	} `json:"-"`
 5388}
 5389
 5390// Returns the unmodified JSON received from the API
 5391func (r ResponseInputItemLocalShellCallOutput) RawJSON() string { return r.JSON.raw }
 5392func (r *ResponseInputItemLocalShellCallOutput) UnmarshalJSON(data []byte) error {
 5393	return apijson.UnmarshalRoot(data, r)
 5394}
 5395
 5396// A list of tools available on an MCP server.
 5397type ResponseInputItemMcpListTools struct {
 5398	// The unique ID of the list.
 5399	ID string `json:"id,required"`
 5400	// The label of the MCP server.
 5401	ServerLabel string `json:"server_label,required"`
 5402	// The tools available on the server.
 5403	Tools []ResponseInputItemMcpListToolsTool `json:"tools,required"`
 5404	// The type of the item. Always `mcp_list_tools`.
 5405	Type constant.McpListTools `json:"type,required"`
 5406	// Error message if the server could not list tools.
 5407	Error string `json:"error,nullable"`
 5408	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 5409	JSON struct {
 5410		ID          respjson.Field
 5411		ServerLabel respjson.Field
 5412		Tools       respjson.Field
 5413		Type        respjson.Field
 5414		Error       respjson.Field
 5415		ExtraFields map[string]respjson.Field
 5416		raw         string
 5417	} `json:"-"`
 5418}
 5419
 5420// Returns the unmodified JSON received from the API
 5421func (r ResponseInputItemMcpListTools) RawJSON() string { return r.JSON.raw }
 5422func (r *ResponseInputItemMcpListTools) UnmarshalJSON(data []byte) error {
 5423	return apijson.UnmarshalRoot(data, r)
 5424}
 5425
 5426// A tool available on an MCP server.
 5427type ResponseInputItemMcpListToolsTool struct {
 5428	// The JSON schema describing the tool's input.
 5429	InputSchema any `json:"input_schema,required"`
 5430	// The name of the tool.
 5431	Name string `json:"name,required"`
 5432	// Additional annotations about the tool.
 5433	Annotations any `json:"annotations,nullable"`
 5434	// The description of the tool.
 5435	Description string `json:"description,nullable"`
 5436	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 5437	JSON struct {
 5438		InputSchema respjson.Field
 5439		Name        respjson.Field
 5440		Annotations respjson.Field
 5441		Description respjson.Field
 5442		ExtraFields map[string]respjson.Field
 5443		raw         string
 5444	} `json:"-"`
 5445}
 5446
 5447// Returns the unmodified JSON received from the API
 5448func (r ResponseInputItemMcpListToolsTool) RawJSON() string { return r.JSON.raw }
 5449func (r *ResponseInputItemMcpListToolsTool) UnmarshalJSON(data []byte) error {
 5450	return apijson.UnmarshalRoot(data, r)
 5451}
 5452
 5453// A request for human approval of a tool invocation.
 5454type ResponseInputItemMcpApprovalRequest struct {
 5455	// The unique ID of the approval request.
 5456	ID string `json:"id,required"`
 5457	// A JSON string of arguments for the tool.
 5458	Arguments string `json:"arguments,required"`
 5459	// The name of the tool to run.
 5460	Name string `json:"name,required"`
 5461	// The label of the MCP server making the request.
 5462	ServerLabel string `json:"server_label,required"`
 5463	// The type of the item. Always `mcp_approval_request`.
 5464	Type constant.McpApprovalRequest `json:"type,required"`
 5465	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 5466	JSON struct {
 5467		ID          respjson.Field
 5468		Arguments   respjson.Field
 5469		Name        respjson.Field
 5470		ServerLabel respjson.Field
 5471		Type        respjson.Field
 5472		ExtraFields map[string]respjson.Field
 5473		raw         string
 5474	} `json:"-"`
 5475}
 5476
 5477// Returns the unmodified JSON received from the API
 5478func (r ResponseInputItemMcpApprovalRequest) RawJSON() string { return r.JSON.raw }
 5479func (r *ResponseInputItemMcpApprovalRequest) UnmarshalJSON(data []byte) error {
 5480	return apijson.UnmarshalRoot(data, r)
 5481}
 5482
 5483// A response to an MCP approval request.
 5484type ResponseInputItemMcpApprovalResponse struct {
 5485	// The ID of the approval request being answered.
 5486	ApprovalRequestID string `json:"approval_request_id,required"`
 5487	// Whether the request was approved.
 5488	Approve bool `json:"approve,required"`
 5489	// The type of the item. Always `mcp_approval_response`.
 5490	Type constant.McpApprovalResponse `json:"type,required"`
 5491	// The unique ID of the approval response
 5492	ID string `json:"id,nullable"`
 5493	// Optional reason for the decision.
 5494	Reason string `json:"reason,nullable"`
 5495	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 5496	JSON struct {
 5497		ApprovalRequestID respjson.Field
 5498		Approve           respjson.Field
 5499		Type              respjson.Field
 5500		ID                respjson.Field
 5501		Reason            respjson.Field
 5502		ExtraFields       map[string]respjson.Field
 5503		raw               string
 5504	} `json:"-"`
 5505}
 5506
 5507// Returns the unmodified JSON received from the API
 5508func (r ResponseInputItemMcpApprovalResponse) RawJSON() string { return r.JSON.raw }
 5509func (r *ResponseInputItemMcpApprovalResponse) UnmarshalJSON(data []byte) error {
 5510	return apijson.UnmarshalRoot(data, r)
 5511}
 5512
 5513// An invocation of a tool on an MCP server.
 5514type ResponseInputItemMcpCall struct {
 5515	// The unique ID of the tool call.
 5516	ID string `json:"id,required"`
 5517	// A JSON string of the arguments passed to the tool.
 5518	Arguments string `json:"arguments,required"`
 5519	// The name of the tool that was run.
 5520	Name string `json:"name,required"`
 5521	// The label of the MCP server running the tool.
 5522	ServerLabel string `json:"server_label,required"`
 5523	// The type of the item. Always `mcp_call`.
 5524	Type constant.McpCall `json:"type,required"`
 5525	// The error from the tool call, if any.
 5526	Error string `json:"error,nullable"`
 5527	// The output from the tool call.
 5528	Output string `json:"output,nullable"`
 5529	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 5530	JSON struct {
 5531		ID          respjson.Field
 5532		Arguments   respjson.Field
 5533		Name        respjson.Field
 5534		ServerLabel respjson.Field
 5535		Type        respjson.Field
 5536		Error       respjson.Field
 5537		Output      respjson.Field
 5538		ExtraFields map[string]respjson.Field
 5539		raw         string
 5540	} `json:"-"`
 5541}
 5542
 5543// Returns the unmodified JSON received from the API
 5544func (r ResponseInputItemMcpCall) RawJSON() string { return r.JSON.raw }
 5545func (r *ResponseInputItemMcpCall) UnmarshalJSON(data []byte) error {
 5546	return apijson.UnmarshalRoot(data, r)
 5547}
 5548
 5549// An internal identifier for an item to reference.
 5550type ResponseInputItemItemReference struct {
 5551	// The ID of the item to reference.
 5552	ID string `json:"id,required"`
 5553	// The type of item to reference. Always `item_reference`.
 5554	//
 5555	// Any of "item_reference".
 5556	Type string `json:"type,nullable"`
 5557	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 5558	JSON struct {
 5559		ID          respjson.Field
 5560		Type        respjson.Field
 5561		ExtraFields map[string]respjson.Field
 5562		raw         string
 5563	} `json:"-"`
 5564}
 5565
 5566// Returns the unmodified JSON received from the API
 5567func (r ResponseInputItemItemReference) RawJSON() string { return r.JSON.raw }
 5568func (r *ResponseInputItemItemReference) UnmarshalJSON(data []byte) error {
 5569	return apijson.UnmarshalRoot(data, r)
 5570}
 5571
 5572func ResponseInputItemParamOfMessage[T string | ResponseInputMessageContentListParam](content T, role EasyInputMessageRole) ResponseInputItemUnionParam {
 5573	var message EasyInputMessageParam
 5574	switch v := any(content).(type) {
 5575	case string:
 5576		message.Content.OfString = param.NewOpt(v)
 5577	case ResponseInputMessageContentListParam:
 5578		message.Content.OfInputItemContentList = v
 5579	}
 5580	message.Role = role
 5581	return ResponseInputItemUnionParam{OfMessage: &message}
 5582}
 5583
 5584func ResponseInputItemParamOfInputMessage(content ResponseInputMessageContentListParam, role string) ResponseInputItemUnionParam {
 5585	var message ResponseInputItemMessageParam
 5586	message.Content = content
 5587	message.Role = role
 5588	return ResponseInputItemUnionParam{OfInputMessage: &message}
 5589}
 5590
 5591func ResponseInputItemParamOfOutputMessage(content []ResponseOutputMessageContentUnionParam, id string, status ResponseOutputMessageStatus) ResponseInputItemUnionParam {
 5592	var message ResponseOutputMessageParam
 5593	message.Content = content
 5594	message.ID = id
 5595	message.Status = status
 5596	return ResponseInputItemUnionParam{OfOutputMessage: &message}
 5597}
 5598
 5599func ResponseInputItemParamOfFileSearchCall(id string, queries []string, status ResponseFileSearchToolCallStatus) ResponseInputItemUnionParam {
 5600	var fileSearchCall ResponseFileSearchToolCallParam
 5601	fileSearchCall.ID = id
 5602	fileSearchCall.Queries = queries
 5603	fileSearchCall.Status = status
 5604	return ResponseInputItemUnionParam{OfFileSearchCall: &fileSearchCall}
 5605}
 5606
 5607func ResponseInputItemParamOfComputerCallOutput(callID string, output ResponseComputerToolCallOutputScreenshotParam) ResponseInputItemUnionParam {
 5608	var computerCallOutput ResponseInputItemComputerCallOutputParam
 5609	computerCallOutput.CallID = callID
 5610	computerCallOutput.Output = output
 5611	return ResponseInputItemUnionParam{OfComputerCallOutput: &computerCallOutput}
 5612}
 5613
 5614func ResponseInputItemParamOfWebSearchCall[
 5615	T ResponseFunctionWebSearchActionSearchParam | ResponseFunctionWebSearchActionOpenPageParam | ResponseFunctionWebSearchActionFindParam,
 5616](action T, id string, status ResponseFunctionWebSearchStatus) ResponseInputItemUnionParam {
 5617	var webSearchCall ResponseFunctionWebSearchParam
 5618	switch v := any(action).(type) {
 5619	case ResponseFunctionWebSearchActionSearchParam:
 5620		webSearchCall.Action.OfSearch = &v
 5621	case ResponseFunctionWebSearchActionOpenPageParam:
 5622		webSearchCall.Action.OfOpenPage = &v
 5623	case ResponseFunctionWebSearchActionFindParam:
 5624		webSearchCall.Action.OfFind = &v
 5625	}
 5626	webSearchCall.ID = id
 5627	webSearchCall.Status = status
 5628	return ResponseInputItemUnionParam{OfWebSearchCall: &webSearchCall}
 5629}
 5630
 5631func ResponseInputItemParamOfFunctionCall(arguments string, callID string, name string) ResponseInputItemUnionParam {
 5632	var functionCall ResponseFunctionToolCallParam
 5633	functionCall.Arguments = arguments
 5634	functionCall.CallID = callID
 5635	functionCall.Name = name
 5636	return ResponseInputItemUnionParam{OfFunctionCall: &functionCall}
 5637}
 5638
 5639func ResponseInputItemParamOfFunctionCallOutput(callID string, output string) ResponseInputItemUnionParam {
 5640	var functionCallOutput ResponseInputItemFunctionCallOutputParam
 5641	functionCallOutput.CallID = callID
 5642	functionCallOutput.Output = output
 5643	return ResponseInputItemUnionParam{OfFunctionCallOutput: &functionCallOutput}
 5644}
 5645
 5646func ResponseInputItemParamOfReasoning(id string, summary []ResponseReasoningItemSummaryParam) ResponseInputItemUnionParam {
 5647	var reasoning ResponseReasoningItemParam
 5648	reasoning.ID = id
 5649	reasoning.Summary = summary
 5650	return ResponseInputItemUnionParam{OfReasoning: &reasoning}
 5651}
 5652
 5653func ResponseInputItemParamOfImageGenerationCall(id string, result string, status string) ResponseInputItemUnionParam {
 5654	var imageGenerationCall ResponseInputItemImageGenerationCallParam
 5655	imageGenerationCall.ID = id
 5656	imageGenerationCall.Result = param.NewOpt(result)
 5657	imageGenerationCall.Status = status
 5658	return ResponseInputItemUnionParam{OfImageGenerationCall: &imageGenerationCall}
 5659}
 5660
 5661func ResponseInputItemParamOfLocalShellCallOutput(id string, output string) ResponseInputItemUnionParam {
 5662	var localShellCallOutput ResponseInputItemLocalShellCallOutputParam
 5663	localShellCallOutput.ID = id
 5664	localShellCallOutput.Output = output
 5665	return ResponseInputItemUnionParam{OfLocalShellCallOutput: &localShellCallOutput}
 5666}
 5667
 5668func ResponseInputItemParamOfMcpListTools(id string, serverLabel string, tools []ResponseInputItemMcpListToolsToolParam) ResponseInputItemUnionParam {
 5669	var mcpListTools ResponseInputItemMcpListToolsParam
 5670	mcpListTools.ID = id
 5671	mcpListTools.ServerLabel = serverLabel
 5672	mcpListTools.Tools = tools
 5673	return ResponseInputItemUnionParam{OfMcpListTools: &mcpListTools}
 5674}
 5675
 5676func ResponseInputItemParamOfMcpApprovalResponse(approvalRequestID string, approve bool) ResponseInputItemUnionParam {
 5677	var mcpApprovalResponse ResponseInputItemMcpApprovalResponseParam
 5678	mcpApprovalResponse.ApprovalRequestID = approvalRequestID
 5679	mcpApprovalResponse.Approve = approve
 5680	return ResponseInputItemUnionParam{OfMcpApprovalResponse: &mcpApprovalResponse}
 5681}
 5682
 5683func ResponseInputItemParamOfItemReference(id string) ResponseInputItemUnionParam {
 5684	var itemReference ResponseInputItemItemReferenceParam
 5685	itemReference.ID = id
 5686	return ResponseInputItemUnionParam{OfItemReference: &itemReference}
 5687}
 5688
 5689// Only one field can be non-zero.
 5690//
 5691// Use [param.IsOmitted] to confirm if a field is set.
 5692type ResponseInputItemUnionParam struct {
 5693	OfMessage              *EasyInputMessageParam                      `json:",omitzero,inline"`
 5694	OfInputMessage         *ResponseInputItemMessageParam              `json:",omitzero,inline"`
 5695	OfOutputMessage        *ResponseOutputMessageParam                 `json:",omitzero,inline"`
 5696	OfFileSearchCall       *ResponseFileSearchToolCallParam            `json:",omitzero,inline"`
 5697	OfComputerCall         *ResponseComputerToolCallParam              `json:",omitzero,inline"`
 5698	OfComputerCallOutput   *ResponseInputItemComputerCallOutputParam   `json:",omitzero,inline"`
 5699	OfWebSearchCall        *ResponseFunctionWebSearchParam             `json:",omitzero,inline"`
 5700	OfFunctionCall         *ResponseFunctionToolCallParam              `json:",omitzero,inline"`
 5701	OfFunctionCallOutput   *ResponseInputItemFunctionCallOutputParam   `json:",omitzero,inline"`
 5702	OfReasoning            *ResponseReasoningItemParam                 `json:",omitzero,inline"`
 5703	OfImageGenerationCall  *ResponseInputItemImageGenerationCallParam  `json:",omitzero,inline"`
 5704	OfCodeInterpreterCall  *ResponseCodeInterpreterToolCallParam       `json:",omitzero,inline"`
 5705	OfLocalShellCall       *ResponseInputItemLocalShellCallParam       `json:",omitzero,inline"`
 5706	OfLocalShellCallOutput *ResponseInputItemLocalShellCallOutputParam `json:",omitzero,inline"`
 5707	OfMcpListTools         *ResponseInputItemMcpListToolsParam         `json:",omitzero,inline"`
 5708	OfMcpApprovalRequest   *ResponseInputItemMcpApprovalRequestParam   `json:",omitzero,inline"`
 5709	OfMcpApprovalResponse  *ResponseInputItemMcpApprovalResponseParam  `json:",omitzero,inline"`
 5710	OfMcpCall              *ResponseInputItemMcpCallParam              `json:",omitzero,inline"`
 5711	OfItemReference        *ResponseInputItemItemReferenceParam        `json:",omitzero,inline"`
 5712	paramUnion
 5713}
 5714
 5715func (u ResponseInputItemUnionParam) MarshalJSON() ([]byte, error) {
 5716	return param.MarshalUnion(u, u.OfMessage,
 5717		u.OfInputMessage,
 5718		u.OfOutputMessage,
 5719		u.OfFileSearchCall,
 5720		u.OfComputerCall,
 5721		u.OfComputerCallOutput,
 5722		u.OfWebSearchCall,
 5723		u.OfFunctionCall,
 5724		u.OfFunctionCallOutput,
 5725		u.OfReasoning,
 5726		u.OfImageGenerationCall,
 5727		u.OfCodeInterpreterCall,
 5728		u.OfLocalShellCall,
 5729		u.OfLocalShellCallOutput,
 5730		u.OfMcpListTools,
 5731		u.OfMcpApprovalRequest,
 5732		u.OfMcpApprovalResponse,
 5733		u.OfMcpCall,
 5734		u.OfItemReference)
 5735}
 5736func (u *ResponseInputItemUnionParam) UnmarshalJSON(data []byte) error {
 5737	return apijson.UnmarshalRoot(data, u)
 5738}
 5739
 5740func (u *ResponseInputItemUnionParam) asAny() any {
 5741	if !param.IsOmitted(u.OfMessage) {
 5742		return u.OfMessage
 5743	} else if !param.IsOmitted(u.OfInputMessage) {
 5744		return u.OfInputMessage
 5745	} else if !param.IsOmitted(u.OfOutputMessage) {
 5746		return u.OfOutputMessage
 5747	} else if !param.IsOmitted(u.OfFileSearchCall) {
 5748		return u.OfFileSearchCall
 5749	} else if !param.IsOmitted(u.OfComputerCall) {
 5750		return u.OfComputerCall
 5751	} else if !param.IsOmitted(u.OfComputerCallOutput) {
 5752		return u.OfComputerCallOutput
 5753	} else if !param.IsOmitted(u.OfWebSearchCall) {
 5754		return u.OfWebSearchCall
 5755	} else if !param.IsOmitted(u.OfFunctionCall) {
 5756		return u.OfFunctionCall
 5757	} else if !param.IsOmitted(u.OfFunctionCallOutput) {
 5758		return u.OfFunctionCallOutput
 5759	} else if !param.IsOmitted(u.OfReasoning) {
 5760		return u.OfReasoning
 5761	} else if !param.IsOmitted(u.OfImageGenerationCall) {
 5762		return u.OfImageGenerationCall
 5763	} else if !param.IsOmitted(u.OfCodeInterpreterCall) {
 5764		return u.OfCodeInterpreterCall
 5765	} else if !param.IsOmitted(u.OfLocalShellCall) {
 5766		return u.OfLocalShellCall
 5767	} else if !param.IsOmitted(u.OfLocalShellCallOutput) {
 5768		return u.OfLocalShellCallOutput
 5769	} else if !param.IsOmitted(u.OfMcpListTools) {
 5770		return u.OfMcpListTools
 5771	} else if !param.IsOmitted(u.OfMcpApprovalRequest) {
 5772		return u.OfMcpApprovalRequest
 5773	} else if !param.IsOmitted(u.OfMcpApprovalResponse) {
 5774		return u.OfMcpApprovalResponse
 5775	} else if !param.IsOmitted(u.OfMcpCall) {
 5776		return u.OfMcpCall
 5777	} else if !param.IsOmitted(u.OfItemReference) {
 5778		return u.OfItemReference
 5779	}
 5780	return nil
 5781}
 5782
 5783// Returns a pointer to the underlying variant's property, if present.
 5784func (u ResponseInputItemUnionParam) GetQueries() []string {
 5785	if vt := u.OfFileSearchCall; vt != nil {
 5786		return vt.Queries
 5787	}
 5788	return nil
 5789}
 5790
 5791// Returns a pointer to the underlying variant's property, if present.
 5792func (u ResponseInputItemUnionParam) GetResults() []ResponseFileSearchToolCallResultParam {
 5793	if vt := u.OfFileSearchCall; vt != nil {
 5794		return vt.Results
 5795	}
 5796	return nil
 5797}
 5798
 5799// Returns a pointer to the underlying variant's property, if present.
 5800func (u ResponseInputItemUnionParam) GetPendingSafetyChecks() []ResponseComputerToolCallPendingSafetyCheckParam {
 5801	if vt := u.OfComputerCall; vt != nil {
 5802		return vt.PendingSafetyChecks
 5803	}
 5804	return nil
 5805}
 5806
 5807// Returns a pointer to the underlying variant's property, if present.
 5808func (u ResponseInputItemUnionParam) GetAcknowledgedSafetyChecks() []ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam {
 5809	if vt := u.OfComputerCallOutput; vt != nil {
 5810		return vt.AcknowledgedSafetyChecks
 5811	}
 5812	return nil
 5813}
 5814
 5815// Returns a pointer to the underlying variant's property, if present.
 5816func (u ResponseInputItemUnionParam) GetSummary() []ResponseReasoningItemSummaryParam {
 5817	if vt := u.OfReasoning; vt != nil {
 5818		return vt.Summary
 5819	}
 5820	return nil
 5821}
 5822
 5823// Returns a pointer to the underlying variant's property, if present.
 5824func (u ResponseInputItemUnionParam) GetEncryptedContent() *string {
 5825	if vt := u.OfReasoning; vt != nil && vt.EncryptedContent.Valid() {
 5826		return &vt.EncryptedContent.Value
 5827	}
 5828	return nil
 5829}
 5830
 5831// Returns a pointer to the underlying variant's property, if present.
 5832func (u ResponseInputItemUnionParam) GetResult() *string {
 5833	if vt := u.OfImageGenerationCall; vt != nil && vt.Result.Valid() {
 5834		return &vt.Result.Value
 5835	}
 5836	return nil
 5837}
 5838
 5839// Returns a pointer to the underlying variant's property, if present.
 5840func (u ResponseInputItemUnionParam) GetCode() *string {
 5841	if vt := u.OfCodeInterpreterCall; vt != nil && vt.Code.Valid() {
 5842		return &vt.Code.Value
 5843	}
 5844	return nil
 5845}
 5846
 5847// Returns a pointer to the underlying variant's property, if present.
 5848func (u ResponseInputItemUnionParam) GetContainerID() *string {
 5849	if vt := u.OfCodeInterpreterCall; vt != nil {
 5850		return &vt.ContainerID
 5851	}
 5852	return nil
 5853}
 5854
 5855// Returns a pointer to the underlying variant's property, if present.
 5856func (u ResponseInputItemUnionParam) GetOutputs() []ResponseCodeInterpreterToolCallOutputUnionParam {
 5857	if vt := u.OfCodeInterpreterCall; vt != nil {
 5858		return vt.Outputs
 5859	}
 5860	return nil
 5861}
 5862
 5863// Returns a pointer to the underlying variant's property, if present.
 5864func (u ResponseInputItemUnionParam) GetTools() []ResponseInputItemMcpListToolsToolParam {
 5865	if vt := u.OfMcpListTools; vt != nil {
 5866		return vt.Tools
 5867	}
 5868	return nil
 5869}
 5870
 5871// Returns a pointer to the underlying variant's property, if present.
 5872func (u ResponseInputItemUnionParam) GetApprovalRequestID() *string {
 5873	if vt := u.OfMcpApprovalResponse; vt != nil {
 5874		return &vt.ApprovalRequestID
 5875	}
 5876	return nil
 5877}
 5878
 5879// Returns a pointer to the underlying variant's property, if present.
 5880func (u ResponseInputItemUnionParam) GetApprove() *bool {
 5881	if vt := u.OfMcpApprovalResponse; vt != nil {
 5882		return &vt.Approve
 5883	}
 5884	return nil
 5885}
 5886
 5887// Returns a pointer to the underlying variant's property, if present.
 5888func (u ResponseInputItemUnionParam) GetReason() *string {
 5889	if vt := u.OfMcpApprovalResponse; vt != nil && vt.Reason.Valid() {
 5890		return &vt.Reason.Value
 5891	}
 5892	return nil
 5893}
 5894
 5895// Returns a pointer to the underlying variant's property, if present.
 5896func (u ResponseInputItemUnionParam) GetRole() *string {
 5897	if vt := u.OfMessage; vt != nil {
 5898		return (*string)(&vt.Role)
 5899	} else if vt := u.OfInputMessage; vt != nil {
 5900		return (*string)(&vt.Role)
 5901	} else if vt := u.OfOutputMessage; vt != nil {
 5902		return (*string)(&vt.Role)
 5903	}
 5904	return nil
 5905}
 5906
 5907// Returns a pointer to the underlying variant's property, if present.
 5908func (u ResponseInputItemUnionParam) GetType() *string {
 5909	if vt := u.OfMessage; vt != nil {
 5910		return (*string)(&vt.Type)
 5911	} else if vt := u.OfInputMessage; vt != nil {
 5912		return (*string)(&vt.Type)
 5913	} else if vt := u.OfOutputMessage; vt != nil {
 5914		return (*string)(&vt.Type)
 5915	} else if vt := u.OfFileSearchCall; vt != nil {
 5916		return (*string)(&vt.Type)
 5917	} else if vt := u.OfComputerCall; vt != nil {
 5918		return (*string)(&vt.Type)
 5919	} else if vt := u.OfComputerCallOutput; vt != nil {
 5920		return (*string)(&vt.Type)
 5921	} else if vt := u.OfWebSearchCall; vt != nil {
 5922		return (*string)(&vt.Type)
 5923	} else if vt := u.OfFunctionCall; vt != nil {
 5924		return (*string)(&vt.Type)
 5925	} else if vt := u.OfFunctionCallOutput; vt != nil {
 5926		return (*string)(&vt.Type)
 5927	} else if vt := u.OfReasoning; vt != nil {
 5928		return (*string)(&vt.Type)
 5929	} else if vt := u.OfImageGenerationCall; vt != nil {
 5930		return (*string)(&vt.Type)
 5931	} else if vt := u.OfCodeInterpreterCall; vt != nil {
 5932		return (*string)(&vt.Type)
 5933	} else if vt := u.OfLocalShellCall; vt != nil {
 5934		return (*string)(&vt.Type)
 5935	} else if vt := u.OfLocalShellCallOutput; vt != nil {
 5936		return (*string)(&vt.Type)
 5937	} else if vt := u.OfMcpListTools; vt != nil {
 5938		return (*string)(&vt.Type)
 5939	} else if vt := u.OfMcpApprovalRequest; vt != nil {
 5940		return (*string)(&vt.Type)
 5941	} else if vt := u.OfMcpApprovalResponse; vt != nil {
 5942		return (*string)(&vt.Type)
 5943	} else if vt := u.OfMcpCall; vt != nil {
 5944		return (*string)(&vt.Type)
 5945	} else if vt := u.OfItemReference; vt != nil {
 5946		return (*string)(&vt.Type)
 5947	}
 5948	return nil
 5949}
 5950
 5951// Returns a pointer to the underlying variant's property, if present.
 5952func (u ResponseInputItemUnionParam) GetStatus() *string {
 5953	if vt := u.OfInputMessage; vt != nil {
 5954		return (*string)(&vt.Status)
 5955	} else if vt := u.OfOutputMessage; vt != nil {
 5956		return (*string)(&vt.Status)
 5957	} else if vt := u.OfFileSearchCall; vt != nil {
 5958		return (*string)(&vt.Status)
 5959	} else if vt := u.OfComputerCall; vt != nil {
 5960		return (*string)(&vt.Status)
 5961	} else if vt := u.OfComputerCallOutput; vt != nil {
 5962		return (*string)(&vt.Status)
 5963	} else if vt := u.OfWebSearchCall; vt != nil {
 5964		return (*string)(&vt.Status)
 5965	} else if vt := u.OfFunctionCall; vt != nil {
 5966		return (*string)(&vt.Status)
 5967	} else if vt := u.OfFunctionCallOutput; vt != nil {
 5968		return (*string)(&vt.Status)
 5969	} else if vt := u.OfReasoning; vt != nil {
 5970		return (*string)(&vt.Status)
 5971	} else if vt := u.OfImageGenerationCall; vt != nil {
 5972		return (*string)(&vt.Status)
 5973	} else if vt := u.OfCodeInterpreterCall; vt != nil {
 5974		return (*string)(&vt.Status)
 5975	} else if vt := u.OfLocalShellCall; vt != nil {
 5976		return (*string)(&vt.Status)
 5977	} else if vt := u.OfLocalShellCallOutput; vt != nil {
 5978		return (*string)(&vt.Status)
 5979	}
 5980	return nil
 5981}
 5982
 5983// Returns a pointer to the underlying variant's property, if present.
 5984func (u ResponseInputItemUnionParam) GetID() *string {
 5985	if vt := u.OfOutputMessage; vt != nil {
 5986		return (*string)(&vt.ID)
 5987	} else if vt := u.OfFileSearchCall; vt != nil {
 5988		return (*string)(&vt.ID)
 5989	} else if vt := u.OfComputerCall; vt != nil {
 5990		return (*string)(&vt.ID)
 5991	} else if vt := u.OfComputerCallOutput; vt != nil && vt.ID.Valid() {
 5992		return &vt.ID.Value
 5993	} else if vt := u.OfWebSearchCall; vt != nil {
 5994		return (*string)(&vt.ID)
 5995	} else if vt := u.OfFunctionCall; vt != nil && vt.ID.Valid() {
 5996		return &vt.ID.Value
 5997	} else if vt := u.OfFunctionCallOutput; vt != nil && vt.ID.Valid() {
 5998		return &vt.ID.Value
 5999	} else if vt := u.OfReasoning; vt != nil {
 6000		return (*string)(&vt.ID)
 6001	} else if vt := u.OfImageGenerationCall; vt != nil {
 6002		return (*string)(&vt.ID)
 6003	} else if vt := u.OfCodeInterpreterCall; vt != nil {
 6004		return (*string)(&vt.ID)
 6005	} else if vt := u.OfLocalShellCall; vt != nil {
 6006		return (*string)(&vt.ID)
 6007	} else if vt := u.OfLocalShellCallOutput; vt != nil {
 6008		return (*string)(&vt.ID)
 6009	} else if vt := u.OfMcpListTools; vt != nil {
 6010		return (*string)(&vt.ID)
 6011	} else if vt := u.OfMcpApprovalRequest; vt != nil {
 6012		return (*string)(&vt.ID)
 6013	} else if vt := u.OfMcpApprovalResponse; vt != nil && vt.ID.Valid() {
 6014		return &vt.ID.Value
 6015	} else if vt := u.OfMcpCall; vt != nil {
 6016		return (*string)(&vt.ID)
 6017	} else if vt := u.OfItemReference; vt != nil {
 6018		return (*string)(&vt.ID)
 6019	}
 6020	return nil
 6021}
 6022
 6023// Returns a pointer to the underlying variant's property, if present.
 6024func (u ResponseInputItemUnionParam) GetCallID() *string {
 6025	if vt := u.OfComputerCall; vt != nil {
 6026		return (*string)(&vt.CallID)
 6027	} else if vt := u.OfComputerCallOutput; vt != nil {
 6028		return (*string)(&vt.CallID)
 6029	} else if vt := u.OfFunctionCall; vt != nil {
 6030		return (*string)(&vt.CallID)
 6031	} else if vt := u.OfFunctionCallOutput; vt != nil {
 6032		return (*string)(&vt.CallID)
 6033	} else if vt := u.OfLocalShellCall; vt != nil {
 6034		return (*string)(&vt.CallID)
 6035	}
 6036	return nil
 6037}
 6038
 6039// Returns a pointer to the underlying variant's property, if present.
 6040func (u ResponseInputItemUnionParam) GetArguments() *string {
 6041	if vt := u.OfFunctionCall; vt != nil {
 6042		return (*string)(&vt.Arguments)
 6043	} else if vt := u.OfMcpApprovalRequest; vt != nil {
 6044		return (*string)(&vt.Arguments)
 6045	} else if vt := u.OfMcpCall; vt != nil {
 6046		return (*string)(&vt.Arguments)
 6047	}
 6048	return nil
 6049}
 6050
 6051// Returns a pointer to the underlying variant's property, if present.
 6052func (u ResponseInputItemUnionParam) GetName() *string {
 6053	if vt := u.OfFunctionCall; vt != nil {
 6054		return (*string)(&vt.Name)
 6055	} else if vt := u.OfMcpApprovalRequest; vt != nil {
 6056		return (*string)(&vt.Name)
 6057	} else if vt := u.OfMcpCall; vt != nil {
 6058		return (*string)(&vt.Name)
 6059	}
 6060	return nil
 6061}
 6062
 6063// Returns a pointer to the underlying variant's property, if present.
 6064func (u ResponseInputItemUnionParam) GetServerLabel() *string {
 6065	if vt := u.OfMcpListTools; vt != nil {
 6066		return (*string)(&vt.ServerLabel)
 6067	} else if vt := u.OfMcpApprovalRequest; vt != nil {
 6068		return (*string)(&vt.ServerLabel)
 6069	} else if vt := u.OfMcpCall; vt != nil {
 6070		return (*string)(&vt.ServerLabel)
 6071	}
 6072	return nil
 6073}
 6074
 6075// Returns a pointer to the underlying variant's property, if present.
 6076func (u ResponseInputItemUnionParam) GetError() *string {
 6077	if vt := u.OfMcpListTools; vt != nil && vt.Error.Valid() {
 6078		return &vt.Error.Value
 6079	} else if vt := u.OfMcpCall; vt != nil && vt.Error.Valid() {
 6080		return &vt.Error.Value
 6081	}
 6082	return nil
 6083}
 6084
 6085// Returns a subunion which exports methods to access subproperties
 6086//
 6087// Or use AsAny() to get the underlying value
 6088func (u ResponseInputItemUnionParam) GetContent() (res responseInputItemUnionParamContent) {
 6089	if vt := u.OfMessage; vt != nil {
 6090		res.any = vt.Content.asAny()
 6091	} else if vt := u.OfInputMessage; vt != nil {
 6092		res.any = &vt.Content
 6093	} else if vt := u.OfOutputMessage; vt != nil {
 6094		res.any = &vt.Content
 6095	}
 6096	return
 6097}
 6098
 6099// Can have the runtime types [*string], [*ResponseInputMessageContentListParam],
 6100// [\*[]ResponseOutputMessageContentUnionParam]
 6101type responseInputItemUnionParamContent struct{ any }
 6102
 6103// Use the following switch statement to get the type of the union:
 6104//
 6105//	switch u.AsAny().(type) {
 6106//	case *string:
 6107//	case *responses.ResponseInputMessageContentListParam:
 6108//	case *[]responses.ResponseOutputMessageContentUnionParam:
 6109//	default:
 6110//	    fmt.Errorf("not present")
 6111//	}
 6112func (u responseInputItemUnionParamContent) AsAny() any { return u.any }
 6113
 6114// Returns a subunion which exports methods to access subproperties
 6115//
 6116// Or use AsAny() to get the underlying value
 6117func (u ResponseInputItemUnionParam) GetAction() (res responseInputItemUnionParamAction) {
 6118	if vt := u.OfComputerCall; vt != nil {
 6119		res.any = vt.Action.asAny()
 6120	} else if vt := u.OfWebSearchCall; vt != nil {
 6121		res.any = vt.Action.asAny()
 6122	} else if vt := u.OfLocalShellCall; vt != nil {
 6123		res.any = &vt.Action
 6124	}
 6125	return
 6126}
 6127
 6128// Can have the runtime types [*ResponseComputerToolCallActionClickParam],
 6129// [*ResponseComputerToolCallActionDoubleClickParam],
 6130// [*ResponseComputerToolCallActionDragParam],
 6131// [*ResponseComputerToolCallActionKeypressParam],
 6132// [*ResponseComputerToolCallActionMoveParam],
 6133// [*ResponseComputerToolCallActionScreenshotParam],
 6134// [*ResponseComputerToolCallActionScrollParam],
 6135// [*ResponseComputerToolCallActionTypeParam],
 6136// [*ResponseComputerToolCallActionWaitParam],
 6137// [*ResponseFunctionWebSearchActionSearchParam],
 6138// [*ResponseFunctionWebSearchActionOpenPageParam],
 6139// [*ResponseFunctionWebSearchActionFindParam],
 6140// [*ResponseInputItemLocalShellCallActionParam]
 6141type responseInputItemUnionParamAction struct{ any }
 6142
 6143// Use the following switch statement to get the type of the union:
 6144//
 6145//	switch u.AsAny().(type) {
 6146//	case *responses.ResponseComputerToolCallActionClickParam:
 6147//	case *responses.ResponseComputerToolCallActionDoubleClickParam:
 6148//	case *responses.ResponseComputerToolCallActionDragParam:
 6149//	case *responses.ResponseComputerToolCallActionKeypressParam:
 6150//	case *responses.ResponseComputerToolCallActionMoveParam:
 6151//	case *responses.ResponseComputerToolCallActionScreenshotParam:
 6152//	case *responses.ResponseComputerToolCallActionScrollParam:
 6153//	case *responses.ResponseComputerToolCallActionTypeParam:
 6154//	case *responses.ResponseComputerToolCallActionWaitParam:
 6155//	case *responses.ResponseFunctionWebSearchActionSearchParam:
 6156//	case *responses.ResponseFunctionWebSearchActionOpenPageParam:
 6157//	case *responses.ResponseFunctionWebSearchActionFindParam:
 6158//	case *responses.ResponseInputItemLocalShellCallActionParam:
 6159//	default:
 6160//	    fmt.Errorf("not present")
 6161//	}
 6162func (u responseInputItemUnionParamAction) AsAny() any { return u.any }
 6163
 6164// Returns a pointer to the underlying variant's property, if present.
 6165func (u responseInputItemUnionParamAction) GetButton() *string {
 6166	switch vt := u.any.(type) {
 6167	case *ResponseComputerToolCallActionUnionParam:
 6168		return vt.GetButton()
 6169	}
 6170	return nil
 6171}
 6172
 6173// Returns a pointer to the underlying variant's property, if present.
 6174func (u responseInputItemUnionParamAction) GetPath() []ResponseComputerToolCallActionDragPathParam {
 6175	switch vt := u.any.(type) {
 6176	case *ResponseComputerToolCallActionUnionParam:
 6177		return vt.GetPath()
 6178	}
 6179	return nil
 6180}
 6181
 6182// Returns a pointer to the underlying variant's property, if present.
 6183func (u responseInputItemUnionParamAction) GetKeys() []string {
 6184	switch vt := u.any.(type) {
 6185	case *ResponseComputerToolCallActionUnionParam:
 6186		return vt.GetKeys()
 6187	}
 6188	return nil
 6189}
 6190
 6191// Returns a pointer to the underlying variant's property, if present.
 6192func (u responseInputItemUnionParamAction) GetScrollX() *int64 {
 6193	switch vt := u.any.(type) {
 6194	case *ResponseComputerToolCallActionUnionParam:
 6195		return vt.GetScrollX()
 6196	}
 6197	return nil
 6198}
 6199
 6200// Returns a pointer to the underlying variant's property, if present.
 6201func (u responseInputItemUnionParamAction) GetScrollY() *int64 {
 6202	switch vt := u.any.(type) {
 6203	case *ResponseComputerToolCallActionUnionParam:
 6204		return vt.GetScrollY()
 6205	}
 6206	return nil
 6207}
 6208
 6209// Returns a pointer to the underlying variant's property, if present.
 6210func (u responseInputItemUnionParamAction) GetText() *string {
 6211	switch vt := u.any.(type) {
 6212	case *ResponseComputerToolCallActionUnionParam:
 6213		return vt.GetText()
 6214	}
 6215	return nil
 6216}
 6217
 6218// Returns a pointer to the underlying variant's property, if present.
 6219func (u responseInputItemUnionParamAction) GetQuery() *string {
 6220	switch vt := u.any.(type) {
 6221	case *ResponseFunctionWebSearchActionUnionParam:
 6222		return vt.GetQuery()
 6223	}
 6224	return nil
 6225}
 6226
 6227// Returns a pointer to the underlying variant's property, if present.
 6228func (u responseInputItemUnionParamAction) GetPattern() *string {
 6229	switch vt := u.any.(type) {
 6230	case *ResponseFunctionWebSearchActionUnionParam:
 6231		return vt.GetPattern()
 6232	}
 6233	return nil
 6234}
 6235
 6236// Returns a pointer to the underlying variant's property, if present.
 6237func (u responseInputItemUnionParamAction) GetCommand() []string {
 6238	switch vt := u.any.(type) {
 6239	case *ResponseInputItemLocalShellCallActionParam:
 6240		return vt.Command
 6241	}
 6242	return nil
 6243}
 6244
 6245// Returns a pointer to the underlying variant's property, if present.
 6246func (u responseInputItemUnionParamAction) GetEnv() map[string]string {
 6247	switch vt := u.any.(type) {
 6248	case *ResponseInputItemLocalShellCallActionParam:
 6249		return vt.Env
 6250	}
 6251	return nil
 6252}
 6253
 6254// Returns a pointer to the underlying variant's property, if present.
 6255func (u responseInputItemUnionParamAction) GetTimeoutMs() *int64 {
 6256	switch vt := u.any.(type) {
 6257	case *ResponseInputItemLocalShellCallActionParam:
 6258		return paramutil.AddrIfPresent(vt.TimeoutMs)
 6259	}
 6260	return nil
 6261}
 6262
 6263// Returns a pointer to the underlying variant's property, if present.
 6264func (u responseInputItemUnionParamAction) GetUser() *string {
 6265	switch vt := u.any.(type) {
 6266	case *ResponseInputItemLocalShellCallActionParam:
 6267		return paramutil.AddrIfPresent(vt.User)
 6268	}
 6269	return nil
 6270}
 6271
 6272// Returns a pointer to the underlying variant's property, if present.
 6273func (u responseInputItemUnionParamAction) GetWorkingDirectory() *string {
 6274	switch vt := u.any.(type) {
 6275	case *ResponseInputItemLocalShellCallActionParam:
 6276		return paramutil.AddrIfPresent(vt.WorkingDirectory)
 6277	}
 6278	return nil
 6279}
 6280
 6281// Returns a pointer to the underlying variant's property, if present.
 6282func (u responseInputItemUnionParamAction) GetType() *string {
 6283	switch vt := u.any.(type) {
 6284	case *ResponseComputerToolCallActionUnionParam:
 6285		return vt.GetType()
 6286	case *ResponseFunctionWebSearchActionUnionParam:
 6287		return vt.GetType()
 6288	case *ResponseInputItemLocalShellCallActionParam:
 6289		return (*string)(&vt.Type)
 6290	}
 6291	return nil
 6292}
 6293
 6294// Returns a pointer to the underlying variant's property, if present.
 6295func (u responseInputItemUnionParamAction) GetX() *int64 {
 6296	switch vt := u.any.(type) {
 6297	case *ResponseComputerToolCallActionUnionParam:
 6298		return vt.GetX()
 6299	}
 6300	return nil
 6301}
 6302
 6303// Returns a pointer to the underlying variant's property, if present.
 6304func (u responseInputItemUnionParamAction) GetY() *int64 {
 6305	switch vt := u.any.(type) {
 6306	case *ResponseComputerToolCallActionUnionParam:
 6307		return vt.GetY()
 6308	}
 6309	return nil
 6310}
 6311
 6312// Returns a pointer to the underlying variant's property, if present.
 6313func (u responseInputItemUnionParamAction) GetURL() *string {
 6314	switch vt := u.any.(type) {
 6315	case *ResponseFunctionWebSearchActionUnionParam:
 6316		return vt.GetURL()
 6317	}
 6318	return nil
 6319}
 6320
 6321// Returns a subunion which exports methods to access subproperties
 6322//
 6323// Or use AsAny() to get the underlying value
 6324func (u ResponseInputItemUnionParam) GetOutput() (res responseInputItemUnionParamOutput) {
 6325	if vt := u.OfComputerCallOutput; vt != nil {
 6326		res.any = &vt.Output
 6327	} else if vt := u.OfFunctionCallOutput; vt != nil {
 6328		res.any = &vt.Output
 6329	} else if vt := u.OfLocalShellCallOutput; vt != nil {
 6330		res.any = &vt.Output
 6331	} else if vt := u.OfMcpCall; vt != nil && vt.Output.Valid() {
 6332		res.any = &vt.Output.Value
 6333	}
 6334	return
 6335}
 6336
 6337// Can have the runtime types [*ResponseComputerToolCallOutputScreenshotParam],
 6338// [*string]
 6339type responseInputItemUnionParamOutput struct{ any }
 6340
 6341// Use the following switch statement to get the type of the union:
 6342//
 6343//	switch u.AsAny().(type) {
 6344//	case *responses.ResponseComputerToolCallOutputScreenshotParam:
 6345//	case *string:
 6346//	default:
 6347//	    fmt.Errorf("not present")
 6348//	}
 6349func (u responseInputItemUnionParamOutput) AsAny() any { return u.any }
 6350
 6351func init() {
 6352	apijson.RegisterUnion[ResponseInputItemUnionParam](
 6353		"type",
 6354		apijson.Discriminator[EasyInputMessageParam]("message"),
 6355		apijson.Discriminator[ResponseInputItemMessageParam]("message"),
 6356		apijson.Discriminator[ResponseOutputMessageParam]("message"),
 6357		apijson.Discriminator[ResponseFileSearchToolCallParam]("file_search_call"),
 6358		apijson.Discriminator[ResponseComputerToolCallParam]("computer_call"),
 6359		apijson.Discriminator[ResponseInputItemComputerCallOutputParam]("computer_call_output"),
 6360		apijson.Discriminator[ResponseFunctionWebSearchParam]("web_search_call"),
 6361		apijson.Discriminator[ResponseFunctionToolCallParam]("function_call"),
 6362		apijson.Discriminator[ResponseInputItemFunctionCallOutputParam]("function_call_output"),
 6363		apijson.Discriminator[ResponseReasoningItemParam]("reasoning"),
 6364		apijson.Discriminator[ResponseInputItemImageGenerationCallParam]("image_generation_call"),
 6365		apijson.Discriminator[ResponseCodeInterpreterToolCallParam]("code_interpreter_call"),
 6366		apijson.Discriminator[ResponseInputItemLocalShellCallParam]("local_shell_call"),
 6367		apijson.Discriminator[ResponseInputItemLocalShellCallOutputParam]("local_shell_call_output"),
 6368		apijson.Discriminator[ResponseInputItemMcpListToolsParam]("mcp_list_tools"),
 6369		apijson.Discriminator[ResponseInputItemMcpApprovalRequestParam]("mcp_approval_request"),
 6370		apijson.Discriminator[ResponseInputItemMcpApprovalResponseParam]("mcp_approval_response"),
 6371		apijson.Discriminator[ResponseInputItemMcpCallParam]("mcp_call"),
 6372		apijson.Discriminator[ResponseInputItemItemReferenceParam]("item_reference"),
 6373	)
 6374}
 6375
 6376// A message input to the model with a role indicating instruction following
 6377// hierarchy. Instructions given with the `developer` or `system` role take
 6378// precedence over instructions given with the `user` role.
 6379//
 6380// The properties Content, Role are required.
 6381type ResponseInputItemMessageParam struct {
 6382	// A list of one or many input items to the model, containing different content
 6383	// types.
 6384	Content ResponseInputMessageContentListParam `json:"content,omitzero,required"`
 6385	// The role of the message input. One of `user`, `system`, or `developer`.
 6386	//
 6387	// Any of "user", "system", "developer".
 6388	Role string `json:"role,omitzero,required"`
 6389	// The status of item. One of `in_progress`, `completed`, or `incomplete`.
 6390	// Populated when items are returned via API.
 6391	//
 6392	// Any of "in_progress", "completed", "incomplete".
 6393	Status string `json:"status,omitzero"`
 6394	// The type of the message input. Always set to `message`.
 6395	//
 6396	// Any of "message".
 6397	Type string `json:"type,omitzero"`
 6398	paramObj
 6399}
 6400
 6401func (r ResponseInputItemMessageParam) MarshalJSON() (data []byte, err error) {
 6402	type shadow ResponseInputItemMessageParam
 6403	return param.MarshalObject(r, (*shadow)(&r))
 6404}
 6405func (r *ResponseInputItemMessageParam) UnmarshalJSON(data []byte) error {
 6406	return apijson.UnmarshalRoot(data, r)
 6407}
 6408
 6409func init() {
 6410	apijson.RegisterFieldValidator[ResponseInputItemMessageParam](
 6411		"role", "user", "system", "developer",
 6412	)
 6413	apijson.RegisterFieldValidator[ResponseInputItemMessageParam](
 6414		"status", "in_progress", "completed", "incomplete",
 6415	)
 6416	apijson.RegisterFieldValidator[ResponseInputItemMessageParam](
 6417		"type", "message",
 6418	)
 6419}
 6420
 6421// The output of a computer tool call.
 6422//
 6423// The properties CallID, Output, Type are required.
 6424type ResponseInputItemComputerCallOutputParam struct {
 6425	// The ID of the computer tool call that produced the output.
 6426	CallID string `json:"call_id,required"`
 6427	// A computer screenshot image used with the computer use tool.
 6428	Output ResponseComputerToolCallOutputScreenshotParam `json:"output,omitzero,required"`
 6429	// The ID of the computer tool call output.
 6430	ID param.Opt[string] `json:"id,omitzero"`
 6431	// The safety checks reported by the API that have been acknowledged by the
 6432	// developer.
 6433	AcknowledgedSafetyChecks []ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam `json:"acknowledged_safety_checks,omitzero"`
 6434	// The status of the message input. One of `in_progress`, `completed`, or
 6435	// `incomplete`. Populated when input items are returned via API.
 6436	//
 6437	// Any of "in_progress", "completed", "incomplete".
 6438	Status string `json:"status,omitzero"`
 6439	// The type of the computer tool call output. Always `computer_call_output`.
 6440	//
 6441	// This field can be elided, and will marshal its zero value as
 6442	// "computer_call_output".
 6443	Type constant.ComputerCallOutput `json:"type,required"`
 6444	paramObj
 6445}
 6446
 6447func (r ResponseInputItemComputerCallOutputParam) MarshalJSON() (data []byte, err error) {
 6448	type shadow ResponseInputItemComputerCallOutputParam
 6449	return param.MarshalObject(r, (*shadow)(&r))
 6450}
 6451func (r *ResponseInputItemComputerCallOutputParam) UnmarshalJSON(data []byte) error {
 6452	return apijson.UnmarshalRoot(data, r)
 6453}
 6454
 6455func init() {
 6456	apijson.RegisterFieldValidator[ResponseInputItemComputerCallOutputParam](
 6457		"status", "in_progress", "completed", "incomplete",
 6458	)
 6459}
 6460
 6461// A pending safety check for the computer call.
 6462//
 6463// The property ID is required.
 6464type ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam struct {
 6465	// The ID of the pending safety check.
 6466	ID string `json:"id,required"`
 6467	// The type of the pending safety check.
 6468	Code param.Opt[string] `json:"code,omitzero"`
 6469	// Details about the pending safety check.
 6470	Message param.Opt[string] `json:"message,omitzero"`
 6471	paramObj
 6472}
 6473
 6474func (r ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam) MarshalJSON() (data []byte, err error) {
 6475	type shadow ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam
 6476	return param.MarshalObject(r, (*shadow)(&r))
 6477}
 6478func (r *ResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam) UnmarshalJSON(data []byte) error {
 6479	return apijson.UnmarshalRoot(data, r)
 6480}
 6481
 6482// The output of a function tool call.
 6483//
 6484// The properties CallID, Output, Type are required.
 6485type ResponseInputItemFunctionCallOutputParam struct {
 6486	// The unique ID of the function tool call generated by the model.
 6487	CallID string `json:"call_id,required"`
 6488	// A JSON string of the output of the function tool call.
 6489	Output string `json:"output,required"`
 6490	// The unique ID of the function tool call output. Populated when this item is
 6491	// returned via API.
 6492	ID param.Opt[string] `json:"id,omitzero"`
 6493	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
 6494	// Populated when items are returned via API.
 6495	//
 6496	// Any of "in_progress", "completed", "incomplete".
 6497	Status string `json:"status,omitzero"`
 6498	// The type of the function tool call output. Always `function_call_output`.
 6499	//
 6500	// This field can be elided, and will marshal its zero value as
 6501	// "function_call_output".
 6502	Type constant.FunctionCallOutput `json:"type,required"`
 6503	paramObj
 6504}
 6505
 6506func (r ResponseInputItemFunctionCallOutputParam) MarshalJSON() (data []byte, err error) {
 6507	type shadow ResponseInputItemFunctionCallOutputParam
 6508	return param.MarshalObject(r, (*shadow)(&r))
 6509}
 6510func (r *ResponseInputItemFunctionCallOutputParam) UnmarshalJSON(data []byte) error {
 6511	return apijson.UnmarshalRoot(data, r)
 6512}
 6513
 6514func init() {
 6515	apijson.RegisterFieldValidator[ResponseInputItemFunctionCallOutputParam](
 6516		"status", "in_progress", "completed", "incomplete",
 6517	)
 6518}
 6519
 6520// An image generation request made by the model.
 6521//
 6522// The properties ID, Result, Status, Type are required.
 6523type ResponseInputItemImageGenerationCallParam struct {
 6524	// The generated image encoded in base64.
 6525	Result param.Opt[string] `json:"result,omitzero,required"`
 6526	// The unique ID of the image generation call.
 6527	ID string `json:"id,required"`
 6528	// The status of the image generation call.
 6529	//
 6530	// Any of "in_progress", "completed", "generating", "failed".
 6531	Status string `json:"status,omitzero,required"`
 6532	// The type of the image generation call. Always `image_generation_call`.
 6533	//
 6534	// This field can be elided, and will marshal its zero value as
 6535	// "image_generation_call".
 6536	Type constant.ImageGenerationCall `json:"type,required"`
 6537	paramObj
 6538}
 6539
 6540func (r ResponseInputItemImageGenerationCallParam) MarshalJSON() (data []byte, err error) {
 6541	type shadow ResponseInputItemImageGenerationCallParam
 6542	return param.MarshalObject(r, (*shadow)(&r))
 6543}
 6544func (r *ResponseInputItemImageGenerationCallParam) UnmarshalJSON(data []byte) error {
 6545	return apijson.UnmarshalRoot(data, r)
 6546}
 6547
 6548func init() {
 6549	apijson.RegisterFieldValidator[ResponseInputItemImageGenerationCallParam](
 6550		"status", "in_progress", "completed", "generating", "failed",
 6551	)
 6552}
 6553
 6554// A tool call to run a command on the local shell.
 6555//
 6556// The properties ID, Action, CallID, Status, Type are required.
 6557type ResponseInputItemLocalShellCallParam struct {
 6558	// The unique ID of the local shell call.
 6559	ID string `json:"id,required"`
 6560	// Execute a shell command on the server.
 6561	Action ResponseInputItemLocalShellCallActionParam `json:"action,omitzero,required"`
 6562	// The unique ID of the local shell tool call generated by the model.
 6563	CallID string `json:"call_id,required"`
 6564	// The status of the local shell call.
 6565	//
 6566	// Any of "in_progress", "completed", "incomplete".
 6567	Status string `json:"status,omitzero,required"`
 6568	// The type of the local shell call. Always `local_shell_call`.
 6569	//
 6570	// This field can be elided, and will marshal its zero value as "local_shell_call".
 6571	Type constant.LocalShellCall `json:"type,required"`
 6572	paramObj
 6573}
 6574
 6575func (r ResponseInputItemLocalShellCallParam) MarshalJSON() (data []byte, err error) {
 6576	type shadow ResponseInputItemLocalShellCallParam
 6577	return param.MarshalObject(r, (*shadow)(&r))
 6578}
 6579func (r *ResponseInputItemLocalShellCallParam) UnmarshalJSON(data []byte) error {
 6580	return apijson.UnmarshalRoot(data, r)
 6581}
 6582
 6583func init() {
 6584	apijson.RegisterFieldValidator[ResponseInputItemLocalShellCallParam](
 6585		"status", "in_progress", "completed", "incomplete",
 6586	)
 6587}
 6588
 6589// Execute a shell command on the server.
 6590//
 6591// The properties Command, Env, Type are required.
 6592type ResponseInputItemLocalShellCallActionParam struct {
 6593	// The command to run.
 6594	Command []string `json:"command,omitzero,required"`
 6595	// Environment variables to set for the command.
 6596	Env map[string]string `json:"env,omitzero,required"`
 6597	// Optional timeout in milliseconds for the command.
 6598	TimeoutMs param.Opt[int64] `json:"timeout_ms,omitzero"`
 6599	// Optional user to run the command as.
 6600	User param.Opt[string] `json:"user,omitzero"`
 6601	// Optional working directory to run the command in.
 6602	WorkingDirectory param.Opt[string] `json:"working_directory,omitzero"`
 6603	// The type of the local shell action. Always `exec`.
 6604	//
 6605	// This field can be elided, and will marshal its zero value as "exec".
 6606	Type constant.Exec `json:"type,required"`
 6607	paramObj
 6608}
 6609
 6610func (r ResponseInputItemLocalShellCallActionParam) MarshalJSON() (data []byte, err error) {
 6611	type shadow ResponseInputItemLocalShellCallActionParam
 6612	return param.MarshalObject(r, (*shadow)(&r))
 6613}
 6614func (r *ResponseInputItemLocalShellCallActionParam) UnmarshalJSON(data []byte) error {
 6615	return apijson.UnmarshalRoot(data, r)
 6616}
 6617
 6618// The output of a local shell tool call.
 6619//
 6620// The properties ID, Output, Type are required.
 6621type ResponseInputItemLocalShellCallOutputParam struct {
 6622	// The unique ID of the local shell tool call generated by the model.
 6623	ID string `json:"id,required"`
 6624	// A JSON string of the output of the local shell tool call.
 6625	Output string `json:"output,required"`
 6626	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
 6627	//
 6628	// Any of "in_progress", "completed", "incomplete".
 6629	Status string `json:"status,omitzero"`
 6630	// The type of the local shell tool call output. Always `local_shell_call_output`.
 6631	//
 6632	// This field can be elided, and will marshal its zero value as
 6633	// "local_shell_call_output".
 6634	Type constant.LocalShellCallOutput `json:"type,required"`
 6635	paramObj
 6636}
 6637
 6638func (r ResponseInputItemLocalShellCallOutputParam) MarshalJSON() (data []byte, err error) {
 6639	type shadow ResponseInputItemLocalShellCallOutputParam
 6640	return param.MarshalObject(r, (*shadow)(&r))
 6641}
 6642func (r *ResponseInputItemLocalShellCallOutputParam) UnmarshalJSON(data []byte) error {
 6643	return apijson.UnmarshalRoot(data, r)
 6644}
 6645
 6646func init() {
 6647	apijson.RegisterFieldValidator[ResponseInputItemLocalShellCallOutputParam](
 6648		"status", "in_progress", "completed", "incomplete",
 6649	)
 6650}
 6651
 6652// A list of tools available on an MCP server.
 6653//
 6654// The properties ID, ServerLabel, Tools, Type are required.
 6655type ResponseInputItemMcpListToolsParam struct {
 6656	// The unique ID of the list.
 6657	ID string `json:"id,required"`
 6658	// The label of the MCP server.
 6659	ServerLabel string `json:"server_label,required"`
 6660	// The tools available on the server.
 6661	Tools []ResponseInputItemMcpListToolsToolParam `json:"tools,omitzero,required"`
 6662	// Error message if the server could not list tools.
 6663	Error param.Opt[string] `json:"error,omitzero"`
 6664	// The type of the item. Always `mcp_list_tools`.
 6665	//
 6666	// This field can be elided, and will marshal its zero value as "mcp_list_tools".
 6667	Type constant.McpListTools `json:"type,required"`
 6668	paramObj
 6669}
 6670
 6671func (r ResponseInputItemMcpListToolsParam) MarshalJSON() (data []byte, err error) {
 6672	type shadow ResponseInputItemMcpListToolsParam
 6673	return param.MarshalObject(r, (*shadow)(&r))
 6674}
 6675func (r *ResponseInputItemMcpListToolsParam) UnmarshalJSON(data []byte) error {
 6676	return apijson.UnmarshalRoot(data, r)
 6677}
 6678
 6679// A tool available on an MCP server.
 6680//
 6681// The properties InputSchema, Name are required.
 6682type ResponseInputItemMcpListToolsToolParam struct {
 6683	// The JSON schema describing the tool's input.
 6684	InputSchema any `json:"input_schema,omitzero,required"`
 6685	// The name of the tool.
 6686	Name string `json:"name,required"`
 6687	// The description of the tool.
 6688	Description param.Opt[string] `json:"description,omitzero"`
 6689	// Additional annotations about the tool.
 6690	Annotations any `json:"annotations,omitzero"`
 6691	paramObj
 6692}
 6693
 6694func (r ResponseInputItemMcpListToolsToolParam) MarshalJSON() (data []byte, err error) {
 6695	type shadow ResponseInputItemMcpListToolsToolParam
 6696	return param.MarshalObject(r, (*shadow)(&r))
 6697}
 6698func (r *ResponseInputItemMcpListToolsToolParam) UnmarshalJSON(data []byte) error {
 6699	return apijson.UnmarshalRoot(data, r)
 6700}
 6701
 6702// A request for human approval of a tool invocation.
 6703//
 6704// The properties ID, Arguments, Name, ServerLabel, Type are required.
 6705type ResponseInputItemMcpApprovalRequestParam struct {
 6706	// The unique ID of the approval request.
 6707	ID string `json:"id,required"`
 6708	// A JSON string of arguments for the tool.
 6709	Arguments string `json:"arguments,required"`
 6710	// The name of the tool to run.
 6711	Name string `json:"name,required"`
 6712	// The label of the MCP server making the request.
 6713	ServerLabel string `json:"server_label,required"`
 6714	// The type of the item. Always `mcp_approval_request`.
 6715	//
 6716	// This field can be elided, and will marshal its zero value as
 6717	// "mcp_approval_request".
 6718	Type constant.McpApprovalRequest `json:"type,required"`
 6719	paramObj
 6720}
 6721
 6722func (r ResponseInputItemMcpApprovalRequestParam) MarshalJSON() (data []byte, err error) {
 6723	type shadow ResponseInputItemMcpApprovalRequestParam
 6724	return param.MarshalObject(r, (*shadow)(&r))
 6725}
 6726func (r *ResponseInputItemMcpApprovalRequestParam) UnmarshalJSON(data []byte) error {
 6727	return apijson.UnmarshalRoot(data, r)
 6728}
 6729
 6730// A response to an MCP approval request.
 6731//
 6732// The properties ApprovalRequestID, Approve, Type are required.
 6733type ResponseInputItemMcpApprovalResponseParam struct {
 6734	// The ID of the approval request being answered.
 6735	ApprovalRequestID string `json:"approval_request_id,required"`
 6736	// Whether the request was approved.
 6737	Approve bool `json:"approve,required"`
 6738	// The unique ID of the approval response
 6739	ID param.Opt[string] `json:"id,omitzero"`
 6740	// Optional reason for the decision.
 6741	Reason param.Opt[string] `json:"reason,omitzero"`
 6742	// The type of the item. Always `mcp_approval_response`.
 6743	//
 6744	// This field can be elided, and will marshal its zero value as
 6745	// "mcp_approval_response".
 6746	Type constant.McpApprovalResponse `json:"type,required"`
 6747	paramObj
 6748}
 6749
 6750func (r ResponseInputItemMcpApprovalResponseParam) MarshalJSON() (data []byte, err error) {
 6751	type shadow ResponseInputItemMcpApprovalResponseParam
 6752	return param.MarshalObject(r, (*shadow)(&r))
 6753}
 6754func (r *ResponseInputItemMcpApprovalResponseParam) UnmarshalJSON(data []byte) error {
 6755	return apijson.UnmarshalRoot(data, r)
 6756}
 6757
 6758// An invocation of a tool on an MCP server.
 6759//
 6760// The properties ID, Arguments, Name, ServerLabel, Type are required.
 6761type ResponseInputItemMcpCallParam struct {
 6762	// The unique ID of the tool call.
 6763	ID string `json:"id,required"`
 6764	// A JSON string of the arguments passed to the tool.
 6765	Arguments string `json:"arguments,required"`
 6766	// The name of the tool that was run.
 6767	Name string `json:"name,required"`
 6768	// The label of the MCP server running the tool.
 6769	ServerLabel string `json:"server_label,required"`
 6770	// The error from the tool call, if any.
 6771	Error param.Opt[string] `json:"error,omitzero"`
 6772	// The output from the tool call.
 6773	Output param.Opt[string] `json:"output,omitzero"`
 6774	// The type of the item. Always `mcp_call`.
 6775	//
 6776	// This field can be elided, and will marshal its zero value as "mcp_call".
 6777	Type constant.McpCall `json:"type,required"`
 6778	paramObj
 6779}
 6780
 6781func (r ResponseInputItemMcpCallParam) MarshalJSON() (data []byte, err error) {
 6782	type shadow ResponseInputItemMcpCallParam
 6783	return param.MarshalObject(r, (*shadow)(&r))
 6784}
 6785func (r *ResponseInputItemMcpCallParam) UnmarshalJSON(data []byte) error {
 6786	return apijson.UnmarshalRoot(data, r)
 6787}
 6788
 6789// An internal identifier for an item to reference.
 6790//
 6791// The property ID is required.
 6792type ResponseInputItemItemReferenceParam struct {
 6793	// The ID of the item to reference.
 6794	ID string `json:"id,required"`
 6795	// The type of item to reference. Always `item_reference`.
 6796	//
 6797	// Any of "item_reference".
 6798	Type string `json:"type,omitzero"`
 6799	paramObj
 6800}
 6801
 6802func (r ResponseInputItemItemReferenceParam) MarshalJSON() (data []byte, err error) {
 6803	type shadow ResponseInputItemItemReferenceParam
 6804	return param.MarshalObject(r, (*shadow)(&r))
 6805}
 6806func (r *ResponseInputItemItemReferenceParam) UnmarshalJSON(data []byte) error {
 6807	return apijson.UnmarshalRoot(data, r)
 6808}
 6809
 6810func init() {
 6811	apijson.RegisterFieldValidator[ResponseInputItemItemReferenceParam](
 6812		"type", "item_reference",
 6813	)
 6814}
 6815
 6816type ResponseInputMessageContentList []ResponseInputContentUnion
 6817
 6818type ResponseInputMessageContentListParam []ResponseInputContentUnionParam
 6819
 6820type ResponseInputMessageItem struct {
 6821	// The unique ID of the message input.
 6822	ID string `json:"id,required"`
 6823	// A list of one or many input items to the model, containing different content
 6824	// types.
 6825	Content ResponseInputMessageContentList `json:"content,required"`
 6826	// The role of the message input. One of `user`, `system`, or `developer`.
 6827	//
 6828	// Any of "user", "system", "developer".
 6829	Role ResponseInputMessageItemRole `json:"role,required"`
 6830	// The status of item. One of `in_progress`, `completed`, or `incomplete`.
 6831	// Populated when items are returned via API.
 6832	//
 6833	// Any of "in_progress", "completed", "incomplete".
 6834	Status ResponseInputMessageItemStatus `json:"status"`
 6835	// The type of the message input. Always set to `message`.
 6836	//
 6837	// Any of "message".
 6838	Type ResponseInputMessageItemType `json:"type"`
 6839	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 6840	JSON struct {
 6841		ID          respjson.Field
 6842		Content     respjson.Field
 6843		Role        respjson.Field
 6844		Status      respjson.Field
 6845		Type        respjson.Field
 6846		ExtraFields map[string]respjson.Field
 6847		raw         string
 6848	} `json:"-"`
 6849}
 6850
 6851// Returns the unmodified JSON received from the API
 6852func (r ResponseInputMessageItem) RawJSON() string { return r.JSON.raw }
 6853func (r *ResponseInputMessageItem) UnmarshalJSON(data []byte) error {
 6854	return apijson.UnmarshalRoot(data, r)
 6855}
 6856
 6857// The role of the message input. One of `user`, `system`, or `developer`.
 6858type ResponseInputMessageItemRole string
 6859
 6860const (
 6861	ResponseInputMessageItemRoleUser      ResponseInputMessageItemRole = "user"
 6862	ResponseInputMessageItemRoleSystem    ResponseInputMessageItemRole = "system"
 6863	ResponseInputMessageItemRoleDeveloper ResponseInputMessageItemRole = "developer"
 6864)
 6865
 6866// The status of item. One of `in_progress`, `completed`, or `incomplete`.
 6867// Populated when items are returned via API.
 6868type ResponseInputMessageItemStatus string
 6869
 6870const (
 6871	ResponseInputMessageItemStatusInProgress ResponseInputMessageItemStatus = "in_progress"
 6872	ResponseInputMessageItemStatusCompleted  ResponseInputMessageItemStatus = "completed"
 6873	ResponseInputMessageItemStatusIncomplete ResponseInputMessageItemStatus = "incomplete"
 6874)
 6875
 6876// The type of the message input. Always set to `message`.
 6877type ResponseInputMessageItemType string
 6878
 6879const (
 6880	ResponseInputMessageItemTypeMessage ResponseInputMessageItemType = "message"
 6881)
 6882
 6883// A text input to the model.
 6884type ResponseInputText struct {
 6885	// The text input to the model.
 6886	Text string `json:"text,required"`
 6887	// The type of the input item. Always `input_text`.
 6888	Type constant.InputText `json:"type,required"`
 6889	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 6890	JSON struct {
 6891		Text        respjson.Field
 6892		Type        respjson.Field
 6893		ExtraFields map[string]respjson.Field
 6894		raw         string
 6895	} `json:"-"`
 6896}
 6897
 6898// Returns the unmodified JSON received from the API
 6899func (r ResponseInputText) RawJSON() string { return r.JSON.raw }
 6900func (r *ResponseInputText) UnmarshalJSON(data []byte) error {
 6901	return apijson.UnmarshalRoot(data, r)
 6902}
 6903
 6904// ToParam converts this ResponseInputText to a ResponseInputTextParam.
 6905//
 6906// Warning: the fields of the param type will not be present. ToParam should only
 6907// be used at the last possible moment before sending a request. Test for this with
 6908// ResponseInputTextParam.Overrides()
 6909func (r ResponseInputText) ToParam() ResponseInputTextParam {
 6910	return param.Override[ResponseInputTextParam](json.RawMessage(r.RawJSON()))
 6911}
 6912
 6913// A text input to the model.
 6914//
 6915// The properties Text, Type are required.
 6916type ResponseInputTextParam struct {
 6917	// The text input to the model.
 6918	Text string `json:"text,required"`
 6919	// The type of the input item. Always `input_text`.
 6920	//
 6921	// This field can be elided, and will marshal its zero value as "input_text".
 6922	Type constant.InputText `json:"type,required"`
 6923	paramObj
 6924}
 6925
 6926func (r ResponseInputTextParam) MarshalJSON() (data []byte, err error) {
 6927	type shadow ResponseInputTextParam
 6928	return param.MarshalObject(r, (*shadow)(&r))
 6929}
 6930func (r *ResponseInputTextParam) UnmarshalJSON(data []byte) error {
 6931	return apijson.UnmarshalRoot(data, r)
 6932}
 6933
 6934// ResponseItemUnion contains all possible properties and values from
 6935// [ResponseInputMessageItem], [ResponseOutputMessage],
 6936// [ResponseFileSearchToolCall], [ResponseComputerToolCall],
 6937// [ResponseComputerToolCallOutputItem], [ResponseFunctionWebSearch],
 6938// [ResponseFunctionToolCallItem], [ResponseFunctionToolCallOutputItem],
 6939// [ResponseItemImageGenerationCall], [ResponseCodeInterpreterToolCall],
 6940// [ResponseItemLocalShellCall], [ResponseItemLocalShellCallOutput],
 6941// [ResponseItemMcpListTools], [ResponseItemMcpApprovalRequest],
 6942// [ResponseItemMcpApprovalResponse], [ResponseItemMcpCall].
 6943//
 6944// Use the [ResponseItemUnion.AsAny] method to switch on the variant.
 6945//
 6946// Use the methods beginning with 'As' to cast the union to one of its variants.
 6947type ResponseItemUnion struct {
 6948	ID string `json:"id"`
 6949	// This field is a union of [ResponseInputMessageContentList],
 6950	// [[]ResponseOutputMessageContentUnion]
 6951	Content ResponseItemUnionContent `json:"content"`
 6952	Role    string                   `json:"role"`
 6953	Status  string                   `json:"status"`
 6954	// Any of "message", "message", "file_search_call", "computer_call",
 6955	// "computer_call_output", "web_search_call", "function_call",
 6956	// "function_call_output", "image_generation_call", "code_interpreter_call",
 6957	// "local_shell_call", "local_shell_call_output", "mcp_list_tools",
 6958	// "mcp_approval_request", "mcp_approval_response", "mcp_call".
 6959	Type string `json:"type"`
 6960	// This field is from variant [ResponseFileSearchToolCall].
 6961	Queries []string `json:"queries"`
 6962	// This field is from variant [ResponseFileSearchToolCall].
 6963	Results []ResponseFileSearchToolCallResult `json:"results"`
 6964	// This field is a union of [ResponseComputerToolCallActionUnion],
 6965	// [ResponseFunctionWebSearchActionUnion], [ResponseItemLocalShellCallAction]
 6966	Action ResponseItemUnionAction `json:"action"`
 6967	CallID string                  `json:"call_id"`
 6968	// This field is from variant [ResponseComputerToolCall].
 6969	PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck `json:"pending_safety_checks"`
 6970	// This field is a union of [ResponseComputerToolCallOutputScreenshot], [string],
 6971	// [string], [string]
 6972	Output ResponseItemUnionOutput `json:"output"`
 6973	// This field is from variant [ResponseComputerToolCallOutputItem].
 6974	AcknowledgedSafetyChecks []ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck `json:"acknowledged_safety_checks"`
 6975	Arguments                string                                                      `json:"arguments"`
 6976	Name                     string                                                      `json:"name"`
 6977	// This field is from variant [ResponseItemImageGenerationCall].
 6978	Result string `json:"result"`
 6979	// This field is from variant [ResponseCodeInterpreterToolCall].
 6980	Code string `json:"code"`
 6981	// This field is from variant [ResponseCodeInterpreterToolCall].
 6982	ContainerID string `json:"container_id"`
 6983	// This field is from variant [ResponseCodeInterpreterToolCall].
 6984	Outputs     []ResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
 6985	ServerLabel string                                       `json:"server_label"`
 6986	// This field is from variant [ResponseItemMcpListTools].
 6987	Tools []ResponseItemMcpListToolsTool `json:"tools"`
 6988	Error string                         `json:"error"`
 6989	// This field is from variant [ResponseItemMcpApprovalResponse].
 6990	ApprovalRequestID string `json:"approval_request_id"`
 6991	// This field is from variant [ResponseItemMcpApprovalResponse].
 6992	Approve bool `json:"approve"`
 6993	// This field is from variant [ResponseItemMcpApprovalResponse].
 6994	Reason string `json:"reason"`
 6995	JSON   struct {
 6996		ID                       respjson.Field
 6997		Content                  respjson.Field
 6998		Role                     respjson.Field
 6999		Status                   respjson.Field
 7000		Type                     respjson.Field
 7001		Queries                  respjson.Field
 7002		Results                  respjson.Field
 7003		Action                   respjson.Field
 7004		CallID                   respjson.Field
 7005		PendingSafetyChecks      respjson.Field
 7006		Output                   respjson.Field
 7007		AcknowledgedSafetyChecks respjson.Field
 7008		Arguments                respjson.Field
 7009		Name                     respjson.Field
 7010		Result                   respjson.Field
 7011		Code                     respjson.Field
 7012		ContainerID              respjson.Field
 7013		Outputs                  respjson.Field
 7014		ServerLabel              respjson.Field
 7015		Tools                    respjson.Field
 7016		Error                    respjson.Field
 7017		ApprovalRequestID        respjson.Field
 7018		Approve                  respjson.Field
 7019		Reason                   respjson.Field
 7020		raw                      string
 7021	} `json:"-"`
 7022}
 7023
 7024// anyResponseItem is implemented by each variant of [ResponseItemUnion] to add
 7025// type safety for the return type of [ResponseItemUnion.AsAny]
 7026type anyResponseItem interface {
 7027	implResponseItemUnion()
 7028}
 7029
 7030func (ResponseInputMessageItem) implResponseItemUnion()           {}
 7031func (ResponseOutputMessage) implResponseItemUnion()              {}
 7032func (ResponseFileSearchToolCall) implResponseItemUnion()         {}
 7033func (ResponseComputerToolCall) implResponseItemUnion()           {}
 7034func (ResponseComputerToolCallOutputItem) implResponseItemUnion() {}
 7035func (ResponseFunctionWebSearch) implResponseItemUnion()          {}
 7036func (ResponseFunctionToolCallItem) implResponseItemUnion()       {}
 7037func (ResponseFunctionToolCallOutputItem) implResponseItemUnion() {}
 7038func (ResponseItemImageGenerationCall) implResponseItemUnion()    {}
 7039func (ResponseCodeInterpreterToolCall) implResponseItemUnion()    {}
 7040func (ResponseItemLocalShellCall) implResponseItemUnion()         {}
 7041func (ResponseItemLocalShellCallOutput) implResponseItemUnion()   {}
 7042func (ResponseItemMcpListTools) implResponseItemUnion()           {}
 7043func (ResponseItemMcpApprovalRequest) implResponseItemUnion()     {}
 7044func (ResponseItemMcpApprovalResponse) implResponseItemUnion()    {}
 7045func (ResponseItemMcpCall) implResponseItemUnion()                {}
 7046
 7047// Use the following switch statement to find the correct variant
 7048//
 7049//	switch variant := ResponseItemUnion.AsAny().(type) {
 7050//	case responses.ResponseInputMessageItem:
 7051//	case responses.ResponseOutputMessage:
 7052//	case responses.ResponseFileSearchToolCall:
 7053//	case responses.ResponseComputerToolCall:
 7054//	case responses.ResponseComputerToolCallOutputItem:
 7055//	case responses.ResponseFunctionWebSearch:
 7056//	case responses.ResponseFunctionToolCallItem:
 7057//	case responses.ResponseFunctionToolCallOutputItem:
 7058//	case responses.ResponseItemImageGenerationCall:
 7059//	case responses.ResponseCodeInterpreterToolCall:
 7060//	case responses.ResponseItemLocalShellCall:
 7061//	case responses.ResponseItemLocalShellCallOutput:
 7062//	case responses.ResponseItemMcpListTools:
 7063//	case responses.ResponseItemMcpApprovalRequest:
 7064//	case responses.ResponseItemMcpApprovalResponse:
 7065//	case responses.ResponseItemMcpCall:
 7066//	default:
 7067//	  fmt.Errorf("no variant present")
 7068//	}
 7069func (u ResponseItemUnion) AsAny() anyResponseItem {
 7070	switch u.Type {
 7071	case "message":
 7072		return u.AsOutputMessage()
 7073	case "file_search_call":
 7074		return u.AsFileSearchCall()
 7075	case "computer_call":
 7076		return u.AsComputerCall()
 7077	case "computer_call_output":
 7078		return u.AsComputerCallOutput()
 7079	case "web_search_call":
 7080		return u.AsWebSearchCall()
 7081	case "function_call":
 7082		return u.AsFunctionCall()
 7083	case "function_call_output":
 7084		return u.AsFunctionCallOutput()
 7085	case "image_generation_call":
 7086		return u.AsImageGenerationCall()
 7087	case "code_interpreter_call":
 7088		return u.AsCodeInterpreterCall()
 7089	case "local_shell_call":
 7090		return u.AsLocalShellCall()
 7091	case "local_shell_call_output":
 7092		return u.AsLocalShellCallOutput()
 7093	case "mcp_list_tools":
 7094		return u.AsMcpListTools()
 7095	case "mcp_approval_request":
 7096		return u.AsMcpApprovalRequest()
 7097	case "mcp_approval_response":
 7098		return u.AsMcpApprovalResponse()
 7099	case "mcp_call":
 7100		return u.AsMcpCall()
 7101	}
 7102	return nil
 7103}
 7104
 7105func (u ResponseItemUnion) AsMessage() (v ResponseInputMessageItem) {
 7106	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7107	return
 7108}
 7109
 7110func (u ResponseItemUnion) AsOutputMessage() (v ResponseOutputMessage) {
 7111	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7112	return
 7113}
 7114
 7115func (u ResponseItemUnion) AsFileSearchCall() (v ResponseFileSearchToolCall) {
 7116	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7117	return
 7118}
 7119
 7120func (u ResponseItemUnion) AsComputerCall() (v ResponseComputerToolCall) {
 7121	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7122	return
 7123}
 7124
 7125func (u ResponseItemUnion) AsComputerCallOutput() (v ResponseComputerToolCallOutputItem) {
 7126	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7127	return
 7128}
 7129
 7130func (u ResponseItemUnion) AsWebSearchCall() (v ResponseFunctionWebSearch) {
 7131	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7132	return
 7133}
 7134
 7135func (u ResponseItemUnion) AsFunctionCall() (v ResponseFunctionToolCallItem) {
 7136	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7137	return
 7138}
 7139
 7140func (u ResponseItemUnion) AsFunctionCallOutput() (v ResponseFunctionToolCallOutputItem) {
 7141	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7142	return
 7143}
 7144
 7145func (u ResponseItemUnion) AsImageGenerationCall() (v ResponseItemImageGenerationCall) {
 7146	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7147	return
 7148}
 7149
 7150func (u ResponseItemUnion) AsCodeInterpreterCall() (v ResponseCodeInterpreterToolCall) {
 7151	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7152	return
 7153}
 7154
 7155func (u ResponseItemUnion) AsLocalShellCall() (v ResponseItemLocalShellCall) {
 7156	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7157	return
 7158}
 7159
 7160func (u ResponseItemUnion) AsLocalShellCallOutput() (v ResponseItemLocalShellCallOutput) {
 7161	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7162	return
 7163}
 7164
 7165func (u ResponseItemUnion) AsMcpListTools() (v ResponseItemMcpListTools) {
 7166	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7167	return
 7168}
 7169
 7170func (u ResponseItemUnion) AsMcpApprovalRequest() (v ResponseItemMcpApprovalRequest) {
 7171	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7172	return
 7173}
 7174
 7175func (u ResponseItemUnion) AsMcpApprovalResponse() (v ResponseItemMcpApprovalResponse) {
 7176	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7177	return
 7178}
 7179
 7180func (u ResponseItemUnion) AsMcpCall() (v ResponseItemMcpCall) {
 7181	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7182	return
 7183}
 7184
 7185// Returns the unmodified JSON received from the API
 7186func (u ResponseItemUnion) RawJSON() string { return u.JSON.raw }
 7187
 7188func (r *ResponseItemUnion) UnmarshalJSON(data []byte) error {
 7189	return apijson.UnmarshalRoot(data, r)
 7190}
 7191
 7192// ResponseItemUnionContent is an implicit subunion of [ResponseItemUnion].
 7193// ResponseItemUnionContent provides convenient access to the sub-properties of the
 7194// union.
 7195//
 7196// For type safety it is recommended to directly use a variant of the
 7197// [ResponseItemUnion].
 7198//
 7199// If the underlying value is not a json object, one of the following properties
 7200// will be valid: OfInputItemContentList OfResponseOutputMessageContentArray]
 7201type ResponseItemUnionContent struct {
 7202	// This field will be present if the value is a [ResponseInputMessageContentList]
 7203	// instead of an object.
 7204	OfInputItemContentList ResponseInputMessageContentList `json:",inline"`
 7205	// This field will be present if the value is a
 7206	// [[]ResponseOutputMessageContentUnion] instead of an object.
 7207	OfResponseOutputMessageContentArray []ResponseOutputMessageContentUnion `json:",inline"`
 7208	JSON                                struct {
 7209		OfInputItemContentList              respjson.Field
 7210		OfResponseOutputMessageContentArray respjson.Field
 7211		raw                                 string
 7212	} `json:"-"`
 7213}
 7214
 7215func (r *ResponseItemUnionContent) UnmarshalJSON(data []byte) error {
 7216	return apijson.UnmarshalRoot(data, r)
 7217}
 7218
 7219// ResponseItemUnionAction is an implicit subunion of [ResponseItemUnion].
 7220// ResponseItemUnionAction provides convenient access to the sub-properties of the
 7221// union.
 7222//
 7223// For type safety it is recommended to directly use a variant of the
 7224// [ResponseItemUnion].
 7225type ResponseItemUnionAction struct {
 7226	// This field is from variant [ResponseComputerToolCallActionUnion].
 7227	Button string `json:"button"`
 7228	Type   string `json:"type"`
 7229	X      int64  `json:"x"`
 7230	Y      int64  `json:"y"`
 7231	// This field is from variant [ResponseComputerToolCallActionUnion].
 7232	Path []ResponseComputerToolCallActionDragPath `json:"path"`
 7233	// This field is from variant [ResponseComputerToolCallActionUnion].
 7234	Keys []string `json:"keys"`
 7235	// This field is from variant [ResponseComputerToolCallActionUnion].
 7236	ScrollX int64 `json:"scroll_x"`
 7237	// This field is from variant [ResponseComputerToolCallActionUnion].
 7238	ScrollY int64 `json:"scroll_y"`
 7239	// This field is from variant [ResponseComputerToolCallActionUnion].
 7240	Text string `json:"text"`
 7241	// This field is from variant [ResponseFunctionWebSearchActionUnion].
 7242	Query string `json:"query"`
 7243	URL   string `json:"url"`
 7244	// This field is from variant [ResponseFunctionWebSearchActionUnion].
 7245	Pattern string `json:"pattern"`
 7246	// This field is from variant [ResponseItemLocalShellCallAction].
 7247	Command []string `json:"command"`
 7248	// This field is from variant [ResponseItemLocalShellCallAction].
 7249	Env map[string]string `json:"env"`
 7250	// This field is from variant [ResponseItemLocalShellCallAction].
 7251	TimeoutMs int64 `json:"timeout_ms"`
 7252	// This field is from variant [ResponseItemLocalShellCallAction].
 7253	User string `json:"user"`
 7254	// This field is from variant [ResponseItemLocalShellCallAction].
 7255	WorkingDirectory string `json:"working_directory"`
 7256	JSON             struct {
 7257		Button           respjson.Field
 7258		Type             respjson.Field
 7259		X                respjson.Field
 7260		Y                respjson.Field
 7261		Path             respjson.Field
 7262		Keys             respjson.Field
 7263		ScrollX          respjson.Field
 7264		ScrollY          respjson.Field
 7265		Text             respjson.Field
 7266		Query            respjson.Field
 7267		URL              respjson.Field
 7268		Pattern          respjson.Field
 7269		Command          respjson.Field
 7270		Env              respjson.Field
 7271		TimeoutMs        respjson.Field
 7272		User             respjson.Field
 7273		WorkingDirectory respjson.Field
 7274		raw              string
 7275	} `json:"-"`
 7276}
 7277
 7278func (r *ResponseItemUnionAction) UnmarshalJSON(data []byte) error {
 7279	return apijson.UnmarshalRoot(data, r)
 7280}
 7281
 7282// ResponseItemUnionOutput is an implicit subunion of [ResponseItemUnion].
 7283// ResponseItemUnionOutput provides convenient access to the sub-properties of the
 7284// union.
 7285//
 7286// For type safety it is recommended to directly use a variant of the
 7287// [ResponseItemUnion].
 7288//
 7289// If the underlying value is not a json object, one of the following properties
 7290// will be valid: OfString]
 7291type ResponseItemUnionOutput struct {
 7292	// This field will be present if the value is a [string] instead of an object.
 7293	OfString string `json:",inline"`
 7294	// This field is from variant [ResponseComputerToolCallOutputScreenshot].
 7295	Type constant.ComputerScreenshot `json:"type"`
 7296	// This field is from variant [ResponseComputerToolCallOutputScreenshot].
 7297	FileID string `json:"file_id"`
 7298	// This field is from variant [ResponseComputerToolCallOutputScreenshot].
 7299	ImageURL string `json:"image_url"`
 7300	JSON     struct {
 7301		OfString respjson.Field
 7302		Type     respjson.Field
 7303		FileID   respjson.Field
 7304		ImageURL respjson.Field
 7305		raw      string
 7306	} `json:"-"`
 7307}
 7308
 7309func (r *ResponseItemUnionOutput) UnmarshalJSON(data []byte) error {
 7310	return apijson.UnmarshalRoot(data, r)
 7311}
 7312
 7313// An image generation request made by the model.
 7314type ResponseItemImageGenerationCall struct {
 7315	// The unique ID of the image generation call.
 7316	ID string `json:"id,required"`
 7317	// The generated image encoded in base64.
 7318	Result string `json:"result,required"`
 7319	// The status of the image generation call.
 7320	//
 7321	// Any of "in_progress", "completed", "generating", "failed".
 7322	Status string `json:"status,required"`
 7323	// The type of the image generation call. Always `image_generation_call`.
 7324	Type constant.ImageGenerationCall `json:"type,required"`
 7325	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 7326	JSON struct {
 7327		ID          respjson.Field
 7328		Result      respjson.Field
 7329		Status      respjson.Field
 7330		Type        respjson.Field
 7331		ExtraFields map[string]respjson.Field
 7332		raw         string
 7333	} `json:"-"`
 7334}
 7335
 7336// Returns the unmodified JSON received from the API
 7337func (r ResponseItemImageGenerationCall) RawJSON() string { return r.JSON.raw }
 7338func (r *ResponseItemImageGenerationCall) UnmarshalJSON(data []byte) error {
 7339	return apijson.UnmarshalRoot(data, r)
 7340}
 7341
 7342// A tool call to run a command on the local shell.
 7343type ResponseItemLocalShellCall struct {
 7344	// The unique ID of the local shell call.
 7345	ID string `json:"id,required"`
 7346	// Execute a shell command on the server.
 7347	Action ResponseItemLocalShellCallAction `json:"action,required"`
 7348	// The unique ID of the local shell tool call generated by the model.
 7349	CallID string `json:"call_id,required"`
 7350	// The status of the local shell call.
 7351	//
 7352	// Any of "in_progress", "completed", "incomplete".
 7353	Status string `json:"status,required"`
 7354	// The type of the local shell call. Always `local_shell_call`.
 7355	Type constant.LocalShellCall `json:"type,required"`
 7356	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 7357	JSON struct {
 7358		ID          respjson.Field
 7359		Action      respjson.Field
 7360		CallID      respjson.Field
 7361		Status      respjson.Field
 7362		Type        respjson.Field
 7363		ExtraFields map[string]respjson.Field
 7364		raw         string
 7365	} `json:"-"`
 7366}
 7367
 7368// Returns the unmodified JSON received from the API
 7369func (r ResponseItemLocalShellCall) RawJSON() string { return r.JSON.raw }
 7370func (r *ResponseItemLocalShellCall) UnmarshalJSON(data []byte) error {
 7371	return apijson.UnmarshalRoot(data, r)
 7372}
 7373
 7374// Execute a shell command on the server.
 7375type ResponseItemLocalShellCallAction struct {
 7376	// The command to run.
 7377	Command []string `json:"command,required"`
 7378	// Environment variables to set for the command.
 7379	Env map[string]string `json:"env,required"`
 7380	// The type of the local shell action. Always `exec`.
 7381	Type constant.Exec `json:"type,required"`
 7382	// Optional timeout in milliseconds for the command.
 7383	TimeoutMs int64 `json:"timeout_ms,nullable"`
 7384	// Optional user to run the command as.
 7385	User string `json:"user,nullable"`
 7386	// Optional working directory to run the command in.
 7387	WorkingDirectory string `json:"working_directory,nullable"`
 7388	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 7389	JSON struct {
 7390		Command          respjson.Field
 7391		Env              respjson.Field
 7392		Type             respjson.Field
 7393		TimeoutMs        respjson.Field
 7394		User             respjson.Field
 7395		WorkingDirectory respjson.Field
 7396		ExtraFields      map[string]respjson.Field
 7397		raw              string
 7398	} `json:"-"`
 7399}
 7400
 7401// Returns the unmodified JSON received from the API
 7402func (r ResponseItemLocalShellCallAction) RawJSON() string { return r.JSON.raw }
 7403func (r *ResponseItemLocalShellCallAction) UnmarshalJSON(data []byte) error {
 7404	return apijson.UnmarshalRoot(data, r)
 7405}
 7406
 7407// The output of a local shell tool call.
 7408type ResponseItemLocalShellCallOutput struct {
 7409	// The unique ID of the local shell tool call generated by the model.
 7410	ID string `json:"id,required"`
 7411	// A JSON string of the output of the local shell tool call.
 7412	Output string `json:"output,required"`
 7413	// The type of the local shell tool call output. Always `local_shell_call_output`.
 7414	Type constant.LocalShellCallOutput `json:"type,required"`
 7415	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
 7416	//
 7417	// Any of "in_progress", "completed", "incomplete".
 7418	Status string `json:"status,nullable"`
 7419	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 7420	JSON struct {
 7421		ID          respjson.Field
 7422		Output      respjson.Field
 7423		Type        respjson.Field
 7424		Status      respjson.Field
 7425		ExtraFields map[string]respjson.Field
 7426		raw         string
 7427	} `json:"-"`
 7428}
 7429
 7430// Returns the unmodified JSON received from the API
 7431func (r ResponseItemLocalShellCallOutput) RawJSON() string { return r.JSON.raw }
 7432func (r *ResponseItemLocalShellCallOutput) UnmarshalJSON(data []byte) error {
 7433	return apijson.UnmarshalRoot(data, r)
 7434}
 7435
 7436// A list of tools available on an MCP server.
 7437type ResponseItemMcpListTools struct {
 7438	// The unique ID of the list.
 7439	ID string `json:"id,required"`
 7440	// The label of the MCP server.
 7441	ServerLabel string `json:"server_label,required"`
 7442	// The tools available on the server.
 7443	Tools []ResponseItemMcpListToolsTool `json:"tools,required"`
 7444	// The type of the item. Always `mcp_list_tools`.
 7445	Type constant.McpListTools `json:"type,required"`
 7446	// Error message if the server could not list tools.
 7447	Error string `json:"error,nullable"`
 7448	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 7449	JSON struct {
 7450		ID          respjson.Field
 7451		ServerLabel respjson.Field
 7452		Tools       respjson.Field
 7453		Type        respjson.Field
 7454		Error       respjson.Field
 7455		ExtraFields map[string]respjson.Field
 7456		raw         string
 7457	} `json:"-"`
 7458}
 7459
 7460// Returns the unmodified JSON received from the API
 7461func (r ResponseItemMcpListTools) RawJSON() string { return r.JSON.raw }
 7462func (r *ResponseItemMcpListTools) UnmarshalJSON(data []byte) error {
 7463	return apijson.UnmarshalRoot(data, r)
 7464}
 7465
 7466// A tool available on an MCP server.
 7467type ResponseItemMcpListToolsTool struct {
 7468	// The JSON schema describing the tool's input.
 7469	InputSchema any `json:"input_schema,required"`
 7470	// The name of the tool.
 7471	Name string `json:"name,required"`
 7472	// Additional annotations about the tool.
 7473	Annotations any `json:"annotations,nullable"`
 7474	// The description of the tool.
 7475	Description string `json:"description,nullable"`
 7476	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 7477	JSON struct {
 7478		InputSchema respjson.Field
 7479		Name        respjson.Field
 7480		Annotations respjson.Field
 7481		Description respjson.Field
 7482		ExtraFields map[string]respjson.Field
 7483		raw         string
 7484	} `json:"-"`
 7485}
 7486
 7487// Returns the unmodified JSON received from the API
 7488func (r ResponseItemMcpListToolsTool) RawJSON() string { return r.JSON.raw }
 7489func (r *ResponseItemMcpListToolsTool) UnmarshalJSON(data []byte) error {
 7490	return apijson.UnmarshalRoot(data, r)
 7491}
 7492
 7493// A request for human approval of a tool invocation.
 7494type ResponseItemMcpApprovalRequest struct {
 7495	// The unique ID of the approval request.
 7496	ID string `json:"id,required"`
 7497	// A JSON string of arguments for the tool.
 7498	Arguments string `json:"arguments,required"`
 7499	// The name of the tool to run.
 7500	Name string `json:"name,required"`
 7501	// The label of the MCP server making the request.
 7502	ServerLabel string `json:"server_label,required"`
 7503	// The type of the item. Always `mcp_approval_request`.
 7504	Type constant.McpApprovalRequest `json:"type,required"`
 7505	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 7506	JSON struct {
 7507		ID          respjson.Field
 7508		Arguments   respjson.Field
 7509		Name        respjson.Field
 7510		ServerLabel respjson.Field
 7511		Type        respjson.Field
 7512		ExtraFields map[string]respjson.Field
 7513		raw         string
 7514	} `json:"-"`
 7515}
 7516
 7517// Returns the unmodified JSON received from the API
 7518func (r ResponseItemMcpApprovalRequest) RawJSON() string { return r.JSON.raw }
 7519func (r *ResponseItemMcpApprovalRequest) UnmarshalJSON(data []byte) error {
 7520	return apijson.UnmarshalRoot(data, r)
 7521}
 7522
 7523// A response to an MCP approval request.
 7524type ResponseItemMcpApprovalResponse struct {
 7525	// The unique ID of the approval response
 7526	ID string `json:"id,required"`
 7527	// The ID of the approval request being answered.
 7528	ApprovalRequestID string `json:"approval_request_id,required"`
 7529	// Whether the request was approved.
 7530	Approve bool `json:"approve,required"`
 7531	// The type of the item. Always `mcp_approval_response`.
 7532	Type constant.McpApprovalResponse `json:"type,required"`
 7533	// Optional reason for the decision.
 7534	Reason string `json:"reason,nullable"`
 7535	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 7536	JSON struct {
 7537		ID                respjson.Field
 7538		ApprovalRequestID respjson.Field
 7539		Approve           respjson.Field
 7540		Type              respjson.Field
 7541		Reason            respjson.Field
 7542		ExtraFields       map[string]respjson.Field
 7543		raw               string
 7544	} `json:"-"`
 7545}
 7546
 7547// Returns the unmodified JSON received from the API
 7548func (r ResponseItemMcpApprovalResponse) RawJSON() string { return r.JSON.raw }
 7549func (r *ResponseItemMcpApprovalResponse) UnmarshalJSON(data []byte) error {
 7550	return apijson.UnmarshalRoot(data, r)
 7551}
 7552
 7553// An invocation of a tool on an MCP server.
 7554type ResponseItemMcpCall struct {
 7555	// The unique ID of the tool call.
 7556	ID string `json:"id,required"`
 7557	// A JSON string of the arguments passed to the tool.
 7558	Arguments string `json:"arguments,required"`
 7559	// The name of the tool that was run.
 7560	Name string `json:"name,required"`
 7561	// The label of the MCP server running the tool.
 7562	ServerLabel string `json:"server_label,required"`
 7563	// The type of the item. Always `mcp_call`.
 7564	Type constant.McpCall `json:"type,required"`
 7565	// The error from the tool call, if any.
 7566	Error string `json:"error,nullable"`
 7567	// The output from the tool call.
 7568	Output string `json:"output,nullable"`
 7569	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 7570	JSON struct {
 7571		ID          respjson.Field
 7572		Arguments   respjson.Field
 7573		Name        respjson.Field
 7574		ServerLabel respjson.Field
 7575		Type        respjson.Field
 7576		Error       respjson.Field
 7577		Output      respjson.Field
 7578		ExtraFields map[string]respjson.Field
 7579		raw         string
 7580	} `json:"-"`
 7581}
 7582
 7583// Returns the unmodified JSON received from the API
 7584func (r ResponseItemMcpCall) RawJSON() string { return r.JSON.raw }
 7585func (r *ResponseItemMcpCall) UnmarshalJSON(data []byte) error {
 7586	return apijson.UnmarshalRoot(data, r)
 7587}
 7588
 7589// Emitted when there is a delta (partial update) to the arguments of an MCP tool
 7590// call.
 7591type ResponseMcpCallArgumentsDeltaEvent struct {
 7592	// The partial update to the arguments for the MCP tool call.
 7593	Delta any `json:"delta,required"`
 7594	// The unique identifier of the MCP tool call item being processed.
 7595	ItemID string `json:"item_id,required"`
 7596	// The index of the output item in the response's output array.
 7597	OutputIndex int64 `json:"output_index,required"`
 7598	// The sequence number of this event.
 7599	SequenceNumber int64 `json:"sequence_number,required"`
 7600	// The type of the event. Always 'response.mcp_call.arguments_delta'.
 7601	Type constant.ResponseMcpCallArgumentsDelta `json:"type,required"`
 7602	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 7603	JSON struct {
 7604		Delta          respjson.Field
 7605		ItemID         respjson.Field
 7606		OutputIndex    respjson.Field
 7607		SequenceNumber respjson.Field
 7608		Type           respjson.Field
 7609		ExtraFields    map[string]respjson.Field
 7610		raw            string
 7611	} `json:"-"`
 7612}
 7613
 7614// Returns the unmodified JSON received from the API
 7615func (r ResponseMcpCallArgumentsDeltaEvent) RawJSON() string { return r.JSON.raw }
 7616func (r *ResponseMcpCallArgumentsDeltaEvent) UnmarshalJSON(data []byte) error {
 7617	return apijson.UnmarshalRoot(data, r)
 7618}
 7619
 7620// Emitted when the arguments for an MCP tool call are finalized.
 7621type ResponseMcpCallArgumentsDoneEvent struct {
 7622	// The finalized arguments for the MCP tool call.
 7623	Arguments any `json:"arguments,required"`
 7624	// The unique identifier of the MCP tool call item being processed.
 7625	ItemID string `json:"item_id,required"`
 7626	// The index of the output item in the response's output array.
 7627	OutputIndex int64 `json:"output_index,required"`
 7628	// The sequence number of this event.
 7629	SequenceNumber int64 `json:"sequence_number,required"`
 7630	// The type of the event. Always 'response.mcp_call.arguments_done'.
 7631	Type constant.ResponseMcpCallArgumentsDone `json:"type,required"`
 7632	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 7633	JSON struct {
 7634		Arguments      respjson.Field
 7635		ItemID         respjson.Field
 7636		OutputIndex    respjson.Field
 7637		SequenceNumber respjson.Field
 7638		Type           respjson.Field
 7639		ExtraFields    map[string]respjson.Field
 7640		raw            string
 7641	} `json:"-"`
 7642}
 7643
 7644// Returns the unmodified JSON received from the API
 7645func (r ResponseMcpCallArgumentsDoneEvent) RawJSON() string { return r.JSON.raw }
 7646func (r *ResponseMcpCallArgumentsDoneEvent) UnmarshalJSON(data []byte) error {
 7647	return apijson.UnmarshalRoot(data, r)
 7648}
 7649
 7650// Emitted when an MCP tool call has completed successfully.
 7651type ResponseMcpCallCompletedEvent struct {
 7652	// The sequence number of this event.
 7653	SequenceNumber int64 `json:"sequence_number,required"`
 7654	// The type of the event. Always 'response.mcp_call.completed'.
 7655	Type constant.ResponseMcpCallCompleted `json:"type,required"`
 7656	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 7657	JSON struct {
 7658		SequenceNumber respjson.Field
 7659		Type           respjson.Field
 7660		ExtraFields    map[string]respjson.Field
 7661		raw            string
 7662	} `json:"-"`
 7663}
 7664
 7665// Returns the unmodified JSON received from the API
 7666func (r ResponseMcpCallCompletedEvent) RawJSON() string { return r.JSON.raw }
 7667func (r *ResponseMcpCallCompletedEvent) UnmarshalJSON(data []byte) error {
 7668	return apijson.UnmarshalRoot(data, r)
 7669}
 7670
 7671// Emitted when an MCP tool call has failed.
 7672type ResponseMcpCallFailedEvent struct {
 7673	// The sequence number of this event.
 7674	SequenceNumber int64 `json:"sequence_number,required"`
 7675	// The type of the event. Always 'response.mcp_call.failed'.
 7676	Type constant.ResponseMcpCallFailed `json:"type,required"`
 7677	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 7678	JSON struct {
 7679		SequenceNumber respjson.Field
 7680		Type           respjson.Field
 7681		ExtraFields    map[string]respjson.Field
 7682		raw            string
 7683	} `json:"-"`
 7684}
 7685
 7686// Returns the unmodified JSON received from the API
 7687func (r ResponseMcpCallFailedEvent) RawJSON() string { return r.JSON.raw }
 7688func (r *ResponseMcpCallFailedEvent) UnmarshalJSON(data []byte) error {
 7689	return apijson.UnmarshalRoot(data, r)
 7690}
 7691
 7692// Emitted when an MCP tool call is in progress.
 7693type ResponseMcpCallInProgressEvent struct {
 7694	// The unique identifier of the MCP tool call item being processed.
 7695	ItemID string `json:"item_id,required"`
 7696	// The index of the output item in the response's output array.
 7697	OutputIndex int64 `json:"output_index,required"`
 7698	// The sequence number of this event.
 7699	SequenceNumber int64 `json:"sequence_number,required"`
 7700	// The type of the event. Always 'response.mcp_call.in_progress'.
 7701	Type constant.ResponseMcpCallInProgress `json:"type,required"`
 7702	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 7703	JSON struct {
 7704		ItemID         respjson.Field
 7705		OutputIndex    respjson.Field
 7706		SequenceNumber respjson.Field
 7707		Type           respjson.Field
 7708		ExtraFields    map[string]respjson.Field
 7709		raw            string
 7710	} `json:"-"`
 7711}
 7712
 7713// Returns the unmodified JSON received from the API
 7714func (r ResponseMcpCallInProgressEvent) RawJSON() string { return r.JSON.raw }
 7715func (r *ResponseMcpCallInProgressEvent) UnmarshalJSON(data []byte) error {
 7716	return apijson.UnmarshalRoot(data, r)
 7717}
 7718
 7719// Emitted when the list of available MCP tools has been successfully retrieved.
 7720type ResponseMcpListToolsCompletedEvent struct {
 7721	// The sequence number of this event.
 7722	SequenceNumber int64 `json:"sequence_number,required"`
 7723	// The type of the event. Always 'response.mcp_list_tools.completed'.
 7724	Type constant.ResponseMcpListToolsCompleted `json:"type,required"`
 7725	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 7726	JSON struct {
 7727		SequenceNumber respjson.Field
 7728		Type           respjson.Field
 7729		ExtraFields    map[string]respjson.Field
 7730		raw            string
 7731	} `json:"-"`
 7732}
 7733
 7734// Returns the unmodified JSON received from the API
 7735func (r ResponseMcpListToolsCompletedEvent) RawJSON() string { return r.JSON.raw }
 7736func (r *ResponseMcpListToolsCompletedEvent) UnmarshalJSON(data []byte) error {
 7737	return apijson.UnmarshalRoot(data, r)
 7738}
 7739
 7740// Emitted when the attempt to list available MCP tools has failed.
 7741type ResponseMcpListToolsFailedEvent struct {
 7742	// The sequence number of this event.
 7743	SequenceNumber int64 `json:"sequence_number,required"`
 7744	// The type of the event. Always 'response.mcp_list_tools.failed'.
 7745	Type constant.ResponseMcpListToolsFailed `json:"type,required"`
 7746	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 7747	JSON struct {
 7748		SequenceNumber respjson.Field
 7749		Type           respjson.Field
 7750		ExtraFields    map[string]respjson.Field
 7751		raw            string
 7752	} `json:"-"`
 7753}
 7754
 7755// Returns the unmodified JSON received from the API
 7756func (r ResponseMcpListToolsFailedEvent) RawJSON() string { return r.JSON.raw }
 7757func (r *ResponseMcpListToolsFailedEvent) UnmarshalJSON(data []byte) error {
 7758	return apijson.UnmarshalRoot(data, r)
 7759}
 7760
 7761// Emitted when the system is in the process of retrieving the list of available
 7762// MCP tools.
 7763type ResponseMcpListToolsInProgressEvent struct {
 7764	// The sequence number of this event.
 7765	SequenceNumber int64 `json:"sequence_number,required"`
 7766	// The type of the event. Always 'response.mcp_list_tools.in_progress'.
 7767	Type constant.ResponseMcpListToolsInProgress `json:"type,required"`
 7768	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 7769	JSON struct {
 7770		SequenceNumber respjson.Field
 7771		Type           respjson.Field
 7772		ExtraFields    map[string]respjson.Field
 7773		raw            string
 7774	} `json:"-"`
 7775}
 7776
 7777// Returns the unmodified JSON received from the API
 7778func (r ResponseMcpListToolsInProgressEvent) RawJSON() string { return r.JSON.raw }
 7779func (r *ResponseMcpListToolsInProgressEvent) UnmarshalJSON(data []byte) error {
 7780	return apijson.UnmarshalRoot(data, r)
 7781}
 7782
 7783// ResponseOutputItemUnion contains all possible properties and values from
 7784// [ResponseOutputMessage], [ResponseFileSearchToolCall],
 7785// [ResponseFunctionToolCall], [ResponseFunctionWebSearch],
 7786// [ResponseComputerToolCall], [ResponseReasoningItem],
 7787// [ResponseOutputItemImageGenerationCall], [ResponseCodeInterpreterToolCall],
 7788// [ResponseOutputItemLocalShellCall], [ResponseOutputItemMcpCall],
 7789// [ResponseOutputItemMcpListTools], [ResponseOutputItemMcpApprovalRequest].
 7790//
 7791// Use the [ResponseOutputItemUnion.AsAny] method to switch on the variant.
 7792//
 7793// Use the methods beginning with 'As' to cast the union to one of its variants.
 7794type ResponseOutputItemUnion struct {
 7795	ID string `json:"id"`
 7796	// This field is from variant [ResponseOutputMessage].
 7797	Content []ResponseOutputMessageContentUnion `json:"content"`
 7798	// This field is from variant [ResponseOutputMessage].
 7799	Role   constant.Assistant `json:"role"`
 7800	Status string             `json:"status"`
 7801	// Any of "message", "file_search_call", "function_call", "web_search_call",
 7802	// "computer_call", "reasoning", "image_generation_call", "code_interpreter_call",
 7803	// "local_shell_call", "mcp_call", "mcp_list_tools", "mcp_approval_request".
 7804	Type string `json:"type"`
 7805	// This field is from variant [ResponseFileSearchToolCall].
 7806	Queries []string `json:"queries"`
 7807	// This field is from variant [ResponseFileSearchToolCall].
 7808	Results   []ResponseFileSearchToolCallResult `json:"results"`
 7809	Arguments string                             `json:"arguments"`
 7810	CallID    string                             `json:"call_id"`
 7811	Name      string                             `json:"name"`
 7812	// This field is a union of [ResponseFunctionWebSearchActionUnion],
 7813	// [ResponseComputerToolCallActionUnion], [ResponseOutputItemLocalShellCallAction]
 7814	Action ResponseOutputItemUnionAction `json:"action"`
 7815	// This field is from variant [ResponseComputerToolCall].
 7816	PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck `json:"pending_safety_checks"`
 7817	// This field is from variant [ResponseReasoningItem].
 7818	Summary []ResponseReasoningItemSummary `json:"summary"`
 7819	// This field is from variant [ResponseReasoningItem].
 7820	EncryptedContent string `json:"encrypted_content"`
 7821	// This field is from variant [ResponseOutputItemImageGenerationCall].
 7822	Result string `json:"result"`
 7823	// This field is from variant [ResponseCodeInterpreterToolCall].
 7824	Code string `json:"code"`
 7825	// This field is from variant [ResponseCodeInterpreterToolCall].
 7826	ContainerID string `json:"container_id"`
 7827	// This field is from variant [ResponseCodeInterpreterToolCall].
 7828	Outputs     []ResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
 7829	ServerLabel string                                       `json:"server_label"`
 7830	Error       string                                       `json:"error"`
 7831	// This field is from variant [ResponseOutputItemMcpCall].
 7832	Output string `json:"output"`
 7833	// This field is from variant [ResponseOutputItemMcpListTools].
 7834	Tools []ResponseOutputItemMcpListToolsTool `json:"tools"`
 7835	JSON  struct {
 7836		ID                  respjson.Field
 7837		Content             respjson.Field
 7838		Role                respjson.Field
 7839		Status              respjson.Field
 7840		Type                respjson.Field
 7841		Queries             respjson.Field
 7842		Results             respjson.Field
 7843		Arguments           respjson.Field
 7844		CallID              respjson.Field
 7845		Name                respjson.Field
 7846		Action              respjson.Field
 7847		PendingSafetyChecks respjson.Field
 7848		Summary             respjson.Field
 7849		EncryptedContent    respjson.Field
 7850		Result              respjson.Field
 7851		Code                respjson.Field
 7852		ContainerID         respjson.Field
 7853		Outputs             respjson.Field
 7854		ServerLabel         respjson.Field
 7855		Error               respjson.Field
 7856		Output              respjson.Field
 7857		Tools               respjson.Field
 7858		raw                 string
 7859	} `json:"-"`
 7860}
 7861
 7862// anyResponseOutputItem is implemented by each variant of
 7863// [ResponseOutputItemUnion] to add type safety for the return type of
 7864// [ResponseOutputItemUnion.AsAny]
 7865type anyResponseOutputItem interface {
 7866	implResponseOutputItemUnion()
 7867}
 7868
 7869func (ResponseOutputMessage) implResponseOutputItemUnion()                 {}
 7870func (ResponseFileSearchToolCall) implResponseOutputItemUnion()            {}
 7871func (ResponseFunctionToolCall) implResponseOutputItemUnion()              {}
 7872func (ResponseFunctionWebSearch) implResponseOutputItemUnion()             {}
 7873func (ResponseComputerToolCall) implResponseOutputItemUnion()              {}
 7874func (ResponseReasoningItem) implResponseOutputItemUnion()                 {}
 7875func (ResponseOutputItemImageGenerationCall) implResponseOutputItemUnion() {}
 7876func (ResponseCodeInterpreterToolCall) implResponseOutputItemUnion()       {}
 7877func (ResponseOutputItemLocalShellCall) implResponseOutputItemUnion()      {}
 7878func (ResponseOutputItemMcpCall) implResponseOutputItemUnion()             {}
 7879func (ResponseOutputItemMcpListTools) implResponseOutputItemUnion()        {}
 7880func (ResponseOutputItemMcpApprovalRequest) implResponseOutputItemUnion()  {}
 7881
 7882// Use the following switch statement to find the correct variant
 7883//
 7884//	switch variant := ResponseOutputItemUnion.AsAny().(type) {
 7885//	case responses.ResponseOutputMessage:
 7886//	case responses.ResponseFileSearchToolCall:
 7887//	case responses.ResponseFunctionToolCall:
 7888//	case responses.ResponseFunctionWebSearch:
 7889//	case responses.ResponseComputerToolCall:
 7890//	case responses.ResponseReasoningItem:
 7891//	case responses.ResponseOutputItemImageGenerationCall:
 7892//	case responses.ResponseCodeInterpreterToolCall:
 7893//	case responses.ResponseOutputItemLocalShellCall:
 7894//	case responses.ResponseOutputItemMcpCall:
 7895//	case responses.ResponseOutputItemMcpListTools:
 7896//	case responses.ResponseOutputItemMcpApprovalRequest:
 7897//	default:
 7898//	  fmt.Errorf("no variant present")
 7899//	}
 7900func (u ResponseOutputItemUnion) AsAny() anyResponseOutputItem {
 7901	switch u.Type {
 7902	case "message":
 7903		return u.AsMessage()
 7904	case "file_search_call":
 7905		return u.AsFileSearchCall()
 7906	case "function_call":
 7907		return u.AsFunctionCall()
 7908	case "web_search_call":
 7909		return u.AsWebSearchCall()
 7910	case "computer_call":
 7911		return u.AsComputerCall()
 7912	case "reasoning":
 7913		return u.AsReasoning()
 7914	case "image_generation_call":
 7915		return u.AsImageGenerationCall()
 7916	case "code_interpreter_call":
 7917		return u.AsCodeInterpreterCall()
 7918	case "local_shell_call":
 7919		return u.AsLocalShellCall()
 7920	case "mcp_call":
 7921		return u.AsMcpCall()
 7922	case "mcp_list_tools":
 7923		return u.AsMcpListTools()
 7924	case "mcp_approval_request":
 7925		return u.AsMcpApprovalRequest()
 7926	}
 7927	return nil
 7928}
 7929
 7930func (u ResponseOutputItemUnion) AsMessage() (v ResponseOutputMessage) {
 7931	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7932	return
 7933}
 7934
 7935func (u ResponseOutputItemUnion) AsFileSearchCall() (v ResponseFileSearchToolCall) {
 7936	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7937	return
 7938}
 7939
 7940func (u ResponseOutputItemUnion) AsFunctionCall() (v ResponseFunctionToolCall) {
 7941	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7942	return
 7943}
 7944
 7945func (u ResponseOutputItemUnion) AsWebSearchCall() (v ResponseFunctionWebSearch) {
 7946	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7947	return
 7948}
 7949
 7950func (u ResponseOutputItemUnion) AsComputerCall() (v ResponseComputerToolCall) {
 7951	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7952	return
 7953}
 7954
 7955func (u ResponseOutputItemUnion) AsReasoning() (v ResponseReasoningItem) {
 7956	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7957	return
 7958}
 7959
 7960func (u ResponseOutputItemUnion) AsImageGenerationCall() (v ResponseOutputItemImageGenerationCall) {
 7961	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7962	return
 7963}
 7964
 7965func (u ResponseOutputItemUnion) AsCodeInterpreterCall() (v ResponseCodeInterpreterToolCall) {
 7966	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7967	return
 7968}
 7969
 7970func (u ResponseOutputItemUnion) AsLocalShellCall() (v ResponseOutputItemLocalShellCall) {
 7971	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7972	return
 7973}
 7974
 7975func (u ResponseOutputItemUnion) AsMcpCall() (v ResponseOutputItemMcpCall) {
 7976	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7977	return
 7978}
 7979
 7980func (u ResponseOutputItemUnion) AsMcpListTools() (v ResponseOutputItemMcpListTools) {
 7981	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7982	return
 7983}
 7984
 7985func (u ResponseOutputItemUnion) AsMcpApprovalRequest() (v ResponseOutputItemMcpApprovalRequest) {
 7986	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 7987	return
 7988}
 7989
 7990// Returns the unmodified JSON received from the API
 7991func (u ResponseOutputItemUnion) RawJSON() string { return u.JSON.raw }
 7992
 7993func (r *ResponseOutputItemUnion) UnmarshalJSON(data []byte) error {
 7994	return apijson.UnmarshalRoot(data, r)
 7995}
 7996
 7997// ResponseOutputItemUnionAction is an implicit subunion of
 7998// [ResponseOutputItemUnion]. ResponseOutputItemUnionAction provides convenient
 7999// access to the sub-properties of the union.
 8000//
 8001// For type safety it is recommended to directly use a variant of the
 8002// [ResponseOutputItemUnion].
 8003type ResponseOutputItemUnionAction struct {
 8004	// This field is from variant [ResponseFunctionWebSearchActionUnion].
 8005	Query string `json:"query"`
 8006	Type  string `json:"type"`
 8007	URL   string `json:"url"`
 8008	// This field is from variant [ResponseFunctionWebSearchActionUnion].
 8009	Pattern string `json:"pattern"`
 8010	// This field is from variant [ResponseComputerToolCallActionUnion].
 8011	Button string `json:"button"`
 8012	X      int64  `json:"x"`
 8013	Y      int64  `json:"y"`
 8014	// This field is from variant [ResponseComputerToolCallActionUnion].
 8015	Path []ResponseComputerToolCallActionDragPath `json:"path"`
 8016	// This field is from variant [ResponseComputerToolCallActionUnion].
 8017	Keys []string `json:"keys"`
 8018	// This field is from variant [ResponseComputerToolCallActionUnion].
 8019	ScrollX int64 `json:"scroll_x"`
 8020	// This field is from variant [ResponseComputerToolCallActionUnion].
 8021	ScrollY int64 `json:"scroll_y"`
 8022	// This field is from variant [ResponseComputerToolCallActionUnion].
 8023	Text string `json:"text"`
 8024	// This field is from variant [ResponseOutputItemLocalShellCallAction].
 8025	Command []string `json:"command"`
 8026	// This field is from variant [ResponseOutputItemLocalShellCallAction].
 8027	Env map[string]string `json:"env"`
 8028	// This field is from variant [ResponseOutputItemLocalShellCallAction].
 8029	TimeoutMs int64 `json:"timeout_ms"`
 8030	// This field is from variant [ResponseOutputItemLocalShellCallAction].
 8031	User string `json:"user"`
 8032	// This field is from variant [ResponseOutputItemLocalShellCallAction].
 8033	WorkingDirectory string `json:"working_directory"`
 8034	JSON             struct {
 8035		Query            respjson.Field
 8036		Type             respjson.Field
 8037		URL              respjson.Field
 8038		Pattern          respjson.Field
 8039		Button           respjson.Field
 8040		X                respjson.Field
 8041		Y                respjson.Field
 8042		Path             respjson.Field
 8043		Keys             respjson.Field
 8044		ScrollX          respjson.Field
 8045		ScrollY          respjson.Field
 8046		Text             respjson.Field
 8047		Command          respjson.Field
 8048		Env              respjson.Field
 8049		TimeoutMs        respjson.Field
 8050		User             respjson.Field
 8051		WorkingDirectory respjson.Field
 8052		raw              string
 8053	} `json:"-"`
 8054}
 8055
 8056func (r *ResponseOutputItemUnionAction) UnmarshalJSON(data []byte) error {
 8057	return apijson.UnmarshalRoot(data, r)
 8058}
 8059
 8060// An image generation request made by the model.
 8061type ResponseOutputItemImageGenerationCall struct {
 8062	// The unique ID of the image generation call.
 8063	ID string `json:"id,required"`
 8064	// The generated image encoded in base64.
 8065	Result string `json:"result,required"`
 8066	// The status of the image generation call.
 8067	//
 8068	// Any of "in_progress", "completed", "generating", "failed".
 8069	Status string `json:"status,required"`
 8070	// The type of the image generation call. Always `image_generation_call`.
 8071	Type constant.ImageGenerationCall `json:"type,required"`
 8072	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 8073	JSON struct {
 8074		ID          respjson.Field
 8075		Result      respjson.Field
 8076		Status      respjson.Field
 8077		Type        respjson.Field
 8078		ExtraFields map[string]respjson.Field
 8079		raw         string
 8080	} `json:"-"`
 8081}
 8082
 8083// Returns the unmodified JSON received from the API
 8084func (r ResponseOutputItemImageGenerationCall) RawJSON() string { return r.JSON.raw }
 8085func (r *ResponseOutputItemImageGenerationCall) UnmarshalJSON(data []byte) error {
 8086	return apijson.UnmarshalRoot(data, r)
 8087}
 8088
 8089// A tool call to run a command on the local shell.
 8090type ResponseOutputItemLocalShellCall struct {
 8091	// The unique ID of the local shell call.
 8092	ID string `json:"id,required"`
 8093	// Execute a shell command on the server.
 8094	Action ResponseOutputItemLocalShellCallAction `json:"action,required"`
 8095	// The unique ID of the local shell tool call generated by the model.
 8096	CallID string `json:"call_id,required"`
 8097	// The status of the local shell call.
 8098	//
 8099	// Any of "in_progress", "completed", "incomplete".
 8100	Status string `json:"status,required"`
 8101	// The type of the local shell call. Always `local_shell_call`.
 8102	Type constant.LocalShellCall `json:"type,required"`
 8103	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 8104	JSON struct {
 8105		ID          respjson.Field
 8106		Action      respjson.Field
 8107		CallID      respjson.Field
 8108		Status      respjson.Field
 8109		Type        respjson.Field
 8110		ExtraFields map[string]respjson.Field
 8111		raw         string
 8112	} `json:"-"`
 8113}
 8114
 8115// Returns the unmodified JSON received from the API
 8116func (r ResponseOutputItemLocalShellCall) RawJSON() string { return r.JSON.raw }
 8117func (r *ResponseOutputItemLocalShellCall) UnmarshalJSON(data []byte) error {
 8118	return apijson.UnmarshalRoot(data, r)
 8119}
 8120
 8121// Execute a shell command on the server.
 8122type ResponseOutputItemLocalShellCallAction struct {
 8123	// The command to run.
 8124	Command []string `json:"command,required"`
 8125	// Environment variables to set for the command.
 8126	Env map[string]string `json:"env,required"`
 8127	// The type of the local shell action. Always `exec`.
 8128	Type constant.Exec `json:"type,required"`
 8129	// Optional timeout in milliseconds for the command.
 8130	TimeoutMs int64 `json:"timeout_ms,nullable"`
 8131	// Optional user to run the command as.
 8132	User string `json:"user,nullable"`
 8133	// Optional working directory to run the command in.
 8134	WorkingDirectory string `json:"working_directory,nullable"`
 8135	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 8136	JSON struct {
 8137		Command          respjson.Field
 8138		Env              respjson.Field
 8139		Type             respjson.Field
 8140		TimeoutMs        respjson.Field
 8141		User             respjson.Field
 8142		WorkingDirectory respjson.Field
 8143		ExtraFields      map[string]respjson.Field
 8144		raw              string
 8145	} `json:"-"`
 8146}
 8147
 8148// Returns the unmodified JSON received from the API
 8149func (r ResponseOutputItemLocalShellCallAction) RawJSON() string { return r.JSON.raw }
 8150func (r *ResponseOutputItemLocalShellCallAction) UnmarshalJSON(data []byte) error {
 8151	return apijson.UnmarshalRoot(data, r)
 8152}
 8153
 8154// An invocation of a tool on an MCP server.
 8155type ResponseOutputItemMcpCall struct {
 8156	// The unique ID of the tool call.
 8157	ID string `json:"id,required"`
 8158	// A JSON string of the arguments passed to the tool.
 8159	Arguments string `json:"arguments,required"`
 8160	// The name of the tool that was run.
 8161	Name string `json:"name,required"`
 8162	// The label of the MCP server running the tool.
 8163	ServerLabel string `json:"server_label,required"`
 8164	// The type of the item. Always `mcp_call`.
 8165	Type constant.McpCall `json:"type,required"`
 8166	// The error from the tool call, if any.
 8167	Error string `json:"error,nullable"`
 8168	// The output from the tool call.
 8169	Output string `json:"output,nullable"`
 8170	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 8171	JSON struct {
 8172		ID          respjson.Field
 8173		Arguments   respjson.Field
 8174		Name        respjson.Field
 8175		ServerLabel respjson.Field
 8176		Type        respjson.Field
 8177		Error       respjson.Field
 8178		Output      respjson.Field
 8179		ExtraFields map[string]respjson.Field
 8180		raw         string
 8181	} `json:"-"`
 8182}
 8183
 8184// Returns the unmodified JSON received from the API
 8185func (r ResponseOutputItemMcpCall) RawJSON() string { return r.JSON.raw }
 8186func (r *ResponseOutputItemMcpCall) UnmarshalJSON(data []byte) error {
 8187	return apijson.UnmarshalRoot(data, r)
 8188}
 8189
 8190// A list of tools available on an MCP server.
 8191type ResponseOutputItemMcpListTools struct {
 8192	// The unique ID of the list.
 8193	ID string `json:"id,required"`
 8194	// The label of the MCP server.
 8195	ServerLabel string `json:"server_label,required"`
 8196	// The tools available on the server.
 8197	Tools []ResponseOutputItemMcpListToolsTool `json:"tools,required"`
 8198	// The type of the item. Always `mcp_list_tools`.
 8199	Type constant.McpListTools `json:"type,required"`
 8200	// Error message if the server could not list tools.
 8201	Error string `json:"error,nullable"`
 8202	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 8203	JSON struct {
 8204		ID          respjson.Field
 8205		ServerLabel respjson.Field
 8206		Tools       respjson.Field
 8207		Type        respjson.Field
 8208		Error       respjson.Field
 8209		ExtraFields map[string]respjson.Field
 8210		raw         string
 8211	} `json:"-"`
 8212}
 8213
 8214// Returns the unmodified JSON received from the API
 8215func (r ResponseOutputItemMcpListTools) RawJSON() string { return r.JSON.raw }
 8216func (r *ResponseOutputItemMcpListTools) UnmarshalJSON(data []byte) error {
 8217	return apijson.UnmarshalRoot(data, r)
 8218}
 8219
 8220// A tool available on an MCP server.
 8221type ResponseOutputItemMcpListToolsTool struct {
 8222	// The JSON schema describing the tool's input.
 8223	InputSchema any `json:"input_schema,required"`
 8224	// The name of the tool.
 8225	Name string `json:"name,required"`
 8226	// Additional annotations about the tool.
 8227	Annotations any `json:"annotations,nullable"`
 8228	// The description of the tool.
 8229	Description string `json:"description,nullable"`
 8230	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 8231	JSON struct {
 8232		InputSchema respjson.Field
 8233		Name        respjson.Field
 8234		Annotations respjson.Field
 8235		Description respjson.Field
 8236		ExtraFields map[string]respjson.Field
 8237		raw         string
 8238	} `json:"-"`
 8239}
 8240
 8241// Returns the unmodified JSON received from the API
 8242func (r ResponseOutputItemMcpListToolsTool) RawJSON() string { return r.JSON.raw }
 8243func (r *ResponseOutputItemMcpListToolsTool) UnmarshalJSON(data []byte) error {
 8244	return apijson.UnmarshalRoot(data, r)
 8245}
 8246
 8247// A request for human approval of a tool invocation.
 8248type ResponseOutputItemMcpApprovalRequest struct {
 8249	// The unique ID of the approval request.
 8250	ID string `json:"id,required"`
 8251	// A JSON string of arguments for the tool.
 8252	Arguments string `json:"arguments,required"`
 8253	// The name of the tool to run.
 8254	Name string `json:"name,required"`
 8255	// The label of the MCP server making the request.
 8256	ServerLabel string `json:"server_label,required"`
 8257	// The type of the item. Always `mcp_approval_request`.
 8258	Type constant.McpApprovalRequest `json:"type,required"`
 8259	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 8260	JSON struct {
 8261		ID          respjson.Field
 8262		Arguments   respjson.Field
 8263		Name        respjson.Field
 8264		ServerLabel respjson.Field
 8265		Type        respjson.Field
 8266		ExtraFields map[string]respjson.Field
 8267		raw         string
 8268	} `json:"-"`
 8269}
 8270
 8271// Returns the unmodified JSON received from the API
 8272func (r ResponseOutputItemMcpApprovalRequest) RawJSON() string { return r.JSON.raw }
 8273func (r *ResponseOutputItemMcpApprovalRequest) UnmarshalJSON(data []byte) error {
 8274	return apijson.UnmarshalRoot(data, r)
 8275}
 8276
 8277// Emitted when a new output item is added.
 8278type ResponseOutputItemAddedEvent struct {
 8279	// The output item that was added.
 8280	Item ResponseOutputItemUnion `json:"item,required"`
 8281	// The index of the output item that was added.
 8282	OutputIndex int64 `json:"output_index,required"`
 8283	// The sequence number of this event.
 8284	SequenceNumber int64 `json:"sequence_number,required"`
 8285	// The type of the event. Always `response.output_item.added`.
 8286	Type constant.ResponseOutputItemAdded `json:"type,required"`
 8287	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 8288	JSON struct {
 8289		Item           respjson.Field
 8290		OutputIndex    respjson.Field
 8291		SequenceNumber respjson.Field
 8292		Type           respjson.Field
 8293		ExtraFields    map[string]respjson.Field
 8294		raw            string
 8295	} `json:"-"`
 8296}
 8297
 8298// Returns the unmodified JSON received from the API
 8299func (r ResponseOutputItemAddedEvent) RawJSON() string { return r.JSON.raw }
 8300func (r *ResponseOutputItemAddedEvent) UnmarshalJSON(data []byte) error {
 8301	return apijson.UnmarshalRoot(data, r)
 8302}
 8303
 8304// Emitted when an output item is marked done.
 8305type ResponseOutputItemDoneEvent struct {
 8306	// The output item that was marked done.
 8307	Item ResponseOutputItemUnion `json:"item,required"`
 8308	// The index of the output item that was marked done.
 8309	OutputIndex int64 `json:"output_index,required"`
 8310	// The sequence number of this event.
 8311	SequenceNumber int64 `json:"sequence_number,required"`
 8312	// The type of the event. Always `response.output_item.done`.
 8313	Type constant.ResponseOutputItemDone `json:"type,required"`
 8314	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 8315	JSON struct {
 8316		Item           respjson.Field
 8317		OutputIndex    respjson.Field
 8318		SequenceNumber respjson.Field
 8319		Type           respjson.Field
 8320		ExtraFields    map[string]respjson.Field
 8321		raw            string
 8322	} `json:"-"`
 8323}
 8324
 8325// Returns the unmodified JSON received from the API
 8326func (r ResponseOutputItemDoneEvent) RawJSON() string { return r.JSON.raw }
 8327func (r *ResponseOutputItemDoneEvent) UnmarshalJSON(data []byte) error {
 8328	return apijson.UnmarshalRoot(data, r)
 8329}
 8330
 8331// An output message from the model.
 8332type ResponseOutputMessage struct {
 8333	// The unique ID of the output message.
 8334	ID string `json:"id,required"`
 8335	// The content of the output message.
 8336	Content []ResponseOutputMessageContentUnion `json:"content,required"`
 8337	// The role of the output message. Always `assistant`.
 8338	Role constant.Assistant `json:"role,required"`
 8339	// The status of the message input. One of `in_progress`, `completed`, or
 8340	// `incomplete`. Populated when input items are returned via API.
 8341	//
 8342	// Any of "in_progress", "completed", "incomplete".
 8343	Status ResponseOutputMessageStatus `json:"status,required"`
 8344	// The type of the output message. Always `message`.
 8345	Type constant.Message `json:"type,required"`
 8346	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 8347	JSON struct {
 8348		ID          respjson.Field
 8349		Content     respjson.Field
 8350		Role        respjson.Field
 8351		Status      respjson.Field
 8352		Type        respjson.Field
 8353		ExtraFields map[string]respjson.Field
 8354		raw         string
 8355	} `json:"-"`
 8356}
 8357
 8358// Returns the unmodified JSON received from the API
 8359func (r ResponseOutputMessage) RawJSON() string { return r.JSON.raw }
 8360func (r *ResponseOutputMessage) UnmarshalJSON(data []byte) error {
 8361	return apijson.UnmarshalRoot(data, r)
 8362}
 8363
 8364// ToParam converts this ResponseOutputMessage to a ResponseOutputMessageParam.
 8365//
 8366// Warning: the fields of the param type will not be present. ToParam should only
 8367// be used at the last possible moment before sending a request. Test for this with
 8368// ResponseOutputMessageParam.Overrides()
 8369func (r ResponseOutputMessage) ToParam() ResponseOutputMessageParam {
 8370	return param.Override[ResponseOutputMessageParam](json.RawMessage(r.RawJSON()))
 8371}
 8372
 8373// ResponseOutputMessageContentUnion contains all possible properties and values
 8374// from [ResponseOutputText], [ResponseOutputRefusal].
 8375//
 8376// Use the [ResponseOutputMessageContentUnion.AsAny] method to switch on the
 8377// variant.
 8378//
 8379// Use the methods beginning with 'As' to cast the union to one of its variants.
 8380type ResponseOutputMessageContentUnion struct {
 8381	// This field is from variant [ResponseOutputText].
 8382	Annotations []ResponseOutputTextAnnotationUnion `json:"annotations"`
 8383	// This field is from variant [ResponseOutputText].
 8384	Text string `json:"text"`
 8385	// Any of "output_text", "refusal".
 8386	Type string `json:"type"`
 8387	// This field is from variant [ResponseOutputText].
 8388	Logprobs []ResponseOutputTextLogprob `json:"logprobs"`
 8389	// This field is from variant [ResponseOutputRefusal].
 8390	Refusal string `json:"refusal"`
 8391	JSON    struct {
 8392		Annotations respjson.Field
 8393		Text        respjson.Field
 8394		Type        respjson.Field
 8395		Logprobs    respjson.Field
 8396		Refusal     respjson.Field
 8397		raw         string
 8398	} `json:"-"`
 8399}
 8400
 8401// anyResponseOutputMessageContent is implemented by each variant of
 8402// [ResponseOutputMessageContentUnion] to add type safety for the return type of
 8403// [ResponseOutputMessageContentUnion.AsAny]
 8404type anyResponseOutputMessageContent interface {
 8405	implResponseOutputMessageContentUnion()
 8406}
 8407
 8408func (ResponseOutputText) implResponseOutputMessageContentUnion()    {}
 8409func (ResponseOutputRefusal) implResponseOutputMessageContentUnion() {}
 8410
 8411// Use the following switch statement to find the correct variant
 8412//
 8413//	switch variant := ResponseOutputMessageContentUnion.AsAny().(type) {
 8414//	case responses.ResponseOutputText:
 8415//	case responses.ResponseOutputRefusal:
 8416//	default:
 8417//	  fmt.Errorf("no variant present")
 8418//	}
 8419func (u ResponseOutputMessageContentUnion) AsAny() anyResponseOutputMessageContent {
 8420	switch u.Type {
 8421	case "output_text":
 8422		return u.AsOutputText()
 8423	case "refusal":
 8424		return u.AsRefusal()
 8425	}
 8426	return nil
 8427}
 8428
 8429func (u ResponseOutputMessageContentUnion) AsOutputText() (v ResponseOutputText) {
 8430	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 8431	return
 8432}
 8433
 8434func (u ResponseOutputMessageContentUnion) AsRefusal() (v ResponseOutputRefusal) {
 8435	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 8436	return
 8437}
 8438
 8439// Returns the unmodified JSON received from the API
 8440func (u ResponseOutputMessageContentUnion) RawJSON() string { return u.JSON.raw }
 8441
 8442func (r *ResponseOutputMessageContentUnion) UnmarshalJSON(data []byte) error {
 8443	return apijson.UnmarshalRoot(data, r)
 8444}
 8445
 8446// The status of the message input. One of `in_progress`, `completed`, or
 8447// `incomplete`. Populated when input items are returned via API.
 8448type ResponseOutputMessageStatus string
 8449
 8450const (
 8451	ResponseOutputMessageStatusInProgress ResponseOutputMessageStatus = "in_progress"
 8452	ResponseOutputMessageStatusCompleted  ResponseOutputMessageStatus = "completed"
 8453	ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete"
 8454)
 8455
 8456// An output message from the model.
 8457//
 8458// The properties ID, Content, Role, Status, Type are required.
 8459type ResponseOutputMessageParam struct {
 8460	// The unique ID of the output message.
 8461	ID string `json:"id,omitzero,required"`
 8462	// The content of the output message.
 8463	Content []ResponseOutputMessageContentUnionParam `json:"content,omitzero,required"`
 8464	// The status of the message input. One of `in_progress`, `completed`, or
 8465	// `incomplete`. Populated when input items are returned via API.
 8466	//
 8467	// Any of "in_progress", "completed", "incomplete".
 8468	Status ResponseOutputMessageStatus `json:"status,omitzero,required"`
 8469	// The role of the output message. Always `assistant`.
 8470	//
 8471	// This field can be elided, and will marshal its zero value as "assistant".
 8472	Role constant.Assistant `json:"role,required"`
 8473	// The type of the output message. Always `message`.
 8474	//
 8475	// This field can be elided, and will marshal its zero value as "message".
 8476	Type constant.Message `json:"type,required"`
 8477	paramObj
 8478}
 8479
 8480func (r ResponseOutputMessageParam) MarshalJSON() (data []byte, err error) {
 8481	type shadow ResponseOutputMessageParam
 8482	return param.MarshalObject(r, (*shadow)(&r))
 8483}
 8484func (r *ResponseOutputMessageParam) UnmarshalJSON(data []byte) error {
 8485	return apijson.UnmarshalRoot(data, r)
 8486}
 8487
 8488// Only one field can be non-zero.
 8489//
 8490// Use [param.IsOmitted] to confirm if a field is set.
 8491type ResponseOutputMessageContentUnionParam struct {
 8492	OfOutputText *ResponseOutputTextParam    `json:",omitzero,inline"`
 8493	OfRefusal    *ResponseOutputRefusalParam `json:",omitzero,inline"`
 8494	paramUnion
 8495}
 8496
 8497func (u ResponseOutputMessageContentUnionParam) MarshalJSON() ([]byte, error) {
 8498	return param.MarshalUnion(u, u.OfOutputText, u.OfRefusal)
 8499}
 8500func (u *ResponseOutputMessageContentUnionParam) UnmarshalJSON(data []byte) error {
 8501	return apijson.UnmarshalRoot(data, u)
 8502}
 8503
 8504func (u *ResponseOutputMessageContentUnionParam) asAny() any {
 8505	if !param.IsOmitted(u.OfOutputText) {
 8506		return u.OfOutputText
 8507	} else if !param.IsOmitted(u.OfRefusal) {
 8508		return u.OfRefusal
 8509	}
 8510	return nil
 8511}
 8512
 8513// Returns a pointer to the underlying variant's property, if present.
 8514func (u ResponseOutputMessageContentUnionParam) GetAnnotations() []ResponseOutputTextAnnotationUnionParam {
 8515	if vt := u.OfOutputText; vt != nil {
 8516		return vt.Annotations
 8517	}
 8518	return nil
 8519}
 8520
 8521// Returns a pointer to the underlying variant's property, if present.
 8522func (u ResponseOutputMessageContentUnionParam) GetText() *string {
 8523	if vt := u.OfOutputText; vt != nil {
 8524		return &vt.Text
 8525	}
 8526	return nil
 8527}
 8528
 8529// Returns a pointer to the underlying variant's property, if present.
 8530func (u ResponseOutputMessageContentUnionParam) GetLogprobs() []ResponseOutputTextLogprobParam {
 8531	if vt := u.OfOutputText; vt != nil {
 8532		return vt.Logprobs
 8533	}
 8534	return nil
 8535}
 8536
 8537// Returns a pointer to the underlying variant's property, if present.
 8538func (u ResponseOutputMessageContentUnionParam) GetRefusal() *string {
 8539	if vt := u.OfRefusal; vt != nil {
 8540		return &vt.Refusal
 8541	}
 8542	return nil
 8543}
 8544
 8545// Returns a pointer to the underlying variant's property, if present.
 8546func (u ResponseOutputMessageContentUnionParam) GetType() *string {
 8547	if vt := u.OfOutputText; vt != nil {
 8548		return (*string)(&vt.Type)
 8549	} else if vt := u.OfRefusal; vt != nil {
 8550		return (*string)(&vt.Type)
 8551	}
 8552	return nil
 8553}
 8554
 8555func init() {
 8556	apijson.RegisterUnion[ResponseOutputMessageContentUnionParam](
 8557		"type",
 8558		apijson.Discriminator[ResponseOutputTextParam]("output_text"),
 8559		apijson.Discriminator[ResponseOutputRefusalParam]("refusal"),
 8560	)
 8561}
 8562
 8563// A refusal from the model.
 8564type ResponseOutputRefusal struct {
 8565	// The refusal explanationfrom the model.
 8566	Refusal string `json:"refusal,required"`
 8567	// The type of the refusal. Always `refusal`.
 8568	Type constant.Refusal `json:"type,required"`
 8569	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 8570	JSON struct {
 8571		Refusal     respjson.Field
 8572		Type        respjson.Field
 8573		ExtraFields map[string]respjson.Field
 8574		raw         string
 8575	} `json:"-"`
 8576}
 8577
 8578// Returns the unmodified JSON received from the API
 8579func (r ResponseOutputRefusal) RawJSON() string { return r.JSON.raw }
 8580func (r *ResponseOutputRefusal) UnmarshalJSON(data []byte) error {
 8581	return apijson.UnmarshalRoot(data, r)
 8582}
 8583
 8584// ToParam converts this ResponseOutputRefusal to a ResponseOutputRefusalParam.
 8585//
 8586// Warning: the fields of the param type will not be present. ToParam should only
 8587// be used at the last possible moment before sending a request. Test for this with
 8588// ResponseOutputRefusalParam.Overrides()
 8589func (r ResponseOutputRefusal) ToParam() ResponseOutputRefusalParam {
 8590	return param.Override[ResponseOutputRefusalParam](json.RawMessage(r.RawJSON()))
 8591}
 8592
 8593// A refusal from the model.
 8594//
 8595// The properties Refusal, Type are required.
 8596type ResponseOutputRefusalParam struct {
 8597	// The refusal explanationfrom the model.
 8598	Refusal string `json:"refusal,required"`
 8599	// The type of the refusal. Always `refusal`.
 8600	//
 8601	// This field can be elided, and will marshal its zero value as "refusal".
 8602	Type constant.Refusal `json:"type,required"`
 8603	paramObj
 8604}
 8605
 8606func (r ResponseOutputRefusalParam) MarshalJSON() (data []byte, err error) {
 8607	type shadow ResponseOutputRefusalParam
 8608	return param.MarshalObject(r, (*shadow)(&r))
 8609}
 8610func (r *ResponseOutputRefusalParam) UnmarshalJSON(data []byte) error {
 8611	return apijson.UnmarshalRoot(data, r)
 8612}
 8613
 8614// A text output from the model.
 8615type ResponseOutputText struct {
 8616	// The annotations of the text output.
 8617	Annotations []ResponseOutputTextAnnotationUnion `json:"annotations,required"`
 8618	// The text output from the model.
 8619	Text string `json:"text,required"`
 8620	// The type of the output text. Always `output_text`.
 8621	Type     constant.OutputText         `json:"type,required"`
 8622	Logprobs []ResponseOutputTextLogprob `json:"logprobs"`
 8623	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 8624	JSON struct {
 8625		Annotations respjson.Field
 8626		Text        respjson.Field
 8627		Type        respjson.Field
 8628		Logprobs    respjson.Field
 8629		ExtraFields map[string]respjson.Field
 8630		raw         string
 8631	} `json:"-"`
 8632}
 8633
 8634// Returns the unmodified JSON received from the API
 8635func (r ResponseOutputText) RawJSON() string { return r.JSON.raw }
 8636func (r *ResponseOutputText) UnmarshalJSON(data []byte) error {
 8637	return apijson.UnmarshalRoot(data, r)
 8638}
 8639
 8640// ToParam converts this ResponseOutputText to a ResponseOutputTextParam.
 8641//
 8642// Warning: the fields of the param type will not be present. ToParam should only
 8643// be used at the last possible moment before sending a request. Test for this with
 8644// ResponseOutputTextParam.Overrides()
 8645func (r ResponseOutputText) ToParam() ResponseOutputTextParam {
 8646	return param.Override[ResponseOutputTextParam](json.RawMessage(r.RawJSON()))
 8647}
 8648
 8649// ResponseOutputTextAnnotationUnion contains all possible properties and values
 8650// from [ResponseOutputTextAnnotationFileCitation],
 8651// [ResponseOutputTextAnnotationURLCitation],
 8652// [ResponseOutputTextAnnotationContainerFileCitation],
 8653// [ResponseOutputTextAnnotationFilePath].
 8654//
 8655// Use the [ResponseOutputTextAnnotationUnion.AsAny] method to switch on the
 8656// variant.
 8657//
 8658// Use the methods beginning with 'As' to cast the union to one of its variants.
 8659type ResponseOutputTextAnnotationUnion struct {
 8660	FileID   string `json:"file_id"`
 8661	Filename string `json:"filename"`
 8662	Index    int64  `json:"index"`
 8663	// Any of "file_citation", "url_citation", "container_file_citation", "file_path".
 8664	Type       string `json:"type"`
 8665	EndIndex   int64  `json:"end_index"`
 8666	StartIndex int64  `json:"start_index"`
 8667	// This field is from variant [ResponseOutputTextAnnotationURLCitation].
 8668	Title string `json:"title"`
 8669	// This field is from variant [ResponseOutputTextAnnotationURLCitation].
 8670	URL string `json:"url"`
 8671	// This field is from variant [ResponseOutputTextAnnotationContainerFileCitation].
 8672	ContainerID string `json:"container_id"`
 8673	JSON        struct {
 8674		FileID      respjson.Field
 8675		Filename    respjson.Field
 8676		Index       respjson.Field
 8677		Type        respjson.Field
 8678		EndIndex    respjson.Field
 8679		StartIndex  respjson.Field
 8680		Title       respjson.Field
 8681		URL         respjson.Field
 8682		ContainerID respjson.Field
 8683		raw         string
 8684	} `json:"-"`
 8685}
 8686
 8687// anyResponseOutputTextAnnotation is implemented by each variant of
 8688// [ResponseOutputTextAnnotationUnion] to add type safety for the return type of
 8689// [ResponseOutputTextAnnotationUnion.AsAny]
 8690type anyResponseOutputTextAnnotation interface {
 8691	implResponseOutputTextAnnotationUnion()
 8692}
 8693
 8694func (ResponseOutputTextAnnotationFileCitation) implResponseOutputTextAnnotationUnion()          {}
 8695func (ResponseOutputTextAnnotationURLCitation) implResponseOutputTextAnnotationUnion()           {}
 8696func (ResponseOutputTextAnnotationContainerFileCitation) implResponseOutputTextAnnotationUnion() {}
 8697func (ResponseOutputTextAnnotationFilePath) implResponseOutputTextAnnotationUnion()              {}
 8698
 8699// Use the following switch statement to find the correct variant
 8700//
 8701//	switch variant := ResponseOutputTextAnnotationUnion.AsAny().(type) {
 8702//	case responses.ResponseOutputTextAnnotationFileCitation:
 8703//	case responses.ResponseOutputTextAnnotationURLCitation:
 8704//	case responses.ResponseOutputTextAnnotationContainerFileCitation:
 8705//	case responses.ResponseOutputTextAnnotationFilePath:
 8706//	default:
 8707//	  fmt.Errorf("no variant present")
 8708//	}
 8709func (u ResponseOutputTextAnnotationUnion) AsAny() anyResponseOutputTextAnnotation {
 8710	switch u.Type {
 8711	case "file_citation":
 8712		return u.AsFileCitation()
 8713	case "url_citation":
 8714		return u.AsURLCitation()
 8715	case "container_file_citation":
 8716		return u.AsContainerFileCitation()
 8717	case "file_path":
 8718		return u.AsFilePath()
 8719	}
 8720	return nil
 8721}
 8722
 8723func (u ResponseOutputTextAnnotationUnion) AsFileCitation() (v ResponseOutputTextAnnotationFileCitation) {
 8724	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 8725	return
 8726}
 8727
 8728func (u ResponseOutputTextAnnotationUnion) AsURLCitation() (v ResponseOutputTextAnnotationURLCitation) {
 8729	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 8730	return
 8731}
 8732
 8733func (u ResponseOutputTextAnnotationUnion) AsContainerFileCitation() (v ResponseOutputTextAnnotationContainerFileCitation) {
 8734	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 8735	return
 8736}
 8737
 8738func (u ResponseOutputTextAnnotationUnion) AsFilePath() (v ResponseOutputTextAnnotationFilePath) {
 8739	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 8740	return
 8741}
 8742
 8743// Returns the unmodified JSON received from the API
 8744func (u ResponseOutputTextAnnotationUnion) RawJSON() string { return u.JSON.raw }
 8745
 8746func (r *ResponseOutputTextAnnotationUnion) UnmarshalJSON(data []byte) error {
 8747	return apijson.UnmarshalRoot(data, r)
 8748}
 8749
 8750// A citation to a file.
 8751type ResponseOutputTextAnnotationFileCitation struct {
 8752	// The ID of the file.
 8753	FileID string `json:"file_id,required"`
 8754	// The filename of the file cited.
 8755	Filename string `json:"filename,required"`
 8756	// The index of the file in the list of files.
 8757	Index int64 `json:"index,required"`
 8758	// The type of the file citation. Always `file_citation`.
 8759	Type constant.FileCitation `json:"type,required"`
 8760	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 8761	JSON struct {
 8762		FileID      respjson.Field
 8763		Filename    respjson.Field
 8764		Index       respjson.Field
 8765		Type        respjson.Field
 8766		ExtraFields map[string]respjson.Field
 8767		raw         string
 8768	} `json:"-"`
 8769}
 8770
 8771// Returns the unmodified JSON received from the API
 8772func (r ResponseOutputTextAnnotationFileCitation) RawJSON() string { return r.JSON.raw }
 8773func (r *ResponseOutputTextAnnotationFileCitation) UnmarshalJSON(data []byte) error {
 8774	return apijson.UnmarshalRoot(data, r)
 8775}
 8776
 8777// A citation for a web resource used to generate a model response.
 8778type ResponseOutputTextAnnotationURLCitation struct {
 8779	// The index of the last character of the URL citation in the message.
 8780	EndIndex int64 `json:"end_index,required"`
 8781	// The index of the first character of the URL citation in the message.
 8782	StartIndex int64 `json:"start_index,required"`
 8783	// The title of the web resource.
 8784	Title string `json:"title,required"`
 8785	// The type of the URL citation. Always `url_citation`.
 8786	Type constant.URLCitation `json:"type,required"`
 8787	// The URL of the web resource.
 8788	URL string `json:"url,required"`
 8789	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 8790	JSON struct {
 8791		EndIndex    respjson.Field
 8792		StartIndex  respjson.Field
 8793		Title       respjson.Field
 8794		Type        respjson.Field
 8795		URL         respjson.Field
 8796		ExtraFields map[string]respjson.Field
 8797		raw         string
 8798	} `json:"-"`
 8799}
 8800
 8801// Returns the unmodified JSON received from the API
 8802func (r ResponseOutputTextAnnotationURLCitation) RawJSON() string { return r.JSON.raw }
 8803func (r *ResponseOutputTextAnnotationURLCitation) UnmarshalJSON(data []byte) error {
 8804	return apijson.UnmarshalRoot(data, r)
 8805}
 8806
 8807// A citation for a container file used to generate a model response.
 8808type ResponseOutputTextAnnotationContainerFileCitation struct {
 8809	// The ID of the container file.
 8810	ContainerID string `json:"container_id,required"`
 8811	// The index of the last character of the container file citation in the message.
 8812	EndIndex int64 `json:"end_index,required"`
 8813	// The ID of the file.
 8814	FileID string `json:"file_id,required"`
 8815	// The filename of the container file cited.
 8816	Filename string `json:"filename,required"`
 8817	// The index of the first character of the container file citation in the message.
 8818	StartIndex int64 `json:"start_index,required"`
 8819	// The type of the container file citation. Always `container_file_citation`.
 8820	Type constant.ContainerFileCitation `json:"type,required"`
 8821	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 8822	JSON struct {
 8823		ContainerID respjson.Field
 8824		EndIndex    respjson.Field
 8825		FileID      respjson.Field
 8826		Filename    respjson.Field
 8827		StartIndex  respjson.Field
 8828		Type        respjson.Field
 8829		ExtraFields map[string]respjson.Field
 8830		raw         string
 8831	} `json:"-"`
 8832}
 8833
 8834// Returns the unmodified JSON received from the API
 8835func (r ResponseOutputTextAnnotationContainerFileCitation) RawJSON() string { return r.JSON.raw }
 8836func (r *ResponseOutputTextAnnotationContainerFileCitation) UnmarshalJSON(data []byte) error {
 8837	return apijson.UnmarshalRoot(data, r)
 8838}
 8839
 8840// A path to a file.
 8841type ResponseOutputTextAnnotationFilePath struct {
 8842	// The ID of the file.
 8843	FileID string `json:"file_id,required"`
 8844	// The index of the file in the list of files.
 8845	Index int64 `json:"index,required"`
 8846	// The type of the file path. Always `file_path`.
 8847	Type constant.FilePath `json:"type,required"`
 8848	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 8849	JSON struct {
 8850		FileID      respjson.Field
 8851		Index       respjson.Field
 8852		Type        respjson.Field
 8853		ExtraFields map[string]respjson.Field
 8854		raw         string
 8855	} `json:"-"`
 8856}
 8857
 8858// Returns the unmodified JSON received from the API
 8859func (r ResponseOutputTextAnnotationFilePath) RawJSON() string { return r.JSON.raw }
 8860func (r *ResponseOutputTextAnnotationFilePath) UnmarshalJSON(data []byte) error {
 8861	return apijson.UnmarshalRoot(data, r)
 8862}
 8863
 8864// The log probability of a token.
 8865type ResponseOutputTextLogprob struct {
 8866	Token       string                                `json:"token,required"`
 8867	Bytes       []int64                               `json:"bytes,required"`
 8868	Logprob     float64                               `json:"logprob,required"`
 8869	TopLogprobs []ResponseOutputTextLogprobTopLogprob `json:"top_logprobs,required"`
 8870	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 8871	JSON struct {
 8872		Token       respjson.Field
 8873		Bytes       respjson.Field
 8874		Logprob     respjson.Field
 8875		TopLogprobs respjson.Field
 8876		ExtraFields map[string]respjson.Field
 8877		raw         string
 8878	} `json:"-"`
 8879}
 8880
 8881// Returns the unmodified JSON received from the API
 8882func (r ResponseOutputTextLogprob) RawJSON() string { return r.JSON.raw }
 8883func (r *ResponseOutputTextLogprob) UnmarshalJSON(data []byte) error {
 8884	return apijson.UnmarshalRoot(data, r)
 8885}
 8886
 8887// The top log probability of a token.
 8888type ResponseOutputTextLogprobTopLogprob struct {
 8889	Token   string  `json:"token,required"`
 8890	Bytes   []int64 `json:"bytes,required"`
 8891	Logprob float64 `json:"logprob,required"`
 8892	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 8893	JSON struct {
 8894		Token       respjson.Field
 8895		Bytes       respjson.Field
 8896		Logprob     respjson.Field
 8897		ExtraFields map[string]respjson.Field
 8898		raw         string
 8899	} `json:"-"`
 8900}
 8901
 8902// Returns the unmodified JSON received from the API
 8903func (r ResponseOutputTextLogprobTopLogprob) RawJSON() string { return r.JSON.raw }
 8904func (r *ResponseOutputTextLogprobTopLogprob) UnmarshalJSON(data []byte) error {
 8905	return apijson.UnmarshalRoot(data, r)
 8906}
 8907
 8908// A text output from the model.
 8909//
 8910// The properties Annotations, Text, Type are required.
 8911type ResponseOutputTextParam struct {
 8912	// The annotations of the text output.
 8913	Annotations []ResponseOutputTextAnnotationUnionParam `json:"annotations,omitzero,required"`
 8914	// The text output from the model.
 8915	Text     string                           `json:"text,required"`
 8916	Logprobs []ResponseOutputTextLogprobParam `json:"logprobs,omitzero"`
 8917	// The type of the output text. Always `output_text`.
 8918	//
 8919	// This field can be elided, and will marshal its zero value as "output_text".
 8920	Type constant.OutputText `json:"type,required"`
 8921	paramObj
 8922}
 8923
 8924func (r ResponseOutputTextParam) MarshalJSON() (data []byte, err error) {
 8925	type shadow ResponseOutputTextParam
 8926	return param.MarshalObject(r, (*shadow)(&r))
 8927}
 8928func (r *ResponseOutputTextParam) UnmarshalJSON(data []byte) error {
 8929	return apijson.UnmarshalRoot(data, r)
 8930}
 8931
 8932// Only one field can be non-zero.
 8933//
 8934// Use [param.IsOmitted] to confirm if a field is set.
 8935type ResponseOutputTextAnnotationUnionParam struct {
 8936	OfFileCitation          *ResponseOutputTextAnnotationFileCitationParam          `json:",omitzero,inline"`
 8937	OfURLCitation           *ResponseOutputTextAnnotationURLCitationParam           `json:",omitzero,inline"`
 8938	OfContainerFileCitation *ResponseOutputTextAnnotationContainerFileCitationParam `json:",omitzero,inline"`
 8939	OfFilePath              *ResponseOutputTextAnnotationFilePathParam              `json:",omitzero,inline"`
 8940	paramUnion
 8941}
 8942
 8943func (u ResponseOutputTextAnnotationUnionParam) MarshalJSON() ([]byte, error) {
 8944	return param.MarshalUnion(u, u.OfFileCitation, u.OfURLCitation, u.OfContainerFileCitation, u.OfFilePath)
 8945}
 8946func (u *ResponseOutputTextAnnotationUnionParam) UnmarshalJSON(data []byte) error {
 8947	return apijson.UnmarshalRoot(data, u)
 8948}
 8949
 8950func (u *ResponseOutputTextAnnotationUnionParam) asAny() any {
 8951	if !param.IsOmitted(u.OfFileCitation) {
 8952		return u.OfFileCitation
 8953	} else if !param.IsOmitted(u.OfURLCitation) {
 8954		return u.OfURLCitation
 8955	} else if !param.IsOmitted(u.OfContainerFileCitation) {
 8956		return u.OfContainerFileCitation
 8957	} else if !param.IsOmitted(u.OfFilePath) {
 8958		return u.OfFilePath
 8959	}
 8960	return nil
 8961}
 8962
 8963// Returns a pointer to the underlying variant's property, if present.
 8964func (u ResponseOutputTextAnnotationUnionParam) GetTitle() *string {
 8965	if vt := u.OfURLCitation; vt != nil {
 8966		return &vt.Title
 8967	}
 8968	return nil
 8969}
 8970
 8971// Returns a pointer to the underlying variant's property, if present.
 8972func (u ResponseOutputTextAnnotationUnionParam) GetURL() *string {
 8973	if vt := u.OfURLCitation; vt != nil {
 8974		return &vt.URL
 8975	}
 8976	return nil
 8977}
 8978
 8979// Returns a pointer to the underlying variant's property, if present.
 8980func (u ResponseOutputTextAnnotationUnionParam) GetContainerID() *string {
 8981	if vt := u.OfContainerFileCitation; vt != nil {
 8982		return &vt.ContainerID
 8983	}
 8984	return nil
 8985}
 8986
 8987// Returns a pointer to the underlying variant's property, if present.
 8988func (u ResponseOutputTextAnnotationUnionParam) GetFileID() *string {
 8989	if vt := u.OfFileCitation; vt != nil {
 8990		return (*string)(&vt.FileID)
 8991	} else if vt := u.OfContainerFileCitation; vt != nil {
 8992		return (*string)(&vt.FileID)
 8993	} else if vt := u.OfFilePath; vt != nil {
 8994		return (*string)(&vt.FileID)
 8995	}
 8996	return nil
 8997}
 8998
 8999// Returns a pointer to the underlying variant's property, if present.
 9000func (u ResponseOutputTextAnnotationUnionParam) GetFilename() *string {
 9001	if vt := u.OfFileCitation; vt != nil {
 9002		return (*string)(&vt.Filename)
 9003	} else if vt := u.OfContainerFileCitation; vt != nil {
 9004		return (*string)(&vt.Filename)
 9005	}
 9006	return nil
 9007}
 9008
 9009// Returns a pointer to the underlying variant's property, if present.
 9010func (u ResponseOutputTextAnnotationUnionParam) GetIndex() *int64 {
 9011	if vt := u.OfFileCitation; vt != nil {
 9012		return (*int64)(&vt.Index)
 9013	} else if vt := u.OfFilePath; vt != nil {
 9014		return (*int64)(&vt.Index)
 9015	}
 9016	return nil
 9017}
 9018
 9019// Returns a pointer to the underlying variant's property, if present.
 9020func (u ResponseOutputTextAnnotationUnionParam) GetType() *string {
 9021	if vt := u.OfFileCitation; vt != nil {
 9022		return (*string)(&vt.Type)
 9023	} else if vt := u.OfURLCitation; vt != nil {
 9024		return (*string)(&vt.Type)
 9025	} else if vt := u.OfContainerFileCitation; vt != nil {
 9026		return (*string)(&vt.Type)
 9027	} else if vt := u.OfFilePath; vt != nil {
 9028		return (*string)(&vt.Type)
 9029	}
 9030	return nil
 9031}
 9032
 9033// Returns a pointer to the underlying variant's property, if present.
 9034func (u ResponseOutputTextAnnotationUnionParam) GetEndIndex() *int64 {
 9035	if vt := u.OfURLCitation; vt != nil {
 9036		return (*int64)(&vt.EndIndex)
 9037	} else if vt := u.OfContainerFileCitation; vt != nil {
 9038		return (*int64)(&vt.EndIndex)
 9039	}
 9040	return nil
 9041}
 9042
 9043// Returns a pointer to the underlying variant's property, if present.
 9044func (u ResponseOutputTextAnnotationUnionParam) GetStartIndex() *int64 {
 9045	if vt := u.OfURLCitation; vt != nil {
 9046		return (*int64)(&vt.StartIndex)
 9047	} else if vt := u.OfContainerFileCitation; vt != nil {
 9048		return (*int64)(&vt.StartIndex)
 9049	}
 9050	return nil
 9051}
 9052
 9053func init() {
 9054	apijson.RegisterUnion[ResponseOutputTextAnnotationUnionParam](
 9055		"type",
 9056		apijson.Discriminator[ResponseOutputTextAnnotationFileCitationParam]("file_citation"),
 9057		apijson.Discriminator[ResponseOutputTextAnnotationURLCitationParam]("url_citation"),
 9058		apijson.Discriminator[ResponseOutputTextAnnotationContainerFileCitationParam]("container_file_citation"),
 9059		apijson.Discriminator[ResponseOutputTextAnnotationFilePathParam]("file_path"),
 9060	)
 9061}
 9062
 9063// A citation to a file.
 9064//
 9065// The properties FileID, Filename, Index, Type are required.
 9066type ResponseOutputTextAnnotationFileCitationParam struct {
 9067	// The ID of the file.
 9068	FileID string `json:"file_id,required"`
 9069	// The filename of the file cited.
 9070	Filename string `json:"filename,required"`
 9071	// The index of the file in the list of files.
 9072	Index int64 `json:"index,required"`
 9073	// The type of the file citation. Always `file_citation`.
 9074	//
 9075	// This field can be elided, and will marshal its zero value as "file_citation".
 9076	Type constant.FileCitation `json:"type,required"`
 9077	paramObj
 9078}
 9079
 9080func (r ResponseOutputTextAnnotationFileCitationParam) MarshalJSON() (data []byte, err error) {
 9081	type shadow ResponseOutputTextAnnotationFileCitationParam
 9082	return param.MarshalObject(r, (*shadow)(&r))
 9083}
 9084func (r *ResponseOutputTextAnnotationFileCitationParam) UnmarshalJSON(data []byte) error {
 9085	return apijson.UnmarshalRoot(data, r)
 9086}
 9087
 9088// A citation for a web resource used to generate a model response.
 9089//
 9090// The properties EndIndex, StartIndex, Title, Type, URL are required.
 9091type ResponseOutputTextAnnotationURLCitationParam struct {
 9092	// The index of the last character of the URL citation in the message.
 9093	EndIndex int64 `json:"end_index,required"`
 9094	// The index of the first character of the URL citation in the message.
 9095	StartIndex int64 `json:"start_index,required"`
 9096	// The title of the web resource.
 9097	Title string `json:"title,required"`
 9098	// The URL of the web resource.
 9099	URL string `json:"url,required"`
 9100	// The type of the URL citation. Always `url_citation`.
 9101	//
 9102	// This field can be elided, and will marshal its zero value as "url_citation".
 9103	Type constant.URLCitation `json:"type,required"`
 9104	paramObj
 9105}
 9106
 9107func (r ResponseOutputTextAnnotationURLCitationParam) MarshalJSON() (data []byte, err error) {
 9108	type shadow ResponseOutputTextAnnotationURLCitationParam
 9109	return param.MarshalObject(r, (*shadow)(&r))
 9110}
 9111func (r *ResponseOutputTextAnnotationURLCitationParam) UnmarshalJSON(data []byte) error {
 9112	return apijson.UnmarshalRoot(data, r)
 9113}
 9114
 9115// A citation for a container file used to generate a model response.
 9116//
 9117// The properties ContainerID, EndIndex, FileID, Filename, StartIndex, Type are
 9118// required.
 9119type ResponseOutputTextAnnotationContainerFileCitationParam struct {
 9120	// The ID of the container file.
 9121	ContainerID string `json:"container_id,required"`
 9122	// The index of the last character of the container file citation in the message.
 9123	EndIndex int64 `json:"end_index,required"`
 9124	// The ID of the file.
 9125	FileID string `json:"file_id,required"`
 9126	// The filename of the container file cited.
 9127	Filename string `json:"filename,required"`
 9128	// The index of the first character of the container file citation in the message.
 9129	StartIndex int64 `json:"start_index,required"`
 9130	// The type of the container file citation. Always `container_file_citation`.
 9131	//
 9132	// This field can be elided, and will marshal its zero value as
 9133	// "container_file_citation".
 9134	Type constant.ContainerFileCitation `json:"type,required"`
 9135	paramObj
 9136}
 9137
 9138func (r ResponseOutputTextAnnotationContainerFileCitationParam) MarshalJSON() (data []byte, err error) {
 9139	type shadow ResponseOutputTextAnnotationContainerFileCitationParam
 9140	return param.MarshalObject(r, (*shadow)(&r))
 9141}
 9142func (r *ResponseOutputTextAnnotationContainerFileCitationParam) UnmarshalJSON(data []byte) error {
 9143	return apijson.UnmarshalRoot(data, r)
 9144}
 9145
 9146// A path to a file.
 9147//
 9148// The properties FileID, Index, Type are required.
 9149type ResponseOutputTextAnnotationFilePathParam struct {
 9150	// The ID of the file.
 9151	FileID string `json:"file_id,required"`
 9152	// The index of the file in the list of files.
 9153	Index int64 `json:"index,required"`
 9154	// The type of the file path. Always `file_path`.
 9155	//
 9156	// This field can be elided, and will marshal its zero value as "file_path".
 9157	Type constant.FilePath `json:"type,required"`
 9158	paramObj
 9159}
 9160
 9161func (r ResponseOutputTextAnnotationFilePathParam) MarshalJSON() (data []byte, err error) {
 9162	type shadow ResponseOutputTextAnnotationFilePathParam
 9163	return param.MarshalObject(r, (*shadow)(&r))
 9164}
 9165func (r *ResponseOutputTextAnnotationFilePathParam) UnmarshalJSON(data []byte) error {
 9166	return apijson.UnmarshalRoot(data, r)
 9167}
 9168
 9169// The log probability of a token.
 9170//
 9171// The properties Token, Bytes, Logprob, TopLogprobs are required.
 9172type ResponseOutputTextLogprobParam struct {
 9173	Token       string                                     `json:"token,required"`
 9174	Bytes       []int64                                    `json:"bytes,omitzero,required"`
 9175	Logprob     float64                                    `json:"logprob,required"`
 9176	TopLogprobs []ResponseOutputTextLogprobTopLogprobParam `json:"top_logprobs,omitzero,required"`
 9177	paramObj
 9178}
 9179
 9180func (r ResponseOutputTextLogprobParam) MarshalJSON() (data []byte, err error) {
 9181	type shadow ResponseOutputTextLogprobParam
 9182	return param.MarshalObject(r, (*shadow)(&r))
 9183}
 9184func (r *ResponseOutputTextLogprobParam) UnmarshalJSON(data []byte) error {
 9185	return apijson.UnmarshalRoot(data, r)
 9186}
 9187
 9188// The top log probability of a token.
 9189//
 9190// The properties Token, Bytes, Logprob are required.
 9191type ResponseOutputTextLogprobTopLogprobParam struct {
 9192	Token   string  `json:"token,required"`
 9193	Bytes   []int64 `json:"bytes,omitzero,required"`
 9194	Logprob float64 `json:"logprob,required"`
 9195	paramObj
 9196}
 9197
 9198func (r ResponseOutputTextLogprobTopLogprobParam) MarshalJSON() (data []byte, err error) {
 9199	type shadow ResponseOutputTextLogprobTopLogprobParam
 9200	return param.MarshalObject(r, (*shadow)(&r))
 9201}
 9202func (r *ResponseOutputTextLogprobTopLogprobParam) UnmarshalJSON(data []byte) error {
 9203	return apijson.UnmarshalRoot(data, r)
 9204}
 9205
 9206// Emitted when an annotation is added to output text content.
 9207type ResponseOutputTextAnnotationAddedEvent struct {
 9208	// The annotation object being added. (See annotation schema for details.)
 9209	Annotation any `json:"annotation,required"`
 9210	// The index of the annotation within the content part.
 9211	AnnotationIndex int64 `json:"annotation_index,required"`
 9212	// The index of the content part within the output item.
 9213	ContentIndex int64 `json:"content_index,required"`
 9214	// The unique identifier of the item to which the annotation is being added.
 9215	ItemID string `json:"item_id,required"`
 9216	// The index of the output item in the response's output array.
 9217	OutputIndex int64 `json:"output_index,required"`
 9218	// The sequence number of this event.
 9219	SequenceNumber int64 `json:"sequence_number,required"`
 9220	// The type of the event. Always 'response.output_text_annotation.added'.
 9221	Type constant.ResponseOutputTextAnnotationAdded `json:"type,required"`
 9222	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 9223	JSON struct {
 9224		Annotation      respjson.Field
 9225		AnnotationIndex respjson.Field
 9226		ContentIndex    respjson.Field
 9227		ItemID          respjson.Field
 9228		OutputIndex     respjson.Field
 9229		SequenceNumber  respjson.Field
 9230		Type            respjson.Field
 9231		ExtraFields     map[string]respjson.Field
 9232		raw             string
 9233	} `json:"-"`
 9234}
 9235
 9236// Returns the unmodified JSON received from the API
 9237func (r ResponseOutputTextAnnotationAddedEvent) RawJSON() string { return r.JSON.raw }
 9238func (r *ResponseOutputTextAnnotationAddedEvent) UnmarshalJSON(data []byte) error {
 9239	return apijson.UnmarshalRoot(data, r)
 9240}
 9241
 9242// Reference to a prompt template and its variables.
 9243// [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
 9244type ResponsePrompt struct {
 9245	// The unique identifier of the prompt template to use.
 9246	ID string `json:"id,required"`
 9247	// Optional map of values to substitute in for variables in your prompt. The
 9248	// substitution values can either be strings, or other Response input types like
 9249	// images or files.
 9250	Variables map[string]ResponsePromptVariableUnion `json:"variables,nullable"`
 9251	// Optional version of the prompt template.
 9252	Version string `json:"version,nullable"`
 9253	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 9254	JSON struct {
 9255		ID          respjson.Field
 9256		Variables   respjson.Field
 9257		Version     respjson.Field
 9258		ExtraFields map[string]respjson.Field
 9259		raw         string
 9260	} `json:"-"`
 9261}
 9262
 9263// Returns the unmodified JSON received from the API
 9264func (r ResponsePrompt) RawJSON() string { return r.JSON.raw }
 9265func (r *ResponsePrompt) UnmarshalJSON(data []byte) error {
 9266	return apijson.UnmarshalRoot(data, r)
 9267}
 9268
 9269// ToParam converts this ResponsePrompt to a ResponsePromptParam.
 9270//
 9271// Warning: the fields of the param type will not be present. ToParam should only
 9272// be used at the last possible moment before sending a request. Test for this with
 9273// ResponsePromptParam.Overrides()
 9274func (r ResponsePrompt) ToParam() ResponsePromptParam {
 9275	return param.Override[ResponsePromptParam](json.RawMessage(r.RawJSON()))
 9276}
 9277
 9278// ResponsePromptVariableUnion contains all possible properties and values from
 9279// [string], [ResponseInputText], [ResponseInputImage], [ResponseInputFile].
 9280//
 9281// Use the methods beginning with 'As' to cast the union to one of its variants.
 9282//
 9283// If the underlying value is not a json object, one of the following properties
 9284// will be valid: OfString]
 9285type ResponsePromptVariableUnion struct {
 9286	// This field will be present if the value is a [string] instead of an object.
 9287	OfString string `json:",inline"`
 9288	// This field is from variant [ResponseInputText].
 9289	Text string `json:"text"`
 9290	Type string `json:"type"`
 9291	// This field is from variant [ResponseInputImage].
 9292	Detail ResponseInputImageDetail `json:"detail"`
 9293	FileID string                   `json:"file_id"`
 9294	// This field is from variant [ResponseInputImage].
 9295	ImageURL string `json:"image_url"`
 9296	// This field is from variant [ResponseInputFile].
 9297	FileData string `json:"file_data"`
 9298	// This field is from variant [ResponseInputFile].
 9299	Filename string `json:"filename"`
 9300	JSON     struct {
 9301		OfString respjson.Field
 9302		Text     respjson.Field
 9303		Type     respjson.Field
 9304		Detail   respjson.Field
 9305		FileID   respjson.Field
 9306		ImageURL respjson.Field
 9307		FileData respjson.Field
 9308		Filename respjson.Field
 9309		raw      string
 9310	} `json:"-"`
 9311}
 9312
 9313func (u ResponsePromptVariableUnion) AsString() (v string) {
 9314	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 9315	return
 9316}
 9317
 9318func (u ResponsePromptVariableUnion) AsInputText() (v ResponseInputText) {
 9319	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 9320	return
 9321}
 9322
 9323func (u ResponsePromptVariableUnion) AsInputImage() (v ResponseInputImage) {
 9324	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 9325	return
 9326}
 9327
 9328func (u ResponsePromptVariableUnion) AsInputFile() (v ResponseInputFile) {
 9329	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
 9330	return
 9331}
 9332
 9333// Returns the unmodified JSON received from the API
 9334func (u ResponsePromptVariableUnion) RawJSON() string { return u.JSON.raw }
 9335
 9336func (r *ResponsePromptVariableUnion) UnmarshalJSON(data []byte) error {
 9337	return apijson.UnmarshalRoot(data, r)
 9338}
 9339
 9340// Reference to a prompt template and its variables.
 9341// [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
 9342//
 9343// The property ID is required.
 9344type ResponsePromptParam struct {
 9345	// The unique identifier of the prompt template to use.
 9346	ID string `json:"id,required"`
 9347	// Optional version of the prompt template.
 9348	Version param.Opt[string] `json:"version,omitzero"`
 9349	// Optional map of values to substitute in for variables in your prompt. The
 9350	// substitution values can either be strings, or other Response input types like
 9351	// images or files.
 9352	Variables map[string]ResponsePromptVariableUnionParam `json:"variables,omitzero"`
 9353	paramObj
 9354}
 9355
 9356func (r ResponsePromptParam) MarshalJSON() (data []byte, err error) {
 9357	type shadow ResponsePromptParam
 9358	return param.MarshalObject(r, (*shadow)(&r))
 9359}
 9360func (r *ResponsePromptParam) UnmarshalJSON(data []byte) error {
 9361	return apijson.UnmarshalRoot(data, r)
 9362}
 9363
 9364// Only one field can be non-zero.
 9365//
 9366// Use [param.IsOmitted] to confirm if a field is set.
 9367type ResponsePromptVariableUnionParam struct {
 9368	OfString     param.Opt[string]        `json:",omitzero,inline"`
 9369	OfInputText  *ResponseInputTextParam  `json:",omitzero,inline"`
 9370	OfInputImage *ResponseInputImageParam `json:",omitzero,inline"`
 9371	OfInputFile  *ResponseInputFileParam  `json:",omitzero,inline"`
 9372	paramUnion
 9373}
 9374
 9375func (u ResponsePromptVariableUnionParam) MarshalJSON() ([]byte, error) {
 9376	return param.MarshalUnion(u, u.OfString, u.OfInputText, u.OfInputImage, u.OfInputFile)
 9377}
 9378func (u *ResponsePromptVariableUnionParam) UnmarshalJSON(data []byte) error {
 9379	return apijson.UnmarshalRoot(data, u)
 9380}
 9381
 9382func (u *ResponsePromptVariableUnionParam) asAny() any {
 9383	if !param.IsOmitted(u.OfString) {
 9384		return &u.OfString.Value
 9385	} else if !param.IsOmitted(u.OfInputText) {
 9386		return u.OfInputText
 9387	} else if !param.IsOmitted(u.OfInputImage) {
 9388		return u.OfInputImage
 9389	} else if !param.IsOmitted(u.OfInputFile) {
 9390		return u.OfInputFile
 9391	}
 9392	return nil
 9393}
 9394
 9395// Returns a pointer to the underlying variant's property, if present.
 9396func (u ResponsePromptVariableUnionParam) GetText() *string {
 9397	if vt := u.OfInputText; vt != nil {
 9398		return &vt.Text
 9399	}
 9400	return nil
 9401}
 9402
 9403// Returns a pointer to the underlying variant's property, if present.
 9404func (u ResponsePromptVariableUnionParam) GetDetail() *string {
 9405	if vt := u.OfInputImage; vt != nil {
 9406		return (*string)(&vt.Detail)
 9407	}
 9408	return nil
 9409}
 9410
 9411// Returns a pointer to the underlying variant's property, if present.
 9412func (u ResponsePromptVariableUnionParam) GetImageURL() *string {
 9413	if vt := u.OfInputImage; vt != nil && vt.ImageURL.Valid() {
 9414		return &vt.ImageURL.Value
 9415	}
 9416	return nil
 9417}
 9418
 9419// Returns a pointer to the underlying variant's property, if present.
 9420func (u ResponsePromptVariableUnionParam) GetFileData() *string {
 9421	if vt := u.OfInputFile; vt != nil && vt.FileData.Valid() {
 9422		return &vt.FileData.Value
 9423	}
 9424	return nil
 9425}
 9426
 9427// Returns a pointer to the underlying variant's property, if present.
 9428func (u ResponsePromptVariableUnionParam) GetFilename() *string {
 9429	if vt := u.OfInputFile; vt != nil && vt.Filename.Valid() {
 9430		return &vt.Filename.Value
 9431	}
 9432	return nil
 9433}
 9434
 9435// Returns a pointer to the underlying variant's property, if present.
 9436func (u ResponsePromptVariableUnionParam) GetType() *string {
 9437	if vt := u.OfInputText; vt != nil {
 9438		return (*string)(&vt.Type)
 9439	} else if vt := u.OfInputImage; vt != nil {
 9440		return (*string)(&vt.Type)
 9441	} else if vt := u.OfInputFile; vt != nil {
 9442		return (*string)(&vt.Type)
 9443	}
 9444	return nil
 9445}
 9446
 9447// Returns a pointer to the underlying variant's property, if present.
 9448func (u ResponsePromptVariableUnionParam) GetFileID() *string {
 9449	if vt := u.OfInputImage; vt != nil && vt.FileID.Valid() {
 9450		return &vt.FileID.Value
 9451	} else if vt := u.OfInputFile; vt != nil && vt.FileID.Valid() {
 9452		return &vt.FileID.Value
 9453	}
 9454	return nil
 9455}
 9456
 9457// Emitted when a response is queued and waiting to be processed.
 9458type ResponseQueuedEvent struct {
 9459	// The full response object that is queued.
 9460	Response Response `json:"response,required"`
 9461	// The sequence number for this event.
 9462	SequenceNumber int64 `json:"sequence_number,required"`
 9463	// The type of the event. Always 'response.queued'.
 9464	Type constant.ResponseQueued `json:"type,required"`
 9465	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 9466	JSON struct {
 9467		Response       respjson.Field
 9468		SequenceNumber respjson.Field
 9469		Type           respjson.Field
 9470		ExtraFields    map[string]respjson.Field
 9471		raw            string
 9472	} `json:"-"`
 9473}
 9474
 9475// Returns the unmodified JSON received from the API
 9476func (r ResponseQueuedEvent) RawJSON() string { return r.JSON.raw }
 9477func (r *ResponseQueuedEvent) UnmarshalJSON(data []byte) error {
 9478	return apijson.UnmarshalRoot(data, r)
 9479}
 9480
 9481// Emitted when there is a delta (partial update) to the reasoning content.
 9482type ResponseReasoningDeltaEvent struct {
 9483	// The index of the reasoning content part within the output item.
 9484	ContentIndex int64 `json:"content_index,required"`
 9485	// The partial update to the reasoning content.
 9486	Delta any `json:"delta,required"`
 9487	// The unique identifier of the item for which reasoning is being updated.
 9488	ItemID string `json:"item_id,required"`
 9489	// The index of the output item in the response's output array.
 9490	OutputIndex int64 `json:"output_index,required"`
 9491	// The sequence number of this event.
 9492	SequenceNumber int64 `json:"sequence_number,required"`
 9493	// The type of the event. Always 'response.reasoning.delta'.
 9494	Type constant.ResponseReasoningDelta `json:"type,required"`
 9495	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 9496	JSON struct {
 9497		ContentIndex   respjson.Field
 9498		Delta          respjson.Field
 9499		ItemID         respjson.Field
 9500		OutputIndex    respjson.Field
 9501		SequenceNumber respjson.Field
 9502		Type           respjson.Field
 9503		ExtraFields    map[string]respjson.Field
 9504		raw            string
 9505	} `json:"-"`
 9506}
 9507
 9508// Returns the unmodified JSON received from the API
 9509func (r ResponseReasoningDeltaEvent) RawJSON() string { return r.JSON.raw }
 9510func (r *ResponseReasoningDeltaEvent) UnmarshalJSON(data []byte) error {
 9511	return apijson.UnmarshalRoot(data, r)
 9512}
 9513
 9514// Emitted when the reasoning content is finalized for an item.
 9515type ResponseReasoningDoneEvent struct {
 9516	// The index of the reasoning content part within the output item.
 9517	ContentIndex int64 `json:"content_index,required"`
 9518	// The unique identifier of the item for which reasoning is finalized.
 9519	ItemID string `json:"item_id,required"`
 9520	// The index of the output item in the response's output array.
 9521	OutputIndex int64 `json:"output_index,required"`
 9522	// The sequence number of this event.
 9523	SequenceNumber int64 `json:"sequence_number,required"`
 9524	// The finalized reasoning text.
 9525	Text string `json:"text,required"`
 9526	// The type of the event. Always 'response.reasoning.done'.
 9527	Type constant.ResponseReasoningDone `json:"type,required"`
 9528	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 9529	JSON struct {
 9530		ContentIndex   respjson.Field
 9531		ItemID         respjson.Field
 9532		OutputIndex    respjson.Field
 9533		SequenceNumber respjson.Field
 9534		Text           respjson.Field
 9535		Type           respjson.Field
 9536		ExtraFields    map[string]respjson.Field
 9537		raw            string
 9538	} `json:"-"`
 9539}
 9540
 9541// Returns the unmodified JSON received from the API
 9542func (r ResponseReasoningDoneEvent) RawJSON() string { return r.JSON.raw }
 9543func (r *ResponseReasoningDoneEvent) UnmarshalJSON(data []byte) error {
 9544	return apijson.UnmarshalRoot(data, r)
 9545}
 9546
 9547// A description of the chain of thought used by a reasoning model while generating
 9548// a response. Be sure to include these items in your `input` to the Responses API
 9549// for subsequent turns of a conversation if you are manually
 9550// [managing context](https://platform.openai.com/docs/guides/conversation-state).
 9551type ResponseReasoningItem struct {
 9552	// The unique identifier of the reasoning content.
 9553	ID string `json:"id,required"`
 9554	// Reasoning text contents.
 9555	Summary []ResponseReasoningItemSummary `json:"summary,required"`
 9556	// The type of the object. Always `reasoning`.
 9557	Type constant.Reasoning `json:"type,required"`
 9558	// The encrypted content of the reasoning item - populated when a response is
 9559	// generated with `reasoning.encrypted_content` in the `include` parameter.
 9560	EncryptedContent string `json:"encrypted_content,nullable"`
 9561	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
 9562	// Populated when items are returned via API.
 9563	//
 9564	// Any of "in_progress", "completed", "incomplete".
 9565	Status ResponseReasoningItemStatus `json:"status"`
 9566	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 9567	JSON struct {
 9568		ID               respjson.Field
 9569		Summary          respjson.Field
 9570		Type             respjson.Field
 9571		EncryptedContent respjson.Field
 9572		Status           respjson.Field
 9573		ExtraFields      map[string]respjson.Field
 9574		raw              string
 9575	} `json:"-"`
 9576}
 9577
 9578// Returns the unmodified JSON received from the API
 9579func (r ResponseReasoningItem) RawJSON() string { return r.JSON.raw }
 9580func (r *ResponseReasoningItem) UnmarshalJSON(data []byte) error {
 9581	return apijson.UnmarshalRoot(data, r)
 9582}
 9583
 9584// ToParam converts this ResponseReasoningItem to a ResponseReasoningItemParam.
 9585//
 9586// Warning: the fields of the param type will not be present. ToParam should only
 9587// be used at the last possible moment before sending a request. Test for this with
 9588// ResponseReasoningItemParam.Overrides()
 9589func (r ResponseReasoningItem) ToParam() ResponseReasoningItemParam {
 9590	return param.Override[ResponseReasoningItemParam](json.RawMessage(r.RawJSON()))
 9591}
 9592
 9593type ResponseReasoningItemSummary struct {
 9594	// A short summary of the reasoning used by the model when generating the response.
 9595	Text string `json:"text,required"`
 9596	// The type of the object. Always `summary_text`.
 9597	Type constant.SummaryText `json:"type,required"`
 9598	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 9599	JSON struct {
 9600		Text        respjson.Field
 9601		Type        respjson.Field
 9602		ExtraFields map[string]respjson.Field
 9603		raw         string
 9604	} `json:"-"`
 9605}
 9606
 9607// Returns the unmodified JSON received from the API
 9608func (r ResponseReasoningItemSummary) RawJSON() string { return r.JSON.raw }
 9609func (r *ResponseReasoningItemSummary) UnmarshalJSON(data []byte) error {
 9610	return apijson.UnmarshalRoot(data, r)
 9611}
 9612
 9613// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
 9614// Populated when items are returned via API.
 9615type ResponseReasoningItemStatus string
 9616
 9617const (
 9618	ResponseReasoningItemStatusInProgress ResponseReasoningItemStatus = "in_progress"
 9619	ResponseReasoningItemStatusCompleted  ResponseReasoningItemStatus = "completed"
 9620	ResponseReasoningItemStatusIncomplete ResponseReasoningItemStatus = "incomplete"
 9621)
 9622
 9623// A description of the chain of thought used by a reasoning model while generating
 9624// a response. Be sure to include these items in your `input` to the Responses API
 9625// for subsequent turns of a conversation if you are manually
 9626// [managing context](https://platform.openai.com/docs/guides/conversation-state).
 9627//
 9628// The properties ID, Summary, Type are required.
 9629type ResponseReasoningItemParam struct {
 9630	// The unique identifier of the reasoning content.
 9631	ID string `json:"id,required"`
 9632	// Reasoning text contents.
 9633	Summary []ResponseReasoningItemSummaryParam `json:"summary,omitzero,required"`
 9634	// The encrypted content of the reasoning item - populated when a response is
 9635	// generated with `reasoning.encrypted_content` in the `include` parameter.
 9636	EncryptedContent param.Opt[string] `json:"encrypted_content,omitzero"`
 9637	// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
 9638	// Populated when items are returned via API.
 9639	//
 9640	// Any of "in_progress", "completed", "incomplete".
 9641	Status ResponseReasoningItemStatus `json:"status,omitzero"`
 9642	// The type of the object. Always `reasoning`.
 9643	//
 9644	// This field can be elided, and will marshal its zero value as "reasoning".
 9645	Type constant.Reasoning `json:"type,required"`
 9646	paramObj
 9647}
 9648
 9649func (r ResponseReasoningItemParam) MarshalJSON() (data []byte, err error) {
 9650	type shadow ResponseReasoningItemParam
 9651	return param.MarshalObject(r, (*shadow)(&r))
 9652}
 9653func (r *ResponseReasoningItemParam) UnmarshalJSON(data []byte) error {
 9654	return apijson.UnmarshalRoot(data, r)
 9655}
 9656
 9657// The properties Text, Type are required.
 9658type ResponseReasoningItemSummaryParam struct {
 9659	// A short summary of the reasoning used by the model when generating the response.
 9660	Text string `json:"text,required"`
 9661	// The type of the object. Always `summary_text`.
 9662	//
 9663	// This field can be elided, and will marshal its zero value as "summary_text".
 9664	Type constant.SummaryText `json:"type,required"`
 9665	paramObj
 9666}
 9667
 9668func (r ResponseReasoningItemSummaryParam) MarshalJSON() (data []byte, err error) {
 9669	type shadow ResponseReasoningItemSummaryParam
 9670	return param.MarshalObject(r, (*shadow)(&r))
 9671}
 9672func (r *ResponseReasoningItemSummaryParam) UnmarshalJSON(data []byte) error {
 9673	return apijson.UnmarshalRoot(data, r)
 9674}
 9675
 9676// Emitted when there is a delta (partial update) to the reasoning summary content.
 9677type ResponseReasoningSummaryDeltaEvent struct {
 9678	// The partial update to the reasoning summary content.
 9679	Delta any `json:"delta,required"`
 9680	// The unique identifier of the item for which the reasoning summary is being
 9681	// updated.
 9682	ItemID string `json:"item_id,required"`
 9683	// The index of the output item in the response's output array.
 9684	OutputIndex int64 `json:"output_index,required"`
 9685	// The sequence number of this event.
 9686	SequenceNumber int64 `json:"sequence_number,required"`
 9687	// The index of the summary part within the output item.
 9688	SummaryIndex int64 `json:"summary_index,required"`
 9689	// The type of the event. Always 'response.reasoning_summary.delta'.
 9690	Type constant.ResponseReasoningSummaryDelta `json:"type,required"`
 9691	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 9692	JSON struct {
 9693		Delta          respjson.Field
 9694		ItemID         respjson.Field
 9695		OutputIndex    respjson.Field
 9696		SequenceNumber respjson.Field
 9697		SummaryIndex   respjson.Field
 9698		Type           respjson.Field
 9699		ExtraFields    map[string]respjson.Field
 9700		raw            string
 9701	} `json:"-"`
 9702}
 9703
 9704// Returns the unmodified JSON received from the API
 9705func (r ResponseReasoningSummaryDeltaEvent) RawJSON() string { return r.JSON.raw }
 9706func (r *ResponseReasoningSummaryDeltaEvent) UnmarshalJSON(data []byte) error {
 9707	return apijson.UnmarshalRoot(data, r)
 9708}
 9709
 9710// Emitted when the reasoning summary content is finalized for an item.
 9711type ResponseReasoningSummaryDoneEvent struct {
 9712	// The unique identifier of the item for which the reasoning summary is finalized.
 9713	ItemID string `json:"item_id,required"`
 9714	// The index of the output item in the response's output array.
 9715	OutputIndex int64 `json:"output_index,required"`
 9716	// The sequence number of this event.
 9717	SequenceNumber int64 `json:"sequence_number,required"`
 9718	// The index of the summary part within the output item.
 9719	SummaryIndex int64 `json:"summary_index,required"`
 9720	// The finalized reasoning summary text.
 9721	Text string `json:"text,required"`
 9722	// The type of the event. Always 'response.reasoning_summary.done'.
 9723	Type constant.ResponseReasoningSummaryDone `json:"type,required"`
 9724	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 9725	JSON struct {
 9726		ItemID         respjson.Field
 9727		OutputIndex    respjson.Field
 9728		SequenceNumber respjson.Field
 9729		SummaryIndex   respjson.Field
 9730		Text           respjson.Field
 9731		Type           respjson.Field
 9732		ExtraFields    map[string]respjson.Field
 9733		raw            string
 9734	} `json:"-"`
 9735}
 9736
 9737// Returns the unmodified JSON received from the API
 9738func (r ResponseReasoningSummaryDoneEvent) RawJSON() string { return r.JSON.raw }
 9739func (r *ResponseReasoningSummaryDoneEvent) UnmarshalJSON(data []byte) error {
 9740	return apijson.UnmarshalRoot(data, r)
 9741}
 9742
 9743// Emitted when a new reasoning summary part is added.
 9744type ResponseReasoningSummaryPartAddedEvent struct {
 9745	// The ID of the item this summary part is associated with.
 9746	ItemID string `json:"item_id,required"`
 9747	// The index of the output item this summary part is associated with.
 9748	OutputIndex int64 `json:"output_index,required"`
 9749	// The summary part that was added.
 9750	Part ResponseReasoningSummaryPartAddedEventPart `json:"part,required"`
 9751	// The sequence number of this event.
 9752	SequenceNumber int64 `json:"sequence_number,required"`
 9753	// The index of the summary part within the reasoning summary.
 9754	SummaryIndex int64 `json:"summary_index,required"`
 9755	// The type of the event. Always `response.reasoning_summary_part.added`.
 9756	Type constant.ResponseReasoningSummaryPartAdded `json:"type,required"`
 9757	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 9758	JSON struct {
 9759		ItemID         respjson.Field
 9760		OutputIndex    respjson.Field
 9761		Part           respjson.Field
 9762		SequenceNumber respjson.Field
 9763		SummaryIndex   respjson.Field
 9764		Type           respjson.Field
 9765		ExtraFields    map[string]respjson.Field
 9766		raw            string
 9767	} `json:"-"`
 9768}
 9769
 9770// Returns the unmodified JSON received from the API
 9771func (r ResponseReasoningSummaryPartAddedEvent) RawJSON() string { return r.JSON.raw }
 9772func (r *ResponseReasoningSummaryPartAddedEvent) UnmarshalJSON(data []byte) error {
 9773	return apijson.UnmarshalRoot(data, r)
 9774}
 9775
 9776// The summary part that was added.
 9777type ResponseReasoningSummaryPartAddedEventPart struct {
 9778	// The text of the summary part.
 9779	Text string `json:"text,required"`
 9780	// The type of the summary part. Always `summary_text`.
 9781	Type constant.SummaryText `json:"type,required"`
 9782	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 9783	JSON struct {
 9784		Text        respjson.Field
 9785		Type        respjson.Field
 9786		ExtraFields map[string]respjson.Field
 9787		raw         string
 9788	} `json:"-"`
 9789}
 9790
 9791// Returns the unmodified JSON received from the API
 9792func (r ResponseReasoningSummaryPartAddedEventPart) RawJSON() string { return r.JSON.raw }
 9793func (r *ResponseReasoningSummaryPartAddedEventPart) UnmarshalJSON(data []byte) error {
 9794	return apijson.UnmarshalRoot(data, r)
 9795}
 9796
 9797// Emitted when a reasoning summary part is completed.
 9798type ResponseReasoningSummaryPartDoneEvent struct {
 9799	// The ID of the item this summary part is associated with.
 9800	ItemID string `json:"item_id,required"`
 9801	// The index of the output item this summary part is associated with.
 9802	OutputIndex int64 `json:"output_index,required"`
 9803	// The completed summary part.
 9804	Part ResponseReasoningSummaryPartDoneEventPart `json:"part,required"`
 9805	// The sequence number of this event.
 9806	SequenceNumber int64 `json:"sequence_number,required"`
 9807	// The index of the summary part within the reasoning summary.
 9808	SummaryIndex int64 `json:"summary_index,required"`
 9809	// The type of the event. Always `response.reasoning_summary_part.done`.
 9810	Type constant.ResponseReasoningSummaryPartDone `json:"type,required"`
 9811	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 9812	JSON struct {
 9813		ItemID         respjson.Field
 9814		OutputIndex    respjson.Field
 9815		Part           respjson.Field
 9816		SequenceNumber respjson.Field
 9817		SummaryIndex   respjson.Field
 9818		Type           respjson.Field
 9819		ExtraFields    map[string]respjson.Field
 9820		raw            string
 9821	} `json:"-"`
 9822}
 9823
 9824// Returns the unmodified JSON received from the API
 9825func (r ResponseReasoningSummaryPartDoneEvent) RawJSON() string { return r.JSON.raw }
 9826func (r *ResponseReasoningSummaryPartDoneEvent) UnmarshalJSON(data []byte) error {
 9827	return apijson.UnmarshalRoot(data, r)
 9828}
 9829
 9830// The completed summary part.
 9831type ResponseReasoningSummaryPartDoneEventPart struct {
 9832	// The text of the summary part.
 9833	Text string `json:"text,required"`
 9834	// The type of the summary part. Always `summary_text`.
 9835	Type constant.SummaryText `json:"type,required"`
 9836	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 9837	JSON struct {
 9838		Text        respjson.Field
 9839		Type        respjson.Field
 9840		ExtraFields map[string]respjson.Field
 9841		raw         string
 9842	} `json:"-"`
 9843}
 9844
 9845// Returns the unmodified JSON received from the API
 9846func (r ResponseReasoningSummaryPartDoneEventPart) RawJSON() string { return r.JSON.raw }
 9847func (r *ResponseReasoningSummaryPartDoneEventPart) UnmarshalJSON(data []byte) error {
 9848	return apijson.UnmarshalRoot(data, r)
 9849}
 9850
 9851// Emitted when a delta is added to a reasoning summary text.
 9852type ResponseReasoningSummaryTextDeltaEvent struct {
 9853	// The text delta that was added to the summary.
 9854	Delta string `json:"delta,required"`
 9855	// The ID of the item this summary text delta is associated with.
 9856	ItemID string `json:"item_id,required"`
 9857	// The index of the output item this summary text delta is associated with.
 9858	OutputIndex int64 `json:"output_index,required"`
 9859	// The sequence number of this event.
 9860	SequenceNumber int64 `json:"sequence_number,required"`
 9861	// The index of the summary part within the reasoning summary.
 9862	SummaryIndex int64 `json:"summary_index,required"`
 9863	// The type of the event. Always `response.reasoning_summary_text.delta`.
 9864	Type constant.ResponseReasoningSummaryTextDelta `json:"type,required"`
 9865	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 9866	JSON struct {
 9867		Delta          respjson.Field
 9868		ItemID         respjson.Field
 9869		OutputIndex    respjson.Field
 9870		SequenceNumber respjson.Field
 9871		SummaryIndex   respjson.Field
 9872		Type           respjson.Field
 9873		ExtraFields    map[string]respjson.Field
 9874		raw            string
 9875	} `json:"-"`
 9876}
 9877
 9878// Returns the unmodified JSON received from the API
 9879func (r ResponseReasoningSummaryTextDeltaEvent) RawJSON() string { return r.JSON.raw }
 9880func (r *ResponseReasoningSummaryTextDeltaEvent) UnmarshalJSON(data []byte) error {
 9881	return apijson.UnmarshalRoot(data, r)
 9882}
 9883
 9884// Emitted when a reasoning summary text is completed.
 9885type ResponseReasoningSummaryTextDoneEvent struct {
 9886	// The ID of the item this summary text is associated with.
 9887	ItemID string `json:"item_id,required"`
 9888	// The index of the output item this summary text is associated with.
 9889	OutputIndex int64 `json:"output_index,required"`
 9890	// The sequence number of this event.
 9891	SequenceNumber int64 `json:"sequence_number,required"`
 9892	// The index of the summary part within the reasoning summary.
 9893	SummaryIndex int64 `json:"summary_index,required"`
 9894	// The full text of the completed reasoning summary.
 9895	Text string `json:"text,required"`
 9896	// The type of the event. Always `response.reasoning_summary_text.done`.
 9897	Type constant.ResponseReasoningSummaryTextDone `json:"type,required"`
 9898	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 9899	JSON struct {
 9900		ItemID         respjson.Field
 9901		OutputIndex    respjson.Field
 9902		SequenceNumber respjson.Field
 9903		SummaryIndex   respjson.Field
 9904		Text           respjson.Field
 9905		Type           respjson.Field
 9906		ExtraFields    map[string]respjson.Field
 9907		raw            string
 9908	} `json:"-"`
 9909}
 9910
 9911// Returns the unmodified JSON received from the API
 9912func (r ResponseReasoningSummaryTextDoneEvent) RawJSON() string { return r.JSON.raw }
 9913func (r *ResponseReasoningSummaryTextDoneEvent) UnmarshalJSON(data []byte) error {
 9914	return apijson.UnmarshalRoot(data, r)
 9915}
 9916
 9917// Emitted when there is a partial refusal text.
 9918type ResponseRefusalDeltaEvent struct {
 9919	// The index of the content part that the refusal text is added to.
 9920	ContentIndex int64 `json:"content_index,required"`
 9921	// The refusal text that is added.
 9922	Delta string `json:"delta,required"`
 9923	// The ID of the output item that the refusal text is added to.
 9924	ItemID string `json:"item_id,required"`
 9925	// The index of the output item that the refusal text is added to.
 9926	OutputIndex int64 `json:"output_index,required"`
 9927	// The sequence number of this event.
 9928	SequenceNumber int64 `json:"sequence_number,required"`
 9929	// The type of the event. Always `response.refusal.delta`.
 9930	Type constant.ResponseRefusalDelta `json:"type,required"`
 9931	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 9932	JSON struct {
 9933		ContentIndex   respjson.Field
 9934		Delta          respjson.Field
 9935		ItemID         respjson.Field
 9936		OutputIndex    respjson.Field
 9937		SequenceNumber respjson.Field
 9938		Type           respjson.Field
 9939		ExtraFields    map[string]respjson.Field
 9940		raw            string
 9941	} `json:"-"`
 9942}
 9943
 9944// Returns the unmodified JSON received from the API
 9945func (r ResponseRefusalDeltaEvent) RawJSON() string { return r.JSON.raw }
 9946func (r *ResponseRefusalDeltaEvent) UnmarshalJSON(data []byte) error {
 9947	return apijson.UnmarshalRoot(data, r)
 9948}
 9949
 9950// Emitted when refusal text is finalized.
 9951type ResponseRefusalDoneEvent struct {
 9952	// The index of the content part that the refusal text is finalized.
 9953	ContentIndex int64 `json:"content_index,required"`
 9954	// The ID of the output item that the refusal text is finalized.
 9955	ItemID string `json:"item_id,required"`
 9956	// The index of the output item that the refusal text is finalized.
 9957	OutputIndex int64 `json:"output_index,required"`
 9958	// The refusal text that is finalized.
 9959	Refusal string `json:"refusal,required"`
 9960	// The sequence number of this event.
 9961	SequenceNumber int64 `json:"sequence_number,required"`
 9962	// The type of the event. Always `response.refusal.done`.
 9963	Type constant.ResponseRefusalDone `json:"type,required"`
 9964	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
 9965	JSON struct {
 9966		ContentIndex   respjson.Field
 9967		ItemID         respjson.Field
 9968		OutputIndex    respjson.Field
 9969		Refusal        respjson.Field
 9970		SequenceNumber respjson.Field
 9971		Type           respjson.Field
 9972		ExtraFields    map[string]respjson.Field
 9973		raw            string
 9974	} `json:"-"`
 9975}
 9976
 9977// Returns the unmodified JSON received from the API
 9978func (r ResponseRefusalDoneEvent) RawJSON() string { return r.JSON.raw }
 9979func (r *ResponseRefusalDoneEvent) UnmarshalJSON(data []byte) error {
 9980	return apijson.UnmarshalRoot(data, r)
 9981}
 9982
 9983// The status of the response generation. One of `completed`, `failed`,
 9984// `in_progress`, `cancelled`, `queued`, or `incomplete`.
 9985type ResponseStatus string
 9986
 9987const (
 9988	ResponseStatusCompleted  ResponseStatus = "completed"
 9989	ResponseStatusFailed     ResponseStatus = "failed"
 9990	ResponseStatusInProgress ResponseStatus = "in_progress"
 9991	ResponseStatusCancelled  ResponseStatus = "cancelled"
 9992	ResponseStatusQueued     ResponseStatus = "queued"
 9993	ResponseStatusIncomplete ResponseStatus = "incomplete"
 9994)
 9995
 9996// ResponseStreamEventUnion contains all possible properties and values from
 9997// [ResponseAudioDeltaEvent], [ResponseAudioDoneEvent],
 9998// [ResponseAudioTranscriptDeltaEvent], [ResponseAudioTranscriptDoneEvent],
 9999// [ResponseCodeInterpreterCallCodeDeltaEvent],
10000// [ResponseCodeInterpreterCallCodeDoneEvent],
10001// [ResponseCodeInterpreterCallCompletedEvent],
10002// [ResponseCodeInterpreterCallInProgressEvent],
10003// [ResponseCodeInterpreterCallInterpretingEvent], [ResponseCompletedEvent],
10004// [ResponseContentPartAddedEvent], [ResponseContentPartDoneEvent],
10005// [ResponseCreatedEvent], [ResponseErrorEvent],
10006// [ResponseFileSearchCallCompletedEvent], [ResponseFileSearchCallInProgressEvent],
10007// [ResponseFileSearchCallSearchingEvent],
10008// [ResponseFunctionCallArgumentsDeltaEvent],
10009// [ResponseFunctionCallArgumentsDoneEvent], [ResponseInProgressEvent],
10010// [ResponseFailedEvent], [ResponseIncompleteEvent],
10011// [ResponseOutputItemAddedEvent], [ResponseOutputItemDoneEvent],
10012// [ResponseReasoningSummaryPartAddedEvent],
10013// [ResponseReasoningSummaryPartDoneEvent],
10014// [ResponseReasoningSummaryTextDeltaEvent],
10015// [ResponseReasoningSummaryTextDoneEvent], [ResponseRefusalDeltaEvent],
10016// [ResponseRefusalDoneEvent], [ResponseTextDeltaEvent], [ResponseTextDoneEvent],
10017// [ResponseWebSearchCallCompletedEvent], [ResponseWebSearchCallInProgressEvent],
10018// [ResponseWebSearchCallSearchingEvent], [ResponseImageGenCallCompletedEvent],
10019// [ResponseImageGenCallGeneratingEvent], [ResponseImageGenCallInProgressEvent],
10020// [ResponseImageGenCallPartialImageEvent], [ResponseMcpCallArgumentsDeltaEvent],
10021// [ResponseMcpCallArgumentsDoneEvent], [ResponseMcpCallCompletedEvent],
10022// [ResponseMcpCallFailedEvent], [ResponseMcpCallInProgressEvent],
10023// [ResponseMcpListToolsCompletedEvent], [ResponseMcpListToolsFailedEvent],
10024// [ResponseMcpListToolsInProgressEvent], [ResponseOutputTextAnnotationAddedEvent],
10025// [ResponseQueuedEvent], [ResponseReasoningDeltaEvent],
10026// [ResponseReasoningDoneEvent], [ResponseReasoningSummaryDeltaEvent],
10027// [ResponseReasoningSummaryDoneEvent].
10028//
10029// Use the [ResponseStreamEventUnion.AsAny] method to switch on the variant.
10030//
10031// Use the methods beginning with 'As' to cast the union to one of its variants.
10032type ResponseStreamEventUnion struct {
10033	// This field is a union of [string], [string], [string], [string], [string],
10034	// [string], [string], [any], [any], [any]
10035	Delta          ResponseStreamEventUnionDelta `json:"delta"`
10036	SequenceNumber int64                         `json:"sequence_number"`
10037	// Any of "response.audio.delta", "response.audio.done",
10038	// "response.audio.transcript.delta", "response.audio.transcript.done",
10039	// "response.code_interpreter_call_code.delta",
10040	// "response.code_interpreter_call_code.done",
10041	// "response.code_interpreter_call.completed",
10042	// "response.code_interpreter_call.in_progress",
10043	// "response.code_interpreter_call.interpreting", "response.completed",
10044	// "response.content_part.added", "response.content_part.done", "response.created",
10045	// "error", "response.file_search_call.completed",
10046	// "response.file_search_call.in_progress", "response.file_search_call.searching",
10047	// "response.function_call_arguments.delta",
10048	// "response.function_call_arguments.done", "response.in_progress",
10049	// "response.failed", "response.incomplete", "response.output_item.added",
10050	// "response.output_item.done", "response.reasoning_summary_part.added",
10051	// "response.reasoning_summary_part.done", "response.reasoning_summary_text.delta",
10052	// "response.reasoning_summary_text.done", "response.refusal.delta",
10053	// "response.refusal.done", "response.output_text.delta",
10054	// "response.output_text.done", "response.web_search_call.completed",
10055	// "response.web_search_call.in_progress", "response.web_search_call.searching",
10056	// "response.image_generation_call.completed",
10057	// "response.image_generation_call.generating",
10058	// "response.image_generation_call.in_progress",
10059	// "response.image_generation_call.partial_image",
10060	// "response.mcp_call.arguments_delta", "response.mcp_call.arguments_done",
10061	// "response.mcp_call.completed", "response.mcp_call.failed",
10062	// "response.mcp_call.in_progress", "response.mcp_list_tools.completed",
10063	// "response.mcp_list_tools.failed", "response.mcp_list_tools.in_progress",
10064	// "response.output_text_annotation.added", "response.queued",
10065	// "response.reasoning.delta", "response.reasoning.done",
10066	// "response.reasoning_summary.delta", "response.reasoning_summary.done".
10067	Type        string `json:"type"`
10068	ItemID      string `json:"item_id"`
10069	OutputIndex int64  `json:"output_index"`
10070	Code        string `json:"code"`
10071	// This field is from variant [ResponseCompletedEvent].
10072	Response     Response `json:"response"`
10073	ContentIndex int64    `json:"content_index"`
10074	// This field is a union of [ResponseContentPartAddedEventPartUnion],
10075	// [ResponseContentPartDoneEventPartUnion],
10076	// [ResponseReasoningSummaryPartAddedEventPart],
10077	// [ResponseReasoningSummaryPartDoneEventPart]
10078	Part ResponseStreamEventUnionPart `json:"part"`
10079	// This field is from variant [ResponseErrorEvent].
10080	Message string `json:"message"`
10081	// This field is from variant [ResponseErrorEvent].
10082	Param string `json:"param"`
10083	// This field is a union of [string], [any]
10084	Arguments ResponseStreamEventUnionArguments `json:"arguments"`
10085	// This field is from variant [ResponseOutputItemAddedEvent].
10086	Item         ResponseOutputItemUnion `json:"item"`
10087	SummaryIndex int64                   `json:"summary_index"`
10088	Text         string                  `json:"text"`
10089	// This field is from variant [ResponseRefusalDoneEvent].
10090	Refusal string `json:"refusal"`
10091	// This field is from variant [ResponseImageGenCallPartialImageEvent].
10092	PartialImageB64 string `json:"partial_image_b64"`
10093	// This field is from variant [ResponseImageGenCallPartialImageEvent].
10094	PartialImageIndex int64 `json:"partial_image_index"`
10095	// This field is from variant [ResponseOutputTextAnnotationAddedEvent].
10096	Annotation any `json:"annotation"`
10097	// This field is from variant [ResponseOutputTextAnnotationAddedEvent].
10098	AnnotationIndex int64 `json:"annotation_index"`
10099	JSON            struct {
10100		Delta             respjson.Field
10101		SequenceNumber    respjson.Field
10102		Type              respjson.Field
10103		ItemID            respjson.Field
10104		OutputIndex       respjson.Field
10105		Code              respjson.Field
10106		Response          respjson.Field
10107		ContentIndex      respjson.Field
10108		Part              respjson.Field
10109		Message           respjson.Field
10110		Param             respjson.Field
10111		Arguments         respjson.Field
10112		Item              respjson.Field
10113		SummaryIndex      respjson.Field
10114		Text              respjson.Field
10115		Refusal           respjson.Field
10116		PartialImageB64   respjson.Field
10117		PartialImageIndex respjson.Field
10118		Annotation        respjson.Field
10119		AnnotationIndex   respjson.Field
10120		raw               string
10121	} `json:"-"`
10122}
10123
10124// anyResponseStreamEvent is implemented by each variant of
10125// [ResponseStreamEventUnion] to add type safety for the return type of
10126// [ResponseStreamEventUnion.AsAny]
10127type anyResponseStreamEvent interface {
10128	implResponseStreamEventUnion()
10129}
10130
10131func (ResponseAudioDeltaEvent) implResponseStreamEventUnion()                      {}
10132func (ResponseAudioDoneEvent) implResponseStreamEventUnion()                       {}
10133func (ResponseAudioTranscriptDeltaEvent) implResponseStreamEventUnion()            {}
10134func (ResponseAudioTranscriptDoneEvent) implResponseStreamEventUnion()             {}
10135func (ResponseCodeInterpreterCallCodeDeltaEvent) implResponseStreamEventUnion()    {}
10136func (ResponseCodeInterpreterCallCodeDoneEvent) implResponseStreamEventUnion()     {}
10137func (ResponseCodeInterpreterCallCompletedEvent) implResponseStreamEventUnion()    {}
10138func (ResponseCodeInterpreterCallInProgressEvent) implResponseStreamEventUnion()   {}
10139func (ResponseCodeInterpreterCallInterpretingEvent) implResponseStreamEventUnion() {}
10140func (ResponseCompletedEvent) implResponseStreamEventUnion()                       {}
10141func (ResponseContentPartAddedEvent) implResponseStreamEventUnion()                {}
10142func (ResponseContentPartDoneEvent) implResponseStreamEventUnion()                 {}
10143func (ResponseCreatedEvent) implResponseStreamEventUnion()                         {}
10144func (ResponseErrorEvent) implResponseStreamEventUnion()                           {}
10145func (ResponseFileSearchCallCompletedEvent) implResponseStreamEventUnion()         {}
10146func (ResponseFileSearchCallInProgressEvent) implResponseStreamEventUnion()        {}
10147func (ResponseFileSearchCallSearchingEvent) implResponseStreamEventUnion()         {}
10148func (ResponseFunctionCallArgumentsDeltaEvent) implResponseStreamEventUnion()      {}
10149func (ResponseFunctionCallArgumentsDoneEvent) implResponseStreamEventUnion()       {}
10150func (ResponseInProgressEvent) implResponseStreamEventUnion()                      {}
10151func (ResponseFailedEvent) implResponseStreamEventUnion()                          {}
10152func (ResponseIncompleteEvent) implResponseStreamEventUnion()                      {}
10153func (ResponseOutputItemAddedEvent) implResponseStreamEventUnion()                 {}
10154func (ResponseOutputItemDoneEvent) implResponseStreamEventUnion()                  {}
10155func (ResponseReasoningSummaryPartAddedEvent) implResponseStreamEventUnion()       {}
10156func (ResponseReasoningSummaryPartDoneEvent) implResponseStreamEventUnion()        {}
10157func (ResponseReasoningSummaryTextDeltaEvent) implResponseStreamEventUnion()       {}
10158func (ResponseReasoningSummaryTextDoneEvent) implResponseStreamEventUnion()        {}
10159func (ResponseRefusalDeltaEvent) implResponseStreamEventUnion()                    {}
10160func (ResponseRefusalDoneEvent) implResponseStreamEventUnion()                     {}
10161func (ResponseTextDeltaEvent) implResponseStreamEventUnion()                       {}
10162func (ResponseTextDoneEvent) implResponseStreamEventUnion()                        {}
10163func (ResponseWebSearchCallCompletedEvent) implResponseStreamEventUnion()          {}
10164func (ResponseWebSearchCallInProgressEvent) implResponseStreamEventUnion()         {}
10165func (ResponseWebSearchCallSearchingEvent) implResponseStreamEventUnion()          {}
10166func (ResponseImageGenCallCompletedEvent) implResponseStreamEventUnion()           {}
10167func (ResponseImageGenCallGeneratingEvent) implResponseStreamEventUnion()          {}
10168func (ResponseImageGenCallInProgressEvent) implResponseStreamEventUnion()          {}
10169func (ResponseImageGenCallPartialImageEvent) implResponseStreamEventUnion()        {}
10170func (ResponseMcpCallArgumentsDeltaEvent) implResponseStreamEventUnion()           {}
10171func (ResponseMcpCallArgumentsDoneEvent) implResponseStreamEventUnion()            {}
10172func (ResponseMcpCallCompletedEvent) implResponseStreamEventUnion()                {}
10173func (ResponseMcpCallFailedEvent) implResponseStreamEventUnion()                   {}
10174func (ResponseMcpCallInProgressEvent) implResponseStreamEventUnion()               {}
10175func (ResponseMcpListToolsCompletedEvent) implResponseStreamEventUnion()           {}
10176func (ResponseMcpListToolsFailedEvent) implResponseStreamEventUnion()              {}
10177func (ResponseMcpListToolsInProgressEvent) implResponseStreamEventUnion()          {}
10178func (ResponseOutputTextAnnotationAddedEvent) implResponseStreamEventUnion()       {}
10179func (ResponseQueuedEvent) implResponseStreamEventUnion()                          {}
10180func (ResponseReasoningDeltaEvent) implResponseStreamEventUnion()                  {}
10181func (ResponseReasoningDoneEvent) implResponseStreamEventUnion()                   {}
10182func (ResponseReasoningSummaryDeltaEvent) implResponseStreamEventUnion()           {}
10183func (ResponseReasoningSummaryDoneEvent) implResponseStreamEventUnion()            {}
10184
10185// Use the following switch statement to find the correct variant
10186//
10187//	switch variant := ResponseStreamEventUnion.AsAny().(type) {
10188//	case responses.ResponseAudioDeltaEvent:
10189//	case responses.ResponseAudioDoneEvent:
10190//	case responses.ResponseAudioTranscriptDeltaEvent:
10191//	case responses.ResponseAudioTranscriptDoneEvent:
10192//	case responses.ResponseCodeInterpreterCallCodeDeltaEvent:
10193//	case responses.ResponseCodeInterpreterCallCodeDoneEvent:
10194//	case responses.ResponseCodeInterpreterCallCompletedEvent:
10195//	case responses.ResponseCodeInterpreterCallInProgressEvent:
10196//	case responses.ResponseCodeInterpreterCallInterpretingEvent:
10197//	case responses.ResponseCompletedEvent:
10198//	case responses.ResponseContentPartAddedEvent:
10199//	case responses.ResponseContentPartDoneEvent:
10200//	case responses.ResponseCreatedEvent:
10201//	case responses.ResponseErrorEvent:
10202//	case responses.ResponseFileSearchCallCompletedEvent:
10203//	case responses.ResponseFileSearchCallInProgressEvent:
10204//	case responses.ResponseFileSearchCallSearchingEvent:
10205//	case responses.ResponseFunctionCallArgumentsDeltaEvent:
10206//	case responses.ResponseFunctionCallArgumentsDoneEvent:
10207//	case responses.ResponseInProgressEvent:
10208//	case responses.ResponseFailedEvent:
10209//	case responses.ResponseIncompleteEvent:
10210//	case responses.ResponseOutputItemAddedEvent:
10211//	case responses.ResponseOutputItemDoneEvent:
10212//	case responses.ResponseReasoningSummaryPartAddedEvent:
10213//	case responses.ResponseReasoningSummaryPartDoneEvent:
10214//	case responses.ResponseReasoningSummaryTextDeltaEvent:
10215//	case responses.ResponseReasoningSummaryTextDoneEvent:
10216//	case responses.ResponseRefusalDeltaEvent:
10217//	case responses.ResponseRefusalDoneEvent:
10218//	case responses.ResponseTextDeltaEvent:
10219//	case responses.ResponseTextDoneEvent:
10220//	case responses.ResponseWebSearchCallCompletedEvent:
10221//	case responses.ResponseWebSearchCallInProgressEvent:
10222//	case responses.ResponseWebSearchCallSearchingEvent:
10223//	case responses.ResponseImageGenCallCompletedEvent:
10224//	case responses.ResponseImageGenCallGeneratingEvent:
10225//	case responses.ResponseImageGenCallInProgressEvent:
10226//	case responses.ResponseImageGenCallPartialImageEvent:
10227//	case responses.ResponseMcpCallArgumentsDeltaEvent:
10228//	case responses.ResponseMcpCallArgumentsDoneEvent:
10229//	case responses.ResponseMcpCallCompletedEvent:
10230//	case responses.ResponseMcpCallFailedEvent:
10231//	case responses.ResponseMcpCallInProgressEvent:
10232//	case responses.ResponseMcpListToolsCompletedEvent:
10233//	case responses.ResponseMcpListToolsFailedEvent:
10234//	case responses.ResponseMcpListToolsInProgressEvent:
10235//	case responses.ResponseOutputTextAnnotationAddedEvent:
10236//	case responses.ResponseQueuedEvent:
10237//	case responses.ResponseReasoningDeltaEvent:
10238//	case responses.ResponseReasoningDoneEvent:
10239//	case responses.ResponseReasoningSummaryDeltaEvent:
10240//	case responses.ResponseReasoningSummaryDoneEvent:
10241//	default:
10242//	  fmt.Errorf("no variant present")
10243//	}
10244func (u ResponseStreamEventUnion) AsAny() anyResponseStreamEvent {
10245	switch u.Type {
10246	case "response.audio.delta":
10247		return u.AsResponseAudioDelta()
10248	case "response.audio.done":
10249		return u.AsResponseAudioDone()
10250	case "response.audio.transcript.delta":
10251		return u.AsResponseAudioTranscriptDelta()
10252	case "response.audio.transcript.done":
10253		return u.AsResponseAudioTranscriptDone()
10254	case "response.code_interpreter_call_code.delta":
10255		return u.AsResponseCodeInterpreterCallCodeDelta()
10256	case "response.code_interpreter_call_code.done":
10257		return u.AsResponseCodeInterpreterCallCodeDone()
10258	case "response.code_interpreter_call.completed":
10259		return u.AsResponseCodeInterpreterCallCompleted()
10260	case "response.code_interpreter_call.in_progress":
10261		return u.AsResponseCodeInterpreterCallInProgress()
10262	case "response.code_interpreter_call.interpreting":
10263		return u.AsResponseCodeInterpreterCallInterpreting()
10264	case "response.completed":
10265		return u.AsResponseCompleted()
10266	case "response.content_part.added":
10267		return u.AsResponseContentPartAdded()
10268	case "response.content_part.done":
10269		return u.AsResponseContentPartDone()
10270	case "response.created":
10271		return u.AsResponseCreated()
10272	case "error":
10273		return u.AsError()
10274	case "response.file_search_call.completed":
10275		return u.AsResponseFileSearchCallCompleted()
10276	case "response.file_search_call.in_progress":
10277		return u.AsResponseFileSearchCallInProgress()
10278	case "response.file_search_call.searching":
10279		return u.AsResponseFileSearchCallSearching()
10280	case "response.function_call_arguments.delta":
10281		return u.AsResponseFunctionCallArgumentsDelta()
10282	case "response.function_call_arguments.done":
10283		return u.AsResponseFunctionCallArgumentsDone()
10284	case "response.in_progress":
10285		return u.AsResponseInProgress()
10286	case "response.failed":
10287		return u.AsResponseFailed()
10288	case "response.incomplete":
10289		return u.AsResponseIncomplete()
10290	case "response.output_item.added":
10291		return u.AsResponseOutputItemAdded()
10292	case "response.output_item.done":
10293		return u.AsResponseOutputItemDone()
10294	case "response.reasoning_summary_part.added":
10295		return u.AsResponseReasoningSummaryPartAdded()
10296	case "response.reasoning_summary_part.done":
10297		return u.AsResponseReasoningSummaryPartDone()
10298	case "response.reasoning_summary_text.delta":
10299		return u.AsResponseReasoningSummaryTextDelta()
10300	case "response.reasoning_summary_text.done":
10301		return u.AsResponseReasoningSummaryTextDone()
10302	case "response.refusal.delta":
10303		return u.AsResponseRefusalDelta()
10304	case "response.refusal.done":
10305		return u.AsResponseRefusalDone()
10306	case "response.output_text.delta":
10307		return u.AsResponseOutputTextDelta()
10308	case "response.output_text.done":
10309		return u.AsResponseOutputTextDone()
10310	case "response.web_search_call.completed":
10311		return u.AsResponseWebSearchCallCompleted()
10312	case "response.web_search_call.in_progress":
10313		return u.AsResponseWebSearchCallInProgress()
10314	case "response.web_search_call.searching":
10315		return u.AsResponseWebSearchCallSearching()
10316	case "response.image_generation_call.completed":
10317		return u.AsResponseImageGenerationCallCompleted()
10318	case "response.image_generation_call.generating":
10319		return u.AsResponseImageGenerationCallGenerating()
10320	case "response.image_generation_call.in_progress":
10321		return u.AsResponseImageGenerationCallInProgress()
10322	case "response.image_generation_call.partial_image":
10323		return u.AsResponseImageGenerationCallPartialImage()
10324	case "response.mcp_call.arguments_delta":
10325		return u.AsResponseMcpCallArgumentsDelta()
10326	case "response.mcp_call.arguments_done":
10327		return u.AsResponseMcpCallArgumentsDone()
10328	case "response.mcp_call.completed":
10329		return u.AsResponseMcpCallCompleted()
10330	case "response.mcp_call.failed":
10331		return u.AsResponseMcpCallFailed()
10332	case "response.mcp_call.in_progress":
10333		return u.AsResponseMcpCallInProgress()
10334	case "response.mcp_list_tools.completed":
10335		return u.AsResponseMcpListToolsCompleted()
10336	case "response.mcp_list_tools.failed":
10337		return u.AsResponseMcpListToolsFailed()
10338	case "response.mcp_list_tools.in_progress":
10339		return u.AsResponseMcpListToolsInProgress()
10340	case "response.output_text_annotation.added":
10341		return u.AsResponseOutputTextAnnotationAdded()
10342	case "response.queued":
10343		return u.AsResponseQueued()
10344	case "response.reasoning.delta":
10345		return u.AsResponseReasoningDelta()
10346	case "response.reasoning.done":
10347		return u.AsResponseReasoningDone()
10348	case "response.reasoning_summary.delta":
10349		return u.AsResponseReasoningSummaryDelta()
10350	case "response.reasoning_summary.done":
10351		return u.AsResponseReasoningSummaryDone()
10352	}
10353	return nil
10354}
10355
10356func (u ResponseStreamEventUnion) AsResponseAudioDelta() (v ResponseAudioDeltaEvent) {
10357	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10358	return
10359}
10360
10361func (u ResponseStreamEventUnion) AsResponseAudioDone() (v ResponseAudioDoneEvent) {
10362	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10363	return
10364}
10365
10366func (u ResponseStreamEventUnion) AsResponseAudioTranscriptDelta() (v ResponseAudioTranscriptDeltaEvent) {
10367	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10368	return
10369}
10370
10371func (u ResponseStreamEventUnion) AsResponseAudioTranscriptDone() (v ResponseAudioTranscriptDoneEvent) {
10372	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10373	return
10374}
10375
10376func (u ResponseStreamEventUnion) AsResponseCodeInterpreterCallCodeDelta() (v ResponseCodeInterpreterCallCodeDeltaEvent) {
10377	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10378	return
10379}
10380
10381func (u ResponseStreamEventUnion) AsResponseCodeInterpreterCallCodeDone() (v ResponseCodeInterpreterCallCodeDoneEvent) {
10382	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10383	return
10384}
10385
10386func (u ResponseStreamEventUnion) AsResponseCodeInterpreterCallCompleted() (v ResponseCodeInterpreterCallCompletedEvent) {
10387	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10388	return
10389}
10390
10391func (u ResponseStreamEventUnion) AsResponseCodeInterpreterCallInProgress() (v ResponseCodeInterpreterCallInProgressEvent) {
10392	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10393	return
10394}
10395
10396func (u ResponseStreamEventUnion) AsResponseCodeInterpreterCallInterpreting() (v ResponseCodeInterpreterCallInterpretingEvent) {
10397	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10398	return
10399}
10400
10401func (u ResponseStreamEventUnion) AsResponseCompleted() (v ResponseCompletedEvent) {
10402	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10403	return
10404}
10405
10406func (u ResponseStreamEventUnion) AsResponseContentPartAdded() (v ResponseContentPartAddedEvent) {
10407	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10408	return
10409}
10410
10411func (u ResponseStreamEventUnion) AsResponseContentPartDone() (v ResponseContentPartDoneEvent) {
10412	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10413	return
10414}
10415
10416func (u ResponseStreamEventUnion) AsResponseCreated() (v ResponseCreatedEvent) {
10417	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10418	return
10419}
10420
10421func (u ResponseStreamEventUnion) AsError() (v ResponseErrorEvent) {
10422	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10423	return
10424}
10425
10426func (u ResponseStreamEventUnion) AsResponseFileSearchCallCompleted() (v ResponseFileSearchCallCompletedEvent) {
10427	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10428	return
10429}
10430
10431func (u ResponseStreamEventUnion) AsResponseFileSearchCallInProgress() (v ResponseFileSearchCallInProgressEvent) {
10432	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10433	return
10434}
10435
10436func (u ResponseStreamEventUnion) AsResponseFileSearchCallSearching() (v ResponseFileSearchCallSearchingEvent) {
10437	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10438	return
10439}
10440
10441func (u ResponseStreamEventUnion) AsResponseFunctionCallArgumentsDelta() (v ResponseFunctionCallArgumentsDeltaEvent) {
10442	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10443	return
10444}
10445
10446func (u ResponseStreamEventUnion) AsResponseFunctionCallArgumentsDone() (v ResponseFunctionCallArgumentsDoneEvent) {
10447	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10448	return
10449}
10450
10451func (u ResponseStreamEventUnion) AsResponseInProgress() (v ResponseInProgressEvent) {
10452	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10453	return
10454}
10455
10456func (u ResponseStreamEventUnion) AsResponseFailed() (v ResponseFailedEvent) {
10457	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10458	return
10459}
10460
10461func (u ResponseStreamEventUnion) AsResponseIncomplete() (v ResponseIncompleteEvent) {
10462	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10463	return
10464}
10465
10466func (u ResponseStreamEventUnion) AsResponseOutputItemAdded() (v ResponseOutputItemAddedEvent) {
10467	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10468	return
10469}
10470
10471func (u ResponseStreamEventUnion) AsResponseOutputItemDone() (v ResponseOutputItemDoneEvent) {
10472	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10473	return
10474}
10475
10476func (u ResponseStreamEventUnion) AsResponseReasoningSummaryPartAdded() (v ResponseReasoningSummaryPartAddedEvent) {
10477	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10478	return
10479}
10480
10481func (u ResponseStreamEventUnion) AsResponseReasoningSummaryPartDone() (v ResponseReasoningSummaryPartDoneEvent) {
10482	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10483	return
10484}
10485
10486func (u ResponseStreamEventUnion) AsResponseReasoningSummaryTextDelta() (v ResponseReasoningSummaryTextDeltaEvent) {
10487	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10488	return
10489}
10490
10491func (u ResponseStreamEventUnion) AsResponseReasoningSummaryTextDone() (v ResponseReasoningSummaryTextDoneEvent) {
10492	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10493	return
10494}
10495
10496func (u ResponseStreamEventUnion) AsResponseRefusalDelta() (v ResponseRefusalDeltaEvent) {
10497	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10498	return
10499}
10500
10501func (u ResponseStreamEventUnion) AsResponseRefusalDone() (v ResponseRefusalDoneEvent) {
10502	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10503	return
10504}
10505
10506func (u ResponseStreamEventUnion) AsResponseOutputTextDelta() (v ResponseTextDeltaEvent) {
10507	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10508	return
10509}
10510
10511func (u ResponseStreamEventUnion) AsResponseOutputTextDone() (v ResponseTextDoneEvent) {
10512	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10513	return
10514}
10515
10516func (u ResponseStreamEventUnion) AsResponseWebSearchCallCompleted() (v ResponseWebSearchCallCompletedEvent) {
10517	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10518	return
10519}
10520
10521func (u ResponseStreamEventUnion) AsResponseWebSearchCallInProgress() (v ResponseWebSearchCallInProgressEvent) {
10522	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10523	return
10524}
10525
10526func (u ResponseStreamEventUnion) AsResponseWebSearchCallSearching() (v ResponseWebSearchCallSearchingEvent) {
10527	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10528	return
10529}
10530
10531func (u ResponseStreamEventUnion) AsResponseImageGenerationCallCompleted() (v ResponseImageGenCallCompletedEvent) {
10532	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10533	return
10534}
10535
10536func (u ResponseStreamEventUnion) AsResponseImageGenerationCallGenerating() (v ResponseImageGenCallGeneratingEvent) {
10537	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10538	return
10539}
10540
10541func (u ResponseStreamEventUnion) AsResponseImageGenerationCallInProgress() (v ResponseImageGenCallInProgressEvent) {
10542	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10543	return
10544}
10545
10546func (u ResponseStreamEventUnion) AsResponseImageGenerationCallPartialImage() (v ResponseImageGenCallPartialImageEvent) {
10547	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10548	return
10549}
10550
10551func (u ResponseStreamEventUnion) AsResponseMcpCallArgumentsDelta() (v ResponseMcpCallArgumentsDeltaEvent) {
10552	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10553	return
10554}
10555
10556func (u ResponseStreamEventUnion) AsResponseMcpCallArgumentsDone() (v ResponseMcpCallArgumentsDoneEvent) {
10557	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10558	return
10559}
10560
10561func (u ResponseStreamEventUnion) AsResponseMcpCallCompleted() (v ResponseMcpCallCompletedEvent) {
10562	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10563	return
10564}
10565
10566func (u ResponseStreamEventUnion) AsResponseMcpCallFailed() (v ResponseMcpCallFailedEvent) {
10567	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10568	return
10569}
10570
10571func (u ResponseStreamEventUnion) AsResponseMcpCallInProgress() (v ResponseMcpCallInProgressEvent) {
10572	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10573	return
10574}
10575
10576func (u ResponseStreamEventUnion) AsResponseMcpListToolsCompleted() (v ResponseMcpListToolsCompletedEvent) {
10577	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10578	return
10579}
10580
10581func (u ResponseStreamEventUnion) AsResponseMcpListToolsFailed() (v ResponseMcpListToolsFailedEvent) {
10582	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10583	return
10584}
10585
10586func (u ResponseStreamEventUnion) AsResponseMcpListToolsInProgress() (v ResponseMcpListToolsInProgressEvent) {
10587	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10588	return
10589}
10590
10591func (u ResponseStreamEventUnion) AsResponseOutputTextAnnotationAdded() (v ResponseOutputTextAnnotationAddedEvent) {
10592	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10593	return
10594}
10595
10596func (u ResponseStreamEventUnion) AsResponseQueued() (v ResponseQueuedEvent) {
10597	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10598	return
10599}
10600
10601func (u ResponseStreamEventUnion) AsResponseReasoningDelta() (v ResponseReasoningDeltaEvent) {
10602	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10603	return
10604}
10605
10606func (u ResponseStreamEventUnion) AsResponseReasoningDone() (v ResponseReasoningDoneEvent) {
10607	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10608	return
10609}
10610
10611func (u ResponseStreamEventUnion) AsResponseReasoningSummaryDelta() (v ResponseReasoningSummaryDeltaEvent) {
10612	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10613	return
10614}
10615
10616func (u ResponseStreamEventUnion) AsResponseReasoningSummaryDone() (v ResponseReasoningSummaryDoneEvent) {
10617	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
10618	return
10619}
10620
10621// Returns the unmodified JSON received from the API
10622func (u ResponseStreamEventUnion) RawJSON() string { return u.JSON.raw }
10623
10624func (r *ResponseStreamEventUnion) UnmarshalJSON(data []byte) error {
10625	return apijson.UnmarshalRoot(data, r)
10626}
10627
10628// ResponseStreamEventUnionDelta is an implicit subunion of
10629// [ResponseStreamEventUnion]. ResponseStreamEventUnionDelta provides convenient
10630// access to the sub-properties of the union.
10631//
10632// For type safety it is recommended to directly use a variant of the
10633// [ResponseStreamEventUnion].
10634//
10635// If the underlying value is not a json object, one of the following properties
10636// will be valid: OfString OfResponseReasoningSummaryDeltaEventDelta]
10637type ResponseStreamEventUnionDelta struct {
10638	// This field will be present if the value is a [string] instead of an object.
10639	OfString string `json:",inline"`
10640	// This field will be present if the value is a [any] instead of an object.
10641	OfResponseReasoningSummaryDeltaEventDelta any `json:",inline"`
10642	JSON                                      struct {
10643		OfString                                  respjson.Field
10644		OfResponseReasoningSummaryDeltaEventDelta respjson.Field
10645		raw                                       string
10646	} `json:"-"`
10647}
10648
10649func (r *ResponseStreamEventUnionDelta) UnmarshalJSON(data []byte) error {
10650	return apijson.UnmarshalRoot(data, r)
10651}
10652
10653// ResponseStreamEventUnionPart is an implicit subunion of
10654// [ResponseStreamEventUnion]. ResponseStreamEventUnionPart provides convenient
10655// access to the sub-properties of the union.
10656//
10657// For type safety it is recommended to directly use a variant of the
10658// [ResponseStreamEventUnion].
10659type ResponseStreamEventUnionPart struct {
10660	// This field is from variant [ResponseContentPartAddedEventPartUnion],
10661	// [ResponseContentPartDoneEventPartUnion].
10662	Annotations []ResponseOutputTextAnnotationUnion `json:"annotations"`
10663	Text        string                              `json:"text"`
10664	Type        string                              `json:"type"`
10665	// This field is from variant [ResponseContentPartAddedEventPartUnion],
10666	// [ResponseContentPartDoneEventPartUnion].
10667	Logprobs []ResponseOutputTextLogprob `json:"logprobs"`
10668	// This field is from variant [ResponseContentPartAddedEventPartUnion],
10669	// [ResponseContentPartDoneEventPartUnion].
10670	Refusal string `json:"refusal"`
10671	JSON    struct {
10672		Annotations respjson.Field
10673		Text        respjson.Field
10674		Type        respjson.Field
10675		Logprobs    respjson.Field
10676		Refusal     respjson.Field
10677		raw         string
10678	} `json:"-"`
10679}
10680
10681func (r *ResponseStreamEventUnionPart) UnmarshalJSON(data []byte) error {
10682	return apijson.UnmarshalRoot(data, r)
10683}
10684
10685// ResponseStreamEventUnionArguments is an implicit subunion of
10686// [ResponseStreamEventUnion]. ResponseStreamEventUnionArguments provides
10687// convenient access to the sub-properties of the union.
10688//
10689// For type safety it is recommended to directly use a variant of the
10690// [ResponseStreamEventUnion].
10691//
10692// If the underlying value is not a json object, one of the following properties
10693// will be valid: OfString OfResponseMcpCallArgumentsDoneEventArguments]
10694type ResponseStreamEventUnionArguments struct {
10695	// This field will be present if the value is a [string] instead of an object.
10696	OfString string `json:",inline"`
10697	// This field will be present if the value is a [any] instead of an object.
10698	OfResponseMcpCallArgumentsDoneEventArguments any `json:",inline"`
10699	JSON                                         struct {
10700		OfString                                     respjson.Field
10701		OfResponseMcpCallArgumentsDoneEventArguments respjson.Field
10702		raw                                          string
10703	} `json:"-"`
10704}
10705
10706func (r *ResponseStreamEventUnionArguments) UnmarshalJSON(data []byte) error {
10707	return apijson.UnmarshalRoot(data, r)
10708}
10709
10710// Configuration options for a text response from the model. Can be plain text or
10711// structured JSON data. Learn more:
10712//
10713// - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
10714// - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
10715type ResponseTextConfig struct {
10716	// An object specifying the format that the model must output.
10717	//
10718	// Configuring `{ "type": "json_schema" }` enables Structured Outputs, which
10719	// ensures the model will match your supplied JSON schema. Learn more in the
10720	// [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
10721	//
10722	// The default format is `{ "type": "text" }` with no additional options.
10723	//
10724	// **Not recommended for gpt-4o and newer models:**
10725	//
10726	// Setting to `{ "type": "json_object" }` enables the older JSON mode, which
10727	// ensures the message the model generates is valid JSON. Using `json_schema` is
10728	// preferred for models that support it.
10729	Format ResponseFormatTextConfigUnion `json:"format"`
10730	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
10731	JSON struct {
10732		Format      respjson.Field
10733		ExtraFields map[string]respjson.Field
10734		raw         string
10735	} `json:"-"`
10736}
10737
10738// Returns the unmodified JSON received from the API
10739func (r ResponseTextConfig) RawJSON() string { return r.JSON.raw }
10740func (r *ResponseTextConfig) UnmarshalJSON(data []byte) error {
10741	return apijson.UnmarshalRoot(data, r)
10742}
10743
10744// ToParam converts this ResponseTextConfig to a ResponseTextConfigParam.
10745//
10746// Warning: the fields of the param type will not be present. ToParam should only
10747// be used at the last possible moment before sending a request. Test for this with
10748// ResponseTextConfigParam.Overrides()
10749func (r ResponseTextConfig) ToParam() ResponseTextConfigParam {
10750	return param.Override[ResponseTextConfigParam](json.RawMessage(r.RawJSON()))
10751}
10752
10753// Configuration options for a text response from the model. Can be plain text or
10754// structured JSON data. Learn more:
10755//
10756// - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
10757// - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
10758type ResponseTextConfigParam struct {
10759	// An object specifying the format that the model must output.
10760	//
10761	// Configuring `{ "type": "json_schema" }` enables Structured Outputs, which
10762	// ensures the model will match your supplied JSON schema. Learn more in the
10763	// [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
10764	//
10765	// The default format is `{ "type": "text" }` with no additional options.
10766	//
10767	// **Not recommended for gpt-4o and newer models:**
10768	//
10769	// Setting to `{ "type": "json_object" }` enables the older JSON mode, which
10770	// ensures the message the model generates is valid JSON. Using `json_schema` is
10771	// preferred for models that support it.
10772	Format ResponseFormatTextConfigUnionParam `json:"format,omitzero"`
10773	paramObj
10774}
10775
10776func (r ResponseTextConfigParam) MarshalJSON() (data []byte, err error) {
10777	type shadow ResponseTextConfigParam
10778	return param.MarshalObject(r, (*shadow)(&r))
10779}
10780func (r *ResponseTextConfigParam) UnmarshalJSON(data []byte) error {
10781	return apijson.UnmarshalRoot(data, r)
10782}
10783
10784// Emitted when there is an additional text delta.
10785type ResponseTextDeltaEvent struct {
10786	// The index of the content part that the text delta was added to.
10787	ContentIndex int64 `json:"content_index,required"`
10788	// The text delta that was added.
10789	Delta string `json:"delta,required"`
10790	// The ID of the output item that the text delta was added to.
10791	ItemID string `json:"item_id,required"`
10792	// The index of the output item that the text delta was added to.
10793	OutputIndex int64 `json:"output_index,required"`
10794	// The sequence number for this event.
10795	SequenceNumber int64 `json:"sequence_number,required"`
10796	// The type of the event. Always `response.output_text.delta`.
10797	Type constant.ResponseOutputTextDelta `json:"type,required"`
10798	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
10799	JSON struct {
10800		ContentIndex   respjson.Field
10801		Delta          respjson.Field
10802		ItemID         respjson.Field
10803		OutputIndex    respjson.Field
10804		SequenceNumber respjson.Field
10805		Type           respjson.Field
10806		ExtraFields    map[string]respjson.Field
10807		raw            string
10808	} `json:"-"`
10809}
10810
10811// Returns the unmodified JSON received from the API
10812func (r ResponseTextDeltaEvent) RawJSON() string { return r.JSON.raw }
10813func (r *ResponseTextDeltaEvent) UnmarshalJSON(data []byte) error {
10814	return apijson.UnmarshalRoot(data, r)
10815}
10816
10817// Emitted when text content is finalized.
10818type ResponseTextDoneEvent struct {
10819	// The index of the content part that the text content is finalized.
10820	ContentIndex int64 `json:"content_index,required"`
10821	// The ID of the output item that the text content is finalized.
10822	ItemID string `json:"item_id,required"`
10823	// The index of the output item that the text content is finalized.
10824	OutputIndex int64 `json:"output_index,required"`
10825	// The sequence number for this event.
10826	SequenceNumber int64 `json:"sequence_number,required"`
10827	// The text content that is finalized.
10828	Text string `json:"text,required"`
10829	// The type of the event. Always `response.output_text.done`.
10830	Type constant.ResponseOutputTextDone `json:"type,required"`
10831	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
10832	JSON struct {
10833		ContentIndex   respjson.Field
10834		ItemID         respjson.Field
10835		OutputIndex    respjson.Field
10836		SequenceNumber respjson.Field
10837		Text           respjson.Field
10838		Type           respjson.Field
10839		ExtraFields    map[string]respjson.Field
10840		raw            string
10841	} `json:"-"`
10842}
10843
10844// Returns the unmodified JSON received from the API
10845func (r ResponseTextDoneEvent) RawJSON() string { return r.JSON.raw }
10846func (r *ResponseTextDoneEvent) UnmarshalJSON(data []byte) error {
10847	return apijson.UnmarshalRoot(data, r)
10848}
10849
10850// Represents token usage details including input tokens, output tokens, a
10851// breakdown of output tokens, and the total tokens used.
10852type ResponseUsage struct {
10853	// The number of input tokens.
10854	InputTokens int64 `json:"input_tokens,required"`
10855	// A detailed breakdown of the input tokens.
10856	InputTokensDetails ResponseUsageInputTokensDetails `json:"input_tokens_details,required"`
10857	// The number of output tokens.
10858	OutputTokens int64 `json:"output_tokens,required"`
10859	// A detailed breakdown of the output tokens.
10860	OutputTokensDetails ResponseUsageOutputTokensDetails `json:"output_tokens_details,required"`
10861	// The total number of tokens used.
10862	TotalTokens int64 `json:"total_tokens,required"`
10863	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
10864	JSON struct {
10865		InputTokens         respjson.Field
10866		InputTokensDetails  respjson.Field
10867		OutputTokens        respjson.Field
10868		OutputTokensDetails respjson.Field
10869		TotalTokens         respjson.Field
10870		ExtraFields         map[string]respjson.Field
10871		raw                 string
10872	} `json:"-"`
10873}
10874
10875// Returns the unmodified JSON received from the API
10876func (r ResponseUsage) RawJSON() string { return r.JSON.raw }
10877func (r *ResponseUsage) UnmarshalJSON(data []byte) error {
10878	return apijson.UnmarshalRoot(data, r)
10879}
10880
10881// A detailed breakdown of the input tokens.
10882type ResponseUsageInputTokensDetails struct {
10883	// The number of tokens that were retrieved from the cache.
10884	// [More on prompt caching](https://platform.openai.com/docs/guides/prompt-caching).
10885	CachedTokens int64 `json:"cached_tokens,required"`
10886	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
10887	JSON struct {
10888		CachedTokens respjson.Field
10889		ExtraFields  map[string]respjson.Field
10890		raw          string
10891	} `json:"-"`
10892}
10893
10894// Returns the unmodified JSON received from the API
10895func (r ResponseUsageInputTokensDetails) RawJSON() string { return r.JSON.raw }
10896func (r *ResponseUsageInputTokensDetails) UnmarshalJSON(data []byte) error {
10897	return apijson.UnmarshalRoot(data, r)
10898}
10899
10900// A detailed breakdown of the output tokens.
10901type ResponseUsageOutputTokensDetails struct {
10902	// The number of reasoning tokens.
10903	ReasoningTokens int64 `json:"reasoning_tokens,required"`
10904	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
10905	JSON struct {
10906		ReasoningTokens respjson.Field
10907		ExtraFields     map[string]respjson.Field
10908		raw             string
10909	} `json:"-"`
10910}
10911
10912// Returns the unmodified JSON received from the API
10913func (r ResponseUsageOutputTokensDetails) RawJSON() string { return r.JSON.raw }
10914func (r *ResponseUsageOutputTokensDetails) UnmarshalJSON(data []byte) error {
10915	return apijson.UnmarshalRoot(data, r)
10916}
10917
10918// Emitted when a web search call is completed.
10919type ResponseWebSearchCallCompletedEvent struct {
10920	// Unique ID for the output item associated with the web search call.
10921	ItemID string `json:"item_id,required"`
10922	// The index of the output item that the web search call is associated with.
10923	OutputIndex int64 `json:"output_index,required"`
10924	// The sequence number of the web search call being processed.
10925	SequenceNumber int64 `json:"sequence_number,required"`
10926	// The type of the event. Always `response.web_search_call.completed`.
10927	Type constant.ResponseWebSearchCallCompleted `json:"type,required"`
10928	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
10929	JSON struct {
10930		ItemID         respjson.Field
10931		OutputIndex    respjson.Field
10932		SequenceNumber respjson.Field
10933		Type           respjson.Field
10934		ExtraFields    map[string]respjson.Field
10935		raw            string
10936	} `json:"-"`
10937}
10938
10939// Returns the unmodified JSON received from the API
10940func (r ResponseWebSearchCallCompletedEvent) RawJSON() string { return r.JSON.raw }
10941func (r *ResponseWebSearchCallCompletedEvent) UnmarshalJSON(data []byte) error {
10942	return apijson.UnmarshalRoot(data, r)
10943}
10944
10945// Emitted when a web search call is initiated.
10946type ResponseWebSearchCallInProgressEvent struct {
10947	// Unique ID for the output item associated with the web search call.
10948	ItemID string `json:"item_id,required"`
10949	// The index of the output item that the web search call is associated with.
10950	OutputIndex int64 `json:"output_index,required"`
10951	// The sequence number of the web search call being processed.
10952	SequenceNumber int64 `json:"sequence_number,required"`
10953	// The type of the event. Always `response.web_search_call.in_progress`.
10954	Type constant.ResponseWebSearchCallInProgress `json:"type,required"`
10955	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
10956	JSON struct {
10957		ItemID         respjson.Field
10958		OutputIndex    respjson.Field
10959		SequenceNumber respjson.Field
10960		Type           respjson.Field
10961		ExtraFields    map[string]respjson.Field
10962		raw            string
10963	} `json:"-"`
10964}
10965
10966// Returns the unmodified JSON received from the API
10967func (r ResponseWebSearchCallInProgressEvent) RawJSON() string { return r.JSON.raw }
10968func (r *ResponseWebSearchCallInProgressEvent) UnmarshalJSON(data []byte) error {
10969	return apijson.UnmarshalRoot(data, r)
10970}
10971
10972// Emitted when a web search call is executing.
10973type ResponseWebSearchCallSearchingEvent struct {
10974	// Unique ID for the output item associated with the web search call.
10975	ItemID string `json:"item_id,required"`
10976	// The index of the output item that the web search call is associated with.
10977	OutputIndex int64 `json:"output_index,required"`
10978	// The sequence number of the web search call being processed.
10979	SequenceNumber int64 `json:"sequence_number,required"`
10980	// The type of the event. Always `response.web_search_call.searching`.
10981	Type constant.ResponseWebSearchCallSearching `json:"type,required"`
10982	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
10983	JSON struct {
10984		ItemID         respjson.Field
10985		OutputIndex    respjson.Field
10986		SequenceNumber respjson.Field
10987		Type           respjson.Field
10988		ExtraFields    map[string]respjson.Field
10989		raw            string
10990	} `json:"-"`
10991}
10992
10993// Returns the unmodified JSON received from the API
10994func (r ResponseWebSearchCallSearchingEvent) RawJSON() string { return r.JSON.raw }
10995func (r *ResponseWebSearchCallSearchingEvent) UnmarshalJSON(data []byte) error {
10996	return apijson.UnmarshalRoot(data, r)
10997}
10998
10999// ToolUnion contains all possible properties and values from [FunctionTool],
11000// [FileSearchTool], [WebSearchTool], [ComputerTool], [ToolMcp],
11001// [ToolCodeInterpreter], [ToolImageGeneration], [ToolLocalShell].
11002//
11003// Use the [ToolUnion.AsAny] method to switch on the variant.
11004//
11005// Use the methods beginning with 'As' to cast the union to one of its variants.
11006type ToolUnion struct {
11007	// This field is from variant [FunctionTool].
11008	Name string `json:"name"`
11009	// This field is from variant [FunctionTool].
11010	Parameters map[string]any `json:"parameters"`
11011	// This field is from variant [FunctionTool].
11012	Strict bool `json:"strict"`
11013	// Any of "function", "file_search", nil, "computer_use_preview", "mcp",
11014	// "code_interpreter", "image_generation", "local_shell".
11015	Type string `json:"type"`
11016	// This field is from variant [FunctionTool].
11017	Description string `json:"description"`
11018	// This field is from variant [FileSearchTool].
11019	VectorStoreIDs []string `json:"vector_store_ids"`
11020	// This field is from variant [FileSearchTool].
11021	Filters FileSearchToolFiltersUnion `json:"filters"`
11022	// This field is from variant [FileSearchTool].
11023	MaxNumResults int64 `json:"max_num_results"`
11024	// This field is from variant [FileSearchTool].
11025	RankingOptions FileSearchToolRankingOptions `json:"ranking_options"`
11026	// This field is from variant [WebSearchTool].
11027	SearchContextSize WebSearchToolSearchContextSize `json:"search_context_size"`
11028	// This field is from variant [WebSearchTool].
11029	UserLocation WebSearchToolUserLocation `json:"user_location"`
11030	// This field is from variant [ComputerTool].
11031	DisplayHeight int64 `json:"display_height"`
11032	// This field is from variant [ComputerTool].
11033	DisplayWidth int64 `json:"display_width"`
11034	// This field is from variant [ComputerTool].
11035	Environment ComputerToolEnvironment `json:"environment"`
11036	// This field is from variant [ToolMcp].
11037	ServerLabel string `json:"server_label"`
11038	// This field is from variant [ToolMcp].
11039	ServerURL string `json:"server_url"`
11040	// This field is from variant [ToolMcp].
11041	AllowedTools ToolMcpAllowedToolsUnion `json:"allowed_tools"`
11042	// This field is from variant [ToolMcp].
11043	Headers map[string]string `json:"headers"`
11044	// This field is from variant [ToolMcp].
11045	RequireApproval ToolMcpRequireApprovalUnion `json:"require_approval"`
11046	// This field is from variant [ToolCodeInterpreter].
11047	Container ToolCodeInterpreterContainerUnion `json:"container"`
11048	// This field is from variant [ToolImageGeneration].
11049	Background string `json:"background"`
11050	// This field is from variant [ToolImageGeneration].
11051	InputImageMask ToolImageGenerationInputImageMask `json:"input_image_mask"`
11052	// This field is from variant [ToolImageGeneration].
11053	Model string `json:"model"`
11054	// This field is from variant [ToolImageGeneration].
11055	Moderation string `json:"moderation"`
11056	// This field is from variant [ToolImageGeneration].
11057	OutputCompression int64 `json:"output_compression"`
11058	// This field is from variant [ToolImageGeneration].
11059	OutputFormat string `json:"output_format"`
11060	// This field is from variant [ToolImageGeneration].
11061	PartialImages int64 `json:"partial_images"`
11062	// This field is from variant [ToolImageGeneration].
11063	Quality string `json:"quality"`
11064	// This field is from variant [ToolImageGeneration].
11065	Size string `json:"size"`
11066	JSON struct {
11067		Name              respjson.Field
11068		Parameters        respjson.Field
11069		Strict            respjson.Field
11070		Type              respjson.Field
11071		Description       respjson.Field
11072		VectorStoreIDs    respjson.Field
11073		Filters           respjson.Field
11074		MaxNumResults     respjson.Field
11075		RankingOptions    respjson.Field
11076		SearchContextSize respjson.Field
11077		UserLocation      respjson.Field
11078		DisplayHeight     respjson.Field
11079		DisplayWidth      respjson.Field
11080		Environment       respjson.Field
11081		ServerLabel       respjson.Field
11082		ServerURL         respjson.Field
11083		AllowedTools      respjson.Field
11084		Headers           respjson.Field
11085		RequireApproval   respjson.Field
11086		Container         respjson.Field
11087		Background        respjson.Field
11088		InputImageMask    respjson.Field
11089		Model             respjson.Field
11090		Moderation        respjson.Field
11091		OutputCompression respjson.Field
11092		OutputFormat      respjson.Field
11093		PartialImages     respjson.Field
11094		Quality           respjson.Field
11095		Size              respjson.Field
11096		raw               string
11097	} `json:"-"`
11098}
11099
11100func (u ToolUnion) AsFunction() (v FunctionTool) {
11101	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
11102	return
11103}
11104
11105func (u ToolUnion) AsFileSearch() (v FileSearchTool) {
11106	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
11107	return
11108}
11109
11110func (u ToolUnion) AsWebSearchPreview() (v WebSearchTool) {
11111	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
11112	return
11113}
11114
11115func (u ToolUnion) AsComputerUsePreview() (v ComputerTool) {
11116	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
11117	return
11118}
11119
11120func (u ToolUnion) AsMcp() (v ToolMcp) {
11121	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
11122	return
11123}
11124
11125func (u ToolUnion) AsCodeInterpreter() (v ToolCodeInterpreter) {
11126	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
11127	return
11128}
11129
11130func (u ToolUnion) AsImageGeneration() (v ToolImageGeneration) {
11131	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
11132	return
11133}
11134
11135func (u ToolUnion) AsLocalShell() (v ToolLocalShell) {
11136	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
11137	return
11138}
11139
11140// Returns the unmodified JSON received from the API
11141func (u ToolUnion) RawJSON() string { return u.JSON.raw }
11142
11143func (r *ToolUnion) UnmarshalJSON(data []byte) error {
11144	return apijson.UnmarshalRoot(data, r)
11145}
11146
11147// ToParam converts this ToolUnion to a ToolUnionParam.
11148//
11149// Warning: the fields of the param type will not be present. ToParam should only
11150// be used at the last possible moment before sending a request. Test for this with
11151// ToolUnionParam.Overrides()
11152func (r ToolUnion) ToParam() ToolUnionParam {
11153	return param.Override[ToolUnionParam](json.RawMessage(r.RawJSON()))
11154}
11155
11156// Give the model access to additional tools via remote Model Context Protocol
11157// (MCP) servers.
11158// [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).
11159type ToolMcp struct {
11160	// A label for this MCP server, used to identify it in tool calls.
11161	ServerLabel string `json:"server_label,required"`
11162	// The URL for the MCP server.
11163	ServerURL string `json:"server_url,required"`
11164	// The type of the MCP tool. Always `mcp`.
11165	Type constant.Mcp `json:"type,required"`
11166	// List of allowed tool names or a filter object.
11167	AllowedTools ToolMcpAllowedToolsUnion `json:"allowed_tools,nullable"`
11168	// Optional HTTP headers to send to the MCP server. Use for authentication or other
11169	// purposes.
11170	Headers map[string]string `json:"headers,nullable"`
11171	// Specify which of the MCP server's tools require approval.
11172	RequireApproval ToolMcpRequireApprovalUnion `json:"require_approval,nullable"`
11173	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
11174	JSON struct {
11175		ServerLabel     respjson.Field
11176		ServerURL       respjson.Field
11177		Type            respjson.Field
11178		AllowedTools    respjson.Field
11179		Headers         respjson.Field
11180		RequireApproval respjson.Field
11181		ExtraFields     map[string]respjson.Field
11182		raw             string
11183	} `json:"-"`
11184}
11185
11186// Returns the unmodified JSON received from the API
11187func (r ToolMcp) RawJSON() string { return r.JSON.raw }
11188func (r *ToolMcp) UnmarshalJSON(data []byte) error {
11189	return apijson.UnmarshalRoot(data, r)
11190}
11191
11192// ToolMcpAllowedToolsUnion contains all possible properties and values from
11193// [[]string], [ToolMcpAllowedToolsMcpAllowedToolsFilter].
11194//
11195// Use the methods beginning with 'As' to cast the union to one of its variants.
11196//
11197// If the underlying value is not a json object, one of the following properties
11198// will be valid: OfMcpAllowedTools]
11199type ToolMcpAllowedToolsUnion struct {
11200	// This field will be present if the value is a [[]string] instead of an object.
11201	OfMcpAllowedTools []string `json:",inline"`
11202	// This field is from variant [ToolMcpAllowedToolsMcpAllowedToolsFilter].
11203	ToolNames []string `json:"tool_names"`
11204	JSON      struct {
11205		OfMcpAllowedTools respjson.Field
11206		ToolNames         respjson.Field
11207		raw               string
11208	} `json:"-"`
11209}
11210
11211func (u ToolMcpAllowedToolsUnion) AsMcpAllowedTools() (v []string) {
11212	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
11213	return
11214}
11215
11216func (u ToolMcpAllowedToolsUnion) AsMcpAllowedToolsFilter() (v ToolMcpAllowedToolsMcpAllowedToolsFilter) {
11217	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
11218	return
11219}
11220
11221// Returns the unmodified JSON received from the API
11222func (u ToolMcpAllowedToolsUnion) RawJSON() string { return u.JSON.raw }
11223
11224func (r *ToolMcpAllowedToolsUnion) UnmarshalJSON(data []byte) error {
11225	return apijson.UnmarshalRoot(data, r)
11226}
11227
11228// A filter object to specify which tools are allowed.
11229type ToolMcpAllowedToolsMcpAllowedToolsFilter struct {
11230	// List of allowed tool names.
11231	ToolNames []string `json:"tool_names"`
11232	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
11233	JSON struct {
11234		ToolNames   respjson.Field
11235		ExtraFields map[string]respjson.Field
11236		raw         string
11237	} `json:"-"`
11238}
11239
11240// Returns the unmodified JSON received from the API
11241func (r ToolMcpAllowedToolsMcpAllowedToolsFilter) RawJSON() string { return r.JSON.raw }
11242func (r *ToolMcpAllowedToolsMcpAllowedToolsFilter) UnmarshalJSON(data []byte) error {
11243	return apijson.UnmarshalRoot(data, r)
11244}
11245
11246// ToolMcpRequireApprovalUnion contains all possible properties and values from
11247// [ToolMcpRequireApprovalMcpToolApprovalFilter], [string].
11248//
11249// Use the methods beginning with 'As' to cast the union to one of its variants.
11250//
11251// If the underlying value is not a json object, one of the following properties
11252// will be valid: OfMcpToolApprovalSetting]
11253type ToolMcpRequireApprovalUnion struct {
11254	// This field will be present if the value is a [string] instead of an object.
11255	OfMcpToolApprovalSetting string `json:",inline"`
11256	// This field is from variant [ToolMcpRequireApprovalMcpToolApprovalFilter].
11257	Always ToolMcpRequireApprovalMcpToolApprovalFilterAlways `json:"always"`
11258	// This field is from variant [ToolMcpRequireApprovalMcpToolApprovalFilter].
11259	Never ToolMcpRequireApprovalMcpToolApprovalFilterNever `json:"never"`
11260	JSON  struct {
11261		OfMcpToolApprovalSetting respjson.Field
11262		Always                   respjson.Field
11263		Never                    respjson.Field
11264		raw                      string
11265	} `json:"-"`
11266}
11267
11268func (u ToolMcpRequireApprovalUnion) AsMcpToolApprovalFilter() (v ToolMcpRequireApprovalMcpToolApprovalFilter) {
11269	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
11270	return
11271}
11272
11273func (u ToolMcpRequireApprovalUnion) AsMcpToolApprovalSetting() (v string) {
11274	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
11275	return
11276}
11277
11278// Returns the unmodified JSON received from the API
11279func (u ToolMcpRequireApprovalUnion) RawJSON() string { return u.JSON.raw }
11280
11281func (r *ToolMcpRequireApprovalUnion) UnmarshalJSON(data []byte) error {
11282	return apijson.UnmarshalRoot(data, r)
11283}
11284
11285type ToolMcpRequireApprovalMcpToolApprovalFilter struct {
11286	// A list of tools that always require approval.
11287	Always ToolMcpRequireApprovalMcpToolApprovalFilterAlways `json:"always"`
11288	// A list of tools that never require approval.
11289	Never ToolMcpRequireApprovalMcpToolApprovalFilterNever `json:"never"`
11290	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
11291	JSON struct {
11292		Always      respjson.Field
11293		Never       respjson.Field
11294		ExtraFields map[string]respjson.Field
11295		raw         string
11296	} `json:"-"`
11297}
11298
11299// Returns the unmodified JSON received from the API
11300func (r ToolMcpRequireApprovalMcpToolApprovalFilter) RawJSON() string { return r.JSON.raw }
11301func (r *ToolMcpRequireApprovalMcpToolApprovalFilter) UnmarshalJSON(data []byte) error {
11302	return apijson.UnmarshalRoot(data, r)
11303}
11304
11305// A list of tools that always require approval.
11306type ToolMcpRequireApprovalMcpToolApprovalFilterAlways struct {
11307	// List of tools that require approval.
11308	ToolNames []string `json:"tool_names"`
11309	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
11310	JSON struct {
11311		ToolNames   respjson.Field
11312		ExtraFields map[string]respjson.Field
11313		raw         string
11314	} `json:"-"`
11315}
11316
11317// Returns the unmodified JSON received from the API
11318func (r ToolMcpRequireApprovalMcpToolApprovalFilterAlways) RawJSON() string { return r.JSON.raw }
11319func (r *ToolMcpRequireApprovalMcpToolApprovalFilterAlways) UnmarshalJSON(data []byte) error {
11320	return apijson.UnmarshalRoot(data, r)
11321}
11322
11323// A list of tools that never require approval.
11324type ToolMcpRequireApprovalMcpToolApprovalFilterNever struct {
11325	// List of tools that do not require approval.
11326	ToolNames []string `json:"tool_names"`
11327	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
11328	JSON struct {
11329		ToolNames   respjson.Field
11330		ExtraFields map[string]respjson.Field
11331		raw         string
11332	} `json:"-"`
11333}
11334
11335// Returns the unmodified JSON received from the API
11336func (r ToolMcpRequireApprovalMcpToolApprovalFilterNever) RawJSON() string { return r.JSON.raw }
11337func (r *ToolMcpRequireApprovalMcpToolApprovalFilterNever) UnmarshalJSON(data []byte) error {
11338	return apijson.UnmarshalRoot(data, r)
11339}
11340
11341// Specify a single approval policy for all tools. One of `always` or `never`. When
11342// set to `always`, all tools will require approval. When set to `never`, all tools
11343// will not require approval.
11344type ToolMcpRequireApprovalMcpToolApprovalSetting string
11345
11346const (
11347	ToolMcpRequireApprovalMcpToolApprovalSettingAlways ToolMcpRequireApprovalMcpToolApprovalSetting = "always"
11348	ToolMcpRequireApprovalMcpToolApprovalSettingNever  ToolMcpRequireApprovalMcpToolApprovalSetting = "never"
11349)
11350
11351// A tool that runs Python code to help generate a response to a prompt.
11352type ToolCodeInterpreter struct {
11353	// The code interpreter container. Can be a container ID or an object that
11354	// specifies uploaded file IDs to make available to your code.
11355	Container ToolCodeInterpreterContainerUnion `json:"container,required"`
11356	// The type of the code interpreter tool. Always `code_interpreter`.
11357	Type constant.CodeInterpreter `json:"type,required"`
11358	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
11359	JSON struct {
11360		Container   respjson.Field
11361		Type        respjson.Field
11362		ExtraFields map[string]respjson.Field
11363		raw         string
11364	} `json:"-"`
11365}
11366
11367// Returns the unmodified JSON received from the API
11368func (r ToolCodeInterpreter) RawJSON() string { return r.JSON.raw }
11369func (r *ToolCodeInterpreter) UnmarshalJSON(data []byte) error {
11370	return apijson.UnmarshalRoot(data, r)
11371}
11372
11373// ToolCodeInterpreterContainerUnion contains all possible properties and values
11374// from [string], [ToolCodeInterpreterContainerCodeInterpreterContainerAuto].
11375//
11376// Use the methods beginning with 'As' to cast the union to one of its variants.
11377//
11378// If the underlying value is not a json object, one of the following properties
11379// will be valid: OfString]
11380type ToolCodeInterpreterContainerUnion struct {
11381	// This field will be present if the value is a [string] instead of an object.
11382	OfString string `json:",inline"`
11383	// This field is from variant
11384	// [ToolCodeInterpreterContainerCodeInterpreterContainerAuto].
11385	Type constant.Auto `json:"type"`
11386	// This field is from variant
11387	// [ToolCodeInterpreterContainerCodeInterpreterContainerAuto].
11388	FileIDs []string `json:"file_ids"`
11389	JSON    struct {
11390		OfString respjson.Field
11391		Type     respjson.Field
11392		FileIDs  respjson.Field
11393		raw      string
11394	} `json:"-"`
11395}
11396
11397func (u ToolCodeInterpreterContainerUnion) AsString() (v string) {
11398	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
11399	return
11400}
11401
11402func (u ToolCodeInterpreterContainerUnion) AsCodeInterpreterContainerAuto() (v ToolCodeInterpreterContainerCodeInterpreterContainerAuto) {
11403	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
11404	return
11405}
11406
11407// Returns the unmodified JSON received from the API
11408func (u ToolCodeInterpreterContainerUnion) RawJSON() string { return u.JSON.raw }
11409
11410func (r *ToolCodeInterpreterContainerUnion) UnmarshalJSON(data []byte) error {
11411	return apijson.UnmarshalRoot(data, r)
11412}
11413
11414// Configuration for a code interpreter container. Optionally specify the IDs of
11415// the files to run the code on.
11416type ToolCodeInterpreterContainerCodeInterpreterContainerAuto struct {
11417	// Always `auto`.
11418	Type constant.Auto `json:"type,required"`
11419	// An optional list of uploaded files to make available to your code.
11420	FileIDs []string `json:"file_ids"`
11421	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
11422	JSON struct {
11423		Type        respjson.Field
11424		FileIDs     respjson.Field
11425		ExtraFields map[string]respjson.Field
11426		raw         string
11427	} `json:"-"`
11428}
11429
11430// Returns the unmodified JSON received from the API
11431func (r ToolCodeInterpreterContainerCodeInterpreterContainerAuto) RawJSON() string { return r.JSON.raw }
11432func (r *ToolCodeInterpreterContainerCodeInterpreterContainerAuto) UnmarshalJSON(data []byte) error {
11433	return apijson.UnmarshalRoot(data, r)
11434}
11435
11436// A tool that generates images using a model like `gpt-image-1`.
11437type ToolImageGeneration struct {
11438	// The type of the image generation tool. Always `image_generation`.
11439	Type constant.ImageGeneration `json:"type,required"`
11440	// Background type for the generated image. One of `transparent`, `opaque`, or
11441	// `auto`. Default: `auto`.
11442	//
11443	// Any of "transparent", "opaque", "auto".
11444	Background string `json:"background"`
11445	// Optional mask for inpainting. Contains `image_url` (string, optional) and
11446	// `file_id` (string, optional).
11447	InputImageMask ToolImageGenerationInputImageMask `json:"input_image_mask"`
11448	// The image generation model to use. Default: `gpt-image-1`.
11449	//
11450	// Any of "gpt-image-1".
11451	Model string `json:"model"`
11452	// Moderation level for the generated image. Default: `auto`.
11453	//
11454	// Any of "auto", "low".
11455	Moderation string `json:"moderation"`
11456	// Compression level for the output image. Default: 100.
11457	OutputCompression int64 `json:"output_compression"`
11458	// The output format of the generated image. One of `png`, `webp`, or `jpeg`.
11459	// Default: `png`.
11460	//
11461	// Any of "png", "webp", "jpeg".
11462	OutputFormat string `json:"output_format"`
11463	// Number of partial images to generate in streaming mode, from 0 (default value)
11464	// to 3.
11465	PartialImages int64 `json:"partial_images"`
11466	// The quality of the generated image. One of `low`, `medium`, `high`, or `auto`.
11467	// Default: `auto`.
11468	//
11469	// Any of "low", "medium", "high", "auto".
11470	Quality string `json:"quality"`
11471	// The size of the generated image. One of `1024x1024`, `1024x1536`, `1536x1024`,
11472	// or `auto`. Default: `auto`.
11473	//
11474	// Any of "1024x1024", "1024x1536", "1536x1024", "auto".
11475	Size string `json:"size"`
11476	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
11477	JSON struct {
11478		Type              respjson.Field
11479		Background        respjson.Field
11480		InputImageMask    respjson.Field
11481		Model             respjson.Field
11482		Moderation        respjson.Field
11483		OutputCompression respjson.Field
11484		OutputFormat      respjson.Field
11485		PartialImages     respjson.Field
11486		Quality           respjson.Field
11487		Size              respjson.Field
11488		ExtraFields       map[string]respjson.Field
11489		raw               string
11490	} `json:"-"`
11491}
11492
11493// Returns the unmodified JSON received from the API
11494func (r ToolImageGeneration) RawJSON() string { return r.JSON.raw }
11495func (r *ToolImageGeneration) UnmarshalJSON(data []byte) error {
11496	return apijson.UnmarshalRoot(data, r)
11497}
11498
11499// Optional mask for inpainting. Contains `image_url` (string, optional) and
11500// `file_id` (string, optional).
11501type ToolImageGenerationInputImageMask struct {
11502	// File ID for the mask image.
11503	FileID string `json:"file_id"`
11504	// Base64-encoded mask image.
11505	ImageURL string `json:"image_url"`
11506	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
11507	JSON struct {
11508		FileID      respjson.Field
11509		ImageURL    respjson.Field
11510		ExtraFields map[string]respjson.Field
11511		raw         string
11512	} `json:"-"`
11513}
11514
11515// Returns the unmodified JSON received from the API
11516func (r ToolImageGenerationInputImageMask) RawJSON() string { return r.JSON.raw }
11517func (r *ToolImageGenerationInputImageMask) UnmarshalJSON(data []byte) error {
11518	return apijson.UnmarshalRoot(data, r)
11519}
11520
11521// A tool that allows the model to execute shell commands in a local environment.
11522type ToolLocalShell struct {
11523	// The type of the local shell tool. Always `local_shell`.
11524	Type constant.LocalShell `json:"type,required"`
11525	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
11526	JSON struct {
11527		Type        respjson.Field
11528		ExtraFields map[string]respjson.Field
11529		raw         string
11530	} `json:"-"`
11531}
11532
11533// Returns the unmodified JSON received from the API
11534func (r ToolLocalShell) RawJSON() string { return r.JSON.raw }
11535func (r *ToolLocalShell) UnmarshalJSON(data []byte) error {
11536	return apijson.UnmarshalRoot(data, r)
11537}
11538
11539func ToolParamOfFunction(name string, parameters map[string]any, strict bool) ToolUnionParam {
11540	var function FunctionToolParam
11541	function.Name = name
11542	function.Parameters = parameters
11543	function.Strict = param.NewOpt(strict)
11544	return ToolUnionParam{OfFunction: &function}
11545}
11546
11547func ToolParamOfFileSearch(vectorStoreIDs []string) ToolUnionParam {
11548	var fileSearch FileSearchToolParam
11549	fileSearch.VectorStoreIDs = vectorStoreIDs
11550	return ToolUnionParam{OfFileSearch: &fileSearch}
11551}
11552
11553func ToolParamOfWebSearchPreview(type_ WebSearchToolType) ToolUnionParam {
11554	var variant WebSearchToolParam
11555	variant.Type = type_
11556	return ToolUnionParam{OfWebSearchPreview: &variant}
11557}
11558
11559func ToolParamOfComputerUsePreview(displayHeight int64, displayWidth int64, environment ComputerToolEnvironment) ToolUnionParam {
11560	var computerUsePreview ComputerToolParam
11561	computerUsePreview.DisplayHeight = displayHeight
11562	computerUsePreview.DisplayWidth = displayWidth
11563	computerUsePreview.Environment = environment
11564	return ToolUnionParam{OfComputerUsePreview: &computerUsePreview}
11565}
11566
11567func ToolParamOfMcp(serverLabel string, serverURL string) ToolUnionParam {
11568	var mcp ToolMcpParam
11569	mcp.ServerLabel = serverLabel
11570	mcp.ServerURL = serverURL
11571	return ToolUnionParam{OfMcp: &mcp}
11572}
11573
11574func ToolParamOfCodeInterpreter[
11575	T string | ToolCodeInterpreterContainerCodeInterpreterContainerAutoParam,
11576](container T) ToolUnionParam {
11577	var codeInterpreter ToolCodeInterpreterParam
11578	switch v := any(container).(type) {
11579	case string:
11580		codeInterpreter.Container.OfString = param.NewOpt(v)
11581	case ToolCodeInterpreterContainerCodeInterpreterContainerAutoParam:
11582		codeInterpreter.Container.OfCodeInterpreterContainerAuto = &v
11583	}
11584	return ToolUnionParam{OfCodeInterpreter: &codeInterpreter}
11585}
11586
11587// Only one field can be non-zero.
11588//
11589// Use [param.IsOmitted] to confirm if a field is set.
11590type ToolUnionParam struct {
11591	OfFunction           *FunctionToolParam        `json:",omitzero,inline"`
11592	OfFileSearch         *FileSearchToolParam      `json:",omitzero,inline"`
11593	OfWebSearchPreview   *WebSearchToolParam       `json:",omitzero,inline"`
11594	OfComputerUsePreview *ComputerToolParam        `json:",omitzero,inline"`
11595	OfMcp                *ToolMcpParam             `json:",omitzero,inline"`
11596	OfCodeInterpreter    *ToolCodeInterpreterParam `json:",omitzero,inline"`
11597	OfImageGeneration    *ToolImageGenerationParam `json:",omitzero,inline"`
11598	OfLocalShell         *ToolLocalShellParam      `json:",omitzero,inline"`
11599	paramUnion
11600}
11601
11602func (u ToolUnionParam) MarshalJSON() ([]byte, error) {
11603	return param.MarshalUnion(u, u.OfFunction,
11604		u.OfFileSearch,
11605		u.OfWebSearchPreview,
11606		u.OfComputerUsePreview,
11607		u.OfMcp,
11608		u.OfCodeInterpreter,
11609		u.OfImageGeneration,
11610		u.OfLocalShell)
11611}
11612func (u *ToolUnionParam) UnmarshalJSON(data []byte) error {
11613	return apijson.UnmarshalRoot(data, u)
11614}
11615
11616func (u *ToolUnionParam) asAny() any {
11617	if !param.IsOmitted(u.OfFunction) {
11618		return u.OfFunction
11619	} else if !param.IsOmitted(u.OfFileSearch) {
11620		return u.OfFileSearch
11621	} else if !param.IsOmitted(u.OfWebSearchPreview) {
11622		return u.OfWebSearchPreview
11623	} else if !param.IsOmitted(u.OfComputerUsePreview) {
11624		return u.OfComputerUsePreview
11625	} else if !param.IsOmitted(u.OfMcp) {
11626		return u.OfMcp
11627	} else if !param.IsOmitted(u.OfCodeInterpreter) {
11628		return u.OfCodeInterpreter
11629	} else if !param.IsOmitted(u.OfImageGeneration) {
11630		return u.OfImageGeneration
11631	} else if !param.IsOmitted(u.OfLocalShell) {
11632		return u.OfLocalShell
11633	}
11634	return nil
11635}
11636
11637// Returns a pointer to the underlying variant's property, if present.
11638func (u ToolUnionParam) GetName() *string {
11639	if vt := u.OfFunction; vt != nil {
11640		return &vt.Name
11641	}
11642	return nil
11643}
11644
11645// Returns a pointer to the underlying variant's property, if present.
11646func (u ToolUnionParam) GetParameters() map[string]any {
11647	if vt := u.OfFunction; vt != nil {
11648		return vt.Parameters
11649	}
11650	return nil
11651}
11652
11653// Returns a pointer to the underlying variant's property, if present.
11654func (u ToolUnionParam) GetStrict() *bool {
11655	if vt := u.OfFunction; vt != nil && vt.Strict.Valid() {
11656		return &vt.Strict.Value
11657	}
11658	return nil
11659}
11660
11661// Returns a pointer to the underlying variant's property, if present.
11662func (u ToolUnionParam) GetDescription() *string {
11663	if vt := u.OfFunction; vt != nil && vt.Description.Valid() {
11664		return &vt.Description.Value
11665	}
11666	return nil
11667}
11668
11669// Returns a pointer to the underlying variant's property, if present.
11670func (u ToolUnionParam) GetVectorStoreIDs() []string {
11671	if vt := u.OfFileSearch; vt != nil {
11672		return vt.VectorStoreIDs
11673	}
11674	return nil
11675}
11676
11677// Returns a pointer to the underlying variant's property, if present.
11678func (u ToolUnionParam) GetFilters() *FileSearchToolFiltersUnionParam {
11679	if vt := u.OfFileSearch; vt != nil {
11680		return &vt.Filters
11681	}
11682	return nil
11683}
11684
11685// Returns a pointer to the underlying variant's property, if present.
11686func (u ToolUnionParam) GetMaxNumResults() *int64 {
11687	if vt := u.OfFileSearch; vt != nil && vt.MaxNumResults.Valid() {
11688		return &vt.MaxNumResults.Value
11689	}
11690	return nil
11691}
11692
11693// Returns a pointer to the underlying variant's property, if present.
11694func (u ToolUnionParam) GetRankingOptions() *FileSearchToolRankingOptionsParam {
11695	if vt := u.OfFileSearch; vt != nil {
11696		return &vt.RankingOptions
11697	}
11698	return nil
11699}
11700
11701// Returns a pointer to the underlying variant's property, if present.
11702func (u ToolUnionParam) GetSearchContextSize() *string {
11703	if vt := u.OfWebSearchPreview; vt != nil {
11704		return (*string)(&vt.SearchContextSize)
11705	}
11706	return nil
11707}
11708
11709// Returns a pointer to the underlying variant's property, if present.
11710func (u ToolUnionParam) GetUserLocation() *WebSearchToolUserLocationParam {
11711	if vt := u.OfWebSearchPreview; vt != nil {
11712		return &vt.UserLocation
11713	}
11714	return nil
11715}
11716
11717// Returns a pointer to the underlying variant's property, if present.
11718func (u ToolUnionParam) GetDisplayHeight() *int64 {
11719	if vt := u.OfComputerUsePreview; vt != nil {
11720		return &vt.DisplayHeight
11721	}
11722	return nil
11723}
11724
11725// Returns a pointer to the underlying variant's property, if present.
11726func (u ToolUnionParam) GetDisplayWidth() *int64 {
11727	if vt := u.OfComputerUsePreview; vt != nil {
11728		return &vt.DisplayWidth
11729	}
11730	return nil
11731}
11732
11733// Returns a pointer to the underlying variant's property, if present.
11734func (u ToolUnionParam) GetEnvironment() *string {
11735	if vt := u.OfComputerUsePreview; vt != nil {
11736		return (*string)(&vt.Environment)
11737	}
11738	return nil
11739}
11740
11741// Returns a pointer to the underlying variant's property, if present.
11742func (u ToolUnionParam) GetServerLabel() *string {
11743	if vt := u.OfMcp; vt != nil {
11744		return &vt.ServerLabel
11745	}
11746	return nil
11747}
11748
11749// Returns a pointer to the underlying variant's property, if present.
11750func (u ToolUnionParam) GetServerURL() *string {
11751	if vt := u.OfMcp; vt != nil {
11752		return &vt.ServerURL
11753	}
11754	return nil
11755}
11756
11757// Returns a pointer to the underlying variant's property, if present.
11758func (u ToolUnionParam) GetAllowedTools() *ToolMcpAllowedToolsUnionParam {
11759	if vt := u.OfMcp; vt != nil {
11760		return &vt.AllowedTools
11761	}
11762	return nil
11763}
11764
11765// Returns a pointer to the underlying variant's property, if present.
11766func (u ToolUnionParam) GetHeaders() map[string]string {
11767	if vt := u.OfMcp; vt != nil {
11768		return vt.Headers
11769	}
11770	return nil
11771}
11772
11773// Returns a pointer to the underlying variant's property, if present.
11774func (u ToolUnionParam) GetRequireApproval() *ToolMcpRequireApprovalUnionParam {
11775	if vt := u.OfMcp; vt != nil {
11776		return &vt.RequireApproval
11777	}
11778	return nil
11779}
11780
11781// Returns a pointer to the underlying variant's property, if present.
11782func (u ToolUnionParam) GetContainer() *ToolCodeInterpreterContainerUnionParam {
11783	if vt := u.OfCodeInterpreter; vt != nil {
11784		return &vt.Container
11785	}
11786	return nil
11787}
11788
11789// Returns a pointer to the underlying variant's property, if present.
11790func (u ToolUnionParam) GetBackground() *string {
11791	if vt := u.OfImageGeneration; vt != nil {
11792		return &vt.Background
11793	}
11794	return nil
11795}
11796
11797// Returns a pointer to the underlying variant's property, if present.
11798func (u ToolUnionParam) GetInputImageMask() *ToolImageGenerationInputImageMaskParam {
11799	if vt := u.OfImageGeneration; vt != nil {
11800		return &vt.InputImageMask
11801	}
11802	return nil
11803}
11804
11805// Returns a pointer to the underlying variant's property, if present.
11806func (u ToolUnionParam) GetModel() *string {
11807	if vt := u.OfImageGeneration; vt != nil {
11808		return &vt.Model
11809	}
11810	return nil
11811}
11812
11813// Returns a pointer to the underlying variant's property, if present.
11814func (u ToolUnionParam) GetModeration() *string {
11815	if vt := u.OfImageGeneration; vt != nil {
11816		return &vt.Moderation
11817	}
11818	return nil
11819}
11820
11821// Returns a pointer to the underlying variant's property, if present.
11822func (u ToolUnionParam) GetOutputCompression() *int64 {
11823	if vt := u.OfImageGeneration; vt != nil && vt.OutputCompression.Valid() {
11824		return &vt.OutputCompression.Value
11825	}
11826	return nil
11827}
11828
11829// Returns a pointer to the underlying variant's property, if present.
11830func (u ToolUnionParam) GetOutputFormat() *string {
11831	if vt := u.OfImageGeneration; vt != nil {
11832		return &vt.OutputFormat
11833	}
11834	return nil
11835}
11836
11837// Returns a pointer to the underlying variant's property, if present.
11838func (u ToolUnionParam) GetPartialImages() *int64 {
11839	if vt := u.OfImageGeneration; vt != nil && vt.PartialImages.Valid() {
11840		return &vt.PartialImages.Value
11841	}
11842	return nil
11843}
11844
11845// Returns a pointer to the underlying variant's property, if present.
11846func (u ToolUnionParam) GetQuality() *string {
11847	if vt := u.OfImageGeneration; vt != nil {
11848		return &vt.Quality
11849	}
11850	return nil
11851}
11852
11853// Returns a pointer to the underlying variant's property, if present.
11854func (u ToolUnionParam) GetSize() *string {
11855	if vt := u.OfImageGeneration; vt != nil {
11856		return &vt.Size
11857	}
11858	return nil
11859}
11860
11861// Returns a pointer to the underlying variant's property, if present.
11862func (u ToolUnionParam) GetType() *string {
11863	if vt := u.OfFunction; vt != nil {
11864		return (*string)(&vt.Type)
11865	} else if vt := u.OfFileSearch; vt != nil {
11866		return (*string)(&vt.Type)
11867	} else if vt := u.OfWebSearchPreview; vt != nil {
11868		return (*string)(&vt.Type)
11869	} else if vt := u.OfComputerUsePreview; vt != nil {
11870		return (*string)(&vt.Type)
11871	} else if vt := u.OfMcp; vt != nil {
11872		return (*string)(&vt.Type)
11873	} else if vt := u.OfCodeInterpreter; vt != nil {
11874		return (*string)(&vt.Type)
11875	} else if vt := u.OfImageGeneration; vt != nil {
11876		return (*string)(&vt.Type)
11877	} else if vt := u.OfLocalShell; vt != nil {
11878		return (*string)(&vt.Type)
11879	}
11880	return nil
11881}
11882
11883func init() {
11884	apijson.RegisterUnion[ToolUnionParam](
11885		"type",
11886		apijson.Discriminator[FunctionToolParam]("function"),
11887		apijson.Discriminator[FileSearchToolParam]("file_search"),
11888		apijson.Discriminator[WebSearchToolParam]("web_search_preview"),
11889		apijson.Discriminator[WebSearchToolParam]("web_search_preview_2025_03_11"),
11890		apijson.Discriminator[ComputerToolParam]("computer_use_preview"),
11891		apijson.Discriminator[ToolMcpParam]("mcp"),
11892		apijson.Discriminator[ToolCodeInterpreterParam]("code_interpreter"),
11893		apijson.Discriminator[ToolImageGenerationParam]("image_generation"),
11894		apijson.Discriminator[ToolLocalShellParam]("local_shell"),
11895	)
11896}
11897
11898// Give the model access to additional tools via remote Model Context Protocol
11899// (MCP) servers.
11900// [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).
11901//
11902// The properties ServerLabel, ServerURL, Type are required.
11903type ToolMcpParam struct {
11904	// A label for this MCP server, used to identify it in tool calls.
11905	ServerLabel string `json:"server_label,required"`
11906	// The URL for the MCP server.
11907	ServerURL string `json:"server_url,required"`
11908	// List of allowed tool names or a filter object.
11909	AllowedTools ToolMcpAllowedToolsUnionParam `json:"allowed_tools,omitzero"`
11910	// Optional HTTP headers to send to the MCP server. Use for authentication or other
11911	// purposes.
11912	Headers map[string]string `json:"headers,omitzero"`
11913	// Specify which of the MCP server's tools require approval.
11914	RequireApproval ToolMcpRequireApprovalUnionParam `json:"require_approval,omitzero"`
11915	// The type of the MCP tool. Always `mcp`.
11916	//
11917	// This field can be elided, and will marshal its zero value as "mcp".
11918	Type constant.Mcp `json:"type,required"`
11919	paramObj
11920}
11921
11922func (r ToolMcpParam) MarshalJSON() (data []byte, err error) {
11923	type shadow ToolMcpParam
11924	return param.MarshalObject(r, (*shadow)(&r))
11925}
11926func (r *ToolMcpParam) UnmarshalJSON(data []byte) error {
11927	return apijson.UnmarshalRoot(data, r)
11928}
11929
11930// Only one field can be non-zero.
11931//
11932// Use [param.IsOmitted] to confirm if a field is set.
11933type ToolMcpAllowedToolsUnionParam struct {
11934	OfMcpAllowedTools       []string                                       `json:",omitzero,inline"`
11935	OfMcpAllowedToolsFilter *ToolMcpAllowedToolsMcpAllowedToolsFilterParam `json:",omitzero,inline"`
11936	paramUnion
11937}
11938
11939func (u ToolMcpAllowedToolsUnionParam) MarshalJSON() ([]byte, error) {
11940	return param.MarshalUnion(u, u.OfMcpAllowedTools, u.OfMcpAllowedToolsFilter)
11941}
11942func (u *ToolMcpAllowedToolsUnionParam) UnmarshalJSON(data []byte) error {
11943	return apijson.UnmarshalRoot(data, u)
11944}
11945
11946func (u *ToolMcpAllowedToolsUnionParam) asAny() any {
11947	if !param.IsOmitted(u.OfMcpAllowedTools) {
11948		return &u.OfMcpAllowedTools
11949	} else if !param.IsOmitted(u.OfMcpAllowedToolsFilter) {
11950		return u.OfMcpAllowedToolsFilter
11951	}
11952	return nil
11953}
11954
11955// A filter object to specify which tools are allowed.
11956type ToolMcpAllowedToolsMcpAllowedToolsFilterParam struct {
11957	// List of allowed tool names.
11958	ToolNames []string `json:"tool_names,omitzero"`
11959	paramObj
11960}
11961
11962func (r ToolMcpAllowedToolsMcpAllowedToolsFilterParam) MarshalJSON() (data []byte, err error) {
11963	type shadow ToolMcpAllowedToolsMcpAllowedToolsFilterParam
11964	return param.MarshalObject(r, (*shadow)(&r))
11965}
11966func (r *ToolMcpAllowedToolsMcpAllowedToolsFilterParam) UnmarshalJSON(data []byte) error {
11967	return apijson.UnmarshalRoot(data, r)
11968}
11969
11970// Only one field can be non-zero.
11971//
11972// Use [param.IsOmitted] to confirm if a field is set.
11973type ToolMcpRequireApprovalUnionParam struct {
11974	OfMcpToolApprovalFilter *ToolMcpRequireApprovalMcpToolApprovalFilterParam `json:",omitzero,inline"`
11975	// Check if union is this variant with
11976	// !param.IsOmitted(union.OfMcpToolApprovalSetting)
11977	OfMcpToolApprovalSetting param.Opt[string] `json:",omitzero,inline"`
11978	paramUnion
11979}
11980
11981func (u ToolMcpRequireApprovalUnionParam) MarshalJSON() ([]byte, error) {
11982	return param.MarshalUnion(u, u.OfMcpToolApprovalFilter, u.OfMcpToolApprovalSetting)
11983}
11984func (u *ToolMcpRequireApprovalUnionParam) UnmarshalJSON(data []byte) error {
11985	return apijson.UnmarshalRoot(data, u)
11986}
11987
11988func (u *ToolMcpRequireApprovalUnionParam) asAny() any {
11989	if !param.IsOmitted(u.OfMcpToolApprovalFilter) {
11990		return u.OfMcpToolApprovalFilter
11991	} else if !param.IsOmitted(u.OfMcpToolApprovalSetting) {
11992		return &u.OfMcpToolApprovalSetting
11993	}
11994	return nil
11995}
11996
11997type ToolMcpRequireApprovalMcpToolApprovalFilterParam struct {
11998	// A list of tools that always require approval.
11999	Always ToolMcpRequireApprovalMcpToolApprovalFilterAlwaysParam `json:"always,omitzero"`
12000	// A list of tools that never require approval.
12001	Never ToolMcpRequireApprovalMcpToolApprovalFilterNeverParam `json:"never,omitzero"`
12002	paramObj
12003}
12004
12005func (r ToolMcpRequireApprovalMcpToolApprovalFilterParam) MarshalJSON() (data []byte, err error) {
12006	type shadow ToolMcpRequireApprovalMcpToolApprovalFilterParam
12007	return param.MarshalObject(r, (*shadow)(&r))
12008}
12009func (r *ToolMcpRequireApprovalMcpToolApprovalFilterParam) UnmarshalJSON(data []byte) error {
12010	return apijson.UnmarshalRoot(data, r)
12011}
12012
12013// A list of tools that always require approval.
12014type ToolMcpRequireApprovalMcpToolApprovalFilterAlwaysParam struct {
12015	// List of tools that require approval.
12016	ToolNames []string `json:"tool_names,omitzero"`
12017	paramObj
12018}
12019
12020func (r ToolMcpRequireApprovalMcpToolApprovalFilterAlwaysParam) MarshalJSON() (data []byte, err error) {
12021	type shadow ToolMcpRequireApprovalMcpToolApprovalFilterAlwaysParam
12022	return param.MarshalObject(r, (*shadow)(&r))
12023}
12024func (r *ToolMcpRequireApprovalMcpToolApprovalFilterAlwaysParam) UnmarshalJSON(data []byte) error {
12025	return apijson.UnmarshalRoot(data, r)
12026}
12027
12028// A list of tools that never require approval.
12029type ToolMcpRequireApprovalMcpToolApprovalFilterNeverParam struct {
12030	// List of tools that do not require approval.
12031	ToolNames []string `json:"tool_names,omitzero"`
12032	paramObj
12033}
12034
12035func (r ToolMcpRequireApprovalMcpToolApprovalFilterNeverParam) MarshalJSON() (data []byte, err error) {
12036	type shadow ToolMcpRequireApprovalMcpToolApprovalFilterNeverParam
12037	return param.MarshalObject(r, (*shadow)(&r))
12038}
12039func (r *ToolMcpRequireApprovalMcpToolApprovalFilterNeverParam) UnmarshalJSON(data []byte) error {
12040	return apijson.UnmarshalRoot(data, r)
12041}
12042
12043// A tool that runs Python code to help generate a response to a prompt.
12044//
12045// The properties Container, Type are required.
12046type ToolCodeInterpreterParam struct {
12047	// The code interpreter container. Can be a container ID or an object that
12048	// specifies uploaded file IDs to make available to your code.
12049	Container ToolCodeInterpreterContainerUnionParam `json:"container,omitzero,required"`
12050	// The type of the code interpreter tool. Always `code_interpreter`.
12051	//
12052	// This field can be elided, and will marshal its zero value as "code_interpreter".
12053	Type constant.CodeInterpreter `json:"type,required"`
12054	paramObj
12055}
12056
12057func (r ToolCodeInterpreterParam) MarshalJSON() (data []byte, err error) {
12058	type shadow ToolCodeInterpreterParam
12059	return param.MarshalObject(r, (*shadow)(&r))
12060}
12061func (r *ToolCodeInterpreterParam) UnmarshalJSON(data []byte) error {
12062	return apijson.UnmarshalRoot(data, r)
12063}
12064
12065// Only one field can be non-zero.
12066//
12067// Use [param.IsOmitted] to confirm if a field is set.
12068type ToolCodeInterpreterContainerUnionParam struct {
12069	OfString                       param.Opt[string]                                              `json:",omitzero,inline"`
12070	OfCodeInterpreterContainerAuto *ToolCodeInterpreterContainerCodeInterpreterContainerAutoParam `json:",omitzero,inline"`
12071	paramUnion
12072}
12073
12074func (u ToolCodeInterpreterContainerUnionParam) MarshalJSON() ([]byte, error) {
12075	return param.MarshalUnion(u, u.OfString, u.OfCodeInterpreterContainerAuto)
12076}
12077func (u *ToolCodeInterpreterContainerUnionParam) UnmarshalJSON(data []byte) error {
12078	return apijson.UnmarshalRoot(data, u)
12079}
12080
12081func (u *ToolCodeInterpreterContainerUnionParam) asAny() any {
12082	if !param.IsOmitted(u.OfString) {
12083		return &u.OfString.Value
12084	} else if !param.IsOmitted(u.OfCodeInterpreterContainerAuto) {
12085		return u.OfCodeInterpreterContainerAuto
12086	}
12087	return nil
12088}
12089
12090// Configuration for a code interpreter container. Optionally specify the IDs of
12091// the files to run the code on.
12092//
12093// The property Type is required.
12094type ToolCodeInterpreterContainerCodeInterpreterContainerAutoParam struct {
12095	// An optional list of uploaded files to make available to your code.
12096	FileIDs []string `json:"file_ids,omitzero"`
12097	// Always `auto`.
12098	//
12099	// This field can be elided, and will marshal its zero value as "auto".
12100	Type constant.Auto `json:"type,required"`
12101	paramObj
12102}
12103
12104func (r ToolCodeInterpreterContainerCodeInterpreterContainerAutoParam) MarshalJSON() (data []byte, err error) {
12105	type shadow ToolCodeInterpreterContainerCodeInterpreterContainerAutoParam
12106	return param.MarshalObject(r, (*shadow)(&r))
12107}
12108func (r *ToolCodeInterpreterContainerCodeInterpreterContainerAutoParam) UnmarshalJSON(data []byte) error {
12109	return apijson.UnmarshalRoot(data, r)
12110}
12111
12112// A tool that generates images using a model like `gpt-image-1`.
12113//
12114// The property Type is required.
12115type ToolImageGenerationParam struct {
12116	// Compression level for the output image. Default: 100.
12117	OutputCompression param.Opt[int64] `json:"output_compression,omitzero"`
12118	// Number of partial images to generate in streaming mode, from 0 (default value)
12119	// to 3.
12120	PartialImages param.Opt[int64] `json:"partial_images,omitzero"`
12121	// Background type for the generated image. One of `transparent`, `opaque`, or
12122	// `auto`. Default: `auto`.
12123	//
12124	// Any of "transparent", "opaque", "auto".
12125	Background string `json:"background,omitzero"`
12126	// Optional mask for inpainting. Contains `image_url` (string, optional) and
12127	// `file_id` (string, optional).
12128	InputImageMask ToolImageGenerationInputImageMaskParam `json:"input_image_mask,omitzero"`
12129	// The image generation model to use. Default: `gpt-image-1`.
12130	//
12131	// Any of "gpt-image-1".
12132	Model string `json:"model,omitzero"`
12133	// Moderation level for the generated image. Default: `auto`.
12134	//
12135	// Any of "auto", "low".
12136	Moderation string `json:"moderation,omitzero"`
12137	// The output format of the generated image. One of `png`, `webp`, or `jpeg`.
12138	// Default: `png`.
12139	//
12140	// Any of "png", "webp", "jpeg".
12141	OutputFormat string `json:"output_format,omitzero"`
12142	// The quality of the generated image. One of `low`, `medium`, `high`, or `auto`.
12143	// Default: `auto`.
12144	//
12145	// Any of "low", "medium", "high", "auto".
12146	Quality string `json:"quality,omitzero"`
12147	// The size of the generated image. One of `1024x1024`, `1024x1536`, `1536x1024`,
12148	// or `auto`. Default: `auto`.
12149	//
12150	// Any of "1024x1024", "1024x1536", "1536x1024", "auto".
12151	Size string `json:"size,omitzero"`
12152	// The type of the image generation tool. Always `image_generation`.
12153	//
12154	// This field can be elided, and will marshal its zero value as "image_generation".
12155	Type constant.ImageGeneration `json:"type,required"`
12156	paramObj
12157}
12158
12159func (r ToolImageGenerationParam) MarshalJSON() (data []byte, err error) {
12160	type shadow ToolImageGenerationParam
12161	return param.MarshalObject(r, (*shadow)(&r))
12162}
12163func (r *ToolImageGenerationParam) UnmarshalJSON(data []byte) error {
12164	return apijson.UnmarshalRoot(data, r)
12165}
12166
12167func init() {
12168	apijson.RegisterFieldValidator[ToolImageGenerationParam](
12169		"background", "transparent", "opaque", "auto",
12170	)
12171	apijson.RegisterFieldValidator[ToolImageGenerationParam](
12172		"model", "gpt-image-1",
12173	)
12174	apijson.RegisterFieldValidator[ToolImageGenerationParam](
12175		"moderation", "auto", "low",
12176	)
12177	apijson.RegisterFieldValidator[ToolImageGenerationParam](
12178		"output_format", "png", "webp", "jpeg",
12179	)
12180	apijson.RegisterFieldValidator[ToolImageGenerationParam](
12181		"quality", "low", "medium", "high", "auto",
12182	)
12183	apijson.RegisterFieldValidator[ToolImageGenerationParam](
12184		"size", "1024x1024", "1024x1536", "1536x1024", "auto",
12185	)
12186}
12187
12188// Optional mask for inpainting. Contains `image_url` (string, optional) and
12189// `file_id` (string, optional).
12190type ToolImageGenerationInputImageMaskParam struct {
12191	// File ID for the mask image.
12192	FileID param.Opt[string] `json:"file_id,omitzero"`
12193	// Base64-encoded mask image.
12194	ImageURL param.Opt[string] `json:"image_url,omitzero"`
12195	paramObj
12196}
12197
12198func (r ToolImageGenerationInputImageMaskParam) MarshalJSON() (data []byte, err error) {
12199	type shadow ToolImageGenerationInputImageMaskParam
12200	return param.MarshalObject(r, (*shadow)(&r))
12201}
12202func (r *ToolImageGenerationInputImageMaskParam) UnmarshalJSON(data []byte) error {
12203	return apijson.UnmarshalRoot(data, r)
12204}
12205
12206func NewToolLocalShellParam() ToolLocalShellParam {
12207	return ToolLocalShellParam{
12208		Type: "local_shell",
12209	}
12210}
12211
12212// A tool that allows the model to execute shell commands in a local environment.
12213//
12214// This struct has a constant value, construct it with [NewToolLocalShellParam].
12215type ToolLocalShellParam struct {
12216	// The type of the local shell tool. Always `local_shell`.
12217	Type constant.LocalShell `json:"type,required"`
12218	paramObj
12219}
12220
12221func (r ToolLocalShellParam) MarshalJSON() (data []byte, err error) {
12222	type shadow ToolLocalShellParam
12223	return param.MarshalObject(r, (*shadow)(&r))
12224}
12225func (r *ToolLocalShellParam) UnmarshalJSON(data []byte) error {
12226	return apijson.UnmarshalRoot(data, r)
12227}
12228
12229// Use this option to force the model to call a specific function.
12230type ToolChoiceFunction struct {
12231	// The name of the function to call.
12232	Name string `json:"name,required"`
12233	// For function calling, the type is always `function`.
12234	Type constant.Function `json:"type,required"`
12235	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
12236	JSON struct {
12237		Name        respjson.Field
12238		Type        respjson.Field
12239		ExtraFields map[string]respjson.Field
12240		raw         string
12241	} `json:"-"`
12242}
12243
12244// Returns the unmodified JSON received from the API
12245func (r ToolChoiceFunction) RawJSON() string { return r.JSON.raw }
12246func (r *ToolChoiceFunction) UnmarshalJSON(data []byte) error {
12247	return apijson.UnmarshalRoot(data, r)
12248}
12249
12250// ToParam converts this ToolChoiceFunction to a ToolChoiceFunctionParam.
12251//
12252// Warning: the fields of the param type will not be present. ToParam should only
12253// be used at the last possible moment before sending a request. Test for this with
12254// ToolChoiceFunctionParam.Overrides()
12255func (r ToolChoiceFunction) ToParam() ToolChoiceFunctionParam {
12256	return param.Override[ToolChoiceFunctionParam](json.RawMessage(r.RawJSON()))
12257}
12258
12259// Use this option to force the model to call a specific function.
12260//
12261// The properties Name, Type are required.
12262type ToolChoiceFunctionParam struct {
12263	// The name of the function to call.
12264	Name string `json:"name,required"`
12265	// For function calling, the type is always `function`.
12266	//
12267	// This field can be elided, and will marshal its zero value as "function".
12268	Type constant.Function `json:"type,required"`
12269	paramObj
12270}
12271
12272func (r ToolChoiceFunctionParam) MarshalJSON() (data []byte, err error) {
12273	type shadow ToolChoiceFunctionParam
12274	return param.MarshalObject(r, (*shadow)(&r))
12275}
12276func (r *ToolChoiceFunctionParam) UnmarshalJSON(data []byte) error {
12277	return apijson.UnmarshalRoot(data, r)
12278}
12279
12280// Use this option to force the model to call a specific tool on a remote MCP
12281// server.
12282type ToolChoiceMcp struct {
12283	// The label of the MCP server to use.
12284	ServerLabel string `json:"server_label,required"`
12285	// For MCP tools, the type is always `mcp`.
12286	Type constant.Mcp `json:"type,required"`
12287	// The name of the tool to call on the server.
12288	Name string `json:"name,nullable"`
12289	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
12290	JSON struct {
12291		ServerLabel respjson.Field
12292		Type        respjson.Field
12293		Name        respjson.Field
12294		ExtraFields map[string]respjson.Field
12295		raw         string
12296	} `json:"-"`
12297}
12298
12299// Returns the unmodified JSON received from the API
12300func (r ToolChoiceMcp) RawJSON() string { return r.JSON.raw }
12301func (r *ToolChoiceMcp) UnmarshalJSON(data []byte) error {
12302	return apijson.UnmarshalRoot(data, r)
12303}
12304
12305// ToParam converts this ToolChoiceMcp to a ToolChoiceMcpParam.
12306//
12307// Warning: the fields of the param type will not be present. ToParam should only
12308// be used at the last possible moment before sending a request. Test for this with
12309// ToolChoiceMcpParam.Overrides()
12310func (r ToolChoiceMcp) ToParam() ToolChoiceMcpParam {
12311	return param.Override[ToolChoiceMcpParam](json.RawMessage(r.RawJSON()))
12312}
12313
12314// Use this option to force the model to call a specific tool on a remote MCP
12315// server.
12316//
12317// The properties ServerLabel, Type are required.
12318type ToolChoiceMcpParam struct {
12319	// The label of the MCP server to use.
12320	ServerLabel string `json:"server_label,required"`
12321	// The name of the tool to call on the server.
12322	Name param.Opt[string] `json:"name,omitzero"`
12323	// For MCP tools, the type is always `mcp`.
12324	//
12325	// This field can be elided, and will marshal its zero value as "mcp".
12326	Type constant.Mcp `json:"type,required"`
12327	paramObj
12328}
12329
12330func (r ToolChoiceMcpParam) MarshalJSON() (data []byte, err error) {
12331	type shadow ToolChoiceMcpParam
12332	return param.MarshalObject(r, (*shadow)(&r))
12333}
12334func (r *ToolChoiceMcpParam) UnmarshalJSON(data []byte) error {
12335	return apijson.UnmarshalRoot(data, r)
12336}
12337
12338// Controls which (if any) tool is called by the model.
12339//
12340// `none` means the model will not call any tool and instead generates a message.
12341//
12342// `auto` means the model can pick between generating a message or calling one or
12343// more tools.
12344//
12345// `required` means the model must call one or more tools.
12346type ToolChoiceOptions string
12347
12348const (
12349	ToolChoiceOptionsNone     ToolChoiceOptions = "none"
12350	ToolChoiceOptionsAuto     ToolChoiceOptions = "auto"
12351	ToolChoiceOptionsRequired ToolChoiceOptions = "required"
12352)
12353
12354// Indicates that the model should use a built-in tool to generate a response.
12355// [Learn more about built-in tools](https://platform.openai.com/docs/guides/tools).
12356type ToolChoiceTypes struct {
12357	// The type of hosted tool the model should to use. Learn more about
12358	// [built-in tools](https://platform.openai.com/docs/guides/tools).
12359	//
12360	// Allowed values are:
12361	//
12362	// - `file_search`
12363	// - `web_search_preview`
12364	// - `computer_use_preview`
12365	// - `code_interpreter`
12366	// - `image_generation`
12367	//
12368	// Any of "file_search", "web_search_preview", "computer_use_preview",
12369	// "web_search_preview_2025_03_11", "image_generation", "code_interpreter".
12370	Type ToolChoiceTypesType `json:"type,required"`
12371	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
12372	JSON struct {
12373		Type        respjson.Field
12374		ExtraFields map[string]respjson.Field
12375		raw         string
12376	} `json:"-"`
12377}
12378
12379// Returns the unmodified JSON received from the API
12380func (r ToolChoiceTypes) RawJSON() string { return r.JSON.raw }
12381func (r *ToolChoiceTypes) UnmarshalJSON(data []byte) error {
12382	return apijson.UnmarshalRoot(data, r)
12383}
12384
12385// ToParam converts this ToolChoiceTypes to a ToolChoiceTypesParam.
12386//
12387// Warning: the fields of the param type will not be present. ToParam should only
12388// be used at the last possible moment before sending a request. Test for this with
12389// ToolChoiceTypesParam.Overrides()
12390func (r ToolChoiceTypes) ToParam() ToolChoiceTypesParam {
12391	return param.Override[ToolChoiceTypesParam](json.RawMessage(r.RawJSON()))
12392}
12393
12394// The type of hosted tool the model should to use. Learn more about
12395// [built-in tools](https://platform.openai.com/docs/guides/tools).
12396//
12397// Allowed values are:
12398//
12399// - `file_search`
12400// - `web_search_preview`
12401// - `computer_use_preview`
12402// - `code_interpreter`
12403// - `image_generation`
12404type ToolChoiceTypesType string
12405
12406const (
12407	ToolChoiceTypesTypeFileSearch                 ToolChoiceTypesType = "file_search"
12408	ToolChoiceTypesTypeWebSearchPreview           ToolChoiceTypesType = "web_search_preview"
12409	ToolChoiceTypesTypeComputerUsePreview         ToolChoiceTypesType = "computer_use_preview"
12410	ToolChoiceTypesTypeWebSearchPreview2025_03_11 ToolChoiceTypesType = "web_search_preview_2025_03_11"
12411	ToolChoiceTypesTypeImageGeneration            ToolChoiceTypesType = "image_generation"
12412	ToolChoiceTypesTypeCodeInterpreter            ToolChoiceTypesType = "code_interpreter"
12413)
12414
12415// Indicates that the model should use a built-in tool to generate a response.
12416// [Learn more about built-in tools](https://platform.openai.com/docs/guides/tools).
12417//
12418// The property Type is required.
12419type ToolChoiceTypesParam struct {
12420	// The type of hosted tool the model should to use. Learn more about
12421	// [built-in tools](https://platform.openai.com/docs/guides/tools).
12422	//
12423	// Allowed values are:
12424	//
12425	// - `file_search`
12426	// - `web_search_preview`
12427	// - `computer_use_preview`
12428	// - `code_interpreter`
12429	// - `image_generation`
12430	//
12431	// Any of "file_search", "web_search_preview", "computer_use_preview",
12432	// "web_search_preview_2025_03_11", "image_generation", "code_interpreter".
12433	Type ToolChoiceTypesType `json:"type,omitzero,required"`
12434	paramObj
12435}
12436
12437func (r ToolChoiceTypesParam) MarshalJSON() (data []byte, err error) {
12438	type shadow ToolChoiceTypesParam
12439	return param.MarshalObject(r, (*shadow)(&r))
12440}
12441func (r *ToolChoiceTypesParam) UnmarshalJSON(data []byte) error {
12442	return apijson.UnmarshalRoot(data, r)
12443}
12444
12445// This tool searches the web for relevant results to use in a response. Learn more
12446// about the
12447// [web search tool](https://platform.openai.com/docs/guides/tools-web-search).
12448type WebSearchTool struct {
12449	// The type of the web search tool. One of `web_search_preview` or
12450	// `web_search_preview_2025_03_11`.
12451	//
12452	// Any of "web_search_preview", "web_search_preview_2025_03_11".
12453	Type WebSearchToolType `json:"type,required"`
12454	// High level guidance for the amount of context window space to use for the
12455	// search. One of `low`, `medium`, or `high`. `medium` is the default.
12456	//
12457	// Any of "low", "medium", "high".
12458	SearchContextSize WebSearchToolSearchContextSize `json:"search_context_size"`
12459	// The user's location.
12460	UserLocation WebSearchToolUserLocation `json:"user_location,nullable"`
12461	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
12462	JSON struct {
12463		Type              respjson.Field
12464		SearchContextSize respjson.Field
12465		UserLocation      respjson.Field
12466		ExtraFields       map[string]respjson.Field
12467		raw               string
12468	} `json:"-"`
12469}
12470
12471// Returns the unmodified JSON received from the API
12472func (r WebSearchTool) RawJSON() string { return r.JSON.raw }
12473func (r *WebSearchTool) UnmarshalJSON(data []byte) error {
12474	return apijson.UnmarshalRoot(data, r)
12475}
12476
12477// ToParam converts this WebSearchTool to a WebSearchToolParam.
12478//
12479// Warning: the fields of the param type will not be present. ToParam should only
12480// be used at the last possible moment before sending a request. Test for this with
12481// WebSearchToolParam.Overrides()
12482func (r WebSearchTool) ToParam() WebSearchToolParam {
12483	return param.Override[WebSearchToolParam](json.RawMessage(r.RawJSON()))
12484}
12485
12486// The type of the web search tool. One of `web_search_preview` or
12487// `web_search_preview_2025_03_11`.
12488type WebSearchToolType string
12489
12490const (
12491	WebSearchToolTypeWebSearchPreview           WebSearchToolType = "web_search_preview"
12492	WebSearchToolTypeWebSearchPreview2025_03_11 WebSearchToolType = "web_search_preview_2025_03_11"
12493)
12494
12495// High level guidance for the amount of context window space to use for the
12496// search. One of `low`, `medium`, or `high`. `medium` is the default.
12497type WebSearchToolSearchContextSize string
12498
12499const (
12500	WebSearchToolSearchContextSizeLow    WebSearchToolSearchContextSize = "low"
12501	WebSearchToolSearchContextSizeMedium WebSearchToolSearchContextSize = "medium"
12502	WebSearchToolSearchContextSizeHigh   WebSearchToolSearchContextSize = "high"
12503)
12504
12505// The user's location.
12506type WebSearchToolUserLocation struct {
12507	// The type of location approximation. Always `approximate`.
12508	Type constant.Approximate `json:"type,required"`
12509	// Free text input for the city of the user, e.g. `San Francisco`.
12510	City string `json:"city,nullable"`
12511	// The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of
12512	// the user, e.g. `US`.
12513	Country string `json:"country,nullable"`
12514	// Free text input for the region of the user, e.g. `California`.
12515	Region string `json:"region,nullable"`
12516	// The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the
12517	// user, e.g. `America/Los_Angeles`.
12518	Timezone string `json:"timezone,nullable"`
12519	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
12520	JSON struct {
12521		Type        respjson.Field
12522		City        respjson.Field
12523		Country     respjson.Field
12524		Region      respjson.Field
12525		Timezone    respjson.Field
12526		ExtraFields map[string]respjson.Field
12527		raw         string
12528	} `json:"-"`
12529}
12530
12531// Returns the unmodified JSON received from the API
12532func (r WebSearchToolUserLocation) RawJSON() string { return r.JSON.raw }
12533func (r *WebSearchToolUserLocation) UnmarshalJSON(data []byte) error {
12534	return apijson.UnmarshalRoot(data, r)
12535}
12536
12537// This tool searches the web for relevant results to use in a response. Learn more
12538// about the
12539// [web search tool](https://platform.openai.com/docs/guides/tools-web-search).
12540//
12541// The property Type is required.
12542type WebSearchToolParam struct {
12543	// The type of the web search tool. One of `web_search_preview` or
12544	// `web_search_preview_2025_03_11`.
12545	//
12546	// Any of "web_search_preview", "web_search_preview_2025_03_11".
12547	Type WebSearchToolType `json:"type,omitzero,required"`
12548	// The user's location.
12549	UserLocation WebSearchToolUserLocationParam `json:"user_location,omitzero"`
12550	// High level guidance for the amount of context window space to use for the
12551	// search. One of `low`, `medium`, or `high`. `medium` is the default.
12552	//
12553	// Any of "low", "medium", "high".
12554	SearchContextSize WebSearchToolSearchContextSize `json:"search_context_size,omitzero"`
12555	paramObj
12556}
12557
12558func (r WebSearchToolParam) MarshalJSON() (data []byte, err error) {
12559	type shadow WebSearchToolParam
12560	return param.MarshalObject(r, (*shadow)(&r))
12561}
12562func (r *WebSearchToolParam) UnmarshalJSON(data []byte) error {
12563	return apijson.UnmarshalRoot(data, r)
12564}
12565
12566// The user's location.
12567//
12568// The property Type is required.
12569type WebSearchToolUserLocationParam struct {
12570	// Free text input for the city of the user, e.g. `San Francisco`.
12571	City param.Opt[string] `json:"city,omitzero"`
12572	// The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of
12573	// the user, e.g. `US`.
12574	Country param.Opt[string] `json:"country,omitzero"`
12575	// Free text input for the region of the user, e.g. `California`.
12576	Region param.Opt[string] `json:"region,omitzero"`
12577	// The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the
12578	// user, e.g. `America/Los_Angeles`.
12579	Timezone param.Opt[string] `json:"timezone,omitzero"`
12580	// The type of location approximation. Always `approximate`.
12581	//
12582	// This field can be elided, and will marshal its zero value as "approximate".
12583	Type constant.Approximate `json:"type,required"`
12584	paramObj
12585}
12586
12587func (r WebSearchToolUserLocationParam) MarshalJSON() (data []byte, err error) {
12588	type shadow WebSearchToolUserLocationParam
12589	return param.MarshalObject(r, (*shadow)(&r))
12590}
12591func (r *WebSearchToolUserLocationParam) UnmarshalJSON(data []byte) error {
12592	return apijson.UnmarshalRoot(data, r)
12593}
12594
12595type ResponseNewParams struct {
12596	// Whether to run the model response in the background.
12597	// [Learn more](https://platform.openai.com/docs/guides/background).
12598	Background param.Opt[bool] `json:"background,omitzero"`
12599	// A system (or developer) message inserted into the model's context.
12600	//
12601	// When using along with `previous_response_id`, the instructions from a previous
12602	// response will not be carried over to the next response. This makes it simple to
12603	// swap out system (or developer) messages in new responses.
12604	Instructions param.Opt[string] `json:"instructions,omitzero"`
12605	// An upper bound for the number of tokens that can be generated for a response,
12606	// including visible output tokens and
12607	// [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).
12608	MaxOutputTokens param.Opt[int64] `json:"max_output_tokens,omitzero"`
12609	// The maximum number of total calls to built-in tools that can be processed in a
12610	// response. This maximum number applies across all built-in tool calls, not per
12611	// individual tool. Any further attempts to call a tool by the model will be
12612	// ignored.
12613	MaxToolCalls param.Opt[int64] `json:"max_tool_calls,omitzero"`
12614	// Whether to allow the model to run tool calls in parallel.
12615	ParallelToolCalls param.Opt[bool] `json:"parallel_tool_calls,omitzero"`
12616	// The unique ID of the previous response to the model. Use this to create
12617	// multi-turn conversations. Learn more about
12618	// [conversation state](https://platform.openai.com/docs/guides/conversation-state).
12619	PreviousResponseID param.Opt[string] `json:"previous_response_id,omitzero"`
12620	// Whether to store the generated model response for later retrieval via API.
12621	Store param.Opt[bool] `json:"store,omitzero"`
12622	// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
12623	// make the output more random, while lower values like 0.2 will make it more
12624	// focused and deterministic. We generally recommend altering this or `top_p` but
12625	// not both.
12626	Temperature param.Opt[float64] `json:"temperature,omitzero"`
12627	// An integer between 0 and 20 specifying the number of most likely tokens to
12628	// return at each token position, each with an associated log probability.
12629	TopLogprobs param.Opt[int64] `json:"top_logprobs,omitzero"`
12630	// An alternative to sampling with temperature, called nucleus sampling, where the
12631	// model considers the results of the tokens with top_p probability mass. So 0.1
12632	// means only the tokens comprising the top 10% probability mass are considered.
12633	//
12634	// We generally recommend altering this or `temperature` but not both.
12635	TopP param.Opt[float64] `json:"top_p,omitzero"`
12636	// A stable identifier for your end-users. Used to boost cache hit rates by better
12637	// bucketing similar requests and to help OpenAI detect and prevent abuse.
12638	// [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
12639	User param.Opt[string] `json:"user,omitzero"`
12640	// Specify additional output data to include in the model response. Currently
12641	// supported values are:
12642	//
12643	//   - `code_interpreter_call.outputs`: Includes the outputs of python code execution
12644	//     in code interpreter tool call items.
12645	//   - `computer_call_output.output.image_url`: Include image urls from the computer
12646	//     call output.
12647	//   - `file_search_call.results`: Include the search results of the file search tool
12648	//     call.
12649	//   - `message.input_image.image_url`: Include image urls from the input message.
12650	//   - `message.output_text.logprobs`: Include logprobs with assistant messages.
12651	//   - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
12652	//     tokens in reasoning item outputs. This enables reasoning items to be used in
12653	//     multi-turn conversations when using the Responses API statelessly (like when
12654	//     the `store` parameter is set to `false`, or when an organization is enrolled
12655	//     in the zero data retention program).
12656	Include []ResponseIncludable `json:"include,omitzero"`
12657	// Set of 16 key-value pairs that can be attached to an object. This can be useful
12658	// for storing additional information about the object in a structured format, and
12659	// querying for objects via API or the dashboard.
12660	//
12661	// Keys are strings with a maximum length of 64 characters. Values are strings with
12662	// a maximum length of 512 characters.
12663	Metadata shared.Metadata `json:"metadata,omitzero"`
12664	// Reference to a prompt template and its variables.
12665	// [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
12666	Prompt ResponsePromptParam `json:"prompt,omitzero"`
12667	// Specifies the processing type used for serving the request.
12668	//
12669	//   - If set to 'auto', then the request will be processed with the service tier
12670	//     configured in the Project settings. Unless otherwise configured, the Project
12671	//     will use 'default'.
12672	//   - If set to 'default', then the requset will be processed with the standard
12673	//     pricing and performance for the selected model.
12674	//   - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
12675	//     'priority', then the request will be processed with the corresponding service
12676	//     tier. [Contact sales](https://openai.com/contact-sales) to learn more about
12677	//     Priority processing.
12678	//   - When not set, the default behavior is 'auto'.
12679	//
12680	// When the `service_tier` parameter is set, the response body will include the
12681	// `service_tier` value based on the processing mode actually used to serve the
12682	// request. This response value may be different from the value set in the
12683	// parameter.
12684	//
12685	// Any of "auto", "default", "flex", "scale", "priority".
12686	ServiceTier ResponseNewParamsServiceTier `json:"service_tier,omitzero"`
12687	// The truncation strategy to use for the model response.
12688	//
12689	//   - `auto`: If the context of this response and previous ones exceeds the model's
12690	//     context window size, the model will truncate the response to fit the context
12691	//     window by dropping input items in the middle of the conversation.
12692	//   - `disabled` (default): If a model response will exceed the context window size
12693	//     for a model, the request will fail with a 400 error.
12694	//
12695	// Any of "auto", "disabled".
12696	Truncation ResponseNewParamsTruncation `json:"truncation,omitzero"`
12697	// Text, image, or file inputs to the model, used to generate a response.
12698	//
12699	// Learn more:
12700	//
12701	// - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
12702	// - [Image inputs](https://platform.openai.com/docs/guides/images)
12703	// - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
12704	// - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
12705	// - [Function calling](https://platform.openai.com/docs/guides/function-calling)
12706	Input ResponseNewParamsInputUnion `json:"input,omitzero"`
12707	// Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
12708	// wide range of models with different capabilities, performance characteristics,
12709	// and price points. Refer to the
12710	// [model guide](https://platform.openai.com/docs/models) to browse and compare
12711	// available models.
12712	Model shared.ResponsesModel `json:"model,omitzero"`
12713	// **o-series models only**
12714	//
12715	// Configuration options for
12716	// [reasoning models](https://platform.openai.com/docs/guides/reasoning).
12717	Reasoning shared.ReasoningParam `json:"reasoning,omitzero"`
12718	// Configuration options for a text response from the model. Can be plain text or
12719	// structured JSON data. Learn more:
12720	//
12721	// - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
12722	// - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
12723	Text ResponseTextConfigParam `json:"text,omitzero"`
12724	// How the model should select which tool (or tools) to use when generating a
12725	// response. See the `tools` parameter to see how to specify which tools the model
12726	// can call.
12727	ToolChoice ResponseNewParamsToolChoiceUnion `json:"tool_choice,omitzero"`
12728	// An array of tools the model may call while generating a response. You can
12729	// specify which tool to use by setting the `tool_choice` parameter.
12730	//
12731	// The two categories of tools you can provide the model are:
12732	//
12733	//   - **Built-in tools**: Tools that are provided by OpenAI that extend the model's
12734	//     capabilities, like
12735	//     [web search](https://platform.openai.com/docs/guides/tools-web-search) or
12736	//     [file search](https://platform.openai.com/docs/guides/tools-file-search).
12737	//     Learn more about
12738	//     [built-in tools](https://platform.openai.com/docs/guides/tools).
12739	//   - **Function calls (custom tools)**: Functions that are defined by you, enabling
12740	//     the model to call your own code. Learn more about
12741	//     [function calling](https://platform.openai.com/docs/guides/function-calling).
12742	Tools []ToolUnionParam `json:"tools,omitzero"`
12743	paramObj
12744}
12745
12746func (r ResponseNewParams) MarshalJSON() (data []byte, err error) {
12747	type shadow ResponseNewParams
12748	return param.MarshalObject(r, (*shadow)(&r))
12749}
12750func (r *ResponseNewParams) UnmarshalJSON(data []byte) error {
12751	return apijson.UnmarshalRoot(data, r)
12752}
12753
12754// Only one field can be non-zero.
12755//
12756// Use [param.IsOmitted] to confirm if a field is set.
12757type ResponseNewParamsInputUnion struct {
12758	OfString        param.Opt[string]  `json:",omitzero,inline"`
12759	OfInputItemList ResponseInputParam `json:",omitzero,inline"`
12760	paramUnion
12761}
12762
12763func (u ResponseNewParamsInputUnion) MarshalJSON() ([]byte, error) {
12764	return param.MarshalUnion(u, u.OfString, u.OfInputItemList)
12765}
12766func (u *ResponseNewParamsInputUnion) UnmarshalJSON(data []byte) error {
12767	return apijson.UnmarshalRoot(data, u)
12768}
12769
12770func (u *ResponseNewParamsInputUnion) asAny() any {
12771	if !param.IsOmitted(u.OfString) {
12772		return &u.OfString.Value
12773	} else if !param.IsOmitted(u.OfInputItemList) {
12774		return &u.OfInputItemList
12775	}
12776	return nil
12777}
12778
12779// Specifies the processing type used for serving the request.
12780//
12781//   - If set to 'auto', then the request will be processed with the service tier
12782//     configured in the Project settings. Unless otherwise configured, the Project
12783//     will use 'default'.
12784//   - If set to 'default', then the requset will be processed with the standard
12785//     pricing and performance for the selected model.
12786//   - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
12787//     'priority', then the request will be processed with the corresponding service
12788//     tier. [Contact sales](https://openai.com/contact-sales) to learn more about
12789//     Priority processing.
12790//   - When not set, the default behavior is 'auto'.
12791//
12792// When the `service_tier` parameter is set, the response body will include the
12793// `service_tier` value based on the processing mode actually used to serve the
12794// request. This response value may be different from the value set in the
12795// parameter.
12796type ResponseNewParamsServiceTier string
12797
12798const (
12799	ResponseNewParamsServiceTierAuto     ResponseNewParamsServiceTier = "auto"
12800	ResponseNewParamsServiceTierDefault  ResponseNewParamsServiceTier = "default"
12801	ResponseNewParamsServiceTierFlex     ResponseNewParamsServiceTier = "flex"
12802	ResponseNewParamsServiceTierScale    ResponseNewParamsServiceTier = "scale"
12803	ResponseNewParamsServiceTierPriority ResponseNewParamsServiceTier = "priority"
12804)
12805
12806// Only one field can be non-zero.
12807//
12808// Use [param.IsOmitted] to confirm if a field is set.
12809type ResponseNewParamsToolChoiceUnion struct {
12810	// Check if union is this variant with !param.IsOmitted(union.OfToolChoiceMode)
12811	OfToolChoiceMode param.Opt[ToolChoiceOptions] `json:",omitzero,inline"`
12812	OfHostedTool     *ToolChoiceTypesParam        `json:",omitzero,inline"`
12813	OfFunctionTool   *ToolChoiceFunctionParam     `json:",omitzero,inline"`
12814	OfMcpTool        *ToolChoiceMcpParam          `json:",omitzero,inline"`
12815	paramUnion
12816}
12817
12818func (u ResponseNewParamsToolChoiceUnion) MarshalJSON() ([]byte, error) {
12819	return param.MarshalUnion(u, u.OfToolChoiceMode, u.OfHostedTool, u.OfFunctionTool, u.OfMcpTool)
12820}
12821func (u *ResponseNewParamsToolChoiceUnion) UnmarshalJSON(data []byte) error {
12822	return apijson.UnmarshalRoot(data, u)
12823}
12824
12825func (u *ResponseNewParamsToolChoiceUnion) asAny() any {
12826	if !param.IsOmitted(u.OfToolChoiceMode) {
12827		return &u.OfToolChoiceMode
12828	} else if !param.IsOmitted(u.OfHostedTool) {
12829		return u.OfHostedTool
12830	} else if !param.IsOmitted(u.OfFunctionTool) {
12831		return u.OfFunctionTool
12832	} else if !param.IsOmitted(u.OfMcpTool) {
12833		return u.OfMcpTool
12834	}
12835	return nil
12836}
12837
12838// Returns a pointer to the underlying variant's property, if present.
12839func (u ResponseNewParamsToolChoiceUnion) GetServerLabel() *string {
12840	if vt := u.OfMcpTool; vt != nil {
12841		return &vt.ServerLabel
12842	}
12843	return nil
12844}
12845
12846// Returns a pointer to the underlying variant's property, if present.
12847func (u ResponseNewParamsToolChoiceUnion) GetType() *string {
12848	if vt := u.OfHostedTool; vt != nil {
12849		return (*string)(&vt.Type)
12850	} else if vt := u.OfFunctionTool; vt != nil {
12851		return (*string)(&vt.Type)
12852	} else if vt := u.OfMcpTool; vt != nil {
12853		return (*string)(&vt.Type)
12854	}
12855	return nil
12856}
12857
12858// Returns a pointer to the underlying variant's property, if present.
12859func (u ResponseNewParamsToolChoiceUnion) GetName() *string {
12860	if vt := u.OfFunctionTool; vt != nil {
12861		return (*string)(&vt.Name)
12862	} else if vt := u.OfMcpTool; vt != nil && vt.Name.Valid() {
12863		return &vt.Name.Value
12864	}
12865	return nil
12866}
12867
12868// The truncation strategy to use for the model response.
12869//
12870//   - `auto`: If the context of this response and previous ones exceeds the model's
12871//     context window size, the model will truncate the response to fit the context
12872//     window by dropping input items in the middle of the conversation.
12873//   - `disabled` (default): If a model response will exceed the context window size
12874//     for a model, the request will fail with a 400 error.
12875type ResponseNewParamsTruncation string
12876
12877const (
12878	ResponseNewParamsTruncationAuto     ResponseNewParamsTruncation = "auto"
12879	ResponseNewParamsTruncationDisabled ResponseNewParamsTruncation = "disabled"
12880)
12881
12882type ResponseGetParams struct {
12883	// The sequence number of the event after which to start streaming.
12884	StartingAfter param.Opt[int64] `query:"starting_after,omitzero" json:"-"`
12885	// Additional fields to include in the response. See the `include` parameter for
12886	// Response creation above for more information.
12887	Include []ResponseIncludable `query:"include,omitzero" json:"-"`
12888	paramObj
12889}
12890
12891// URLQuery serializes [ResponseGetParams]'s query parameters as `url.Values`.
12892func (r ResponseGetParams) URLQuery() (v url.Values, err error) {
12893	return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
12894		ArrayFormat:  apiquery.ArrayQueryFormatBrackets,
12895		NestedFormat: apiquery.NestedQueryFormatBrackets,
12896	})
12897}