diff --git a/go.mod b/go.mod index e3f660eb1..2cbc162f0 100644 --- a/go.mod +++ b/go.mod @@ -23,8 +23,8 @@ require ( github.com/sirupsen/logrus v1.9.4 github.com/spf13/cobra v1.10.2 github.com/stretchr/testify v1.11.1 - golang.org/x/mod v0.35.0 - golang.org/x/net v0.53.0 + golang.org/x/mod v0.37.0 + golang.org/x/net v0.57.0 gopkg.in/yaml.v3 v3.0.1 k8s.io/api v0.35.4 k8s.io/apiextensions-apiserver v0.35.4 @@ -40,10 +40,10 @@ require ( cloud.google.com/go/auth v0.20.0 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect cloud.google.com/go/compute/metadata v0.9.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.22.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.7.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.7.2 // indirect github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b // indirect github.com/anthropics/anthropic-sdk-go v1.37.0 // indirect github.com/aws/aws-sdk-go-v2 v1.41.5 // indirect @@ -142,7 +142,7 @@ require ( github.com/open-telemetry/opentelemetry-collector-contrib/internal/exp/metrics v0.150.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.150.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatocumulativeprocessor v0.150.0 // indirect - github.com/openai/openai-go/v3 v3.32.0 // indirect + github.com/openai/openai-go/v3 v3.45.0 // indirect github.com/pb33f/jsonpath v0.8.2 // indirect github.com/pb33f/libopenapi v0.36.1 // indirect github.com/pb33f/libopenapi-validator v0.13.4 // indirect @@ -158,7 +158,7 @@ require ( github.com/puzpuzpuz/xsync/v4 v4.4.0 // indirect github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect github.com/spf13/pflag v1.0.10 // indirect - github.com/tidwall/gjson v1.18.0 // indirect + github.com/tidwall/gjson v1.19.0 // indirect github.com/tidwall/match v1.2.0 // indirect github.com/tidwall/pretty v1.2.1 // indirect github.com/tidwall/sjson v1.2.5 // indirect @@ -187,15 +187,15 @@ require ( go.yaml.in/yaml/v2 v2.4.4 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect go.yaml.in/yaml/v4 v4.0.0-rc.4 // indirect - golang.org/x/crypto v0.50.0 // indirect + golang.org/x/crypto v0.54.0 // indirect golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f // indirect golang.org/x/oauth2 v0.36.0 // indirect - golang.org/x/sync v0.20.0 // indirect - golang.org/x/sys v0.43.0 // indirect - golang.org/x/term v0.42.0 // indirect - golang.org/x/text v0.36.0 // indirect + golang.org/x/sync v0.22.0 // indirect + golang.org/x/sys v0.47.0 // indirect + golang.org/x/term v0.45.0 // indirect + golang.org/x/text v0.40.0 // indirect golang.org/x/time v0.15.0 // indirect - golang.org/x/tools v0.44.0 // indirect + golang.org/x/tools v0.47.0 // indirect gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect google.golang.org/api v0.276.0 // indirect google.golang.org/genai v1.54.0 // indirect diff --git a/go.sum b/go.sum index 49f9dee7a..679ca7296 100644 --- a/go.sum +++ b/go.sum @@ -8,12 +8,12 @@ cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIi cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c= cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 h1:fou+2+WFTib47nS+nz/ozhEBnvU96bKHy6LjRsY4E28= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0/go.mod h1:t76Ruy8AHvUAC8GfMWJMa0ElSbuIcO03NLpynfbgsPA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 h1:Hk5QBxZQC1jb2Fwj6mpzme37xbCDdNTxU7O9eb5+LB4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1/go.mod h1:IYus9qsFobWIc2YVwe/WPjcnyCkPKtnHAqUYeebc8z0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.22.0 h1:aokoqcHvaGjiM3VpjKDfMMnF/8epJ+Q1HLJ7CudztqE= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.22.0/go.mod h1:/WYEx9pcM9Y+Dd/APJaNlSvVSvzl54rrMdZT5+Oi2LM= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.0 h1:CU4+EJeJi3TKYWEcYuSdWsjzw0nVsK/H0MSQOiPcymU= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.0/go.mod h1:q0+UTSRvShwUCrR/s5HtyInYphN7Wvxb7snFM3u+SLA= +github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.4.0 h1:xFaZZ+IubdftrDHnGGwZ6QvQ3KHTtWl2MCK+GMt2vxs= +github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.4.0/go.mod h1:mCBhUhlMjLLJKr5aqw2TNS/VqJOie8MzWq3DAMJeKso= github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 h1:fhqpLE3UEXi9lPaBRpQ6XuRW0nU7hgg4zlmZZa+a9q4= github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0/go.mod h1:7dCRMLwisfRH3dBupKeNCioWYUZ4SS09Z14H+7i8ZoY= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.7.0 h1:LkHbJbgF3YyvC53aqYGR+wWQDn2Rdp9AQdGndf9QvY4= @@ -22,8 +22,8 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 v4.3 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 v4.3.0/go.mod h1:Y/HgrePTmGy9HjdSGTqZNa+apUpTVIEVKXJyARP2lrk= github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= -github.com/AzureAD/microsoft-authentication-library-for-go v1.7.1 h1:edShSHV3DV90+kt+CMaEXEzR9QF7wFrPJxVGz2blMIU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.7.1/go.mod h1:HKpQxkWaGLJ+D/5H8QRpyQXA1eKjxkFlOMwck5+33Jk= +github.com/AzureAD/microsoft-authentication-library-for-go v1.7.2 h1:RHK7bS+HQMslb1sZpAokUt+zTVmue0hKSs2C791hhzU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.7.2/go.mod h1:HKpQxkWaGLJ+D/5H8QRpyQXA1eKjxkFlOMwck5+33Jk= github.com/Code-Hex/go-generics-cache v1.5.1 h1:6vhZGc5M7Y/YD8cIUcY8kcuQLB4cHR7U+0KMqAA0KcU= github.com/Code-Hex/go-generics-cache v1.5.1/go.mod h1:qxcC9kRVrct9rHeiYpFWSoW1vxyillCVzX13KZG8dl4= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= @@ -390,8 +390,8 @@ github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.150.0 github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.150.0/go.mod h1:qYh2PcJsgK0qJ0+vjLYow+E2DAJ7o1MuZ3r0hakgxiE= github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatocumulativeprocessor v0.150.0 h1:Jg2Ets7VwgAZUmnaptx7TJTnjPG7nYZhGOeaveTpC/8= github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatocumulativeprocessor v0.150.0/go.mod h1:SdJHLLrcNFtcPIY4NUTLyx4+0gZZRyOTJfrVLUVxILQ= -github.com/openai/openai-go/v3 v3.32.0 h1:aHp/3wkX1W6jB8zTtf9xV0aK0qPFSVDqS7AHmlJ4hXs= -github.com/openai/openai-go/v3 v3.32.0/go.mod h1:cdufnVK14cWcT9qA1rRtrXx4FTRsgbDPW7Ia7SS5cZo= +github.com/openai/openai-go/v3 v3.45.0 h1:bmSSXh5EhTrFA7AFYFLBs4NmeIuWB8iUSk+gGKUTmkA= +github.com/openai/openai-go/v3 v3.45.0/go.mod h1:b8MgNMpR3lPifYnaOH8XwcG8qRHwhzZxuDgM9lL7h5k= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= @@ -484,8 +484,8 @@ github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8 github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= -github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/gjson v1.19.0 h1:xwxm7n691Uf3u5OFjzngavjGTh55KX5q/9w9xHW88JU= +github.com/tidwall/gjson v1.19.0/go.mod h1:V37/opeE/JbLUOfH0QTXiNez2l0RUjYUhpT4szFQAfc= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/match v1.2.0 h1:0pt8FlkOwjN2fPt4bIl4BoNxb98gGHN2ObFEDkrfZnM= github.com/tidwall/match v1.2.0/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= @@ -588,16 +588,16 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= -golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI= -golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q= +golang.org/x/crypto v0.54.0 h1:YLIA59K4fiNzHzjnZt2tUJQjQtUWfWbeHBqKtk3eScw= +golang.org/x/crypto v0.54.0/go.mod h1:KWL8ny2AZdGR2cWmzeHrp2azQPGogOv+HeQaVEXC2dk= golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f h1:W3F4c+6OLc6H2lb//N1q4WpJkhzJCK5J6kUi1NTVXfM= golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f/go.mod h1:J1xhfL/vlindoeF/aINzNzt2Bket5bjo9sdOYzOsU80= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM= -golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU= +golang.org/x/mod v0.37.0 h1:vF1DjpVEshcIqoEaauuHebaLk1O1forxjxBaVn884JQ= +golang.org/x/mod v0.37.0/go.mod h1:m8S8VeM9r4dzDwjrKO0a1sZP3YjeMamRRlD+fmR2Q/0= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -609,8 +609,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= -golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA= -golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs= +golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE= +golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -619,8 +619,8 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= -golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= +golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -638,23 +638,23 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= -golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= +golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= -golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY= -golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY= +golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0= +golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= -golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= +golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= +golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -664,8 +664,8 @@ golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c= -golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI= +golang.org/x/tools v0.47.0 h1:7Kn5x/d1svx/PzryTsqeoZN4TZwqeH5pGWjefhLi/1Q= +golang.org/x/tools v0.47.0/go.mod h1:dFHnyTvFWY212G+h7ZY4Vsp/K3U4/7W9TyVaAul8uCA= golang.org/x/tools/go/expect v0.1.1-deprecated h1:jpBZDwmgPhXsKZC6WhL20P4b/wmnpsEAGHaNy0n/rJM= golang.org/x/tools/go/expect v0.1.1-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY= golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated h1:1h2MnaIAIXISqTFKdENegdpAgUXz6NrPEsbIeWaBRvM= diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md index fa477145f..ed56ac241 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md @@ -1,5 +1,28 @@ # Release History +## 1.22.0 (2026-06-04) + +### Features Added + +* Added type `datetime.RFC7231` for date/time values in RFC 1123 format with a fixed GMT timezone. + +### Other Changes + +* Upgraded dependencies. + +## 1.21.1 (2026-04-16) + +### Bugs Fixed + +* Fixed an issue in `ResponseError.Error()` where the request URL path was being logged unescaped. +* Redact query parameters when logging errors. +* For `runtime.JoinPaths`, don't add a slash between root and paths when `paths` starts with `?` (query string). + +### Other Changes + +* Upgraded to Go 1.25.0. +* Upgraded dependencies. + ## 1.21.0 (2026-01-12) ### Features Added diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/response_error.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/response_error.go index ef0635bb2..8246b6a5b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/response_error.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported/response_error.go @@ -131,7 +131,7 @@ func (e *ResponseError) Error() string { msg := &bytes.Buffer{} if e.RawResponse != nil { if e.RawResponse.Request != nil { - fmt.Fprintf(msg, "%s %s://%s%s\n", e.RawResponse.Request.Method, e.RawResponse.Request.URL.Scheme, e.RawResponse.Request.URL.Host, e.RawResponse.Request.URL.Path) + fmt.Fprintf(msg, "%s %s://%s%s\n", e.RawResponse.Request.Method, e.RawResponse.Request.URL.Scheme, e.RawResponse.Request.URL.Host, e.RawResponse.Request.URL.EscapedPath()) } else { fmt.Fprintln(msg, "Request information not available") } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go index 213202e33..4f7aa6434 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go @@ -37,5 +37,5 @@ const ( Module = "azcore" // Version is the semantic version (see http://semver.org) of this module. - Version = "v1.21.0" + Version = "v1.22.0" ) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_bearer_token.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_bearer_token.go index 547e5a327..f204a19c4 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_bearer_token.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_bearer_token.go @@ -182,7 +182,7 @@ func (b *BearerTokenPolicy) handleChallenge(req *policy.Request, res *http.Respo func checkHTTPSForAuth(req *policy.Request, allowHTTP bool) error { if strings.ToLower(req.Raw().URL.Scheme) != "https" && !allowHTTP { - return errorinfo.NonRetriableError(errors.New("authenticated requests are not permitted for non TLS protected (https) endpoints")) + return errorinfo.NonRetriableError(errors.New("authorized requests are not permitted for non-TLS protected (https) endpoints")) } return nil } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_http_trace.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_http_trace.go index ddf9ede01..7017d5e10 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_http_trace.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_http_trace.go @@ -5,10 +5,8 @@ package runtime import ( "context" - "errors" "fmt" "net/http" - "net/url" "strings" "github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/exported" @@ -73,14 +71,7 @@ func (h *httpTracePolicy) Do(req *policy.Request) (resp *http.Response, err erro span.SetAttributes(tracing.Attribute{Key: attrAZServiceReqID, Value: reqID}) } } else if err != nil { - var urlErr *url.Error - if errors.As(err, &urlErr) { - // calling *url.Error.Error() will include the unsanitized URL - // which we don't want. in addition, we already have the HTTP verb - // and sanitized URL in the trace so we aren't losing any info - err = urlErr.Err - } - span.SetStatus(tracing.SpanStatusError, err.Error()) + span.SetStatus(tracing.SpanStatusError, getSanitizedURLString(err.Error(), req.Raw().URL, h.allowedQP)) } span.End() }() diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_logging.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_logging.go index dd59fbc99..d9e6481de 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_logging.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_logging.go @@ -158,6 +158,27 @@ func getSanitizedURL(u url.URL, allowedQueryParams map[string]struct{}) string { return u.String() } +// getSanitizedURLString returns s with the query params of u redacted. +// if s doesn't contain u, then s is returned unchanged. +func getSanitizedURLString(s string, u *url.URL, allowedQueryParams map[string]struct{}) string { + if u.RawQuery == "" { + // the URL doesn't have any query params, so nothing to redact + return s + } + + urlIndex := strings.Index(strings.ToLower(s), strings.ToLower(u.String())) + if urlIndex < 0 { + // the URL isn't in the string, so nothing to redact + return s + } + + // replace the unsanitized URL in the error message with the sanitized version + sanitizedURL := getSanitizedURL(*u, allowedQueryParams) + s = s[:urlIndex] + sanitizedURL + s[urlIndex+len(u.String()):] + + return s +} + // writeRequestWithResponse appends a formatted HTTP request into a Buffer. If request and/or err are // not nil, then these are also written into the Buffer. func (p *logPolicy) writeRequestWithResponse(b *bytes.Buffer, req *policy.Request, resp *http.Response, err error) { @@ -171,7 +192,7 @@ func (p *logPolicy) writeRequestWithResponse(b *bytes.Buffer, req *policy.Reques } if err != nil { fmt.Fprintln(b, " --------------------------------------------------------------------------------") - fmt.Fprint(b, " ERROR:\n"+err.Error()+"\n") + fmt.Fprint(b, " ERROR:\n"+getSanitizedURLString(err.Error(), req.Raw().URL, p.allowedQP)+"\n") } } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/request.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/request.go index df7826b76..20d86496d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/request.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/request.go @@ -90,12 +90,16 @@ func JoinPaths(root string, paths ...string) string { } if qps != "" { - p = p + "?" + qps + if strings.Contains(p, "?") { + p = p + "&" + qps + } else { + p = p + "?" + qps + } } if strings.HasSuffix(root, "/") && strings.HasPrefix(p, "/") { root = root[:len(root)-1] - } else if !strings.HasSuffix(root, "/") && !strings.HasPrefix(p, "/") { + } else if !strings.HasSuffix(root, "/") && !strings.HasPrefix(p, "/") && !strings.HasPrefix(p, "?") { p = "/" + p } return root + p diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/CHANGELOG.md index 4a6349e16..ba360a30e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/CHANGELOG.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/CHANGELOG.md @@ -1,11 +1,61 @@ # Release History +## 1.14.0 (2026-06-15) + +### Breaking Changes + +> These changes affect only code written against a beta version such as v1.14.0-beta.3 +- Removed `WorkloadIdentityCredentialOptions.EnableAzureProxy`. + It will return in v1.15.0-beta.1 + +### Bugs Fixed + +- `AzureDeveloperCLICredential` improved reporting of error messages returned from `azd` + +### Other Changes + +- Returned `azidentity` errors include links to the troubleshooting guide when appropriate +- This module now requires a minimum Go version of 1.25 +- Upgraded dependencies + +## 1.14.0-beta.3 (2026-02-10) + +### Breaking Changes + +> These changes affect only code written against a beta version such as v1.14.0-beta.2 +- Renamed `WorkloadIdentityCredentialOptions.EnableAzureTokenProxy` to `EnableAzureProxy` + +### Other Changes + +- Removed extraneous JSON from `AzureDeveloperCLICredential` errors + +## 1.14.0-beta.2 (2025-11-10) + +### Breaking Changes + +> These changes affect only code written against a beta version such as v1.13.0-beta.1 +- `WorkloadIdentityCredential` identity binding mode is disabled by default. To enable it, set + `WorkloadIdentityCredentialOptions.EnableAzureTokenProxy` to `true` +- Removed identity binding mode support from `DefaultAzureCredential`. To use this feature, use + `WorkloadIdentityCredential` directly instead and set + `WorkloadIdentityCredentialOptions.EnableAzureTokenProxy` to `true` + +### Bugs Fixed + +- `AzureCLICredential` quoted arguments incorrectly on Windows + ## 1.13.1 (2025-11-10) ### Bugs Fixed - `AzureCLICredential` quoted arguments incorrectly on Windows +## 1.14.0-beta.1 (2025-10-07) + +### Features Added + +- Restored the `WorkloadIdentityCredential` identity binding mode support removed in v1.13.0 + ## 1.13.0 (2025-10-07) ### Features Added diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/TROUBLESHOOTING.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/TROUBLESHOOTING.md index 517006a42..c69664a84 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/TROUBLESHOOTING.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azidentity/TROUBLESHOOTING.md @@ -83,7 +83,7 @@ azlog.SetEvents(azidentity.EventAuthentication) | Error |Description| Mitigation | |---|---|---| -|"DefaultAzureCredential failed to acquire a token"|No credential in the `DefaultAzureCredential` chain provided a token|
client.Beta.Responses.New(ctx context.Context, params openai.BetaResponseNewParams) (\*openai.BetaResponse, error)
+- client.Beta.Responses.Get(ctx context.Context, responseID string, params openai.BetaResponseGetParams) (\*openai.BetaResponse, error)
+- client.Beta.Responses.Delete(ctx context.Context, responseID string, body openai.BetaResponseDeleteParams) error
+- client.Beta.Responses.Cancel(ctx context.Context, responseID string, body openai.BetaResponseCancelParams) (\*openai.BetaResponse, error)
+- client.Beta.Responses.Compact(ctx context.Context, params openai.BetaResponseCompactParams) (\*openai.BetaCompactedResponse, error)
+
+### InputItems
+
+Response Types:
+
+- openai.BetaResponseItemList
+
+Methods:
+
+- client.Beta.Responses.InputItems.List(ctx context.Context, responseID string, params openai.BetaResponseInputItemListParams) (\*pagination.CursorPage[openai.BetaResponseItemUnion], error)
+
+### InputTokens
+
+Response Types:
+
+- openai.BetaResponseInputTokenCountResponse
+
+Methods:
+
+- client.Beta.Responses.InputTokens.Count(ctx context.Context, params openai.BetaResponseInputTokenCountParams) (\*openai.BetaResponseInputTokenCountResponse, error)
+
## ChatKit
Response Types:
@@ -656,6 +897,421 @@ Methods:
- client.Uploads.Parts.New(ctx context.Context, uploadID string, body openai.UploadPartNewParams) (\*openai.UploadPart, error)
+# Admin
+
+## Organization
+
+### AuditLogs
+
+Response Types:
+
+- openai.AdminOrganizationAuditLogListResponse
+
+Methods:
+
+- client.Admin.Organization.AuditLogs.List(ctx context.Context, query openai.AdminOrganizationAuditLogListParams) (\*pagination.ConversationCursorPage[openai.AdminOrganizationAuditLogListResponse], error)
+
+### AdminAPIKeys
+
+Response Types:
+
+- openai.AdminAPIKey
+- openai.AdminOrganizationAdminAPIKeyNewResponse
+- openai.AdminOrganizationAdminAPIKeyDeleteResponse
+
+Methods:
+
+- client.Admin.Organization.AdminAPIKeys.New(ctx context.Context, body openai.AdminOrganizationAdminAPIKeyNewParams) (\*openai.AdminOrganizationAdminAPIKeyNewResponse, error)
+- client.Admin.Organization.AdminAPIKeys.Get(ctx context.Context, keyID string) (\*openai.AdminAPIKey, error)
+- client.Admin.Organization.AdminAPIKeys.List(ctx context.Context, query openai.AdminOrganizationAdminAPIKeyListParams) (\*pagination.CursorPage[openai.AdminAPIKey], error)
+- client.Admin.Organization.AdminAPIKeys.Delete(ctx context.Context, keyID string) (\*openai.AdminOrganizationAdminAPIKeyDeleteResponse, error)
+
+### Usage
+
+Response Types:
+
+- openai.AdminOrganizationUsageAudioSpeechesResponse
+- openai.AdminOrganizationUsageAudioTranscriptionsResponse
+- openai.AdminOrganizationUsageCodeInterpreterSessionsResponse
+- openai.AdminOrganizationUsageCompletionsResponse
+- openai.AdminOrganizationUsageCostsResponse
+- openai.AdminOrganizationUsageEmbeddingsResponse
+- openai.AdminOrganizationUsageFileSearchCallsResponse
+- openai.AdminOrganizationUsageImagesResponse
+- openai.AdminOrganizationUsageModerationsResponse
+- openai.AdminOrganizationUsageVectorStoresResponse
+- openai.AdminOrganizationUsageWebSearchCallsResponse
+
+Methods:
+
+- client.Admin.Organization.Usage.AudioSpeeches(ctx context.Context, query openai.AdminOrganizationUsageAudioSpeechesParams) (\*openai.AdminOrganizationUsageAudioSpeechesResponse, error)
+- client.Admin.Organization.Usage.AudioTranscriptions(ctx context.Context, query openai.AdminOrganizationUsageAudioTranscriptionsParams) (\*openai.AdminOrganizationUsageAudioTranscriptionsResponse, error)
+- client.Admin.Organization.Usage.CodeInterpreterSessions(ctx context.Context, query openai.AdminOrganizationUsageCodeInterpreterSessionsParams) (\*openai.AdminOrganizationUsageCodeInterpreterSessionsResponse, error)
+- client.Admin.Organization.Usage.Completions(ctx context.Context, query openai.AdminOrganizationUsageCompletionsParams) (\*openai.AdminOrganizationUsageCompletionsResponse, error)
+- client.Admin.Organization.Usage.Costs(ctx context.Context, query openai.AdminOrganizationUsageCostsParams) (\*openai.AdminOrganizationUsageCostsResponse, error)
+- client.Admin.Organization.Usage.Embeddings(ctx context.Context, query openai.AdminOrganizationUsageEmbeddingsParams) (\*openai.AdminOrganizationUsageEmbeddingsResponse, error)
+- client.Admin.Organization.Usage.FileSearchCalls(ctx context.Context, query openai.AdminOrganizationUsageFileSearchCallsParams) (\*openai.AdminOrganizationUsageFileSearchCallsResponse, error)
+- client.Admin.Organization.Usage.Images(ctx context.Context, query openai.AdminOrganizationUsageImagesParams) (\*openai.AdminOrganizationUsageImagesResponse, error)
+- client.Admin.Organization.Usage.Moderations(ctx context.Context, query openai.AdminOrganizationUsageModerationsParams) (\*openai.AdminOrganizationUsageModerationsResponse, error)
+- client.Admin.Organization.Usage.VectorStores(ctx context.Context, query openai.AdminOrganizationUsageVectorStoresParams) (\*openai.AdminOrganizationUsageVectorStoresResponse, error)
+- client.Admin.Organization.Usage.WebSearchCalls(ctx context.Context, query openai.AdminOrganizationUsageWebSearchCallsParams) (\*openai.AdminOrganizationUsageWebSearchCallsResponse, error)
+
+### Invites
+
+Response Types:
+
+- openai.Invite
+- openai.AdminOrganizationInviteDeleteResponse
+
+Methods:
+
+- client.Admin.Organization.Invites.New(ctx context.Context, body openai.AdminOrganizationInviteNewParams) (\*openai.Invite, error)
+- client.Admin.Organization.Invites.Get(ctx context.Context, inviteID string) (\*openai.Invite, error)
+- client.Admin.Organization.Invites.List(ctx context.Context, query openai.AdminOrganizationInviteListParams) (\*pagination.ConversationCursorPage[openai.Invite], error)
+- client.Admin.Organization.Invites.Delete(ctx context.Context, inviteID string) (\*openai.AdminOrganizationInviteDeleteResponse, error)
+
+### Users
+
+Response Types:
+
+- openai.OrganizationUser
+- openai.AdminOrganizationUserDeleteResponse
+
+Methods:
+
+- client.Admin.Organization.Users.Get(ctx context.Context, userID string) (\*openai.OrganizationUser, error)
+- client.Admin.Organization.Users.Update(ctx context.Context, userID string, body openai.AdminOrganizationUserUpdateParams) (\*openai.OrganizationUser, error)
+- client.Admin.Organization.Users.List(ctx context.Context, query openai.AdminOrganizationUserListParams) (\*pagination.ConversationCursorPage[openai.OrganizationUser], error)
+- client.Admin.Organization.Users.Delete(ctx context.Context, userID string) (\*openai.AdminOrganizationUserDeleteResponse, error)
+
+#### Roles
+
+Response Types:
+
+- openai.AdminOrganizationUserRoleNewResponse
+- openai.AdminOrganizationUserRoleGetResponse
+- openai.AdminOrganizationUserRoleListResponse
+- openai.AdminOrganizationUserRoleDeleteResponse
+
+Methods:
+
+- client.Admin.Organization.Users.Roles.New(ctx context.Context, userID string, body openai.AdminOrganizationUserRoleNewParams) (\*openai.AdminOrganizationUserRoleNewResponse, error)
+- client.Admin.Organization.Users.Roles.Get(ctx context.Context, userID string, roleID string) (\*openai.AdminOrganizationUserRoleGetResponse, error)
+- client.Admin.Organization.Users.Roles.List(ctx context.Context, userID string, query openai.AdminOrganizationUserRoleListParams) (\*pagination.NextCursorPage[openai.AdminOrganizationUserRoleListResponse], error)
+- client.Admin.Organization.Users.Roles.Delete(ctx context.Context, userID string, roleID string) (\*openai.AdminOrganizationUserRoleDeleteResponse, error)
+
+### Groups
+
+Response Types:
+
+- openai.Group
+- openai.AdminOrganizationGroupUpdateResponse
+- openai.AdminOrganizationGroupDeleteResponse
+
+Methods:
+
+- client.Admin.Organization.Groups.New(ctx context.Context, body openai.AdminOrganizationGroupNewParams) (\*openai.Group, error)
+- client.Admin.Organization.Groups.Get(ctx context.Context, groupID string) (\*openai.Group, error)
+- client.Admin.Organization.Groups.Update(ctx context.Context, groupID string, body openai.AdminOrganizationGroupUpdateParams) (\*openai.AdminOrganizationGroupUpdateResponse, error)
+- client.Admin.Organization.Groups.List(ctx context.Context, query openai.AdminOrganizationGroupListParams) (\*pagination.NextCursorPage[openai.Group], error)
+- client.Admin.Organization.Groups.Delete(ctx context.Context, groupID string) (\*openai.AdminOrganizationGroupDeleteResponse, error)
+
+#### Users
+
+Response Types:
+
+- openai.OrganizationGroupUser
+- openai.AdminOrganizationGroupUserNewResponse
+- openai.AdminOrganizationGroupUserGetResponse
+- openai.AdminOrganizationGroupUserDeleteResponse
+
+Methods:
+
+- client.Admin.Organization.Groups.Users.New(ctx context.Context, groupID string, body openai.AdminOrganizationGroupUserNewParams) (\*openai.AdminOrganizationGroupUserNewResponse, error)
+- client.Admin.Organization.Groups.Users.Get(ctx context.Context, groupID string, userID string) (\*openai.AdminOrganizationGroupUserGetResponse, error)
+- client.Admin.Organization.Groups.Users.List(ctx context.Context, groupID string, query openai.AdminOrganizationGroupUserListParams) (\*pagination.NextCursorPage[openai.OrganizationGroupUser], error)
+- client.Admin.Organization.Groups.Users.Delete(ctx context.Context, groupID string, userID string) (\*openai.AdminOrganizationGroupUserDeleteResponse, error)
+
+#### Roles
+
+Response Types:
+
+- openai.AdminOrganizationGroupRoleNewResponse
+- openai.AdminOrganizationGroupRoleGetResponse
+- openai.AdminOrganizationGroupRoleListResponse
+- openai.AdminOrganizationGroupRoleDeleteResponse
+
+Methods:
+
+- client.Admin.Organization.Groups.Roles.New(ctx context.Context, groupID string, body openai.AdminOrganizationGroupRoleNewParams) (\*openai.AdminOrganizationGroupRoleNewResponse, error)
+- client.Admin.Organization.Groups.Roles.Get(ctx context.Context, groupID string, roleID string) (\*openai.AdminOrganizationGroupRoleGetResponse, error)
+- client.Admin.Organization.Groups.Roles.List(ctx context.Context, groupID string, query openai.AdminOrganizationGroupRoleListParams) (\*pagination.NextCursorPage[openai.AdminOrganizationGroupRoleListResponse], error)
+- client.Admin.Organization.Groups.Roles.Delete(ctx context.Context, groupID string, roleID string) (\*openai.AdminOrganizationGroupRoleDeleteResponse, error)
+
+### Roles
+
+Response Types:
+
+- openai.Role
+- openai.AdminOrganizationRoleDeleteResponse
+
+Methods:
+
+- client.Admin.Organization.Roles.New(ctx context.Context, body openai.AdminOrganizationRoleNewParams) (\*openai.Role, error)
+- client.Admin.Organization.Roles.Get(ctx context.Context, roleID string) (\*openai.Role, error)
+- client.Admin.Organization.Roles.Update(ctx context.Context, roleID string, body openai.AdminOrganizationRoleUpdateParams) (\*openai.Role, error)
+- client.Admin.Organization.Roles.List(ctx context.Context, query openai.AdminOrganizationRoleListParams) (\*pagination.NextCursorPage[openai.Role], error)
+- client.Admin.Organization.Roles.Delete(ctx context.Context, roleID string) (\*openai.AdminOrganizationRoleDeleteResponse, error)
+
+### DataRetention
+
+Response Types:
+
+- openai.OrganizationDataRetention
+
+Methods:
+
+- client.Admin.Organization.DataRetention.Get(ctx context.Context) (\*openai.OrganizationDataRetention, error)
+- client.Admin.Organization.DataRetention.Update(ctx context.Context, body openai.AdminOrganizationDataRetentionUpdateParams) (\*openai.OrganizationDataRetention, error)
+
+### SpendAlerts
+
+Response Types:
+
+- openai.OrganizationSpendAlert
+- openai.OrganizationSpendAlertDeleted
+
+Methods:
+
+- client.Admin.Organization.SpendAlerts.New(ctx context.Context, body openai.AdminOrganizationSpendAlertNewParams) (\*openai.OrganizationSpendAlert, error)
+- client.Admin.Organization.SpendAlerts.Get(ctx context.Context, alertID string) (\*openai.OrganizationSpendAlert, error)
+- client.Admin.Organization.SpendAlerts.Update(ctx context.Context, alertID string, body openai.AdminOrganizationSpendAlertUpdateParams) (\*openai.OrganizationSpendAlert, error)
+- client.Admin.Organization.SpendAlerts.List(ctx context.Context, query openai.AdminOrganizationSpendAlertListParams) (\*pagination.ConversationCursorPage[openai.OrganizationSpendAlert], error)
+- client.Admin.Organization.SpendAlerts.Delete(ctx context.Context, alertID string) (\*openai.OrganizationSpendAlertDeleted, error)
+
+### Certificates
+
+Response Types:
+
+- openai.Certificate
+- openai.AdminOrganizationCertificateListResponse
+- openai.AdminOrganizationCertificateDeleteResponse
+- openai.AdminOrganizationCertificateActivateResponse
+- openai.AdminOrganizationCertificateDeactivateResponse
+
+Methods:
+
+- client.Admin.Organization.Certificates.New(ctx context.Context, body openai.AdminOrganizationCertificateNewParams) (\*openai.Certificate, error)
+- client.Admin.Organization.Certificates.Get(ctx context.Context, certificateID string, query openai.AdminOrganizationCertificateGetParams) (\*openai.Certificate, error)
+- client.Admin.Organization.Certificates.Update(ctx context.Context, certificateID string, body openai.AdminOrganizationCertificateUpdateParams) (\*openai.Certificate, error)
+- client.Admin.Organization.Certificates.List(ctx context.Context, query openai.AdminOrganizationCertificateListParams) (\*pagination.ConversationCursorPage[openai.AdminOrganizationCertificateListResponse], error)
+- client.Admin.Organization.Certificates.Delete(ctx context.Context, certificateID string) (\*openai.AdminOrganizationCertificateDeleteResponse, error)
+- client.Admin.Organization.Certificates.Activate(ctx context.Context, body openai.AdminOrganizationCertificateActivateParams) (\*pagination.Page[openai.AdminOrganizationCertificateActivateResponse], error)
+- client.Admin.Organization.Certificates.Deactivate(ctx context.Context, body openai.AdminOrganizationCertificateDeactivateParams) (\*pagination.Page[openai.AdminOrganizationCertificateDeactivateResponse], error)
+
+### Projects
+
+Response Types:
+
+- openai.Project
+
+Methods:
+
+- client.Admin.Organization.Projects.New(ctx context.Context, body openai.AdminOrganizationProjectNewParams) (\*openai.Project, error)
+- client.Admin.Organization.Projects.Get(ctx context.Context, projectID string) (\*openai.Project, error)
+- client.Admin.Organization.Projects.Update(ctx context.Context, projectID string, body openai.AdminOrganizationProjectUpdateParams) (\*openai.Project, error)
+- client.Admin.Organization.Projects.List(ctx context.Context, query openai.AdminOrganizationProjectListParams) (\*pagination.ConversationCursorPage[openai.Project], error)
+- client.Admin.Organization.Projects.Archive(ctx context.Context, projectID string) (\*openai.Project, error)
+
+#### Users
+
+Response Types:
+
+- openai.ProjectUser
+- openai.AdminOrganizationProjectUserDeleteResponse
+
+Methods:
+
+- client.Admin.Organization.Projects.Users.New(ctx context.Context, projectID string, body openai.AdminOrganizationProjectUserNewParams) (\*openai.ProjectUser, error)
+- client.Admin.Organization.Projects.Users.Get(ctx context.Context, projectID string, userID string) (\*openai.ProjectUser, error)
+- client.Admin.Organization.Projects.Users.Update(ctx context.Context, projectID string, userID string, body openai.AdminOrganizationProjectUserUpdateParams) (\*openai.ProjectUser, error)
+- client.Admin.Organization.Projects.Users.List(ctx context.Context, projectID string, query openai.AdminOrganizationProjectUserListParams) (\*pagination.ConversationCursorPage[openai.ProjectUser], error)
+- client.Admin.Organization.Projects.Users.Delete(ctx context.Context, projectID string, userID string) (\*openai.AdminOrganizationProjectUserDeleteResponse, error)
+
+##### Roles
+
+Response Types:
+
+- openai.AdminOrganizationProjectUserRoleNewResponse
+- openai.AdminOrganizationProjectUserRoleGetResponse
+- openai.AdminOrganizationProjectUserRoleListResponse
+- openai.AdminOrganizationProjectUserRoleDeleteResponse
+
+Methods:
+
+- client.Admin.Organization.Projects.Users.Roles.New(ctx context.Context, projectID string, userID string, body openai.AdminOrganizationProjectUserRoleNewParams) (\*openai.AdminOrganizationProjectUserRoleNewResponse, error)
+- client.Admin.Organization.Projects.Users.Roles.Get(ctx context.Context, projectID string, userID string, roleID string) (\*openai.AdminOrganizationProjectUserRoleGetResponse, error)
+- client.Admin.Organization.Projects.Users.Roles.List(ctx context.Context, projectID string, userID string, query openai.AdminOrganizationProjectUserRoleListParams) (\*pagination.NextCursorPage[openai.AdminOrganizationProjectUserRoleListResponse], error)
+- client.Admin.Organization.Projects.Users.Roles.Delete(ctx context.Context, projectID string, userID string, roleID string) (\*openai.AdminOrganizationProjectUserRoleDeleteResponse, error)
+
+#### ServiceAccounts
+
+Response Types:
+
+- openai.ProjectServiceAccount
+- openai.AdminOrganizationProjectServiceAccountNewResponse
+- openai.AdminOrganizationProjectServiceAccountDeleteResponse
+
+Methods:
+
+- client.Admin.Organization.Projects.ServiceAccounts.New(ctx context.Context, projectID string, body openai.AdminOrganizationProjectServiceAccountNewParams) (\*openai.AdminOrganizationProjectServiceAccountNewResponse, error)
+- client.Admin.Organization.Projects.ServiceAccounts.Get(ctx context.Context, projectID string, serviceAccountID string) (\*openai.ProjectServiceAccount, error)
+- client.Admin.Organization.Projects.ServiceAccounts.Update(ctx context.Context, projectID string, serviceAccountID string, body openai.AdminOrganizationProjectServiceAccountUpdateParams) (\*openai.ProjectServiceAccount, error)
+- client.Admin.Organization.Projects.ServiceAccounts.List(ctx context.Context, projectID string, query openai.AdminOrganizationProjectServiceAccountListParams) (\*pagination.ConversationCursorPage[openai.ProjectServiceAccount], error)
+- client.Admin.Organization.Projects.ServiceAccounts.Delete(ctx context.Context, projectID string, serviceAccountID string) (\*openai.AdminOrganizationProjectServiceAccountDeleteResponse, error)
+
+##### APIKeys
+
+Response Types:
+
+- openai.AdminOrganizationProjectServiceAccountAPIKeyNewResponse
+
+Methods:
+
+- client.Admin.Organization.Projects.ServiceAccounts.APIKeys.New(ctx context.Context, projectID string, serviceAccountID string, body openai.AdminOrganizationProjectServiceAccountAPIKeyNewParams) (\*openai.AdminOrganizationProjectServiceAccountAPIKeyNewResponse, error)
+
+#### APIKeys
+
+Response Types:
+
+- openai.ProjectAPIKey
+- openai.AdminOrganizationProjectAPIKeyDeleteResponse
+
+Methods:
+
+- client.Admin.Organization.Projects.APIKeys.Get(ctx context.Context, projectID string, apiKeyID string) (\*openai.ProjectAPIKey, error)
+- client.Admin.Organization.Projects.APIKeys.List(ctx context.Context, projectID string, query openai.AdminOrganizationProjectAPIKeyListParams) (\*pagination.ConversationCursorPage[openai.ProjectAPIKey], error)
+- client.Admin.Organization.Projects.APIKeys.Delete(ctx context.Context, projectID string, apiKeyID string) (\*openai.AdminOrganizationProjectAPIKeyDeleteResponse, error)
+
+#### RateLimits
+
+Response Types:
+
+- openai.ProjectRateLimit
+
+Methods:
+
+- client.Admin.Organization.Projects.RateLimits.ListRateLimits(ctx context.Context, projectID string, query openai.AdminOrganizationProjectRateLimitListRateLimitsParams) (\*pagination.ConversationCursorPage[openai.ProjectRateLimit], error)
+- client.Admin.Organization.Projects.RateLimits.UpdateRateLimit(ctx context.Context, projectID string, rateLimitID string, body openai.AdminOrganizationProjectRateLimitUpdateRateLimitParams) (\*openai.ProjectRateLimit, error)
+
+#### ModelPermissions
+
+Response Types:
+
+- openai.ProjectModelPermissions
+- openai.ProjectModelPermissionsDeleted
+
+Methods:
+
+- client.Admin.Organization.Projects.ModelPermissions.Get(ctx context.Context, projectID string) (\*openai.ProjectModelPermissions, error)
+- client.Admin.Organization.Projects.ModelPermissions.Update(ctx context.Context, projectID string, body openai.AdminOrganizationProjectModelPermissionUpdateParams) (\*openai.ProjectModelPermissions, error)
+- client.Admin.Organization.Projects.ModelPermissions.Delete(ctx context.Context, projectID string) (\*openai.ProjectModelPermissionsDeleted, error)
+
+#### HostedToolPermissions
+
+Response Types:
+
+- openai.ProjectHostedToolPermissions
+
+Methods:
+
+- client.Admin.Organization.Projects.HostedToolPermissions.Get(ctx context.Context, projectID string) (\*openai.ProjectHostedToolPermissions, error)
+- client.Admin.Organization.Projects.HostedToolPermissions.Update(ctx context.Context, projectID string, body openai.AdminOrganizationProjectHostedToolPermissionUpdateParams) (\*openai.ProjectHostedToolPermissions, error)
+
+#### Groups
+
+Response Types:
+
+- openai.ProjectGroup
+- openai.AdminOrganizationProjectGroupDeleteResponse
+
+Methods:
+
+- client.Admin.Organization.Projects.Groups.New(ctx context.Context, projectID string, body openai.AdminOrganizationProjectGroupNewParams) (\*openai.ProjectGroup, error)
+- client.Admin.Organization.Projects.Groups.Get(ctx context.Context, projectID string, groupID string, query openai.AdminOrganizationProjectGroupGetParams) (\*openai.ProjectGroup, error)
+- client.Admin.Organization.Projects.Groups.List(ctx context.Context, projectID string, query openai.AdminOrganizationProjectGroupListParams) (\*pagination.NextCursorPage[openai.ProjectGroup], error)
+- client.Admin.Organization.Projects.Groups.Delete(ctx context.Context, projectID string, groupID string) (\*openai.AdminOrganizationProjectGroupDeleteResponse, error)
+
+##### Roles
+
+Response Types:
+
+- openai.AdminOrganizationProjectGroupRoleNewResponse
+- openai.AdminOrganizationProjectGroupRoleGetResponse
+- openai.AdminOrganizationProjectGroupRoleListResponse
+- openai.AdminOrganizationProjectGroupRoleDeleteResponse
+
+Methods:
+
+- client.Admin.Organization.Projects.Groups.Roles.New(ctx context.Context, projectID string, groupID string, body openai.AdminOrganizationProjectGroupRoleNewParams) (\*openai.AdminOrganizationProjectGroupRoleNewResponse, error)
+- client.Admin.Organization.Projects.Groups.Roles.Get(ctx context.Context, projectID string, groupID string, roleID string) (\*openai.AdminOrganizationProjectGroupRoleGetResponse, error)
+- client.Admin.Organization.Projects.Groups.Roles.List(ctx context.Context, projectID string, groupID string, query openai.AdminOrganizationProjectGroupRoleListParams) (\*pagination.NextCursorPage[openai.AdminOrganizationProjectGroupRoleListResponse], error)
+- client.Admin.Organization.Projects.Groups.Roles.Delete(ctx context.Context, projectID string, groupID string, roleID string) (\*openai.AdminOrganizationProjectGroupRoleDeleteResponse, error)
+
+#### Roles
+
+Response Types:
+
+- openai.AdminOrganizationProjectRoleDeleteResponse
+
+Methods:
+
+- client.Admin.Organization.Projects.Roles.New(ctx context.Context, projectID string, body openai.AdminOrganizationProjectRoleNewParams) (\*openai.Role, error)
+- client.Admin.Organization.Projects.Roles.Get(ctx context.Context, projectID string, roleID string) (\*openai.Role, error)
+- client.Admin.Organization.Projects.Roles.Update(ctx context.Context, projectID string, roleID string, body openai.AdminOrganizationProjectRoleUpdateParams) (\*openai.Role, error)
+- client.Admin.Organization.Projects.Roles.List(ctx context.Context, projectID string, query openai.AdminOrganizationProjectRoleListParams) (\*pagination.NextCursorPage[openai.Role], error)
+- client.Admin.Organization.Projects.Roles.Delete(ctx context.Context, projectID string, roleID string) (\*openai.AdminOrganizationProjectRoleDeleteResponse, error)
+
+#### DataRetention
+
+Response Types:
+
+- openai.ProjectDataRetention
+
+Methods:
+
+- client.Admin.Organization.Projects.DataRetention.Get(ctx context.Context, projectID string) (\*openai.ProjectDataRetention, error)
+- client.Admin.Organization.Projects.DataRetention.Update(ctx context.Context, projectID string, body openai.AdminOrganizationProjectDataRetentionUpdateParams) (\*openai.ProjectDataRetention, error)
+
+#### SpendAlerts
+
+Response Types:
+
+- openai.ProjectSpendAlert
+- openai.ProjectSpendAlertDeleted
+
+Methods:
+
+- client.Admin.Organization.Projects.SpendAlerts.New(ctx context.Context, projectID string, body openai.AdminOrganizationProjectSpendAlertNewParams) (\*openai.ProjectSpendAlert, error)
+- client.Admin.Organization.Projects.SpendAlerts.Get(ctx context.Context, projectID string, alertID string) (\*openai.ProjectSpendAlert, error)
+- client.Admin.Organization.Projects.SpendAlerts.Update(ctx context.Context, projectID string, alertID string, body openai.AdminOrganizationProjectSpendAlertUpdateParams) (\*openai.ProjectSpendAlert, error)
+- client.Admin.Organization.Projects.SpendAlerts.List(ctx context.Context, projectID string, query openai.AdminOrganizationProjectSpendAlertListParams) (\*pagination.ConversationCursorPage[openai.ProjectSpendAlert], error)
+- client.Admin.Organization.Projects.SpendAlerts.Delete(ctx context.Context, projectID string, alertID string) (\*openai.ProjectSpendAlertDeleted, error)
+
+#### Certificates
+
+Response Types:
+
+- openai.AdminOrganizationProjectCertificateListResponse
+- openai.AdminOrganizationProjectCertificateActivateResponse
+- openai.AdminOrganizationProjectCertificateDeactivateResponse
+
+Methods:
+
+- client.Admin.Organization.Projects.Certificates.List(ctx context.Context, projectID string, query openai.AdminOrganizationProjectCertificateListParams) (\*pagination.ConversationCursorPage[openai.AdminOrganizationProjectCertificateListResponse], error)
+- client.Admin.Organization.Projects.Certificates.Activate(ctx context.Context, projectID string, body openai.AdminOrganizationProjectCertificateActivateParams) (\*pagination.Page[openai.AdminOrganizationProjectCertificateActivateResponse], error)
+- client.Admin.Organization.Projects.Certificates.Deactivate(ctx context.Context, projectID string, body openai.AdminOrganizationProjectCertificateDeactivateParams) (\*pagination.Page[openai.AdminOrganizationProjectCertificateDeactivateResponse], error)
+
# [Responses](responses/api.md)
# [Realtime](realtime/api.md)
diff --git a/vendor/github.com/openai/openai-go/v3/audiospeech.go b/vendor/github.com/openai/openai-go/v3/audiospeech.go
index 1318beb5c..9adce1ec5 100644
--- a/vendor/github.com/openai/openai-go/v3/audiospeech.go
+++ b/vendor/github.com/openai/openai-go/v3/audiospeech.go
@@ -38,7 +38,8 @@ func NewAudioSpeechService(opts ...option.RequestOption) (r AudioSpeechService)
//
// Returns the audio file content, or a stream of audio events.
func (r *AudioSpeechService) New(ctx context.Context, body AudioSpeechNewParams, opts ...option.RequestOption) (res *http.Response, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "application/octet-stream")}, opts...)
path := "audio/speech"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
diff --git a/vendor/github.com/openai/openai-go/v3/audiotranscription.go b/vendor/github.com/openai/openai-go/v3/audiotranscription.go
index 15da5e18b..f3e908b6c 100644
--- a/vendor/github.com/openai/openai-go/v3/audiotranscription.go
+++ b/vendor/github.com/openai/openai-go/v3/audiotranscription.go
@@ -47,7 +47,8 @@ func NewAudioTranscriptionService(opts ...option.RequestOption) (r AudioTranscri
// Returns a transcription object in `json`, `diarized_json`, or `verbose_json`
// format, or a stream of transcript events.
func (r *AudioTranscriptionService) New(ctx context.Context, body AudioTranscriptionNewParams, opts ...option.RequestOption) (res *AudioTranscriptionNewResponseUnion, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "audio/transcriptions"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -62,7 +63,8 @@ func (r *AudioTranscriptionService) NewStreaming(ctx context.Context, body Audio
raw *http.Response
err error
)
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
body.SetExtraFields(map[string]any{
"stream": "true",
})
diff --git a/vendor/github.com/openai/openai-go/v3/audiotranslation.go b/vendor/github.com/openai/openai-go/v3/audiotranslation.go
index b5039ceef..e9053e04a 100644
--- a/vendor/github.com/openai/openai-go/v3/audiotranslation.go
+++ b/vendor/github.com/openai/openai-go/v3/audiotranslation.go
@@ -41,7 +41,8 @@ func NewAudioTranslationService(opts ...option.RequestOption) (r AudioTranslatio
// Translates audio into English.
func (r *AudioTranslationService) New(ctx context.Context, body AudioTranslationNewParams, opts ...option.RequestOption) (res *Translation, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "audio/translations"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
diff --git a/vendor/github.com/openai/openai-go/v3/auth/workloadidentity.go b/vendor/github.com/openai/openai-go/v3/auth/workloadidentity.go
index 68ef70104..3166be308 100644
--- a/vendor/github.com/openai/openai-go/v3/auth/workloadidentity.go
+++ b/vendor/github.com/openai/openai-go/v3/auth/workloadidentity.go
@@ -22,7 +22,6 @@ const (
TokenExchangeURL = "https://auth.openai.com/oauth/token"
)
-
type WorkloadIdentityAuth struct {
config WorkloadIdentity
@@ -47,7 +46,7 @@ type tokenRefreshState struct {
type tokenExchangeRequest struct {
GrantType string `json:"grant_type"`
- ClientID string `json:"client_id"`
+ ClientID string `json:"client_id,omitempty"`
SubjectToken string `json:"subject_token"`
SubjectTokenType string `json:"subject_token_type"`
IdentityProviderID string `json:"identity_provider_id"`
@@ -55,9 +54,6 @@ type tokenExchangeRequest struct {
}
func NewWorkloadIdentityAuth(config WorkloadIdentity) (*WorkloadIdentityAuth, error) {
- if config.ClientID == "" {
- return nil, fmt.Errorf("WorkloadIdentity: ClientID is required")
- }
if config.IdentityProviderID == "" {
return nil, fmt.Errorf("WorkloadIdentity: IdentityProviderID is required")
}
diff --git a/vendor/github.com/openai/openai-go/v3/batch.go b/vendor/github.com/openai/openai-go/v3/batch.go
index 0b4a8bc46..a0054c361 100644
--- a/vendor/github.com/openai/openai-go/v3/batch.go
+++ b/vendor/github.com/openai/openai-go/v3/batch.go
@@ -5,7 +5,6 @@ package openai
import (
"context"
"errors"
- "fmt"
"net/http"
"net/url"
"slices"
@@ -44,7 +43,8 @@ func NewBatchService(opts ...option.RequestOption) (r BatchService) {
// Creates and executes a batch from an uploaded file of requests
func (r *BatchService) New(ctx context.Context, body BatchNewParams, opts ...option.RequestOption) (res *Batch, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "batches"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -52,12 +52,13 @@ func (r *BatchService) New(ctx context.Context, body BatchNewParams, opts ...opt
// Retrieves a batch.
func (r *BatchService) Get(ctx context.Context, batchID string, opts ...option.RequestOption) (res *Batch, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if batchID == "" {
err = errors.New("missing required batch_id parameter")
return nil, err
}
- path := fmt.Sprintf("batches/%s", batchID)
+ path := requestconfig.FormatPath("batches/%s", batchID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
@@ -65,7 +66,8 @@ func (r *BatchService) Get(ctx context.Context, batchID string, opts ...option.R
// List your organization's batches.
func (r *BatchService) List(ctx context.Context, query BatchListParams, opts ...option.RequestOption) (res *pagination.CursorPage[Batch], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "batches"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
@@ -89,12 +91,13 @@ func (r *BatchService) ListAutoPaging(ctx context.Context, query BatchListParams
// 10 minutes, before changing to `cancelled`, where it will have partial results
// (if any) available in the output file.
func (r *BatchService) Cancel(ctx context.Context, batchID string, opts ...option.RequestOption) (res *Batch, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if batchID == "" {
err = errors.New("missing required batch_id parameter")
return nil, err
}
- path := fmt.Sprintf("batches/%s/cancel", batchID)
+ path := requestconfig.FormatPath("batches/%s/cancel", batchID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
return res, err
}
@@ -104,7 +107,7 @@ type Batch struct {
// The time frame within which the batch should be processed.
CompletionWindow string `json:"completion_window" api:"required"`
// The Unix timestamp (in seconds) for when the batch was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The OpenAI API endpoint used by the batch.
Endpoint string `json:"endpoint" api:"required"`
// The ID of the input file for the batch.
@@ -117,24 +120,24 @@ type Batch struct {
// "expired", "cancelling", "cancelled".
Status BatchStatus `json:"status" api:"required"`
// The Unix timestamp (in seconds) for when the batch was cancelled.
- CancelledAt int64 `json:"cancelled_at"`
+ CancelledAt int64 `json:"cancelled_at" format:"unixtime"`
// The Unix timestamp (in seconds) for when the batch started cancelling.
- CancellingAt int64 `json:"cancelling_at"`
+ CancellingAt int64 `json:"cancelling_at" format:"unixtime"`
// The Unix timestamp (in seconds) for when the batch was completed.
- CompletedAt int64 `json:"completed_at"`
+ CompletedAt int64 `json:"completed_at" format:"unixtime"`
// The ID of the file containing the outputs of requests with errors.
ErrorFileID string `json:"error_file_id"`
Errors BatchErrors `json:"errors"`
// The Unix timestamp (in seconds) for when the batch expired.
- ExpiredAt int64 `json:"expired_at"`
+ ExpiredAt int64 `json:"expired_at" format:"unixtime"`
// The Unix timestamp (in seconds) for when the batch will expire.
- ExpiresAt int64 `json:"expires_at"`
+ ExpiresAt int64 `json:"expires_at" format:"unixtime"`
// The Unix timestamp (in seconds) for when the batch failed.
- FailedAt int64 `json:"failed_at"`
+ FailedAt int64 `json:"failed_at" format:"unixtime"`
// The Unix timestamp (in seconds) for when the batch started finalizing.
- FinalizingAt int64 `json:"finalizing_at"`
+ FinalizingAt int64 `json:"finalizing_at" format:"unixtime"`
// The Unix timestamp (in seconds) for when the batch started processing.
- InProgressAt int64 `json:"in_progress_at"`
+ InProgressAt int64 `json:"in_progress_at" format:"unixtime"`
// Set of 16 key-value pairs that can be attached to an object. This can be useful
// for storing additional information about the object in a structured format, and
// querying for objects via API or the dashboard.
diff --git a/vendor/github.com/openai/openai-go/v3/beta.go b/vendor/github.com/openai/openai-go/v3/beta.go
index 1d240d7f7..6d38af533 100644
--- a/vendor/github.com/openai/openai-go/v3/beta.go
+++ b/vendor/github.com/openai/openai-go/v3/beta.go
@@ -13,8 +13,9 @@ import (
// automatically. You should not instantiate this service directly, and instead use
// the [NewBetaService] method instead.
type BetaService struct {
- Options []option.RequestOption
- ChatKit BetaChatKitService
+ Options []option.RequestOption
+ Responses BetaResponseService
+ ChatKit BetaChatKitService
// Build Assistants that can call models and use tools.
Assistants BetaAssistantService
// Build Assistants that can call models and use tools.
@@ -29,6 +30,7 @@ type BetaService struct {
func NewBetaService(opts ...option.RequestOption) (r BetaService) {
r = BetaService{}
r.Options = opts
+ r.Responses = NewBetaResponseService(opts...)
r.ChatKit = NewBetaChatKitService(opts...)
r.Assistants = NewBetaAssistantService(opts...)
r.Threads = NewBetaThreadService(opts...)
diff --git a/vendor/github.com/openai/openai-go/v3/betaassistant.go b/vendor/github.com/openai/openai-go/v3/betaassistant.go
index a36f36eb6..63b997cfe 100644
--- a/vendor/github.com/openai/openai-go/v3/betaassistant.go
+++ b/vendor/github.com/openai/openai-go/v3/betaassistant.go
@@ -6,7 +6,6 @@ import (
"context"
"encoding/json"
"errors"
- "fmt"
"net/http"
"net/url"
"slices"
@@ -47,7 +46,8 @@ func NewBetaAssistantService(opts ...option.RequestOption) (r BetaAssistantServi
//
// Deprecated: deprecated
func (r *BetaAssistantService) New(ctx context.Context, body BetaAssistantNewParams, opts ...option.RequestOption) (res *Assistant, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
path := "assistants"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
@@ -58,13 +58,14 @@ func (r *BetaAssistantService) New(ctx context.Context, body BetaAssistantNewPar
//
// Deprecated: deprecated
func (r *BetaAssistantService) Get(ctx context.Context, assistantID string, opts ...option.RequestOption) (res *Assistant, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if assistantID == "" {
err = errors.New("missing required assistant_id parameter")
return nil, err
}
- path := fmt.Sprintf("assistants/%s", assistantID)
+ path := requestconfig.FormatPath("assistants/%s", assistantID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
@@ -73,13 +74,14 @@ func (r *BetaAssistantService) Get(ctx context.Context, assistantID string, opts
//
// Deprecated: deprecated
func (r *BetaAssistantService) Update(ctx context.Context, assistantID string, body BetaAssistantUpdateParams, opts ...option.RequestOption) (res *Assistant, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if assistantID == "" {
err = errors.New("missing required assistant_id parameter")
return nil, err
}
- path := fmt.Sprintf("assistants/%s", assistantID)
+ path := requestconfig.FormatPath("assistants/%s", assistantID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
@@ -89,7 +91,8 @@ func (r *BetaAssistantService) Update(ctx context.Context, assistantID string, b
// Deprecated: deprecated
func (r *BetaAssistantService) List(ctx context.Context, query BetaAssistantListParams, opts ...option.RequestOption) (res *pagination.CursorPage[Assistant], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2"), option.WithResponseInto(&raw)}, opts...)
path := "assistants"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
@@ -115,13 +118,14 @@ func (r *BetaAssistantService) ListAutoPaging(ctx context.Context, query BetaAss
//
// Deprecated: deprecated
func (r *BetaAssistantService) Delete(ctx context.Context, assistantID string, opts ...option.RequestOption) (res *AssistantDeleted, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if assistantID == "" {
err = errors.New("missing required assistant_id parameter")
return nil, err
}
- path := fmt.Sprintf("assistants/%s", assistantID)
+ path := requestconfig.FormatPath("assistants/%s", assistantID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
return res, err
}
@@ -133,7 +137,7 @@ type Assistant struct {
// The identifier, which can be referenced in API endpoints.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) for when the assistant was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The description of the assistant. The maximum length is 512 characters.
Description string `json:"description" api:"required"`
// The system instructions that the assistant uses. The maximum length is 256,000
@@ -1797,21 +1801,14 @@ type BetaAssistantNewParams struct {
// Keys are strings with a maximum length of 64 characters. Values are strings with
// a maximum length of 512 characters.
Metadata shared.Metadata `json:"metadata,omitzero"`
- // Constrains effort on reasoning for
- // [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
- // supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`.
- // Reducing reasoning effort can result in faster responses and fewer tokens used
- // on reasoning in a response.
+ // Constrains effort on reasoning for reasoning models. Currently supported values
+ // are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. Reducing
+ // reasoning effort can result in faster responses and fewer tokens used on
+ // reasoning in a response. Not all reasoning models support every value. See the
+ // [reasoning guide](https://platform.openai.com/docs/guides/reasoning) for
+ // model-specific support.
//
- // - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported
- // reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool
- // calls are supported for all reasoning values in gpt-5.1.
- // - All models before `gpt-5.1` default to `medium` reasoning effort, and do not
- // support `none`.
- // - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
- // - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
- //
- // Any of "none", "minimal", "low", "medium", "high", "xhigh".
+ // Any of "none", "minimal", "low", "medium", "high", "xhigh", "max".
ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"`
// A set of resources that are used by the assistant's tools. The resources are
// specific to the type of tool. For example, the `code_interpreter` tool requires
@@ -2076,21 +2073,14 @@ type BetaAssistantUpdateParams struct {
// Keys are strings with a maximum length of 64 characters. Values are strings with
// a maximum length of 512 characters.
Metadata shared.Metadata `json:"metadata,omitzero"`
- // Constrains effort on reasoning for
- // [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
- // supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`.
- // Reducing reasoning effort can result in faster responses and fewer tokens used
- // on reasoning in a response.
- //
- // - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported
- // reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool
- // calls are supported for all reasoning values in gpt-5.1.
- // - All models before `gpt-5.1` default to `medium` reasoning effort, and do not
- // support `none`.
- // - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
- // - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
+ // Constrains effort on reasoning for reasoning models. Currently supported values
+ // are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. Reducing
+ // reasoning effort can result in faster responses and fewer tokens used on
+ // reasoning in a response. Not all reasoning models support every value. See the
+ // [reasoning guide](https://platform.openai.com/docs/guides/reasoning) for
+ // model-specific support.
//
- // Any of "none", "minimal", "low", "medium", "high", "xhigh".
+ // Any of "none", "minimal", "low", "medium", "high", "xhigh", "max".
ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"`
// A set of resources that are used by the assistant's tools. The resources are
// specific to the type of tool. For example, the `code_interpreter` tool requires
diff --git a/vendor/github.com/openai/openai-go/v3/betachatkitsession.go b/vendor/github.com/openai/openai-go/v3/betachatkitsession.go
index 9fe1b8426..188b5e136 100644
--- a/vendor/github.com/openai/openai-go/v3/betachatkitsession.go
+++ b/vendor/github.com/openai/openai-go/v3/betachatkitsession.go
@@ -5,7 +5,6 @@ package openai
import (
"context"
"errors"
- "fmt"
"net/http"
"slices"
@@ -36,7 +35,8 @@ func NewBetaChatKitSessionService(opts ...option.RequestOption) (r BetaChatKitSe
// Create a ChatKit session.
func (r *BetaChatKitSessionService) New(ctx context.Context, body BetaChatKitSessionNewParams, opts ...option.RequestOption) (res *ChatSession, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "chatkit_beta=v1")}, opts...)
path := "chatkit/sessions"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
@@ -47,13 +47,14 @@ func (r *BetaChatKitSessionService) New(ctx context.Context, body BetaChatKitSes
//
// Cancelling prevents new requests from using the issued client secret.
func (r *BetaChatKitSessionService) Cancel(ctx context.Context, sessionID string, opts ...option.RequestOption) (res *ChatSession, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "chatkit_beta=v1")}, opts...)
if sessionID == "" {
err = errors.New("missing required session_id parameter")
return nil, err
}
- path := fmt.Sprintf("chatkit/sessions/%s/cancel", sessionID)
+ path := requestconfig.FormatPath("chatkit/sessions/%s/cancel", sessionID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
return res, err
}
diff --git a/vendor/github.com/openai/openai-go/v3/betachatkitthread.go b/vendor/github.com/openai/openai-go/v3/betachatkitthread.go
index d81ab730a..72ee9a189 100644
--- a/vendor/github.com/openai/openai-go/v3/betachatkitthread.go
+++ b/vendor/github.com/openai/openai-go/v3/betachatkitthread.go
@@ -6,7 +6,6 @@ import (
"context"
"encoding/json"
"errors"
- "fmt"
"net/http"
"net/url"
"slices"
@@ -42,13 +41,14 @@ func NewBetaChatKitThreadService(opts ...option.RequestOption) (r BetaChatKitThr
// Retrieve a ChatKit thread by its identifier.
func (r *BetaChatKitThreadService) Get(ctx context.Context, threadID string, opts ...option.RequestOption) (res *ChatKitThread, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "chatkit_beta=v1")}, opts...)
if threadID == "" {
err = errors.New("missing required thread_id parameter")
return nil, err
}
- path := fmt.Sprintf("chatkit/threads/%s", threadID)
+ path := requestconfig.FormatPath("chatkit/threads/%s", threadID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
@@ -56,7 +56,8 @@ func (r *BetaChatKitThreadService) Get(ctx context.Context, threadID string, opt
// List ChatKit threads with optional pagination and user filters.
func (r *BetaChatKitThreadService) List(ctx context.Context, query BetaChatKitThreadListParams, opts ...option.RequestOption) (res *pagination.ConversationCursorPage[ChatKitThread], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "chatkit_beta=v1"), option.WithResponseInto(&raw)}, opts...)
path := "chatkit/threads"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
@@ -78,13 +79,14 @@ func (r *BetaChatKitThreadService) ListAutoPaging(ctx context.Context, query Bet
// Delete a ChatKit thread along with its items and stored attachments.
func (r *BetaChatKitThreadService) Delete(ctx context.Context, threadID string, opts ...option.RequestOption) (res *BetaChatKitThreadDeleteResponse, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "chatkit_beta=v1")}, opts...)
if threadID == "" {
err = errors.New("missing required thread_id parameter")
return nil, err
}
- path := fmt.Sprintf("chatkit/threads/%s", threadID)
+ path := requestconfig.FormatPath("chatkit/threads/%s", threadID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
return res, err
}
@@ -92,13 +94,14 @@ func (r *BetaChatKitThreadService) Delete(ctx context.Context, threadID string,
// List items that belong to a ChatKit thread.
func (r *BetaChatKitThreadService) ListItems(ctx context.Context, threadID string, query BetaChatKitThreadListItemsParams, opts ...option.RequestOption) (res *pagination.ConversationCursorPage[ChatKitThreadItemListDataUnion], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "chatkit_beta=v1"), option.WithResponseInto(&raw)}, opts...)
if threadID == "" {
err = errors.New("missing required thread_id parameter")
return nil, err
}
- path := fmt.Sprintf("chatkit/threads/%s/items", threadID)
+ path := requestconfig.FormatPath("chatkit/threads/%s/items", threadID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
@@ -125,7 +128,7 @@ type ChatSession struct {
// Ephemeral client secret that authenticates session requests.
ClientSecret string `json:"client_secret" api:"required"`
// Unix timestamp (in seconds) for when the session expires.
- ExpiresAt int64 `json:"expires_at" api:"required"`
+ ExpiresAt int64 `json:"expires_at" api:"required" format:"unixtime"`
// Convenience copy of the per-minute request limit.
MaxRequestsPer1Minute int64 `json:"max_requests_per_1_minute" api:"required"`
// Type discriminator that is always `chatkit.session`.
@@ -469,7 +472,7 @@ type ChatKitAttachment struct {
// Original display name for the attachment.
Name string `json:"name" api:"required"`
// Preview URL for rendering the attachment inline.
- PreviewURL string `json:"preview_url" api:"required"`
+ PreviewURL string `json:"preview_url" api:"required" format:"uri"`
// Attachment discriminator.
//
// Any of "image", "file".
@@ -683,7 +686,7 @@ type ChatKitResponseOutputTextAnnotationURLSource struct {
// Type discriminator that is always `url`.
Type constant.URL `json:"type" default:"url"`
// URL referenced by the annotation.
- URL string `json:"url" api:"required"`
+ URL string `json:"url" api:"required" format:"uri"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
@@ -704,7 +707,7 @@ type ChatKitThread struct {
// Identifier of the thread.
ID string `json:"id" api:"required"`
// Unix timestamp (in seconds) for when the thread was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Type discriminator that is always `chatkit.thread`.
Object constant.ChatKitThread `json:"object" default:"chatkit.thread"`
// Current status for the thread. Defaults to `active` for newly created threads.
@@ -872,7 +875,7 @@ type ChatKitThreadAssistantMessageItem struct {
// Ordered assistant response segments.
Content []ChatKitResponseOutputText `json:"content" api:"required"`
// Unix timestamp (in seconds) for when the item was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Type discriminator that is always `chatkit.thread_item`.
Object constant.ChatKitThreadItem `json:"object" default:"chatkit.thread_item"`
// Identifier of the parent thread.
@@ -1114,7 +1117,7 @@ type ChatKitThreadItemListDataChatKitClientToolCall struct {
// Identifier for the client tool call.
CallID string `json:"call_id" api:"required"`
// Unix timestamp (in seconds) for when the item was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Tool name that was invoked.
Name string `json:"name" api:"required"`
// Type discriminator that is always `chatkit.thread_item`.
@@ -1158,7 +1161,7 @@ type ChatKitThreadItemListDataChatKitTask struct {
// Identifier of the thread item.
ID string `json:"id" api:"required"`
// Unix timestamp (in seconds) for when the item was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Optional heading for the task. Defaults to null when not provided.
Heading string `json:"heading" api:"required"`
// Type discriminator that is always `chatkit.thread_item`.
@@ -1199,7 +1202,7 @@ type ChatKitThreadItemListDataChatKitTaskGroup struct {
// Identifier of the thread item.
ID string `json:"id" api:"required"`
// Unix timestamp (in seconds) for when the item was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Type discriminator that is always `chatkit.thread_item`.
Object constant.ChatKitThreadItem `json:"object" default:"chatkit.thread_item"`
// Tasks included in the group.
@@ -1262,7 +1265,7 @@ type ChatKitThreadUserMessageItem struct {
// Ordered content elements supplied by the user.
Content []ChatKitThreadUserMessageItemContentUnion `json:"content" api:"required"`
// Unix timestamp (in seconds) for when the item was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Inference overrides applied to the message. Defaults to null when unset.
InferenceOptions ChatKitThreadUserMessageItemInferenceOptions `json:"inference_options" api:"required"`
// Type discriminator that is always `chatkit.thread_item`.
@@ -1442,7 +1445,7 @@ type ChatKitWidgetItem struct {
// Identifier of the thread item.
ID string `json:"id" api:"required"`
// Unix timestamp (in seconds) for when the item was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Type discriminator that is always `chatkit.thread_item`.
Object constant.ChatKitThreadItem `json:"object" default:"chatkit.thread_item"`
// Identifier of the parent thread.
diff --git a/vendor/github.com/openai/openai-go/v3/betaresponse.go b/vendor/github.com/openai/openai-go/v3/betaresponse.go
new file mode 100644
index 000000000..2ae945b9e
--- /dev/null
+++ b/vendor/github.com/openai/openai-go/v3/betaresponse.go
@@ -0,0 +1,32641 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package openai
+
+import (
+ "context"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "net/http"
+ "net/url"
+ "slices"
+
+ "github.com/openai/openai-go/v3/internal/apijson"
+ "github.com/openai/openai-go/v3/internal/apiquery"
+ "github.com/openai/openai-go/v3/internal/paramutil"
+ "github.com/openai/openai-go/v3/internal/requestconfig"
+ "github.com/openai/openai-go/v3/option"
+ "github.com/openai/openai-go/v3/packages/param"
+ "github.com/openai/openai-go/v3/packages/respjson"
+ "github.com/openai/openai-go/v3/packages/ssestream"
+ "github.com/openai/openai-go/v3/shared/constant"
+)
+
+// BetaResponseService contains methods and other services that help with
+// interacting with the openai API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewBetaResponseService] method instead.
+type BetaResponseService struct {
+ Options []option.RequestOption
+ InputItems BetaResponseInputItemService
+ InputTokens BetaResponseInputTokenService
+}
+
+// NewBetaResponseService generates a new service that applies the given options to
+// each request. These options are applied after the parent client's options (if
+// there is one), and before any request-specific options.
+func NewBetaResponseService(opts ...option.RequestOption) (r BetaResponseService) {
+ r = BetaResponseService{}
+ r.Options = opts
+ r.InputItems = NewBetaResponseInputItemService(opts...)
+ r.InputTokens = NewBetaResponseInputTokenService(opts...)
+ return
+}
+
+// Creates a model response. Provide
+// [text](https://platform.openai.com/docs/guides/text) or
+// [image](https://platform.openai.com/docs/guides/images) inputs to generate
+// [text](https://platform.openai.com/docs/guides/text) or
+// [JSON](https://platform.openai.com/docs/guides/structured-outputs) outputs. Have
+// the model call your own
+// [custom code](https://platform.openai.com/docs/guides/function-calling) or use
+// built-in [tools](https://platform.openai.com/docs/guides/tools) like
+// [web search](https://platform.openai.com/docs/guides/tools-web-search) or
+// [file search](https://platform.openai.com/docs/guides/tools-file-search) to use
+// your own data as input for the model's response.
+func (r *BetaResponseService) New(ctx context.Context, params BetaResponseNewParams, opts ...option.RequestOption) (res *BetaResponse, err error) {
+ for _, v := range params.Betas {
+ opts = append(opts, option.WithHeaderAdd("openai-beta", fmt.Sprintf("%v", v)))
+ }
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
+ path := "responses?beta=true"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
+ return res, err
+}
+
+// Creates a model response. Provide
+// [text](https://platform.openai.com/docs/guides/text) or
+// [image](https://platform.openai.com/docs/guides/images) inputs to generate
+// [text](https://platform.openai.com/docs/guides/text) or
+// [JSON](https://platform.openai.com/docs/guides/structured-outputs) outputs. Have
+// the model call your own
+// [custom code](https://platform.openai.com/docs/guides/function-calling) or use
+// built-in [tools](https://platform.openai.com/docs/guides/tools) like
+// [web search](https://platform.openai.com/docs/guides/tools-web-search) or
+// [file search](https://platform.openai.com/docs/guides/tools-file-search) to use
+// your own data as input for the model's response.
+func (r *BetaResponseService) NewStreaming(ctx context.Context, params BetaResponseNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[BetaResponseStreamEventUnion]) {
+ var (
+ raw *http.Response
+ err error
+ )
+ for _, v := range params.Betas {
+ opts = append(opts, option.WithHeaderAdd("openai-beta", fmt.Sprintf("%v", v)))
+ }
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
+ opts = append(opts, option.WithJSONSet("stream", true))
+ path := "responses?beta=true"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &raw, opts...)
+ return ssestream.NewStream[BetaResponseStreamEventUnion](ssestream.NewDecoder(raw), err)
+}
+
+// Retrieves a model response with the given ID.
+func (r *BetaResponseService) Get(ctx context.Context, responseID string, params BetaResponseGetParams, opts ...option.RequestOption) (res *BetaResponse, err error) {
+ for _, v := range params.Betas {
+ opts = append(opts, option.WithHeaderAdd("openai-beta", fmt.Sprintf("%v", v)))
+ }
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
+ if responseID == "" {
+ err = errors.New("missing required response_id parameter")
+ return nil, err
+ }
+ path := requestconfig.FormatPath("responses/%s?beta=true", responseID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &res, opts...)
+ return res, err
+}
+
+// Retrieves a model response with the given ID.
+func (r *BetaResponseService) GetStreaming(ctx context.Context, responseID string, params BetaResponseGetParams, opts ...option.RequestOption) (stream *ssestream.Stream[BetaResponseStreamEventUnion]) {
+ var (
+ raw *http.Response
+ err error
+ )
+ for _, v := range params.Betas {
+ opts = append(opts, option.WithHeaderAdd("openai-beta", fmt.Sprintf("%v", v)))
+ }
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
+ opts = append(opts, option.WithJSONSet("stream", true))
+ if responseID == "" {
+ err = errors.New("missing required response_id parameter")
+ return ssestream.NewStream[BetaResponseStreamEventUnion](nil, err)
+ }
+ path := requestconfig.FormatPath("responses/%s?beta=true", responseID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &raw, opts...)
+ return ssestream.NewStream[BetaResponseStreamEventUnion](ssestream.NewDecoder(raw), err)
+}
+
+// Deletes a model response with the given ID.
+func (r *BetaResponseService) Delete(ctx context.Context, responseID string, body BetaResponseDeleteParams, opts ...option.RequestOption) (err error) {
+ for _, v := range body.Betas {
+ opts = append(opts, option.WithHeaderAdd("openai-beta", fmt.Sprintf("%v", v)))
+ }
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
+ opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...)
+ if responseID == "" {
+ err = errors.New("missing required response_id parameter")
+ return err
+ }
+ path := requestconfig.FormatPath("responses/%s?beta=true", responseID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...)
+ return err
+}
+
+// Cancels a model response with the given ID. Only responses created with the
+// `background` parameter set to `true` can be cancelled.
+// [Learn more](https://platform.openai.com/docs/guides/background).
+func (r *BetaResponseService) Cancel(ctx context.Context, responseID string, body BetaResponseCancelParams, opts ...option.RequestOption) (res *BetaResponse, err error) {
+ for _, v := range body.Betas {
+ opts = append(opts, option.WithHeaderAdd("openai-beta", fmt.Sprintf("%v", v)))
+ }
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
+ if responseID == "" {
+ err = errors.New("missing required response_id parameter")
+ return nil, err
+ }
+ path := requestconfig.FormatPath("responses/%s/cancel?beta=true", responseID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
+ return res, err
+}
+
+// Compact a conversation. Returns a compacted response object.
+//
+// Learn when and how to compact long-running conversations in the
+// [conversation state guide](https://platform.openai.com/docs/guides/conversation-state#managing-the-context-window).
+// For ZDR-compatible compaction details, see
+// [Compaction (advanced)](https://platform.openai.com/docs/guides/conversation-state#compaction-advanced).
+func (r *BetaResponseService) Compact(ctx context.Context, params BetaResponseCompactParams, opts ...option.RequestOption) (res *BetaCompactedResponse, err error) {
+ for _, v := range params.Betas {
+ opts = append(opts, option.WithHeaderAdd("openai-beta", fmt.Sprintf("%v", v)))
+ }
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
+ path := "responses/compact?beta=true"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
+ return res, err
+}
+
+// Allows the assistant to create, delete, or update files using unified diffs.
+type BetaApplyPatchTool struct {
+ // The type of the tool. Always `apply_patch`.
+ Type constant.ApplyPatch `json:"type" default:"apply_patch"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ AllowedCallers respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaApplyPatchTool) RawJSON() string { return r.JSON.raw }
+func (r *BetaApplyPatchTool) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaApplyPatchTool to a BetaApplyPatchToolParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaApplyPatchToolParam.Overrides()
+func (r BetaApplyPatchTool) ToParam() BetaApplyPatchToolParam {
+ return param.Override[BetaApplyPatchToolParam](json.RawMessage(r.RawJSON()))
+}
+
+// Allows the assistant to create, delete, or update files using unified diffs.
+//
+// The property Type is required.
+type BetaApplyPatchToolParam struct {
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers,omitzero"`
+ // The type of the tool. Always `apply_patch`.
+ //
+ // This field can be elided, and will marshal its zero value as "apply_patch".
+ Type constant.ApplyPatch `json:"type" default:"apply_patch"`
+ paramObj
+}
+
+func (r BetaApplyPatchToolParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaApplyPatchToolParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaApplyPatchToolParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaCompactedResponse struct {
+ // The unique identifier for the compacted response.
+ ID string `json:"id" api:"required"`
+ // Unix timestamp (in seconds) when the compacted conversation was created.
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
+ // The object type. Always `response.compaction`.
+ Object constant.ResponseCompaction `json:"object" default:"response.compaction"`
+ // The compacted list of output items. This is a list of all user messages,
+ // followed by a single compaction item.
+ Output []BetaResponseOutputItemUnion `json:"output" api:"required"`
+ // Token accounting for the compaction pass, including cached, reasoning, and total
+ // tokens.
+ Usage BetaResponseUsage `json:"usage" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CreatedAt respjson.Field
+ Object respjson.Field
+ Output respjson.Field
+ Usage respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaCompactedResponse) RawJSON() string { return r.JSON.raw }
+func (r *BetaCompactedResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaComputerActionUnion contains all possible properties and values from
+// [BetaComputerActionClick], [BetaComputerActionDoubleClick],
+// [BetaComputerActionDrag], [BetaComputerActionKeypress],
+// [BetaComputerActionMove], [BetaComputerActionScreenshot],
+// [BetaComputerActionScroll], [BetaComputerActionType], [BetaComputerActionWait].
+//
+// Use the [BetaComputerActionUnion.AsAny] method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaComputerActionUnion struct {
+ // This field is from variant [BetaComputerActionClick].
+ Button string `json:"button"`
+ // Any of "click", "double_click", "drag", "keypress", "move", "screenshot",
+ // "scroll", "type", "wait".
+ Type string `json:"type"`
+ X int64 `json:"x"`
+ Y int64 `json:"y"`
+ Keys []string `json:"keys"`
+ // This field is from variant [BetaComputerActionDrag].
+ Path []BetaComputerActionDragPath `json:"path"`
+ // This field is from variant [BetaComputerActionScroll].
+ ScrollX int64 `json:"scroll_x"`
+ // This field is from variant [BetaComputerActionScroll].
+ ScrollY int64 `json:"scroll_y"`
+ // This field is from variant [BetaComputerActionType].
+ Text string `json:"text"`
+ JSON struct {
+ Button respjson.Field
+ Type respjson.Field
+ X respjson.Field
+ Y respjson.Field
+ Keys respjson.Field
+ Path respjson.Field
+ ScrollX respjson.Field
+ ScrollY respjson.Field
+ Text respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaComputerAction is implemented by each variant of
+// [BetaComputerActionUnion] to add type safety for the return type of
+// [BetaComputerActionUnion.AsAny]
+type anyBetaComputerAction interface {
+ implBetaComputerActionUnion()
+}
+
+func (BetaComputerActionClick) implBetaComputerActionUnion() {}
+func (BetaComputerActionDoubleClick) implBetaComputerActionUnion() {}
+func (BetaComputerActionDrag) implBetaComputerActionUnion() {}
+func (BetaComputerActionKeypress) implBetaComputerActionUnion() {}
+func (BetaComputerActionMove) implBetaComputerActionUnion() {}
+func (BetaComputerActionScreenshot) implBetaComputerActionUnion() {}
+func (BetaComputerActionScroll) implBetaComputerActionUnion() {}
+func (BetaComputerActionType) implBetaComputerActionUnion() {}
+func (BetaComputerActionWait) implBetaComputerActionUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaComputerActionUnion.AsAny().(type) {
+// case openai.BetaComputerActionClick:
+// case openai.BetaComputerActionDoubleClick:
+// case openai.BetaComputerActionDrag:
+// case openai.BetaComputerActionKeypress:
+// case openai.BetaComputerActionMove:
+// case openai.BetaComputerActionScreenshot:
+// case openai.BetaComputerActionScroll:
+// case openai.BetaComputerActionType:
+// case openai.BetaComputerActionWait:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaComputerActionUnion) AsAny() anyBetaComputerAction {
+ switch u.Type {
+ case "click":
+ return u.AsClick()
+ case "double_click":
+ return u.AsDoubleClick()
+ case "drag":
+ return u.AsDrag()
+ case "keypress":
+ return u.AsKeypress()
+ case "move":
+ return u.AsMove()
+ case "screenshot":
+ return u.AsScreenshot()
+ case "scroll":
+ return u.AsScroll()
+ case "type":
+ return u.AsType()
+ case "wait":
+ return u.AsWait()
+ }
+ return nil
+}
+
+func (u BetaComputerActionUnion) AsClick() (v BetaComputerActionClick) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaComputerActionUnion) AsDoubleClick() (v BetaComputerActionDoubleClick) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaComputerActionUnion) AsDrag() (v BetaComputerActionDrag) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaComputerActionUnion) AsKeypress() (v BetaComputerActionKeypress) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaComputerActionUnion) AsMove() (v BetaComputerActionMove) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaComputerActionUnion) AsScreenshot() (v BetaComputerActionScreenshot) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaComputerActionUnion) AsScroll() (v BetaComputerActionScroll) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaComputerActionUnion) AsType() (v BetaComputerActionType) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaComputerActionUnion) AsWait() (v BetaComputerActionWait) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaComputerActionUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaComputerActionUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaComputerActionUnion to a BetaComputerActionUnionParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaComputerActionUnionParam.Overrides()
+func (r BetaComputerActionUnion) ToParam() BetaComputerActionUnionParam {
+ return param.Override[BetaComputerActionUnionParam](json.RawMessage(r.RawJSON()))
+}
+
+// A click action.
+type BetaComputerActionClick struct {
+ // Indicates which mouse button was pressed during the click. One of `left`,
+ // `right`, `wheel`, `back`, or `forward`.
+ //
+ // Any of "left", "right", "wheel", "back", "forward".
+ Button string `json:"button" api:"required"`
+ // Specifies the event type. For a click action, this property is always `click`.
+ Type constant.Click `json:"type" default:"click"`
+ // The x-coordinate where the click occurred.
+ X int64 `json:"x" api:"required"`
+ // The y-coordinate where the click occurred.
+ Y int64 `json:"y" api:"required"`
+ // The keys being held while clicking.
+ Keys []string `json:"keys" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Button respjson.Field
+ Type respjson.Field
+ X respjson.Field
+ Y respjson.Field
+ Keys respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaComputerActionClick) RawJSON() string { return r.JSON.raw }
+func (r *BetaComputerActionClick) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A double click action.
+type BetaComputerActionDoubleClick struct {
+ // The keys being held while double-clicking.
+ Keys []string `json:"keys" api:"required"`
+ // Specifies the event type. For a double click action, this property is always set
+ // to `double_click`.
+ Type constant.DoubleClick `json:"type" default:"double_click"`
+ // The x-coordinate where the double click occurred.
+ X int64 `json:"x" api:"required"`
+ // The y-coordinate where the double click occurred.
+ Y int64 `json:"y" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Keys respjson.Field
+ Type respjson.Field
+ X respjson.Field
+ Y respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaComputerActionDoubleClick) RawJSON() string { return r.JSON.raw }
+func (r *BetaComputerActionDoubleClick) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A drag action.
+type BetaComputerActionDrag struct {
+ // An array of coordinates representing the path of the drag action. Coordinates
+ // will appear as an array of objects, eg
+ //
+ // ```
+ // [
+ //
+ // { x: 100, y: 200 },
+ // { x: 200, y: 300 }
+ //
+ // ]
+ // ```
+ Path []BetaComputerActionDragPath `json:"path" api:"required"`
+ // Specifies the event type. For a drag action, this property is always set to
+ // `drag`.
+ Type constant.Drag `json:"type" default:"drag"`
+ // The keys being held while dragging the mouse.
+ Keys []string `json:"keys" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Path respjson.Field
+ Type respjson.Field
+ Keys respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaComputerActionDrag) RawJSON() string { return r.JSON.raw }
+func (r *BetaComputerActionDrag) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`.
+type BetaComputerActionDragPath struct {
+ // The x-coordinate.
+ X int64 `json:"x" api:"required"`
+ // The y-coordinate.
+ Y int64 `json:"y" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ X respjson.Field
+ Y respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaComputerActionDragPath) RawJSON() string { return r.JSON.raw }
+func (r *BetaComputerActionDragPath) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A collection of keypresses the model would like to perform.
+type BetaComputerActionKeypress struct {
+ // The combination of keys the model is requesting to be pressed. This is an array
+ // of strings, each representing a key.
+ Keys []string `json:"keys" api:"required"`
+ // Specifies the event type. For a keypress action, this property is always set to
+ // `keypress`.
+ Type constant.Keypress `json:"type" default:"keypress"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Keys respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaComputerActionKeypress) RawJSON() string { return r.JSON.raw }
+func (r *BetaComputerActionKeypress) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A mouse move action.
+type BetaComputerActionMove struct {
+ // Specifies the event type. For a move action, this property is always set to
+ // `move`.
+ Type constant.Move `json:"type" default:"move"`
+ // The x-coordinate to move to.
+ X int64 `json:"x" api:"required"`
+ // The y-coordinate to move to.
+ Y int64 `json:"y" api:"required"`
+ // The keys being held while moving the mouse.
+ Keys []string `json:"keys" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ X respjson.Field
+ Y respjson.Field
+ Keys respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaComputerActionMove) RawJSON() string { return r.JSON.raw }
+func (r *BetaComputerActionMove) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A screenshot action.
+type BetaComputerActionScreenshot struct {
+ // Specifies the event type. For a screenshot action, this property is always set
+ // to `screenshot`.
+ Type constant.Screenshot `json:"type" default:"screenshot"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaComputerActionScreenshot) RawJSON() string { return r.JSON.raw }
+func (r *BetaComputerActionScreenshot) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A scroll action.
+type BetaComputerActionScroll struct {
+ // The horizontal scroll distance.
+ ScrollX int64 `json:"scroll_x" api:"required"`
+ // The vertical scroll distance.
+ ScrollY int64 `json:"scroll_y" api:"required"`
+ // Specifies the event type. For a scroll action, this property is always set to
+ // `scroll`.
+ Type constant.Scroll `json:"type" default:"scroll"`
+ // The x-coordinate where the scroll occurred.
+ X int64 `json:"x" api:"required"`
+ // The y-coordinate where the scroll occurred.
+ Y int64 `json:"y" api:"required"`
+ // The keys being held while scrolling.
+ Keys []string `json:"keys" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ScrollX respjson.Field
+ ScrollY respjson.Field
+ Type respjson.Field
+ X respjson.Field
+ Y respjson.Field
+ Keys respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaComputerActionScroll) RawJSON() string { return r.JSON.raw }
+func (r *BetaComputerActionScroll) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An action to type in text.
+type BetaComputerActionType struct {
+ // The text to type.
+ Text string `json:"text" api:"required"`
+ // Specifies the event type. For a type action, this property is always set to
+ // `type`.
+ Type constant.Type `json:"type" default:"type"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaComputerActionType) RawJSON() string { return r.JSON.raw }
+func (r *BetaComputerActionType) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A wait action.
+type BetaComputerActionWait struct {
+ // Specifies the event type. For a wait action, this property is always set to
+ // `wait`.
+ Type constant.Wait `json:"type" default:"wait"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaComputerActionWait) RawJSON() string { return r.JSON.raw }
+func (r *BetaComputerActionWait) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func BetaComputerActionParamOfClick(button string, x int64, y int64) BetaComputerActionUnionParam {
+ var click BetaComputerActionClickParam
+ click.Button = button
+ click.X = x
+ click.Y = y
+ return BetaComputerActionUnionParam{OfClick: &click}
+}
+
+func BetaComputerActionParamOfDoubleClick(keys []string, x int64, y int64) BetaComputerActionUnionParam {
+ var doubleClick BetaComputerActionDoubleClickParam
+ doubleClick.Keys = keys
+ doubleClick.X = x
+ doubleClick.Y = y
+ return BetaComputerActionUnionParam{OfDoubleClick: &doubleClick}
+}
+
+func BetaComputerActionParamOfDrag(path []BetaComputerActionDragPathParam) BetaComputerActionUnionParam {
+ var drag BetaComputerActionDragParam
+ drag.Path = path
+ return BetaComputerActionUnionParam{OfDrag: &drag}
+}
+
+func BetaComputerActionParamOfKeypress(keys []string) BetaComputerActionUnionParam {
+ var keypress BetaComputerActionKeypressParam
+ keypress.Keys = keys
+ return BetaComputerActionUnionParam{OfKeypress: &keypress}
+}
+
+func BetaComputerActionParamOfMove(x int64, y int64) BetaComputerActionUnionParam {
+ var move BetaComputerActionMoveParam
+ move.X = x
+ move.Y = y
+ return BetaComputerActionUnionParam{OfMove: &move}
+}
+
+func BetaComputerActionParamOfType(text string) BetaComputerActionUnionParam {
+ var type_ BetaComputerActionTypeParam
+ type_.Text = text
+ return BetaComputerActionUnionParam{OfType: &type_}
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaComputerActionUnionParam struct {
+ OfClick *BetaComputerActionClickParam `json:",omitzero,inline"`
+ OfDoubleClick *BetaComputerActionDoubleClickParam `json:",omitzero,inline"`
+ OfDrag *BetaComputerActionDragParam `json:",omitzero,inline"`
+ OfKeypress *BetaComputerActionKeypressParam `json:",omitzero,inline"`
+ OfMove *BetaComputerActionMoveParam `json:",omitzero,inline"`
+ OfScreenshot *BetaComputerActionScreenshotParam `json:",omitzero,inline"`
+ OfScroll *BetaComputerActionScrollParam `json:",omitzero,inline"`
+ OfType *BetaComputerActionTypeParam `json:",omitzero,inline"`
+ OfWait *BetaComputerActionWaitParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaComputerActionUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfClick,
+ u.OfDoubleClick,
+ u.OfDrag,
+ u.OfKeypress,
+ u.OfMove,
+ u.OfScreenshot,
+ u.OfScroll,
+ u.OfType,
+ u.OfWait)
+}
+func (u *BetaComputerActionUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaComputerActionUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfClick) {
+ return u.OfClick
+ } else if !param.IsOmitted(u.OfDoubleClick) {
+ return u.OfDoubleClick
+ } else if !param.IsOmitted(u.OfDrag) {
+ return u.OfDrag
+ } else if !param.IsOmitted(u.OfKeypress) {
+ return u.OfKeypress
+ } else if !param.IsOmitted(u.OfMove) {
+ return u.OfMove
+ } else if !param.IsOmitted(u.OfScreenshot) {
+ return u.OfScreenshot
+ } else if !param.IsOmitted(u.OfScroll) {
+ return u.OfScroll
+ } else if !param.IsOmitted(u.OfType) {
+ return u.OfType
+ } else if !param.IsOmitted(u.OfWait) {
+ return u.OfWait
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaComputerActionUnionParam) GetButton() *string {
+ if vt := u.OfClick; vt != nil {
+ return &vt.Button
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaComputerActionUnionParam) GetPath() []BetaComputerActionDragPathParam {
+ if vt := u.OfDrag; vt != nil {
+ return vt.Path
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaComputerActionUnionParam) GetScrollX() *int64 {
+ if vt := u.OfScroll; vt != nil {
+ return &vt.ScrollX
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaComputerActionUnionParam) GetScrollY() *int64 {
+ if vt := u.OfScroll; vt != nil {
+ return &vt.ScrollY
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaComputerActionUnionParam) GetText() *string {
+ if vt := u.OfType; vt != nil {
+ return &vt.Text
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaComputerActionUnionParam) GetType() *string {
+ if vt := u.OfClick; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfDoubleClick; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfDrag; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfKeypress; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfMove; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfScreenshot; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfScroll; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfType; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfWait; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaComputerActionUnionParam) GetX() *int64 {
+ if vt := u.OfClick; vt != nil {
+ return (*int64)(&vt.X)
+ } else if vt := u.OfDoubleClick; vt != nil {
+ return (*int64)(&vt.X)
+ } else if vt := u.OfMove; vt != nil {
+ return (*int64)(&vt.X)
+ } else if vt := u.OfScroll; vt != nil {
+ return (*int64)(&vt.X)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaComputerActionUnionParam) GetY() *int64 {
+ if vt := u.OfClick; vt != nil {
+ return (*int64)(&vt.Y)
+ } else if vt := u.OfDoubleClick; vt != nil {
+ return (*int64)(&vt.Y)
+ } else if vt := u.OfMove; vt != nil {
+ return (*int64)(&vt.Y)
+ } else if vt := u.OfScroll; vt != nil {
+ return (*int64)(&vt.Y)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's Keys property, if present.
+func (u BetaComputerActionUnionParam) GetKeys() []string {
+ if vt := u.OfClick; vt != nil {
+ return vt.Keys
+ } else if vt := u.OfDoubleClick; vt != nil {
+ return vt.Keys
+ } else if vt := u.OfDrag; vt != nil {
+ return vt.Keys
+ } else if vt := u.OfKeypress; vt != nil {
+ return vt.Keys
+ } else if vt := u.OfMove; vt != nil {
+ return vt.Keys
+ } else if vt := u.OfScroll; vt != nil {
+ return vt.Keys
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaComputerActionUnionParam](
+ "type",
+ apijson.Discriminator[BetaComputerActionClickParam]("click"),
+ apijson.Discriminator[BetaComputerActionDoubleClickParam]("double_click"),
+ apijson.Discriminator[BetaComputerActionDragParam]("drag"),
+ apijson.Discriminator[BetaComputerActionKeypressParam]("keypress"),
+ apijson.Discriminator[BetaComputerActionMoveParam]("move"),
+ apijson.Discriminator[BetaComputerActionScreenshotParam]("screenshot"),
+ apijson.Discriminator[BetaComputerActionScrollParam]("scroll"),
+ apijson.Discriminator[BetaComputerActionTypeParam]("type"),
+ apijson.Discriminator[BetaComputerActionWaitParam]("wait"),
+ )
+}
+
+// A click action.
+//
+// The properties Button, Type, X, Y are required.
+type BetaComputerActionClickParam struct {
+ // Indicates which mouse button was pressed during the click. One of `left`,
+ // `right`, `wheel`, `back`, or `forward`.
+ //
+ // Any of "left", "right", "wheel", "back", "forward".
+ Button string `json:"button,omitzero" api:"required"`
+ // The x-coordinate where the click occurred.
+ X int64 `json:"x" api:"required"`
+ // The y-coordinate where the click occurred.
+ Y int64 `json:"y" api:"required"`
+ // The keys being held while clicking.
+ Keys []string `json:"keys,omitzero"`
+ // Specifies the event type. For a click action, this property is always `click`.
+ //
+ // This field can be elided, and will marshal its zero value as "click".
+ Type constant.Click `json:"type" default:"click"`
+ paramObj
+}
+
+func (r BetaComputerActionClickParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaComputerActionClickParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaComputerActionClickParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaComputerActionClickParam](
+ "button", "left", "right", "wheel", "back", "forward",
+ )
+}
+
+// A double click action.
+//
+// The properties Keys, Type, X, Y are required.
+type BetaComputerActionDoubleClickParam struct {
+ // The keys being held while double-clicking.
+ Keys []string `json:"keys,omitzero" api:"required"`
+ // The x-coordinate where the double click occurred.
+ X int64 `json:"x" api:"required"`
+ // The y-coordinate where the double click occurred.
+ Y int64 `json:"y" api:"required"`
+ // Specifies the event type. For a double click action, this property is always set
+ // to `double_click`.
+ //
+ // This field can be elided, and will marshal its zero value as "double_click".
+ Type constant.DoubleClick `json:"type" default:"double_click"`
+ paramObj
+}
+
+func (r BetaComputerActionDoubleClickParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaComputerActionDoubleClickParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaComputerActionDoubleClickParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A drag action.
+//
+// The properties Path, Type are required.
+type BetaComputerActionDragParam struct {
+ // An array of coordinates representing the path of the drag action. Coordinates
+ // will appear as an array of objects, eg
+ //
+ // ```
+ // [
+ //
+ // { x: 100, y: 200 },
+ // { x: 200, y: 300 }
+ //
+ // ]
+ // ```
+ Path []BetaComputerActionDragPathParam `json:"path,omitzero" api:"required"`
+ // The keys being held while dragging the mouse.
+ Keys []string `json:"keys,omitzero"`
+ // Specifies the event type. For a drag action, this property is always set to
+ // `drag`.
+ //
+ // This field can be elided, and will marshal its zero value as "drag".
+ Type constant.Drag `json:"type" default:"drag"`
+ paramObj
+}
+
+func (r BetaComputerActionDragParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaComputerActionDragParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaComputerActionDragParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`.
+//
+// The properties X, Y are required.
+type BetaComputerActionDragPathParam struct {
+ // The x-coordinate.
+ X int64 `json:"x" api:"required"`
+ // The y-coordinate.
+ Y int64 `json:"y" api:"required"`
+ paramObj
+}
+
+func (r BetaComputerActionDragPathParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaComputerActionDragPathParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaComputerActionDragPathParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A collection of keypresses the model would like to perform.
+//
+// The properties Keys, Type are required.
+type BetaComputerActionKeypressParam struct {
+ // The combination of keys the model is requesting to be pressed. This is an array
+ // of strings, each representing a key.
+ Keys []string `json:"keys,omitzero" api:"required"`
+ // Specifies the event type. For a keypress action, this property is always set to
+ // `keypress`.
+ //
+ // This field can be elided, and will marshal its zero value as "keypress".
+ Type constant.Keypress `json:"type" default:"keypress"`
+ paramObj
+}
+
+func (r BetaComputerActionKeypressParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaComputerActionKeypressParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaComputerActionKeypressParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A mouse move action.
+//
+// The properties Type, X, Y are required.
+type BetaComputerActionMoveParam struct {
+ // The x-coordinate to move to.
+ X int64 `json:"x" api:"required"`
+ // The y-coordinate to move to.
+ Y int64 `json:"y" api:"required"`
+ // The keys being held while moving the mouse.
+ Keys []string `json:"keys,omitzero"`
+ // Specifies the event type. For a move action, this property is always set to
+ // `move`.
+ //
+ // This field can be elided, and will marshal its zero value as "move".
+ Type constant.Move `json:"type" default:"move"`
+ paramObj
+}
+
+func (r BetaComputerActionMoveParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaComputerActionMoveParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaComputerActionMoveParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func NewBetaComputerActionScreenshotParam() BetaComputerActionScreenshotParam {
+ return BetaComputerActionScreenshotParam{
+ Type: "screenshot",
+ }
+}
+
+// A screenshot action.
+//
+// This struct has a constant value, construct it with
+// [NewBetaComputerActionScreenshotParam].
+type BetaComputerActionScreenshotParam struct {
+ // Specifies the event type. For a screenshot action, this property is always set
+ // to `screenshot`.
+ Type constant.Screenshot `json:"type" default:"screenshot"`
+ paramObj
+}
+
+func (r BetaComputerActionScreenshotParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaComputerActionScreenshotParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaComputerActionScreenshotParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A scroll action.
+//
+// The properties ScrollX, ScrollY, Type, X, Y are required.
+type BetaComputerActionScrollParam struct {
+ // The horizontal scroll distance.
+ ScrollX int64 `json:"scroll_x" api:"required"`
+ // The vertical scroll distance.
+ ScrollY int64 `json:"scroll_y" api:"required"`
+ // The x-coordinate where the scroll occurred.
+ X int64 `json:"x" api:"required"`
+ // The y-coordinate where the scroll occurred.
+ Y int64 `json:"y" api:"required"`
+ // The keys being held while scrolling.
+ Keys []string `json:"keys,omitzero"`
+ // Specifies the event type. For a scroll action, this property is always set to
+ // `scroll`.
+ //
+ // This field can be elided, and will marshal its zero value as "scroll".
+ Type constant.Scroll `json:"type" default:"scroll"`
+ paramObj
+}
+
+func (r BetaComputerActionScrollParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaComputerActionScrollParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaComputerActionScrollParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An action to type in text.
+//
+// The properties Text, Type are required.
+type BetaComputerActionTypeParam struct {
+ // The text to type.
+ Text string `json:"text" api:"required"`
+ // Specifies the event type. For a type action, this property is always set to
+ // `type`.
+ //
+ // This field can be elided, and will marshal its zero value as "type".
+ Type constant.Type `json:"type" default:"type"`
+ paramObj
+}
+
+func (r BetaComputerActionTypeParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaComputerActionTypeParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaComputerActionTypeParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func NewBetaComputerActionWaitParam() BetaComputerActionWaitParam {
+ return BetaComputerActionWaitParam{
+ Type: "wait",
+ }
+}
+
+// A wait action.
+//
+// This struct has a constant value, construct it with
+// [NewBetaComputerActionWaitParam].
+type BetaComputerActionWaitParam struct {
+ // Specifies the event type. For a wait action, this property is always set to
+ // `wait`.
+ Type constant.Wait `json:"type" default:"wait"`
+ paramObj
+}
+
+func (r BetaComputerActionWaitParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaComputerActionWaitParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaComputerActionWaitParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaComputerActionList []BetaComputerActionUnion
+
+type BetaComputerActionListParam []BetaComputerActionUnionParam
+
+// A tool that controls a virtual computer. Learn more about the
+// [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).
+type BetaComputerTool struct {
+ // The type of the computer tool. Always `computer`.
+ Type constant.Computer `json:"type" default:"computer"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaComputerTool) RawJSON() string { return r.JSON.raw }
+func (r *BetaComputerTool) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaComputerTool to a BetaComputerToolParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaComputerToolParam.Overrides()
+func (r BetaComputerTool) ToParam() BetaComputerToolParam {
+ return param.Override[BetaComputerToolParam](json.RawMessage(r.RawJSON()))
+}
+
+func NewBetaComputerToolParam() BetaComputerToolParam {
+ return BetaComputerToolParam{
+ Type: "computer",
+ }
+}
+
+// A tool that controls a virtual computer. Learn more about the
+// [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).
+//
+// This struct has a constant value, construct it with [NewBetaComputerToolParam].
+type BetaComputerToolParam struct {
+ // The type of the computer tool. Always `computer`.
+ Type constant.Computer `json:"type" default:"computer"`
+ paramObj
+}
+
+func (r BetaComputerToolParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaComputerToolParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaComputerToolParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool that controls a virtual computer. Learn more about the
+// [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).
+type BetaComputerUsePreviewTool struct {
+ // The height of the computer display.
+ DisplayHeight int64 `json:"display_height" api:"required"`
+ // The width of the computer display.
+ DisplayWidth int64 `json:"display_width" api:"required"`
+ // The type of computer environment to control.
+ //
+ // Any of "windows", "mac", "linux", "ubuntu", "browser".
+ Environment BetaComputerUsePreviewToolEnvironment `json:"environment" api:"required"`
+ // The type of the computer use tool. Always `computer_use_preview`.
+ Type constant.ComputerUsePreview `json:"type" default:"computer_use_preview"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ DisplayHeight respjson.Field
+ DisplayWidth respjson.Field
+ Environment respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaComputerUsePreviewTool) RawJSON() string { return r.JSON.raw }
+func (r *BetaComputerUsePreviewTool) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaComputerUsePreviewTool to a
+// BetaComputerUsePreviewToolParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaComputerUsePreviewToolParam.Overrides()
+func (r BetaComputerUsePreviewTool) ToParam() BetaComputerUsePreviewToolParam {
+ return param.Override[BetaComputerUsePreviewToolParam](json.RawMessage(r.RawJSON()))
+}
+
+// The type of computer environment to control.
+type BetaComputerUsePreviewToolEnvironment string
+
+const (
+ BetaComputerUsePreviewToolEnvironmentWindows BetaComputerUsePreviewToolEnvironment = "windows"
+ BetaComputerUsePreviewToolEnvironmentMac BetaComputerUsePreviewToolEnvironment = "mac"
+ BetaComputerUsePreviewToolEnvironmentLinux BetaComputerUsePreviewToolEnvironment = "linux"
+ BetaComputerUsePreviewToolEnvironmentUbuntu BetaComputerUsePreviewToolEnvironment = "ubuntu"
+ BetaComputerUsePreviewToolEnvironmentBrowser BetaComputerUsePreviewToolEnvironment = "browser"
+)
+
+// A tool that controls a virtual computer. Learn more about the
+// [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).
+//
+// The properties DisplayHeight, DisplayWidth, Environment, Type are required.
+type BetaComputerUsePreviewToolParam struct {
+ // The height of the computer display.
+ DisplayHeight int64 `json:"display_height" api:"required"`
+ // The width of the computer display.
+ DisplayWidth int64 `json:"display_width" api:"required"`
+ // The type of computer environment to control.
+ //
+ // Any of "windows", "mac", "linux", "ubuntu", "browser".
+ Environment BetaComputerUsePreviewToolEnvironment `json:"environment,omitzero" api:"required"`
+ // The type of the computer use tool. Always `computer_use_preview`.
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "computer_use_preview".
+ Type constant.ComputerUsePreview `json:"type" default:"computer_use_preview"`
+ paramObj
+}
+
+func (r BetaComputerUsePreviewToolParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaComputerUsePreviewToolParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaComputerUsePreviewToolParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaContainerAuto struct {
+ // Automatically creates a container for this request
+ Type constant.ContainerAuto `json:"type" default:"container_auto"`
+ // An optional list of uploaded files to make available to your code.
+ FileIDs []string `json:"file_ids"`
+ // The memory limit for the container.
+ //
+ // Any of "1g", "4g", "16g", "64g".
+ MemoryLimit BetaContainerAutoMemoryLimit `json:"memory_limit" api:"nullable"`
+ // Network access policy for the container.
+ NetworkPolicy BetaContainerAutoNetworkPolicyUnion `json:"network_policy"`
+ // An optional list of skills referenced by id or inline data.
+ Skills []BetaContainerAutoSkillUnion `json:"skills"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ FileIDs respjson.Field
+ MemoryLimit respjson.Field
+ NetworkPolicy respjson.Field
+ Skills respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaContainerAuto) RawJSON() string { return r.JSON.raw }
+func (r *BetaContainerAuto) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaContainerAuto to a BetaContainerAutoParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaContainerAutoParam.Overrides()
+func (r BetaContainerAuto) ToParam() BetaContainerAutoParam {
+ return param.Override[BetaContainerAutoParam](json.RawMessage(r.RawJSON()))
+}
+
+// The memory limit for the container.
+type BetaContainerAutoMemoryLimit string
+
+const (
+ BetaContainerAutoMemoryLimit1g BetaContainerAutoMemoryLimit = "1g"
+ BetaContainerAutoMemoryLimit4g BetaContainerAutoMemoryLimit = "4g"
+ BetaContainerAutoMemoryLimit16g BetaContainerAutoMemoryLimit = "16g"
+ BetaContainerAutoMemoryLimit64g BetaContainerAutoMemoryLimit = "64g"
+)
+
+// BetaContainerAutoNetworkPolicyUnion contains all possible properties and values
+// from [BetaContainerNetworkPolicyDisabled],
+// [BetaContainerNetworkPolicyAllowlist].
+//
+// Use the [BetaContainerAutoNetworkPolicyUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaContainerAutoNetworkPolicyUnion struct {
+ // Any of "disabled", "allowlist".
+ Type string `json:"type"`
+ // This field is from variant [BetaContainerNetworkPolicyAllowlist].
+ AllowedDomains []string `json:"allowed_domains"`
+ // This field is from variant [BetaContainerNetworkPolicyAllowlist].
+ DomainSecrets []BetaContainerNetworkPolicyDomainSecret `json:"domain_secrets"`
+ JSON struct {
+ Type respjson.Field
+ AllowedDomains respjson.Field
+ DomainSecrets respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaContainerAutoNetworkPolicy is implemented by each variant of
+// [BetaContainerAutoNetworkPolicyUnion] to add type safety for the return type of
+// [BetaContainerAutoNetworkPolicyUnion.AsAny]
+type anyBetaContainerAutoNetworkPolicy interface {
+ implBetaContainerAutoNetworkPolicyUnion()
+}
+
+func (BetaContainerNetworkPolicyDisabled) implBetaContainerAutoNetworkPolicyUnion() {}
+func (BetaContainerNetworkPolicyAllowlist) implBetaContainerAutoNetworkPolicyUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaContainerAutoNetworkPolicyUnion.AsAny().(type) {
+// case openai.BetaContainerNetworkPolicyDisabled:
+// case openai.BetaContainerNetworkPolicyAllowlist:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaContainerAutoNetworkPolicyUnion) AsAny() anyBetaContainerAutoNetworkPolicy {
+ switch u.Type {
+ case "disabled":
+ return u.AsDisabled()
+ case "allowlist":
+ return u.AsAllowlist()
+ }
+ return nil
+}
+
+func (u BetaContainerAutoNetworkPolicyUnion) AsDisabled() (v BetaContainerNetworkPolicyDisabled) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaContainerAutoNetworkPolicyUnion) AsAllowlist() (v BetaContainerNetworkPolicyAllowlist) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaContainerAutoNetworkPolicyUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaContainerAutoNetworkPolicyUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaContainerAutoSkillUnion contains all possible properties and values from
+// [BetaSkillReference], [BetaInlineSkill].
+//
+// Use the [BetaContainerAutoSkillUnion.AsAny] method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaContainerAutoSkillUnion struct {
+ // This field is from variant [BetaSkillReference].
+ SkillID string `json:"skill_id"`
+ // Any of "skill_reference", "inline".
+ Type string `json:"type"`
+ // This field is from variant [BetaSkillReference].
+ Version string `json:"version"`
+ // This field is from variant [BetaInlineSkill].
+ Description string `json:"description"`
+ // This field is from variant [BetaInlineSkill].
+ Name string `json:"name"`
+ // This field is from variant [BetaInlineSkill].
+ Source BetaInlineSkillSource `json:"source"`
+ JSON struct {
+ SkillID respjson.Field
+ Type respjson.Field
+ Version respjson.Field
+ Description respjson.Field
+ Name respjson.Field
+ Source respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaContainerAutoSkill is implemented by each variant of
+// [BetaContainerAutoSkillUnion] to add type safety for the return type of
+// [BetaContainerAutoSkillUnion.AsAny]
+type anyBetaContainerAutoSkill interface {
+ implBetaContainerAutoSkillUnion()
+}
+
+func (BetaSkillReference) implBetaContainerAutoSkillUnion() {}
+func (BetaInlineSkill) implBetaContainerAutoSkillUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaContainerAutoSkillUnion.AsAny().(type) {
+// case openai.BetaSkillReference:
+// case openai.BetaInlineSkill:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaContainerAutoSkillUnion) AsAny() anyBetaContainerAutoSkill {
+ switch u.Type {
+ case "skill_reference":
+ return u.AsSkillReference()
+ case "inline":
+ return u.AsInline()
+ }
+ return nil
+}
+
+func (u BetaContainerAutoSkillUnion) AsSkillReference() (v BetaSkillReference) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaContainerAutoSkillUnion) AsInline() (v BetaInlineSkill) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaContainerAutoSkillUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaContainerAutoSkillUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The property Type is required.
+type BetaContainerAutoParam struct {
+ // The memory limit for the container.
+ //
+ // Any of "1g", "4g", "16g", "64g".
+ MemoryLimit BetaContainerAutoMemoryLimit `json:"memory_limit,omitzero"`
+ // An optional list of uploaded files to make available to your code.
+ FileIDs []string `json:"file_ids,omitzero"`
+ // Network access policy for the container.
+ NetworkPolicy BetaContainerAutoNetworkPolicyUnionParam `json:"network_policy,omitzero"`
+ // An optional list of skills referenced by id or inline data.
+ Skills []BetaContainerAutoSkillUnionParam `json:"skills,omitzero"`
+ // Automatically creates a container for this request
+ //
+ // This field can be elided, and will marshal its zero value as "container_auto".
+ Type constant.ContainerAuto `json:"type" default:"container_auto"`
+ paramObj
+}
+
+func (r BetaContainerAutoParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaContainerAutoParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaContainerAutoParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaContainerAutoNetworkPolicyUnionParam struct {
+ OfDisabled *BetaContainerNetworkPolicyDisabledParam `json:",omitzero,inline"`
+ OfAllowlist *BetaContainerNetworkPolicyAllowlistParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaContainerAutoNetworkPolicyUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfDisabled, u.OfAllowlist)
+}
+func (u *BetaContainerAutoNetworkPolicyUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaContainerAutoNetworkPolicyUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfDisabled) {
+ return u.OfDisabled
+ } else if !param.IsOmitted(u.OfAllowlist) {
+ return u.OfAllowlist
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaContainerAutoNetworkPolicyUnionParam) GetAllowedDomains() []string {
+ if vt := u.OfAllowlist; vt != nil {
+ return vt.AllowedDomains
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaContainerAutoNetworkPolicyUnionParam) GetDomainSecrets() []BetaContainerNetworkPolicyDomainSecretParam {
+ if vt := u.OfAllowlist; vt != nil {
+ return vt.DomainSecrets
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaContainerAutoNetworkPolicyUnionParam) GetType() *string {
+ if vt := u.OfDisabled; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfAllowlist; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaContainerAutoNetworkPolicyUnionParam](
+ "type",
+ apijson.Discriminator[BetaContainerNetworkPolicyDisabledParam]("disabled"),
+ apijson.Discriminator[BetaContainerNetworkPolicyAllowlistParam]("allowlist"),
+ )
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaContainerAutoSkillUnionParam struct {
+ OfSkillReference *BetaSkillReferenceParam `json:",omitzero,inline"`
+ OfInline *BetaInlineSkillParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaContainerAutoSkillUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfSkillReference, u.OfInline)
+}
+func (u *BetaContainerAutoSkillUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaContainerAutoSkillUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfSkillReference) {
+ return u.OfSkillReference
+ } else if !param.IsOmitted(u.OfInline) {
+ return u.OfInline
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaContainerAutoSkillUnionParam) GetSkillID() *string {
+ if vt := u.OfSkillReference; vt != nil {
+ return &vt.SkillID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaContainerAutoSkillUnionParam) GetVersion() *string {
+ if vt := u.OfSkillReference; vt != nil && vt.Version.Valid() {
+ return &vt.Version.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaContainerAutoSkillUnionParam) GetDescription() *string {
+ if vt := u.OfInline; vt != nil {
+ return &vt.Description
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaContainerAutoSkillUnionParam) GetName() *string {
+ if vt := u.OfInline; vt != nil {
+ return &vt.Name
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaContainerAutoSkillUnionParam) GetSource() *BetaInlineSkillSourceParam {
+ if vt := u.OfInline; vt != nil {
+ return &vt.Source
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaContainerAutoSkillUnionParam) GetType() *string {
+ if vt := u.OfSkillReference; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfInline; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaContainerAutoSkillUnionParam](
+ "type",
+ apijson.Discriminator[BetaSkillReferenceParam]("skill_reference"),
+ apijson.Discriminator[BetaInlineSkillParam]("inline"),
+ )
+}
+
+type BetaContainerNetworkPolicyAllowlist struct {
+ // A list of allowed domains when type is `allowlist`.
+ AllowedDomains []string `json:"allowed_domains" api:"required"`
+ // Allow outbound network access only to specified domains. Always `allowlist`.
+ Type constant.Allowlist `json:"type" default:"allowlist"`
+ // Optional domain-scoped secrets for allowlisted domains.
+ DomainSecrets []BetaContainerNetworkPolicyDomainSecret `json:"domain_secrets"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AllowedDomains respjson.Field
+ Type respjson.Field
+ DomainSecrets respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaContainerNetworkPolicyAllowlist) RawJSON() string { return r.JSON.raw }
+func (r *BetaContainerNetworkPolicyAllowlist) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaContainerNetworkPolicyAllowlist to a
+// BetaContainerNetworkPolicyAllowlistParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaContainerNetworkPolicyAllowlistParam.Overrides()
+func (r BetaContainerNetworkPolicyAllowlist) ToParam() BetaContainerNetworkPolicyAllowlistParam {
+ return param.Override[BetaContainerNetworkPolicyAllowlistParam](json.RawMessage(r.RawJSON()))
+}
+
+// The properties AllowedDomains, Type are required.
+type BetaContainerNetworkPolicyAllowlistParam struct {
+ // A list of allowed domains when type is `allowlist`.
+ AllowedDomains []string `json:"allowed_domains,omitzero" api:"required"`
+ // Optional domain-scoped secrets for allowlisted domains.
+ DomainSecrets []BetaContainerNetworkPolicyDomainSecretParam `json:"domain_secrets,omitzero"`
+ // Allow outbound network access only to specified domains. Always `allowlist`.
+ //
+ // This field can be elided, and will marshal its zero value as "allowlist".
+ Type constant.Allowlist `json:"type" default:"allowlist"`
+ paramObj
+}
+
+func (r BetaContainerNetworkPolicyAllowlistParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaContainerNetworkPolicyAllowlistParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaContainerNetworkPolicyAllowlistParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaContainerNetworkPolicyDisabled struct {
+ // Disable outbound network access. Always `disabled`.
+ Type constant.Disabled `json:"type" default:"disabled"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaContainerNetworkPolicyDisabled) RawJSON() string { return r.JSON.raw }
+func (r *BetaContainerNetworkPolicyDisabled) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaContainerNetworkPolicyDisabled to a
+// BetaContainerNetworkPolicyDisabledParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaContainerNetworkPolicyDisabledParam.Overrides()
+func (r BetaContainerNetworkPolicyDisabled) ToParam() BetaContainerNetworkPolicyDisabledParam {
+ return param.Override[BetaContainerNetworkPolicyDisabledParam](json.RawMessage(r.RawJSON()))
+}
+
+func NewBetaContainerNetworkPolicyDisabledParam() BetaContainerNetworkPolicyDisabledParam {
+ return BetaContainerNetworkPolicyDisabledParam{
+ Type: "disabled",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewBetaContainerNetworkPolicyDisabledParam].
+type BetaContainerNetworkPolicyDisabledParam struct {
+ // Disable outbound network access. Always `disabled`.
+ Type constant.Disabled `json:"type" default:"disabled"`
+ paramObj
+}
+
+func (r BetaContainerNetworkPolicyDisabledParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaContainerNetworkPolicyDisabledParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaContainerNetworkPolicyDisabledParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaContainerNetworkPolicyDomainSecret struct {
+ // The domain associated with the secret.
+ Domain string `json:"domain" api:"required"`
+ // The name of the secret to inject for the domain.
+ Name string `json:"name" api:"required"`
+ // The secret value to inject for the domain.
+ Value string `json:"value" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Domain respjson.Field
+ Name respjson.Field
+ Value respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaContainerNetworkPolicyDomainSecret) RawJSON() string { return r.JSON.raw }
+func (r *BetaContainerNetworkPolicyDomainSecret) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaContainerNetworkPolicyDomainSecret to a
+// BetaContainerNetworkPolicyDomainSecretParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaContainerNetworkPolicyDomainSecretParam.Overrides()
+func (r BetaContainerNetworkPolicyDomainSecret) ToParam() BetaContainerNetworkPolicyDomainSecretParam {
+ return param.Override[BetaContainerNetworkPolicyDomainSecretParam](json.RawMessage(r.RawJSON()))
+}
+
+// The properties Domain, Name, Value are required.
+type BetaContainerNetworkPolicyDomainSecretParam struct {
+ // The domain associated with the secret.
+ Domain string `json:"domain" api:"required"`
+ // The name of the secret to inject for the domain.
+ Name string `json:"name" api:"required"`
+ // The secret value to inject for the domain.
+ Value string `json:"value" api:"required"`
+ paramObj
+}
+
+func (r BetaContainerNetworkPolicyDomainSecretParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaContainerNetworkPolicyDomainSecretParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaContainerNetworkPolicyDomainSecretParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaContainerReference struct {
+ // The ID of the referenced container.
+ ContainerID string `json:"container_id" api:"required"`
+ // References a container created with the /v1/containers endpoint
+ Type constant.ContainerReference `json:"type" default:"container_reference"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ContainerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaContainerReference) RawJSON() string { return r.JSON.raw }
+func (r *BetaContainerReference) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaContainerReference to a BetaContainerReferenceParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaContainerReferenceParam.Overrides()
+func (r BetaContainerReference) ToParam() BetaContainerReferenceParam {
+ return param.Override[BetaContainerReferenceParam](json.RawMessage(r.RawJSON()))
+}
+
+// The properties ContainerID, Type are required.
+type BetaContainerReferenceParam struct {
+ // The ID of the referenced container.
+ ContainerID string `json:"container_id" api:"required"`
+ // References a container created with the /v1/containers endpoint
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "container_reference".
+ Type constant.ContainerReference `json:"type" default:"container_reference"`
+ paramObj
+}
+
+func (r BetaContainerReferenceParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaContainerReferenceParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaContainerReferenceParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A custom tool that processes input using a specified format. Learn more about
+// [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools)
+type BetaCustomTool struct {
+ // The name of the custom tool, used to identify it in tool calls.
+ Name string `json:"name" api:"required"`
+ // The type of the custom tool. Always `custom`.
+ Type constant.Custom `json:"type" default:"custom"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers" api:"nullable"`
+ // Whether this tool should be deferred and discovered via tool search.
+ DeferLoading bool `json:"defer_loading"`
+ // Optional description of the custom tool, used to provide more context.
+ Description string `json:"description"`
+ // The input format for the custom tool. Default is unconstrained text.
+ Format BetaCustomToolFormatUnion `json:"format"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Name respjson.Field
+ Type respjson.Field
+ AllowedCallers respjson.Field
+ DeferLoading respjson.Field
+ Description respjson.Field
+ Format respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaCustomTool) RawJSON() string { return r.JSON.raw }
+func (r *BetaCustomTool) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaCustomTool to a BetaCustomToolParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaCustomToolParam.Overrides()
+func (r BetaCustomTool) ToParam() BetaCustomToolParam {
+ return param.Override[BetaCustomToolParam](json.RawMessage(r.RawJSON()))
+}
+
+// BetaCustomToolFormatUnion contains all possible properties and values from
+// [BetaCustomToolFormatText], [BetaCustomToolFormatGrammar].
+//
+// Use the [BetaCustomToolFormatUnion.AsAny] method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaCustomToolFormatUnion struct {
+ // Any of "text", "grammar".
+ Type string `json:"type"`
+ // This field is from variant [BetaCustomToolFormatGrammar].
+ Definition string `json:"definition"`
+ // This field is from variant [BetaCustomToolFormatGrammar].
+ Syntax string `json:"syntax"`
+ JSON struct {
+ Type respjson.Field
+ Definition respjson.Field
+ Syntax respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaCustomToolFormat is implemented by each variant of
+// [BetaCustomToolFormatUnion] to add type safety for the return type of
+// [BetaCustomToolFormatUnion.AsAny]
+type anyBetaCustomToolFormat interface {
+ implBetaCustomToolFormatUnion()
+}
+
+func (BetaCustomToolFormatText) implBetaCustomToolFormatUnion() {}
+func (BetaCustomToolFormatGrammar) implBetaCustomToolFormatUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaCustomToolFormatUnion.AsAny().(type) {
+// case openai.BetaCustomToolFormatText:
+// case openai.BetaCustomToolFormatGrammar:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaCustomToolFormatUnion) AsAny() anyBetaCustomToolFormat {
+ switch u.Type {
+ case "text":
+ return u.AsText()
+ case "grammar":
+ return u.AsGrammar()
+ }
+ return nil
+}
+
+func (u BetaCustomToolFormatUnion) AsText() (v BetaCustomToolFormatText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaCustomToolFormatUnion) AsGrammar() (v BetaCustomToolFormatGrammar) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaCustomToolFormatUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaCustomToolFormatUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Unconstrained free-form text.
+type BetaCustomToolFormatText struct {
+ // Unconstrained text format. Always `text`.
+ Type constant.Text `json:"type" default:"text"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaCustomToolFormatText) RawJSON() string { return r.JSON.raw }
+func (r *BetaCustomToolFormatText) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A grammar defined by the user.
+type BetaCustomToolFormatGrammar struct {
+ // The grammar definition.
+ Definition string `json:"definition" api:"required"`
+ // The syntax of the grammar definition. One of `lark` or `regex`.
+ //
+ // Any of "lark", "regex".
+ Syntax string `json:"syntax" api:"required"`
+ // Grammar format. Always `grammar`.
+ Type constant.Grammar `json:"type" default:"grammar"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Definition respjson.Field
+ Syntax respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaCustomToolFormatGrammar) RawJSON() string { return r.JSON.raw }
+func (r *BetaCustomToolFormatGrammar) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A custom tool that processes input using a specified format. Learn more about
+// [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools)
+//
+// The properties Name, Type are required.
+type BetaCustomToolParam struct {
+ // The name of the custom tool, used to identify it in tool calls.
+ Name string `json:"name" api:"required"`
+ // Whether this tool should be deferred and discovered via tool search.
+ DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
+ // Optional description of the custom tool, used to provide more context.
+ Description param.Opt[string] `json:"description,omitzero"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers,omitzero"`
+ // The input format for the custom tool. Default is unconstrained text.
+ Format BetaCustomToolFormatUnionParam `json:"format,omitzero"`
+ // The type of the custom tool. Always `custom`.
+ //
+ // This field can be elided, and will marshal its zero value as "custom".
+ Type constant.Custom `json:"type" default:"custom"`
+ paramObj
+}
+
+func (r BetaCustomToolParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaCustomToolParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaCustomToolParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaCustomToolFormatUnionParam struct {
+ OfText *BetaCustomToolFormatTextParam `json:",omitzero,inline"`
+ OfGrammar *BetaCustomToolFormatGrammarParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaCustomToolFormatUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfText, u.OfGrammar)
+}
+func (u *BetaCustomToolFormatUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaCustomToolFormatUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfText) {
+ return u.OfText
+ } else if !param.IsOmitted(u.OfGrammar) {
+ return u.OfGrammar
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaCustomToolFormatUnionParam) GetDefinition() *string {
+ if vt := u.OfGrammar; vt != nil {
+ return &vt.Definition
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaCustomToolFormatUnionParam) GetSyntax() *string {
+ if vt := u.OfGrammar; vt != nil {
+ return &vt.Syntax
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaCustomToolFormatUnionParam) GetType() *string {
+ if vt := u.OfText; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfGrammar; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaCustomToolFormatUnionParam](
+ "type",
+ apijson.Discriminator[BetaCustomToolFormatTextParam]("text"),
+ apijson.Discriminator[BetaCustomToolFormatGrammarParam]("grammar"),
+ )
+}
+
+func NewBetaCustomToolFormatTextParam() BetaCustomToolFormatTextParam {
+ return BetaCustomToolFormatTextParam{
+ Type: "text",
+ }
+}
+
+// Unconstrained free-form text.
+//
+// This struct has a constant value, construct it with
+// [NewBetaCustomToolFormatTextParam].
+type BetaCustomToolFormatTextParam struct {
+ // Unconstrained text format. Always `text`.
+ Type constant.Text `json:"type" default:"text"`
+ paramObj
+}
+
+func (r BetaCustomToolFormatTextParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaCustomToolFormatTextParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaCustomToolFormatTextParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A grammar defined by the user.
+//
+// The properties Definition, Syntax, Type are required.
+type BetaCustomToolFormatGrammarParam struct {
+ // The grammar definition.
+ Definition string `json:"definition" api:"required"`
+ // The syntax of the grammar definition. One of `lark` or `regex`.
+ //
+ // Any of "lark", "regex".
+ Syntax string `json:"syntax,omitzero" api:"required"`
+ // Grammar format. Always `grammar`.
+ //
+ // This field can be elided, and will marshal its zero value as "grammar".
+ Type constant.Grammar `json:"type" default:"grammar"`
+ paramObj
+}
+
+func (r BetaCustomToolFormatGrammarParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaCustomToolFormatGrammarParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaCustomToolFormatGrammarParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaCustomToolFormatGrammarParam](
+ "syntax", "lark", "regex",
+ )
+}
+
+// A message input to the model with a role indicating instruction following
+// hierarchy. Instructions given with the `developer` or `system` role take
+// precedence over instructions given with the `user` role. Messages with the
+// `assistant` role are presumed to have been generated by the model in previous
+// interactions.
+type BetaEasyInputMessage struct {
+ // Text, image, or audio input to the model, used to generate a response. Can also
+ // contain previous assistant responses.
+ Content BetaEasyInputMessageContentUnion `json:"content" api:"required"`
+ // The role of the message input. One of `user`, `assistant`, `system`, or
+ // `developer`.
+ //
+ // Any of "user", "assistant", "system", "developer".
+ Role BetaEasyInputMessageRole `json:"role" api:"required"`
+ // Labels an `assistant` message as intermediate commentary (`commentary`) or the
+ // final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when
+ // sending follow-up requests, preserve and resend phase on all assistant messages
+ // — dropping it can degrade performance. Not used for user messages.
+ //
+ // Any of "commentary", "final_answer".
+ Phase BetaEasyInputMessagePhase `json:"phase" api:"nullable"`
+ // The type of the message input. Always `message`.
+ //
+ // Any of "message".
+ Type BetaEasyInputMessageType `json:"type"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Content respjson.Field
+ Role respjson.Field
+ Phase respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaEasyInputMessage) RawJSON() string { return r.JSON.raw }
+func (r *BetaEasyInputMessage) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaEasyInputMessage to a BetaEasyInputMessageParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaEasyInputMessageParam.Overrides()
+func (r BetaEasyInputMessage) ToParam() BetaEasyInputMessageParam {
+ return param.Override[BetaEasyInputMessageParam](json.RawMessage(r.RawJSON()))
+}
+
+// BetaEasyInputMessageContentUnion contains all possible properties and values
+// from [string], [BetaResponseInputMessageContentList].
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString OfInputItemContentList]
+type BetaEasyInputMessageContentUnion struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a
+ // [BetaResponseInputMessageContentList] instead of an object.
+ OfInputItemContentList BetaResponseInputMessageContentList `json:",inline"`
+ JSON struct {
+ OfString respjson.Field
+ OfInputItemContentList respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u BetaEasyInputMessageContentUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaEasyInputMessageContentUnion) AsInputItemContentList() (v BetaResponseInputMessageContentList) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaEasyInputMessageContentUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaEasyInputMessageContentUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The role of the message input. One of `user`, `assistant`, `system`, or
+// `developer`.
+type BetaEasyInputMessageRole string
+
+const (
+ BetaEasyInputMessageRoleUser BetaEasyInputMessageRole = "user"
+ BetaEasyInputMessageRoleAssistant BetaEasyInputMessageRole = "assistant"
+ BetaEasyInputMessageRoleSystem BetaEasyInputMessageRole = "system"
+ BetaEasyInputMessageRoleDeveloper BetaEasyInputMessageRole = "developer"
+)
+
+// Labels an `assistant` message as intermediate commentary (`commentary`) or the
+// final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when
+// sending follow-up requests, preserve and resend phase on all assistant messages
+// — dropping it can degrade performance. Not used for user messages.
+type BetaEasyInputMessagePhase string
+
+const (
+ BetaEasyInputMessagePhaseCommentary BetaEasyInputMessagePhase = "commentary"
+ BetaEasyInputMessagePhaseFinalAnswer BetaEasyInputMessagePhase = "final_answer"
+)
+
+// The type of the message input. Always `message`.
+type BetaEasyInputMessageType string
+
+const (
+ BetaEasyInputMessageTypeMessage BetaEasyInputMessageType = "message"
+)
+
+// A message input to the model with a role indicating instruction following
+// hierarchy. Instructions given with the `developer` or `system` role take
+// precedence over instructions given with the `user` role. Messages with the
+// `assistant` role are presumed to have been generated by the model in previous
+// interactions.
+//
+// The properties Content, Role are required.
+type BetaEasyInputMessageParam struct {
+ // Text, image, or audio input to the model, used to generate a response. Can also
+ // contain previous assistant responses.
+ Content BetaEasyInputMessageContentUnionParam `json:"content,omitzero" api:"required"`
+ // The role of the message input. One of `user`, `assistant`, `system`, or
+ // `developer`.
+ //
+ // Any of "user", "assistant", "system", "developer".
+ Role BetaEasyInputMessageRole `json:"role,omitzero" api:"required"`
+ // Labels an `assistant` message as intermediate commentary (`commentary`) or the
+ // final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when
+ // sending follow-up requests, preserve and resend phase on all assistant messages
+ // — dropping it can degrade performance. Not used for user messages.
+ //
+ // Any of "commentary", "final_answer".
+ Phase BetaEasyInputMessagePhase `json:"phase,omitzero"`
+ // The type of the message input. Always `message`.
+ //
+ // Any of "message".
+ Type BetaEasyInputMessageType `json:"type,omitzero"`
+ paramObj
+}
+
+func (r BetaEasyInputMessageParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaEasyInputMessageParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaEasyInputMessageParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaEasyInputMessageContentUnionParam struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfInputItemContentList BetaResponseInputMessageContentListParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaEasyInputMessageContentUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfInputItemContentList)
+}
+func (u *BetaEasyInputMessageContentUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaEasyInputMessageContentUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfInputItemContentList) {
+ return &u.OfInputItemContentList
+ }
+ return nil
+}
+
+// A tool that searches for relevant content from uploaded files. Learn more about
+// the
+// [file search tool](https://platform.openai.com/docs/guides/tools-file-search).
+type BetaFileSearchTool struct {
+ // The type of the file search tool. Always `file_search`.
+ Type constant.FileSearch `json:"type" default:"file_search"`
+ // The IDs of the vector stores to search.
+ VectorStoreIDs []string `json:"vector_store_ids" api:"required"`
+ // A filter to apply.
+ Filters BetaFileSearchToolFiltersUnion `json:"filters" api:"nullable"`
+ // The maximum number of results to return. This number should be between 1 and 50
+ // inclusive.
+ MaxNumResults int64 `json:"max_num_results"`
+ // Ranking options for search.
+ RankingOptions BetaFileSearchToolRankingOptions `json:"ranking_options"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ VectorStoreIDs respjson.Field
+ Filters respjson.Field
+ MaxNumResults respjson.Field
+ RankingOptions respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaFileSearchTool) RawJSON() string { return r.JSON.raw }
+func (r *BetaFileSearchTool) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaFileSearchTool to a BetaFileSearchToolParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaFileSearchToolParam.Overrides()
+func (r BetaFileSearchTool) ToParam() BetaFileSearchToolParam {
+ return param.Override[BetaFileSearchToolParam](json.RawMessage(r.RawJSON()))
+}
+
+// BetaFileSearchToolFiltersUnion contains all possible properties and values from
+// [BetaFileSearchToolFiltersComparisonFilter],
+// [BetaFileSearchToolFiltersCompoundFilter].
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaFileSearchToolFiltersUnion struct {
+ // This field is from variant [BetaFileSearchToolFiltersComparisonFilter].
+ Key string `json:"key"`
+ Type string `json:"type"`
+ // This field is from variant [BetaFileSearchToolFiltersComparisonFilter].
+ Value BetaFileSearchToolFiltersComparisonFilterValueUnion `json:"value"`
+ // This field is from variant [BetaFileSearchToolFiltersCompoundFilter].
+ Filters []BetaFileSearchToolFiltersCompoundFilterFilter `json:"filters"`
+ JSON struct {
+ Key respjson.Field
+ Type respjson.Field
+ Value respjson.Field
+ Filters respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u BetaFileSearchToolFiltersUnion) AsComparisonFilter() (v BetaFileSearchToolFiltersComparisonFilter) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaFileSearchToolFiltersUnion) AsCompoundFilter() (v BetaFileSearchToolFiltersCompoundFilter) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaFileSearchToolFiltersUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaFileSearchToolFiltersUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A filter used to compare a specified attribute key to a given value using a
+// defined comparison operation.
+type BetaFileSearchToolFiltersComparisonFilter struct {
+ // The key to compare against the value.
+ Key string `json:"key" api:"required"`
+ // Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`,
+ // `nin`.
+ //
+ // - `eq`: equals
+ // - `ne`: not equal
+ // - `gt`: greater than
+ // - `gte`: greater than or equal
+ // - `lt`: less than
+ // - `lte`: less than or equal
+ // - `in`: in
+ // - `nin`: not in
+ //
+ // Any of "eq", "ne", "gt", "gte", "lt", "lte", "in", "nin".
+ Type string `json:"type" api:"required"`
+ // The value to compare against the attribute key; supports string, number, or
+ // boolean types.
+ Value BetaFileSearchToolFiltersComparisonFilterValueUnion `json:"value" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Key respjson.Field
+ Type respjson.Field
+ Value respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaFileSearchToolFiltersComparisonFilter) RawJSON() string { return r.JSON.raw }
+func (r *BetaFileSearchToolFiltersComparisonFilter) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaFileSearchToolFiltersComparisonFilterValueUnion contains all possible
+// properties and values from [string], [float64], [bool],
+// [[]BetaFileSearchToolFiltersComparisonFilterValueArrayItemUnion].
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString OfFloat OfBool
+// OfBetaFileSearchToolFiltersComparisonFilterValueArray]
+type BetaFileSearchToolFiltersComparisonFilterValueUnion struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaFileSearchToolFiltersComparisonFilterValueArrayItemUnion] instead of an
+ // object.
+ OfBetaFileSearchToolFiltersComparisonFilterValueArray []BetaFileSearchToolFiltersComparisonFilterValueArrayItemUnion `json:",inline"`
+ JSON struct {
+ OfString respjson.Field
+ OfFloat respjson.Field
+ OfBool respjson.Field
+ OfBetaFileSearchToolFiltersComparisonFilterValueArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u BetaFileSearchToolFiltersComparisonFilterValueUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaFileSearchToolFiltersComparisonFilterValueUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaFileSearchToolFiltersComparisonFilterValueUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaFileSearchToolFiltersComparisonFilterValueUnion) AsBetaFileSearchToolFiltersComparisonFilterValueArray() (v []BetaFileSearchToolFiltersComparisonFilterValueArrayItemUnion) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaFileSearchToolFiltersComparisonFilterValueUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaFileSearchToolFiltersComparisonFilterValueUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaFileSearchToolFiltersComparisonFilterValueArrayItemUnion contains all
+// possible properties and values from [string], [float64].
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString OfFloat]
+type BetaFileSearchToolFiltersComparisonFilterValueArrayItemUnion struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ JSON struct {
+ OfString respjson.Field
+ OfFloat respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u BetaFileSearchToolFiltersComparisonFilterValueArrayItemUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaFileSearchToolFiltersComparisonFilterValueArrayItemUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaFileSearchToolFiltersComparisonFilterValueArrayItemUnion) RawJSON() string {
+ return u.JSON.raw
+}
+
+func (r *BetaFileSearchToolFiltersComparisonFilterValueArrayItemUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Combine multiple filters using `and` or `or`.
+type BetaFileSearchToolFiltersCompoundFilter struct {
+ // Array of filters to combine. Items can be `ComparisonFilter` or
+ // `CompoundFilter`.
+ Filters []BetaFileSearchToolFiltersCompoundFilterFilter `json:"filters" api:"required"`
+ // Type of operation: `and` or `or`.
+ //
+ // Any of "and", "or".
+ Type string `json:"type" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Filters respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaFileSearchToolFiltersCompoundFilter) RawJSON() string { return r.JSON.raw }
+func (r *BetaFileSearchToolFiltersCompoundFilter) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A filter used to compare a specified attribute key to a given value using a
+// defined comparison operation.
+type BetaFileSearchToolFiltersCompoundFilterFilter struct {
+ // The key to compare against the value.
+ Key string `json:"key" api:"required"`
+ // Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`,
+ // `nin`.
+ //
+ // - `eq`: equals
+ // - `ne`: not equal
+ // - `gt`: greater than
+ // - `gte`: greater than or equal
+ // - `lt`: less than
+ // - `lte`: less than or equal
+ // - `in`: in
+ // - `nin`: not in
+ //
+ // Any of "eq", "ne", "gt", "gte", "lt", "lte", "in", "nin".
+ Type string `json:"type" api:"required"`
+ // The value to compare against the attribute key; supports string, number, or
+ // boolean types.
+ Value BetaFileSearchToolFiltersCompoundFilterFilterValueUnion `json:"value" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Key respjson.Field
+ Type respjson.Field
+ Value respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaFileSearchToolFiltersCompoundFilterFilter) RawJSON() string { return r.JSON.raw }
+func (r *BetaFileSearchToolFiltersCompoundFilterFilter) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaFileSearchToolFiltersCompoundFilterFilterValueUnion contains all possible
+// properties and values from [string], [float64], [bool],
+// [[]BetaFileSearchToolFiltersCompoundFilterFilterValueArrayItemUnion].
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString OfFloat OfBool
+// OfBetaFileSearchToolFiltersCompoundFilterFilterValueArray]
+type BetaFileSearchToolFiltersCompoundFilterFilterValueUnion struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaFileSearchToolFiltersCompoundFilterFilterValueArrayItemUnion] instead of
+ // an object.
+ OfBetaFileSearchToolFiltersCompoundFilterFilterValueArray []BetaFileSearchToolFiltersCompoundFilterFilterValueArrayItemUnion `json:",inline"`
+ JSON struct {
+ OfString respjson.Field
+ OfFloat respjson.Field
+ OfBool respjson.Field
+ OfBetaFileSearchToolFiltersCompoundFilterFilterValueArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u BetaFileSearchToolFiltersCompoundFilterFilterValueUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaFileSearchToolFiltersCompoundFilterFilterValueUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaFileSearchToolFiltersCompoundFilterFilterValueUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaFileSearchToolFiltersCompoundFilterFilterValueUnion) AsBetaFileSearchToolFiltersCompoundFilterFilterValueArray() (v []BetaFileSearchToolFiltersCompoundFilterFilterValueArrayItemUnion) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaFileSearchToolFiltersCompoundFilterFilterValueUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaFileSearchToolFiltersCompoundFilterFilterValueUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaFileSearchToolFiltersCompoundFilterFilterValueArrayItemUnion contains all
+// possible properties and values from [string], [float64].
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString OfFloat]
+type BetaFileSearchToolFiltersCompoundFilterFilterValueArrayItemUnion struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ JSON struct {
+ OfString respjson.Field
+ OfFloat respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u BetaFileSearchToolFiltersCompoundFilterFilterValueArrayItemUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaFileSearchToolFiltersCompoundFilterFilterValueArrayItemUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaFileSearchToolFiltersCompoundFilterFilterValueArrayItemUnion) RawJSON() string {
+ return u.JSON.raw
+}
+
+func (r *BetaFileSearchToolFiltersCompoundFilterFilterValueArrayItemUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Ranking options for search.
+type BetaFileSearchToolRankingOptions struct {
+ // Weights that control how reciprocal rank fusion balances semantic embedding
+ // matches versus sparse keyword matches when hybrid search is enabled.
+ HybridSearch BetaFileSearchToolRankingOptionsHybridSearch `json:"hybrid_search"`
+ // The ranker to use for the file search.
+ //
+ // Any of "auto", "default-2024-11-15".
+ Ranker string `json:"ranker"`
+ // The score threshold for the file search, a number between 0 and 1. Numbers
+ // closer to 1 will attempt to return only the most relevant results, but may
+ // return fewer results.
+ ScoreThreshold float64 `json:"score_threshold"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ HybridSearch respjson.Field
+ Ranker respjson.Field
+ ScoreThreshold respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaFileSearchToolRankingOptions) RawJSON() string { return r.JSON.raw }
+func (r *BetaFileSearchToolRankingOptions) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Weights that control how reciprocal rank fusion balances semantic embedding
+// matches versus sparse keyword matches when hybrid search is enabled.
+type BetaFileSearchToolRankingOptionsHybridSearch struct {
+ // The weight of the embedding in the reciprocal ranking fusion.
+ EmbeddingWeight float64 `json:"embedding_weight" api:"required"`
+ // The weight of the text in the reciprocal ranking fusion.
+ TextWeight float64 `json:"text_weight" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ EmbeddingWeight respjson.Field
+ TextWeight respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaFileSearchToolRankingOptionsHybridSearch) RawJSON() string { return r.JSON.raw }
+func (r *BetaFileSearchToolRankingOptionsHybridSearch) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool that searches for relevant content from uploaded files. Learn more about
+// the
+// [file search tool](https://platform.openai.com/docs/guides/tools-file-search).
+//
+// The properties Type, VectorStoreIDs are required.
+type BetaFileSearchToolParam struct {
+ // The IDs of the vector stores to search.
+ VectorStoreIDs []string `json:"vector_store_ids,omitzero" api:"required"`
+ // The maximum number of results to return. This number should be between 1 and 50
+ // inclusive.
+ MaxNumResults param.Opt[int64] `json:"max_num_results,omitzero"`
+ // A filter to apply.
+ Filters BetaFileSearchToolFiltersUnionParam `json:"filters,omitzero"`
+ // Ranking options for search.
+ RankingOptions BetaFileSearchToolRankingOptionsParam `json:"ranking_options,omitzero"`
+ // The type of the file search tool. Always `file_search`.
+ //
+ // This field can be elided, and will marshal its zero value as "file_search".
+ Type constant.FileSearch `json:"type" default:"file_search"`
+ paramObj
+}
+
+func (r BetaFileSearchToolParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaFileSearchToolParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaFileSearchToolParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaFileSearchToolFiltersUnionParam struct {
+ OfComparisonFilter *BetaFileSearchToolFiltersComparisonFilterParam `json:",omitzero,inline"`
+ OfCompoundFilter *BetaFileSearchToolFiltersCompoundFilterParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaFileSearchToolFiltersUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfComparisonFilter, u.OfCompoundFilter)
+}
+func (u *BetaFileSearchToolFiltersUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaFileSearchToolFiltersUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfComparisonFilter) {
+ return u.OfComparisonFilter
+ } else if !param.IsOmitted(u.OfCompoundFilter) {
+ return u.OfCompoundFilter
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaFileSearchToolFiltersUnionParam) GetKey() *string {
+ if vt := u.OfComparisonFilter; vt != nil {
+ return &vt.Key
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaFileSearchToolFiltersUnionParam) GetValue() *BetaFileSearchToolFiltersComparisonFilterValueUnionParam {
+ if vt := u.OfComparisonFilter; vt != nil {
+ return &vt.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaFileSearchToolFiltersUnionParam) GetFilters() []BetaFileSearchToolFiltersCompoundFilterFilterParam {
+ if vt := u.OfCompoundFilter; vt != nil {
+ return vt.Filters
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaFileSearchToolFiltersUnionParam) GetType() *string {
+ if vt := u.OfComparisonFilter; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfCompoundFilter; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// A filter used to compare a specified attribute key to a given value using a
+// defined comparison operation.
+//
+// The properties Key, Type, Value are required.
+type BetaFileSearchToolFiltersComparisonFilterParam struct {
+ // The key to compare against the value.
+ Key string `json:"key" api:"required"`
+ // Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`,
+ // `nin`.
+ //
+ // - `eq`: equals
+ // - `ne`: not equal
+ // - `gt`: greater than
+ // - `gte`: greater than or equal
+ // - `lt`: less than
+ // - `lte`: less than or equal
+ // - `in`: in
+ // - `nin`: not in
+ //
+ // Any of "eq", "ne", "gt", "gte", "lt", "lte", "in", "nin".
+ Type string `json:"type,omitzero" api:"required"`
+ // The value to compare against the attribute key; supports string, number, or
+ // boolean types.
+ Value BetaFileSearchToolFiltersComparisonFilterValueUnionParam `json:"value,omitzero" api:"required"`
+ paramObj
+}
+
+func (r BetaFileSearchToolFiltersComparisonFilterParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaFileSearchToolFiltersComparisonFilterParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaFileSearchToolFiltersComparisonFilterParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaFileSearchToolFiltersComparisonFilterParam](
+ "type", "eq", "ne", "gt", "gte", "lt", "lte", "in", "nin",
+ )
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaFileSearchToolFiltersComparisonFilterValueUnionParam struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ OfBool param.Opt[bool] `json:",omitzero,inline"`
+ OfBetaFileSearchToolFiltersComparisonFilterValueArray []BetaFileSearchToolFiltersComparisonFilterValueArrayItemUnionParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaFileSearchToolFiltersComparisonFilterValueUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfFloat, u.OfBool, u.OfBetaFileSearchToolFiltersComparisonFilterValueArray)
+}
+func (u *BetaFileSearchToolFiltersComparisonFilterValueUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaFileSearchToolFiltersComparisonFilterValueUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ } else if !param.IsOmitted(u.OfBool) {
+ return &u.OfBool.Value
+ } else if !param.IsOmitted(u.OfBetaFileSearchToolFiltersComparisonFilterValueArray) {
+ return &u.OfBetaFileSearchToolFiltersComparisonFilterValueArray
+ }
+ return nil
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaFileSearchToolFiltersComparisonFilterValueArrayItemUnionParam struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaFileSearchToolFiltersComparisonFilterValueArrayItemUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfFloat)
+}
+func (u *BetaFileSearchToolFiltersComparisonFilterValueArrayItemUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaFileSearchToolFiltersComparisonFilterValueArrayItemUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ }
+ return nil
+}
+
+// Combine multiple filters using `and` or `or`.
+//
+// The properties Filters, Type are required.
+type BetaFileSearchToolFiltersCompoundFilterParam struct {
+ // Array of filters to combine. Items can be `ComparisonFilter` or
+ // `CompoundFilter`.
+ Filters []BetaFileSearchToolFiltersCompoundFilterFilterParam `json:"filters,omitzero" api:"required"`
+ // Type of operation: `and` or `or`.
+ //
+ // Any of "and", "or".
+ Type string `json:"type,omitzero" api:"required"`
+ paramObj
+}
+
+func (r BetaFileSearchToolFiltersCompoundFilterParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaFileSearchToolFiltersCompoundFilterParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaFileSearchToolFiltersCompoundFilterParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaFileSearchToolFiltersCompoundFilterParam](
+ "type", "and", "or",
+ )
+}
+
+// A filter used to compare a specified attribute key to a given value using a
+// defined comparison operation.
+//
+// The properties Key, Type, Value are required.
+type BetaFileSearchToolFiltersCompoundFilterFilterParam struct {
+ // The key to compare against the value.
+ Key string `json:"key" api:"required"`
+ // Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`,
+ // `nin`.
+ //
+ // - `eq`: equals
+ // - `ne`: not equal
+ // - `gt`: greater than
+ // - `gte`: greater than or equal
+ // - `lt`: less than
+ // - `lte`: less than or equal
+ // - `in`: in
+ // - `nin`: not in
+ //
+ // Any of "eq", "ne", "gt", "gte", "lt", "lte", "in", "nin".
+ Type string `json:"type,omitzero" api:"required"`
+ // The value to compare against the attribute key; supports string, number, or
+ // boolean types.
+ Value BetaFileSearchToolFiltersCompoundFilterFilterValueUnionParam `json:"value,omitzero" api:"required"`
+ paramObj
+}
+
+func (r BetaFileSearchToolFiltersCompoundFilterFilterParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaFileSearchToolFiltersCompoundFilterFilterParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaFileSearchToolFiltersCompoundFilterFilterParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaFileSearchToolFiltersCompoundFilterFilterParam](
+ "type", "eq", "ne", "gt", "gte", "lt", "lte", "in", "nin",
+ )
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaFileSearchToolFiltersCompoundFilterFilterValueUnionParam struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ OfBool param.Opt[bool] `json:",omitzero,inline"`
+ OfBetaFileSearchToolFiltersCompoundFilterFilterValueArray []BetaFileSearchToolFiltersCompoundFilterFilterValueArrayItemUnionParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaFileSearchToolFiltersCompoundFilterFilterValueUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfFloat, u.OfBool, u.OfBetaFileSearchToolFiltersCompoundFilterFilterValueArray)
+}
+func (u *BetaFileSearchToolFiltersCompoundFilterFilterValueUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaFileSearchToolFiltersCompoundFilterFilterValueUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ } else if !param.IsOmitted(u.OfBool) {
+ return &u.OfBool.Value
+ } else if !param.IsOmitted(u.OfBetaFileSearchToolFiltersCompoundFilterFilterValueArray) {
+ return &u.OfBetaFileSearchToolFiltersCompoundFilterFilterValueArray
+ }
+ return nil
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaFileSearchToolFiltersCompoundFilterFilterValueArrayItemUnionParam struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaFileSearchToolFiltersCompoundFilterFilterValueArrayItemUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfFloat)
+}
+func (u *BetaFileSearchToolFiltersCompoundFilterFilterValueArrayItemUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaFileSearchToolFiltersCompoundFilterFilterValueArrayItemUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ }
+ return nil
+}
+
+// Ranking options for search.
+type BetaFileSearchToolRankingOptionsParam struct {
+ // The score threshold for the file search, a number between 0 and 1. Numbers
+ // closer to 1 will attempt to return only the most relevant results, but may
+ // return fewer results.
+ ScoreThreshold param.Opt[float64] `json:"score_threshold,omitzero"`
+ // Weights that control how reciprocal rank fusion balances semantic embedding
+ // matches versus sparse keyword matches when hybrid search is enabled.
+ HybridSearch BetaFileSearchToolRankingOptionsHybridSearchParam `json:"hybrid_search,omitzero"`
+ // The ranker to use for the file search.
+ //
+ // Any of "auto", "default-2024-11-15".
+ Ranker string `json:"ranker,omitzero"`
+ paramObj
+}
+
+func (r BetaFileSearchToolRankingOptionsParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaFileSearchToolRankingOptionsParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaFileSearchToolRankingOptionsParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaFileSearchToolRankingOptionsParam](
+ "ranker", "auto", "default-2024-11-15",
+ )
+}
+
+// Weights that control how reciprocal rank fusion balances semantic embedding
+// matches versus sparse keyword matches when hybrid search is enabled.
+//
+// The properties EmbeddingWeight, TextWeight are required.
+type BetaFileSearchToolRankingOptionsHybridSearchParam struct {
+ // The weight of the embedding in the reciprocal ranking fusion.
+ EmbeddingWeight float64 `json:"embedding_weight" api:"required"`
+ // The weight of the text in the reciprocal ranking fusion.
+ TextWeight float64 `json:"text_weight" api:"required"`
+ paramObj
+}
+
+func (r BetaFileSearchToolRankingOptionsHybridSearchParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaFileSearchToolRankingOptionsHybridSearchParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaFileSearchToolRankingOptionsHybridSearchParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool that allows the model to execute shell commands.
+type BetaFunctionShellTool struct {
+ // The type of the shell tool. Always `shell`.
+ Type constant.Shell `json:"type" default:"shell"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers" api:"nullable"`
+ Environment BetaFunctionShellToolEnvironmentUnion `json:"environment" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ AllowedCallers respjson.Field
+ Environment respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaFunctionShellTool) RawJSON() string { return r.JSON.raw }
+func (r *BetaFunctionShellTool) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaFunctionShellTool to a BetaFunctionShellToolParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaFunctionShellToolParam.Overrides()
+func (r BetaFunctionShellTool) ToParam() BetaFunctionShellToolParam {
+ return param.Override[BetaFunctionShellToolParam](json.RawMessage(r.RawJSON()))
+}
+
+// BetaFunctionShellToolEnvironmentUnion contains all possible properties and
+// values from [BetaContainerAuto], [BetaLocalEnvironment],
+// [BetaContainerReference].
+//
+// Use the [BetaFunctionShellToolEnvironmentUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaFunctionShellToolEnvironmentUnion struct {
+ // Any of "container_auto", "local", "container_reference".
+ Type string `json:"type"`
+ // This field is from variant [BetaContainerAuto].
+ FileIDs []string `json:"file_ids"`
+ // This field is from variant [BetaContainerAuto].
+ MemoryLimit BetaContainerAutoMemoryLimit `json:"memory_limit"`
+ // This field is from variant [BetaContainerAuto].
+ NetworkPolicy BetaContainerAutoNetworkPolicyUnion `json:"network_policy"`
+ // This field is a union of [[]BetaContainerAutoSkillUnion], [[]BetaLocalSkill]
+ Skills BetaFunctionShellToolEnvironmentUnionSkills `json:"skills"`
+ // This field is from variant [BetaContainerReference].
+ ContainerID string `json:"container_id"`
+ JSON struct {
+ Type respjson.Field
+ FileIDs respjson.Field
+ MemoryLimit respjson.Field
+ NetworkPolicy respjson.Field
+ Skills respjson.Field
+ ContainerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaFunctionShellToolEnvironment is implemented by each variant of
+// [BetaFunctionShellToolEnvironmentUnion] to add type safety for the return type
+// of [BetaFunctionShellToolEnvironmentUnion.AsAny]
+type anyBetaFunctionShellToolEnvironment interface {
+ implBetaFunctionShellToolEnvironmentUnion()
+}
+
+func (BetaContainerAuto) implBetaFunctionShellToolEnvironmentUnion() {}
+func (BetaLocalEnvironment) implBetaFunctionShellToolEnvironmentUnion() {}
+func (BetaContainerReference) implBetaFunctionShellToolEnvironmentUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaFunctionShellToolEnvironmentUnion.AsAny().(type) {
+// case openai.BetaContainerAuto:
+// case openai.BetaLocalEnvironment:
+// case openai.BetaContainerReference:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaFunctionShellToolEnvironmentUnion) AsAny() anyBetaFunctionShellToolEnvironment {
+ switch u.Type {
+ case "container_auto":
+ return u.AsContainerAuto()
+ case "local":
+ return u.AsLocal()
+ case "container_reference":
+ return u.AsContainerReference()
+ }
+ return nil
+}
+
+func (u BetaFunctionShellToolEnvironmentUnion) AsContainerAuto() (v BetaContainerAuto) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaFunctionShellToolEnvironmentUnion) AsLocal() (v BetaLocalEnvironment) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaFunctionShellToolEnvironmentUnion) AsContainerReference() (v BetaContainerReference) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaFunctionShellToolEnvironmentUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaFunctionShellToolEnvironmentUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaFunctionShellToolEnvironmentUnionSkills is an implicit subunion of
+// [BetaFunctionShellToolEnvironmentUnion].
+// BetaFunctionShellToolEnvironmentUnionSkills provides convenient access to the
+// sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaFunctionShellToolEnvironmentUnion].
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfBetaContainerAutoSkills OfBetaLocalSkillArray]
+type BetaFunctionShellToolEnvironmentUnionSkills struct {
+ // This field will be present if the value is a [[]BetaContainerAutoSkillUnion]
+ // instead of an object.
+ OfBetaContainerAutoSkills []BetaContainerAutoSkillUnion `json:",inline"`
+ // This field will be present if the value is a [[]BetaLocalSkill] instead of an
+ // object.
+ OfBetaLocalSkillArray []BetaLocalSkill `json:",inline"`
+ JSON struct {
+ OfBetaContainerAutoSkills respjson.Field
+ OfBetaLocalSkillArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaFunctionShellToolEnvironmentUnionSkills) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool that allows the model to execute shell commands.
+//
+// The property Type is required.
+type BetaFunctionShellToolParam struct {
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers,omitzero"`
+ Environment BetaFunctionShellToolEnvironmentUnionParam `json:"environment,omitzero"`
+ // The type of the shell tool. Always `shell`.
+ //
+ // This field can be elided, and will marshal its zero value as "shell".
+ Type constant.Shell `json:"type" default:"shell"`
+ paramObj
+}
+
+func (r BetaFunctionShellToolParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaFunctionShellToolParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaFunctionShellToolParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaFunctionShellToolEnvironmentUnionParam struct {
+ OfContainerAuto *BetaContainerAutoParam `json:",omitzero,inline"`
+ OfLocal *BetaLocalEnvironmentParam `json:",omitzero,inline"`
+ OfContainerReference *BetaContainerReferenceParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaFunctionShellToolEnvironmentUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfContainerAuto, u.OfLocal, u.OfContainerReference)
+}
+func (u *BetaFunctionShellToolEnvironmentUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaFunctionShellToolEnvironmentUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfContainerAuto) {
+ return u.OfContainerAuto
+ } else if !param.IsOmitted(u.OfLocal) {
+ return u.OfLocal
+ } else if !param.IsOmitted(u.OfContainerReference) {
+ return u.OfContainerReference
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaFunctionShellToolEnvironmentUnionParam) GetFileIDs() []string {
+ if vt := u.OfContainerAuto; vt != nil {
+ return vt.FileIDs
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaFunctionShellToolEnvironmentUnionParam) GetMemoryLimit() *string {
+ if vt := u.OfContainerAuto; vt != nil {
+ return (*string)(&vt.MemoryLimit)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaFunctionShellToolEnvironmentUnionParam) GetNetworkPolicy() *BetaContainerAutoNetworkPolicyUnionParam {
+ if vt := u.OfContainerAuto; vt != nil {
+ return &vt.NetworkPolicy
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaFunctionShellToolEnvironmentUnionParam) GetContainerID() *string {
+ if vt := u.OfContainerReference; vt != nil {
+ return &vt.ContainerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaFunctionShellToolEnvironmentUnionParam) GetType() *string {
+ if vt := u.OfContainerAuto; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfLocal; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfContainerReference; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u BetaFunctionShellToolEnvironmentUnionParam) GetSkills() (res betaFunctionShellToolEnvironmentUnionParamSkills) {
+ if vt := u.OfContainerAuto; vt != nil {
+ res.any = &vt.Skills
+ } else if vt := u.OfLocal; vt != nil {
+ res.any = &vt.Skills
+ }
+ return
+}
+
+// Can have the runtime types [_[]BetaContainerAutoSkillUnionParam],
+// [_[]BetaLocalSkillParam]
+type betaFunctionShellToolEnvironmentUnionParamSkills struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *[]openai.BetaContainerAutoSkillUnionParam:
+// case *[]openai.BetaLocalSkillParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u betaFunctionShellToolEnvironmentUnionParamSkills) AsAny() any { return u.any }
+
+func init() {
+ apijson.RegisterUnion[BetaFunctionShellToolEnvironmentUnionParam](
+ "type",
+ apijson.Discriminator[BetaContainerAutoParam]("container_auto"),
+ apijson.Discriminator[BetaLocalEnvironmentParam]("local"),
+ apijson.Discriminator[BetaContainerReferenceParam]("container_reference"),
+ )
+}
+
+// Defines a function in your own code the model can choose to call. Learn more
+// about
+// [function calling](https://platform.openai.com/docs/guides/function-calling).
+type BetaFunctionTool struct {
+ // The name of the function to call.
+ Name string `json:"name" api:"required"`
+ // A JSON schema object describing the parameters of the function.
+ Parameters map[string]any `json:"parameters" api:"required"`
+ // Whether strict parameter validation is enforced for this function tool.
+ Strict bool `json:"strict" api:"required"`
+ // The type of the function tool. Always `function`.
+ Type constant.Function `json:"type" default:"function"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers" api:"nullable"`
+ // Whether this function is deferred and loaded via tool search.
+ DeferLoading bool `json:"defer_loading"`
+ // A description of the function. Used by the model to determine whether or not to
+ // call the function.
+ Description string `json:"description" api:"nullable"`
+ // A JSON schema object describing the JSON value encoded in string outputs for
+ // this function.
+ OutputSchema map[string]any `json:"output_schema" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Name respjson.Field
+ Parameters respjson.Field
+ Strict respjson.Field
+ Type respjson.Field
+ AllowedCallers respjson.Field
+ DeferLoading respjson.Field
+ Description respjson.Field
+ OutputSchema respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaFunctionTool) RawJSON() string { return r.JSON.raw }
+func (r *BetaFunctionTool) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaFunctionTool to a BetaFunctionToolParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaFunctionToolParam.Overrides()
+func (r BetaFunctionTool) ToParam() BetaFunctionToolParam {
+ return param.Override[BetaFunctionToolParam](json.RawMessage(r.RawJSON()))
+}
+
+// Defines a function in your own code the model can choose to call. Learn more
+// about
+// [function calling](https://platform.openai.com/docs/guides/function-calling).
+//
+// The properties Name, Parameters, Strict, Type are required.
+type BetaFunctionToolParam struct {
+ // Whether strict parameter validation is enforced for this function tool.
+ Strict param.Opt[bool] `json:"strict,omitzero" api:"required"`
+ // A JSON schema object describing the parameters of the function.
+ Parameters map[string]any `json:"parameters,omitzero" api:"required"`
+ // The name of the function to call.
+ Name string `json:"name" api:"required"`
+ // A description of the function. Used by the model to determine whether or not to
+ // call the function.
+ Description param.Opt[string] `json:"description,omitzero"`
+ // Whether this function is deferred and loaded via tool search.
+ DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers,omitzero"`
+ // A JSON schema object describing the JSON value encoded in string outputs for
+ // this function.
+ OutputSchema map[string]any `json:"output_schema,omitzero"`
+ // The type of the function tool. Always `function`.
+ //
+ // This field can be elided, and will marshal its zero value as "function".
+ Type constant.Function `json:"type" default:"function"`
+ paramObj
+}
+
+func (r BetaFunctionToolParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaFunctionToolParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaFunctionToolParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaInlineSkill struct {
+ // The description of the skill.
+ Description string `json:"description" api:"required"`
+ // The name of the skill.
+ Name string `json:"name" api:"required"`
+ // Inline skill payload
+ Source BetaInlineSkillSource `json:"source" api:"required"`
+ // Defines an inline skill for this request.
+ Type constant.Inline `json:"type" default:"inline"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Description respjson.Field
+ Name respjson.Field
+ Source respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaInlineSkill) RawJSON() string { return r.JSON.raw }
+func (r *BetaInlineSkill) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaInlineSkill to a BetaInlineSkillParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaInlineSkillParam.Overrides()
+func (r BetaInlineSkill) ToParam() BetaInlineSkillParam {
+ return param.Override[BetaInlineSkillParam](json.RawMessage(r.RawJSON()))
+}
+
+// The properties Description, Name, Source, Type are required.
+type BetaInlineSkillParam struct {
+ // The description of the skill.
+ Description string `json:"description" api:"required"`
+ // The name of the skill.
+ Name string `json:"name" api:"required"`
+ // Inline skill payload
+ Source BetaInlineSkillSourceParam `json:"source,omitzero" api:"required"`
+ // Defines an inline skill for this request.
+ //
+ // This field can be elided, and will marshal its zero value as "inline".
+ Type constant.Inline `json:"type" default:"inline"`
+ paramObj
+}
+
+func (r BetaInlineSkillParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaInlineSkillParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaInlineSkillParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Inline skill payload
+type BetaInlineSkillSource struct {
+ // Base64-encoded skill zip bundle.
+ Data string `json:"data" api:"required"`
+ // The media type of the inline skill payload. Must be `application/zip`.
+ MediaType constant.ApplicationZip `json:"media_type" default:"application/zip"`
+ // The type of the inline skill source. Must be `base64`.
+ Type constant.Base64 `json:"type" default:"base64"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Data respjson.Field
+ MediaType respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaInlineSkillSource) RawJSON() string { return r.JSON.raw }
+func (r *BetaInlineSkillSource) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaInlineSkillSource to a BetaInlineSkillSourceParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaInlineSkillSourceParam.Overrides()
+func (r BetaInlineSkillSource) ToParam() BetaInlineSkillSourceParam {
+ return param.Override[BetaInlineSkillSourceParam](json.RawMessage(r.RawJSON()))
+}
+
+// Inline skill payload
+//
+// The properties Data, MediaType, Type are required.
+type BetaInlineSkillSourceParam struct {
+ // Base64-encoded skill zip bundle.
+ Data string `json:"data" api:"required"`
+ // The media type of the inline skill payload. Must be `application/zip`.
+ //
+ // This field can be elided, and will marshal its zero value as "application/zip".
+ MediaType constant.ApplicationZip `json:"media_type" default:"application/zip"`
+ // The type of the inline skill source. Must be `base64`.
+ //
+ // This field can be elided, and will marshal its zero value as "base64".
+ Type constant.Base64 `json:"type" default:"base64"`
+ paramObj
+}
+
+func (r BetaInlineSkillSourceParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaInlineSkillSourceParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaInlineSkillSourceParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaLocalEnvironment struct {
+ // Use a local computer environment.
+ Type constant.Local `json:"type" default:"local"`
+ // An optional list of skills.
+ Skills []BetaLocalSkill `json:"skills"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ Skills respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaLocalEnvironment) RawJSON() string { return r.JSON.raw }
+func (r *BetaLocalEnvironment) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaLocalEnvironment to a BetaLocalEnvironmentParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaLocalEnvironmentParam.Overrides()
+func (r BetaLocalEnvironment) ToParam() BetaLocalEnvironmentParam {
+ return param.Override[BetaLocalEnvironmentParam](json.RawMessage(r.RawJSON()))
+}
+
+// The property Type is required.
+type BetaLocalEnvironmentParam struct {
+ // An optional list of skills.
+ Skills []BetaLocalSkillParam `json:"skills,omitzero"`
+ // Use a local computer environment.
+ //
+ // This field can be elided, and will marshal its zero value as "local".
+ Type constant.Local `json:"type" default:"local"`
+ paramObj
+}
+
+func (r BetaLocalEnvironmentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaLocalEnvironmentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaLocalEnvironmentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaLocalSkill struct {
+ // The description of the skill.
+ Description string `json:"description" api:"required"`
+ // The name of the skill.
+ Name string `json:"name" api:"required"`
+ // The path to the directory containing the skill.
+ Path string `json:"path" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Description respjson.Field
+ Name respjson.Field
+ Path respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaLocalSkill) RawJSON() string { return r.JSON.raw }
+func (r *BetaLocalSkill) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaLocalSkill to a BetaLocalSkillParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaLocalSkillParam.Overrides()
+func (r BetaLocalSkill) ToParam() BetaLocalSkillParam {
+ return param.Override[BetaLocalSkillParam](json.RawMessage(r.RawJSON()))
+}
+
+// The properties Description, Name, Path are required.
+type BetaLocalSkillParam struct {
+ // The description of the skill.
+ Description string `json:"description" api:"required"`
+ // The name of the skill.
+ Name string `json:"name" api:"required"`
+ // The path to the directory containing the skill.
+ Path string `json:"path" api:"required"`
+ paramObj
+}
+
+func (r BetaLocalSkillParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaLocalSkillParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaLocalSkillParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Groups function/custom tools under a shared namespace.
+type BetaNamespaceTool struct {
+ // A description of the namespace shown to the model.
+ Description string `json:"description" api:"required"`
+ // The namespace name used in tool calls (for example, `crm`).
+ Name string `json:"name" api:"required"`
+ // The function/custom tools available inside this namespace.
+ Tools []BetaNamespaceToolToolUnion `json:"tools" api:"required"`
+ // The type of the tool. Always `namespace`.
+ Type constant.Namespace `json:"type" default:"namespace"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Description respjson.Field
+ Name respjson.Field
+ Tools respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaNamespaceTool) RawJSON() string { return r.JSON.raw }
+func (r *BetaNamespaceTool) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaNamespaceTool to a BetaNamespaceToolParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaNamespaceToolParam.Overrides()
+func (r BetaNamespaceTool) ToParam() BetaNamespaceToolParam {
+ return param.Override[BetaNamespaceToolParam](json.RawMessage(r.RawJSON()))
+}
+
+// BetaNamespaceToolToolUnion contains all possible properties and values from
+// [BetaNamespaceToolToolFunction], [BetaCustomTool].
+//
+// Use the [BetaNamespaceToolToolUnion.AsAny] method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaNamespaceToolToolUnion struct {
+ Name string `json:"name"`
+ // Any of "function", "custom".
+ Type string `json:"type"`
+ AllowedCallers []string `json:"allowed_callers"`
+ DeferLoading bool `json:"defer_loading"`
+ Description string `json:"description"`
+ // This field is from variant [BetaNamespaceToolToolFunction].
+ OutputSchema map[string]any `json:"output_schema"`
+ // This field is from variant [BetaNamespaceToolToolFunction].
+ Parameters any `json:"parameters"`
+ // This field is from variant [BetaNamespaceToolToolFunction].
+ Strict bool `json:"strict"`
+ // This field is from variant [BetaCustomTool].
+ Format BetaCustomToolFormatUnion `json:"format"`
+ JSON struct {
+ Name respjson.Field
+ Type respjson.Field
+ AllowedCallers respjson.Field
+ DeferLoading respjson.Field
+ Description respjson.Field
+ OutputSchema respjson.Field
+ Parameters respjson.Field
+ Strict respjson.Field
+ Format respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaNamespaceToolTool is implemented by each variant of
+// [BetaNamespaceToolToolUnion] to add type safety for the return type of
+// [BetaNamespaceToolToolUnion.AsAny]
+type anyBetaNamespaceToolTool interface {
+ implBetaNamespaceToolToolUnion()
+}
+
+func (BetaNamespaceToolToolFunction) implBetaNamespaceToolToolUnion() {}
+func (BetaCustomTool) implBetaNamespaceToolToolUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaNamespaceToolToolUnion.AsAny().(type) {
+// case openai.BetaNamespaceToolToolFunction:
+// case openai.BetaCustomTool:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaNamespaceToolToolUnion) AsAny() anyBetaNamespaceToolTool {
+ switch u.Type {
+ case "function":
+ return u.AsFunction()
+ case "custom":
+ return u.AsCustom()
+ }
+ return nil
+}
+
+func (u BetaNamespaceToolToolUnion) AsFunction() (v BetaNamespaceToolToolFunction) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaNamespaceToolToolUnion) AsCustom() (v BetaCustomTool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaNamespaceToolToolUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaNamespaceToolToolUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaNamespaceToolToolFunction struct {
+ Name string `json:"name" api:"required"`
+ Type constant.Function `json:"type" default:"function"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers" api:"nullable"`
+ // Whether this function should be deferred and discovered via tool search.
+ DeferLoading bool `json:"defer_loading"`
+ Description string `json:"description" api:"nullable"`
+ // A JSON Schema describing the JSON value encoded in string outputs for this
+ // function tool. This does not describe content-array outputs.
+ OutputSchema map[string]any `json:"output_schema" api:"nullable"`
+ Parameters any `json:"parameters" api:"nullable"`
+ // Whether to enforce strict parameter validation. If omitted, Responses attempts
+ // to use strict validation when the schema is compatible, and falls back to
+ // non-strict validation otherwise.
+ Strict bool `json:"strict" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Name respjson.Field
+ Type respjson.Field
+ AllowedCallers respjson.Field
+ DeferLoading respjson.Field
+ Description respjson.Field
+ OutputSchema respjson.Field
+ Parameters respjson.Field
+ Strict respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaNamespaceToolToolFunction) RawJSON() string { return r.JSON.raw }
+func (r *BetaNamespaceToolToolFunction) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Groups function/custom tools under a shared namespace.
+//
+// The properties Description, Name, Tools, Type are required.
+type BetaNamespaceToolParam struct {
+ // A description of the namespace shown to the model.
+ Description string `json:"description" api:"required"`
+ // The namespace name used in tool calls (for example, `crm`).
+ Name string `json:"name" api:"required"`
+ // The function/custom tools available inside this namespace.
+ Tools []BetaNamespaceToolToolUnionParam `json:"tools,omitzero" api:"required"`
+ // The type of the tool. Always `namespace`.
+ //
+ // This field can be elided, and will marshal its zero value as "namespace".
+ Type constant.Namespace `json:"type" default:"namespace"`
+ paramObj
+}
+
+func (r BetaNamespaceToolParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaNamespaceToolParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaNamespaceToolParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaNamespaceToolToolUnionParam struct {
+ OfFunction *BetaNamespaceToolToolFunctionParam `json:",omitzero,inline"`
+ OfCustom *BetaCustomToolParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaNamespaceToolToolUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfFunction, u.OfCustom)
+}
+func (u *BetaNamespaceToolToolUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaNamespaceToolToolUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfFunction) {
+ return u.OfFunction
+ } else if !param.IsOmitted(u.OfCustom) {
+ return u.OfCustom
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaNamespaceToolToolUnionParam) GetOutputSchema() map[string]any {
+ if vt := u.OfFunction; vt != nil {
+ return vt.OutputSchema
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaNamespaceToolToolUnionParam) GetParameters() *any {
+ if vt := u.OfFunction; vt != nil {
+ return &vt.Parameters
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaNamespaceToolToolUnionParam) GetStrict() *bool {
+ if vt := u.OfFunction; vt != nil && vt.Strict.Valid() {
+ return &vt.Strict.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaNamespaceToolToolUnionParam) GetFormat() *BetaCustomToolFormatUnionParam {
+ if vt := u.OfCustom; vt != nil {
+ return &vt.Format
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaNamespaceToolToolUnionParam) GetName() *string {
+ if vt := u.OfFunction; vt != nil {
+ return (*string)(&vt.Name)
+ } else if vt := u.OfCustom; vt != nil {
+ return (*string)(&vt.Name)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaNamespaceToolToolUnionParam) GetType() *string {
+ if vt := u.OfFunction; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfCustom; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaNamespaceToolToolUnionParam) GetDeferLoading() *bool {
+ if vt := u.OfFunction; vt != nil && vt.DeferLoading.Valid() {
+ return &vt.DeferLoading.Value
+ } else if vt := u.OfCustom; vt != nil && vt.DeferLoading.Valid() {
+ return &vt.DeferLoading.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaNamespaceToolToolUnionParam) GetDescription() *string {
+ if vt := u.OfFunction; vt != nil && vt.Description.Valid() {
+ return &vt.Description.Value
+ } else if vt := u.OfCustom; vt != nil && vt.Description.Valid() {
+ return &vt.Description.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's AllowedCallers property, if
+// present.
+func (u BetaNamespaceToolToolUnionParam) GetAllowedCallers() []string {
+ if vt := u.OfFunction; vt != nil {
+ return vt.AllowedCallers
+ } else if vt := u.OfCustom; vt != nil {
+ return vt.AllowedCallers
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaNamespaceToolToolUnionParam](
+ "type",
+ apijson.Discriminator[BetaNamespaceToolToolFunctionParam]("function"),
+ apijson.Discriminator[BetaCustomToolParam]("custom"),
+ )
+}
+
+// The properties Name, Type are required.
+type BetaNamespaceToolToolFunctionParam struct {
+ Name string `json:"name" api:"required"`
+ Description param.Opt[string] `json:"description,omitzero"`
+ // Whether to enforce strict parameter validation. If omitted, Responses attempts
+ // to use strict validation when the schema is compatible, and falls back to
+ // non-strict validation otherwise.
+ Strict param.Opt[bool] `json:"strict,omitzero"`
+ // Whether this function should be deferred and discovered via tool search.
+ DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers,omitzero"`
+ // A JSON Schema describing the JSON value encoded in string outputs for this
+ // function tool. This does not describe content-array outputs.
+ OutputSchema map[string]any `json:"output_schema,omitzero"`
+ Parameters any `json:"parameters,omitzero"`
+ // This field can be elided, and will marshal its zero value as "function".
+ Type constant.Function `json:"type" default:"function"`
+ paramObj
+}
+
+func (r BetaNamespaceToolToolFunctionParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaNamespaceToolToolFunctionParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaNamespaceToolToolFunctionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponse struct {
+ // Unique identifier for this Response.
+ ID string `json:"id" api:"required"`
+ // Unix timestamp (in seconds) of when this Response was created.
+ CreatedAt float64 `json:"created_at" api:"required" format:"unixtime"`
+ // An error object returned when the model fails to generate a Response.
+ Error BetaResponseError `json:"error" api:"required"`
+ // Details about why the response is incomplete.
+ IncompleteDetails BetaResponseIncompleteDetails `json:"incomplete_details" api:"required"`
+ // A system (or developer) message inserted into the model's context.
+ //
+ // When using along with `previous_response_id`, the instructions from a previous
+ // response will not be carried over to the next response. This makes it simple to
+ // swap out system (or developer) messages in new responses.
+ Instructions BetaResponseInstructionsUnion `json:"instructions" api:"required"`
+ // Set of 16 key-value pairs that can be attached to an object. This can be useful
+ // for storing additional information about the object in a structured format, and
+ // querying for objects via API or the dashboard.
+ //
+ // Keys are strings with a maximum length of 64 characters. Values are strings with
+ // a maximum length of 512 characters.
+ Metadata map[string]string `json:"metadata" api:"required"`
+ // Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
+ // wide range of models with different capabilities, performance characteristics,
+ // and price points. Refer to the
+ // [model guide](https://platform.openai.com/docs/models) to browse and compare
+ // available models.
+ Model BetaResponseModel `json:"model" api:"required"`
+ // The object type of this resource - always set to `response`.
+ Object constant.Response `json:"object" default:"response"`
+ // An array of content items generated by the model.
+ //
+ // - The length and order of items in the `output` array is dependent on the
+ // model's response.
+ // - Rather than accessing the first item in the `output` array and assuming it's
+ // an `assistant` message with the content generated by the model, you might
+ // consider using the `output_text` property where supported in SDKs.
+ Output []BetaResponseOutputItemUnion `json:"output" api:"required"`
+ // Whether to allow the model to run tool calls in parallel.
+ ParallelToolCalls bool `json:"parallel_tool_calls" api:"required"`
+ // What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
+ // make the output more random, while lower values like 0.2 will make it more
+ // focused and deterministic. We generally recommend altering this or `top_p` but
+ // not both.
+ Temperature float64 `json:"temperature" api:"required"`
+ // How the model should select which tool (or tools) to use when generating a
+ // response. See the `tools` parameter to see how to specify which tools the model
+ // can call.
+ ToolChoice BetaResponseToolChoiceUnion `json:"tool_choice" api:"required"`
+ // An array of tools the model may call while generating a response. You can
+ // specify which tool to use by setting the `tool_choice` parameter.
+ //
+ // We support the following categories of tools:
+ //
+ // - **Built-in tools**: Tools that are provided by OpenAI that extend the model's
+ // capabilities, like
+ // [web search](https://platform.openai.com/docs/guides/tools-web-search) or
+ // [file search](https://platform.openai.com/docs/guides/tools-file-search).
+ // Learn more about
+ // [built-in tools](https://platform.openai.com/docs/guides/tools).
+ // - **MCP Tools**: Integrations with third-party systems via custom MCP servers or
+ // predefined connectors such as Google Drive and SharePoint. Learn more about
+ // [MCP Tools](https://platform.openai.com/docs/guides/tools-connectors-mcp).
+ // - **Function calls (custom tools)**: Functions that are defined by you, enabling
+ // the model to call your own code with strongly typed arguments and outputs.
+ // Learn more about
+ // [function calling](https://platform.openai.com/docs/guides/function-calling).
+ // You can also use custom tools to call your own code.
+ Tools []BetaToolUnion `json:"tools" api:"required"`
+ // An alternative to sampling with temperature, called nucleus sampling, where the
+ // model considers the results of the tokens with top_p probability mass. So 0.1
+ // means only the tokens comprising the top 10% probability mass are considered.
+ //
+ // We generally recommend altering this or `temperature` but not both.
+ TopP float64 `json:"top_p" api:"required"`
+ // Whether to run the model response in the background.
+ // [Learn more](https://platform.openai.com/docs/guides/background).
+ Background bool `json:"background" api:"nullable"`
+ // Unix timestamp (in seconds) of when this Response was completed. Only present
+ // when the status is `completed`.
+ CompletedAt float64 `json:"completed_at" api:"nullable" format:"unixtime"`
+ // The conversation that this response belonged to. Input items and output items
+ // from this response were automatically added to this conversation.
+ Conversation BetaResponseConversation `json:"conversation" api:"nullable"`
+ // An upper bound for the number of tokens that can be generated for a response,
+ // including visible output tokens and
+ // [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).
+ MaxOutputTokens int64 `json:"max_output_tokens" api:"nullable"`
+ // The maximum number of total calls to built-in tools that can be processed in a
+ // response. This maximum number applies across all built-in tool calls, not per
+ // individual tool. Any further attempts to call a tool by the model will be
+ // ignored.
+ MaxToolCalls int64 `json:"max_tool_calls" api:"nullable"`
+ // Moderation results for the response input and output, if moderated completions
+ // were requested.
+ Moderation BetaResponseModeration `json:"moderation" api:"nullable"`
+ // The unique ID of the previous response to the model. Use this to create
+ // multi-turn conversations. Learn more about
+ // [conversation state](https://platform.openai.com/docs/guides/conversation-state).
+ // Cannot be used in conjunction with `conversation`.
+ PreviousResponseID string `json:"previous_response_id" api:"nullable"`
+ // Reference to a prompt template and its variables.
+ // [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
+ Prompt BetaResponsePrompt `json:"prompt" api:"nullable"`
+ // Used by OpenAI to cache responses for similar requests to optimize your cache
+ // hit rates. Replaces the `user` field.
+ // [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
+ PromptCacheKey string `json:"prompt_cache_key" api:"nullable"`
+ // The prompt-caching options that were applied to the response. Supported for
+ // `gpt-5.6` and later models.
+ PromptCacheOptions BetaResponsePromptCacheOptions `json:"prompt_cache_options"`
+ // Deprecated. Use `prompt_cache_options.ttl` instead.
+ //
+ // The retention policy for the prompt cache. Set to `24h` to enable extended
+ // prompt caching, which keeps cached prefixes active for longer, up to a maximum
+ // of 24 hours.
+ // [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
+ // This field expresses a maximum retention policy, while
+ // `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
+ // are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
+ // models, only `24h` is supported.
+ //
+ // For older models that support both `in_memory` and `24h`, the default depends on
+ // your organization's data retention policy:
+ //
+ // - Organizations without ZDR enabled default to `24h`.
+ // - Organizations with ZDR enabled default to `in_memory` when
+ // `prompt_cache_retention` is not specified.
+ //
+ // Any of "in_memory", "24h".
+ //
+ // Deprecated: deprecated
+ PromptCacheRetention BetaResponsePromptCacheRetention `json:"prompt_cache_retention" api:"nullable"`
+ // **gpt-5 and o-series models only**
+ //
+ // Configuration options for
+ // [reasoning models](https://platform.openai.com/docs/guides/reasoning).
+ Reasoning BetaResponseReasoning `json:"reasoning" api:"nullable"`
+ // A stable identifier used to help detect users of your application that may be
+ // violating OpenAI's usage policies. The IDs should be a string that uniquely
+ // identifies each user, with a maximum length of 64 characters. We recommend
+ // hashing their username or email address, in order to avoid sending us any
+ // identifying information.
+ // [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
+ SafetyIdentifier string `json:"safety_identifier" api:"nullable"`
+ // Specifies the processing type used for serving the request.
+ //
+ // - If set to 'auto', then the request will be processed with the service tier
+ // configured in the Project settings. Unless otherwise configured, the Project
+ // will use 'default'.
+ // - If set to 'default', then the request will be processed with the standard
+ // pricing and performance for the selected model.
+ // - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
+ // '[priority](https://openai.com/api-priority-processing/)', then the request
+ // will be processed with the corresponding service tier.
+ // - When not set, the default behavior is 'auto'.
+ //
+ // When the `service_tier` parameter is set, the response body will include the
+ // `service_tier` value based on the processing mode actually used to serve the
+ // request. This response value may be different from the value set in the
+ // parameter.
+ //
+ // Any of "auto", "default", "flex", "scale", "priority".
+ ServiceTier BetaResponseServiceTier `json:"service_tier" api:"nullable"`
+ // The status of the response generation. One of `completed`, `failed`,
+ // `in_progress`, `cancelled`, `queued`, or `incomplete`.
+ //
+ // Any of "completed", "failed", "in_progress", "cancelled", "queued",
+ // "incomplete".
+ Status BetaResponseStatus `json:"status"`
+ // Configuration options for a text response from the model. Can be plain text or
+ // structured JSON data. Learn more:
+ //
+ // - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
+ // - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
+ Text BetaResponseTextConfig `json:"text"`
+ // An integer between 0 and 20 specifying the maximum number of most likely tokens
+ // to return at each token position, each with an associated log probability. In
+ // some cases, the number of returned tokens may be fewer than requested.
+ TopLogprobs int64 `json:"top_logprobs" api:"nullable"`
+ // The truncation strategy to use for the model response.
+ //
+ // - `auto`: If the input to this Response exceeds the model's context window size,
+ // the model will truncate the response to fit the context window by dropping
+ // items from the beginning of the conversation.
+ // - `disabled` (default): If the input size will exceed the context window size
+ // for a model, the request will fail with a 400 error.
+ //
+ // Any of "auto", "disabled".
+ Truncation BetaResponseTruncation `json:"truncation" api:"nullable"`
+ // Represents token usage details including input tokens, output tokens, a
+ // breakdown of output tokens, and the total tokens used.
+ Usage BetaResponseUsage `json:"usage"`
+ // This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use
+ // `prompt_cache_key` instead to maintain caching optimizations. A stable
+ // identifier for your end-users. Used to boost cache hit rates by better bucketing
+ // similar requests and to help OpenAI detect and prevent abuse.
+ // [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
+ //
+ // Deprecated: deprecated
+ User string `json:"user"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CreatedAt respjson.Field
+ Error respjson.Field
+ IncompleteDetails respjson.Field
+ Instructions respjson.Field
+ Metadata respjson.Field
+ Model respjson.Field
+ Object respjson.Field
+ Output respjson.Field
+ ParallelToolCalls respjson.Field
+ Temperature respjson.Field
+ ToolChoice respjson.Field
+ Tools respjson.Field
+ TopP respjson.Field
+ Background respjson.Field
+ CompletedAt respjson.Field
+ Conversation respjson.Field
+ MaxOutputTokens respjson.Field
+ MaxToolCalls respjson.Field
+ Moderation respjson.Field
+ PreviousResponseID respjson.Field
+ Prompt respjson.Field
+ PromptCacheKey respjson.Field
+ PromptCacheOptions respjson.Field
+ PromptCacheRetention respjson.Field
+ Reasoning respjson.Field
+ SafetyIdentifier respjson.Field
+ ServiceTier respjson.Field
+ Status respjson.Field
+ Text respjson.Field
+ TopLogprobs respjson.Field
+ Truncation respjson.Field
+ Usage respjson.Field
+ User respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponse) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Details about why the response is incomplete.
+type BetaResponseIncompleteDetails struct {
+ // The reason why the response is incomplete.
+ //
+ // Any of "max_output_tokens", "content_filter".
+ Reason string `json:"reason"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Reason respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseIncompleteDetails) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseIncompleteDetails) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInstructionsUnion contains all possible properties and values from
+// [string], [[]BetaResponseInputItemUnion].
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString OfInputItemList]
+type BetaResponseInstructionsUnion struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]BetaResponseInputItemUnion]
+ // instead of an object.
+ OfInputItemList []BetaResponseInputItemUnion `json:",inline"`
+ JSON struct {
+ OfString respjson.Field
+ OfInputItemList respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u BetaResponseInstructionsUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInstructionsUnion) AsInputItemList() (v []BetaResponseInputItemUnion) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseInstructionsUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseInstructionsUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
+// wide range of models with different capabilities, performance characteristics,
+// and price points. Refer to the
+// [model guide](https://platform.openai.com/docs/models) to browse and compare
+// available models.
+type BetaResponseModel string
+
+const (
+ BetaResponseModelGPT5_6Sol BetaResponseModel = "gpt-5.6-sol"
+ BetaResponseModelGPT5_6Terra BetaResponseModel = "gpt-5.6-terra"
+ BetaResponseModelGPT5_6Luna BetaResponseModel = "gpt-5.6-luna"
+ BetaResponseModelGPT5_4 BetaResponseModel = "gpt-5.4"
+ BetaResponseModelGPT5_4Mini BetaResponseModel = "gpt-5.4-mini"
+ BetaResponseModelGPT5_4Nano BetaResponseModel = "gpt-5.4-nano"
+ BetaResponseModelGPT5_4Mini2026_03_17 BetaResponseModel = "gpt-5.4-mini-2026-03-17"
+ BetaResponseModelGPT5_4Nano2026_03_17 BetaResponseModel = "gpt-5.4-nano-2026-03-17"
+ BetaResponseModelGPT5_3ChatLatest BetaResponseModel = "gpt-5.3-chat-latest"
+ BetaResponseModelGPT5_2 BetaResponseModel = "gpt-5.2"
+ BetaResponseModelGPT5_2_2025_12_11 BetaResponseModel = "gpt-5.2-2025-12-11"
+ BetaResponseModelGPT5_2ChatLatest BetaResponseModel = "gpt-5.2-chat-latest"
+ BetaResponseModelGPT5_2Pro BetaResponseModel = "gpt-5.2-pro"
+ BetaResponseModelGPT5_2Pro2025_12_11 BetaResponseModel = "gpt-5.2-pro-2025-12-11"
+ BetaResponseModelGPT5_1 BetaResponseModel = "gpt-5.1"
+ BetaResponseModelGPT5_1_2025_11_13 BetaResponseModel = "gpt-5.1-2025-11-13"
+ BetaResponseModelGPT5_1Codex BetaResponseModel = "gpt-5.1-codex"
+ BetaResponseModelGPT5_1Mini BetaResponseModel = "gpt-5.1-mini"
+ BetaResponseModelGPT5_1ChatLatest BetaResponseModel = "gpt-5.1-chat-latest"
+ BetaResponseModelGPT5 BetaResponseModel = "gpt-5"
+ BetaResponseModelGPT5Mini BetaResponseModel = "gpt-5-mini"
+ BetaResponseModelGPT5Nano BetaResponseModel = "gpt-5-nano"
+ BetaResponseModelGPT5_2025_08_07 BetaResponseModel = "gpt-5-2025-08-07"
+ BetaResponseModelGPT5Mini2025_08_07 BetaResponseModel = "gpt-5-mini-2025-08-07"
+ BetaResponseModelGPT5Nano2025_08_07 BetaResponseModel = "gpt-5-nano-2025-08-07"
+ BetaResponseModelGPT5ChatLatest BetaResponseModel = "gpt-5-chat-latest"
+ BetaResponseModelGPT4_1 BetaResponseModel = "gpt-4.1"
+ BetaResponseModelGPT4_1Mini BetaResponseModel = "gpt-4.1-mini"
+ BetaResponseModelGPT4_1Nano BetaResponseModel = "gpt-4.1-nano"
+ BetaResponseModelGPT4_1_2025_04_14 BetaResponseModel = "gpt-4.1-2025-04-14"
+ BetaResponseModelGPT4_1Mini2025_04_14 BetaResponseModel = "gpt-4.1-mini-2025-04-14"
+ BetaResponseModelGPT4_1Nano2025_04_14 BetaResponseModel = "gpt-4.1-nano-2025-04-14"
+ BetaResponseModelO4Mini BetaResponseModel = "o4-mini"
+ BetaResponseModelO4Mini2025_04_16 BetaResponseModel = "o4-mini-2025-04-16"
+ BetaResponseModelO3 BetaResponseModel = "o3"
+ BetaResponseModelO3_2025_04_16 BetaResponseModel = "o3-2025-04-16"
+ BetaResponseModelO3Mini BetaResponseModel = "o3-mini"
+ BetaResponseModelO3Mini2025_01_31 BetaResponseModel = "o3-mini-2025-01-31"
+ BetaResponseModelO1 BetaResponseModel = "o1"
+ BetaResponseModelO1_2024_12_17 BetaResponseModel = "o1-2024-12-17"
+ BetaResponseModelO1Preview BetaResponseModel = "o1-preview"
+ BetaResponseModelO1Preview2024_09_12 BetaResponseModel = "o1-preview-2024-09-12"
+ BetaResponseModelO1Mini BetaResponseModel = "o1-mini"
+ BetaResponseModelO1Mini2024_09_12 BetaResponseModel = "o1-mini-2024-09-12"
+ BetaResponseModelGPT4o BetaResponseModel = "gpt-4o"
+ BetaResponseModelGPT4o2024_11_20 BetaResponseModel = "gpt-4o-2024-11-20"
+ BetaResponseModelGPT4o2024_08_06 BetaResponseModel = "gpt-4o-2024-08-06"
+ BetaResponseModelGPT4o2024_05_13 BetaResponseModel = "gpt-4o-2024-05-13"
+ BetaResponseModelGPT4oAudioPreview BetaResponseModel = "gpt-4o-audio-preview"
+ BetaResponseModelGPT4oAudioPreview2024_10_01 BetaResponseModel = "gpt-4o-audio-preview-2024-10-01"
+ BetaResponseModelGPT4oAudioPreview2024_12_17 BetaResponseModel = "gpt-4o-audio-preview-2024-12-17"
+ BetaResponseModelGPT4oAudioPreview2025_06_03 BetaResponseModel = "gpt-4o-audio-preview-2025-06-03"
+ BetaResponseModelGPT4oMiniAudioPreview BetaResponseModel = "gpt-4o-mini-audio-preview"
+ BetaResponseModelGPT4oMiniAudioPreview2024_12_17 BetaResponseModel = "gpt-4o-mini-audio-preview-2024-12-17"
+ BetaResponseModelGPT4oSearchPreview BetaResponseModel = "gpt-4o-search-preview"
+ BetaResponseModelGPT4oMiniSearchPreview BetaResponseModel = "gpt-4o-mini-search-preview"
+ BetaResponseModelGPT4oSearchPreview2025_03_11 BetaResponseModel = "gpt-4o-search-preview-2025-03-11"
+ BetaResponseModelGPT4oMiniSearchPreview2025_03_11 BetaResponseModel = "gpt-4o-mini-search-preview-2025-03-11"
+ BetaResponseModelChatgpt4oLatest BetaResponseModel = "chatgpt-4o-latest"
+ BetaResponseModelCodexMiniLatest BetaResponseModel = "codex-mini-latest"
+ BetaResponseModelGPT4oMini BetaResponseModel = "gpt-4o-mini"
+ BetaResponseModelGPT4oMini2024_07_18 BetaResponseModel = "gpt-4o-mini-2024-07-18"
+ BetaResponseModelGPT4Turbo BetaResponseModel = "gpt-4-turbo"
+ BetaResponseModelGPT4Turbo2024_04_09 BetaResponseModel = "gpt-4-turbo-2024-04-09"
+ BetaResponseModelGPT4_0125Preview BetaResponseModel = "gpt-4-0125-preview"
+ BetaResponseModelGPT4TurboPreview BetaResponseModel = "gpt-4-turbo-preview"
+ BetaResponseModelGPT4_1106Preview BetaResponseModel = "gpt-4-1106-preview"
+ BetaResponseModelGPT4VisionPreview BetaResponseModel = "gpt-4-vision-preview"
+ BetaResponseModelGPT4 BetaResponseModel = "gpt-4"
+ BetaResponseModelGPT4_0314 BetaResponseModel = "gpt-4-0314"
+ BetaResponseModelGPT4_0613 BetaResponseModel = "gpt-4-0613"
+ BetaResponseModelGPT4_32k BetaResponseModel = "gpt-4-32k"
+ BetaResponseModelGPT4_32k0314 BetaResponseModel = "gpt-4-32k-0314"
+ BetaResponseModelGPT4_32k0613 BetaResponseModel = "gpt-4-32k-0613"
+ BetaResponseModelGPT3_5Turbo BetaResponseModel = "gpt-3.5-turbo"
+ BetaResponseModelGPT3_5Turbo16k BetaResponseModel = "gpt-3.5-turbo-16k"
+ BetaResponseModelGPT3_5Turbo0301 BetaResponseModel = "gpt-3.5-turbo-0301"
+ BetaResponseModelGPT3_5Turbo0613 BetaResponseModel = "gpt-3.5-turbo-0613"
+ BetaResponseModelGPT3_5Turbo1106 BetaResponseModel = "gpt-3.5-turbo-1106"
+ BetaResponseModelGPT3_5Turbo0125 BetaResponseModel = "gpt-3.5-turbo-0125"
+ BetaResponseModelGPT3_5Turbo16k0613 BetaResponseModel = "gpt-3.5-turbo-16k-0613"
+ BetaResponseModelO1Pro BetaResponseModel = "o1-pro"
+ BetaResponseModelO1Pro2025_03_19 BetaResponseModel = "o1-pro-2025-03-19"
+ BetaResponseModelO3Pro BetaResponseModel = "o3-pro"
+ BetaResponseModelO3Pro2025_06_10 BetaResponseModel = "o3-pro-2025-06-10"
+ BetaResponseModelO3DeepResearch BetaResponseModel = "o3-deep-research"
+ BetaResponseModelO3DeepResearch2025_06_26 BetaResponseModel = "o3-deep-research-2025-06-26"
+ BetaResponseModelO4MiniDeepResearch BetaResponseModel = "o4-mini-deep-research"
+ BetaResponseModelO4MiniDeepResearch2025_06_26 BetaResponseModel = "o4-mini-deep-research-2025-06-26"
+ BetaResponseModelComputerUsePreview BetaResponseModel = "computer-use-preview"
+ BetaResponseModelComputerUsePreview2025_03_11 BetaResponseModel = "computer-use-preview-2025-03-11"
+ BetaResponseModelGPT5Codex BetaResponseModel = "gpt-5-codex"
+ BetaResponseModelGPT5Pro BetaResponseModel = "gpt-5-pro"
+ BetaResponseModelGPT5Pro2025_10_06 BetaResponseModel = "gpt-5-pro-2025-10-06"
+ BetaResponseModelGPT5_1CodexMax BetaResponseModel = "gpt-5.1-codex-max"
+)
+
+// BetaResponseToolChoiceUnion contains all possible properties and values from
+// [BetaToolChoiceOptions], [BetaToolChoiceAllowed], [BetaToolChoiceTypes],
+// [BetaToolChoiceFunction], [BetaToolChoiceMcp], [BetaToolChoiceCustom],
+// [BetaResponseToolChoiceBetaSpecificProgrammaticToolCallingParam],
+// [BetaToolChoiceApplyPatch], [BetaToolChoiceShell].
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfToolChoiceMode]
+type BetaResponseToolChoiceUnion struct {
+ // This field will be present if the value is a [BetaToolChoiceOptions] instead of
+ // an object.
+ OfToolChoiceMode BetaToolChoiceOptions `json:",inline"`
+ // This field is from variant [BetaToolChoiceAllowed].
+ Mode BetaToolChoiceAllowedMode `json:"mode"`
+ // This field is from variant [BetaToolChoiceAllowed].
+ Tools []map[string]any `json:"tools"`
+ Type string `json:"type"`
+ Name string `json:"name"`
+ // This field is from variant [BetaToolChoiceMcp].
+ ServerLabel string `json:"server_label"`
+ JSON struct {
+ OfToolChoiceMode respjson.Field
+ Mode respjson.Field
+ Tools respjson.Field
+ Type respjson.Field
+ Name respjson.Field
+ ServerLabel respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u BetaResponseToolChoiceUnion) AsToolChoiceMode() (v BetaToolChoiceOptions) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseToolChoiceUnion) AsAllowedTools() (v BetaToolChoiceAllowed) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseToolChoiceUnion) AsHostedTool() (v BetaToolChoiceTypes) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseToolChoiceUnion) AsFunctionTool() (v BetaToolChoiceFunction) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseToolChoiceUnion) AsMcpTool() (v BetaToolChoiceMcp) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseToolChoiceUnion) AsCustomTool() (v BetaToolChoiceCustom) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseToolChoiceUnion) AsBetaResponseToolChoiceBetaSpecificProgrammaticToolCallingParam() (v BetaResponseToolChoiceBetaSpecificProgrammaticToolCallingParam) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseToolChoiceUnion) AsSpecificApplyPatchToolChoice() (v BetaToolChoiceApplyPatch) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseToolChoiceUnion) AsSpecificShellToolChoice() (v BetaToolChoiceShell) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseToolChoiceUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseToolChoiceUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseToolChoiceBetaSpecificProgrammaticToolCallingParam struct {
+ // The tool to call. Always `programmatic_tool_calling`.
+ Type constant.ProgrammaticToolCalling `json:"type" default:"programmatic_tool_calling"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseToolChoiceBetaSpecificProgrammaticToolCallingParam) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *BetaResponseToolChoiceBetaSpecificProgrammaticToolCallingParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The conversation that this response belonged to. Input items and output items
+// from this response were automatically added to this conversation.
+type BetaResponseConversation struct {
+ // The unique ID of the conversation that this response was associated with.
+ ID string `json:"id" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseConversation) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseConversation) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Moderation results for the response input and output, if moderated completions
+// were requested.
+type BetaResponseModeration struct {
+ // Moderation for the response input.
+ Input BetaResponseModerationInputUnion `json:"input" api:"required"`
+ // Moderation for the response output.
+ Output BetaResponseModerationOutputUnion `json:"output" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Input respjson.Field
+ Output respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseModeration) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseModeration) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseModerationInputUnion contains all possible properties and values
+// from [BetaResponseModerationInputModerationResult],
+// [BetaResponseModerationInputError].
+//
+// Use the [BetaResponseModerationInputUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseModerationInputUnion struct {
+ // This field is from variant [BetaResponseModerationInputModerationResult].
+ Categories map[string]bool `json:"categories"`
+ // This field is from variant [BetaResponseModerationInputModerationResult].
+ CategoryAppliedInputTypes map[string][]string `json:"category_applied_input_types"`
+ // This field is from variant [BetaResponseModerationInputModerationResult].
+ CategoryScores map[string]float64 `json:"category_scores"`
+ // This field is from variant [BetaResponseModerationInputModerationResult].
+ Flagged bool `json:"flagged"`
+ // This field is from variant [BetaResponseModerationInputModerationResult].
+ Model string `json:"model"`
+ // Any of "moderation_result", "error".
+ Type string `json:"type"`
+ // This field is from variant [BetaResponseModerationInputError].
+ Code string `json:"code"`
+ // This field is from variant [BetaResponseModerationInputError].
+ Message string `json:"message"`
+ JSON struct {
+ Categories respjson.Field
+ CategoryAppliedInputTypes respjson.Field
+ CategoryScores respjson.Field
+ Flagged respjson.Field
+ Model respjson.Field
+ Type respjson.Field
+ Code respjson.Field
+ Message respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseModerationInput is implemented by each variant of
+// [BetaResponseModerationInputUnion] to add type safety for the return type of
+// [BetaResponseModerationInputUnion.AsAny]
+type anyBetaResponseModerationInput interface {
+ implBetaResponseModerationInputUnion()
+}
+
+func (BetaResponseModerationInputModerationResult) implBetaResponseModerationInputUnion() {}
+func (BetaResponseModerationInputError) implBetaResponseModerationInputUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseModerationInputUnion.AsAny().(type) {
+// case openai.BetaResponseModerationInputModerationResult:
+// case openai.BetaResponseModerationInputError:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseModerationInputUnion) AsAny() anyBetaResponseModerationInput {
+ switch u.Type {
+ case "moderation_result":
+ return u.AsModerationResult()
+ case "error":
+ return u.AsError()
+ }
+ return nil
+}
+
+func (u BetaResponseModerationInputUnion) AsModerationResult() (v BetaResponseModerationInputModerationResult) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseModerationInputUnion) AsError() (v BetaResponseModerationInputError) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseModerationInputUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseModerationInputUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A moderation result produced for the response input or output.
+type BetaResponseModerationInputModerationResult struct {
+ // A dictionary of moderation categories to booleans, True if the input is flagged
+ // under this category.
+ Categories map[string]bool `json:"categories" api:"required"`
+ // Which modalities of input are reflected by the score for each category.
+ CategoryAppliedInputTypes map[string][]string `json:"category_applied_input_types" api:"required"`
+ // A dictionary of moderation categories to scores.
+ CategoryScores map[string]float64 `json:"category_scores" api:"required"`
+ // A boolean indicating whether the content was flagged by any category.
+ Flagged bool `json:"flagged" api:"required"`
+ // The moderation model that produced this result.
+ Model string `json:"model" api:"required"`
+ // The object type, which was always `moderation_result` for successful moderation
+ // results.
+ Type constant.ModerationResult `json:"type" default:"moderation_result"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Categories respjson.Field
+ CategoryAppliedInputTypes respjson.Field
+ CategoryScores respjson.Field
+ Flagged respjson.Field
+ Model respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseModerationInputModerationResult) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseModerationInputModerationResult) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An error produced while attempting moderation for the response input or output.
+type BetaResponseModerationInputError struct {
+ // The error code.
+ Code string `json:"code" api:"required"`
+ // The error message.
+ Message string `json:"message" api:"required"`
+ // The object type, which was always `error` for moderation failures.
+ Type constant.Error `json:"type" default:"error"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Code respjson.Field
+ Message respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseModerationInputError) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseModerationInputError) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseModerationOutputUnion contains all possible properties and values
+// from [BetaResponseModerationOutputModerationResult],
+// [BetaResponseModerationOutputError].
+//
+// Use the [BetaResponseModerationOutputUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseModerationOutputUnion struct {
+ // This field is from variant [BetaResponseModerationOutputModerationResult].
+ Categories map[string]bool `json:"categories"`
+ // This field is from variant [BetaResponseModerationOutputModerationResult].
+ CategoryAppliedInputTypes map[string][]string `json:"category_applied_input_types"`
+ // This field is from variant [BetaResponseModerationOutputModerationResult].
+ CategoryScores map[string]float64 `json:"category_scores"`
+ // This field is from variant [BetaResponseModerationOutputModerationResult].
+ Flagged bool `json:"flagged"`
+ // This field is from variant [BetaResponseModerationOutputModerationResult].
+ Model string `json:"model"`
+ // Any of "moderation_result", "error".
+ Type string `json:"type"`
+ // This field is from variant [BetaResponseModerationOutputError].
+ Code string `json:"code"`
+ // This field is from variant [BetaResponseModerationOutputError].
+ Message string `json:"message"`
+ JSON struct {
+ Categories respjson.Field
+ CategoryAppliedInputTypes respjson.Field
+ CategoryScores respjson.Field
+ Flagged respjson.Field
+ Model respjson.Field
+ Type respjson.Field
+ Code respjson.Field
+ Message respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseModerationOutput is implemented by each variant of
+// [BetaResponseModerationOutputUnion] to add type safety for the return type of
+// [BetaResponseModerationOutputUnion.AsAny]
+type anyBetaResponseModerationOutput interface {
+ implBetaResponseModerationOutputUnion()
+}
+
+func (BetaResponseModerationOutputModerationResult) implBetaResponseModerationOutputUnion() {}
+func (BetaResponseModerationOutputError) implBetaResponseModerationOutputUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseModerationOutputUnion.AsAny().(type) {
+// case openai.BetaResponseModerationOutputModerationResult:
+// case openai.BetaResponseModerationOutputError:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseModerationOutputUnion) AsAny() anyBetaResponseModerationOutput {
+ switch u.Type {
+ case "moderation_result":
+ return u.AsModerationResult()
+ case "error":
+ return u.AsError()
+ }
+ return nil
+}
+
+func (u BetaResponseModerationOutputUnion) AsModerationResult() (v BetaResponseModerationOutputModerationResult) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseModerationOutputUnion) AsError() (v BetaResponseModerationOutputError) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseModerationOutputUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseModerationOutputUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A moderation result produced for the response input or output.
+type BetaResponseModerationOutputModerationResult struct {
+ // A dictionary of moderation categories to booleans, True if the input is flagged
+ // under this category.
+ Categories map[string]bool `json:"categories" api:"required"`
+ // Which modalities of input are reflected by the score for each category.
+ CategoryAppliedInputTypes map[string][]string `json:"category_applied_input_types" api:"required"`
+ // A dictionary of moderation categories to scores.
+ CategoryScores map[string]float64 `json:"category_scores" api:"required"`
+ // A boolean indicating whether the content was flagged by any category.
+ Flagged bool `json:"flagged" api:"required"`
+ // The moderation model that produced this result.
+ Model string `json:"model" api:"required"`
+ // The object type, which was always `moderation_result` for successful moderation
+ // results.
+ Type constant.ModerationResult `json:"type" default:"moderation_result"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Categories respjson.Field
+ CategoryAppliedInputTypes respjson.Field
+ CategoryScores respjson.Field
+ Flagged respjson.Field
+ Model respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseModerationOutputModerationResult) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseModerationOutputModerationResult) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An error produced while attempting moderation for the response input or output.
+type BetaResponseModerationOutputError struct {
+ // The error code.
+ Code string `json:"code" api:"required"`
+ // The error message.
+ Message string `json:"message" api:"required"`
+ // The object type, which was always `error` for moderation failures.
+ Type constant.Error `json:"type" default:"error"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Code respjson.Field
+ Message respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseModerationOutputError) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseModerationOutputError) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The prompt-caching options that were applied to the response. Supported for
+// `gpt-5.6` and later models.
+type BetaResponsePromptCacheOptions struct {
+ // Whether implicit prompt-cache breakpoints were enabled.
+ //
+ // Any of "implicit", "explicit".
+ Mode string `json:"mode" api:"required"`
+ // The minimum lifetime applied to each cache breakpoint.
+ //
+ // Any of "30m".
+ Ttl string `json:"ttl" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Mode respjson.Field
+ Ttl respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponsePromptCacheOptions) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponsePromptCacheOptions) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Deprecated. Use `prompt_cache_options.ttl` instead.
+//
+// The retention policy for the prompt cache. Set to `24h` to enable extended
+// prompt caching, which keeps cached prefixes active for longer, up to a maximum
+// of 24 hours.
+// [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
+// This field expresses a maximum retention policy, while
+// `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
+// are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
+// models, only `24h` is supported.
+//
+// For older models that support both `in_memory` and `24h`, the default depends on
+// your organization's data retention policy:
+//
+// - Organizations without ZDR enabled default to `24h`.
+// - Organizations with ZDR enabled default to `in_memory` when
+// `prompt_cache_retention` is not specified.
+type BetaResponsePromptCacheRetention string
+
+const (
+ BetaResponsePromptCacheRetentionInMemory BetaResponsePromptCacheRetention = "in_memory"
+ BetaResponsePromptCacheRetention24h BetaResponsePromptCacheRetention = "24h"
+)
+
+// **gpt-5 and o-series models only**
+//
+// Configuration options for
+// [reasoning models](https://platform.openai.com/docs/guides/reasoning).
+type BetaResponseReasoning struct {
+ // Controls which reasoning items are rendered back to the model on later turns. If
+ // omitted or set to `auto`, the model determines the context mode. The `gpt-5.6`
+ // model family defaults to `all_turns`; earlier models default to `current_turn`.
+ //
+ // When returned on a response, this is the effective reasoning context mode used
+ // for the response.
+ //
+ // Any of "auto", "current_turn", "all_turns".
+ Context string `json:"context" api:"nullable"`
+ // Constrains effort on reasoning for reasoning models. Currently supported values
+ // are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. Reducing
+ // reasoning effort can result in faster responses and fewer tokens used on
+ // reasoning in a response. Not all reasoning models support every value. See the
+ // [reasoning guide](https://platform.openai.com/docs/guides/reasoning) for
+ // model-specific support.
+ //
+ // Any of "none", "minimal", "low", "medium", "high", "xhigh", "max".
+ Effort string `json:"effort" api:"nullable"`
+ // **Deprecated:** use `summary` instead.
+ //
+ // A summary of the reasoning performed by the model. This can be useful for
+ // debugging and understanding the model's reasoning process. One of `auto`,
+ // `concise`, or `detailed`.
+ //
+ // Any of "auto", "concise", "detailed".
+ //
+ // Deprecated: deprecated
+ GenerateSummary string `json:"generate_summary" api:"nullable"`
+ // Controls the reasoning execution mode for the request.
+ //
+ // When returned on a response, this is the effective execution mode.
+ Mode string `json:"mode"`
+ // A summary of the reasoning performed by the model. This can be useful for
+ // debugging and understanding the model's reasoning process. One of `auto`,
+ // `concise`, or `detailed`.
+ //
+ // `concise` is supported for `computer-use-preview` models and all reasoning
+ // models after `gpt-5`.
+ //
+ // Any of "auto", "concise", "detailed".
+ Summary string `json:"summary" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Context respjson.Field
+ Effort respjson.Field
+ GenerateSummary respjson.Field
+ Mode respjson.Field
+ Summary respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseReasoning) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseReasoning) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Specifies the processing type used for serving the request.
+//
+// - If set to 'auto', then the request will be processed with the service tier
+// configured in the Project settings. Unless otherwise configured, the Project
+// will use 'default'.
+// - If set to 'default', then the request will be processed with the standard
+// pricing and performance for the selected model.
+// - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
+// '[priority](https://openai.com/api-priority-processing/)', then the request
+// will be processed with the corresponding service tier.
+// - When not set, the default behavior is 'auto'.
+//
+// When the `service_tier` parameter is set, the response body will include the
+// `service_tier` value based on the processing mode actually used to serve the
+// request. This response value may be different from the value set in the
+// parameter.
+type BetaResponseServiceTier string
+
+const (
+ BetaResponseServiceTierAuto BetaResponseServiceTier = "auto"
+ BetaResponseServiceTierDefault BetaResponseServiceTier = "default"
+ BetaResponseServiceTierFlex BetaResponseServiceTier = "flex"
+ BetaResponseServiceTierScale BetaResponseServiceTier = "scale"
+ BetaResponseServiceTierPriority BetaResponseServiceTier = "priority"
+)
+
+// The truncation strategy to use for the model response.
+//
+// - `auto`: If the input to this Response exceeds the model's context window size,
+// the model will truncate the response to fit the context window by dropping
+// items from the beginning of the conversation.
+// - `disabled` (default): If the input size will exceed the context window size
+// for a model, the request will fail with a 400 error.
+type BetaResponseTruncation string
+
+const (
+ BetaResponseTruncationAuto BetaResponseTruncation = "auto"
+ BetaResponseTruncationDisabled BetaResponseTruncation = "disabled"
+)
+
+// A tool call that applies file diffs by creating, deleting, or updating files.
+type BetaResponseApplyPatchToolCall struct {
+ // The unique ID of the apply patch tool call. Populated when this item is returned
+ // via API.
+ ID string `json:"id" api:"required"`
+ // The unique ID of the apply patch tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // One of the create_file, delete_file, or update_file operations applied via
+ // apply_patch.
+ Operation BetaResponseApplyPatchToolCallOperationUnion `json:"operation" api:"required"`
+ // The status of the apply patch tool call. One of `in_progress` or `completed`.
+ //
+ // Any of "in_progress", "completed".
+ Status BetaResponseApplyPatchToolCallStatus `json:"status" api:"required"`
+ // The type of the item. Always `apply_patch_call`.
+ Type constant.ApplyPatchCall `json:"type" default:"apply_patch_call"`
+ // The agent that produced this item.
+ Agent BetaResponseApplyPatchToolCallAgent `json:"agent"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseApplyPatchToolCallCallerUnion `json:"caller" api:"nullable"`
+ // The ID of the entity that created this tool call.
+ CreatedBy string `json:"created_by"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Operation respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Caller respjson.Field
+ CreatedBy respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseApplyPatchToolCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseApplyPatchToolCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseApplyPatchToolCallOperationUnion contains all possible properties
+// and values from [BetaResponseApplyPatchToolCallOperationCreateFile],
+// [BetaResponseApplyPatchToolCallOperationDeleteFile],
+// [BetaResponseApplyPatchToolCallOperationUpdateFile].
+//
+// Use the [BetaResponseApplyPatchToolCallOperationUnion.AsAny] method to switch on
+// the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseApplyPatchToolCallOperationUnion struct {
+ Diff string `json:"diff"`
+ Path string `json:"path"`
+ // Any of "create_file", "delete_file", "update_file".
+ Type string `json:"type"`
+ JSON struct {
+ Diff respjson.Field
+ Path respjson.Field
+ Type respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseApplyPatchToolCallOperation is implemented by each variant of
+// [BetaResponseApplyPatchToolCallOperationUnion] to add type safety for the return
+// type of [BetaResponseApplyPatchToolCallOperationUnion.AsAny]
+type anyBetaResponseApplyPatchToolCallOperation interface {
+ implBetaResponseApplyPatchToolCallOperationUnion()
+}
+
+func (BetaResponseApplyPatchToolCallOperationCreateFile) implBetaResponseApplyPatchToolCallOperationUnion() {
+}
+func (BetaResponseApplyPatchToolCallOperationDeleteFile) implBetaResponseApplyPatchToolCallOperationUnion() {
+}
+func (BetaResponseApplyPatchToolCallOperationUpdateFile) implBetaResponseApplyPatchToolCallOperationUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseApplyPatchToolCallOperationUnion.AsAny().(type) {
+// case openai.BetaResponseApplyPatchToolCallOperationCreateFile:
+// case openai.BetaResponseApplyPatchToolCallOperationDeleteFile:
+// case openai.BetaResponseApplyPatchToolCallOperationUpdateFile:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseApplyPatchToolCallOperationUnion) AsAny() anyBetaResponseApplyPatchToolCallOperation {
+ switch u.Type {
+ case "create_file":
+ return u.AsCreateFile()
+ case "delete_file":
+ return u.AsDeleteFile()
+ case "update_file":
+ return u.AsUpdateFile()
+ }
+ return nil
+}
+
+func (u BetaResponseApplyPatchToolCallOperationUnion) AsCreateFile() (v BetaResponseApplyPatchToolCallOperationCreateFile) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseApplyPatchToolCallOperationUnion) AsDeleteFile() (v BetaResponseApplyPatchToolCallOperationDeleteFile) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseApplyPatchToolCallOperationUnion) AsUpdateFile() (v BetaResponseApplyPatchToolCallOperationUpdateFile) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseApplyPatchToolCallOperationUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseApplyPatchToolCallOperationUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Instruction describing how to create a file via the apply_patch tool.
+type BetaResponseApplyPatchToolCallOperationCreateFile struct {
+ // Diff to apply.
+ Diff string `json:"diff" api:"required"`
+ // Path of the file to create.
+ Path string `json:"path" api:"required"`
+ // Create a new file with the provided diff.
+ Type constant.CreateFile `json:"type" default:"create_file"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Diff respjson.Field
+ Path respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseApplyPatchToolCallOperationCreateFile) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseApplyPatchToolCallOperationCreateFile) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Instruction describing how to delete a file via the apply_patch tool.
+type BetaResponseApplyPatchToolCallOperationDeleteFile struct {
+ // Path of the file to delete.
+ Path string `json:"path" api:"required"`
+ // Delete the specified file.
+ Type constant.DeleteFile `json:"type" default:"delete_file"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Path respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseApplyPatchToolCallOperationDeleteFile) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseApplyPatchToolCallOperationDeleteFile) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Instruction describing how to update a file via the apply_patch tool.
+type BetaResponseApplyPatchToolCallOperationUpdateFile struct {
+ // Diff to apply.
+ Diff string `json:"diff" api:"required"`
+ // Path of the file to update.
+ Path string `json:"path" api:"required"`
+ // Update an existing file with the provided diff.
+ Type constant.UpdateFile `json:"type" default:"update_file"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Diff respjson.Field
+ Path respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseApplyPatchToolCallOperationUpdateFile) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseApplyPatchToolCallOperationUpdateFile) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The status of the apply patch tool call. One of `in_progress` or `completed`.
+type BetaResponseApplyPatchToolCallStatus string
+
+const (
+ BetaResponseApplyPatchToolCallStatusInProgress BetaResponseApplyPatchToolCallStatus = "in_progress"
+ BetaResponseApplyPatchToolCallStatusCompleted BetaResponseApplyPatchToolCallStatus = "completed"
+)
+
+// The agent that produced this item.
+type BetaResponseApplyPatchToolCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseApplyPatchToolCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseApplyPatchToolCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseApplyPatchToolCallCallerUnion contains all possible properties and
+// values from [BetaResponseApplyPatchToolCallCallerDirect],
+// [BetaResponseApplyPatchToolCallCallerProgram].
+//
+// Use the [BetaResponseApplyPatchToolCallCallerUnion.AsAny] method to switch on
+// the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseApplyPatchToolCallCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [BetaResponseApplyPatchToolCallCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseApplyPatchToolCallCaller is implemented by each variant of
+// [BetaResponseApplyPatchToolCallCallerUnion] to add type safety for the return
+// type of [BetaResponseApplyPatchToolCallCallerUnion.AsAny]
+type anyBetaResponseApplyPatchToolCallCaller interface {
+ implBetaResponseApplyPatchToolCallCallerUnion()
+}
+
+func (BetaResponseApplyPatchToolCallCallerDirect) implBetaResponseApplyPatchToolCallCallerUnion() {}
+func (BetaResponseApplyPatchToolCallCallerProgram) implBetaResponseApplyPatchToolCallCallerUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseApplyPatchToolCallCallerUnion.AsAny().(type) {
+// case openai.BetaResponseApplyPatchToolCallCallerDirect:
+// case openai.BetaResponseApplyPatchToolCallCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseApplyPatchToolCallCallerUnion) AsAny() anyBetaResponseApplyPatchToolCallCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u BetaResponseApplyPatchToolCallCallerUnion) AsDirect() (v BetaResponseApplyPatchToolCallCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseApplyPatchToolCallCallerUnion) AsProgram() (v BetaResponseApplyPatchToolCallCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseApplyPatchToolCallCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseApplyPatchToolCallCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseApplyPatchToolCallCallerDirect struct {
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseApplyPatchToolCallCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseApplyPatchToolCallCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseApplyPatchToolCallCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseApplyPatchToolCallCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseApplyPatchToolCallCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The output emitted by an apply patch tool call.
+type BetaResponseApplyPatchToolCallOutput struct {
+ // The unique ID of the apply patch tool call output. Populated when this item is
+ // returned via API.
+ ID string `json:"id" api:"required"`
+ // The unique ID of the apply patch tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // The status of the apply patch tool call output. One of `completed` or `failed`.
+ //
+ // Any of "completed", "failed".
+ Status BetaResponseApplyPatchToolCallOutputStatus `json:"status" api:"required"`
+ // The type of the item. Always `apply_patch_call_output`.
+ Type constant.ApplyPatchCallOutput `json:"type" default:"apply_patch_call_output"`
+ // The agent that produced this item.
+ Agent BetaResponseApplyPatchToolCallOutputAgent `json:"agent"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseApplyPatchToolCallOutputCallerUnion `json:"caller" api:"nullable"`
+ // The ID of the entity that created this tool call output.
+ CreatedBy string `json:"created_by"`
+ // Optional textual output returned by the apply patch tool.
+ Output string `json:"output" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Caller respjson.Field
+ CreatedBy respjson.Field
+ Output respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseApplyPatchToolCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseApplyPatchToolCallOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The status of the apply patch tool call output. One of `completed` or `failed`.
+type BetaResponseApplyPatchToolCallOutputStatus string
+
+const (
+ BetaResponseApplyPatchToolCallOutputStatusCompleted BetaResponseApplyPatchToolCallOutputStatus = "completed"
+ BetaResponseApplyPatchToolCallOutputStatusFailed BetaResponseApplyPatchToolCallOutputStatus = "failed"
+)
+
+// The agent that produced this item.
+type BetaResponseApplyPatchToolCallOutputAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseApplyPatchToolCallOutputAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseApplyPatchToolCallOutputAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseApplyPatchToolCallOutputCallerUnion contains all possible properties
+// and values from [BetaResponseApplyPatchToolCallOutputCallerDirect],
+// [BetaResponseApplyPatchToolCallOutputCallerProgram].
+//
+// Use the [BetaResponseApplyPatchToolCallOutputCallerUnion.AsAny] method to switch
+// on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseApplyPatchToolCallOutputCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [BetaResponseApplyPatchToolCallOutputCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseApplyPatchToolCallOutputCaller is implemented by each variant of
+// [BetaResponseApplyPatchToolCallOutputCallerUnion] to add type safety for the
+// return type of [BetaResponseApplyPatchToolCallOutputCallerUnion.AsAny]
+type anyBetaResponseApplyPatchToolCallOutputCaller interface {
+ implBetaResponseApplyPatchToolCallOutputCallerUnion()
+}
+
+func (BetaResponseApplyPatchToolCallOutputCallerDirect) implBetaResponseApplyPatchToolCallOutputCallerUnion() {
+}
+func (BetaResponseApplyPatchToolCallOutputCallerProgram) implBetaResponseApplyPatchToolCallOutputCallerUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseApplyPatchToolCallOutputCallerUnion.AsAny().(type) {
+// case openai.BetaResponseApplyPatchToolCallOutputCallerDirect:
+// case openai.BetaResponseApplyPatchToolCallOutputCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseApplyPatchToolCallOutputCallerUnion) AsAny() anyBetaResponseApplyPatchToolCallOutputCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u BetaResponseApplyPatchToolCallOutputCallerUnion) AsDirect() (v BetaResponseApplyPatchToolCallOutputCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseApplyPatchToolCallOutputCallerUnion) AsProgram() (v BetaResponseApplyPatchToolCallOutputCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseApplyPatchToolCallOutputCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseApplyPatchToolCallOutputCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseApplyPatchToolCallOutputCallerDirect struct {
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseApplyPatchToolCallOutputCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseApplyPatchToolCallOutputCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseApplyPatchToolCallOutputCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseApplyPatchToolCallOutputCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseApplyPatchToolCallOutputCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when there is a partial audio response.
+type BetaResponseAudioDeltaEvent struct {
+ // A chunk of Base64 encoded response audio bytes.
+ Delta string `json:"delta" api:"required"`
+ // A sequence number for this chunk of the stream response.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.audio.delta`.
+ Type constant.ResponseAudioDelta `json:"type" default:"response.audio.delta"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseAudioDeltaEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Delta respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseAudioDeltaEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseAudioDeltaEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseAudioDeltaEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseAudioDeltaEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseAudioDeltaEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when the audio response is complete.
+type BetaResponseAudioDoneEvent struct {
+ // The sequence number of the delta.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.audio.done`.
+ Type constant.ResponseAudioDone `json:"type" default:"response.audio.done"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseAudioDoneEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseAudioDoneEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseAudioDoneEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseAudioDoneEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseAudioDoneEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseAudioDoneEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when there is a partial transcript of audio.
+type BetaResponseAudioTranscriptDeltaEvent struct {
+ // The partial transcript of the audio response.
+ Delta string `json:"delta" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.audio.transcript.delta`.
+ Type constant.ResponseAudioTranscriptDelta `json:"type" default:"response.audio.transcript.delta"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseAudioTranscriptDeltaEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Delta respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseAudioTranscriptDeltaEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseAudioTranscriptDeltaEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseAudioTranscriptDeltaEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseAudioTranscriptDeltaEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseAudioTranscriptDeltaEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when the full audio transcript is completed.
+type BetaResponseAudioTranscriptDoneEvent struct {
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.audio.transcript.done`.
+ Type constant.ResponseAudioTranscriptDone `json:"type" default:"response.audio.transcript.done"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseAudioTranscriptDoneEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseAudioTranscriptDoneEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseAudioTranscriptDoneEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseAudioTranscriptDoneEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseAudioTranscriptDoneEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseAudioTranscriptDoneEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when a partial code snippet is streamed by the code interpreter.
+type BetaResponseCodeInterpreterCallCodeDeltaEvent struct {
+ // The partial code snippet being streamed by the code interpreter.
+ Delta string `json:"delta" api:"required"`
+ // The unique identifier of the code interpreter tool call item.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item in the response for which the code is being
+ // streamed.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event, used to order streaming events.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.code_interpreter_call_code.delta`.
+ Type constant.ResponseCodeInterpreterCallCodeDelta `json:"type" default:"response.code_interpreter_call_code.delta"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseCodeInterpreterCallCodeDeltaEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Delta respjson.Field
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCodeInterpreterCallCodeDeltaEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCodeInterpreterCallCodeDeltaEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseCodeInterpreterCallCodeDeltaEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCodeInterpreterCallCodeDeltaEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCodeInterpreterCallCodeDeltaEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when the code snippet is finalized by the code interpreter.
+type BetaResponseCodeInterpreterCallCodeDoneEvent struct {
+ // The final code snippet output by the code interpreter.
+ Code string `json:"code" api:"required"`
+ // The unique identifier of the code interpreter tool call item.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item in the response for which the code is finalized.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event, used to order streaming events.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.code_interpreter_call_code.done`.
+ Type constant.ResponseCodeInterpreterCallCodeDone `json:"type" default:"response.code_interpreter_call_code.done"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseCodeInterpreterCallCodeDoneEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Code respjson.Field
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCodeInterpreterCallCodeDoneEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCodeInterpreterCallCodeDoneEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseCodeInterpreterCallCodeDoneEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCodeInterpreterCallCodeDoneEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCodeInterpreterCallCodeDoneEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when the code interpreter call is completed.
+type BetaResponseCodeInterpreterCallCompletedEvent struct {
+ // The unique identifier of the code interpreter tool call item.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item in the response for which the code interpreter call
+ // is completed.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event, used to order streaming events.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.code_interpreter_call.completed`.
+ Type constant.ResponseCodeInterpreterCallCompleted `json:"type" default:"response.code_interpreter_call.completed"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseCodeInterpreterCallCompletedEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCodeInterpreterCallCompletedEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCodeInterpreterCallCompletedEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseCodeInterpreterCallCompletedEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCodeInterpreterCallCompletedEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCodeInterpreterCallCompletedEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when a code interpreter call is in progress.
+type BetaResponseCodeInterpreterCallInProgressEvent struct {
+ // The unique identifier of the code interpreter tool call item.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item in the response for which the code interpreter call
+ // is in progress.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event, used to order streaming events.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.code_interpreter_call.in_progress`.
+ Type constant.ResponseCodeInterpreterCallInProgress `json:"type" default:"response.code_interpreter_call.in_progress"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseCodeInterpreterCallInProgressEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCodeInterpreterCallInProgressEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCodeInterpreterCallInProgressEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseCodeInterpreterCallInProgressEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCodeInterpreterCallInProgressEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCodeInterpreterCallInProgressEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when the code interpreter is actively interpreting the code snippet.
+type BetaResponseCodeInterpreterCallInterpretingEvent struct {
+ // The unique identifier of the code interpreter tool call item.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item in the response for which the code interpreter is
+ // interpreting code.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event, used to order streaming events.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.code_interpreter_call.interpreting`.
+ Type constant.ResponseCodeInterpreterCallInterpreting `json:"type" default:"response.code_interpreter_call.interpreting"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseCodeInterpreterCallInterpretingEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCodeInterpreterCallInterpretingEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCodeInterpreterCallInterpretingEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseCodeInterpreterCallInterpretingEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCodeInterpreterCallInterpretingEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCodeInterpreterCallInterpretingEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool call to run code.
+type BetaResponseCodeInterpreterToolCall struct {
+ // The unique ID of the code interpreter tool call.
+ ID string `json:"id" api:"required"`
+ // The code to run, or null if not available.
+ Code string `json:"code" api:"required"`
+ // The ID of the container used to run the code.
+ ContainerID string `json:"container_id" api:"required"`
+ // The outputs generated by the code interpreter, such as logs or images. Can be
+ // null if no outputs are available.
+ Outputs []BetaResponseCodeInterpreterToolCallOutputUnion `json:"outputs" api:"required"`
+ // The status of the code interpreter tool call. Valid values are `in_progress`,
+ // `completed`, `incomplete`, `interpreting`, and `failed`.
+ //
+ // Any of "in_progress", "completed", "incomplete", "interpreting", "failed".
+ Status BetaResponseCodeInterpreterToolCallStatus `json:"status" api:"required"`
+ // The type of the code interpreter tool call. Always `code_interpreter_call`.
+ Type constant.CodeInterpreterCall `json:"type" default:"code_interpreter_call"`
+ // The agent that produced this item.
+ Agent BetaResponseCodeInterpreterToolCallAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Code respjson.Field
+ ContainerID respjson.Field
+ Outputs respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCodeInterpreterToolCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCodeInterpreterToolCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseCodeInterpreterToolCall to a
+// BetaResponseCodeInterpreterToolCallParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseCodeInterpreterToolCallParam.Overrides()
+func (r BetaResponseCodeInterpreterToolCall) ToParam() BetaResponseCodeInterpreterToolCallParam {
+ return param.Override[BetaResponseCodeInterpreterToolCallParam](json.RawMessage(r.RawJSON()))
+}
+
+// BetaResponseCodeInterpreterToolCallOutputUnion contains all possible properties
+// and values from [BetaResponseCodeInterpreterToolCallOutputLogs],
+// [BetaResponseCodeInterpreterToolCallOutputImage].
+//
+// Use the [BetaResponseCodeInterpreterToolCallOutputUnion.AsAny] method to switch
+// on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseCodeInterpreterToolCallOutputUnion struct {
+ // This field is from variant [BetaResponseCodeInterpreterToolCallOutputLogs].
+ Logs string `json:"logs"`
+ // Any of "logs", "image".
+ Type string `json:"type"`
+ // This field is from variant [BetaResponseCodeInterpreterToolCallOutputImage].
+ URL string `json:"url"`
+ JSON struct {
+ Logs respjson.Field
+ Type respjson.Field
+ URL respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseCodeInterpreterToolCallOutput is implemented by each variant of
+// [BetaResponseCodeInterpreterToolCallOutputUnion] to add type safety for the
+// return type of [BetaResponseCodeInterpreterToolCallOutputUnion.AsAny]
+type anyBetaResponseCodeInterpreterToolCallOutput interface {
+ implBetaResponseCodeInterpreterToolCallOutputUnion()
+}
+
+func (BetaResponseCodeInterpreterToolCallOutputLogs) implBetaResponseCodeInterpreterToolCallOutputUnion() {
+}
+func (BetaResponseCodeInterpreterToolCallOutputImage) implBetaResponseCodeInterpreterToolCallOutputUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseCodeInterpreterToolCallOutputUnion.AsAny().(type) {
+// case openai.BetaResponseCodeInterpreterToolCallOutputLogs:
+// case openai.BetaResponseCodeInterpreterToolCallOutputImage:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseCodeInterpreterToolCallOutputUnion) AsAny() anyBetaResponseCodeInterpreterToolCallOutput {
+ switch u.Type {
+ case "logs":
+ return u.AsLogs()
+ case "image":
+ return u.AsImage()
+ }
+ return nil
+}
+
+func (u BetaResponseCodeInterpreterToolCallOutputUnion) AsLogs() (v BetaResponseCodeInterpreterToolCallOutputLogs) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseCodeInterpreterToolCallOutputUnion) AsImage() (v BetaResponseCodeInterpreterToolCallOutputImage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseCodeInterpreterToolCallOutputUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseCodeInterpreterToolCallOutputUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The logs output from the code interpreter.
+type BetaResponseCodeInterpreterToolCallOutputLogs struct {
+ // The logs output from the code interpreter.
+ Logs string `json:"logs" api:"required"`
+ // The type of the output. Always `logs`.
+ Type constant.Logs `json:"type" default:"logs"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Logs respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCodeInterpreterToolCallOutputLogs) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCodeInterpreterToolCallOutputLogs) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The image output from the code interpreter.
+type BetaResponseCodeInterpreterToolCallOutputImage struct {
+ // The type of the output. Always `image`.
+ Type constant.Image `json:"type" default:"image"`
+ // The URL of the image output from the code interpreter.
+ URL string `json:"url" api:"required" format:"uri"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ URL respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCodeInterpreterToolCallOutputImage) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCodeInterpreterToolCallOutputImage) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The status of the code interpreter tool call. Valid values are `in_progress`,
+// `completed`, `incomplete`, `interpreting`, and `failed`.
+type BetaResponseCodeInterpreterToolCallStatus string
+
+const (
+ BetaResponseCodeInterpreterToolCallStatusInProgress BetaResponseCodeInterpreterToolCallStatus = "in_progress"
+ BetaResponseCodeInterpreterToolCallStatusCompleted BetaResponseCodeInterpreterToolCallStatus = "completed"
+ BetaResponseCodeInterpreterToolCallStatusIncomplete BetaResponseCodeInterpreterToolCallStatus = "incomplete"
+ BetaResponseCodeInterpreterToolCallStatusInterpreting BetaResponseCodeInterpreterToolCallStatus = "interpreting"
+ BetaResponseCodeInterpreterToolCallStatusFailed BetaResponseCodeInterpreterToolCallStatus = "failed"
+)
+
+// The agent that produced this item.
+type BetaResponseCodeInterpreterToolCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCodeInterpreterToolCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCodeInterpreterToolCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool call to run code.
+//
+// The properties ID, Code, ContainerID, Outputs, Status, Type are required.
+type BetaResponseCodeInterpreterToolCallParam struct {
+ // The code to run, or null if not available.
+ Code param.Opt[string] `json:"code,omitzero" api:"required"`
+ // The outputs generated by the code interpreter, such as logs or images. Can be
+ // null if no outputs are available.
+ Outputs []BetaResponseCodeInterpreterToolCallOutputUnionParam `json:"outputs,omitzero" api:"required"`
+ // The unique ID of the code interpreter tool call.
+ ID string `json:"id" api:"required"`
+ // The ID of the container used to run the code.
+ ContainerID string `json:"container_id" api:"required"`
+ // The status of the code interpreter tool call. Valid values are `in_progress`,
+ // `completed`, `incomplete`, `interpreting`, and `failed`.
+ //
+ // Any of "in_progress", "completed", "incomplete", "interpreting", "failed".
+ Status BetaResponseCodeInterpreterToolCallStatus `json:"status,omitzero" api:"required"`
+ // The agent that produced this item.
+ Agent BetaResponseCodeInterpreterToolCallAgentParam `json:"agent,omitzero"`
+ // The type of the code interpreter tool call. Always `code_interpreter_call`.
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "code_interpreter_call".
+ Type constant.CodeInterpreterCall `json:"type" default:"code_interpreter_call"`
+ paramObj
+}
+
+func (r BetaResponseCodeInterpreterToolCallParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseCodeInterpreterToolCallParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseCodeInterpreterToolCallParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseCodeInterpreterToolCallOutputUnionParam struct {
+ OfLogs *BetaResponseCodeInterpreterToolCallOutputLogsParam `json:",omitzero,inline"`
+ OfImage *BetaResponseCodeInterpreterToolCallOutputImageParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseCodeInterpreterToolCallOutputUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfLogs, u.OfImage)
+}
+func (u *BetaResponseCodeInterpreterToolCallOutputUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseCodeInterpreterToolCallOutputUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfLogs) {
+ return u.OfLogs
+ } else if !param.IsOmitted(u.OfImage) {
+ return u.OfImage
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseCodeInterpreterToolCallOutputUnionParam) GetLogs() *string {
+ if vt := u.OfLogs; vt != nil {
+ return &vt.Logs
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseCodeInterpreterToolCallOutputUnionParam) GetURL() *string {
+ if vt := u.OfImage; vt != nil {
+ return &vt.URL
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseCodeInterpreterToolCallOutputUnionParam) GetType() *string {
+ if vt := u.OfLogs; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfImage; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseCodeInterpreterToolCallOutputUnionParam](
+ "type",
+ apijson.Discriminator[BetaResponseCodeInterpreterToolCallOutputLogsParam]("logs"),
+ apijson.Discriminator[BetaResponseCodeInterpreterToolCallOutputImageParam]("image"),
+ )
+}
+
+// The logs output from the code interpreter.
+//
+// The properties Logs, Type are required.
+type BetaResponseCodeInterpreterToolCallOutputLogsParam struct {
+ // The logs output from the code interpreter.
+ Logs string `json:"logs" api:"required"`
+ // The type of the output. Always `logs`.
+ //
+ // This field can be elided, and will marshal its zero value as "logs".
+ Type constant.Logs `json:"type" default:"logs"`
+ paramObj
+}
+
+func (r BetaResponseCodeInterpreterToolCallOutputLogsParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseCodeInterpreterToolCallOutputLogsParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseCodeInterpreterToolCallOutputLogsParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The image output from the code interpreter.
+//
+// The properties Type, URL are required.
+type BetaResponseCodeInterpreterToolCallOutputImageParam struct {
+ // The URL of the image output from the code interpreter.
+ URL string `json:"url" api:"required" format:"uri"`
+ // The type of the output. Always `image`.
+ //
+ // This field can be elided, and will marshal its zero value as "image".
+ Type constant.Image `json:"type" default:"image"`
+ paramObj
+}
+
+func (r BetaResponseCodeInterpreterToolCallOutputImageParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseCodeInterpreterToolCallOutputImageParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseCodeInterpreterToolCallOutputImageParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseCodeInterpreterToolCallAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseCodeInterpreterToolCallAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseCodeInterpreterToolCallAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseCodeInterpreterToolCallAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A compaction item generated by the
+// [`v1/responses/compact` API](https://platform.openai.com/docs/api-reference/responses/compact).
+type BetaResponseCompactionItem struct {
+ // The unique ID of the compaction item.
+ ID string `json:"id" api:"required"`
+ // The encrypted content that was produced by compaction.
+ EncryptedContent string `json:"encrypted_content" api:"required"`
+ // The type of the item. Always `compaction`.
+ Type constant.Compaction `json:"type" default:"compaction"`
+ // The agent that produced this item.
+ Agent BetaResponseCompactionItemAgent `json:"agent"`
+ // The identifier of the actor that created the item.
+ CreatedBy string `json:"created_by"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ EncryptedContent respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ CreatedBy respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCompactionItem) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCompactionItem) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseCompactionItemAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCompactionItemAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCompactionItemAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A compaction item generated by the
+// [`v1/responses/compact` API](https://platform.openai.com/docs/api-reference/responses/compact).
+type BetaResponseCompactionItemParamResp struct {
+ // The encrypted content of the compaction summary.
+ EncryptedContent string `json:"encrypted_content" api:"required"`
+ // The type of the item. Always `compaction`.
+ Type constant.Compaction `json:"type" default:"compaction"`
+ // The ID of the compaction item.
+ ID string `json:"id" api:"nullable"`
+ // The agent that produced this item.
+ Agent BetaResponseCompactionItemParamAgentResp `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ EncryptedContent respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCompactionItemParamResp) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCompactionItemParamResp) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseCompactionItemParamResp to a
+// BetaResponseCompactionItemParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseCompactionItemParam.Overrides()
+func (r BetaResponseCompactionItemParamResp) ToParam() BetaResponseCompactionItemParam {
+ return param.Override[BetaResponseCompactionItemParam](json.RawMessage(r.RawJSON()))
+}
+
+// The agent that produced this item.
+type BetaResponseCompactionItemParamAgentResp struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCompactionItemParamAgentResp) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCompactionItemParamAgentResp) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A compaction item generated by the
+// [`v1/responses/compact` API](https://platform.openai.com/docs/api-reference/responses/compact).
+//
+// The properties EncryptedContent, Type are required.
+type BetaResponseCompactionItemParam struct {
+ // The encrypted content of the compaction summary.
+ EncryptedContent string `json:"encrypted_content" api:"required"`
+ // The ID of the compaction item.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // The agent that produced this item.
+ Agent BetaResponseCompactionItemParamAgent `json:"agent,omitzero"`
+ // The type of the item. Always `compaction`.
+ //
+ // This field can be elided, and will marshal its zero value as "compaction".
+ Type constant.Compaction `json:"type" default:"compaction"`
+ paramObj
+}
+
+func (r BetaResponseCompactionItemParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseCompactionItemParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseCompactionItemParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseCompactionItemParamAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseCompactionItemParamAgent) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseCompactionItemParamAgent
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseCompactionItemParamAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when the model response is complete.
+type BetaResponseCompletedEvent struct {
+ // Properties of the completed response.
+ Response BetaResponse `json:"response" api:"required"`
+ // The sequence number for this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.completed`.
+ Type constant.ResponseCompleted `json:"type" default:"response.completed"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseCompletedEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Response respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCompletedEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCompletedEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseCompletedEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCompletedEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCompletedEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool call to a computer use tool. See the
+// [computer use guide](https://platform.openai.com/docs/guides/tools-computer-use)
+// for more information.
+type BetaResponseComputerToolCall struct {
+ // The unique ID of the computer call.
+ ID string `json:"id" api:"required"`
+ // An identifier used when responding to the tool call with output.
+ CallID string `json:"call_id" api:"required"`
+ // The pending safety checks for the computer call.
+ PendingSafetyChecks []BetaResponseComputerToolCallPendingSafetyCheck `json:"pending_safety_checks" api:"required"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ // Populated when items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status BetaResponseComputerToolCallStatus `json:"status" api:"required"`
+ // The type of the computer call. Always `computer_call`.
+ //
+ // Any of "computer_call".
+ Type BetaResponseComputerToolCallType `json:"type" api:"required"`
+ // A click action.
+ Action BetaComputerActionUnion `json:"action"`
+ // Flattened batched actions for `computer_use`. Each action includes an `type`
+ // discriminator and action-specific fields.
+ Actions BetaComputerActionList `json:"actions"`
+ // The agent that produced this item.
+ Agent BetaResponseComputerToolCallAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ PendingSafetyChecks respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Action respjson.Field
+ Actions respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseComputerToolCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseComputerToolCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseComputerToolCall to a
+// BetaResponseComputerToolCallParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseComputerToolCallParam.Overrides()
+func (r BetaResponseComputerToolCall) ToParam() BetaResponseComputerToolCallParam {
+ return param.Override[BetaResponseComputerToolCallParam](json.RawMessage(r.RawJSON()))
+}
+
+// A pending safety check for the computer call.
+type BetaResponseComputerToolCallPendingSafetyCheck struct {
+ // The ID of the pending safety check.
+ ID string `json:"id" api:"required"`
+ // The type of the pending safety check.
+ Code string `json:"code" api:"nullable"`
+ // Details about the pending safety check.
+ Message string `json:"message" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Code respjson.Field
+ Message respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseComputerToolCallPendingSafetyCheck) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseComputerToolCallPendingSafetyCheck) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+// Populated when items are returned via API.
+type BetaResponseComputerToolCallStatus string
+
+const (
+ BetaResponseComputerToolCallStatusInProgress BetaResponseComputerToolCallStatus = "in_progress"
+ BetaResponseComputerToolCallStatusCompleted BetaResponseComputerToolCallStatus = "completed"
+ BetaResponseComputerToolCallStatusIncomplete BetaResponseComputerToolCallStatus = "incomplete"
+)
+
+// The type of the computer call. Always `computer_call`.
+type BetaResponseComputerToolCallType string
+
+const (
+ BetaResponseComputerToolCallTypeComputerCall BetaResponseComputerToolCallType = "computer_call"
+)
+
+// The agent that produced this item.
+type BetaResponseComputerToolCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseComputerToolCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseComputerToolCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool call to a computer use tool. See the
+// [computer use guide](https://platform.openai.com/docs/guides/tools-computer-use)
+// for more information.
+//
+// The properties ID, CallID, PendingSafetyChecks, Status, Type are required.
+type BetaResponseComputerToolCallParam struct {
+ // The unique ID of the computer call.
+ ID string `json:"id" api:"required"`
+ // An identifier used when responding to the tool call with output.
+ CallID string `json:"call_id" api:"required"`
+ // The pending safety checks for the computer call.
+ PendingSafetyChecks []BetaResponseComputerToolCallPendingSafetyCheckParam `json:"pending_safety_checks,omitzero" api:"required"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ // Populated when items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status BetaResponseComputerToolCallStatus `json:"status,omitzero" api:"required"`
+ // The type of the computer call. Always `computer_call`.
+ //
+ // Any of "computer_call".
+ Type BetaResponseComputerToolCallType `json:"type,omitzero" api:"required"`
+ // The agent that produced this item.
+ Agent BetaResponseComputerToolCallAgentParam `json:"agent,omitzero"`
+ // A click action.
+ Action BetaComputerActionUnionParam `json:"action,omitzero"`
+ // Flattened batched actions for `computer_use`. Each action includes an `type`
+ // discriminator and action-specific fields.
+ Actions BetaComputerActionListParam `json:"actions,omitzero"`
+ paramObj
+}
+
+func (r BetaResponseComputerToolCallParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseComputerToolCallParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseComputerToolCallParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A pending safety check for the computer call.
+//
+// The property ID is required.
+type BetaResponseComputerToolCallPendingSafetyCheckParam struct {
+ // The ID of the pending safety check.
+ ID string `json:"id" api:"required"`
+ // The type of the pending safety check.
+ Code param.Opt[string] `json:"code,omitzero"`
+ // Details about the pending safety check.
+ Message param.Opt[string] `json:"message,omitzero"`
+ paramObj
+}
+
+func (r BetaResponseComputerToolCallPendingSafetyCheckParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseComputerToolCallPendingSafetyCheckParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseComputerToolCallPendingSafetyCheckParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseComputerToolCallAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseComputerToolCallAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseComputerToolCallAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseComputerToolCallAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseComputerToolCallOutputItem struct {
+ // The unique ID of the computer call tool output.
+ ID string `json:"id" api:"required"`
+ // The ID of the computer tool call that produced the output.
+ CallID string `json:"call_id" api:"required"`
+ // A computer screenshot image used with the computer use tool.
+ Output BetaResponseComputerToolCallOutputScreenshot `json:"output" api:"required"`
+ // The status of the message input. One of `in_progress`, `completed`, or
+ // `incomplete`. Populated when input items are returned via API.
+ //
+ // Any of "completed", "incomplete", "failed", "in_progress".
+ Status BetaResponseComputerToolCallOutputItemStatus `json:"status" api:"required"`
+ // The type of the computer tool call output. Always `computer_call_output`.
+ Type constant.ComputerCallOutput `json:"type" default:"computer_call_output"`
+ // The safety checks reported by the API that have been acknowledged by the
+ // developer.
+ AcknowledgedSafetyChecks []BetaResponseComputerToolCallOutputItemAcknowledgedSafetyCheck `json:"acknowledged_safety_checks"`
+ // The agent that produced this item.
+ Agent BetaResponseComputerToolCallOutputItemAgent `json:"agent" api:"nullable"`
+ // The identifier of the actor that created the item.
+ CreatedBy string `json:"created_by"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Output respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ AcknowledgedSafetyChecks respjson.Field
+ Agent respjson.Field
+ CreatedBy respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseComputerToolCallOutputItem) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseComputerToolCallOutputItem) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The status of the message input. One of `in_progress`, `completed`, or
+// `incomplete`. Populated when input items are returned via API.
+type BetaResponseComputerToolCallOutputItemStatus string
+
+const (
+ BetaResponseComputerToolCallOutputItemStatusCompleted BetaResponseComputerToolCallOutputItemStatus = "completed"
+ BetaResponseComputerToolCallOutputItemStatusIncomplete BetaResponseComputerToolCallOutputItemStatus = "incomplete"
+ BetaResponseComputerToolCallOutputItemStatusFailed BetaResponseComputerToolCallOutputItemStatus = "failed"
+ BetaResponseComputerToolCallOutputItemStatusInProgress BetaResponseComputerToolCallOutputItemStatus = "in_progress"
+)
+
+// A pending safety check for the computer call.
+type BetaResponseComputerToolCallOutputItemAcknowledgedSafetyCheck struct {
+ // The ID of the pending safety check.
+ ID string `json:"id" api:"required"`
+ // The type of the pending safety check.
+ Code string `json:"code" api:"nullable"`
+ // Details about the pending safety check.
+ Message string `json:"message" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Code respjson.Field
+ Message respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseComputerToolCallOutputItemAcknowledgedSafetyCheck) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *BetaResponseComputerToolCallOutputItemAcknowledgedSafetyCheck) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseComputerToolCallOutputItemAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseComputerToolCallOutputItemAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseComputerToolCallOutputItemAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A computer screenshot image used with the computer use tool.
+type BetaResponseComputerToolCallOutputScreenshot struct {
+ // Specifies the event type. For a computer screenshot, this property is always set
+ // to `computer_screenshot`.
+ Type constant.ComputerScreenshot `json:"type" default:"computer_screenshot"`
+ // The identifier of an uploaded file that contains the screenshot.
+ FileID string `json:"file_id"`
+ // The URL of the screenshot image.
+ ImageURL string `json:"image_url" format:"uri"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseComputerToolCallOutputScreenshot) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseComputerToolCallOutputScreenshot) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseComputerToolCallOutputScreenshot to a
+// BetaResponseComputerToolCallOutputScreenshotParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseComputerToolCallOutputScreenshotParam.Overrides()
+func (r BetaResponseComputerToolCallOutputScreenshot) ToParam() BetaResponseComputerToolCallOutputScreenshotParam {
+ return param.Override[BetaResponseComputerToolCallOutputScreenshotParam](json.RawMessage(r.RawJSON()))
+}
+
+// A computer screenshot image used with the computer use tool.
+//
+// The property Type is required.
+type BetaResponseComputerToolCallOutputScreenshotParam struct {
+ // The identifier of an uploaded file that contains the screenshot.
+ FileID param.Opt[string] `json:"file_id,omitzero"`
+ // The URL of the screenshot image.
+ ImageURL param.Opt[string] `json:"image_url,omitzero" format:"uri"`
+ // Specifies the event type. For a computer screenshot, this property is always set
+ // to `computer_screenshot`.
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "computer_screenshot".
+ Type constant.ComputerScreenshot `json:"type" default:"computer_screenshot"`
+ paramObj
+}
+
+func (r BetaResponseComputerToolCallOutputScreenshotParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseComputerToolCallOutputScreenshotParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseComputerToolCallOutputScreenshotParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Represents a container created with /v1/containers.
+type BetaResponseContainerReference struct {
+ ContainerID string `json:"container_id" api:"required"`
+ // The environment type. Always `container_reference`.
+ Type constant.ContainerReference `json:"type" default:"container_reference"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ContainerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseContainerReference) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseContainerReference) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when a new content part is added.
+type BetaResponseContentPartAddedEvent struct {
+ // The index of the content part that was added.
+ ContentIndex int64 `json:"content_index" api:"required"`
+ // The ID of the output item that the content part was added to.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item that the content part was added to.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The content part that was added.
+ Part BetaResponseContentPartAddedEventPartUnion `json:"part" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.content_part.added`.
+ Type constant.ResponseContentPartAdded `json:"type" default:"response.content_part.added"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseContentPartAddedEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ContentIndex respjson.Field
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ Part respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseContentPartAddedEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseContentPartAddedEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseContentPartAddedEventPartUnion contains all possible properties and
+// values from [BetaResponseOutputText], [BetaResponseOutputRefusal],
+// [BetaResponseContentPartAddedEventPartReasoningText].
+//
+// Use the [BetaResponseContentPartAddedEventPartUnion.AsAny] method to switch on
+// the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseContentPartAddedEventPartUnion struct {
+ // This field is from variant [BetaResponseOutputText].
+ Annotations []BetaResponseOutputTextAnnotationUnion `json:"annotations"`
+ Text string `json:"text"`
+ // Any of "output_text", "refusal", "reasoning_text".
+ Type string `json:"type"`
+ // This field is from variant [BetaResponseOutputText].
+ Logprobs []BetaResponseOutputTextLogprob `json:"logprobs"`
+ // This field is from variant [BetaResponseOutputRefusal].
+ Refusal string `json:"refusal"`
+ JSON struct {
+ Annotations respjson.Field
+ Text respjson.Field
+ Type respjson.Field
+ Logprobs respjson.Field
+ Refusal respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseContentPartAddedEventPart is implemented by each variant of
+// [BetaResponseContentPartAddedEventPartUnion] to add type safety for the return
+// type of [BetaResponseContentPartAddedEventPartUnion.AsAny]
+type anyBetaResponseContentPartAddedEventPart interface {
+ implBetaResponseContentPartAddedEventPartUnion()
+}
+
+func (BetaResponseOutputText) implBetaResponseContentPartAddedEventPartUnion() {}
+func (BetaResponseOutputRefusal) implBetaResponseContentPartAddedEventPartUnion() {}
+func (BetaResponseContentPartAddedEventPartReasoningText) implBetaResponseContentPartAddedEventPartUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseContentPartAddedEventPartUnion.AsAny().(type) {
+// case openai.BetaResponseOutputText:
+// case openai.BetaResponseOutputRefusal:
+// case openai.BetaResponseContentPartAddedEventPartReasoningText:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseContentPartAddedEventPartUnion) AsAny() anyBetaResponseContentPartAddedEventPart {
+ switch u.Type {
+ case "output_text":
+ return u.AsOutputText()
+ case "refusal":
+ return u.AsRefusal()
+ case "reasoning_text":
+ return u.AsReasoningText()
+ }
+ return nil
+}
+
+func (u BetaResponseContentPartAddedEventPartUnion) AsOutputText() (v BetaResponseOutputText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseContentPartAddedEventPartUnion) AsRefusal() (v BetaResponseOutputRefusal) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseContentPartAddedEventPartUnion) AsReasoningText() (v BetaResponseContentPartAddedEventPartReasoningText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseContentPartAddedEventPartUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseContentPartAddedEventPartUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Reasoning text from the model.
+type BetaResponseContentPartAddedEventPartReasoningText struct {
+ // The reasoning text from the model.
+ Text string `json:"text" api:"required"`
+ // The type of the reasoning text. Always `reasoning_text`.
+ Type constant.ReasoningText `json:"type" default:"reasoning_text"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseContentPartAddedEventPartReasoningText) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseContentPartAddedEventPartReasoningText) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseContentPartAddedEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseContentPartAddedEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseContentPartAddedEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when a content part is done.
+type BetaResponseContentPartDoneEvent struct {
+ // The index of the content part that is done.
+ ContentIndex int64 `json:"content_index" api:"required"`
+ // The ID of the output item that the content part was added to.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item that the content part was added to.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The content part that is done.
+ Part BetaResponseContentPartDoneEventPartUnion `json:"part" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.content_part.done`.
+ Type constant.ResponseContentPartDone `json:"type" default:"response.content_part.done"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseContentPartDoneEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ContentIndex respjson.Field
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ Part respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseContentPartDoneEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseContentPartDoneEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseContentPartDoneEventPartUnion contains all possible properties and
+// values from [BetaResponseOutputText], [BetaResponseOutputRefusal],
+// [BetaResponseContentPartDoneEventPartReasoningText].
+//
+// Use the [BetaResponseContentPartDoneEventPartUnion.AsAny] method to switch on
+// the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseContentPartDoneEventPartUnion struct {
+ // This field is from variant [BetaResponseOutputText].
+ Annotations []BetaResponseOutputTextAnnotationUnion `json:"annotations"`
+ Text string `json:"text"`
+ // Any of "output_text", "refusal", "reasoning_text".
+ Type string `json:"type"`
+ // This field is from variant [BetaResponseOutputText].
+ Logprobs []BetaResponseOutputTextLogprob `json:"logprobs"`
+ // This field is from variant [BetaResponseOutputRefusal].
+ Refusal string `json:"refusal"`
+ JSON struct {
+ Annotations respjson.Field
+ Text respjson.Field
+ Type respjson.Field
+ Logprobs respjson.Field
+ Refusal respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseContentPartDoneEventPart is implemented by each variant of
+// [BetaResponseContentPartDoneEventPartUnion] to add type safety for the return
+// type of [BetaResponseContentPartDoneEventPartUnion.AsAny]
+type anyBetaResponseContentPartDoneEventPart interface {
+ implBetaResponseContentPartDoneEventPartUnion()
+}
+
+func (BetaResponseOutputText) implBetaResponseContentPartDoneEventPartUnion() {}
+func (BetaResponseOutputRefusal) implBetaResponseContentPartDoneEventPartUnion() {}
+func (BetaResponseContentPartDoneEventPartReasoningText) implBetaResponseContentPartDoneEventPartUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseContentPartDoneEventPartUnion.AsAny().(type) {
+// case openai.BetaResponseOutputText:
+// case openai.BetaResponseOutputRefusal:
+// case openai.BetaResponseContentPartDoneEventPartReasoningText:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseContentPartDoneEventPartUnion) AsAny() anyBetaResponseContentPartDoneEventPart {
+ switch u.Type {
+ case "output_text":
+ return u.AsOutputText()
+ case "refusal":
+ return u.AsRefusal()
+ case "reasoning_text":
+ return u.AsReasoningText()
+ }
+ return nil
+}
+
+func (u BetaResponseContentPartDoneEventPartUnion) AsOutputText() (v BetaResponseOutputText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseContentPartDoneEventPartUnion) AsRefusal() (v BetaResponseOutputRefusal) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseContentPartDoneEventPartUnion) AsReasoningText() (v BetaResponseContentPartDoneEventPartReasoningText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseContentPartDoneEventPartUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseContentPartDoneEventPartUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Reasoning text from the model.
+type BetaResponseContentPartDoneEventPartReasoningText struct {
+ // The reasoning text from the model.
+ Text string `json:"text" api:"required"`
+ // The type of the reasoning text. Always `reasoning_text`.
+ Type constant.ReasoningText `json:"type" default:"reasoning_text"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseContentPartDoneEventPartReasoningText) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseContentPartDoneEventPartReasoningText) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseContentPartDoneEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseContentPartDoneEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseContentPartDoneEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The conversation that this response belongs to.
+//
+// The property ID is required.
+type BetaResponseConversationParam struct {
+ // The unique ID of the conversation.
+ ID string `json:"id" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseConversationParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseConversationParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseConversationParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An event that is emitted when a response is created.
+type BetaResponseCreatedEvent struct {
+ // The response that was created.
+ Response BetaResponse `json:"response" api:"required"`
+ // The sequence number for this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.created`.
+ Type constant.ResponseCreated `json:"type" default:"response.created"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseCreatedEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Response respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCreatedEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCreatedEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseCreatedEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCreatedEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCreatedEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A call to a custom tool created by the model.
+type BetaResponseCustomToolCall struct {
+ // An identifier used to map this custom tool call to a tool call output.
+ CallID string `json:"call_id" api:"required"`
+ // The input for the custom tool call generated by the model.
+ Input string `json:"input" api:"required"`
+ // The name of the custom tool being called.
+ Name string `json:"name" api:"required"`
+ // The type of the custom tool call. Always `custom_tool_call`.
+ Type constant.CustomToolCall `json:"type" default:"custom_tool_call"`
+ // The unique ID of the custom tool call in the OpenAI platform.
+ ID string `json:"id"`
+ // The agent that produced this item.
+ Agent BetaResponseCustomToolCallAgent `json:"agent" api:"nullable"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseCustomToolCallCallerUnion `json:"caller" api:"nullable"`
+ // The namespace of the custom tool being called.
+ Namespace string `json:"namespace"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallID respjson.Field
+ Input respjson.Field
+ Name respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Agent respjson.Field
+ Caller respjson.Field
+ Namespace respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCustomToolCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCustomToolCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseCustomToolCall to a
+// BetaResponseCustomToolCallParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseCustomToolCallParam.Overrides()
+func (r BetaResponseCustomToolCall) ToParam() BetaResponseCustomToolCallParam {
+ return param.Override[BetaResponseCustomToolCallParam](json.RawMessage(r.RawJSON()))
+}
+
+// The agent that produced this item.
+type BetaResponseCustomToolCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCustomToolCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCustomToolCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseCustomToolCallCallerUnion contains all possible properties and
+// values from [BetaResponseCustomToolCallCallerDirect],
+// [BetaResponseCustomToolCallCallerProgram].
+//
+// Use the [BetaResponseCustomToolCallCallerUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseCustomToolCallCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [BetaResponseCustomToolCallCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseCustomToolCallCaller is implemented by each variant of
+// [BetaResponseCustomToolCallCallerUnion] to add type safety for the return type
+// of [BetaResponseCustomToolCallCallerUnion.AsAny]
+type anyBetaResponseCustomToolCallCaller interface {
+ implBetaResponseCustomToolCallCallerUnion()
+}
+
+func (BetaResponseCustomToolCallCallerDirect) implBetaResponseCustomToolCallCallerUnion() {}
+func (BetaResponseCustomToolCallCallerProgram) implBetaResponseCustomToolCallCallerUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseCustomToolCallCallerUnion.AsAny().(type) {
+// case openai.BetaResponseCustomToolCallCallerDirect:
+// case openai.BetaResponseCustomToolCallCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseCustomToolCallCallerUnion) AsAny() anyBetaResponseCustomToolCallCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u BetaResponseCustomToolCallCallerUnion) AsDirect() (v BetaResponseCustomToolCallCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseCustomToolCallCallerUnion) AsProgram() (v BetaResponseCustomToolCallCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseCustomToolCallCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseCustomToolCallCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseCustomToolCallCallerDirect struct {
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCustomToolCallCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCustomToolCallCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseCustomToolCallCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCustomToolCallCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCustomToolCallCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A call to a custom tool created by the model.
+//
+// The properties CallID, Input, Name, Type are required.
+type BetaResponseCustomToolCallParam struct {
+ // An identifier used to map this custom tool call to a tool call output.
+ CallID string `json:"call_id" api:"required"`
+ // The input for the custom tool call generated by the model.
+ Input string `json:"input" api:"required"`
+ // The name of the custom tool being called.
+ Name string `json:"name" api:"required"`
+ // The unique ID of the custom tool call in the OpenAI platform.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // The namespace of the custom tool being called.
+ Namespace param.Opt[string] `json:"namespace,omitzero"`
+ // The agent that produced this item.
+ Agent BetaResponseCustomToolCallAgentParam `json:"agent,omitzero"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseCustomToolCallCallerUnionParam `json:"caller,omitzero"`
+ // The type of the custom tool call. Always `custom_tool_call`.
+ //
+ // This field can be elided, and will marshal its zero value as "custom_tool_call".
+ Type constant.CustomToolCall `json:"type" default:"custom_tool_call"`
+ paramObj
+}
+
+func (r BetaResponseCustomToolCallParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseCustomToolCallParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseCustomToolCallParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseCustomToolCallAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseCustomToolCallAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseCustomToolCallAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseCustomToolCallAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseCustomToolCallCallerUnionParam struct {
+ OfDirect *BetaResponseCustomToolCallCallerDirectParam `json:",omitzero,inline"`
+ OfProgram *BetaResponseCustomToolCallCallerProgramParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseCustomToolCallCallerUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfDirect, u.OfProgram)
+}
+func (u *BetaResponseCustomToolCallCallerUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseCustomToolCallCallerUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfDirect) {
+ return u.OfDirect
+ } else if !param.IsOmitted(u.OfProgram) {
+ return u.OfProgram
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseCustomToolCallCallerUnionParam) GetCallerID() *string {
+ if vt := u.OfProgram; vt != nil {
+ return &vt.CallerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseCustomToolCallCallerUnionParam) GetType() *string {
+ if vt := u.OfDirect; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseCustomToolCallCallerUnionParam](
+ "type",
+ apijson.Discriminator[BetaResponseCustomToolCallCallerDirectParam]("direct"),
+ apijson.Discriminator[BetaResponseCustomToolCallCallerProgramParam]("program"),
+ )
+}
+
+func NewBetaResponseCustomToolCallCallerDirectParam() BetaResponseCustomToolCallCallerDirectParam {
+ return BetaResponseCustomToolCallCallerDirectParam{
+ Type: "direct",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewBetaResponseCustomToolCallCallerDirectParam].
+type BetaResponseCustomToolCallCallerDirectParam struct {
+ Type constant.Direct `json:"type" default:"direct"`
+ paramObj
+}
+
+func (r BetaResponseCustomToolCallCallerDirectParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseCustomToolCallCallerDirectParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseCustomToolCallCallerDirectParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties CallerID, Type are required.
+type BetaResponseCustomToolCallCallerProgramParam struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // This field can be elided, and will marshal its zero value as "program".
+ Type constant.Program `json:"type" default:"program"`
+ paramObj
+}
+
+func (r BetaResponseCustomToolCallCallerProgramParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseCustomToolCallCallerProgramParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseCustomToolCallCallerProgramParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Event representing a delta (partial update) to the input of a custom tool call.
+type BetaResponseCustomToolCallInputDeltaEvent struct {
+ // The incremental input data (delta) for the custom tool call.
+ Delta string `json:"delta" api:"required"`
+ // Unique identifier for the API item associated with this event.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output this delta applies to.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The event type identifier.
+ Type constant.ResponseCustomToolCallInputDelta `json:"type" default:"response.custom_tool_call_input.delta"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseCustomToolCallInputDeltaEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Delta respjson.Field
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCustomToolCallInputDeltaEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCustomToolCallInputDeltaEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseCustomToolCallInputDeltaEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCustomToolCallInputDeltaEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCustomToolCallInputDeltaEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Event indicating that input for a custom tool call is complete.
+type BetaResponseCustomToolCallInputDoneEvent struct {
+ // The complete input data for the custom tool call.
+ Input string `json:"input" api:"required"`
+ // Unique identifier for the API item associated with this event.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output this event applies to.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The event type identifier.
+ Type constant.ResponseCustomToolCallInputDone `json:"type" default:"response.custom_tool_call_input.done"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseCustomToolCallInputDoneEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Input respjson.Field
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCustomToolCallInputDoneEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCustomToolCallInputDoneEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseCustomToolCallInputDoneEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCustomToolCallInputDoneEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCustomToolCallInputDoneEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A call to a custom tool created by the model.
+type BetaResponseCustomToolCallItem struct {
+ // The unique ID of the custom tool call item.
+ ID string `json:"id" api:"required"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ // Populated when items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status" api:"required"`
+ // The identifier of the actor that created the item.
+ CreatedBy string `json:"created_by"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Status respjson.Field
+ CreatedBy respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+ BetaResponseCustomToolCall
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCustomToolCallItem) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCustomToolCallItem) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The output of a custom tool call from your code, being sent back to the model.
+type BetaResponseCustomToolCallOutput struct {
+ // The call ID, used to map this custom tool call output to a custom tool call.
+ CallID string `json:"call_id" api:"required"`
+ // The output from the custom tool call generated by your code. Can be a string or
+ // an list of output content.
+ Output BetaResponseCustomToolCallOutputOutputUnion `json:"output" api:"required"`
+ // The type of the custom tool call output. Always `custom_tool_call_output`.
+ Type constant.CustomToolCallOutput `json:"type" default:"custom_tool_call_output"`
+ // The unique ID of the custom tool call output in the OpenAI platform.
+ ID string `json:"id"`
+ // The agent that produced this item.
+ Agent BetaResponseCustomToolCallOutputAgent `json:"agent" api:"nullable"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseCustomToolCallOutputCallerUnion `json:"caller" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallID respjson.Field
+ Output respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Agent respjson.Field
+ Caller respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCustomToolCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCustomToolCallOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseCustomToolCallOutput to a
+// BetaResponseCustomToolCallOutputParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseCustomToolCallOutputParam.Overrides()
+func (r BetaResponseCustomToolCallOutput) ToParam() BetaResponseCustomToolCallOutputParam {
+ return param.Override[BetaResponseCustomToolCallOutputParam](json.RawMessage(r.RawJSON()))
+}
+
+// BetaResponseCustomToolCallOutputOutputUnion contains all possible properties and
+// values from [string],
+// [[]BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion].
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString OfOutputContentList]
+type BetaResponseCustomToolCallOutputOutputUnion struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion] instead of
+ // an object.
+ OfOutputContentList []BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion `json:",inline"`
+ JSON struct {
+ OfString respjson.Field
+ OfOutputContentList respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u BetaResponseCustomToolCallOutputOutputUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseCustomToolCallOutputOutputUnion) AsOutputContentList() (v []BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseCustomToolCallOutputOutputUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseCustomToolCallOutputOutputUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion contains all
+// possible properties and values from [BetaResponseInputText],
+// [BetaResponseInputImage], [BetaResponseInputFile].
+//
+// Use the [BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion.AsAny]
+// method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion struct {
+ // This field is from variant [BetaResponseInputText].
+ Text string `json:"text"`
+ // Any of "input_text", "input_image", "input_file".
+ Type string `json:"type"`
+ // This field is a union of [BetaResponseInputTextPromptCacheBreakpoint],
+ // [BetaResponseInputImagePromptCacheBreakpoint],
+ // [BetaResponseInputFilePromptCacheBreakpoint]
+ PromptCacheBreakpoint BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
+ Detail string `json:"detail"`
+ FileID string `json:"file_id"`
+ // This field is from variant [BetaResponseInputImage].
+ ImageURL string `json:"image_url"`
+ // This field is from variant [BetaResponseInputFile].
+ FileData string `json:"file_data"`
+ // This field is from variant [BetaResponseInputFile].
+ FileURL string `json:"file_url"`
+ // This field is from variant [BetaResponseInputFile].
+ Filename string `json:"filename"`
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ Detail respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ FileData respjson.Field
+ FileURL respjson.Field
+ Filename respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseCustomToolCallOutputOutputOutputContentListItem is implemented by
+// each variant of
+// [BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion] to add type
+// safety for the return type of
+// [BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion.AsAny]
+type anyBetaResponseCustomToolCallOutputOutputOutputContentListItem interface {
+ implBetaResponseCustomToolCallOutputOutputOutputContentListItemUnion()
+}
+
+func (BetaResponseInputText) implBetaResponseCustomToolCallOutputOutputOutputContentListItemUnion() {}
+func (BetaResponseInputImage) implBetaResponseCustomToolCallOutputOutputOutputContentListItemUnion() {
+}
+func (BetaResponseInputFile) implBetaResponseCustomToolCallOutputOutputOutputContentListItemUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion.AsAny().(type) {
+// case openai.BetaResponseInputText:
+// case openai.BetaResponseInputImage:
+// case openai.BetaResponseInputFile:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion) AsAny() anyBetaResponseCustomToolCallOutputOutputOutputContentListItem {
+ switch u.Type {
+ case "input_text":
+ return u.AsInputText()
+ case "input_image":
+ return u.AsInputImage()
+ case "input_file":
+ return u.AsInputFile()
+ }
+ return nil
+}
+
+func (u BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion) AsInputText() (v BetaResponseInputText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion) AsInputImage() (v BetaResponseInputImage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion) AsInputFile() (v BetaResponseInputFile) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion) RawJSON() string {
+ return u.JSON.raw
+}
+
+func (r *BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionPromptCacheBreakpoint
+// is an implicit subunion of
+// [BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion].
+// BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionPromptCacheBreakpoint
+// provides convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion].
+type BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionPromptCacheBreakpoint struct {
+ // This field is from variant [BetaResponseInputTextPromptCacheBreakpoint].
+ Mode constant.Explicit `json:"mode"`
+ JSON struct {
+ Mode respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseCustomToolCallOutputAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCustomToolCallOutputAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCustomToolCallOutputAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseCustomToolCallOutputCallerUnion contains all possible properties and
+// values from [BetaResponseCustomToolCallOutputCallerDirect],
+// [BetaResponseCustomToolCallOutputCallerProgram].
+//
+// Use the [BetaResponseCustomToolCallOutputCallerUnion.AsAny] method to switch on
+// the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseCustomToolCallOutputCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [BetaResponseCustomToolCallOutputCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseCustomToolCallOutputCaller is implemented by each variant of
+// [BetaResponseCustomToolCallOutputCallerUnion] to add type safety for the return
+// type of [BetaResponseCustomToolCallOutputCallerUnion.AsAny]
+type anyBetaResponseCustomToolCallOutputCaller interface {
+ implBetaResponseCustomToolCallOutputCallerUnion()
+}
+
+func (BetaResponseCustomToolCallOutputCallerDirect) implBetaResponseCustomToolCallOutputCallerUnion() {
+}
+func (BetaResponseCustomToolCallOutputCallerProgram) implBetaResponseCustomToolCallOutputCallerUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseCustomToolCallOutputCallerUnion.AsAny().(type) {
+// case openai.BetaResponseCustomToolCallOutputCallerDirect:
+// case openai.BetaResponseCustomToolCallOutputCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseCustomToolCallOutputCallerUnion) AsAny() anyBetaResponseCustomToolCallOutputCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u BetaResponseCustomToolCallOutputCallerUnion) AsDirect() (v BetaResponseCustomToolCallOutputCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseCustomToolCallOutputCallerUnion) AsProgram() (v BetaResponseCustomToolCallOutputCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseCustomToolCallOutputCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseCustomToolCallOutputCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseCustomToolCallOutputCallerDirect struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCustomToolCallOutputCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCustomToolCallOutputCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseCustomToolCallOutputCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCustomToolCallOutputCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCustomToolCallOutputCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The output of a custom tool call from your code, being sent back to the model.
+//
+// The properties CallID, Output, Type are required.
+type BetaResponseCustomToolCallOutputParam struct {
+ // The call ID, used to map this custom tool call output to a custom tool call.
+ CallID string `json:"call_id" api:"required"`
+ // The output from the custom tool call generated by your code. Can be a string or
+ // an list of output content.
+ Output BetaResponseCustomToolCallOutputOutputUnionParam `json:"output,omitzero" api:"required"`
+ // The unique ID of the custom tool call output in the OpenAI platform.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // The agent that produced this item.
+ Agent BetaResponseCustomToolCallOutputAgentParam `json:"agent,omitzero"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseCustomToolCallOutputCallerUnionParam `json:"caller,omitzero"`
+ // The type of the custom tool call output. Always `custom_tool_call_output`.
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "custom_tool_call_output".
+ Type constant.CustomToolCallOutput `json:"type" default:"custom_tool_call_output"`
+ paramObj
+}
+
+func (r BetaResponseCustomToolCallOutputParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseCustomToolCallOutputParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseCustomToolCallOutputParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseCustomToolCallOutputOutputUnionParam struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfOutputContentList []BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseCustomToolCallOutputOutputUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfOutputContentList)
+}
+func (u *BetaResponseCustomToolCallOutputOutputUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseCustomToolCallOutputOutputUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfOutputContentList) {
+ return &u.OfOutputContentList
+ }
+ return nil
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionParam struct {
+ OfInputText *BetaResponseInputTextParam `json:",omitzero,inline"`
+ OfInputImage *BetaResponseInputImageParam `json:",omitzero,inline"`
+ OfInputFile *BetaResponseInputFileParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfInputText, u.OfInputImage, u.OfInputFile)
+}
+func (u *BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfInputText) {
+ return u.OfInputText
+ } else if !param.IsOmitted(u.OfInputImage) {
+ return u.OfInputImage
+ } else if !param.IsOmitted(u.OfInputFile) {
+ return u.OfInputFile
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionParam) GetText() *string {
+ if vt := u.OfInputText; vt != nil {
+ return &vt.Text
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionParam) GetImageURL() *string {
+ if vt := u.OfInputImage; vt != nil && vt.ImageURL.Valid() {
+ return &vt.ImageURL.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionParam) GetFileData() *string {
+ if vt := u.OfInputFile; vt != nil && vt.FileData.Valid() {
+ return &vt.FileData.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionParam) GetFileURL() *string {
+ if vt := u.OfInputFile; vt != nil && vt.FileURL.Valid() {
+ return &vt.FileURL.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionParam) GetFilename() *string {
+ if vt := u.OfInputFile; vt != nil && vt.Filename.Valid() {
+ return &vt.Filename.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionParam) GetType() *string {
+ if vt := u.OfInputText; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfInputImage; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfInputFile; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionParam) GetDetail() *string {
+ if vt := u.OfInputImage; vt != nil {
+ return (*string)(&vt.Detail)
+ } else if vt := u.OfInputFile; vt != nil {
+ return (*string)(&vt.Detail)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionParam) GetFileID() *string {
+ if vt := u.OfInputImage; vt != nil && vt.FileID.Valid() {
+ return &vt.FileID.Value
+ } else if vt := u.OfInputFile; vt != nil && vt.FileID.Valid() {
+ return &vt.FileID.Value
+ }
+ return nil
+}
+
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionParam) GetPromptCacheBreakpoint() (res betaResponseCustomToolCallOutputOutputOutputContentListItemUnionParamPromptCacheBreakpoint) {
+ if vt := u.OfInputText; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ } else if vt := u.OfInputImage; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ } else if vt := u.OfInputFile; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ }
+ return
+}
+
+// Can have the runtime types [*BetaResponseInputTextPromptCacheBreakpointParam],
+// [*BetaResponseInputImagePromptCacheBreakpointParam],
+// [*BetaResponseInputFilePromptCacheBreakpointParam]
+type betaResponseCustomToolCallOutputOutputOutputContentListItemUnionParamPromptCacheBreakpoint struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *openai.BetaResponseInputTextPromptCacheBreakpointParam:
+// case *openai.BetaResponseInputImagePromptCacheBreakpointParam:
+// case *openai.BetaResponseInputFilePromptCacheBreakpointParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u betaResponseCustomToolCallOutputOutputOutputContentListItemUnionParamPromptCacheBreakpoint) AsAny() any {
+ return u.any
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseCustomToolCallOutputOutputOutputContentListItemUnionParamPromptCacheBreakpoint) GetMode() *string {
+ switch vt := u.any.(type) {
+ case *BetaResponseInputTextPromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ case *BetaResponseInputImagePromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ case *BetaResponseInputFilePromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionParam](
+ "type",
+ apijson.Discriminator[BetaResponseInputTextParam]("input_text"),
+ apijson.Discriminator[BetaResponseInputImageParam]("input_image"),
+ apijson.Discriminator[BetaResponseInputFileParam]("input_file"),
+ )
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseCustomToolCallOutputAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseCustomToolCallOutputAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseCustomToolCallOutputAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseCustomToolCallOutputAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseCustomToolCallOutputCallerUnionParam struct {
+ OfDirect *BetaResponseCustomToolCallOutputCallerDirectParam `json:",omitzero,inline"`
+ OfProgram *BetaResponseCustomToolCallOutputCallerProgramParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseCustomToolCallOutputCallerUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfDirect, u.OfProgram)
+}
+func (u *BetaResponseCustomToolCallOutputCallerUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseCustomToolCallOutputCallerUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfDirect) {
+ return u.OfDirect
+ } else if !param.IsOmitted(u.OfProgram) {
+ return u.OfProgram
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseCustomToolCallOutputCallerUnionParam) GetCallerID() *string {
+ if vt := u.OfProgram; vt != nil {
+ return &vt.CallerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseCustomToolCallOutputCallerUnionParam) GetType() *string {
+ if vt := u.OfDirect; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseCustomToolCallOutputCallerUnionParam](
+ "type",
+ apijson.Discriminator[BetaResponseCustomToolCallOutputCallerDirectParam]("direct"),
+ apijson.Discriminator[BetaResponseCustomToolCallOutputCallerProgramParam]("program"),
+ )
+}
+
+func NewBetaResponseCustomToolCallOutputCallerDirectParam() BetaResponseCustomToolCallOutputCallerDirectParam {
+ return BetaResponseCustomToolCallOutputCallerDirectParam{
+ Type: "direct",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewBetaResponseCustomToolCallOutputCallerDirectParam].
+type BetaResponseCustomToolCallOutputCallerDirectParam struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ paramObj
+}
+
+func (r BetaResponseCustomToolCallOutputCallerDirectParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseCustomToolCallOutputCallerDirectParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseCustomToolCallOutputCallerDirectParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties CallerID, Type are required.
+type BetaResponseCustomToolCallOutputCallerProgramParam struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ //
+ // This field can be elided, and will marshal its zero value as "program".
+ Type constant.Program `json:"type" default:"program"`
+ paramObj
+}
+
+func (r BetaResponseCustomToolCallOutputCallerProgramParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseCustomToolCallOutputCallerProgramParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseCustomToolCallOutputCallerProgramParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The output of a custom tool call from your code, being sent back to the model.
+type BetaResponseCustomToolCallOutputItem struct {
+ // The unique ID of the custom tool call output item.
+ ID string `json:"id" api:"required"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ // Populated when items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status" api:"required"`
+ // The identifier of the actor that created the item.
+ CreatedBy string `json:"created_by"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Status respjson.Field
+ CreatedBy respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+ BetaResponseCustomToolCallOutput
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseCustomToolCallOutputItem) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseCustomToolCallOutputItem) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An error object returned when the model fails to generate a Response.
+type BetaResponseError struct {
+ // The error code for the response.
+ //
+ // Any of "server_error", "rate_limit_exceeded", "invalid_prompt",
+ // "data_residency_mismatch", "bio_policy", "vector_store_timeout",
+ // "invalid_image", "invalid_image_format", "invalid_base64_image",
+ // "invalid_image_url", "image_too_large", "image_too_small", "image_parse_error",
+ // "image_content_policy_violation", "invalid_image_mode", "image_file_too_large",
+ // "unsupported_image_media_type", "empty_image_file", "failed_to_download_image",
+ // "image_file_not_found".
+ Code BetaResponseErrorCode `json:"code" api:"required"`
+ // A human-readable description of the error.
+ Message string `json:"message" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Code respjson.Field
+ Message respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseError) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseError) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The error code for the response.
+type BetaResponseErrorCode string
+
+const (
+ BetaResponseErrorCodeServerError BetaResponseErrorCode = "server_error"
+ BetaResponseErrorCodeRateLimitExceeded BetaResponseErrorCode = "rate_limit_exceeded"
+ BetaResponseErrorCodeInvalidPrompt BetaResponseErrorCode = "invalid_prompt"
+ BetaResponseErrorCodeDataResidencyMismatch BetaResponseErrorCode = "data_residency_mismatch"
+ BetaResponseErrorCodeBioPolicy BetaResponseErrorCode = "bio_policy"
+ BetaResponseErrorCodeVectorStoreTimeout BetaResponseErrorCode = "vector_store_timeout"
+ BetaResponseErrorCodeInvalidImage BetaResponseErrorCode = "invalid_image"
+ BetaResponseErrorCodeInvalidImageFormat BetaResponseErrorCode = "invalid_image_format"
+ BetaResponseErrorCodeInvalidBase64Image BetaResponseErrorCode = "invalid_base64_image"
+ BetaResponseErrorCodeInvalidImageURL BetaResponseErrorCode = "invalid_image_url"
+ BetaResponseErrorCodeImageTooLarge BetaResponseErrorCode = "image_too_large"
+ BetaResponseErrorCodeImageTooSmall BetaResponseErrorCode = "image_too_small"
+ BetaResponseErrorCodeImageParseError BetaResponseErrorCode = "image_parse_error"
+ BetaResponseErrorCodeImageContentPolicyViolation BetaResponseErrorCode = "image_content_policy_violation"
+ BetaResponseErrorCodeInvalidImageMode BetaResponseErrorCode = "invalid_image_mode"
+ BetaResponseErrorCodeImageFileTooLarge BetaResponseErrorCode = "image_file_too_large"
+ BetaResponseErrorCodeUnsupportedImageMediaType BetaResponseErrorCode = "unsupported_image_media_type"
+ BetaResponseErrorCodeEmptyImageFile BetaResponseErrorCode = "empty_image_file"
+ BetaResponseErrorCodeFailedToDownloadImage BetaResponseErrorCode = "failed_to_download_image"
+ BetaResponseErrorCodeImageFileNotFound BetaResponseErrorCode = "image_file_not_found"
+)
+
+// Emitted when an error occurs.
+type BetaResponseErrorEvent struct {
+ // The error code.
+ Code string `json:"code" api:"required"`
+ // The error message.
+ Message string `json:"message" api:"required"`
+ // The error parameter.
+ Param string `json:"param" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `error`.
+ Type constant.Error `json:"type" default:"error"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseErrorEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Code respjson.Field
+ Message respjson.Field
+ Param respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseErrorEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseErrorEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseErrorEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseErrorEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseErrorEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An event that is emitted when a response fails.
+type BetaResponseFailedEvent struct {
+ // The response that failed.
+ Response BetaResponse `json:"response" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.failed`.
+ Type constant.ResponseFailed `json:"type" default:"response.failed"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseFailedEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Response respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFailedEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFailedEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseFailedEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFailedEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFailedEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when a file search call is completed (results found).
+type BetaResponseFileSearchCallCompletedEvent struct {
+ // The ID of the output item that the file search call is initiated.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item that the file search call is initiated.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.file_search_call.completed`.
+ Type constant.ResponseFileSearchCallCompleted `json:"type" default:"response.file_search_call.completed"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseFileSearchCallCompletedEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFileSearchCallCompletedEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFileSearchCallCompletedEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseFileSearchCallCompletedEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFileSearchCallCompletedEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFileSearchCallCompletedEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when a file search call is initiated.
+type BetaResponseFileSearchCallInProgressEvent struct {
+ // The ID of the output item that the file search call is initiated.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item that the file search call is initiated.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.file_search_call.in_progress`.
+ Type constant.ResponseFileSearchCallInProgress `json:"type" default:"response.file_search_call.in_progress"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseFileSearchCallInProgressEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFileSearchCallInProgressEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFileSearchCallInProgressEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseFileSearchCallInProgressEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFileSearchCallInProgressEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFileSearchCallInProgressEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when a file search is currently searching.
+type BetaResponseFileSearchCallSearchingEvent struct {
+ // The ID of the output item that the file search call is initiated.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item that the file search call is searching.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.file_search_call.searching`.
+ Type constant.ResponseFileSearchCallSearching `json:"type" default:"response.file_search_call.searching"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseFileSearchCallSearchingEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFileSearchCallSearchingEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFileSearchCallSearchingEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseFileSearchCallSearchingEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFileSearchCallSearchingEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFileSearchCallSearchingEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The results of a file search tool call. See the
+// [file search guide](https://platform.openai.com/docs/guides/tools-file-search)
+// for more information.
+type BetaResponseFileSearchToolCall struct {
+ // The unique ID of the file search tool call.
+ ID string `json:"id" api:"required"`
+ // The queries used to search for files.
+ Queries []string `json:"queries" api:"required"`
+ // The status of the file search tool call. One of `in_progress`, `searching`,
+ // `incomplete` or `failed`,
+ //
+ // Any of "in_progress", "searching", "completed", "incomplete", "failed".
+ Status BetaResponseFileSearchToolCallStatus `json:"status" api:"required"`
+ // The type of the file search tool call. Always `file_search_call`.
+ Type constant.FileSearchCall `json:"type" default:"file_search_call"`
+ // The agent that produced this item.
+ Agent BetaResponseFileSearchToolCallAgent `json:"agent" api:"nullable"`
+ // The results of the file search tool call.
+ Results []BetaResponseFileSearchToolCallResult `json:"results" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Queries respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Results respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFileSearchToolCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFileSearchToolCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseFileSearchToolCall to a
+// BetaResponseFileSearchToolCallParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseFileSearchToolCallParam.Overrides()
+func (r BetaResponseFileSearchToolCall) ToParam() BetaResponseFileSearchToolCallParam {
+ return param.Override[BetaResponseFileSearchToolCallParam](json.RawMessage(r.RawJSON()))
+}
+
+// The status of the file search tool call. One of `in_progress`, `searching`,
+// `incomplete` or `failed`,
+type BetaResponseFileSearchToolCallStatus string
+
+const (
+ BetaResponseFileSearchToolCallStatusInProgress BetaResponseFileSearchToolCallStatus = "in_progress"
+ BetaResponseFileSearchToolCallStatusSearching BetaResponseFileSearchToolCallStatus = "searching"
+ BetaResponseFileSearchToolCallStatusCompleted BetaResponseFileSearchToolCallStatus = "completed"
+ BetaResponseFileSearchToolCallStatusIncomplete BetaResponseFileSearchToolCallStatus = "incomplete"
+ BetaResponseFileSearchToolCallStatusFailed BetaResponseFileSearchToolCallStatus = "failed"
+)
+
+// The agent that produced this item.
+type BetaResponseFileSearchToolCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFileSearchToolCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFileSearchToolCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseFileSearchToolCallResult struct {
+ // Set of 16 key-value pairs that can be attached to an object. This can be useful
+ // for storing additional information about the object in a structured format, and
+ // querying for objects via API or the dashboard. Keys are strings with a maximum
+ // length of 64 characters. Values are strings with a maximum length of 512
+ // characters, booleans, or numbers.
+ Attributes map[string]BetaResponseFileSearchToolCallResultAttributeUnion `json:"attributes" api:"nullable"`
+ // The unique ID of the file.
+ FileID string `json:"file_id"`
+ // The name of the file.
+ Filename string `json:"filename"`
+ // The relevance score of the file - a value between 0 and 1.
+ Score float64 `json:"score"`
+ // The text that was retrieved from the file.
+ Text string `json:"text"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Attributes respjson.Field
+ FileID respjson.Field
+ Filename respjson.Field
+ Score respjson.Field
+ Text respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFileSearchToolCallResult) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFileSearchToolCallResult) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseFileSearchToolCallResultAttributeUnion contains all possible
+// properties and values from [string], [float64], [bool].
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString OfFloat OfBool]
+type BetaResponseFileSearchToolCallResultAttributeUnion struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ JSON struct {
+ OfString respjson.Field
+ OfFloat respjson.Field
+ OfBool respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u BetaResponseFileSearchToolCallResultAttributeUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseFileSearchToolCallResultAttributeUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseFileSearchToolCallResultAttributeUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseFileSearchToolCallResultAttributeUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseFileSearchToolCallResultAttributeUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The results of a file search tool call. See the
+// [file search guide](https://platform.openai.com/docs/guides/tools-file-search)
+// for more information.
+//
+// The properties ID, Queries, Status, Type are required.
+type BetaResponseFileSearchToolCallParam struct {
+ // The unique ID of the file search tool call.
+ ID string `json:"id" api:"required"`
+ // The queries used to search for files.
+ Queries []string `json:"queries,omitzero" api:"required"`
+ // The status of the file search tool call. One of `in_progress`, `searching`,
+ // `incomplete` or `failed`,
+ //
+ // Any of "in_progress", "searching", "completed", "incomplete", "failed".
+ Status BetaResponseFileSearchToolCallStatus `json:"status,omitzero" api:"required"`
+ // The agent that produced this item.
+ Agent BetaResponseFileSearchToolCallAgentParam `json:"agent,omitzero"`
+ // The results of the file search tool call.
+ Results []BetaResponseFileSearchToolCallResultParam `json:"results,omitzero"`
+ // The type of the file search tool call. Always `file_search_call`.
+ //
+ // This field can be elided, and will marshal its zero value as "file_search_call".
+ Type constant.FileSearchCall `json:"type" default:"file_search_call"`
+ paramObj
+}
+
+func (r BetaResponseFileSearchToolCallParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseFileSearchToolCallParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseFileSearchToolCallParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseFileSearchToolCallAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseFileSearchToolCallAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseFileSearchToolCallAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseFileSearchToolCallAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseFileSearchToolCallResultParam struct {
+ // The unique ID of the file.
+ FileID param.Opt[string] `json:"file_id,omitzero"`
+ // The name of the file.
+ Filename param.Opt[string] `json:"filename,omitzero"`
+ // The relevance score of the file - a value between 0 and 1.
+ Score param.Opt[float64] `json:"score,omitzero"`
+ // The text that was retrieved from the file.
+ Text param.Opt[string] `json:"text,omitzero"`
+ // Set of 16 key-value pairs that can be attached to an object. This can be useful
+ // for storing additional information about the object in a structured format, and
+ // querying for objects via API or the dashboard. Keys are strings with a maximum
+ // length of 64 characters. Values are strings with a maximum length of 512
+ // characters, booleans, or numbers.
+ Attributes map[string]BetaResponseFileSearchToolCallResultAttributeUnionParam `json:"attributes,omitzero"`
+ paramObj
+}
+
+func (r BetaResponseFileSearchToolCallResultParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseFileSearchToolCallResultParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseFileSearchToolCallResultParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseFileSearchToolCallResultAttributeUnionParam struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ OfBool param.Opt[bool] `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseFileSearchToolCallResultAttributeUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfFloat, u.OfBool)
+}
+func (u *BetaResponseFileSearchToolCallResultAttributeUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseFileSearchToolCallResultAttributeUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ } else if !param.IsOmitted(u.OfBool) {
+ return &u.OfBool.Value
+ }
+ return nil
+}
+
+// BetaResponseFormatTextConfigUnion contains all possible properties and values
+// from [BetaResponseFormatTextConfigText],
+// [BetaResponseFormatTextJSONSchemaConfig],
+// [BetaResponseFormatTextConfigJSONObject].
+//
+// Use the [BetaResponseFormatTextConfigUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseFormatTextConfigUnion struct {
+ // Any of "text", "json_schema", "json_object".
+ Type string `json:"type"`
+ // This field is from variant [BetaResponseFormatTextJSONSchemaConfig].
+ Name string `json:"name"`
+ // This field is from variant [BetaResponseFormatTextJSONSchemaConfig].
+ Schema map[string]any `json:"schema"`
+ // This field is from variant [BetaResponseFormatTextJSONSchemaConfig].
+ Description string `json:"description"`
+ // This field is from variant [BetaResponseFormatTextJSONSchemaConfig].
+ Strict bool `json:"strict"`
+ JSON struct {
+ Type respjson.Field
+ Name respjson.Field
+ Schema respjson.Field
+ Description respjson.Field
+ Strict respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseFormatTextConfig is implemented by each variant of
+// [BetaResponseFormatTextConfigUnion] to add type safety for the return type of
+// [BetaResponseFormatTextConfigUnion.AsAny]
+type anyBetaResponseFormatTextConfig interface {
+ implBetaResponseFormatTextConfigUnion()
+}
+
+func (BetaResponseFormatTextConfigText) implBetaResponseFormatTextConfigUnion() {}
+func (BetaResponseFormatTextJSONSchemaConfig) implBetaResponseFormatTextConfigUnion() {}
+func (BetaResponseFormatTextConfigJSONObject) implBetaResponseFormatTextConfigUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseFormatTextConfigUnion.AsAny().(type) {
+// case openai.BetaResponseFormatTextConfigText:
+// case openai.BetaResponseFormatTextJSONSchemaConfig:
+// case openai.BetaResponseFormatTextConfigJSONObject:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseFormatTextConfigUnion) AsAny() anyBetaResponseFormatTextConfig {
+ switch u.Type {
+ case "text":
+ return u.AsText()
+ case "json_schema":
+ return u.AsJSONSchema()
+ case "json_object":
+ return u.AsJSONObject()
+ }
+ return nil
+}
+
+func (u BetaResponseFormatTextConfigUnion) AsText() (v BetaResponseFormatTextConfigText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseFormatTextConfigUnion) AsJSONSchema() (v BetaResponseFormatTextJSONSchemaConfig) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseFormatTextConfigUnion) AsJSONObject() (v BetaResponseFormatTextConfigJSONObject) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseFormatTextConfigUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseFormatTextConfigUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseFormatTextConfigUnion to a
+// BetaResponseFormatTextConfigUnionParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseFormatTextConfigUnionParam.Overrides()
+func (r BetaResponseFormatTextConfigUnion) ToParam() BetaResponseFormatTextConfigUnionParam {
+ return param.Override[BetaResponseFormatTextConfigUnionParam](json.RawMessage(r.RawJSON()))
+}
+
+// Default response format. Used to generate text responses.
+type BetaResponseFormatTextConfigText struct {
+ // The type of response format being defined. Always `text`.
+ Type constant.Text `json:"type" default:"text"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFormatTextConfigText) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFormatTextConfigText) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// JSON object response format. An older method of generating JSON responses. Using
+// `json_schema` is recommended for models that support it. Note that the model
+// will not generate JSON without a system or user message instructing it to do so.
+type BetaResponseFormatTextConfigJSONObject struct {
+ // The type of response format being defined. Always `json_object`.
+ Type constant.JSONObject `json:"type" default:"json_object"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFormatTextConfigJSONObject) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFormatTextConfigJSONObject) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func BetaResponseFormatTextConfigParamOfJSONSchema(name string, schema map[string]any) BetaResponseFormatTextConfigUnionParam {
+ var jsonSchema BetaResponseFormatTextJSONSchemaConfigParam
+ jsonSchema.Name = name
+ jsonSchema.Schema = schema
+ return BetaResponseFormatTextConfigUnionParam{OfJSONSchema: &jsonSchema}
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseFormatTextConfigUnionParam struct {
+ OfText *BetaResponseFormatTextConfigTextParam `json:",omitzero,inline"`
+ OfJSONSchema *BetaResponseFormatTextJSONSchemaConfigParam `json:",omitzero,inline"`
+ OfJSONObject *BetaResponseFormatTextConfigJSONObjectParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseFormatTextConfigUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfText, u.OfJSONSchema, u.OfJSONObject)
+}
+func (u *BetaResponseFormatTextConfigUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseFormatTextConfigUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfText) {
+ return u.OfText
+ } else if !param.IsOmitted(u.OfJSONSchema) {
+ return u.OfJSONSchema
+ } else if !param.IsOmitted(u.OfJSONObject) {
+ return u.OfJSONObject
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFormatTextConfigUnionParam) GetName() *string {
+ if vt := u.OfJSONSchema; vt != nil {
+ return &vt.Name
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFormatTextConfigUnionParam) GetSchema() map[string]any {
+ if vt := u.OfJSONSchema; vt != nil {
+ return vt.Schema
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFormatTextConfigUnionParam) GetDescription() *string {
+ if vt := u.OfJSONSchema; vt != nil && vt.Description.Valid() {
+ return &vt.Description.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFormatTextConfigUnionParam) GetStrict() *bool {
+ if vt := u.OfJSONSchema; vt != nil && vt.Strict.Valid() {
+ return &vt.Strict.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFormatTextConfigUnionParam) GetType() *string {
+ if vt := u.OfText; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfJSONSchema; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfJSONObject; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseFormatTextConfigUnionParam](
+ "type",
+ apijson.Discriminator[BetaResponseFormatTextConfigTextParam]("text"),
+ apijson.Discriminator[BetaResponseFormatTextJSONSchemaConfigParam]("json_schema"),
+ apijson.Discriminator[BetaResponseFormatTextConfigJSONObjectParam]("json_object"),
+ )
+}
+
+func NewBetaResponseFormatTextConfigTextParam() BetaResponseFormatTextConfigTextParam {
+ return BetaResponseFormatTextConfigTextParam{
+ Type: "text",
+ }
+}
+
+// Default response format. Used to generate text responses.
+//
+// This struct has a constant value, construct it with
+// [NewBetaResponseFormatTextConfigTextParam].
+type BetaResponseFormatTextConfigTextParam struct {
+ // The type of response format being defined. Always `text`.
+ Type constant.Text `json:"type" default:"text"`
+ paramObj
+}
+
+func (r BetaResponseFormatTextConfigTextParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseFormatTextConfigTextParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseFormatTextConfigTextParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func NewBetaResponseFormatTextConfigJSONObjectParam() BetaResponseFormatTextConfigJSONObjectParam {
+ return BetaResponseFormatTextConfigJSONObjectParam{
+ Type: "json_object",
+ }
+}
+
+// JSON object response format. An older method of generating JSON responses. Using
+// `json_schema` is recommended for models that support it. Note that the model
+// will not generate JSON without a system or user message instructing it to do so.
+//
+// This struct has a constant value, construct it with
+// [NewBetaResponseFormatTextConfigJSONObjectParam].
+type BetaResponseFormatTextConfigJSONObjectParam struct {
+ // The type of response format being defined. Always `json_object`.
+ Type constant.JSONObject `json:"type" default:"json_object"`
+ paramObj
+}
+
+func (r BetaResponseFormatTextConfigJSONObjectParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseFormatTextConfigJSONObjectParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseFormatTextConfigJSONObjectParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// JSON Schema response format. Used to generate structured JSON responses. Learn
+// more about
+// [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).
+type BetaResponseFormatTextJSONSchemaConfig struct {
+ // The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores
+ // and dashes, with a maximum length of 64.
+ Name string `json:"name" api:"required"`
+ // The schema for the response format, described as a JSON Schema object. Learn how
+ // to build JSON schemas [here](https://json-schema.org/).
+ Schema map[string]any `json:"schema" api:"required"`
+ // The type of response format being defined. Always `json_schema`.
+ Type constant.JSONSchema `json:"type" default:"json_schema"`
+ // A description of what the response format is for, used by the model to determine
+ // how to respond in the format.
+ Description string `json:"description"`
+ // Whether to enable strict schema adherence when generating the output. If set to
+ // true, the model will always follow the exact schema defined in the `schema`
+ // field. Only a subset of JSON Schema is supported when `strict` is `true`. To
+ // learn more, read the
+ // [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
+ Strict bool `json:"strict" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Name respjson.Field
+ Schema respjson.Field
+ Type respjson.Field
+ Description respjson.Field
+ Strict respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFormatTextJSONSchemaConfig) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFormatTextJSONSchemaConfig) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseFormatTextJSONSchemaConfig to a
+// BetaResponseFormatTextJSONSchemaConfigParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseFormatTextJSONSchemaConfigParam.Overrides()
+func (r BetaResponseFormatTextJSONSchemaConfig) ToParam() BetaResponseFormatTextJSONSchemaConfigParam {
+ return param.Override[BetaResponseFormatTextJSONSchemaConfigParam](json.RawMessage(r.RawJSON()))
+}
+
+// JSON Schema response format. Used to generate structured JSON responses. Learn
+// more about
+// [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).
+//
+// The properties Name, Schema, Type are required.
+type BetaResponseFormatTextJSONSchemaConfigParam struct {
+ // The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores
+ // and dashes, with a maximum length of 64.
+ Name string `json:"name" api:"required"`
+ // The schema for the response format, described as a JSON Schema object. Learn how
+ // to build JSON schemas [here](https://json-schema.org/).
+ Schema map[string]any `json:"schema,omitzero" api:"required"`
+ // Whether to enable strict schema adherence when generating the output. If set to
+ // true, the model will always follow the exact schema defined in the `schema`
+ // field. Only a subset of JSON Schema is supported when `strict` is `true`. To
+ // learn more, read the
+ // [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
+ Strict param.Opt[bool] `json:"strict,omitzero"`
+ // A description of what the response format is for, used by the model to determine
+ // how to respond in the format.
+ Description param.Opt[string] `json:"description,omitzero"`
+ // The type of response format being defined. Always `json_schema`.
+ //
+ // This field can be elided, and will marshal its zero value as "json_schema".
+ Type constant.JSONSchema `json:"type" default:"json_schema"`
+ paramObj
+}
+
+func (r BetaResponseFormatTextJSONSchemaConfigParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseFormatTextJSONSchemaConfigParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseFormatTextJSONSchemaConfigParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when there is a partial function-call arguments delta.
+type BetaResponseFunctionCallArgumentsDeltaEvent struct {
+ // The function-call arguments delta that is added.
+ Delta string `json:"delta" api:"required"`
+ // The ID of the output item that the function-call arguments delta is added to.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item that the function-call arguments delta is added to.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.function_call_arguments.delta`.
+ Type constant.ResponseFunctionCallArgumentsDelta `json:"type" default:"response.function_call_arguments.delta"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseFunctionCallArgumentsDeltaEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Delta respjson.Field
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionCallArgumentsDeltaEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionCallArgumentsDeltaEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseFunctionCallArgumentsDeltaEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionCallArgumentsDeltaEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionCallArgumentsDeltaEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when function-call arguments are finalized.
+type BetaResponseFunctionCallArgumentsDoneEvent struct {
+ // The function-call arguments.
+ Arguments string `json:"arguments" api:"required"`
+ // The ID of the item.
+ ItemID string `json:"item_id" api:"required"`
+ // The name of the function that was called.
+ Name string `json:"name" api:"required"`
+ // The index of the output item.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ Type constant.ResponseFunctionCallArgumentsDone `json:"type" default:"response.function_call_arguments.done"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseFunctionCallArgumentsDoneEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Arguments respjson.Field
+ ItemID respjson.Field
+ Name respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionCallArgumentsDoneEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionCallArgumentsDoneEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseFunctionCallArgumentsDoneEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionCallArgumentsDoneEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionCallArgumentsDoneEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseFunctionCallOutputItemUnion contains all possible properties and
+// values from [BetaResponseInputTextContent], [BetaResponseInputImageContent],
+// [BetaResponseInputFileContent].
+//
+// Use the [BetaResponseFunctionCallOutputItemUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseFunctionCallOutputItemUnion struct {
+ // This field is from variant [BetaResponseInputTextContent].
+ Text string `json:"text"`
+ // Any of "input_text", "input_image", "input_file".
+ Type string `json:"type"`
+ // This field is a union of [BetaResponseInputTextContentPromptCacheBreakpoint],
+ // [BetaResponseInputImageContentPromptCacheBreakpoint],
+ // [BetaResponseInputFileContentPromptCacheBreakpoint]
+ PromptCacheBreakpoint BetaResponseFunctionCallOutputItemUnionPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
+ Detail string `json:"detail"`
+ FileID string `json:"file_id"`
+ // This field is from variant [BetaResponseInputImageContent].
+ ImageURL string `json:"image_url"`
+ // This field is from variant [BetaResponseInputFileContent].
+ FileData string `json:"file_data"`
+ // This field is from variant [BetaResponseInputFileContent].
+ FileURL string `json:"file_url"`
+ // This field is from variant [BetaResponseInputFileContent].
+ Filename string `json:"filename"`
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ Detail respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ FileData respjson.Field
+ FileURL respjson.Field
+ Filename respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseFunctionCallOutputItem is implemented by each variant of
+// [BetaResponseFunctionCallOutputItemUnion] to add type safety for the return type
+// of [BetaResponseFunctionCallOutputItemUnion.AsAny]
+type anyBetaResponseFunctionCallOutputItem interface {
+ implBetaResponseFunctionCallOutputItemUnion()
+}
+
+func (BetaResponseInputTextContent) implBetaResponseFunctionCallOutputItemUnion() {}
+func (BetaResponseInputImageContent) implBetaResponseFunctionCallOutputItemUnion() {}
+func (BetaResponseInputFileContent) implBetaResponseFunctionCallOutputItemUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseFunctionCallOutputItemUnion.AsAny().(type) {
+// case openai.BetaResponseInputTextContent:
+// case openai.BetaResponseInputImageContent:
+// case openai.BetaResponseInputFileContent:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseFunctionCallOutputItemUnion) AsAny() anyBetaResponseFunctionCallOutputItem {
+ switch u.Type {
+ case "input_text":
+ return u.AsInputText()
+ case "input_image":
+ return u.AsInputImage()
+ case "input_file":
+ return u.AsInputFile()
+ }
+ return nil
+}
+
+func (u BetaResponseFunctionCallOutputItemUnion) AsInputText() (v BetaResponseInputTextContent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseFunctionCallOutputItemUnion) AsInputImage() (v BetaResponseInputImageContent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseFunctionCallOutputItemUnion) AsInputFile() (v BetaResponseInputFileContent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseFunctionCallOutputItemUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseFunctionCallOutputItemUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseFunctionCallOutputItemUnionPromptCacheBreakpoint is an implicit
+// subunion of [BetaResponseFunctionCallOutputItemUnion].
+// BetaResponseFunctionCallOutputItemUnionPromptCacheBreakpoint provides convenient
+// access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseFunctionCallOutputItemUnion].
+type BetaResponseFunctionCallOutputItemUnionPromptCacheBreakpoint struct {
+ // This field is from variant [BetaResponseInputTextContentPromptCacheBreakpoint].
+ Mode constant.Explicit `json:"mode"`
+ JSON struct {
+ Mode respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseFunctionCallOutputItemUnionPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseFunctionCallOutputItemUnion to a
+// BetaResponseFunctionCallOutputItemUnionParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseFunctionCallOutputItemUnionParam.Overrides()
+func (r BetaResponseFunctionCallOutputItemUnion) ToParam() BetaResponseFunctionCallOutputItemUnionParam {
+ return param.Override[BetaResponseFunctionCallOutputItemUnionParam](json.RawMessage(r.RawJSON()))
+}
+
+func BetaResponseFunctionCallOutputItemParamOfInputText(text string) BetaResponseFunctionCallOutputItemUnionParam {
+ var inputText BetaResponseInputTextContentParam
+ inputText.Text = text
+ return BetaResponseFunctionCallOutputItemUnionParam{OfInputText: &inputText}
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseFunctionCallOutputItemUnionParam struct {
+ OfInputText *BetaResponseInputTextContentParam `json:",omitzero,inline"`
+ OfInputImage *BetaResponseInputImageContentParam `json:",omitzero,inline"`
+ OfInputFile *BetaResponseInputFileContentParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseFunctionCallOutputItemUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfInputText, u.OfInputImage, u.OfInputFile)
+}
+func (u *BetaResponseFunctionCallOutputItemUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseFunctionCallOutputItemUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfInputText) {
+ return u.OfInputText
+ } else if !param.IsOmitted(u.OfInputImage) {
+ return u.OfInputImage
+ } else if !param.IsOmitted(u.OfInputFile) {
+ return u.OfInputFile
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFunctionCallOutputItemUnionParam) GetText() *string {
+ if vt := u.OfInputText; vt != nil {
+ return &vt.Text
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFunctionCallOutputItemUnionParam) GetImageURL() *string {
+ if vt := u.OfInputImage; vt != nil && vt.ImageURL.Valid() {
+ return &vt.ImageURL.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFunctionCallOutputItemUnionParam) GetFileData() *string {
+ if vt := u.OfInputFile; vt != nil && vt.FileData.Valid() {
+ return &vt.FileData.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFunctionCallOutputItemUnionParam) GetFileURL() *string {
+ if vt := u.OfInputFile; vt != nil && vt.FileURL.Valid() {
+ return &vt.FileURL.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFunctionCallOutputItemUnionParam) GetFilename() *string {
+ if vt := u.OfInputFile; vt != nil && vt.Filename.Valid() {
+ return &vt.Filename.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFunctionCallOutputItemUnionParam) GetType() *string {
+ if vt := u.OfInputText; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfInputImage; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfInputFile; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFunctionCallOutputItemUnionParam) GetDetail() *string {
+ if vt := u.OfInputImage; vt != nil {
+ return (*string)(&vt.Detail)
+ } else if vt := u.OfInputFile; vt != nil {
+ return (*string)(&vt.Detail)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFunctionCallOutputItemUnionParam) GetFileID() *string {
+ if vt := u.OfInputImage; vt != nil && vt.FileID.Valid() {
+ return &vt.FileID.Value
+ } else if vt := u.OfInputFile; vt != nil && vt.FileID.Valid() {
+ return &vt.FileID.Value
+ }
+ return nil
+}
+
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u BetaResponseFunctionCallOutputItemUnionParam) GetPromptCacheBreakpoint() (res betaResponseFunctionCallOutputItemUnionParamPromptCacheBreakpoint) {
+ if vt := u.OfInputText; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ } else if vt := u.OfInputImage; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ } else if vt := u.OfInputFile; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ }
+ return
+}
+
+// Can have the runtime types
+// [*BetaResponseInputTextContentPromptCacheBreakpointParam],
+// [*BetaResponseInputImageContentPromptCacheBreakpointParam],
+// [*BetaResponseInputFileContentPromptCacheBreakpointParam]
+type betaResponseFunctionCallOutputItemUnionParamPromptCacheBreakpoint struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *openai.BetaResponseInputTextContentPromptCacheBreakpointParam:
+// case *openai.BetaResponseInputImageContentPromptCacheBreakpointParam:
+// case *openai.BetaResponseInputFileContentPromptCacheBreakpointParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u betaResponseFunctionCallOutputItemUnionParamPromptCacheBreakpoint) AsAny() any { return u.any }
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseFunctionCallOutputItemUnionParamPromptCacheBreakpoint) GetMode() *string {
+ switch vt := u.any.(type) {
+ case *BetaResponseInputTextContentPromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ case *BetaResponseInputImageContentPromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ case *BetaResponseInputFileContentPromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseFunctionCallOutputItemUnionParam](
+ "type",
+ apijson.Discriminator[BetaResponseInputTextContentParam]("input_text"),
+ apijson.Discriminator[BetaResponseInputImageContentParam]("input_image"),
+ apijson.Discriminator[BetaResponseInputFileContentParam]("input_file"),
+ )
+}
+
+type BetaResponseFunctionCallOutputItemList []BetaResponseFunctionCallOutputItemUnion
+
+type BetaResponseFunctionCallOutputItemListParam []BetaResponseFunctionCallOutputItemUnionParam
+
+// Captured stdout and stderr for a portion of a shell tool call output.
+type BetaResponseFunctionShellCallOutputContent struct {
+ // The exit or timeout outcome associated with this shell call.
+ Outcome BetaResponseFunctionShellCallOutputContentOutcomeUnion `json:"outcome" api:"required"`
+ // Captured stderr output for the shell call.
+ Stderr string `json:"stderr" api:"required"`
+ // Captured stdout output for the shell call.
+ Stdout string `json:"stdout" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Outcome respjson.Field
+ Stderr respjson.Field
+ Stdout respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionShellCallOutputContent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionShellCallOutputContent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseFunctionShellCallOutputContent to a
+// BetaResponseFunctionShellCallOutputContentParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseFunctionShellCallOutputContentParam.Overrides()
+func (r BetaResponseFunctionShellCallOutputContent) ToParam() BetaResponseFunctionShellCallOutputContentParam {
+ return param.Override[BetaResponseFunctionShellCallOutputContentParam](json.RawMessage(r.RawJSON()))
+}
+
+// BetaResponseFunctionShellCallOutputContentOutcomeUnion contains all possible
+// properties and values from
+// [BetaResponseFunctionShellCallOutputContentOutcomeTimeout],
+// [BetaResponseFunctionShellCallOutputContentOutcomeExit].
+//
+// Use the [BetaResponseFunctionShellCallOutputContentOutcomeUnion.AsAny] method to
+// switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseFunctionShellCallOutputContentOutcomeUnion struct {
+ // Any of "timeout", "exit".
+ Type string `json:"type"`
+ // This field is from variant
+ // [BetaResponseFunctionShellCallOutputContentOutcomeExit].
+ ExitCode int64 `json:"exit_code"`
+ JSON struct {
+ Type respjson.Field
+ ExitCode respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseFunctionShellCallOutputContentOutcome is implemented by each
+// variant of [BetaResponseFunctionShellCallOutputContentOutcomeUnion] to add type
+// safety for the return type of
+// [BetaResponseFunctionShellCallOutputContentOutcomeUnion.AsAny]
+type anyBetaResponseFunctionShellCallOutputContentOutcome interface {
+ implBetaResponseFunctionShellCallOutputContentOutcomeUnion()
+}
+
+func (BetaResponseFunctionShellCallOutputContentOutcomeTimeout) implBetaResponseFunctionShellCallOutputContentOutcomeUnion() {
+}
+func (BetaResponseFunctionShellCallOutputContentOutcomeExit) implBetaResponseFunctionShellCallOutputContentOutcomeUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseFunctionShellCallOutputContentOutcomeUnion.AsAny().(type) {
+// case openai.BetaResponseFunctionShellCallOutputContentOutcomeTimeout:
+// case openai.BetaResponseFunctionShellCallOutputContentOutcomeExit:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseFunctionShellCallOutputContentOutcomeUnion) AsAny() anyBetaResponseFunctionShellCallOutputContentOutcome {
+ switch u.Type {
+ case "timeout":
+ return u.AsTimeout()
+ case "exit":
+ return u.AsExit()
+ }
+ return nil
+}
+
+func (u BetaResponseFunctionShellCallOutputContentOutcomeUnion) AsTimeout() (v BetaResponseFunctionShellCallOutputContentOutcomeTimeout) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseFunctionShellCallOutputContentOutcomeUnion) AsExit() (v BetaResponseFunctionShellCallOutputContentOutcomeExit) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseFunctionShellCallOutputContentOutcomeUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseFunctionShellCallOutputContentOutcomeUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Indicates that the shell call exceeded its configured time limit.
+type BetaResponseFunctionShellCallOutputContentOutcomeTimeout struct {
+ // The outcome type. Always `timeout`.
+ Type constant.Timeout `json:"type" default:"timeout"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionShellCallOutputContentOutcomeTimeout) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionShellCallOutputContentOutcomeTimeout) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Indicates that the shell commands finished and returned an exit code.
+type BetaResponseFunctionShellCallOutputContentOutcomeExit struct {
+ // The exit code returned by the shell process.
+ ExitCode int64 `json:"exit_code" api:"required"`
+ // The outcome type. Always `exit`.
+ Type constant.Exit `json:"type" default:"exit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ExitCode respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionShellCallOutputContentOutcomeExit) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionShellCallOutputContentOutcomeExit) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Captured stdout and stderr for a portion of a shell tool call output.
+//
+// The properties Outcome, Stderr, Stdout are required.
+type BetaResponseFunctionShellCallOutputContentParam struct {
+ // The exit or timeout outcome associated with this shell call.
+ Outcome BetaResponseFunctionShellCallOutputContentOutcomeUnionParam `json:"outcome,omitzero" api:"required"`
+ // Captured stderr output for the shell call.
+ Stderr string `json:"stderr" api:"required"`
+ // Captured stdout output for the shell call.
+ Stdout string `json:"stdout" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseFunctionShellCallOutputContentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseFunctionShellCallOutputContentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseFunctionShellCallOutputContentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseFunctionShellCallOutputContentOutcomeUnionParam struct {
+ OfTimeout *BetaResponseFunctionShellCallOutputContentOutcomeTimeoutParam `json:",omitzero,inline"`
+ OfExit *BetaResponseFunctionShellCallOutputContentOutcomeExitParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseFunctionShellCallOutputContentOutcomeUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfTimeout, u.OfExit)
+}
+func (u *BetaResponseFunctionShellCallOutputContentOutcomeUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseFunctionShellCallOutputContentOutcomeUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfTimeout) {
+ return u.OfTimeout
+ } else if !param.IsOmitted(u.OfExit) {
+ return u.OfExit
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFunctionShellCallOutputContentOutcomeUnionParam) GetExitCode() *int64 {
+ if vt := u.OfExit; vt != nil {
+ return &vt.ExitCode
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFunctionShellCallOutputContentOutcomeUnionParam) GetType() *string {
+ if vt := u.OfTimeout; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfExit; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseFunctionShellCallOutputContentOutcomeUnionParam](
+ "type",
+ apijson.Discriminator[BetaResponseFunctionShellCallOutputContentOutcomeTimeoutParam]("timeout"),
+ apijson.Discriminator[BetaResponseFunctionShellCallOutputContentOutcomeExitParam]("exit"),
+ )
+}
+
+func NewBetaResponseFunctionShellCallOutputContentOutcomeTimeoutParam() BetaResponseFunctionShellCallOutputContentOutcomeTimeoutParam {
+ return BetaResponseFunctionShellCallOutputContentOutcomeTimeoutParam{
+ Type: "timeout",
+ }
+}
+
+// Indicates that the shell call exceeded its configured time limit.
+//
+// This struct has a constant value, construct it with
+// [NewBetaResponseFunctionShellCallOutputContentOutcomeTimeoutParam].
+type BetaResponseFunctionShellCallOutputContentOutcomeTimeoutParam struct {
+ // The outcome type. Always `timeout`.
+ Type constant.Timeout `json:"type" default:"timeout"`
+ paramObj
+}
+
+func (r BetaResponseFunctionShellCallOutputContentOutcomeTimeoutParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseFunctionShellCallOutputContentOutcomeTimeoutParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseFunctionShellCallOutputContentOutcomeTimeoutParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Indicates that the shell commands finished and returned an exit code.
+//
+// The properties ExitCode, Type are required.
+type BetaResponseFunctionShellCallOutputContentOutcomeExitParam struct {
+ // The exit code returned by the shell process.
+ ExitCode int64 `json:"exit_code" api:"required"`
+ // The outcome type. Always `exit`.
+ //
+ // This field can be elided, and will marshal its zero value as "exit".
+ Type constant.Exit `json:"type" default:"exit"`
+ paramObj
+}
+
+func (r BetaResponseFunctionShellCallOutputContentOutcomeExitParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseFunctionShellCallOutputContentOutcomeExitParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseFunctionShellCallOutputContentOutcomeExitParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool call that executes one or more shell commands in a managed environment.
+type BetaResponseFunctionShellToolCall struct {
+ // The unique ID of the shell tool call. Populated when this item is returned via
+ // API.
+ ID string `json:"id" api:"required"`
+ // The shell commands and limits that describe how to run the tool call.
+ Action BetaResponseFunctionShellToolCallAction `json:"action" api:"required"`
+ // The unique ID of the shell tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // Represents the use of a local environment to perform shell actions.
+ Environment BetaResponseFunctionShellToolCallEnvironmentUnion `json:"environment" api:"required"`
+ // The status of the shell call. One of `in_progress`, `completed`, or
+ // `incomplete`.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status BetaResponseFunctionShellToolCallStatus `json:"status" api:"required"`
+ // The type of the item. Always `shell_call`.
+ Type constant.ShellCall `json:"type" default:"shell_call"`
+ // The agent that produced this item.
+ Agent BetaResponseFunctionShellToolCallAgent `json:"agent"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseFunctionShellToolCallCallerUnion `json:"caller" api:"nullable"`
+ // The ID of the entity that created this tool call.
+ CreatedBy string `json:"created_by"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Action respjson.Field
+ CallID respjson.Field
+ Environment respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Caller respjson.Field
+ CreatedBy respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionShellToolCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionShellToolCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The shell commands and limits that describe how to run the tool call.
+type BetaResponseFunctionShellToolCallAction struct {
+ Commands []string `json:"commands" api:"required"`
+ // Optional maximum number of characters to return from each command.
+ MaxOutputLength int64 `json:"max_output_length" api:"required"`
+ // Optional timeout in milliseconds for the commands.
+ TimeoutMs int64 `json:"timeout_ms" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Commands respjson.Field
+ MaxOutputLength respjson.Field
+ TimeoutMs respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionShellToolCallAction) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionShellToolCallAction) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseFunctionShellToolCallEnvironmentUnion contains all possible
+// properties and values from [BetaResponseLocalEnvironment],
+// [BetaResponseContainerReference].
+//
+// Use the [BetaResponseFunctionShellToolCallEnvironmentUnion.AsAny] method to
+// switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseFunctionShellToolCallEnvironmentUnion struct {
+ // Any of "local", "container_reference".
+ Type string `json:"type"`
+ // This field is from variant [BetaResponseContainerReference].
+ ContainerID string `json:"container_id"`
+ JSON struct {
+ Type respjson.Field
+ ContainerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseFunctionShellToolCallEnvironment is implemented by each variant
+// of [BetaResponseFunctionShellToolCallEnvironmentUnion] to add type safety for
+// the return type of [BetaResponseFunctionShellToolCallEnvironmentUnion.AsAny]
+type anyBetaResponseFunctionShellToolCallEnvironment interface {
+ implBetaResponseFunctionShellToolCallEnvironmentUnion()
+}
+
+func (BetaResponseLocalEnvironment) implBetaResponseFunctionShellToolCallEnvironmentUnion() {}
+func (BetaResponseContainerReference) implBetaResponseFunctionShellToolCallEnvironmentUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseFunctionShellToolCallEnvironmentUnion.AsAny().(type) {
+// case openai.BetaResponseLocalEnvironment:
+// case openai.BetaResponseContainerReference:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseFunctionShellToolCallEnvironmentUnion) AsAny() anyBetaResponseFunctionShellToolCallEnvironment {
+ switch u.Type {
+ case "local":
+ return u.AsLocal()
+ case "container_reference":
+ return u.AsContainerReference()
+ }
+ return nil
+}
+
+func (u BetaResponseFunctionShellToolCallEnvironmentUnion) AsLocal() (v BetaResponseLocalEnvironment) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseFunctionShellToolCallEnvironmentUnion) AsContainerReference() (v BetaResponseContainerReference) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseFunctionShellToolCallEnvironmentUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseFunctionShellToolCallEnvironmentUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The status of the shell call. One of `in_progress`, `completed`, or
+// `incomplete`.
+type BetaResponseFunctionShellToolCallStatus string
+
+const (
+ BetaResponseFunctionShellToolCallStatusInProgress BetaResponseFunctionShellToolCallStatus = "in_progress"
+ BetaResponseFunctionShellToolCallStatusCompleted BetaResponseFunctionShellToolCallStatus = "completed"
+ BetaResponseFunctionShellToolCallStatusIncomplete BetaResponseFunctionShellToolCallStatus = "incomplete"
+)
+
+// The agent that produced this item.
+type BetaResponseFunctionShellToolCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionShellToolCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionShellToolCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseFunctionShellToolCallCallerUnion contains all possible properties
+// and values from [BetaResponseFunctionShellToolCallCallerDirect],
+// [BetaResponseFunctionShellToolCallCallerProgram].
+//
+// Use the [BetaResponseFunctionShellToolCallCallerUnion.AsAny] method to switch on
+// the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseFunctionShellToolCallCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [BetaResponseFunctionShellToolCallCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseFunctionShellToolCallCaller is implemented by each variant of
+// [BetaResponseFunctionShellToolCallCallerUnion] to add type safety for the return
+// type of [BetaResponseFunctionShellToolCallCallerUnion.AsAny]
+type anyBetaResponseFunctionShellToolCallCaller interface {
+ implBetaResponseFunctionShellToolCallCallerUnion()
+}
+
+func (BetaResponseFunctionShellToolCallCallerDirect) implBetaResponseFunctionShellToolCallCallerUnion() {
+}
+func (BetaResponseFunctionShellToolCallCallerProgram) implBetaResponseFunctionShellToolCallCallerUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseFunctionShellToolCallCallerUnion.AsAny().(type) {
+// case openai.BetaResponseFunctionShellToolCallCallerDirect:
+// case openai.BetaResponseFunctionShellToolCallCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseFunctionShellToolCallCallerUnion) AsAny() anyBetaResponseFunctionShellToolCallCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u BetaResponseFunctionShellToolCallCallerUnion) AsDirect() (v BetaResponseFunctionShellToolCallCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseFunctionShellToolCallCallerUnion) AsProgram() (v BetaResponseFunctionShellToolCallCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseFunctionShellToolCallCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseFunctionShellToolCallCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseFunctionShellToolCallCallerDirect struct {
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionShellToolCallCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionShellToolCallCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseFunctionShellToolCallCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionShellToolCallCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionShellToolCallCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The output of a shell tool call that was emitted.
+type BetaResponseFunctionShellToolCallOutput struct {
+ // The unique ID of the shell call output. Populated when this item is returned via
+ // API.
+ ID string `json:"id" api:"required"`
+ // The unique ID of the shell tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // The maximum length of the shell command output. This is generated by the model
+ // and should be passed back with the raw output.
+ MaxOutputLength int64 `json:"max_output_length" api:"required"`
+ // An array of shell call output contents
+ Output []BetaResponseFunctionShellToolCallOutputOutput `json:"output" api:"required"`
+ // The status of the shell call output. One of `in_progress`, `completed`, or
+ // `incomplete`.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status BetaResponseFunctionShellToolCallOutputStatus `json:"status" api:"required"`
+ // The type of the shell call output. Always `shell_call_output`.
+ Type constant.ShellCallOutput `json:"type" default:"shell_call_output"`
+ // The agent that produced this item.
+ Agent BetaResponseFunctionShellToolCallOutputAgent `json:"agent"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseFunctionShellToolCallOutputCallerUnion `json:"caller" api:"nullable"`
+ // The identifier of the actor that created the item.
+ CreatedBy string `json:"created_by"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ MaxOutputLength respjson.Field
+ Output respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Caller respjson.Field
+ CreatedBy respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionShellToolCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionShellToolCallOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The content of a shell tool call output that was emitted.
+type BetaResponseFunctionShellToolCallOutputOutput struct {
+ // Represents either an exit outcome (with an exit code) or a timeout outcome for a
+ // shell call output chunk.
+ Outcome BetaResponseFunctionShellToolCallOutputOutputOutcomeUnion `json:"outcome" api:"required"`
+ // The standard error output that was captured.
+ Stderr string `json:"stderr" api:"required"`
+ // The standard output that was captured.
+ Stdout string `json:"stdout" api:"required"`
+ // The identifier of the actor that created the item.
+ CreatedBy string `json:"created_by"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Outcome respjson.Field
+ Stderr respjson.Field
+ Stdout respjson.Field
+ CreatedBy respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionShellToolCallOutputOutput) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionShellToolCallOutputOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseFunctionShellToolCallOutputOutputOutcomeUnion contains all possible
+// properties and values from
+// [BetaResponseFunctionShellToolCallOutputOutputOutcomeTimeout],
+// [BetaResponseFunctionShellToolCallOutputOutputOutcomeExit].
+//
+// Use the [BetaResponseFunctionShellToolCallOutputOutputOutcomeUnion.AsAny] method
+// to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseFunctionShellToolCallOutputOutputOutcomeUnion struct {
+ // Any of "timeout", "exit".
+ Type string `json:"type"`
+ // This field is from variant
+ // [BetaResponseFunctionShellToolCallOutputOutputOutcomeExit].
+ ExitCode int64 `json:"exit_code"`
+ JSON struct {
+ Type respjson.Field
+ ExitCode respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseFunctionShellToolCallOutputOutputOutcome is implemented by each
+// variant of [BetaResponseFunctionShellToolCallOutputOutputOutcomeUnion] to add
+// type safety for the return type of
+// [BetaResponseFunctionShellToolCallOutputOutputOutcomeUnion.AsAny]
+type anyBetaResponseFunctionShellToolCallOutputOutputOutcome interface {
+ implBetaResponseFunctionShellToolCallOutputOutputOutcomeUnion()
+}
+
+func (BetaResponseFunctionShellToolCallOutputOutputOutcomeTimeout) implBetaResponseFunctionShellToolCallOutputOutputOutcomeUnion() {
+}
+func (BetaResponseFunctionShellToolCallOutputOutputOutcomeExit) implBetaResponseFunctionShellToolCallOutputOutputOutcomeUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseFunctionShellToolCallOutputOutputOutcomeUnion.AsAny().(type) {
+// case openai.BetaResponseFunctionShellToolCallOutputOutputOutcomeTimeout:
+// case openai.BetaResponseFunctionShellToolCallOutputOutputOutcomeExit:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseFunctionShellToolCallOutputOutputOutcomeUnion) AsAny() anyBetaResponseFunctionShellToolCallOutputOutputOutcome {
+ switch u.Type {
+ case "timeout":
+ return u.AsTimeout()
+ case "exit":
+ return u.AsExit()
+ }
+ return nil
+}
+
+func (u BetaResponseFunctionShellToolCallOutputOutputOutcomeUnion) AsTimeout() (v BetaResponseFunctionShellToolCallOutputOutputOutcomeTimeout) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseFunctionShellToolCallOutputOutputOutcomeUnion) AsExit() (v BetaResponseFunctionShellToolCallOutputOutputOutcomeExit) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseFunctionShellToolCallOutputOutputOutcomeUnion) RawJSON() string {
+ return u.JSON.raw
+}
+
+func (r *BetaResponseFunctionShellToolCallOutputOutputOutcomeUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Indicates that the shell call exceeded its configured time limit.
+type BetaResponseFunctionShellToolCallOutputOutputOutcomeTimeout struct {
+ // The outcome type. Always `timeout`.
+ Type constant.Timeout `json:"type" default:"timeout"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionShellToolCallOutputOutputOutcomeTimeout) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *BetaResponseFunctionShellToolCallOutputOutputOutcomeTimeout) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Indicates that the shell commands finished and returned an exit code.
+type BetaResponseFunctionShellToolCallOutputOutputOutcomeExit struct {
+ // Exit code from the shell process.
+ ExitCode int64 `json:"exit_code" api:"required"`
+ // The outcome type. Always `exit`.
+ Type constant.Exit `json:"type" default:"exit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ExitCode respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionShellToolCallOutputOutputOutcomeExit) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionShellToolCallOutputOutputOutcomeExit) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The status of the shell call output. One of `in_progress`, `completed`, or
+// `incomplete`.
+type BetaResponseFunctionShellToolCallOutputStatus string
+
+const (
+ BetaResponseFunctionShellToolCallOutputStatusInProgress BetaResponseFunctionShellToolCallOutputStatus = "in_progress"
+ BetaResponseFunctionShellToolCallOutputStatusCompleted BetaResponseFunctionShellToolCallOutputStatus = "completed"
+ BetaResponseFunctionShellToolCallOutputStatusIncomplete BetaResponseFunctionShellToolCallOutputStatus = "incomplete"
+)
+
+// The agent that produced this item.
+type BetaResponseFunctionShellToolCallOutputAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionShellToolCallOutputAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionShellToolCallOutputAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseFunctionShellToolCallOutputCallerUnion contains all possible
+// properties and values from
+// [BetaResponseFunctionShellToolCallOutputCallerDirect],
+// [BetaResponseFunctionShellToolCallOutputCallerProgram].
+//
+// Use the [BetaResponseFunctionShellToolCallOutputCallerUnion.AsAny] method to
+// switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseFunctionShellToolCallOutputCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant
+ // [BetaResponseFunctionShellToolCallOutputCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseFunctionShellToolCallOutputCaller is implemented by each variant
+// of [BetaResponseFunctionShellToolCallOutputCallerUnion] to add type safety for
+// the return type of [BetaResponseFunctionShellToolCallOutputCallerUnion.AsAny]
+type anyBetaResponseFunctionShellToolCallOutputCaller interface {
+ implBetaResponseFunctionShellToolCallOutputCallerUnion()
+}
+
+func (BetaResponseFunctionShellToolCallOutputCallerDirect) implBetaResponseFunctionShellToolCallOutputCallerUnion() {
+}
+func (BetaResponseFunctionShellToolCallOutputCallerProgram) implBetaResponseFunctionShellToolCallOutputCallerUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseFunctionShellToolCallOutputCallerUnion.AsAny().(type) {
+// case openai.BetaResponseFunctionShellToolCallOutputCallerDirect:
+// case openai.BetaResponseFunctionShellToolCallOutputCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseFunctionShellToolCallOutputCallerUnion) AsAny() anyBetaResponseFunctionShellToolCallOutputCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u BetaResponseFunctionShellToolCallOutputCallerUnion) AsDirect() (v BetaResponseFunctionShellToolCallOutputCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseFunctionShellToolCallOutputCallerUnion) AsProgram() (v BetaResponseFunctionShellToolCallOutputCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseFunctionShellToolCallOutputCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseFunctionShellToolCallOutputCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseFunctionShellToolCallOutputCallerDirect struct {
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionShellToolCallOutputCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionShellToolCallOutputCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseFunctionShellToolCallOutputCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionShellToolCallOutputCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionShellToolCallOutputCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool call to run a function. See the
+// [function calling guide](https://platform.openai.com/docs/guides/function-calling)
+// for more information.
+type BetaResponseFunctionToolCall struct {
+ // A JSON string of the arguments to pass to the function.
+ Arguments string `json:"arguments" api:"required"`
+ // The unique ID of the function tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // The name of the function to run.
+ Name string `json:"name" api:"required"`
+ // The type of the function tool call. Always `function_call`.
+ Type constant.FunctionCall `json:"type" default:"function_call"`
+ // The unique ID of the function tool call.
+ ID string `json:"id"`
+ // The agent that produced this item.
+ Agent BetaResponseFunctionToolCallAgent `json:"agent" api:"nullable"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseFunctionToolCallCallerUnion `json:"caller" api:"nullable"`
+ // The namespace of the function to run.
+ Namespace string `json:"namespace"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ // Populated when items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status BetaResponseFunctionToolCallStatus `json:"status"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Arguments respjson.Field
+ CallID respjson.Field
+ Name respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Agent respjson.Field
+ Caller respjson.Field
+ Namespace respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionToolCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionToolCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseFunctionToolCall to a
+// BetaResponseFunctionToolCallParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseFunctionToolCallParam.Overrides()
+func (r BetaResponseFunctionToolCall) ToParam() BetaResponseFunctionToolCallParam {
+ return param.Override[BetaResponseFunctionToolCallParam](json.RawMessage(r.RawJSON()))
+}
+
+// The agent that produced this item.
+type BetaResponseFunctionToolCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionToolCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionToolCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseFunctionToolCallCallerUnion contains all possible properties and
+// values from [BetaResponseFunctionToolCallCallerDirect],
+// [BetaResponseFunctionToolCallCallerProgram].
+//
+// Use the [BetaResponseFunctionToolCallCallerUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseFunctionToolCallCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [BetaResponseFunctionToolCallCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseFunctionToolCallCaller is implemented by each variant of
+// [BetaResponseFunctionToolCallCallerUnion] to add type safety for the return type
+// of [BetaResponseFunctionToolCallCallerUnion.AsAny]
+type anyBetaResponseFunctionToolCallCaller interface {
+ implBetaResponseFunctionToolCallCallerUnion()
+}
+
+func (BetaResponseFunctionToolCallCallerDirect) implBetaResponseFunctionToolCallCallerUnion() {}
+func (BetaResponseFunctionToolCallCallerProgram) implBetaResponseFunctionToolCallCallerUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseFunctionToolCallCallerUnion.AsAny().(type) {
+// case openai.BetaResponseFunctionToolCallCallerDirect:
+// case openai.BetaResponseFunctionToolCallCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseFunctionToolCallCallerUnion) AsAny() anyBetaResponseFunctionToolCallCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u BetaResponseFunctionToolCallCallerUnion) AsDirect() (v BetaResponseFunctionToolCallCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseFunctionToolCallCallerUnion) AsProgram() (v BetaResponseFunctionToolCallCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseFunctionToolCallCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseFunctionToolCallCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseFunctionToolCallCallerDirect struct {
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionToolCallCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionToolCallCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseFunctionToolCallCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionToolCallCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionToolCallCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+// Populated when items are returned via API.
+type BetaResponseFunctionToolCallStatus string
+
+const (
+ BetaResponseFunctionToolCallStatusInProgress BetaResponseFunctionToolCallStatus = "in_progress"
+ BetaResponseFunctionToolCallStatusCompleted BetaResponseFunctionToolCallStatus = "completed"
+ BetaResponseFunctionToolCallStatusIncomplete BetaResponseFunctionToolCallStatus = "incomplete"
+)
+
+// A tool call to run a function. See the
+// [function calling guide](https://platform.openai.com/docs/guides/function-calling)
+// for more information.
+//
+// The properties Arguments, CallID, Name, Type are required.
+type BetaResponseFunctionToolCallParam struct {
+ // A JSON string of the arguments to pass to the function.
+ Arguments string `json:"arguments" api:"required"`
+ // The unique ID of the function tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // The name of the function to run.
+ Name string `json:"name" api:"required"`
+ // The unique ID of the function tool call.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // The namespace of the function to run.
+ Namespace param.Opt[string] `json:"namespace,omitzero"`
+ // The agent that produced this item.
+ Agent BetaResponseFunctionToolCallAgentParam `json:"agent,omitzero"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseFunctionToolCallCallerUnionParam `json:"caller,omitzero"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ // Populated when items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status BetaResponseFunctionToolCallStatus `json:"status,omitzero"`
+ // The type of the function tool call. Always `function_call`.
+ //
+ // This field can be elided, and will marshal its zero value as "function_call".
+ Type constant.FunctionCall `json:"type" default:"function_call"`
+ paramObj
+}
+
+func (r BetaResponseFunctionToolCallParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseFunctionToolCallParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseFunctionToolCallParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseFunctionToolCallAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseFunctionToolCallAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseFunctionToolCallAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseFunctionToolCallAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseFunctionToolCallCallerUnionParam struct {
+ OfDirect *BetaResponseFunctionToolCallCallerDirectParam `json:",omitzero,inline"`
+ OfProgram *BetaResponseFunctionToolCallCallerProgramParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseFunctionToolCallCallerUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfDirect, u.OfProgram)
+}
+func (u *BetaResponseFunctionToolCallCallerUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseFunctionToolCallCallerUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfDirect) {
+ return u.OfDirect
+ } else if !param.IsOmitted(u.OfProgram) {
+ return u.OfProgram
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFunctionToolCallCallerUnionParam) GetCallerID() *string {
+ if vt := u.OfProgram; vt != nil {
+ return &vt.CallerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFunctionToolCallCallerUnionParam) GetType() *string {
+ if vt := u.OfDirect; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseFunctionToolCallCallerUnionParam](
+ "type",
+ apijson.Discriminator[BetaResponseFunctionToolCallCallerDirectParam]("direct"),
+ apijson.Discriminator[BetaResponseFunctionToolCallCallerProgramParam]("program"),
+ )
+}
+
+func NewBetaResponseFunctionToolCallCallerDirectParam() BetaResponseFunctionToolCallCallerDirectParam {
+ return BetaResponseFunctionToolCallCallerDirectParam{
+ Type: "direct",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewBetaResponseFunctionToolCallCallerDirectParam].
+type BetaResponseFunctionToolCallCallerDirectParam struct {
+ Type constant.Direct `json:"type" default:"direct"`
+ paramObj
+}
+
+func (r BetaResponseFunctionToolCallCallerDirectParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseFunctionToolCallCallerDirectParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseFunctionToolCallCallerDirectParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties CallerID, Type are required.
+type BetaResponseFunctionToolCallCallerProgramParam struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // This field can be elided, and will marshal its zero value as "program".
+ Type constant.Program `json:"type" default:"program"`
+ paramObj
+}
+
+func (r BetaResponseFunctionToolCallCallerProgramParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseFunctionToolCallCallerProgramParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseFunctionToolCallCallerProgramParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool call to run a function. See the
+// [function calling guide](https://platform.openai.com/docs/guides/function-calling)
+// for more information.
+type BetaResponseFunctionToolCallItem struct {
+ // The unique ID of the function tool call.
+ ID string `json:"id" api:"required"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ // Populated when items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status" api:"required"`
+ // The identifier of the actor that created the item.
+ CreatedBy string `json:"created_by"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Status respjson.Field
+ CreatedBy respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+ BetaResponseFunctionToolCall
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionToolCallItem) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionToolCallItem) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseFunctionToolCallOutputItem struct {
+ // The unique ID of the function call tool output.
+ ID string `json:"id" api:"required"`
+ // The unique ID of the function tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // The output from the function call generated by your code. Can be a string or an
+ // list of output content.
+ Output BetaResponseFunctionToolCallOutputItemOutputUnion `json:"output" api:"required"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ // Populated when items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status BetaResponseFunctionToolCallOutputItemStatus `json:"status" api:"required"`
+ // The type of the function tool call output. Always `function_call_output`.
+ Type constant.FunctionCallOutput `json:"type" default:"function_call_output"`
+ // The agent that produced this item.
+ Agent BetaResponseFunctionToolCallOutputItemAgent `json:"agent" api:"nullable"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseFunctionToolCallOutputItemCallerUnion `json:"caller" api:"nullable"`
+ // The identifier of the actor that created the item.
+ CreatedBy string `json:"created_by"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Output respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Caller respjson.Field
+ CreatedBy respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionToolCallOutputItem) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionToolCallOutputItem) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseFunctionToolCallOutputItemOutputUnion contains all possible
+// properties and values from [string],
+// [[]BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion].
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString OfOutputContentList]
+type BetaResponseFunctionToolCallOutputItemOutputUnion struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion]
+ // instead of an object.
+ OfOutputContentList []BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion `json:",inline"`
+ JSON struct {
+ OfString respjson.Field
+ OfOutputContentList respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u BetaResponseFunctionToolCallOutputItemOutputUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseFunctionToolCallOutputItemOutputUnion) AsOutputContentList() (v []BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseFunctionToolCallOutputItemOutputUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseFunctionToolCallOutputItemOutputUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion contains
+// all possible properties and values from [BetaResponseInputText],
+// [BetaResponseInputImage], [BetaResponseInputFile].
+//
+// Use the
+// [BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion.AsAny]
+// method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion struct {
+ // This field is from variant [BetaResponseInputText].
+ Text string `json:"text"`
+ // Any of "input_text", "input_image", "input_file".
+ Type string `json:"type"`
+ // This field is a union of [BetaResponseInputTextPromptCacheBreakpoint],
+ // [BetaResponseInputImagePromptCacheBreakpoint],
+ // [BetaResponseInputFilePromptCacheBreakpoint]
+ PromptCacheBreakpoint BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnionPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
+ Detail string `json:"detail"`
+ FileID string `json:"file_id"`
+ // This field is from variant [BetaResponseInputImage].
+ ImageURL string `json:"image_url"`
+ // This field is from variant [BetaResponseInputFile].
+ FileData string `json:"file_data"`
+ // This field is from variant [BetaResponseInputFile].
+ FileURL string `json:"file_url"`
+ // This field is from variant [BetaResponseInputFile].
+ Filename string `json:"filename"`
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ Detail respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ FileData respjson.Field
+ FileURL respjson.Field
+ Filename respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseFunctionToolCallOutputItemOutputOutputContentListItem is
+// implemented by each variant of
+// [BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion] to add
+// type safety for the return type of
+// [BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion.AsAny]
+type anyBetaResponseFunctionToolCallOutputItemOutputOutputContentListItem interface {
+ implBetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion()
+}
+
+func (BetaResponseInputText) implBetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion() {
+}
+func (BetaResponseInputImage) implBetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion() {
+}
+func (BetaResponseInputFile) implBetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion.AsAny().(type) {
+// case openai.BetaResponseInputText:
+// case openai.BetaResponseInputImage:
+// case openai.BetaResponseInputFile:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion) AsAny() anyBetaResponseFunctionToolCallOutputItemOutputOutputContentListItem {
+ switch u.Type {
+ case "input_text":
+ return u.AsInputText()
+ case "input_image":
+ return u.AsInputImage()
+ case "input_file":
+ return u.AsInputFile()
+ }
+ return nil
+}
+
+func (u BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion) AsInputText() (v BetaResponseInputText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion) AsInputImage() (v BetaResponseInputImage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion) AsInputFile() (v BetaResponseInputFile) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion) RawJSON() string {
+ return u.JSON.raw
+}
+
+func (r *BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnionPromptCacheBreakpoint
+// is an implicit subunion of
+// [BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion].
+// BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnionPromptCacheBreakpoint
+// provides convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion].
+type BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnionPromptCacheBreakpoint struct {
+ // This field is from variant [BetaResponseInputTextPromptCacheBreakpoint].
+ Mode constant.Explicit `json:"mode"`
+ JSON struct {
+ Mode respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnionPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+// Populated when items are returned via API.
+type BetaResponseFunctionToolCallOutputItemStatus string
+
+const (
+ BetaResponseFunctionToolCallOutputItemStatusInProgress BetaResponseFunctionToolCallOutputItemStatus = "in_progress"
+ BetaResponseFunctionToolCallOutputItemStatusCompleted BetaResponseFunctionToolCallOutputItemStatus = "completed"
+ BetaResponseFunctionToolCallOutputItemStatusIncomplete BetaResponseFunctionToolCallOutputItemStatus = "incomplete"
+)
+
+// The agent that produced this item.
+type BetaResponseFunctionToolCallOutputItemAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionToolCallOutputItemAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionToolCallOutputItemAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseFunctionToolCallOutputItemCallerUnion contains all possible
+// properties and values from [BetaResponseFunctionToolCallOutputItemCallerDirect],
+// [BetaResponseFunctionToolCallOutputItemCallerProgram].
+//
+// Use the [BetaResponseFunctionToolCallOutputItemCallerUnion.AsAny] method to
+// switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseFunctionToolCallOutputItemCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant
+ // [BetaResponseFunctionToolCallOutputItemCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseFunctionToolCallOutputItemCaller is implemented by each variant
+// of [BetaResponseFunctionToolCallOutputItemCallerUnion] to add type safety for
+// the return type of [BetaResponseFunctionToolCallOutputItemCallerUnion.AsAny]
+type anyBetaResponseFunctionToolCallOutputItemCaller interface {
+ implBetaResponseFunctionToolCallOutputItemCallerUnion()
+}
+
+func (BetaResponseFunctionToolCallOutputItemCallerDirect) implBetaResponseFunctionToolCallOutputItemCallerUnion() {
+}
+func (BetaResponseFunctionToolCallOutputItemCallerProgram) implBetaResponseFunctionToolCallOutputItemCallerUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseFunctionToolCallOutputItemCallerUnion.AsAny().(type) {
+// case openai.BetaResponseFunctionToolCallOutputItemCallerDirect:
+// case openai.BetaResponseFunctionToolCallOutputItemCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseFunctionToolCallOutputItemCallerUnion) AsAny() anyBetaResponseFunctionToolCallOutputItemCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u BetaResponseFunctionToolCallOutputItemCallerUnion) AsDirect() (v BetaResponseFunctionToolCallOutputItemCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseFunctionToolCallOutputItemCallerUnion) AsProgram() (v BetaResponseFunctionToolCallOutputItemCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseFunctionToolCallOutputItemCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseFunctionToolCallOutputItemCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseFunctionToolCallOutputItemCallerDirect struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionToolCallOutputItemCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionToolCallOutputItemCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseFunctionToolCallOutputItemCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionToolCallOutputItemCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionToolCallOutputItemCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The results of a web search tool call. See the
+// [web search guide](https://platform.openai.com/docs/guides/tools-web-search) for
+// more information.
+type BetaResponseFunctionWebSearch struct {
+ // The unique ID of the web search tool call.
+ ID string `json:"id" api:"required"`
+ // An object describing the specific action taken in this web search call. Includes
+ // details on how the model used the web (search, open_page, find_in_page).
+ Action BetaResponseFunctionWebSearchActionUnion `json:"action" api:"required"`
+ // The status of the web search tool call.
+ //
+ // Any of "in_progress", "searching", "completed", "failed".
+ Status BetaResponseFunctionWebSearchStatus `json:"status" api:"required"`
+ // The type of the web search tool call. Always `web_search_call`.
+ Type constant.WebSearchCall `json:"type" default:"web_search_call"`
+ // The agent that produced this item.
+ Agent BetaResponseFunctionWebSearchAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Action respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionWebSearch) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionWebSearch) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseFunctionWebSearch to a
+// BetaResponseFunctionWebSearchParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseFunctionWebSearchParam.Overrides()
+func (r BetaResponseFunctionWebSearch) ToParam() BetaResponseFunctionWebSearchParam {
+ return param.Override[BetaResponseFunctionWebSearchParam](json.RawMessage(r.RawJSON()))
+}
+
+// BetaResponseFunctionWebSearchActionUnion contains all possible properties and
+// values from [BetaResponseFunctionWebSearchActionSearch],
+// [BetaResponseFunctionWebSearchActionOpenPage],
+// [BetaResponseFunctionWebSearchActionFindInPage].
+//
+// Use the [BetaResponseFunctionWebSearchActionUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseFunctionWebSearchActionUnion struct {
+ // Any of "search", "open_page", "find_in_page".
+ Type string `json:"type"`
+ // This field is from variant [BetaResponseFunctionWebSearchActionSearch].
+ Queries []string `json:"queries"`
+ // This field is from variant [BetaResponseFunctionWebSearchActionSearch].
+ Query string `json:"query"`
+ // This field is from variant [BetaResponseFunctionWebSearchActionSearch].
+ Sources []BetaResponseFunctionWebSearchActionSearchSource `json:"sources"`
+ URL string `json:"url"`
+ // This field is from variant [BetaResponseFunctionWebSearchActionFindInPage].
+ Pattern string `json:"pattern"`
+ JSON struct {
+ Type respjson.Field
+ Queries respjson.Field
+ Query respjson.Field
+ Sources respjson.Field
+ URL respjson.Field
+ Pattern respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseFunctionWebSearchAction is implemented by each variant of
+// [BetaResponseFunctionWebSearchActionUnion] to add type safety for the return
+// type of [BetaResponseFunctionWebSearchActionUnion.AsAny]
+type anyBetaResponseFunctionWebSearchAction interface {
+ implBetaResponseFunctionWebSearchActionUnion()
+}
+
+func (BetaResponseFunctionWebSearchActionSearch) implBetaResponseFunctionWebSearchActionUnion() {}
+func (BetaResponseFunctionWebSearchActionOpenPage) implBetaResponseFunctionWebSearchActionUnion() {}
+func (BetaResponseFunctionWebSearchActionFindInPage) implBetaResponseFunctionWebSearchActionUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseFunctionWebSearchActionUnion.AsAny().(type) {
+// case openai.BetaResponseFunctionWebSearchActionSearch:
+// case openai.BetaResponseFunctionWebSearchActionOpenPage:
+// case openai.BetaResponseFunctionWebSearchActionFindInPage:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseFunctionWebSearchActionUnion) AsAny() anyBetaResponseFunctionWebSearchAction {
+ switch u.Type {
+ case "search":
+ return u.AsSearch()
+ case "open_page":
+ return u.AsOpenPage()
+ case "find_in_page":
+ return u.AsFindInPage()
+ }
+ return nil
+}
+
+func (u BetaResponseFunctionWebSearchActionUnion) AsSearch() (v BetaResponseFunctionWebSearchActionSearch) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseFunctionWebSearchActionUnion) AsOpenPage() (v BetaResponseFunctionWebSearchActionOpenPage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseFunctionWebSearchActionUnion) AsFindInPage() (v BetaResponseFunctionWebSearchActionFindInPage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseFunctionWebSearchActionUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseFunctionWebSearchActionUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Action type "search" - Performs a web search query.
+type BetaResponseFunctionWebSearchActionSearch struct {
+ // The action type.
+ Type constant.Search `json:"type" default:"search"`
+ // The search queries.
+ Queries []string `json:"queries"`
+ // The search query.
+ //
+ // Deprecated: deprecated
+ Query string `json:"query"`
+ // The sources used in the search.
+ Sources []BetaResponseFunctionWebSearchActionSearchSource `json:"sources"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ Queries respjson.Field
+ Query respjson.Field
+ Sources respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionWebSearchActionSearch) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionWebSearchActionSearch) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A source used in the search.
+type BetaResponseFunctionWebSearchActionSearchSource struct {
+ // The type of source. Always `url`.
+ Type constant.URL `json:"type" default:"url"`
+ // The URL of the source.
+ URL string `json:"url" api:"required" format:"uri"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ URL respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionWebSearchActionSearchSource) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionWebSearchActionSearchSource) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Action type "open_page" - Opens a specific URL from search results.
+type BetaResponseFunctionWebSearchActionOpenPage struct {
+ // The action type.
+ Type constant.OpenPage `json:"type" default:"open_page"`
+ // The URL opened by the model.
+ URL string `json:"url" api:"nullable" format:"uri"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ URL respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionWebSearchActionOpenPage) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionWebSearchActionOpenPage) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Action type "find_in_page": Searches for a pattern within a loaded page.
+type BetaResponseFunctionWebSearchActionFindInPage struct {
+ // The pattern or text to search for within the page.
+ Pattern string `json:"pattern" api:"required"`
+ // The action type.
+ Type constant.FindInPage `json:"type" default:"find_in_page"`
+ // The URL of the page searched for the pattern.
+ URL string `json:"url" api:"required" format:"uri"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Pattern respjson.Field
+ Type respjson.Field
+ URL respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionWebSearchActionFindInPage) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionWebSearchActionFindInPage) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The status of the web search tool call.
+type BetaResponseFunctionWebSearchStatus string
+
+const (
+ BetaResponseFunctionWebSearchStatusInProgress BetaResponseFunctionWebSearchStatus = "in_progress"
+ BetaResponseFunctionWebSearchStatusSearching BetaResponseFunctionWebSearchStatus = "searching"
+ BetaResponseFunctionWebSearchStatusCompleted BetaResponseFunctionWebSearchStatus = "completed"
+ BetaResponseFunctionWebSearchStatusFailed BetaResponseFunctionWebSearchStatus = "failed"
+)
+
+// The agent that produced this item.
+type BetaResponseFunctionWebSearchAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseFunctionWebSearchAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseFunctionWebSearchAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The results of a web search tool call. See the
+// [web search guide](https://platform.openai.com/docs/guides/tools-web-search) for
+// more information.
+//
+// The properties ID, Action, Status, Type are required.
+type BetaResponseFunctionWebSearchParam struct {
+ // The unique ID of the web search tool call.
+ ID string `json:"id" api:"required"`
+ // An object describing the specific action taken in this web search call. Includes
+ // details on how the model used the web (search, open_page, find_in_page).
+ Action BetaResponseFunctionWebSearchActionUnionParam `json:"action,omitzero" api:"required"`
+ // The status of the web search tool call.
+ //
+ // Any of "in_progress", "searching", "completed", "failed".
+ Status BetaResponseFunctionWebSearchStatus `json:"status,omitzero" api:"required"`
+ // The agent that produced this item.
+ Agent BetaResponseFunctionWebSearchAgentParam `json:"agent,omitzero"`
+ // The type of the web search tool call. Always `web_search_call`.
+ //
+ // This field can be elided, and will marshal its zero value as "web_search_call".
+ Type constant.WebSearchCall `json:"type" default:"web_search_call"`
+ paramObj
+}
+
+func (r BetaResponseFunctionWebSearchParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseFunctionWebSearchParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseFunctionWebSearchParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseFunctionWebSearchActionUnionParam struct {
+ OfSearch *BetaResponseFunctionWebSearchActionSearchParam `json:",omitzero,inline"`
+ OfOpenPage *BetaResponseFunctionWebSearchActionOpenPageParam `json:",omitzero,inline"`
+ OfFindInPage *BetaResponseFunctionWebSearchActionFindInPageParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseFunctionWebSearchActionUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfSearch, u.OfOpenPage, u.OfFindInPage)
+}
+func (u *BetaResponseFunctionWebSearchActionUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseFunctionWebSearchActionUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfSearch) {
+ return u.OfSearch
+ } else if !param.IsOmitted(u.OfOpenPage) {
+ return u.OfOpenPage
+ } else if !param.IsOmitted(u.OfFindInPage) {
+ return u.OfFindInPage
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFunctionWebSearchActionUnionParam) GetQueries() []string {
+ if vt := u.OfSearch; vt != nil {
+ return vt.Queries
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFunctionWebSearchActionUnionParam) GetQuery() *string {
+ if vt := u.OfSearch; vt != nil && vt.Query.Valid() {
+ return &vt.Query.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFunctionWebSearchActionUnionParam) GetSources() []BetaResponseFunctionWebSearchActionSearchSourceParam {
+ if vt := u.OfSearch; vt != nil {
+ return vt.Sources
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFunctionWebSearchActionUnionParam) GetPattern() *string {
+ if vt := u.OfFindInPage; vt != nil {
+ return &vt.Pattern
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFunctionWebSearchActionUnionParam) GetType() *string {
+ if vt := u.OfSearch; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfOpenPage; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfFindInPage; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseFunctionWebSearchActionUnionParam) GetURL() *string {
+ if vt := u.OfOpenPage; vt != nil && vt.URL.Valid() {
+ return &vt.URL.Value
+ } else if vt := u.OfFindInPage; vt != nil {
+ return (*string)(&vt.URL)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseFunctionWebSearchActionUnionParam](
+ "type",
+ apijson.Discriminator[BetaResponseFunctionWebSearchActionSearchParam]("search"),
+ apijson.Discriminator[BetaResponseFunctionWebSearchActionOpenPageParam]("open_page"),
+ apijson.Discriminator[BetaResponseFunctionWebSearchActionFindInPageParam]("find_in_page"),
+ )
+}
+
+// Action type "search" - Performs a web search query.
+//
+// The property Type is required.
+type BetaResponseFunctionWebSearchActionSearchParam struct {
+ // The search query.
+ //
+ // Deprecated: deprecated
+ Query param.Opt[string] `json:"query,omitzero"`
+ // The search queries.
+ Queries []string `json:"queries,omitzero"`
+ // The sources used in the search.
+ Sources []BetaResponseFunctionWebSearchActionSearchSourceParam `json:"sources,omitzero"`
+ // The action type.
+ //
+ // This field can be elided, and will marshal its zero value as "search".
+ Type constant.Search `json:"type" default:"search"`
+ paramObj
+}
+
+func (r BetaResponseFunctionWebSearchActionSearchParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseFunctionWebSearchActionSearchParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseFunctionWebSearchActionSearchParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A source used in the search.
+//
+// The properties Type, URL are required.
+type BetaResponseFunctionWebSearchActionSearchSourceParam struct {
+ // The URL of the source.
+ URL string `json:"url" api:"required" format:"uri"`
+ // The type of source. Always `url`.
+ //
+ // This field can be elided, and will marshal its zero value as "url".
+ Type constant.URL `json:"type" default:"url"`
+ paramObj
+}
+
+func (r BetaResponseFunctionWebSearchActionSearchSourceParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseFunctionWebSearchActionSearchSourceParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseFunctionWebSearchActionSearchSourceParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Action type "open_page" - Opens a specific URL from search results.
+//
+// The property Type is required.
+type BetaResponseFunctionWebSearchActionOpenPageParam struct {
+ // The URL opened by the model.
+ URL param.Opt[string] `json:"url,omitzero" format:"uri"`
+ // The action type.
+ //
+ // This field can be elided, and will marshal its zero value as "open_page".
+ Type constant.OpenPage `json:"type" default:"open_page"`
+ paramObj
+}
+
+func (r BetaResponseFunctionWebSearchActionOpenPageParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseFunctionWebSearchActionOpenPageParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseFunctionWebSearchActionOpenPageParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Action type "find_in_page": Searches for a pattern within a loaded page.
+//
+// The properties Pattern, Type, URL are required.
+type BetaResponseFunctionWebSearchActionFindInPageParam struct {
+ // The pattern or text to search for within the page.
+ Pattern string `json:"pattern" api:"required"`
+ // The URL of the page searched for the pattern.
+ URL string `json:"url" api:"required" format:"uri"`
+ // The action type.
+ //
+ // This field can be elided, and will marshal its zero value as "find_in_page".
+ Type constant.FindInPage `json:"type" default:"find_in_page"`
+ paramObj
+}
+
+func (r BetaResponseFunctionWebSearchActionFindInPageParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseFunctionWebSearchActionFindInPageParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseFunctionWebSearchActionFindInPageParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseFunctionWebSearchAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseFunctionWebSearchAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseFunctionWebSearchAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseFunctionWebSearchAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when an image generation tool call has completed and the final image is
+// available.
+type BetaResponseImageGenCallCompletedEvent struct {
+ // The unique identifier of the image generation item being processed.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item in the response's output array.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always 'response.image_generation_call.completed'.
+ Type constant.ResponseImageGenerationCallCompleted `json:"type" default:"response.image_generation_call.completed"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseImageGenCallCompletedEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseImageGenCallCompletedEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseImageGenCallCompletedEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseImageGenCallCompletedEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseImageGenCallCompletedEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseImageGenCallCompletedEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when an image generation tool call is actively generating an image
+// (intermediate state).
+type BetaResponseImageGenCallGeneratingEvent struct {
+ // The unique identifier of the image generation item being processed.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item in the response's output array.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of the image generation item being processed.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always 'response.image_generation_call.generating'.
+ Type constant.ResponseImageGenerationCallGenerating `json:"type" default:"response.image_generation_call.generating"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseImageGenCallGeneratingEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseImageGenCallGeneratingEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseImageGenCallGeneratingEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseImageGenCallGeneratingEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseImageGenCallGeneratingEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseImageGenCallGeneratingEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when an image generation tool call is in progress.
+type BetaResponseImageGenCallInProgressEvent struct {
+ // The unique identifier of the image generation item being processed.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item in the response's output array.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of the image generation item being processed.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always 'response.image_generation_call.in_progress'.
+ Type constant.ResponseImageGenerationCallInProgress `json:"type" default:"response.image_generation_call.in_progress"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseImageGenCallInProgressEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseImageGenCallInProgressEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseImageGenCallInProgressEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseImageGenCallInProgressEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseImageGenCallInProgressEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseImageGenCallInProgressEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when a partial image is available during image generation streaming.
+type BetaResponseImageGenCallPartialImageEvent struct {
+ // The unique identifier of the image generation item being processed.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item in the response's output array.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // Base64-encoded partial image data, suitable for rendering as an image.
+ PartialImageB64 string `json:"partial_image_b64" api:"required"`
+ // 0-based index for the partial image (backend is 1-based, but this is 0-based for
+ // the user).
+ PartialImageIndex int64 `json:"partial_image_index" api:"required"`
+ // The sequence number of the image generation item being processed.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always 'response.image_generation_call.partial_image'.
+ Type constant.ResponseImageGenerationCallPartialImage `json:"type" default:"response.image_generation_call.partial_image"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseImageGenCallPartialImageEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ PartialImageB64 respjson.Field
+ PartialImageIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseImageGenCallPartialImageEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseImageGenCallPartialImageEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseImageGenCallPartialImageEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseImageGenCallPartialImageEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseImageGenCallPartialImageEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when the response is in progress.
+type BetaResponseInProgressEvent struct {
+ // The response that is in progress.
+ Response BetaResponse `json:"response" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.in_progress`.
+ Type constant.ResponseInProgress `json:"type" default:"response.in_progress"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseInProgressEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Response respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInProgressEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInProgressEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseInProgressEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInProgressEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInProgressEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Specify additional output data to include in the model response. Currently
+// supported values are:
+//
+// - `web_search_call.results`: Include the search results of the web search tool
+// call.
+// - `web_search_call.action.sources`: Include the sources of the web search tool
+// call.
+// - `code_interpreter_call.outputs`: Includes the outputs of python code execution
+// in code interpreter tool call items.
+// - `computer_call_output.output.image_url`: Include image urls from the computer
+// call output.
+// - `file_search_call.results`: Include the search results of the file search tool
+// call.
+// - `message.input_image.image_url`: Include image urls from the input message.
+// - `message.output_text.logprobs`: Include logprobs with assistant messages.
+// - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
+// tokens in reasoning item outputs. This enables reasoning items to be used in
+// multi-turn conversations when using the Responses API statelessly (like when
+// the `store` parameter is set to `false`, or when an organization is enrolled
+// in the zero data retention program).
+type BetaResponseIncludable string
+
+const (
+ BetaResponseIncludableFileSearchCallResults BetaResponseIncludable = "file_search_call.results"
+ BetaResponseIncludableWebSearchCallResults BetaResponseIncludable = "web_search_call.results"
+ BetaResponseIncludableWebSearchCallActionSources BetaResponseIncludable = "web_search_call.action.sources"
+ BetaResponseIncludableMessageInputImageImageURL BetaResponseIncludable = "message.input_image.image_url"
+ BetaResponseIncludableComputerCallOutputOutputImageURL BetaResponseIncludable = "computer_call_output.output.image_url"
+ BetaResponseIncludableCodeInterpreterCallOutputs BetaResponseIncludable = "code_interpreter_call.outputs"
+ BetaResponseIncludableReasoningEncryptedContent BetaResponseIncludable = "reasoning.encrypted_content"
+ BetaResponseIncludableMessageOutputTextLogprobs BetaResponseIncludable = "message.output_text.logprobs"
+)
+
+// An event that is emitted when a response finishes as incomplete.
+type BetaResponseIncompleteEvent struct {
+ // The response that was incomplete.
+ Response BetaResponse `json:"response" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.incomplete`.
+ Type constant.ResponseIncomplete `json:"type" default:"response.incomplete"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseIncompleteEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Response respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseIncompleteEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseIncompleteEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseIncompleteEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseIncompleteEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseIncompleteEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputParam []BetaResponseInputItemUnionParam
+
+// BetaResponseInputContentUnion contains all possible properties and values from
+// [BetaResponseInputText], [BetaResponseInputImage], [BetaResponseInputFile].
+//
+// Use the [BetaResponseInputContentUnion.AsAny] method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseInputContentUnion struct {
+ // This field is from variant [BetaResponseInputText].
+ Text string `json:"text"`
+ // Any of "input_text", "input_image", "input_file".
+ Type string `json:"type"`
+ // This field is a union of [BetaResponseInputTextPromptCacheBreakpoint],
+ // [BetaResponseInputImagePromptCacheBreakpoint],
+ // [BetaResponseInputFilePromptCacheBreakpoint]
+ PromptCacheBreakpoint BetaResponseInputContentUnionPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
+ Detail string `json:"detail"`
+ FileID string `json:"file_id"`
+ // This field is from variant [BetaResponseInputImage].
+ ImageURL string `json:"image_url"`
+ // This field is from variant [BetaResponseInputFile].
+ FileData string `json:"file_data"`
+ // This field is from variant [BetaResponseInputFile].
+ FileURL string `json:"file_url"`
+ // This field is from variant [BetaResponseInputFile].
+ Filename string `json:"filename"`
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ Detail respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ FileData respjson.Field
+ FileURL respjson.Field
+ Filename respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseInputContent is implemented by each variant of
+// [BetaResponseInputContentUnion] to add type safety for the return type of
+// [BetaResponseInputContentUnion.AsAny]
+type anyBetaResponseInputContent interface {
+ implBetaResponseInputContentUnion()
+}
+
+func (BetaResponseInputText) implBetaResponseInputContentUnion() {}
+func (BetaResponseInputImage) implBetaResponseInputContentUnion() {}
+func (BetaResponseInputFile) implBetaResponseInputContentUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseInputContentUnion.AsAny().(type) {
+// case openai.BetaResponseInputText:
+// case openai.BetaResponseInputImage:
+// case openai.BetaResponseInputFile:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseInputContentUnion) AsAny() anyBetaResponseInputContent {
+ switch u.Type {
+ case "input_text":
+ return u.AsInputText()
+ case "input_image":
+ return u.AsInputImage()
+ case "input_file":
+ return u.AsInputFile()
+ }
+ return nil
+}
+
+func (u BetaResponseInputContentUnion) AsInputText() (v BetaResponseInputText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputContentUnion) AsInputImage() (v BetaResponseInputImage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputContentUnion) AsInputFile() (v BetaResponseInputFile) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseInputContentUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseInputContentUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInputContentUnionPromptCacheBreakpoint is an implicit subunion of
+// [BetaResponseInputContentUnion].
+// BetaResponseInputContentUnionPromptCacheBreakpoint provides convenient access to
+// the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseInputContentUnion].
+type BetaResponseInputContentUnionPromptCacheBreakpoint struct {
+ // This field is from variant [BetaResponseInputTextPromptCacheBreakpoint].
+ Mode constant.Explicit `json:"mode"`
+ JSON struct {
+ Mode respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseInputContentUnionPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseInputContentUnion to a
+// BetaResponseInputContentUnionParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseInputContentUnionParam.Overrides()
+func (r BetaResponseInputContentUnion) ToParam() BetaResponseInputContentUnionParam {
+ return param.Override[BetaResponseInputContentUnionParam](json.RawMessage(r.RawJSON()))
+}
+
+func BetaResponseInputContentParamOfInputText(text string) BetaResponseInputContentUnionParam {
+ var inputText BetaResponseInputTextParam
+ inputText.Text = text
+ return BetaResponseInputContentUnionParam{OfInputText: &inputText}
+}
+
+func BetaResponseInputContentParamOfInputImage(detail BetaResponseInputImageDetail) BetaResponseInputContentUnionParam {
+ var inputImage BetaResponseInputImageParam
+ inputImage.Detail = detail
+ return BetaResponseInputContentUnionParam{OfInputImage: &inputImage}
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseInputContentUnionParam struct {
+ OfInputText *BetaResponseInputTextParam `json:",omitzero,inline"`
+ OfInputImage *BetaResponseInputImageParam `json:",omitzero,inline"`
+ OfInputFile *BetaResponseInputFileParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseInputContentUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfInputText, u.OfInputImage, u.OfInputFile)
+}
+func (u *BetaResponseInputContentUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseInputContentUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfInputText) {
+ return u.OfInputText
+ } else if !param.IsOmitted(u.OfInputImage) {
+ return u.OfInputImage
+ } else if !param.IsOmitted(u.OfInputFile) {
+ return u.OfInputFile
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputContentUnionParam) GetText() *string {
+ if vt := u.OfInputText; vt != nil {
+ return &vt.Text
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputContentUnionParam) GetImageURL() *string {
+ if vt := u.OfInputImage; vt != nil && vt.ImageURL.Valid() {
+ return &vt.ImageURL.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputContentUnionParam) GetFileData() *string {
+ if vt := u.OfInputFile; vt != nil && vt.FileData.Valid() {
+ return &vt.FileData.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputContentUnionParam) GetFileURL() *string {
+ if vt := u.OfInputFile; vt != nil && vt.FileURL.Valid() {
+ return &vt.FileURL.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputContentUnionParam) GetFilename() *string {
+ if vt := u.OfInputFile; vt != nil && vt.Filename.Valid() {
+ return &vt.Filename.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputContentUnionParam) GetType() *string {
+ if vt := u.OfInputText; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfInputImage; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfInputFile; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputContentUnionParam) GetDetail() *string {
+ if vt := u.OfInputImage; vt != nil {
+ return (*string)(&vt.Detail)
+ } else if vt := u.OfInputFile; vt != nil {
+ return (*string)(&vt.Detail)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputContentUnionParam) GetFileID() *string {
+ if vt := u.OfInputImage; vt != nil && vt.FileID.Valid() {
+ return &vt.FileID.Value
+ } else if vt := u.OfInputFile; vt != nil && vt.FileID.Valid() {
+ return &vt.FileID.Value
+ }
+ return nil
+}
+
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u BetaResponseInputContentUnionParam) GetPromptCacheBreakpoint() (res betaResponseInputContentUnionParamPromptCacheBreakpoint) {
+ if vt := u.OfInputText; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ } else if vt := u.OfInputImage; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ } else if vt := u.OfInputFile; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ }
+ return
+}
+
+// Can have the runtime types [*BetaResponseInputTextPromptCacheBreakpointParam],
+// [*BetaResponseInputImagePromptCacheBreakpointParam],
+// [*BetaResponseInputFilePromptCacheBreakpointParam]
+type betaResponseInputContentUnionParamPromptCacheBreakpoint struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *openai.BetaResponseInputTextPromptCacheBreakpointParam:
+// case *openai.BetaResponseInputImagePromptCacheBreakpointParam:
+// case *openai.BetaResponseInputFilePromptCacheBreakpointParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u betaResponseInputContentUnionParamPromptCacheBreakpoint) AsAny() any { return u.any }
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputContentUnionParamPromptCacheBreakpoint) GetMode() *string {
+ switch vt := u.any.(type) {
+ case *BetaResponseInputTextPromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ case *BetaResponseInputImagePromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ case *BetaResponseInputFilePromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseInputContentUnionParam](
+ "type",
+ apijson.Discriminator[BetaResponseInputTextParam]("input_text"),
+ apijson.Discriminator[BetaResponseInputImageParam]("input_image"),
+ apijson.Discriminator[BetaResponseInputFileParam]("input_file"),
+ )
+}
+
+// A file input to the model.
+type BetaResponseInputFile struct {
+ // The type of the input item. Always `input_file`.
+ Type constant.InputFile `json:"type" default:"input_file"`
+ // The detail level of the file to be sent to the model. Use `auto` to let the
+ // system select the detail level; for GPT-5.6 and later models, `auto` uses
+ // high-quality rendering, which may increase input token usage. Use `low` for
+ // lower-cost rendering, or `high` to render the file at higher quality. Defaults
+ // to `auto`.
+ //
+ // Any of "auto", "low", "high".
+ Detail BetaResponseInputFileDetail `json:"detail"`
+ // The content of the file to be sent to the model.
+ FileData string `json:"file_data"`
+ // The ID of the file to be sent to the model.
+ FileID string `json:"file_id" api:"nullable"`
+ // The URL of the file to be sent to the model.
+ FileURL string `json:"file_url" format:"uri"`
+ // The name of the file to be sent to the model.
+ Filename string `json:"filename"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint BetaResponseInputFilePromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ Detail respjson.Field
+ FileData respjson.Field
+ FileID respjson.Field
+ FileURL respjson.Field
+ Filename respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputFile) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputFile) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseInputFile to a BetaResponseInputFileParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseInputFileParam.Overrides()
+func (r BetaResponseInputFile) ToParam() BetaResponseInputFileParam {
+ return param.Override[BetaResponseInputFileParam](json.RawMessage(r.RawJSON()))
+}
+
+// The detail level of the file to be sent to the model. Use `auto` to let the
+// system select the detail level; for GPT-5.6 and later models, `auto` uses
+// high-quality rendering, which may increase input token usage. Use `low` for
+// lower-cost rendering, or `high` to render the file at higher quality. Defaults
+// to `auto`.
+type BetaResponseInputFileDetail string
+
+const (
+ BetaResponseInputFileDetailAuto BetaResponseInputFileDetail = "auto"
+ BetaResponseInputFileDetailLow BetaResponseInputFileDetail = "low"
+ BetaResponseInputFileDetailHigh BetaResponseInputFileDetail = "high"
+)
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+type BetaResponseInputFilePromptCacheBreakpoint struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Mode respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputFilePromptCacheBreakpoint) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputFilePromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A file input to the model.
+//
+// The property Type is required.
+type BetaResponseInputFileParam struct {
+ // The ID of the file to be sent to the model.
+ FileID param.Opt[string] `json:"file_id,omitzero"`
+ // The content of the file to be sent to the model.
+ FileData param.Opt[string] `json:"file_data,omitzero"`
+ // The URL of the file to be sent to the model.
+ FileURL param.Opt[string] `json:"file_url,omitzero" format:"uri"`
+ // The name of the file to be sent to the model.
+ Filename param.Opt[string] `json:"filename,omitzero"`
+ // The detail level of the file to be sent to the model. Use `auto` to let the
+ // system select the detail level; for GPT-5.6 and later models, `auto` uses
+ // high-quality rendering, which may increase input token usage. Use `low` for
+ // lower-cost rendering, or `high` to render the file at higher quality. Defaults
+ // to `auto`.
+ //
+ // Any of "auto", "low", "high".
+ Detail BetaResponseInputFileDetail `json:"detail,omitzero"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint BetaResponseInputFilePromptCacheBreakpointParam `json:"prompt_cache_breakpoint,omitzero"`
+ // The type of the input item. Always `input_file`.
+ //
+ // This field can be elided, and will marshal its zero value as "input_file".
+ Type constant.InputFile `json:"type" default:"input_file"`
+ paramObj
+}
+
+func (r BetaResponseInputFileParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputFileParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputFileParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func NewBetaResponseInputFilePromptCacheBreakpointParam() BetaResponseInputFilePromptCacheBreakpointParam {
+ return BetaResponseInputFilePromptCacheBreakpointParam{
+ Mode: "explicit",
+ }
+}
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+//
+// This struct has a constant value, construct it with
+// [NewBetaResponseInputFilePromptCacheBreakpointParam].
+type BetaResponseInputFilePromptCacheBreakpointParam struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ paramObj
+}
+
+func (r BetaResponseInputFilePromptCacheBreakpointParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputFilePromptCacheBreakpointParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputFilePromptCacheBreakpointParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A file input to the model.
+type BetaResponseInputFileContent struct {
+ // The type of the input item. Always `input_file`.
+ Type constant.InputFile `json:"type" default:"input_file"`
+ // The detail level of the file to be sent to the model. Use `auto` to let the
+ // system select the detail level; for GPT-5.6 and later models, `auto` uses
+ // high-quality rendering, which may increase input token usage. Use `low` for
+ // lower-cost rendering, or `high` to render the file at higher quality. Defaults
+ // to `auto`.
+ //
+ // Any of "auto", "low", "high".
+ Detail BetaResponseInputFileContentDetail `json:"detail"`
+ // The base64-encoded data of the file to be sent to the model.
+ FileData string `json:"file_data" api:"nullable"`
+ // The ID of the file to be sent to the model.
+ FileID string `json:"file_id" api:"nullable"`
+ // The URL of the file to be sent to the model.
+ FileURL string `json:"file_url" api:"nullable" format:"uri"`
+ // The name of the file to be sent to the model.
+ Filename string `json:"filename" api:"nullable"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint BetaResponseInputFileContentPromptCacheBreakpoint `json:"prompt_cache_breakpoint" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ Detail respjson.Field
+ FileData respjson.Field
+ FileID respjson.Field
+ FileURL respjson.Field
+ Filename respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputFileContent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputFileContent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseInputFileContent to a
+// BetaResponseInputFileContentParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseInputFileContentParam.Overrides()
+func (r BetaResponseInputFileContent) ToParam() BetaResponseInputFileContentParam {
+ return param.Override[BetaResponseInputFileContentParam](json.RawMessage(r.RawJSON()))
+}
+
+// The detail level of the file to be sent to the model. Use `auto` to let the
+// system select the detail level; for GPT-5.6 and later models, `auto` uses
+// high-quality rendering, which may increase input token usage. Use `low` for
+// lower-cost rendering, or `high` to render the file at higher quality. Defaults
+// to `auto`.
+type BetaResponseInputFileContentDetail string
+
+const (
+ BetaResponseInputFileContentDetailAuto BetaResponseInputFileContentDetail = "auto"
+ BetaResponseInputFileContentDetailLow BetaResponseInputFileContentDetail = "low"
+ BetaResponseInputFileContentDetailHigh BetaResponseInputFileContentDetail = "high"
+)
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+type BetaResponseInputFileContentPromptCacheBreakpoint struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Mode respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputFileContentPromptCacheBreakpoint) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputFileContentPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A file input to the model.
+//
+// The property Type is required.
+type BetaResponseInputFileContentParam struct {
+ // The base64-encoded data of the file to be sent to the model.
+ FileData param.Opt[string] `json:"file_data,omitzero"`
+ // The ID of the file to be sent to the model.
+ FileID param.Opt[string] `json:"file_id,omitzero"`
+ // The URL of the file to be sent to the model.
+ FileURL param.Opt[string] `json:"file_url,omitzero" format:"uri"`
+ // The name of the file to be sent to the model.
+ Filename param.Opt[string] `json:"filename,omitzero"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint BetaResponseInputFileContentPromptCacheBreakpointParam `json:"prompt_cache_breakpoint,omitzero"`
+ // The detail level of the file to be sent to the model. Use `auto` to let the
+ // system select the detail level; for GPT-5.6 and later models, `auto` uses
+ // high-quality rendering, which may increase input token usage. Use `low` for
+ // lower-cost rendering, or `high` to render the file at higher quality. Defaults
+ // to `auto`.
+ //
+ // Any of "auto", "low", "high".
+ Detail BetaResponseInputFileContentDetail `json:"detail,omitzero"`
+ // The type of the input item. Always `input_file`.
+ //
+ // This field can be elided, and will marshal its zero value as "input_file".
+ Type constant.InputFile `json:"type" default:"input_file"`
+ paramObj
+}
+
+func (r BetaResponseInputFileContentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputFileContentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputFileContentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func NewBetaResponseInputFileContentPromptCacheBreakpointParam() BetaResponseInputFileContentPromptCacheBreakpointParam {
+ return BetaResponseInputFileContentPromptCacheBreakpointParam{
+ Mode: "explicit",
+ }
+}
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+//
+// This struct has a constant value, construct it with
+// [NewBetaResponseInputFileContentPromptCacheBreakpointParam].
+type BetaResponseInputFileContentPromptCacheBreakpointParam struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ paramObj
+}
+
+func (r BetaResponseInputFileContentPromptCacheBreakpointParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputFileContentPromptCacheBreakpointParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputFileContentPromptCacheBreakpointParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An image input to the model. Learn about
+// [image inputs](https://platform.openai.com/docs/guides/vision).
+type BetaResponseInputImage struct {
+ // The detail level of the image to be sent to the model. One of `high`, `low`,
+ // `auto`, or `original`. Defaults to `auto`.
+ //
+ // Any of "low", "high", "auto", "original".
+ Detail BetaResponseInputImageDetail `json:"detail" api:"required"`
+ // The type of the input item. Always `input_image`.
+ Type constant.InputImage `json:"type" default:"input_image"`
+ // The ID of the file to be sent to the model.
+ FileID string `json:"file_id" api:"nullable"`
+ // The URL of the image to be sent to the model. A fully qualified URL or base64
+ // encoded image in a data URL.
+ ImageURL string `json:"image_url" api:"nullable" format:"uri"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint BetaResponseInputImagePromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Detail respjson.Field
+ Type respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputImage) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputImage) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseInputImage to a BetaResponseInputImageParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseInputImageParam.Overrides()
+func (r BetaResponseInputImage) ToParam() BetaResponseInputImageParam {
+ return param.Override[BetaResponseInputImageParam](json.RawMessage(r.RawJSON()))
+}
+
+// The detail level of the image to be sent to the model. One of `high`, `low`,
+// `auto`, or `original`. Defaults to `auto`.
+type BetaResponseInputImageDetail string
+
+const (
+ BetaResponseInputImageDetailLow BetaResponseInputImageDetail = "low"
+ BetaResponseInputImageDetailHigh BetaResponseInputImageDetail = "high"
+ BetaResponseInputImageDetailAuto BetaResponseInputImageDetail = "auto"
+ BetaResponseInputImageDetailOriginal BetaResponseInputImageDetail = "original"
+)
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+type BetaResponseInputImagePromptCacheBreakpoint struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Mode respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputImagePromptCacheBreakpoint) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputImagePromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An image input to the model. Learn about
+// [image inputs](https://platform.openai.com/docs/guides/vision).
+//
+// The properties Detail, Type are required.
+type BetaResponseInputImageParam struct {
+ // The detail level of the image to be sent to the model. One of `high`, `low`,
+ // `auto`, or `original`. Defaults to `auto`.
+ //
+ // Any of "low", "high", "auto", "original".
+ Detail BetaResponseInputImageDetail `json:"detail,omitzero" api:"required"`
+ // The ID of the file to be sent to the model.
+ FileID param.Opt[string] `json:"file_id,omitzero"`
+ // The URL of the image to be sent to the model. A fully qualified URL or base64
+ // encoded image in a data URL.
+ ImageURL param.Opt[string] `json:"image_url,omitzero" format:"uri"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint BetaResponseInputImagePromptCacheBreakpointParam `json:"prompt_cache_breakpoint,omitzero"`
+ // The type of the input item. Always `input_image`.
+ //
+ // This field can be elided, and will marshal its zero value as "input_image".
+ Type constant.InputImage `json:"type" default:"input_image"`
+ paramObj
+}
+
+func (r BetaResponseInputImageParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputImageParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputImageParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func NewBetaResponseInputImagePromptCacheBreakpointParam() BetaResponseInputImagePromptCacheBreakpointParam {
+ return BetaResponseInputImagePromptCacheBreakpointParam{
+ Mode: "explicit",
+ }
+}
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+//
+// This struct has a constant value, construct it with
+// [NewBetaResponseInputImagePromptCacheBreakpointParam].
+type BetaResponseInputImagePromptCacheBreakpointParam struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ paramObj
+}
+
+func (r BetaResponseInputImagePromptCacheBreakpointParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputImagePromptCacheBreakpointParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputImagePromptCacheBreakpointParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An image input to the model. Learn about
+// [image inputs](https://platform.openai.com/docs/guides/vision)
+type BetaResponseInputImageContent struct {
+ // The type of the input item. Always `input_image`.
+ Type constant.InputImage `json:"type" default:"input_image"`
+ // The detail level of the image to be sent to the model. One of `high`, `low`,
+ // `auto`, or `original`. Defaults to `auto`.
+ //
+ // Any of "low", "high", "auto", "original".
+ Detail BetaResponseInputImageContentDetail `json:"detail" api:"nullable"`
+ // The ID of the file to be sent to the model.
+ FileID string `json:"file_id" api:"nullable"`
+ // The URL of the image to be sent to the model. A fully qualified URL or base64
+ // encoded image in a data URL.
+ ImageURL string `json:"image_url" api:"nullable" format:"uri"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint BetaResponseInputImageContentPromptCacheBreakpoint `json:"prompt_cache_breakpoint" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ Detail respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputImageContent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputImageContent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseInputImageContent to a
+// BetaResponseInputImageContentParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseInputImageContentParam.Overrides()
+func (r BetaResponseInputImageContent) ToParam() BetaResponseInputImageContentParam {
+ return param.Override[BetaResponseInputImageContentParam](json.RawMessage(r.RawJSON()))
+}
+
+// The detail level of the image to be sent to the model. One of `high`, `low`,
+// `auto`, or `original`. Defaults to `auto`.
+type BetaResponseInputImageContentDetail string
+
+const (
+ BetaResponseInputImageContentDetailLow BetaResponseInputImageContentDetail = "low"
+ BetaResponseInputImageContentDetailHigh BetaResponseInputImageContentDetail = "high"
+ BetaResponseInputImageContentDetailAuto BetaResponseInputImageContentDetail = "auto"
+ BetaResponseInputImageContentDetailOriginal BetaResponseInputImageContentDetail = "original"
+)
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+type BetaResponseInputImageContentPromptCacheBreakpoint struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Mode respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputImageContentPromptCacheBreakpoint) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputImageContentPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An image input to the model. Learn about
+// [image inputs](https://platform.openai.com/docs/guides/vision)
+//
+// The property Type is required.
+type BetaResponseInputImageContentParam struct {
+ // The ID of the file to be sent to the model.
+ FileID param.Opt[string] `json:"file_id,omitzero"`
+ // The URL of the image to be sent to the model. A fully qualified URL or base64
+ // encoded image in a data URL.
+ ImageURL param.Opt[string] `json:"image_url,omitzero" format:"uri"`
+ // The detail level of the image to be sent to the model. One of `high`, `low`,
+ // `auto`, or `original`. Defaults to `auto`.
+ //
+ // Any of "low", "high", "auto", "original".
+ Detail BetaResponseInputImageContentDetail `json:"detail,omitzero"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint BetaResponseInputImageContentPromptCacheBreakpointParam `json:"prompt_cache_breakpoint,omitzero"`
+ // The type of the input item. Always `input_image`.
+ //
+ // This field can be elided, and will marshal its zero value as "input_image".
+ Type constant.InputImage `json:"type" default:"input_image"`
+ paramObj
+}
+
+func (r BetaResponseInputImageContentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputImageContentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputImageContentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func NewBetaResponseInputImageContentPromptCacheBreakpointParam() BetaResponseInputImageContentPromptCacheBreakpointParam {
+ return BetaResponseInputImageContentPromptCacheBreakpointParam{
+ Mode: "explicit",
+ }
+}
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+//
+// This struct has a constant value, construct it with
+// [NewBetaResponseInputImageContentPromptCacheBreakpointParam].
+type BetaResponseInputImageContentPromptCacheBreakpointParam struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ paramObj
+}
+
+func (r BetaResponseInputImageContentPromptCacheBreakpointParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputImageContentPromptCacheBreakpointParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputImageContentPromptCacheBreakpointParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInputItemUnion contains all possible properties and values from
+// [BetaEasyInputMessage], [BetaResponseInputItemMessage],
+// [BetaResponseOutputMessage], [BetaResponseFileSearchToolCall],
+// [BetaResponseComputerToolCall], [BetaResponseInputItemComputerCallOutput],
+// [BetaResponseFunctionWebSearch], [BetaResponseFunctionToolCall],
+// [BetaResponseInputItemFunctionCallOutput], [BetaResponseInputItemAgentMessage],
+// [BetaResponseInputItemMultiAgentCall],
+// [BetaResponseInputItemMultiAgentCallOutput],
+// [BetaResponseInputItemToolSearchCall],
+// [BetaResponseToolSearchOutputItemParamResp],
+// [BetaResponseInputItemAdditionalTools], [BetaResponseReasoningItem],
+// [BetaResponseCompactionItemParamResp],
+// [BetaResponseInputItemImageGenerationCall],
+// [BetaResponseCodeInterpreterToolCall], [BetaResponseInputItemLocalShellCall],
+// [BetaResponseInputItemLocalShellCallOutput], [BetaResponseInputItemShellCall],
+// [BetaResponseInputItemShellCallOutput], [BetaResponseInputItemApplyPatchCall],
+// [BetaResponseInputItemApplyPatchCallOutput],
+// [BetaResponseInputItemMcpListTools], [BetaResponseInputItemMcpApprovalRequest],
+// [BetaResponseInputItemMcpApprovalResponse], [BetaResponseInputItemMcpCall],
+// [BetaResponseCustomToolCallOutput], [BetaResponseCustomToolCall],
+// [BetaResponseInputItemCompactionTrigger], [BetaResponseInputItemItemReference],
+// [BetaResponseInputItemProgram], [BetaResponseInputItemProgramOutput].
+//
+// Use the [BetaResponseInputItemUnion.AsAny] method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseInputItemUnion struct {
+ // This field is a union of [BetaEasyInputMessageContentUnion],
+ // [BetaResponseInputMessageContentList],
+ // [[]BetaResponseOutputMessageContentUnion],
+ // [[]BetaResponseInputItemAgentMessageContentUnion],
+ // [[]BetaResponseReasoningItemContent]
+ Content BetaResponseInputItemUnionContent `json:"content"`
+ Role string `json:"role"`
+ Phase string `json:"phase"`
+ // Any of "message", "message", "message", "file_search_call", "computer_call",
+ // "computer_call_output", "web_search_call", "function_call",
+ // "function_call_output", "agent_message", "multi_agent_call",
+ // "multi_agent_call_output", "tool_search_call", "tool_search_output",
+ // "additional_tools", "reasoning", "compaction", "image_generation_call",
+ // "code_interpreter_call", "local_shell_call", "local_shell_call_output",
+ // "shell_call", "shell_call_output", "apply_patch_call",
+ // "apply_patch_call_output", "mcp_list_tools", "mcp_approval_request",
+ // "mcp_approval_response", "mcp_call", "custom_tool_call_output",
+ // "custom_tool_call", "compaction_trigger", "item_reference", "program",
+ // "program_output".
+ Type string `json:"type"`
+ // This field is a union of [BetaResponseInputItemMessageAgent],
+ // [BetaResponseOutputMessageAgent], [BetaResponseFileSearchToolCallAgent],
+ // [BetaResponseComputerToolCallAgent],
+ // [BetaResponseInputItemComputerCallOutputAgent],
+ // [BetaResponseFunctionWebSearchAgent], [BetaResponseFunctionToolCallAgent],
+ // [BetaResponseInputItemFunctionCallOutputAgent],
+ // [BetaResponseInputItemAgentMessageAgent],
+ // [BetaResponseInputItemMultiAgentCallAgent],
+ // [BetaResponseInputItemMultiAgentCallOutputAgent],
+ // [BetaResponseInputItemToolSearchCallAgent],
+ // [BetaResponseToolSearchOutputItemParamAgentResp],
+ // [BetaResponseInputItemAdditionalToolsAgent], [BetaResponseReasoningItemAgent],
+ // [BetaResponseCompactionItemParamAgentResp],
+ // [BetaResponseInputItemImageGenerationCallAgent],
+ // [BetaResponseCodeInterpreterToolCallAgent],
+ // [BetaResponseInputItemLocalShellCallAgent],
+ // [BetaResponseInputItemLocalShellCallOutputAgent],
+ // [BetaResponseInputItemShellCallAgent],
+ // [BetaResponseInputItemShellCallOutputAgent],
+ // [BetaResponseInputItemApplyPatchCallAgent],
+ // [BetaResponseInputItemApplyPatchCallOutputAgent],
+ // [BetaResponseInputItemMcpListToolsAgent],
+ // [BetaResponseInputItemMcpApprovalRequestAgent],
+ // [BetaResponseInputItemMcpApprovalResponseAgent],
+ // [BetaResponseInputItemMcpCallAgent], [BetaResponseCustomToolCallOutputAgent],
+ // [BetaResponseCustomToolCallAgent],
+ // [BetaResponseInputItemCompactionTriggerAgent],
+ // [BetaResponseInputItemItemReferenceAgent], [BetaResponseInputItemProgramAgent],
+ // [BetaResponseInputItemProgramOutputAgent]
+ Agent BetaResponseInputItemUnionAgent `json:"agent"`
+ Status string `json:"status"`
+ ID string `json:"id"`
+ // This field is from variant [BetaResponseFileSearchToolCall].
+ Queries []string `json:"queries"`
+ // This field is from variant [BetaResponseFileSearchToolCall].
+ Results []BetaResponseFileSearchToolCallResult `json:"results"`
+ CallID string `json:"call_id"`
+ // This field is from variant [BetaResponseComputerToolCall].
+ PendingSafetyChecks []BetaResponseComputerToolCallPendingSafetyCheck `json:"pending_safety_checks"`
+ // This field is a union of [BetaComputerActionUnion],
+ // [BetaResponseFunctionWebSearchActionUnion], [string], [string],
+ // [BetaResponseInputItemLocalShellCallAction],
+ // [BetaResponseInputItemShellCallAction]
+ Action BetaResponseInputItemUnionAction `json:"action"`
+ // This field is from variant [BetaResponseComputerToolCall].
+ Actions BetaComputerActionList `json:"actions"`
+ // This field is a union of [BetaResponseComputerToolCallOutputScreenshot],
+ // [BetaResponseInputItemFunctionCallOutputOutputUnion],
+ // [[]BetaResponseInputItemMultiAgentCallOutputOutput], [string],
+ // [[]BetaResponseFunctionShellCallOutputContent], [string], [string],
+ // [BetaResponseCustomToolCallOutputOutputUnion]
+ Output BetaResponseInputItemUnionOutput `json:"output"`
+ // This field is from variant [BetaResponseInputItemComputerCallOutput].
+ AcknowledgedSafetyChecks []BetaResponseInputItemComputerCallOutputAcknowledgedSafetyCheck `json:"acknowledged_safety_checks"`
+ // This field is a union of [string], [string], [any], [string], [string]
+ Arguments BetaResponseInputItemUnionArguments `json:"arguments"`
+ Name string `json:"name"`
+ // This field is a union of [BetaResponseFunctionToolCallCallerUnion],
+ // [BetaResponseInputItemFunctionCallOutputCallerUnion],
+ // [BetaResponseInputItemShellCallCallerUnion],
+ // [BetaResponseInputItemShellCallOutputCallerUnion],
+ // [BetaResponseInputItemApplyPatchCallCallerUnion],
+ // [BetaResponseInputItemApplyPatchCallOutputCallerUnion],
+ // [BetaResponseCustomToolCallOutputCallerUnion],
+ // [BetaResponseCustomToolCallCallerUnion]
+ Caller BetaResponseInputItemUnionCaller `json:"caller"`
+ Namespace string `json:"namespace"`
+ // This field is from variant [BetaResponseInputItemAgentMessage].
+ Author string `json:"author"`
+ // This field is from variant [BetaResponseInputItemAgentMessage].
+ Recipient string `json:"recipient"`
+ Execution string `json:"execution"`
+ // This field is a union of [[]BetaToolUnion], [[]BetaToolUnion],
+ // [[]BetaResponseInputItemMcpListToolsTool]
+ Tools BetaResponseInputItemUnionTools `json:"tools"`
+ // This field is from variant [BetaResponseReasoningItem].
+ Summary []BetaResponseReasoningItemSummary `json:"summary"`
+ EncryptedContent string `json:"encrypted_content"`
+ Result string `json:"result"`
+ Code string `json:"code"`
+ // This field is from variant [BetaResponseCodeInterpreterToolCall].
+ ContainerID string `json:"container_id"`
+ // This field is from variant [BetaResponseCodeInterpreterToolCall].
+ Outputs []BetaResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
+ // This field is from variant [BetaResponseInputItemShellCall].
+ Environment BetaResponseInputItemShellCallEnvironmentUnion `json:"environment"`
+ // This field is from variant [BetaResponseInputItemShellCallOutput].
+ MaxOutputLength int64 `json:"max_output_length"`
+ // This field is from variant [BetaResponseInputItemApplyPatchCall].
+ Operation BetaResponseInputItemApplyPatchCallOperationUnion `json:"operation"`
+ ServerLabel string `json:"server_label"`
+ Error string `json:"error"`
+ ApprovalRequestID string `json:"approval_request_id"`
+ // This field is from variant [BetaResponseInputItemMcpApprovalResponse].
+ Approve bool `json:"approve"`
+ // This field is from variant [BetaResponseInputItemMcpApprovalResponse].
+ Reason string `json:"reason"`
+ // This field is from variant [BetaResponseCustomToolCall].
+ Input string `json:"input"`
+ // This field is from variant [BetaResponseInputItemProgram].
+ Fingerprint string `json:"fingerprint"`
+ JSON struct {
+ Content respjson.Field
+ Role respjson.Field
+ Phase respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Status respjson.Field
+ ID respjson.Field
+ Queries respjson.Field
+ Results respjson.Field
+ CallID respjson.Field
+ PendingSafetyChecks respjson.Field
+ Action respjson.Field
+ Actions respjson.Field
+ Output respjson.Field
+ AcknowledgedSafetyChecks respjson.Field
+ Arguments respjson.Field
+ Name respjson.Field
+ Caller respjson.Field
+ Namespace respjson.Field
+ Author respjson.Field
+ Recipient respjson.Field
+ Execution respjson.Field
+ Tools respjson.Field
+ Summary respjson.Field
+ EncryptedContent respjson.Field
+ Result respjson.Field
+ Code respjson.Field
+ ContainerID respjson.Field
+ Outputs respjson.Field
+ Environment respjson.Field
+ MaxOutputLength respjson.Field
+ Operation respjson.Field
+ ServerLabel respjson.Field
+ Error respjson.Field
+ ApprovalRequestID respjson.Field
+ Approve respjson.Field
+ Reason respjson.Field
+ Input respjson.Field
+ Fingerprint respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseInputItem is implemented by each variant of
+// [BetaResponseInputItemUnion] to add type safety for the return type of
+// [BetaResponseInputItemUnion.AsAny]
+type anyBetaResponseInputItem interface {
+ implBetaResponseInputItemUnion()
+}
+
+func (BetaEasyInputMessage) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemMessage) implBetaResponseInputItemUnion() {}
+func (BetaResponseOutputMessage) implBetaResponseInputItemUnion() {}
+func (BetaResponseFileSearchToolCall) implBetaResponseInputItemUnion() {}
+func (BetaResponseComputerToolCall) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemComputerCallOutput) implBetaResponseInputItemUnion() {}
+func (BetaResponseFunctionWebSearch) implBetaResponseInputItemUnion() {}
+func (BetaResponseFunctionToolCall) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemFunctionCallOutput) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemAgentMessage) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemMultiAgentCall) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemMultiAgentCallOutput) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemToolSearchCall) implBetaResponseInputItemUnion() {}
+func (BetaResponseToolSearchOutputItemParamResp) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemAdditionalTools) implBetaResponseInputItemUnion() {}
+func (BetaResponseReasoningItem) implBetaResponseInputItemUnion() {}
+func (BetaResponseCompactionItemParamResp) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemImageGenerationCall) implBetaResponseInputItemUnion() {}
+func (BetaResponseCodeInterpreterToolCall) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemLocalShellCall) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemLocalShellCallOutput) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemShellCall) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemShellCallOutput) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemApplyPatchCall) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemApplyPatchCallOutput) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemMcpListTools) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemMcpApprovalRequest) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemMcpApprovalResponse) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemMcpCall) implBetaResponseInputItemUnion() {}
+func (BetaResponseCustomToolCallOutput) implBetaResponseInputItemUnion() {}
+func (BetaResponseCustomToolCall) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemCompactionTrigger) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemItemReference) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemProgram) implBetaResponseInputItemUnion() {}
+func (BetaResponseInputItemProgramOutput) implBetaResponseInputItemUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseInputItemUnion.AsAny().(type) {
+// case openai.BetaEasyInputMessage:
+// case openai.BetaResponseInputItemMessage:
+// case openai.BetaResponseOutputMessage:
+// case openai.BetaResponseFileSearchToolCall:
+// case openai.BetaResponseComputerToolCall:
+// case openai.BetaResponseInputItemComputerCallOutput:
+// case openai.BetaResponseFunctionWebSearch:
+// case openai.BetaResponseFunctionToolCall:
+// case openai.BetaResponseInputItemFunctionCallOutput:
+// case openai.BetaResponseInputItemAgentMessage:
+// case openai.BetaResponseInputItemMultiAgentCall:
+// case openai.BetaResponseInputItemMultiAgentCallOutput:
+// case openai.BetaResponseInputItemToolSearchCall:
+// case openai.BetaResponseToolSearchOutputItemParamResp:
+// case openai.BetaResponseInputItemAdditionalTools:
+// case openai.BetaResponseReasoningItem:
+// case openai.BetaResponseCompactionItemParamResp:
+// case openai.BetaResponseInputItemImageGenerationCall:
+// case openai.BetaResponseCodeInterpreterToolCall:
+// case openai.BetaResponseInputItemLocalShellCall:
+// case openai.BetaResponseInputItemLocalShellCallOutput:
+// case openai.BetaResponseInputItemShellCall:
+// case openai.BetaResponseInputItemShellCallOutput:
+// case openai.BetaResponseInputItemApplyPatchCall:
+// case openai.BetaResponseInputItemApplyPatchCallOutput:
+// case openai.BetaResponseInputItemMcpListTools:
+// case openai.BetaResponseInputItemMcpApprovalRequest:
+// case openai.BetaResponseInputItemMcpApprovalResponse:
+// case openai.BetaResponseInputItemMcpCall:
+// case openai.BetaResponseCustomToolCallOutput:
+// case openai.BetaResponseCustomToolCall:
+// case openai.BetaResponseInputItemCompactionTrigger:
+// case openai.BetaResponseInputItemItemReference:
+// case openai.BetaResponseInputItemProgram:
+// case openai.BetaResponseInputItemProgramOutput:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseInputItemUnion) AsAny() anyBetaResponseInputItem {
+ switch u.Type {
+ case "message":
+ return u.AsOutputMessage()
+ case "file_search_call":
+ return u.AsFileSearchCall()
+ case "computer_call":
+ return u.AsComputerCall()
+ case "computer_call_output":
+ return u.AsComputerCallOutput()
+ case "web_search_call":
+ return u.AsWebSearchCall()
+ case "function_call":
+ return u.AsFunctionCall()
+ case "function_call_output":
+ return u.AsFunctionCallOutput()
+ case "agent_message":
+ return u.AsAgentMessage()
+ case "multi_agent_call":
+ return u.AsMultiAgentCall()
+ case "multi_agent_call_output":
+ return u.AsMultiAgentCallOutput()
+ case "tool_search_call":
+ return u.AsToolSearchCall()
+ case "tool_search_output":
+ return u.AsToolSearchOutput()
+ case "additional_tools":
+ return u.AsAdditionalTools()
+ case "reasoning":
+ return u.AsReasoning()
+ case "compaction":
+ return u.AsCompaction()
+ case "image_generation_call":
+ return u.AsImageGenerationCall()
+ case "code_interpreter_call":
+ return u.AsCodeInterpreterCall()
+ case "local_shell_call":
+ return u.AsLocalShellCall()
+ case "local_shell_call_output":
+ return u.AsLocalShellCallOutput()
+ case "shell_call":
+ return u.AsShellCall()
+ case "shell_call_output":
+ return u.AsShellCallOutput()
+ case "apply_patch_call":
+ return u.AsApplyPatchCall()
+ case "apply_patch_call_output":
+ return u.AsApplyPatchCallOutput()
+ case "mcp_list_tools":
+ return u.AsMcpListTools()
+ case "mcp_approval_request":
+ return u.AsMcpApprovalRequest()
+ case "mcp_approval_response":
+ return u.AsMcpApprovalResponse()
+ case "mcp_call":
+ return u.AsMcpCall()
+ case "custom_tool_call_output":
+ return u.AsCustomToolCallOutput()
+ case "custom_tool_call":
+ return u.AsCustomToolCall()
+ case "compaction_trigger":
+ return u.AsCompactionTrigger()
+ case "item_reference":
+ return u.AsItemReference()
+ case "program":
+ return u.AsProgram()
+ case "program_output":
+ return u.AsProgramOutput()
+ }
+ return nil
+}
+
+func (u BetaResponseInputItemUnion) AsMessage() (v BetaEasyInputMessage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsInputMessage() (v BetaResponseInputItemMessage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsOutputMessage() (v BetaResponseOutputMessage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsFileSearchCall() (v BetaResponseFileSearchToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsComputerCall() (v BetaResponseComputerToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsComputerCallOutput() (v BetaResponseInputItemComputerCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsWebSearchCall() (v BetaResponseFunctionWebSearch) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsFunctionCall() (v BetaResponseFunctionToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsFunctionCallOutput() (v BetaResponseInputItemFunctionCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsAgentMessage() (v BetaResponseInputItemAgentMessage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsMultiAgentCall() (v BetaResponseInputItemMultiAgentCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsMultiAgentCallOutput() (v BetaResponseInputItemMultiAgentCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsToolSearchCall() (v BetaResponseInputItemToolSearchCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsToolSearchOutput() (v BetaResponseToolSearchOutputItemParamResp) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsAdditionalTools() (v BetaResponseInputItemAdditionalTools) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsReasoning() (v BetaResponseReasoningItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsCompaction() (v BetaResponseCompactionItemParamResp) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsImageGenerationCall() (v BetaResponseInputItemImageGenerationCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsCodeInterpreterCall() (v BetaResponseCodeInterpreterToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsLocalShellCall() (v BetaResponseInputItemLocalShellCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsLocalShellCallOutput() (v BetaResponseInputItemLocalShellCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsShellCall() (v BetaResponseInputItemShellCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsShellCallOutput() (v BetaResponseInputItemShellCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsApplyPatchCall() (v BetaResponseInputItemApplyPatchCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsApplyPatchCallOutput() (v BetaResponseInputItemApplyPatchCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsMcpListTools() (v BetaResponseInputItemMcpListTools) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsMcpApprovalRequest() (v BetaResponseInputItemMcpApprovalRequest) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsMcpApprovalResponse() (v BetaResponseInputItemMcpApprovalResponse) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsMcpCall() (v BetaResponseInputItemMcpCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsCustomToolCallOutput() (v BetaResponseCustomToolCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsCustomToolCall() (v BetaResponseCustomToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsCompactionTrigger() (v BetaResponseInputItemCompactionTrigger) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsItemReference() (v BetaResponseInputItemItemReference) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsProgram() (v BetaResponseInputItemProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemUnion) AsProgramOutput() (v BetaResponseInputItemProgramOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseInputItemUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseInputItemUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInputItemUnionContent is an implicit subunion of
+// [BetaResponseInputItemUnion]. BetaResponseInputItemUnionContent provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseInputItemUnion].
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString OfInputItemContentList
+// OfBetaResponseOutputMessageContentArray
+// OfBetaResponseInputItemAgentMessageContentArray
+// OfBetaResponseReasoningItemContentArray]
+type BetaResponseInputItemUnionContent struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a
+ // [BetaResponseInputMessageContentList] instead of an object.
+ OfInputItemContentList BetaResponseInputMessageContentList `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseOutputMessageContentUnion] instead of an object.
+ OfBetaResponseOutputMessageContentArray []BetaResponseOutputMessageContentUnion `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseInputItemAgentMessageContentUnion] instead of an object.
+ OfBetaResponseInputItemAgentMessageContentArray []BetaResponseInputItemAgentMessageContentUnion `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseReasoningItemContent] instead of an object.
+ OfBetaResponseReasoningItemContentArray []BetaResponseReasoningItemContent `json:",inline"`
+ JSON struct {
+ OfString respjson.Field
+ OfInputItemContentList respjson.Field
+ OfBetaResponseOutputMessageContentArray respjson.Field
+ OfBetaResponseInputItemAgentMessageContentArray respjson.Field
+ OfBetaResponseReasoningItemContentArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseInputItemUnionContent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInputItemUnionAgent is an implicit subunion of
+// [BetaResponseInputItemUnion]. BetaResponseInputItemUnionAgent provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseInputItemUnion].
+type BetaResponseInputItemUnionAgent struct {
+ AgentName string `json:"agent_name"`
+ JSON struct {
+ AgentName respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseInputItemUnionAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInputItemUnionAction is an implicit subunion of
+// [BetaResponseInputItemUnion]. BetaResponseInputItemUnionAction provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseInputItemUnion].
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfBetaResponseInputItemMultiAgentCallOutputAction]
+type BetaResponseInputItemUnionAction struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfBetaResponseInputItemMultiAgentCallOutputAction string `json:",inline"`
+ // This field is from variant [BetaComputerActionUnion].
+ Button string `json:"button"`
+ Type string `json:"type"`
+ X int64 `json:"x"`
+ Y int64 `json:"y"`
+ Keys []string `json:"keys"`
+ // This field is from variant [BetaComputerActionUnion].
+ Path []BetaComputerActionDragPath `json:"path"`
+ // This field is from variant [BetaComputerActionUnion].
+ ScrollX int64 `json:"scroll_x"`
+ // This field is from variant [BetaComputerActionUnion].
+ ScrollY int64 `json:"scroll_y"`
+ // This field is from variant [BetaComputerActionUnion].
+ Text string `json:"text"`
+ // This field is from variant [BetaResponseFunctionWebSearchActionUnion].
+ Queries []string `json:"queries"`
+ // This field is from variant [BetaResponseFunctionWebSearchActionUnion].
+ Query string `json:"query"`
+ // This field is from variant [BetaResponseFunctionWebSearchActionUnion].
+ Sources []BetaResponseFunctionWebSearchActionSearchSource `json:"sources"`
+ URL string `json:"url"`
+ // This field is from variant [BetaResponseFunctionWebSearchActionUnion].
+ Pattern string `json:"pattern"`
+ // This field is from variant [BetaResponseInputItemLocalShellCallAction].
+ Command []string `json:"command"`
+ // This field is from variant [BetaResponseInputItemLocalShellCallAction].
+ Env map[string]string `json:"env"`
+ TimeoutMs int64 `json:"timeout_ms"`
+ // This field is from variant [BetaResponseInputItemLocalShellCallAction].
+ User string `json:"user"`
+ // This field is from variant [BetaResponseInputItemLocalShellCallAction].
+ WorkingDirectory string `json:"working_directory"`
+ // This field is from variant [BetaResponseInputItemShellCallAction].
+ Commands []string `json:"commands"`
+ // This field is from variant [BetaResponseInputItemShellCallAction].
+ MaxOutputLength int64 `json:"max_output_length"`
+ JSON struct {
+ OfBetaResponseInputItemMultiAgentCallOutputAction respjson.Field
+ Button respjson.Field
+ Type respjson.Field
+ X respjson.Field
+ Y respjson.Field
+ Keys respjson.Field
+ Path respjson.Field
+ ScrollX respjson.Field
+ ScrollY respjson.Field
+ Text respjson.Field
+ Queries respjson.Field
+ Query respjson.Field
+ Sources respjson.Field
+ URL respjson.Field
+ Pattern respjson.Field
+ Command respjson.Field
+ Env respjson.Field
+ TimeoutMs respjson.Field
+ User respjson.Field
+ WorkingDirectory respjson.Field
+ Commands respjson.Field
+ MaxOutputLength respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseInputItemUnionAction) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInputItemUnionOutput is an implicit subunion of
+// [BetaResponseInputItemUnion]. BetaResponseInputItemUnionOutput provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseInputItemUnion].
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString OfBetaResponseFunctionCallOutputItemArray
+// OfBetaResponseInputItemMultiAgentCallOutputOutputArray
+// OfBetaResponseFunctionShellCallOutputContentArray OfOutputContentList]
+type BetaResponseInputItemUnionOutput struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a
+ // [BetaResponseFunctionCallOutputItemList] instead of an object.
+ OfBetaResponseFunctionCallOutputItemArray BetaResponseFunctionCallOutputItemList `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseInputItemMultiAgentCallOutputOutput] instead of an object.
+ OfBetaResponseInputItemMultiAgentCallOutputOutputArray []BetaResponseInputItemMultiAgentCallOutputOutput `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseFunctionShellCallOutputContent] instead of an object.
+ OfBetaResponseFunctionShellCallOutputContentArray []BetaResponseFunctionShellCallOutputContent `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion] instead of
+ // an object.
+ OfOutputContentList []BetaResponseCustomToolCallOutputOutputOutputContentListItemUnion `json:",inline"`
+ // This field is from variant [BetaResponseComputerToolCallOutputScreenshot].
+ Type constant.ComputerScreenshot `json:"type"`
+ // This field is from variant [BetaResponseComputerToolCallOutputScreenshot].
+ FileID string `json:"file_id"`
+ // This field is from variant [BetaResponseComputerToolCallOutputScreenshot].
+ ImageURL string `json:"image_url"`
+ JSON struct {
+ OfString respjson.Field
+ OfBetaResponseFunctionCallOutputItemArray respjson.Field
+ OfBetaResponseInputItemMultiAgentCallOutputOutputArray respjson.Field
+ OfBetaResponseFunctionShellCallOutputContentArray respjson.Field
+ OfOutputContentList respjson.Field
+ Type respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseInputItemUnionOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInputItemUnionArguments is an implicit subunion of
+// [BetaResponseInputItemUnion]. BetaResponseInputItemUnionArguments provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseInputItemUnion].
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString OfBetaResponseInputItemToolSearchCallArguments]
+type BetaResponseInputItemUnionArguments struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [any] instead of an object.
+ OfBetaResponseInputItemToolSearchCallArguments any `json:",inline"`
+ JSON struct {
+ OfString respjson.Field
+ OfBetaResponseInputItemToolSearchCallArguments respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseInputItemUnionArguments) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInputItemUnionCaller is an implicit subunion of
+// [BetaResponseInputItemUnion]. BetaResponseInputItemUnionCaller provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseInputItemUnion].
+type BetaResponseInputItemUnionCaller struct {
+ Type string `json:"type"`
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseInputItemUnionCaller) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInputItemUnionTools is an implicit subunion of
+// [BetaResponseInputItemUnion]. BetaResponseInputItemUnionTools provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseInputItemUnion].
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfBetaToolArray OfBetaResponseInputItemMcpListToolsTools]
+type BetaResponseInputItemUnionTools struct {
+ // This field will be present if the value is a [[]BetaToolUnion] instead of an
+ // object.
+ OfBetaToolArray []BetaToolUnion `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseInputItemMcpListToolsTool] instead of an object.
+ OfBetaResponseInputItemMcpListToolsTools []BetaResponseInputItemMcpListToolsTool `json:",inline"`
+ JSON struct {
+ OfBetaToolArray respjson.Field
+ OfBetaResponseInputItemMcpListToolsTools respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseInputItemUnionTools) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseInputItemUnion to a
+// BetaResponseInputItemUnionParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseInputItemUnionParam.Overrides()
+func (r BetaResponseInputItemUnion) ToParam() BetaResponseInputItemUnionParam {
+ return param.Override[BetaResponseInputItemUnionParam](json.RawMessage(r.RawJSON()))
+}
+
+// A message input to the model with a role indicating instruction following
+// hierarchy. Instructions given with the `developer` or `system` role take
+// precedence over instructions given with the `user` role.
+type BetaResponseInputItemMessage struct {
+ // A list of one or many input items to the model, containing different content
+ // types.
+ Content BetaResponseInputMessageContentList `json:"content" api:"required"`
+ // The role of the message input. One of `user`, `system`, or `developer`.
+ //
+ // Any of "user", "system", "developer".
+ Role string `json:"role" api:"required"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemMessageAgent `json:"agent" api:"nullable"`
+ // The status of item. One of `in_progress`, `completed`, or `incomplete`.
+ // Populated when items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status"`
+ // The type of the message input. Always set to `message`.
+ //
+ // Any of "message".
+ Type string `json:"type"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Content respjson.Field
+ Role respjson.Field
+ Agent respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemMessage) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemMessage) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemMessageAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemMessageAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemMessageAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The output of a computer tool call.
+type BetaResponseInputItemComputerCallOutput struct {
+ // The ID of the computer tool call that produced the output.
+ CallID string `json:"call_id" api:"required"`
+ // A computer screenshot image used with the computer use tool.
+ Output BetaResponseComputerToolCallOutputScreenshot `json:"output" api:"required"`
+ // The type of the computer tool call output. Always `computer_call_output`.
+ Type constant.ComputerCallOutput `json:"type" default:"computer_call_output"`
+ // The ID of the computer tool call output.
+ ID string `json:"id" api:"nullable"`
+ // The safety checks reported by the API that have been acknowledged by the
+ // developer.
+ AcknowledgedSafetyChecks []BetaResponseInputItemComputerCallOutputAcknowledgedSafetyCheck `json:"acknowledged_safety_checks" api:"nullable"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemComputerCallOutputAgent `json:"agent" api:"nullable"`
+ // The status of the message input. One of `in_progress`, `completed`, or
+ // `incomplete`. Populated when input items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallID respjson.Field
+ Output respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ AcknowledgedSafetyChecks respjson.Field
+ Agent respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemComputerCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemComputerCallOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A pending safety check for the computer call.
+type BetaResponseInputItemComputerCallOutputAcknowledgedSafetyCheck struct {
+ // The ID of the pending safety check.
+ ID string `json:"id" api:"required"`
+ // The type of the pending safety check.
+ Code string `json:"code" api:"nullable"`
+ // Details about the pending safety check.
+ Message string `json:"message" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Code respjson.Field
+ Message respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemComputerCallOutputAcknowledgedSafetyCheck) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *BetaResponseInputItemComputerCallOutputAcknowledgedSafetyCheck) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemComputerCallOutputAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemComputerCallOutputAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemComputerCallOutputAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The output of a function tool call.
+type BetaResponseInputItemFunctionCallOutput struct {
+ // The unique ID of the function tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // Text, image, or file output of the function tool call.
+ Output BetaResponseInputItemFunctionCallOutputOutputUnion `json:"output" api:"required"`
+ // The type of the function tool call output. Always `function_call_output`.
+ Type constant.FunctionCallOutput `json:"type" default:"function_call_output"`
+ // The unique ID of the function tool call output. Populated when this item is
+ // returned via API.
+ ID string `json:"id" api:"nullable"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemFunctionCallOutputAgent `json:"agent" api:"nullable"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseInputItemFunctionCallOutputCallerUnion `json:"caller" api:"nullable"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ // Populated when items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallID respjson.Field
+ Output respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Agent respjson.Field
+ Caller respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemFunctionCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemFunctionCallOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInputItemFunctionCallOutputOutputUnion contains all possible
+// properties and values from [string], [BetaResponseFunctionCallOutputItemList].
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString OfBetaResponseFunctionCallOutputItemArray]
+type BetaResponseInputItemFunctionCallOutputOutputUnion struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a
+ // [BetaResponseFunctionCallOutputItemList] instead of an object.
+ OfBetaResponseFunctionCallOutputItemArray BetaResponseFunctionCallOutputItemList `json:",inline"`
+ JSON struct {
+ OfString respjson.Field
+ OfBetaResponseFunctionCallOutputItemArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u BetaResponseInputItemFunctionCallOutputOutputUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemFunctionCallOutputOutputUnion) AsBetaResponseFunctionCallOutputItemArray() (v BetaResponseFunctionCallOutputItemList) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseInputItemFunctionCallOutputOutputUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseInputItemFunctionCallOutputOutputUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemFunctionCallOutputAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemFunctionCallOutputAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemFunctionCallOutputAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInputItemFunctionCallOutputCallerUnion contains all possible
+// properties and values from
+// [BetaResponseInputItemFunctionCallOutputCallerDirect],
+// [BetaResponseInputItemFunctionCallOutputCallerProgram].
+//
+// Use the [BetaResponseInputItemFunctionCallOutputCallerUnion.AsAny] method to
+// switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseInputItemFunctionCallOutputCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant
+ // [BetaResponseInputItemFunctionCallOutputCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseInputItemFunctionCallOutputCaller is implemented by each variant
+// of [BetaResponseInputItemFunctionCallOutputCallerUnion] to add type safety for
+// the return type of [BetaResponseInputItemFunctionCallOutputCallerUnion.AsAny]
+type anyBetaResponseInputItemFunctionCallOutputCaller interface {
+ implBetaResponseInputItemFunctionCallOutputCallerUnion()
+}
+
+func (BetaResponseInputItemFunctionCallOutputCallerDirect) implBetaResponseInputItemFunctionCallOutputCallerUnion() {
+}
+func (BetaResponseInputItemFunctionCallOutputCallerProgram) implBetaResponseInputItemFunctionCallOutputCallerUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseInputItemFunctionCallOutputCallerUnion.AsAny().(type) {
+// case openai.BetaResponseInputItemFunctionCallOutputCallerDirect:
+// case openai.BetaResponseInputItemFunctionCallOutputCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseInputItemFunctionCallOutputCallerUnion) AsAny() anyBetaResponseInputItemFunctionCallOutputCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u BetaResponseInputItemFunctionCallOutputCallerUnion) AsDirect() (v BetaResponseInputItemFunctionCallOutputCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemFunctionCallOutputCallerUnion) AsProgram() (v BetaResponseInputItemFunctionCallOutputCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseInputItemFunctionCallOutputCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseInputItemFunctionCallOutputCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemFunctionCallOutputCallerDirect struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemFunctionCallOutputCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemFunctionCallOutputCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemFunctionCallOutputCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemFunctionCallOutputCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemFunctionCallOutputCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A message routed between agents.
+type BetaResponseInputItemAgentMessage struct {
+ // The sending agent identity.
+ Author string `json:"author" api:"required"`
+ // Plaintext, image, or encrypted content sent between agents.
+ Content []BetaResponseInputItemAgentMessageContentUnion `json:"content" api:"required"`
+ // The destination agent identity.
+ Recipient string `json:"recipient" api:"required"`
+ // The item type. Always `agent_message`.
+ Type constant.AgentMessage `json:"type" default:"agent_message"`
+ // The unique ID of this agent message item.
+ ID string `json:"id" api:"nullable"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemAgentMessageAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Author respjson.Field
+ Content respjson.Field
+ Recipient respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemAgentMessage) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemAgentMessage) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInputItemAgentMessageContentUnion contains all possible properties
+// and values from [BetaResponseInputTextContent], [BetaResponseInputImageContent],
+// [BetaResponseInputItemAgentMessageContentEncryptedContent].
+//
+// Use the [BetaResponseInputItemAgentMessageContentUnion.AsAny] method to switch
+// on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseInputItemAgentMessageContentUnion struct {
+ // This field is from variant [BetaResponseInputTextContent].
+ Text string `json:"text"`
+ // Any of "input_text", "input_image", "encrypted_content".
+ Type string `json:"type"`
+ // This field is a union of [BetaResponseInputTextContentPromptCacheBreakpoint],
+ // [BetaResponseInputImageContentPromptCacheBreakpoint]
+ PromptCacheBreakpoint BetaResponseInputItemAgentMessageContentUnionPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
+ // This field is from variant [BetaResponseInputImageContent].
+ Detail BetaResponseInputImageContentDetail `json:"detail"`
+ // This field is from variant [BetaResponseInputImageContent].
+ FileID string `json:"file_id"`
+ // This field is from variant [BetaResponseInputImageContent].
+ ImageURL string `json:"image_url"`
+ // This field is from variant
+ // [BetaResponseInputItemAgentMessageContentEncryptedContent].
+ EncryptedContent string `json:"encrypted_content"`
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ Detail respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ EncryptedContent respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseInputItemAgentMessageContent is implemented by each variant of
+// [BetaResponseInputItemAgentMessageContentUnion] to add type safety for the
+// return type of [BetaResponseInputItemAgentMessageContentUnion.AsAny]
+type anyBetaResponseInputItemAgentMessageContent interface {
+ implBetaResponseInputItemAgentMessageContentUnion()
+}
+
+func (BetaResponseInputTextContent) implBetaResponseInputItemAgentMessageContentUnion() {}
+func (BetaResponseInputImageContent) implBetaResponseInputItemAgentMessageContentUnion() {}
+func (BetaResponseInputItemAgentMessageContentEncryptedContent) implBetaResponseInputItemAgentMessageContentUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseInputItemAgentMessageContentUnion.AsAny().(type) {
+// case openai.BetaResponseInputTextContent:
+// case openai.BetaResponseInputImageContent:
+// case openai.BetaResponseInputItemAgentMessageContentEncryptedContent:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseInputItemAgentMessageContentUnion) AsAny() anyBetaResponseInputItemAgentMessageContent {
+ switch u.Type {
+ case "input_text":
+ return u.AsInputText()
+ case "input_image":
+ return u.AsInputImage()
+ case "encrypted_content":
+ return u.AsEncryptedContent()
+ }
+ return nil
+}
+
+func (u BetaResponseInputItemAgentMessageContentUnion) AsInputText() (v BetaResponseInputTextContent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemAgentMessageContentUnion) AsInputImage() (v BetaResponseInputImageContent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemAgentMessageContentUnion) AsEncryptedContent() (v BetaResponseInputItemAgentMessageContentEncryptedContent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseInputItemAgentMessageContentUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseInputItemAgentMessageContentUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInputItemAgentMessageContentUnionPromptCacheBreakpoint is an
+// implicit subunion of [BetaResponseInputItemAgentMessageContentUnion].
+// BetaResponseInputItemAgentMessageContentUnionPromptCacheBreakpoint provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseInputItemAgentMessageContentUnion].
+type BetaResponseInputItemAgentMessageContentUnionPromptCacheBreakpoint struct {
+ // This field is from variant [BetaResponseInputTextContentPromptCacheBreakpoint].
+ Mode constant.Explicit `json:"mode"`
+ JSON struct {
+ Mode respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseInputItemAgentMessageContentUnionPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Opaque encrypted content that Responses API decrypts inside trusted model
+// execution.
+type BetaResponseInputItemAgentMessageContentEncryptedContent struct {
+ // Opaque encrypted content.
+ EncryptedContent string `json:"encrypted_content" api:"required"`
+ // The type of the input item. Always `encrypted_content`.
+ Type constant.EncryptedContent `json:"type" default:"encrypted_content"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ EncryptedContent respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemAgentMessageContentEncryptedContent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemAgentMessageContentEncryptedContent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemAgentMessageAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemAgentMessageAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemAgentMessageAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemMultiAgentCall struct {
+ // The multi-agent action that was executed.
+ //
+ // Any of "spawn_agent", "interrupt_agent", "list_agents", "send_message",
+ // "followup_task", "wait_agent".
+ Action string `json:"action" api:"required"`
+ // The action arguments as a JSON string.
+ Arguments string `json:"arguments" api:"required"`
+ // The unique ID linking this call to its output.
+ CallID string `json:"call_id" api:"required"`
+ // The item type. Always `multi_agent_call`.
+ Type constant.MultiAgentCall `json:"type" default:"multi_agent_call"`
+ // The unique ID of this multi-agent call.
+ ID string `json:"id" api:"nullable"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemMultiAgentCallAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Action respjson.Field
+ Arguments respjson.Field
+ CallID respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemMultiAgentCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemMultiAgentCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemMultiAgentCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemMultiAgentCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemMultiAgentCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemMultiAgentCallOutput struct {
+ // The multi-agent action that produced this result.
+ //
+ // Any of "spawn_agent", "interrupt_agent", "list_agents", "send_message",
+ // "followup_task", "wait_agent".
+ Action string `json:"action" api:"required"`
+ // The unique ID of the multi-agent call.
+ CallID string `json:"call_id" api:"required"`
+ // Text output returned by the multi-agent action.
+ Output []BetaResponseInputItemMultiAgentCallOutputOutput `json:"output" api:"required"`
+ // The item type. Always `multi_agent_call_output`.
+ Type constant.MultiAgentCallOutput `json:"type" default:"multi_agent_call_output"`
+ // The unique ID of this multi-agent call output.
+ ID string `json:"id" api:"nullable"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemMultiAgentCallOutputAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Action respjson.Field
+ CallID respjson.Field
+ Output respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemMultiAgentCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemMultiAgentCallOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemMultiAgentCallOutputOutput struct {
+ // The text content.
+ Text string `json:"text" api:"required"`
+ // The content type. Always `output_text`.
+ Type constant.OutputText `json:"type" default:"output_text"`
+ // Citations associated with the text content.
+ Annotations []BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnion `json:"annotations"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ Annotations respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemMultiAgentCallOutputOutput) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemMultiAgentCallOutputOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnion contains all
+// possible properties and values from
+// [BetaResponseInputItemMultiAgentCallOutputOutputAnnotationFileCitation],
+// [BetaResponseInputItemMultiAgentCallOutputOutputAnnotationURLCitation],
+// [BetaResponseInputItemMultiAgentCallOutputOutputAnnotationContainerFileCitation].
+//
+// Use the [BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnion.AsAny]
+// method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnion struct {
+ FileID string `json:"file_id"`
+ Filename string `json:"filename"`
+ // This field is from variant
+ // [BetaResponseInputItemMultiAgentCallOutputOutputAnnotationFileCitation].
+ Index int64 `json:"index"`
+ // Any of "file_citation", "url_citation", "container_file_citation".
+ Type string `json:"type"`
+ EndIndex int64 `json:"end_index"`
+ StartIndex int64 `json:"start_index"`
+ // This field is from variant
+ // [BetaResponseInputItemMultiAgentCallOutputOutputAnnotationURLCitation].
+ Title string `json:"title"`
+ // This field is from variant
+ // [BetaResponseInputItemMultiAgentCallOutputOutputAnnotationURLCitation].
+ URL string `json:"url"`
+ // This field is from variant
+ // [BetaResponseInputItemMultiAgentCallOutputOutputAnnotationContainerFileCitation].
+ ContainerID string `json:"container_id"`
+ JSON struct {
+ FileID respjson.Field
+ Filename respjson.Field
+ Index respjson.Field
+ Type respjson.Field
+ EndIndex respjson.Field
+ StartIndex respjson.Field
+ Title respjson.Field
+ URL respjson.Field
+ ContainerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseInputItemMultiAgentCallOutputOutputAnnotation is implemented by
+// each variant of [BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnion]
+// to add type safety for the return type of
+// [BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnion.AsAny]
+type anyBetaResponseInputItemMultiAgentCallOutputOutputAnnotation interface {
+ implBetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnion()
+}
+
+func (BetaResponseInputItemMultiAgentCallOutputOutputAnnotationFileCitation) implBetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnion() {
+}
+func (BetaResponseInputItemMultiAgentCallOutputOutputAnnotationURLCitation) implBetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnion() {
+}
+func (BetaResponseInputItemMultiAgentCallOutputOutputAnnotationContainerFileCitation) implBetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnion.AsAny().(type) {
+// case openai.BetaResponseInputItemMultiAgentCallOutputOutputAnnotationFileCitation:
+// case openai.BetaResponseInputItemMultiAgentCallOutputOutputAnnotationURLCitation:
+// case openai.BetaResponseInputItemMultiAgentCallOutputOutputAnnotationContainerFileCitation:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnion) AsAny() anyBetaResponseInputItemMultiAgentCallOutputOutputAnnotation {
+ switch u.Type {
+ case "file_citation":
+ return u.AsFileCitation()
+ case "url_citation":
+ return u.AsURLCitation()
+ case "container_file_citation":
+ return u.AsContainerFileCitation()
+ }
+ return nil
+}
+
+func (u BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnion) AsFileCitation() (v BetaResponseInputItemMultiAgentCallOutputOutputAnnotationFileCitation) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnion) AsURLCitation() (v BetaResponseInputItemMultiAgentCallOutputOutputAnnotationURLCitation) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnion) AsContainerFileCitation() (v BetaResponseInputItemMultiAgentCallOutputOutputAnnotationContainerFileCitation) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnion) RawJSON() string {
+ return u.JSON.raw
+}
+
+func (r *BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemMultiAgentCallOutputOutputAnnotationFileCitation struct {
+ // The ID of the file.
+ FileID string `json:"file_id" api:"required"`
+ // The filename of the file cited.
+ Filename string `json:"filename" api:"required"`
+ // The index of the file in the list of files.
+ Index int64 `json:"index" api:"required"`
+ // The citation type. Always `file_citation`.
+ Type constant.FileCitation `json:"type" default:"file_citation"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ FileID respjson.Field
+ Filename respjson.Field
+ Index respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemMultiAgentCallOutputOutputAnnotationFileCitation) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *BetaResponseInputItemMultiAgentCallOutputOutputAnnotationFileCitation) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemMultiAgentCallOutputOutputAnnotationURLCitation struct {
+ // The index of the last character of the citation in the message.
+ EndIndex int64 `json:"end_index" api:"required"`
+ // The index of the first character of the citation in the message.
+ StartIndex int64 `json:"start_index" api:"required"`
+ // The title of the cited resource.
+ Title string `json:"title" api:"required"`
+ // The citation type. Always `url_citation`.
+ Type constant.URLCitation `json:"type" default:"url_citation"`
+ // The URL of the cited resource.
+ URL string `json:"url" api:"required" format:"uri"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ EndIndex respjson.Field
+ StartIndex respjson.Field
+ Title respjson.Field
+ Type respjson.Field
+ URL respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemMultiAgentCallOutputOutputAnnotationURLCitation) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *BetaResponseInputItemMultiAgentCallOutputOutputAnnotationURLCitation) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemMultiAgentCallOutputOutputAnnotationContainerFileCitation struct {
+ // The ID of the container.
+ ContainerID string `json:"container_id" api:"required"`
+ // The index of the last character of the citation in the message.
+ EndIndex int64 `json:"end_index" api:"required"`
+ // The ID of the container file.
+ FileID string `json:"file_id" api:"required"`
+ // The filename of the container file cited.
+ Filename string `json:"filename" api:"required"`
+ // The index of the first character of the citation in the message.
+ StartIndex int64 `json:"start_index" api:"required"`
+ // The citation type. Always `container_file_citation`.
+ Type constant.ContainerFileCitation `json:"type" default:"container_file_citation"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ContainerID respjson.Field
+ EndIndex respjson.Field
+ FileID respjson.Field
+ Filename respjson.Field
+ StartIndex respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemMultiAgentCallOutputOutputAnnotationContainerFileCitation) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *BetaResponseInputItemMultiAgentCallOutputOutputAnnotationContainerFileCitation) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemMultiAgentCallOutputAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemMultiAgentCallOutputAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemMultiAgentCallOutputAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemToolSearchCall struct {
+ // The arguments supplied to the tool search call.
+ Arguments any `json:"arguments" api:"required"`
+ // The item type. Always `tool_search_call`.
+ Type constant.ToolSearchCall `json:"type" default:"tool_search_call"`
+ // The unique ID of this tool search call.
+ ID string `json:"id" api:"nullable"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemToolSearchCallAgent `json:"agent" api:"nullable"`
+ // The unique ID of the tool search call generated by the model.
+ CallID string `json:"call_id" api:"nullable"`
+ // Whether tool search was executed by the server or by the client.
+ //
+ // Any of "server", "client".
+ Execution string `json:"execution"`
+ // The status of the tool search call.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Arguments respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Agent respjson.Field
+ CallID respjson.Field
+ Execution respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemToolSearchCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemToolSearchCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemToolSearchCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemToolSearchCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemToolSearchCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemAdditionalTools struct {
+ // The role that provided the additional tools. Only `developer` is supported.
+ Role constant.Developer `json:"role" default:"developer"`
+ // A list of additional tools made available at this item.
+ Tools []BetaToolUnion `json:"tools" api:"required"`
+ // The item type. Always `additional_tools`.
+ Type constant.AdditionalTools `json:"type" default:"additional_tools"`
+ // The unique ID of this additional tools item.
+ ID string `json:"id" api:"nullable"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemAdditionalToolsAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Role respjson.Field
+ Tools respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemAdditionalTools) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemAdditionalTools) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemAdditionalToolsAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemAdditionalToolsAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemAdditionalToolsAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An image generation request made by the model.
+type BetaResponseInputItemImageGenerationCall struct {
+ // The unique ID of the image generation call.
+ ID string `json:"id" api:"required"`
+ // The generated image encoded in base64.
+ Result string `json:"result" api:"required"`
+ // The status of the image generation call.
+ //
+ // Any of "in_progress", "completed", "generating", "failed".
+ Status string `json:"status" api:"required"`
+ // The type of the image generation call. Always `image_generation_call`.
+ Type constant.ImageGenerationCall `json:"type" default:"image_generation_call"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemImageGenerationCallAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Result respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemImageGenerationCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemImageGenerationCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemImageGenerationCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemImageGenerationCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemImageGenerationCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool call to run a command on the local shell.
+type BetaResponseInputItemLocalShellCall struct {
+ // The unique ID of the local shell call.
+ ID string `json:"id" api:"required"`
+ // Execute a shell command on the server.
+ Action BetaResponseInputItemLocalShellCallAction `json:"action" api:"required"`
+ // The unique ID of the local shell tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // The status of the local shell call.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status" api:"required"`
+ // The type of the local shell call. Always `local_shell_call`.
+ Type constant.LocalShellCall `json:"type" default:"local_shell_call"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemLocalShellCallAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Action respjson.Field
+ CallID respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemLocalShellCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemLocalShellCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Execute a shell command on the server.
+type BetaResponseInputItemLocalShellCallAction struct {
+ // The command to run.
+ Command []string `json:"command" api:"required"`
+ // Environment variables to set for the command.
+ Env map[string]string `json:"env" api:"required"`
+ // The type of the local shell action. Always `exec`.
+ Type constant.Exec `json:"type" default:"exec"`
+ // Optional timeout in milliseconds for the command.
+ TimeoutMs int64 `json:"timeout_ms" api:"nullable"`
+ // Optional user to run the command as.
+ User string `json:"user" api:"nullable"`
+ // Optional working directory to run the command in.
+ WorkingDirectory string `json:"working_directory" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Command respjson.Field
+ Env respjson.Field
+ Type respjson.Field
+ TimeoutMs respjson.Field
+ User respjson.Field
+ WorkingDirectory respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemLocalShellCallAction) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemLocalShellCallAction) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemLocalShellCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemLocalShellCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemLocalShellCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The output of a local shell tool call.
+type BetaResponseInputItemLocalShellCallOutput struct {
+ // The unique ID of the local shell tool call generated by the model.
+ ID string `json:"id" api:"required"`
+ // A JSON string of the output of the local shell tool call.
+ Output string `json:"output" api:"required"`
+ // The type of the local shell tool call output. Always `local_shell_call_output`.
+ Type constant.LocalShellCallOutput `json:"type" default:"local_shell_call_output"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemLocalShellCallOutputAgent `json:"agent" api:"nullable"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Output respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemLocalShellCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemLocalShellCallOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemLocalShellCallOutputAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemLocalShellCallOutputAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemLocalShellCallOutputAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool representing a request to execute one or more shell commands.
+type BetaResponseInputItemShellCall struct {
+ // The shell commands and limits that describe how to run the tool call.
+ Action BetaResponseInputItemShellCallAction `json:"action" api:"required"`
+ // The unique ID of the shell tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // The type of the item. Always `shell_call`.
+ Type constant.ShellCall `json:"type" default:"shell_call"`
+ // The unique ID of the shell tool call. Populated when this item is returned via
+ // API.
+ ID string `json:"id" api:"nullable"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemShellCallAgent `json:"agent" api:"nullable"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseInputItemShellCallCallerUnion `json:"caller" api:"nullable"`
+ // The environment to execute the shell commands in.
+ Environment BetaResponseInputItemShellCallEnvironmentUnion `json:"environment" api:"nullable"`
+ // The status of the shell call. One of `in_progress`, `completed`, or
+ // `incomplete`.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Action respjson.Field
+ CallID respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Agent respjson.Field
+ Caller respjson.Field
+ Environment respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemShellCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemShellCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The shell commands and limits that describe how to run the tool call.
+type BetaResponseInputItemShellCallAction struct {
+ // Ordered shell commands for the execution environment to run.
+ Commands []string `json:"commands" api:"required"`
+ // Maximum number of UTF-8 characters to capture from combined stdout and stderr
+ // output.
+ MaxOutputLength int64 `json:"max_output_length" api:"nullable"`
+ // Maximum wall-clock time in milliseconds to allow the shell commands to run.
+ TimeoutMs int64 `json:"timeout_ms" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Commands respjson.Field
+ MaxOutputLength respjson.Field
+ TimeoutMs respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemShellCallAction) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemShellCallAction) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemShellCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemShellCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemShellCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInputItemShellCallCallerUnion contains all possible properties and
+// values from [BetaResponseInputItemShellCallCallerDirect],
+// [BetaResponseInputItemShellCallCallerProgram].
+//
+// Use the [BetaResponseInputItemShellCallCallerUnion.AsAny] method to switch on
+// the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseInputItemShellCallCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [BetaResponseInputItemShellCallCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseInputItemShellCallCaller is implemented by each variant of
+// [BetaResponseInputItemShellCallCallerUnion] to add type safety for the return
+// type of [BetaResponseInputItemShellCallCallerUnion.AsAny]
+type anyBetaResponseInputItemShellCallCaller interface {
+ implBetaResponseInputItemShellCallCallerUnion()
+}
+
+func (BetaResponseInputItemShellCallCallerDirect) implBetaResponseInputItemShellCallCallerUnion() {}
+func (BetaResponseInputItemShellCallCallerProgram) implBetaResponseInputItemShellCallCallerUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseInputItemShellCallCallerUnion.AsAny().(type) {
+// case openai.BetaResponseInputItemShellCallCallerDirect:
+// case openai.BetaResponseInputItemShellCallCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseInputItemShellCallCallerUnion) AsAny() anyBetaResponseInputItemShellCallCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u BetaResponseInputItemShellCallCallerUnion) AsDirect() (v BetaResponseInputItemShellCallCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemShellCallCallerUnion) AsProgram() (v BetaResponseInputItemShellCallCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseInputItemShellCallCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseInputItemShellCallCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemShellCallCallerDirect struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemShellCallCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemShellCallCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemShellCallCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemShellCallCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemShellCallCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInputItemShellCallEnvironmentUnion contains all possible properties
+// and values from [BetaLocalEnvironment], [BetaContainerReference].
+//
+// Use the [BetaResponseInputItemShellCallEnvironmentUnion.AsAny] method to switch
+// on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseInputItemShellCallEnvironmentUnion struct {
+ // Any of "local", "container_reference".
+ Type string `json:"type"`
+ // This field is from variant [BetaLocalEnvironment].
+ Skills []BetaLocalSkill `json:"skills"`
+ // This field is from variant [BetaContainerReference].
+ ContainerID string `json:"container_id"`
+ JSON struct {
+ Type respjson.Field
+ Skills respjson.Field
+ ContainerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseInputItemShellCallEnvironment is implemented by each variant of
+// [BetaResponseInputItemShellCallEnvironmentUnion] to add type safety for the
+// return type of [BetaResponseInputItemShellCallEnvironmentUnion.AsAny]
+type anyBetaResponseInputItemShellCallEnvironment interface {
+ implBetaResponseInputItemShellCallEnvironmentUnion()
+}
+
+func (BetaLocalEnvironment) implBetaResponseInputItemShellCallEnvironmentUnion() {}
+func (BetaContainerReference) implBetaResponseInputItemShellCallEnvironmentUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseInputItemShellCallEnvironmentUnion.AsAny().(type) {
+// case openai.BetaLocalEnvironment:
+// case openai.BetaContainerReference:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseInputItemShellCallEnvironmentUnion) AsAny() anyBetaResponseInputItemShellCallEnvironment {
+ switch u.Type {
+ case "local":
+ return u.AsLocal()
+ case "container_reference":
+ return u.AsContainerReference()
+ }
+ return nil
+}
+
+func (u BetaResponseInputItemShellCallEnvironmentUnion) AsLocal() (v BetaLocalEnvironment) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemShellCallEnvironmentUnion) AsContainerReference() (v BetaContainerReference) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseInputItemShellCallEnvironmentUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseInputItemShellCallEnvironmentUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The streamed output items emitted by a shell tool call.
+type BetaResponseInputItemShellCallOutput struct {
+ // The unique ID of the shell tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // Captured chunks of stdout and stderr output, along with their associated
+ // outcomes.
+ Output []BetaResponseFunctionShellCallOutputContent `json:"output" api:"required"`
+ // The type of the item. Always `shell_call_output`.
+ Type constant.ShellCallOutput `json:"type" default:"shell_call_output"`
+ // The unique ID of the shell tool call output. Populated when this item is
+ // returned via API.
+ ID string `json:"id" api:"nullable"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemShellCallOutputAgent `json:"agent" api:"nullable"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseInputItemShellCallOutputCallerUnion `json:"caller" api:"nullable"`
+ // The maximum number of UTF-8 characters captured for this shell call's combined
+ // output.
+ MaxOutputLength int64 `json:"max_output_length" api:"nullable"`
+ // The status of the shell call output.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallID respjson.Field
+ Output respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Agent respjson.Field
+ Caller respjson.Field
+ MaxOutputLength respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemShellCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemShellCallOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemShellCallOutputAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemShellCallOutputAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemShellCallOutputAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInputItemShellCallOutputCallerUnion contains all possible properties
+// and values from [BetaResponseInputItemShellCallOutputCallerDirect],
+// [BetaResponseInputItemShellCallOutputCallerProgram].
+//
+// Use the [BetaResponseInputItemShellCallOutputCallerUnion.AsAny] method to switch
+// on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseInputItemShellCallOutputCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [BetaResponseInputItemShellCallOutputCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseInputItemShellCallOutputCaller is implemented by each variant of
+// [BetaResponseInputItemShellCallOutputCallerUnion] to add type safety for the
+// return type of [BetaResponseInputItemShellCallOutputCallerUnion.AsAny]
+type anyBetaResponseInputItemShellCallOutputCaller interface {
+ implBetaResponseInputItemShellCallOutputCallerUnion()
+}
+
+func (BetaResponseInputItemShellCallOutputCallerDirect) implBetaResponseInputItemShellCallOutputCallerUnion() {
+}
+func (BetaResponseInputItemShellCallOutputCallerProgram) implBetaResponseInputItemShellCallOutputCallerUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseInputItemShellCallOutputCallerUnion.AsAny().(type) {
+// case openai.BetaResponseInputItemShellCallOutputCallerDirect:
+// case openai.BetaResponseInputItemShellCallOutputCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseInputItemShellCallOutputCallerUnion) AsAny() anyBetaResponseInputItemShellCallOutputCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u BetaResponseInputItemShellCallOutputCallerUnion) AsDirect() (v BetaResponseInputItemShellCallOutputCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemShellCallOutputCallerUnion) AsProgram() (v BetaResponseInputItemShellCallOutputCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseInputItemShellCallOutputCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseInputItemShellCallOutputCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemShellCallOutputCallerDirect struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemShellCallOutputCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemShellCallOutputCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemShellCallOutputCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemShellCallOutputCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemShellCallOutputCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool call representing a request to create, delete, or update files using diff
+// patches.
+type BetaResponseInputItemApplyPatchCall struct {
+ // The unique ID of the apply patch tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // The specific create, delete, or update instruction for the apply_patch tool
+ // call.
+ Operation BetaResponseInputItemApplyPatchCallOperationUnion `json:"operation" api:"required"`
+ // The status of the apply patch tool call. One of `in_progress` or `completed`.
+ //
+ // Any of "in_progress", "completed".
+ Status string `json:"status" api:"required"`
+ // The type of the item. Always `apply_patch_call`.
+ Type constant.ApplyPatchCall `json:"type" default:"apply_patch_call"`
+ // The unique ID of the apply patch tool call. Populated when this item is returned
+ // via API.
+ ID string `json:"id" api:"nullable"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemApplyPatchCallAgent `json:"agent" api:"nullable"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseInputItemApplyPatchCallCallerUnion `json:"caller" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallID respjson.Field
+ Operation respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Agent respjson.Field
+ Caller respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemApplyPatchCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemApplyPatchCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInputItemApplyPatchCallOperationUnion contains all possible
+// properties and values from
+// [BetaResponseInputItemApplyPatchCallOperationCreateFile],
+// [BetaResponseInputItemApplyPatchCallOperationDeleteFile],
+// [BetaResponseInputItemApplyPatchCallOperationUpdateFile].
+//
+// Use the [BetaResponseInputItemApplyPatchCallOperationUnion.AsAny] method to
+// switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseInputItemApplyPatchCallOperationUnion struct {
+ Diff string `json:"diff"`
+ Path string `json:"path"`
+ // Any of "create_file", "delete_file", "update_file".
+ Type string `json:"type"`
+ JSON struct {
+ Diff respjson.Field
+ Path respjson.Field
+ Type respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseInputItemApplyPatchCallOperation is implemented by each variant
+// of [BetaResponseInputItemApplyPatchCallOperationUnion] to add type safety for
+// the return type of [BetaResponseInputItemApplyPatchCallOperationUnion.AsAny]
+type anyBetaResponseInputItemApplyPatchCallOperation interface {
+ implBetaResponseInputItemApplyPatchCallOperationUnion()
+}
+
+func (BetaResponseInputItemApplyPatchCallOperationCreateFile) implBetaResponseInputItemApplyPatchCallOperationUnion() {
+}
+func (BetaResponseInputItemApplyPatchCallOperationDeleteFile) implBetaResponseInputItemApplyPatchCallOperationUnion() {
+}
+func (BetaResponseInputItemApplyPatchCallOperationUpdateFile) implBetaResponseInputItemApplyPatchCallOperationUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseInputItemApplyPatchCallOperationUnion.AsAny().(type) {
+// case openai.BetaResponseInputItemApplyPatchCallOperationCreateFile:
+// case openai.BetaResponseInputItemApplyPatchCallOperationDeleteFile:
+// case openai.BetaResponseInputItemApplyPatchCallOperationUpdateFile:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseInputItemApplyPatchCallOperationUnion) AsAny() anyBetaResponseInputItemApplyPatchCallOperation {
+ switch u.Type {
+ case "create_file":
+ return u.AsCreateFile()
+ case "delete_file":
+ return u.AsDeleteFile()
+ case "update_file":
+ return u.AsUpdateFile()
+ }
+ return nil
+}
+
+func (u BetaResponseInputItemApplyPatchCallOperationUnion) AsCreateFile() (v BetaResponseInputItemApplyPatchCallOperationCreateFile) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemApplyPatchCallOperationUnion) AsDeleteFile() (v BetaResponseInputItemApplyPatchCallOperationDeleteFile) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemApplyPatchCallOperationUnion) AsUpdateFile() (v BetaResponseInputItemApplyPatchCallOperationUpdateFile) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseInputItemApplyPatchCallOperationUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseInputItemApplyPatchCallOperationUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Instruction for creating a new file via the apply_patch tool.
+type BetaResponseInputItemApplyPatchCallOperationCreateFile struct {
+ // Unified diff content to apply when creating the file.
+ Diff string `json:"diff" api:"required"`
+ // Path of the file to create relative to the workspace root.
+ Path string `json:"path" api:"required"`
+ // The operation type. Always `create_file`.
+ Type constant.CreateFile `json:"type" default:"create_file"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Diff respjson.Field
+ Path respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemApplyPatchCallOperationCreateFile) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemApplyPatchCallOperationCreateFile) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Instruction for deleting an existing file via the apply_patch tool.
+type BetaResponseInputItemApplyPatchCallOperationDeleteFile struct {
+ // Path of the file to delete relative to the workspace root.
+ Path string `json:"path" api:"required"`
+ // The operation type. Always `delete_file`.
+ Type constant.DeleteFile `json:"type" default:"delete_file"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Path respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemApplyPatchCallOperationDeleteFile) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemApplyPatchCallOperationDeleteFile) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Instruction for updating an existing file via the apply_patch tool.
+type BetaResponseInputItemApplyPatchCallOperationUpdateFile struct {
+ // Unified diff content to apply to the existing file.
+ Diff string `json:"diff" api:"required"`
+ // Path of the file to update relative to the workspace root.
+ Path string `json:"path" api:"required"`
+ // The operation type. Always `update_file`.
+ Type constant.UpdateFile `json:"type" default:"update_file"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Diff respjson.Field
+ Path respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemApplyPatchCallOperationUpdateFile) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemApplyPatchCallOperationUpdateFile) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemApplyPatchCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemApplyPatchCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemApplyPatchCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInputItemApplyPatchCallCallerUnion contains all possible properties
+// and values from [BetaResponseInputItemApplyPatchCallCallerDirect],
+// [BetaResponseInputItemApplyPatchCallCallerProgram].
+//
+// Use the [BetaResponseInputItemApplyPatchCallCallerUnion.AsAny] method to switch
+// on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseInputItemApplyPatchCallCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [BetaResponseInputItemApplyPatchCallCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseInputItemApplyPatchCallCaller is implemented by each variant of
+// [BetaResponseInputItemApplyPatchCallCallerUnion] to add type safety for the
+// return type of [BetaResponseInputItemApplyPatchCallCallerUnion.AsAny]
+type anyBetaResponseInputItemApplyPatchCallCaller interface {
+ implBetaResponseInputItemApplyPatchCallCallerUnion()
+}
+
+func (BetaResponseInputItemApplyPatchCallCallerDirect) implBetaResponseInputItemApplyPatchCallCallerUnion() {
+}
+func (BetaResponseInputItemApplyPatchCallCallerProgram) implBetaResponseInputItemApplyPatchCallCallerUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseInputItemApplyPatchCallCallerUnion.AsAny().(type) {
+// case openai.BetaResponseInputItemApplyPatchCallCallerDirect:
+// case openai.BetaResponseInputItemApplyPatchCallCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseInputItemApplyPatchCallCallerUnion) AsAny() anyBetaResponseInputItemApplyPatchCallCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u BetaResponseInputItemApplyPatchCallCallerUnion) AsDirect() (v BetaResponseInputItemApplyPatchCallCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemApplyPatchCallCallerUnion) AsProgram() (v BetaResponseInputItemApplyPatchCallCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseInputItemApplyPatchCallCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseInputItemApplyPatchCallCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemApplyPatchCallCallerDirect struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemApplyPatchCallCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemApplyPatchCallCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemApplyPatchCallCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemApplyPatchCallCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemApplyPatchCallCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The streamed output emitted by an apply patch tool call.
+type BetaResponseInputItemApplyPatchCallOutput struct {
+ // The unique ID of the apply patch tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // The status of the apply patch tool call output. One of `completed` or `failed`.
+ //
+ // Any of "completed", "failed".
+ Status string `json:"status" api:"required"`
+ // The type of the item. Always `apply_patch_call_output`.
+ Type constant.ApplyPatchCallOutput `json:"type" default:"apply_patch_call_output"`
+ // The unique ID of the apply patch tool call output. Populated when this item is
+ // returned via API.
+ ID string `json:"id" api:"nullable"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemApplyPatchCallOutputAgent `json:"agent" api:"nullable"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseInputItemApplyPatchCallOutputCallerUnion `json:"caller" api:"nullable"`
+ // Optional human-readable log text from the apply patch tool (e.g., patch results
+ // or errors).
+ Output string `json:"output" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallID respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Agent respjson.Field
+ Caller respjson.Field
+ Output respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemApplyPatchCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemApplyPatchCallOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemApplyPatchCallOutputAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemApplyPatchCallOutputAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemApplyPatchCallOutputAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseInputItemApplyPatchCallOutputCallerUnion contains all possible
+// properties and values from
+// [BetaResponseInputItemApplyPatchCallOutputCallerDirect],
+// [BetaResponseInputItemApplyPatchCallOutputCallerProgram].
+//
+// Use the [BetaResponseInputItemApplyPatchCallOutputCallerUnion.AsAny] method to
+// switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseInputItemApplyPatchCallOutputCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant
+ // [BetaResponseInputItemApplyPatchCallOutputCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseInputItemApplyPatchCallOutputCaller is implemented by each
+// variant of [BetaResponseInputItemApplyPatchCallOutputCallerUnion] to add type
+// safety for the return type of
+// [BetaResponseInputItemApplyPatchCallOutputCallerUnion.AsAny]
+type anyBetaResponseInputItemApplyPatchCallOutputCaller interface {
+ implBetaResponseInputItemApplyPatchCallOutputCallerUnion()
+}
+
+func (BetaResponseInputItemApplyPatchCallOutputCallerDirect) implBetaResponseInputItemApplyPatchCallOutputCallerUnion() {
+}
+func (BetaResponseInputItemApplyPatchCallOutputCallerProgram) implBetaResponseInputItemApplyPatchCallOutputCallerUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseInputItemApplyPatchCallOutputCallerUnion.AsAny().(type) {
+// case openai.BetaResponseInputItemApplyPatchCallOutputCallerDirect:
+// case openai.BetaResponseInputItemApplyPatchCallOutputCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseInputItemApplyPatchCallOutputCallerUnion) AsAny() anyBetaResponseInputItemApplyPatchCallOutputCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u BetaResponseInputItemApplyPatchCallOutputCallerUnion) AsDirect() (v BetaResponseInputItemApplyPatchCallOutputCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseInputItemApplyPatchCallOutputCallerUnion) AsProgram() (v BetaResponseInputItemApplyPatchCallOutputCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseInputItemApplyPatchCallOutputCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseInputItemApplyPatchCallOutputCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemApplyPatchCallOutputCallerDirect struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemApplyPatchCallOutputCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemApplyPatchCallOutputCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemApplyPatchCallOutputCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemApplyPatchCallOutputCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemApplyPatchCallOutputCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A list of tools available on an MCP server.
+type BetaResponseInputItemMcpListTools struct {
+ // The unique ID of the list.
+ ID string `json:"id" api:"required"`
+ // The label of the MCP server.
+ ServerLabel string `json:"server_label" api:"required"`
+ // The tools available on the server.
+ Tools []BetaResponseInputItemMcpListToolsTool `json:"tools" api:"required"`
+ // The type of the item. Always `mcp_list_tools`.
+ Type constant.McpListTools `json:"type" default:"mcp_list_tools"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemMcpListToolsAgent `json:"agent" api:"nullable"`
+ // Error message if the server could not list tools.
+ Error string `json:"error" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ ServerLabel respjson.Field
+ Tools respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Error respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemMcpListTools) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemMcpListTools) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool available on an MCP server.
+type BetaResponseInputItemMcpListToolsTool struct {
+ // The JSON schema describing the tool's input.
+ InputSchema any `json:"input_schema" api:"required"`
+ // The name of the tool.
+ Name string `json:"name" api:"required"`
+ // Additional annotations about the tool.
+ Annotations any `json:"annotations" api:"nullable"`
+ // The description of the tool.
+ Description string `json:"description" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ InputSchema respjson.Field
+ Name respjson.Field
+ Annotations respjson.Field
+ Description respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemMcpListToolsTool) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemMcpListToolsTool) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemMcpListToolsAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemMcpListToolsAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemMcpListToolsAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A request for human approval of a tool invocation.
+type BetaResponseInputItemMcpApprovalRequest struct {
+ // The unique ID of the approval request.
+ ID string `json:"id" api:"required"`
+ // A JSON string of arguments for the tool.
+ Arguments string `json:"arguments" api:"required"`
+ // The name of the tool to run.
+ Name string `json:"name" api:"required"`
+ // The label of the MCP server making the request.
+ ServerLabel string `json:"server_label" api:"required"`
+ // The type of the item. Always `mcp_approval_request`.
+ Type constant.McpApprovalRequest `json:"type" default:"mcp_approval_request"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemMcpApprovalRequestAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Arguments respjson.Field
+ Name respjson.Field
+ ServerLabel respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemMcpApprovalRequest) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemMcpApprovalRequest) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemMcpApprovalRequestAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemMcpApprovalRequestAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemMcpApprovalRequestAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A response to an MCP approval request.
+type BetaResponseInputItemMcpApprovalResponse struct {
+ // The ID of the approval request being answered.
+ ApprovalRequestID string `json:"approval_request_id" api:"required"`
+ // Whether the request was approved.
+ Approve bool `json:"approve" api:"required"`
+ // The type of the item. Always `mcp_approval_response`.
+ Type constant.McpApprovalResponse `json:"type" default:"mcp_approval_response"`
+ // The unique ID of the approval response
+ ID string `json:"id" api:"nullable"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemMcpApprovalResponseAgent `json:"agent" api:"nullable"`
+ // Optional reason for the decision.
+ Reason string `json:"reason" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ApprovalRequestID respjson.Field
+ Approve respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Agent respjson.Field
+ Reason respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemMcpApprovalResponse) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemMcpApprovalResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemMcpApprovalResponseAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemMcpApprovalResponseAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemMcpApprovalResponseAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An invocation of a tool on an MCP server.
+type BetaResponseInputItemMcpCall struct {
+ // The unique ID of the tool call.
+ ID string `json:"id" api:"required"`
+ // A JSON string of the arguments passed to the tool.
+ Arguments string `json:"arguments" api:"required"`
+ // The name of the tool that was run.
+ Name string `json:"name" api:"required"`
+ // The label of the MCP server running the tool.
+ ServerLabel string `json:"server_label" api:"required"`
+ // The type of the item. Always `mcp_call`.
+ Type constant.McpCall `json:"type" default:"mcp_call"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemMcpCallAgent `json:"agent" api:"nullable"`
+ // Unique identifier for the MCP tool call approval request. Include this value in
+ // a subsequent `mcp_approval_response` input to approve or reject the
+ // corresponding tool call.
+ ApprovalRequestID string `json:"approval_request_id" api:"nullable"`
+ // The error from the tool call, if any.
+ Error string `json:"error" api:"nullable"`
+ // The output from the tool call.
+ Output string `json:"output" api:"nullable"`
+ // The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
+ // `calling`, or `failed`.
+ //
+ // Any of "in_progress", "completed", "incomplete", "calling", "failed".
+ Status string `json:"status"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Arguments respjson.Field
+ Name respjson.Field
+ ServerLabel respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ApprovalRequestID respjson.Field
+ Error respjson.Field
+ Output respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemMcpCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemMcpCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemMcpCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemMcpCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemMcpCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Compacts the current context. Must be the final input item.
+type BetaResponseInputItemCompactionTrigger struct {
+ // The type of the item. Always `compaction_trigger`.
+ Type constant.CompactionTrigger `json:"type" default:"compaction_trigger"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemCompactionTriggerAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemCompactionTrigger) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemCompactionTrigger) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemCompactionTriggerAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemCompactionTriggerAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemCompactionTriggerAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An internal identifier for an item to reference.
+type BetaResponseInputItemItemReference struct {
+ // The ID of the item to reference.
+ ID string `json:"id" api:"required"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemItemReferenceAgent `json:"agent" api:"nullable"`
+ // The type of item to reference. Always `item_reference`.
+ //
+ // Any of "item_reference".
+ Type string `json:"type" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Agent respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemItemReference) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemItemReference) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemItemReferenceAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemItemReferenceAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemItemReferenceAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemProgram struct {
+ // The unique ID of this program item.
+ ID string `json:"id" api:"required"`
+ // The stable call ID of the program item.
+ CallID string `json:"call_id" api:"required"`
+ // The JavaScript source executed by programmatic tool calling.
+ Code string `json:"code" api:"required"`
+ // Opaque program replay fingerprint that must be round-tripped.
+ Fingerprint string `json:"fingerprint" api:"required"`
+ // The item type. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemProgramAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Code respjson.Field
+ Fingerprint respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemProgram) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemProgramAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemProgramAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemProgramAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemProgramOutput struct {
+ // The unique ID of this program output item.
+ ID string `json:"id" api:"required"`
+ // The call ID of the program item.
+ CallID string `json:"call_id" api:"required"`
+ // The result produced by the program item.
+ Result string `json:"result" api:"required"`
+ // The terminal status of the program output.
+ //
+ // Any of "completed", "incomplete".
+ Status string `json:"status" api:"required"`
+ // The item type. Always `program_output`.
+ Type constant.ProgramOutput `json:"type" default:"program_output"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemProgramOutputAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Result respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemProgramOutput) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemProgramOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseInputItemProgramOutputAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputItemProgramOutputAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputItemProgramOutputAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func BetaResponseInputItemParamOfMessage[
+ T string | BetaResponseInputMessageContentListParam,
+](content T, role BetaEasyInputMessageRole) BetaResponseInputItemUnionParam {
+ var message BetaEasyInputMessageParam
+ switch v := any(content).(type) {
+ case string:
+ message.Content.OfString = param.NewOpt(v)
+ case BetaResponseInputMessageContentListParam:
+ message.Content.OfInputItemContentList = v
+ }
+ message.Role = role
+ return BetaResponseInputItemUnionParam{OfMessage: &message}
+}
+
+func BetaResponseInputItemParamOfInputMessage(content BetaResponseInputMessageContentListParam, role string) BetaResponseInputItemUnionParam {
+ var message BetaResponseInputItemMessageParam
+ message.Content = content
+ message.Role = role
+ return BetaResponseInputItemUnionParam{OfInputMessage: &message}
+}
+
+func BetaResponseInputItemParamOfOutputMessage(content []BetaResponseOutputMessageContentUnionParam, id string, status BetaResponseOutputMessageStatus) BetaResponseInputItemUnionParam {
+ var message BetaResponseOutputMessageParam
+ message.Content = content
+ message.ID = id
+ message.Status = status
+ return BetaResponseInputItemUnionParam{OfOutputMessage: &message}
+}
+
+func BetaResponseInputItemParamOfFileSearchCall(id string, queries []string, status BetaResponseFileSearchToolCallStatus) BetaResponseInputItemUnionParam {
+ var fileSearchCall BetaResponseFileSearchToolCallParam
+ fileSearchCall.ID = id
+ fileSearchCall.Queries = queries
+ fileSearchCall.Status = status
+ return BetaResponseInputItemUnionParam{OfFileSearchCall: &fileSearchCall}
+}
+
+func BetaResponseInputItemParamOfComputerCallOutput(callID string, output BetaResponseComputerToolCallOutputScreenshotParam) BetaResponseInputItemUnionParam {
+ var computerCallOutput BetaResponseInputItemComputerCallOutputParam
+ computerCallOutput.CallID = callID
+ computerCallOutput.Output = output
+ return BetaResponseInputItemUnionParam{OfComputerCallOutput: &computerCallOutput}
+}
+
+func BetaResponseInputItemParamOfWebSearchCall[
+ T BetaResponseFunctionWebSearchActionSearchParam | BetaResponseFunctionWebSearchActionOpenPageParam | BetaResponseFunctionWebSearchActionFindInPageParam,
+](action T, id string, status BetaResponseFunctionWebSearchStatus) BetaResponseInputItemUnionParam {
+ var webSearchCall BetaResponseFunctionWebSearchParam
+ switch v := any(action).(type) {
+ case BetaResponseFunctionWebSearchActionSearchParam:
+ webSearchCall.Action.OfSearch = &v
+ case BetaResponseFunctionWebSearchActionOpenPageParam:
+ webSearchCall.Action.OfOpenPage = &v
+ case BetaResponseFunctionWebSearchActionFindInPageParam:
+ webSearchCall.Action.OfFindInPage = &v
+ }
+ webSearchCall.ID = id
+ webSearchCall.Status = status
+ return BetaResponseInputItemUnionParam{OfWebSearchCall: &webSearchCall}
+}
+
+func BetaResponseInputItemParamOfFunctionCall(arguments string, callID string, name string) BetaResponseInputItemUnionParam {
+ var functionCall BetaResponseFunctionToolCallParam
+ functionCall.Arguments = arguments
+ functionCall.CallID = callID
+ functionCall.Name = name
+ return BetaResponseInputItemUnionParam{OfFunctionCall: &functionCall}
+}
+
+func BetaResponseInputItemParamOfFunctionCallOutput[
+ T string | BetaResponseFunctionCallOutputItemListParam,
+](callID string, output T) BetaResponseInputItemUnionParam {
+ var functionCallOutput BetaResponseInputItemFunctionCallOutputParam
+ functionCallOutput.CallID = callID
+ switch v := any(output).(type) {
+ case string:
+ functionCallOutput.Output.OfString = param.NewOpt(v)
+ case BetaResponseFunctionCallOutputItemListParam:
+ functionCallOutput.Output.OfBetaResponseFunctionCallOutputItemArray = v
+ }
+ return BetaResponseInputItemUnionParam{OfFunctionCallOutput: &functionCallOutput}
+}
+
+func BetaResponseInputItemParamOfAgentMessage(author string, content []BetaResponseInputItemAgentMessageContentUnionParam, recipient string) BetaResponseInputItemUnionParam {
+ var agentMessage BetaResponseInputItemAgentMessageParam
+ agentMessage.Author = author
+ agentMessage.Content = content
+ agentMessage.Recipient = recipient
+ return BetaResponseInputItemUnionParam{OfAgentMessage: &agentMessage}
+}
+
+func BetaResponseInputItemParamOfMultiAgentCall(action string, arguments string, callID string) BetaResponseInputItemUnionParam {
+ var multiAgentCall BetaResponseInputItemMultiAgentCallParam
+ multiAgentCall.Action = action
+ multiAgentCall.Arguments = arguments
+ multiAgentCall.CallID = callID
+ return BetaResponseInputItemUnionParam{OfMultiAgentCall: &multiAgentCall}
+}
+
+func BetaResponseInputItemParamOfMultiAgentCallOutput(action string, callID string, output []BetaResponseInputItemMultiAgentCallOutputOutputParam) BetaResponseInputItemUnionParam {
+ var multiAgentCallOutput BetaResponseInputItemMultiAgentCallOutputParam
+ multiAgentCallOutput.Action = action
+ multiAgentCallOutput.CallID = callID
+ multiAgentCallOutput.Output = output
+ return BetaResponseInputItemUnionParam{OfMultiAgentCallOutput: &multiAgentCallOutput}
+}
+
+func BetaResponseInputItemParamOfToolSearchCall(arguments any) BetaResponseInputItemUnionParam {
+ var toolSearchCall BetaResponseInputItemToolSearchCallParam
+ toolSearchCall.Arguments = arguments
+ return BetaResponseInputItemUnionParam{OfToolSearchCall: &toolSearchCall}
+}
+
+func BetaResponseInputItemParamOfToolSearchOutput(tools []BetaToolUnionParam) BetaResponseInputItemUnionParam {
+ var toolSearchOutput BetaResponseToolSearchOutputItemParam
+ toolSearchOutput.Tools = tools
+ return BetaResponseInputItemUnionParam{OfToolSearchOutput: &toolSearchOutput}
+}
+
+func BetaResponseInputItemParamOfAdditionalTools(tools []BetaToolUnionParam) BetaResponseInputItemUnionParam {
+ var additionalTools BetaResponseInputItemAdditionalToolsParam
+ additionalTools.Tools = tools
+ return BetaResponseInputItemUnionParam{OfAdditionalTools: &additionalTools}
+}
+
+func BetaResponseInputItemParamOfReasoning(id string, summary []BetaResponseReasoningItemSummaryParam) BetaResponseInputItemUnionParam {
+ var reasoning BetaResponseReasoningItemParam
+ reasoning.ID = id
+ reasoning.Summary = summary
+ return BetaResponseInputItemUnionParam{OfReasoning: &reasoning}
+}
+
+func BetaResponseInputItemParamOfCompaction(encryptedContent string) BetaResponseInputItemUnionParam {
+ var compaction BetaResponseCompactionItemParam
+ compaction.EncryptedContent = encryptedContent
+ return BetaResponseInputItemUnionParam{OfCompaction: &compaction}
+}
+
+func BetaResponseInputItemParamOfImageGenerationCall(id string, result string, status string) BetaResponseInputItemUnionParam {
+ var imageGenerationCall BetaResponseInputItemImageGenerationCallParam
+ imageGenerationCall.ID = id
+ imageGenerationCall.Result = param.NewOpt(result)
+ imageGenerationCall.Status = status
+ return BetaResponseInputItemUnionParam{OfImageGenerationCall: &imageGenerationCall}
+}
+
+func BetaResponseInputItemParamOfLocalShellCallOutput(id string, output string) BetaResponseInputItemUnionParam {
+ var localShellCallOutput BetaResponseInputItemLocalShellCallOutputParam
+ localShellCallOutput.ID = id
+ localShellCallOutput.Output = output
+ return BetaResponseInputItemUnionParam{OfLocalShellCallOutput: &localShellCallOutput}
+}
+
+func BetaResponseInputItemParamOfShellCall(action BetaResponseInputItemShellCallActionParam, callID string) BetaResponseInputItemUnionParam {
+ var shellCall BetaResponseInputItemShellCallParam
+ shellCall.Action = action
+ shellCall.CallID = callID
+ return BetaResponseInputItemUnionParam{OfShellCall: &shellCall}
+}
+
+func BetaResponseInputItemParamOfShellCallOutput(callID string, output []BetaResponseFunctionShellCallOutputContentParam) BetaResponseInputItemUnionParam {
+ var shellCallOutput BetaResponseInputItemShellCallOutputParam
+ shellCallOutput.CallID = callID
+ shellCallOutput.Output = output
+ return BetaResponseInputItemUnionParam{OfShellCallOutput: &shellCallOutput}
+}
+
+func BetaResponseInputItemParamOfApplyPatchCall[
+ T BetaResponseInputItemApplyPatchCallOperationCreateFileParam | BetaResponseInputItemApplyPatchCallOperationDeleteFileParam | BetaResponseInputItemApplyPatchCallOperationUpdateFileParam,
+](callID string, operation T, status string) BetaResponseInputItemUnionParam {
+ var applyPatchCall BetaResponseInputItemApplyPatchCallParam
+ applyPatchCall.CallID = callID
+ switch v := any(operation).(type) {
+ case BetaResponseInputItemApplyPatchCallOperationCreateFileParam:
+ applyPatchCall.Operation.OfCreateFile = &v
+ case BetaResponseInputItemApplyPatchCallOperationDeleteFileParam:
+ applyPatchCall.Operation.OfDeleteFile = &v
+ case BetaResponseInputItemApplyPatchCallOperationUpdateFileParam:
+ applyPatchCall.Operation.OfUpdateFile = &v
+ }
+ applyPatchCall.Status = status
+ return BetaResponseInputItemUnionParam{OfApplyPatchCall: &applyPatchCall}
+}
+
+func BetaResponseInputItemParamOfApplyPatchCallOutput(callID string, status string) BetaResponseInputItemUnionParam {
+ var applyPatchCallOutput BetaResponseInputItemApplyPatchCallOutputParam
+ applyPatchCallOutput.CallID = callID
+ applyPatchCallOutput.Status = status
+ return BetaResponseInputItemUnionParam{OfApplyPatchCallOutput: &applyPatchCallOutput}
+}
+
+func BetaResponseInputItemParamOfMcpListTools(id string, serverLabel string, tools []BetaResponseInputItemMcpListToolsToolParam) BetaResponseInputItemUnionParam {
+ var mcpListTools BetaResponseInputItemMcpListToolsParam
+ mcpListTools.ID = id
+ mcpListTools.ServerLabel = serverLabel
+ mcpListTools.Tools = tools
+ return BetaResponseInputItemUnionParam{OfMcpListTools: &mcpListTools}
+}
+
+func BetaResponseInputItemParamOfMcpApprovalResponse(approvalRequestID string, approve bool) BetaResponseInputItemUnionParam {
+ var mcpApprovalResponse BetaResponseInputItemMcpApprovalResponseParam
+ mcpApprovalResponse.ApprovalRequestID = approvalRequestID
+ mcpApprovalResponse.Approve = approve
+ return BetaResponseInputItemUnionParam{OfMcpApprovalResponse: &mcpApprovalResponse}
+}
+
+func BetaResponseInputItemParamOfCustomToolCallOutput[
+ T string | []BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionParam,
+](callID string, output T) BetaResponseInputItemUnionParam {
+ var customToolCallOutput BetaResponseCustomToolCallOutputParam
+ customToolCallOutput.CallID = callID
+ switch v := any(output).(type) {
+ case string:
+ customToolCallOutput.Output.OfString = param.NewOpt(v)
+ case []BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionParam:
+ customToolCallOutput.Output.OfOutputContentList = v
+ }
+ return BetaResponseInputItemUnionParam{OfCustomToolCallOutput: &customToolCallOutput}
+}
+
+func BetaResponseInputItemParamOfCustomToolCall(callID string, input string, name string) BetaResponseInputItemUnionParam {
+ var customToolCall BetaResponseCustomToolCallParam
+ customToolCall.CallID = callID
+ customToolCall.Input = input
+ customToolCall.Name = name
+ return BetaResponseInputItemUnionParam{OfCustomToolCall: &customToolCall}
+}
+
+func BetaResponseInputItemParamOfItemReference(id string) BetaResponseInputItemUnionParam {
+ var itemReference BetaResponseInputItemItemReferenceParam
+ itemReference.ID = id
+ return BetaResponseInputItemUnionParam{OfItemReference: &itemReference}
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseInputItemUnionParam struct {
+ OfMessage *BetaEasyInputMessageParam `json:",omitzero,inline"`
+ OfInputMessage *BetaResponseInputItemMessageParam `json:",omitzero,inline"`
+ OfOutputMessage *BetaResponseOutputMessageParam `json:",omitzero,inline"`
+ OfFileSearchCall *BetaResponseFileSearchToolCallParam `json:",omitzero,inline"`
+ OfComputerCall *BetaResponseComputerToolCallParam `json:",omitzero,inline"`
+ OfComputerCallOutput *BetaResponseInputItemComputerCallOutputParam `json:",omitzero,inline"`
+ OfWebSearchCall *BetaResponseFunctionWebSearchParam `json:",omitzero,inline"`
+ OfFunctionCall *BetaResponseFunctionToolCallParam `json:",omitzero,inline"`
+ OfFunctionCallOutput *BetaResponseInputItemFunctionCallOutputParam `json:",omitzero,inline"`
+ OfAgentMessage *BetaResponseInputItemAgentMessageParam `json:",omitzero,inline"`
+ OfMultiAgentCall *BetaResponseInputItemMultiAgentCallParam `json:",omitzero,inline"`
+ OfMultiAgentCallOutput *BetaResponseInputItemMultiAgentCallOutputParam `json:",omitzero,inline"`
+ OfToolSearchCall *BetaResponseInputItemToolSearchCallParam `json:",omitzero,inline"`
+ OfToolSearchOutput *BetaResponseToolSearchOutputItemParam `json:",omitzero,inline"`
+ OfAdditionalTools *BetaResponseInputItemAdditionalToolsParam `json:",omitzero,inline"`
+ OfReasoning *BetaResponseReasoningItemParam `json:",omitzero,inline"`
+ OfCompaction *BetaResponseCompactionItemParam `json:",omitzero,inline"`
+ OfImageGenerationCall *BetaResponseInputItemImageGenerationCallParam `json:",omitzero,inline"`
+ OfCodeInterpreterCall *BetaResponseCodeInterpreterToolCallParam `json:",omitzero,inline"`
+ OfLocalShellCall *BetaResponseInputItemLocalShellCallParam `json:",omitzero,inline"`
+ OfLocalShellCallOutput *BetaResponseInputItemLocalShellCallOutputParam `json:",omitzero,inline"`
+ OfShellCall *BetaResponseInputItemShellCallParam `json:",omitzero,inline"`
+ OfShellCallOutput *BetaResponseInputItemShellCallOutputParam `json:",omitzero,inline"`
+ OfApplyPatchCall *BetaResponseInputItemApplyPatchCallParam `json:",omitzero,inline"`
+ OfApplyPatchCallOutput *BetaResponseInputItemApplyPatchCallOutputParam `json:",omitzero,inline"`
+ OfMcpListTools *BetaResponseInputItemMcpListToolsParam `json:",omitzero,inline"`
+ OfMcpApprovalRequest *BetaResponseInputItemMcpApprovalRequestParam `json:",omitzero,inline"`
+ OfMcpApprovalResponse *BetaResponseInputItemMcpApprovalResponseParam `json:",omitzero,inline"`
+ OfMcpCall *BetaResponseInputItemMcpCallParam `json:",omitzero,inline"`
+ OfCustomToolCallOutput *BetaResponseCustomToolCallOutputParam `json:",omitzero,inline"`
+ OfCustomToolCall *BetaResponseCustomToolCallParam `json:",omitzero,inline"`
+ OfCompactionTrigger *BetaResponseInputItemCompactionTriggerParam `json:",omitzero,inline"`
+ OfItemReference *BetaResponseInputItemItemReferenceParam `json:",omitzero,inline"`
+ OfProgram *BetaResponseInputItemProgramParam `json:",omitzero,inline"`
+ OfProgramOutput *BetaResponseInputItemProgramOutputParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseInputItemUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfMessage,
+ u.OfInputMessage,
+ u.OfOutputMessage,
+ u.OfFileSearchCall,
+ u.OfComputerCall,
+ u.OfComputerCallOutput,
+ u.OfWebSearchCall,
+ u.OfFunctionCall,
+ u.OfFunctionCallOutput,
+ u.OfAgentMessage,
+ u.OfMultiAgentCall,
+ u.OfMultiAgentCallOutput,
+ u.OfToolSearchCall,
+ u.OfToolSearchOutput,
+ u.OfAdditionalTools,
+ u.OfReasoning,
+ u.OfCompaction,
+ u.OfImageGenerationCall,
+ u.OfCodeInterpreterCall,
+ u.OfLocalShellCall,
+ u.OfLocalShellCallOutput,
+ u.OfShellCall,
+ u.OfShellCallOutput,
+ u.OfApplyPatchCall,
+ u.OfApplyPatchCallOutput,
+ u.OfMcpListTools,
+ u.OfMcpApprovalRequest,
+ u.OfMcpApprovalResponse,
+ u.OfMcpCall,
+ u.OfCustomToolCallOutput,
+ u.OfCustomToolCall,
+ u.OfCompactionTrigger,
+ u.OfItemReference,
+ u.OfProgram,
+ u.OfProgramOutput)
+}
+func (u *BetaResponseInputItemUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseInputItemUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfMessage) {
+ return u.OfMessage
+ } else if !param.IsOmitted(u.OfInputMessage) {
+ return u.OfInputMessage
+ } else if !param.IsOmitted(u.OfOutputMessage) {
+ return u.OfOutputMessage
+ } else if !param.IsOmitted(u.OfFileSearchCall) {
+ return u.OfFileSearchCall
+ } else if !param.IsOmitted(u.OfComputerCall) {
+ return u.OfComputerCall
+ } else if !param.IsOmitted(u.OfComputerCallOutput) {
+ return u.OfComputerCallOutput
+ } else if !param.IsOmitted(u.OfWebSearchCall) {
+ return u.OfWebSearchCall
+ } else if !param.IsOmitted(u.OfFunctionCall) {
+ return u.OfFunctionCall
+ } else if !param.IsOmitted(u.OfFunctionCallOutput) {
+ return u.OfFunctionCallOutput
+ } else if !param.IsOmitted(u.OfAgentMessage) {
+ return u.OfAgentMessage
+ } else if !param.IsOmitted(u.OfMultiAgentCall) {
+ return u.OfMultiAgentCall
+ } else if !param.IsOmitted(u.OfMultiAgentCallOutput) {
+ return u.OfMultiAgentCallOutput
+ } else if !param.IsOmitted(u.OfToolSearchCall) {
+ return u.OfToolSearchCall
+ } else if !param.IsOmitted(u.OfToolSearchOutput) {
+ return u.OfToolSearchOutput
+ } else if !param.IsOmitted(u.OfAdditionalTools) {
+ return u.OfAdditionalTools
+ } else if !param.IsOmitted(u.OfReasoning) {
+ return u.OfReasoning
+ } else if !param.IsOmitted(u.OfCompaction) {
+ return u.OfCompaction
+ } else if !param.IsOmitted(u.OfImageGenerationCall) {
+ return u.OfImageGenerationCall
+ } else if !param.IsOmitted(u.OfCodeInterpreterCall) {
+ return u.OfCodeInterpreterCall
+ } else if !param.IsOmitted(u.OfLocalShellCall) {
+ return u.OfLocalShellCall
+ } else if !param.IsOmitted(u.OfLocalShellCallOutput) {
+ return u.OfLocalShellCallOutput
+ } else if !param.IsOmitted(u.OfShellCall) {
+ return u.OfShellCall
+ } else if !param.IsOmitted(u.OfShellCallOutput) {
+ return u.OfShellCallOutput
+ } else if !param.IsOmitted(u.OfApplyPatchCall) {
+ return u.OfApplyPatchCall
+ } else if !param.IsOmitted(u.OfApplyPatchCallOutput) {
+ return u.OfApplyPatchCallOutput
+ } else if !param.IsOmitted(u.OfMcpListTools) {
+ return u.OfMcpListTools
+ } else if !param.IsOmitted(u.OfMcpApprovalRequest) {
+ return u.OfMcpApprovalRequest
+ } else if !param.IsOmitted(u.OfMcpApprovalResponse) {
+ return u.OfMcpApprovalResponse
+ } else if !param.IsOmitted(u.OfMcpCall) {
+ return u.OfMcpCall
+ } else if !param.IsOmitted(u.OfCustomToolCallOutput) {
+ return u.OfCustomToolCallOutput
+ } else if !param.IsOmitted(u.OfCustomToolCall) {
+ return u.OfCustomToolCall
+ } else if !param.IsOmitted(u.OfCompactionTrigger) {
+ return u.OfCompactionTrigger
+ } else if !param.IsOmitted(u.OfItemReference) {
+ return u.OfItemReference
+ } else if !param.IsOmitted(u.OfProgram) {
+ return u.OfProgram
+ } else if !param.IsOmitted(u.OfProgramOutput) {
+ return u.OfProgramOutput
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetQueries() []string {
+ if vt := u.OfFileSearchCall; vt != nil {
+ return vt.Queries
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetResults() []BetaResponseFileSearchToolCallResultParam {
+ if vt := u.OfFileSearchCall; vt != nil {
+ return vt.Results
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetPendingSafetyChecks() []BetaResponseComputerToolCallPendingSafetyCheckParam {
+ if vt := u.OfComputerCall; vt != nil {
+ return vt.PendingSafetyChecks
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetActions() BetaComputerActionListParam {
+ if vt := u.OfComputerCall; vt != nil {
+ return vt.Actions
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetAcknowledgedSafetyChecks() []BetaResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam {
+ if vt := u.OfComputerCallOutput; vt != nil {
+ return vt.AcknowledgedSafetyChecks
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetAuthor() *string {
+ if vt := u.OfAgentMessage; vt != nil {
+ return &vt.Author
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetRecipient() *string {
+ if vt := u.OfAgentMessage; vt != nil {
+ return &vt.Recipient
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetSummary() []BetaResponseReasoningItemSummaryParam {
+ if vt := u.OfReasoning; vt != nil {
+ return vt.Summary
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetContainerID() *string {
+ if vt := u.OfCodeInterpreterCall; vt != nil {
+ return &vt.ContainerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetOutputs() []BetaResponseCodeInterpreterToolCallOutputUnionParam {
+ if vt := u.OfCodeInterpreterCall; vt != nil {
+ return vt.Outputs
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetEnvironment() *BetaResponseInputItemShellCallEnvironmentUnionParam {
+ if vt := u.OfShellCall; vt != nil {
+ return &vt.Environment
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetMaxOutputLength() *int64 {
+ if vt := u.OfShellCallOutput; vt != nil && vt.MaxOutputLength.Valid() {
+ return &vt.MaxOutputLength.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetOperation() *BetaResponseInputItemApplyPatchCallOperationUnionParam {
+ if vt := u.OfApplyPatchCall; vt != nil {
+ return &vt.Operation
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetApprove() *bool {
+ if vt := u.OfMcpApprovalResponse; vt != nil {
+ return &vt.Approve
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetReason() *string {
+ if vt := u.OfMcpApprovalResponse; vt != nil && vt.Reason.Valid() {
+ return &vt.Reason.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetInput() *string {
+ if vt := u.OfCustomToolCall; vt != nil {
+ return &vt.Input
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetFingerprint() *string {
+ if vt := u.OfProgram; vt != nil {
+ return &vt.Fingerprint
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetRole() *string {
+ if vt := u.OfMessage; vt != nil {
+ return (*string)(&vt.Role)
+ } else if vt := u.OfInputMessage; vt != nil {
+ return (*string)(&vt.Role)
+ } else if vt := u.OfOutputMessage; vt != nil {
+ return (*string)(&vt.Role)
+ } else if vt := u.OfAdditionalTools; vt != nil {
+ return (*string)(&vt.Role)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetPhase() *string {
+ if vt := u.OfMessage; vt != nil {
+ return (*string)(&vt.Phase)
+ } else if vt := u.OfOutputMessage; vt != nil {
+ return (*string)(&vt.Phase)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetType() *string {
+ if vt := u.OfMessage; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfInputMessage; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfOutputMessage; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfFileSearchCall; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfComputerCall; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfComputerCallOutput; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfWebSearchCall; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfFunctionCall; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfFunctionCallOutput; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfAgentMessage; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfMultiAgentCall; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfMultiAgentCallOutput; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfToolSearchCall; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfToolSearchOutput; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfAdditionalTools; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfReasoning; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfCompaction; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfImageGenerationCall; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfCodeInterpreterCall; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfLocalShellCall; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfLocalShellCallOutput; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfShellCall; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfShellCallOutput; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfApplyPatchCall; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfApplyPatchCallOutput; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfMcpListTools; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfMcpApprovalRequest; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfMcpApprovalResponse; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfMcpCall; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfCustomToolCallOutput; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfCustomToolCall; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfCompactionTrigger; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfItemReference; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfProgramOutput; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetStatus() *string {
+ if vt := u.OfInputMessage; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfOutputMessage; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfFileSearchCall; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfComputerCall; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfComputerCallOutput; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfWebSearchCall; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfFunctionCall; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfFunctionCallOutput; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfToolSearchCall; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfToolSearchOutput; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfReasoning; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfImageGenerationCall; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfCodeInterpreterCall; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfLocalShellCall; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfLocalShellCallOutput; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfShellCall; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfShellCallOutput; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfApplyPatchCall; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfApplyPatchCallOutput; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfMcpCall; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfProgramOutput; vt != nil {
+ return (*string)(&vt.Status)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetID() *string {
+ if vt := u.OfOutputMessage; vt != nil {
+ return (*string)(&vt.ID)
+ } else if vt := u.OfFileSearchCall; vt != nil {
+ return (*string)(&vt.ID)
+ } else if vt := u.OfComputerCall; vt != nil {
+ return (*string)(&vt.ID)
+ } else if vt := u.OfComputerCallOutput; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfWebSearchCall; vt != nil {
+ return (*string)(&vt.ID)
+ } else if vt := u.OfFunctionCall; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfFunctionCallOutput; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfAgentMessage; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfMultiAgentCall; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfMultiAgentCallOutput; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfToolSearchCall; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfToolSearchOutput; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfAdditionalTools; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfReasoning; vt != nil {
+ return (*string)(&vt.ID)
+ } else if vt := u.OfCompaction; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfImageGenerationCall; vt != nil {
+ return (*string)(&vt.ID)
+ } else if vt := u.OfCodeInterpreterCall; vt != nil {
+ return (*string)(&vt.ID)
+ } else if vt := u.OfLocalShellCall; vt != nil {
+ return (*string)(&vt.ID)
+ } else if vt := u.OfLocalShellCallOutput; vt != nil {
+ return (*string)(&vt.ID)
+ } else if vt := u.OfShellCall; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfShellCallOutput; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfApplyPatchCall; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfApplyPatchCallOutput; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfMcpListTools; vt != nil {
+ return (*string)(&vt.ID)
+ } else if vt := u.OfMcpApprovalRequest; vt != nil {
+ return (*string)(&vt.ID)
+ } else if vt := u.OfMcpApprovalResponse; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfMcpCall; vt != nil {
+ return (*string)(&vt.ID)
+ } else if vt := u.OfCustomToolCallOutput; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfCustomToolCall; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfItemReference; vt != nil {
+ return (*string)(&vt.ID)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.ID)
+ } else if vt := u.OfProgramOutput; vt != nil {
+ return (*string)(&vt.ID)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetCallID() *string {
+ if vt := u.OfComputerCall; vt != nil {
+ return (*string)(&vt.CallID)
+ } else if vt := u.OfComputerCallOutput; vt != nil {
+ return (*string)(&vt.CallID)
+ } else if vt := u.OfFunctionCall; vt != nil {
+ return (*string)(&vt.CallID)
+ } else if vt := u.OfFunctionCallOutput; vt != nil {
+ return (*string)(&vt.CallID)
+ } else if vt := u.OfMultiAgentCall; vt != nil {
+ return (*string)(&vt.CallID)
+ } else if vt := u.OfMultiAgentCallOutput; vt != nil {
+ return (*string)(&vt.CallID)
+ } else if vt := u.OfToolSearchCall; vt != nil && vt.CallID.Valid() {
+ return &vt.CallID.Value
+ } else if vt := u.OfToolSearchOutput; vt != nil && vt.CallID.Valid() {
+ return &vt.CallID.Value
+ } else if vt := u.OfLocalShellCall; vt != nil {
+ return (*string)(&vt.CallID)
+ } else if vt := u.OfShellCall; vt != nil {
+ return (*string)(&vt.CallID)
+ } else if vt := u.OfShellCallOutput; vt != nil {
+ return (*string)(&vt.CallID)
+ } else if vt := u.OfApplyPatchCall; vt != nil {
+ return (*string)(&vt.CallID)
+ } else if vt := u.OfApplyPatchCallOutput; vt != nil {
+ return (*string)(&vt.CallID)
+ } else if vt := u.OfCustomToolCallOutput; vt != nil {
+ return (*string)(&vt.CallID)
+ } else if vt := u.OfCustomToolCall; vt != nil {
+ return (*string)(&vt.CallID)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.CallID)
+ } else if vt := u.OfProgramOutput; vt != nil {
+ return (*string)(&vt.CallID)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetName() *string {
+ if vt := u.OfFunctionCall; vt != nil {
+ return (*string)(&vt.Name)
+ } else if vt := u.OfMcpApprovalRequest; vt != nil {
+ return (*string)(&vt.Name)
+ } else if vt := u.OfMcpCall; vt != nil {
+ return (*string)(&vt.Name)
+ } else if vt := u.OfCustomToolCall; vt != nil {
+ return (*string)(&vt.Name)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetNamespace() *string {
+ if vt := u.OfFunctionCall; vt != nil && vt.Namespace.Valid() {
+ return &vt.Namespace.Value
+ } else if vt := u.OfCustomToolCall; vt != nil && vt.Namespace.Valid() {
+ return &vt.Namespace.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetExecution() *string {
+ if vt := u.OfToolSearchCall; vt != nil {
+ return (*string)(&vt.Execution)
+ } else if vt := u.OfToolSearchOutput; vt != nil {
+ return (*string)(&vt.Execution)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetEncryptedContent() *string {
+ if vt := u.OfReasoning; vt != nil && vt.EncryptedContent.Valid() {
+ return &vt.EncryptedContent.Value
+ } else if vt := u.OfCompaction; vt != nil {
+ return (*string)(&vt.EncryptedContent)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetResult() *string {
+ if vt := u.OfImageGenerationCall; vt != nil && vt.Result.Valid() {
+ return &vt.Result.Value
+ } else if vt := u.OfProgramOutput; vt != nil {
+ return (*string)(&vt.Result)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetCode() *string {
+ if vt := u.OfCodeInterpreterCall; vt != nil && vt.Code.Valid() {
+ return &vt.Code.Value
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.Code)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetServerLabel() *string {
+ if vt := u.OfMcpListTools; vt != nil {
+ return (*string)(&vt.ServerLabel)
+ } else if vt := u.OfMcpApprovalRequest; vt != nil {
+ return (*string)(&vt.ServerLabel)
+ } else if vt := u.OfMcpCall; vt != nil {
+ return (*string)(&vt.ServerLabel)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetError() *string {
+ if vt := u.OfMcpListTools; vt != nil && vt.Error.Valid() {
+ return &vt.Error.Value
+ } else if vt := u.OfMcpCall; vt != nil && vt.Error.Valid() {
+ return &vt.Error.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemUnionParam) GetApprovalRequestID() *string {
+ if vt := u.OfMcpApprovalResponse; vt != nil {
+ return (*string)(&vt.ApprovalRequestID)
+ } else if vt := u.OfMcpCall; vt != nil && vt.ApprovalRequestID.Valid() {
+ return &vt.ApprovalRequestID.Value
+ }
+ return nil
+}
+
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u BetaResponseInputItemUnionParam) GetContent() (res betaResponseInputItemUnionParamContent) {
+ if vt := u.OfMessage; vt != nil {
+ res.any = vt.Content.asAny()
+ } else if vt := u.OfInputMessage; vt != nil {
+ res.any = &vt.Content
+ } else if vt := u.OfOutputMessage; vt != nil {
+ res.any = &vt.Content
+ } else if vt := u.OfAgentMessage; vt != nil {
+ res.any = &vt.Content
+ } else if vt := u.OfReasoning; vt != nil {
+ res.any = &vt.Content
+ }
+ return
+}
+
+// Can have the runtime types [*string],
+// [*BetaResponseInputMessageContentListParam],
+// [_[]BetaResponseOutputMessageContentUnionParam],
+// [_[]BetaResponseInputItemAgentMessageContentUnionParam],
+// [\*[]BetaResponseReasoningItemContentParam]
+type betaResponseInputItemUnionParamContent struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *string:
+// case *openai.BetaResponseInputMessageContentListParam:
+// case *[]openai.BetaResponseOutputMessageContentUnionParam:
+// case *[]openai.BetaResponseInputItemAgentMessageContentUnionParam:
+// case *[]openai.BetaResponseReasoningItemContentParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u betaResponseInputItemUnionParamContent) AsAny() any { return u.any }
+
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u BetaResponseInputItemUnionParam) GetAgent() (res betaResponseInputItemUnionParamAgent) {
+ if vt := u.OfInputMessage; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfOutputMessage; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfFileSearchCall; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfComputerCall; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfComputerCallOutput; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfWebSearchCall; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfFunctionCall; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfFunctionCallOutput; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfAgentMessage; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfMultiAgentCall; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfMultiAgentCallOutput; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfToolSearchCall; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfToolSearchOutput; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfAdditionalTools; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfReasoning; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfCompaction; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfImageGenerationCall; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfCodeInterpreterCall; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfLocalShellCall; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfLocalShellCallOutput; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfShellCall; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfShellCallOutput; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfApplyPatchCall; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfApplyPatchCallOutput; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfMcpListTools; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfMcpApprovalRequest; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfMcpApprovalResponse; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfMcpCall; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfCustomToolCallOutput; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfCustomToolCall; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfCompactionTrigger; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfItemReference; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfProgram; vt != nil {
+ res.any = &vt.Agent
+ } else if vt := u.OfProgramOutput; vt != nil {
+ res.any = &vt.Agent
+ }
+ return
+}
+
+// Can have the runtime types [*BetaResponseInputItemMessageAgentParam],
+// [*BetaResponseOutputMessageAgentParam],
+// [*BetaResponseFileSearchToolCallAgentParam],
+// [*BetaResponseComputerToolCallAgentParam],
+// [*BetaResponseInputItemComputerCallOutputAgentParam],
+// [*BetaResponseFunctionWebSearchAgentParam],
+// [*BetaResponseFunctionToolCallAgentParam],
+// [*BetaResponseInputItemFunctionCallOutputAgentParam],
+// [*BetaResponseInputItemAgentMessageAgentParam],
+// [*BetaResponseInputItemMultiAgentCallAgentParam],
+// [*BetaResponseInputItemMultiAgentCallOutputAgentParam],
+// [*BetaResponseInputItemToolSearchCallAgentParam],
+// [*BetaResponseToolSearchOutputItemParamAgent],
+// [*BetaResponseInputItemAdditionalToolsAgentParam],
+// [*BetaResponseReasoningItemAgentParam], [*BetaResponseCompactionItemParamAgent],
+// [*BetaResponseInputItemImageGenerationCallAgentParam],
+// [*BetaResponseCodeInterpreterToolCallAgentParam],
+// [*BetaResponseInputItemLocalShellCallAgentParam],
+// [*BetaResponseInputItemLocalShellCallOutputAgentParam],
+// [*BetaResponseInputItemShellCallAgentParam],
+// [*BetaResponseInputItemShellCallOutputAgentParam],
+// [*BetaResponseInputItemApplyPatchCallAgentParam],
+// [*BetaResponseInputItemApplyPatchCallOutputAgentParam],
+// [*BetaResponseInputItemMcpListToolsAgentParam],
+// [*BetaResponseInputItemMcpApprovalRequestAgentParam],
+// [*BetaResponseInputItemMcpApprovalResponseAgentParam],
+// [*BetaResponseInputItemMcpCallAgentParam],
+// [*BetaResponseCustomToolCallOutputAgentParam],
+// [*BetaResponseCustomToolCallAgentParam],
+// [*BetaResponseInputItemCompactionTriggerAgentParam],
+// [*BetaResponseInputItemItemReferenceAgentParam],
+// [*BetaResponseInputItemProgramAgentParam],
+// [*BetaResponseInputItemProgramOutputAgentParam]
+type betaResponseInputItemUnionParamAgent struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *openai.BetaResponseInputItemMessageAgentParam:
+// case *openai.BetaResponseOutputMessageAgentParam:
+// case *openai.BetaResponseFileSearchToolCallAgentParam:
+// case *openai.BetaResponseComputerToolCallAgentParam:
+// case *openai.BetaResponseInputItemComputerCallOutputAgentParam:
+// case *openai.BetaResponseFunctionWebSearchAgentParam:
+// case *openai.BetaResponseFunctionToolCallAgentParam:
+// case *openai.BetaResponseInputItemFunctionCallOutputAgentParam:
+// case *openai.BetaResponseInputItemAgentMessageAgentParam:
+// case *openai.BetaResponseInputItemMultiAgentCallAgentParam:
+// case *openai.BetaResponseInputItemMultiAgentCallOutputAgentParam:
+// case *openai.BetaResponseInputItemToolSearchCallAgentParam:
+// case *openai.BetaResponseToolSearchOutputItemParamAgent:
+// case *openai.BetaResponseInputItemAdditionalToolsAgentParam:
+// case *openai.BetaResponseReasoningItemAgentParam:
+// case *openai.BetaResponseCompactionItemParamAgent:
+// case *openai.BetaResponseInputItemImageGenerationCallAgentParam:
+// case *openai.BetaResponseCodeInterpreterToolCallAgentParam:
+// case *openai.BetaResponseInputItemLocalShellCallAgentParam:
+// case *openai.BetaResponseInputItemLocalShellCallOutputAgentParam:
+// case *openai.BetaResponseInputItemShellCallAgentParam:
+// case *openai.BetaResponseInputItemShellCallOutputAgentParam:
+// case *openai.BetaResponseInputItemApplyPatchCallAgentParam:
+// case *openai.BetaResponseInputItemApplyPatchCallOutputAgentParam:
+// case *openai.BetaResponseInputItemMcpListToolsAgentParam:
+// case *openai.BetaResponseInputItemMcpApprovalRequestAgentParam:
+// case *openai.BetaResponseInputItemMcpApprovalResponseAgentParam:
+// case *openai.BetaResponseInputItemMcpCallAgentParam:
+// case *openai.BetaResponseCustomToolCallOutputAgentParam:
+// case *openai.BetaResponseCustomToolCallAgentParam:
+// case *openai.BetaResponseInputItemCompactionTriggerAgentParam:
+// case *openai.BetaResponseInputItemItemReferenceAgentParam:
+// case *openai.BetaResponseInputItemProgramAgentParam:
+// case *openai.BetaResponseInputItemProgramOutputAgentParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u betaResponseInputItemUnionParamAgent) AsAny() any { return u.any }
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAgent) GetAgentName() *string {
+ switch vt := u.any.(type) {
+ case *BetaResponseInputItemMessageAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseOutputMessageAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseFileSearchToolCallAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseComputerToolCallAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemComputerCallOutputAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseFunctionWebSearchAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseFunctionToolCallAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemFunctionCallOutputAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemAgentMessageAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemMultiAgentCallAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemMultiAgentCallOutputAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemToolSearchCallAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseToolSearchOutputItemParamAgent:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemAdditionalToolsAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseReasoningItemAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseCompactionItemParamAgent:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemImageGenerationCallAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseCodeInterpreterToolCallAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemLocalShellCallAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemLocalShellCallOutputAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemShellCallAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemShellCallOutputAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemApplyPatchCallAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemApplyPatchCallOutputAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemMcpListToolsAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemMcpApprovalRequestAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemMcpApprovalResponseAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemMcpCallAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseCustomToolCallOutputAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseCustomToolCallAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemCompactionTriggerAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemItemReferenceAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemProgramAgentParam:
+ return (*string)(&vt.AgentName)
+ case *BetaResponseInputItemProgramOutputAgentParam:
+ return (*string)(&vt.AgentName)
+ }
+ return nil
+}
+
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u BetaResponseInputItemUnionParam) GetAction() (res betaResponseInputItemUnionParamAction) {
+ if vt := u.OfComputerCall; vt != nil {
+ res.any = vt.Action.asAny()
+ } else if vt := u.OfWebSearchCall; vt != nil {
+ res.any = vt.Action.asAny()
+ } else if vt := u.OfMultiAgentCall; vt != nil {
+ res.any = &vt.Action
+ } else if vt := u.OfMultiAgentCallOutput; vt != nil {
+ res.any = &vt.Action
+ } else if vt := u.OfLocalShellCall; vt != nil {
+ res.any = &vt.Action
+ } else if vt := u.OfShellCall; vt != nil {
+ res.any = &vt.Action
+ }
+ return
+}
+
+// Can have the runtime types [*BetaComputerActionClickParam],
+// [*BetaComputerActionDoubleClickParam], [*BetaComputerActionDragParam],
+// [*BetaComputerActionKeypressParam], [*BetaComputerActionMoveParam],
+// [*BetaComputerActionScreenshotParam], [*BetaComputerActionScrollParam],
+// [*BetaComputerActionTypeParam], [*BetaComputerActionWaitParam],
+// [*BetaResponseFunctionWebSearchActionSearchParam],
+// [*BetaResponseFunctionWebSearchActionOpenPageParam],
+// [*BetaResponseFunctionWebSearchActionFindInPageParam], [*string],
+// [*BetaResponseInputItemLocalShellCallActionParam],
+// [*BetaResponseInputItemShellCallActionParam]
+type betaResponseInputItemUnionParamAction struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *openai.BetaComputerActionClickParam:
+// case *openai.BetaComputerActionDoubleClickParam:
+// case *openai.BetaComputerActionDragParam:
+// case *openai.BetaComputerActionKeypressParam:
+// case *openai.BetaComputerActionMoveParam:
+// case *openai.BetaComputerActionScreenshotParam:
+// case *openai.BetaComputerActionScrollParam:
+// case *openai.BetaComputerActionTypeParam:
+// case *openai.BetaComputerActionWaitParam:
+// case *openai.BetaResponseFunctionWebSearchActionSearchParam:
+// case *openai.BetaResponseFunctionWebSearchActionOpenPageParam:
+// case *openai.BetaResponseFunctionWebSearchActionFindInPageParam:
+// case *string:
+// case *openai.BetaResponseInputItemLocalShellCallActionParam:
+// case *openai.BetaResponseInputItemShellCallActionParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u betaResponseInputItemUnionParamAction) AsAny() any { return u.any }
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAction) GetButton() *string {
+ switch vt := u.any.(type) {
+ case *BetaComputerActionUnionParam:
+ return vt.GetButton()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAction) GetPath() []BetaComputerActionDragPathParam {
+ switch vt := u.any.(type) {
+ case *BetaComputerActionUnionParam:
+ return vt.GetPath()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAction) GetScrollX() *int64 {
+ switch vt := u.any.(type) {
+ case *BetaComputerActionUnionParam:
+ return vt.GetScrollX()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAction) GetScrollY() *int64 {
+ switch vt := u.any.(type) {
+ case *BetaComputerActionUnionParam:
+ return vt.GetScrollY()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAction) GetText() *string {
+ switch vt := u.any.(type) {
+ case *BetaComputerActionUnionParam:
+ return vt.GetText()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAction) GetQueries() []string {
+ switch vt := u.any.(type) {
+ case *BetaResponseFunctionWebSearchActionUnionParam:
+ return vt.GetQueries()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAction) GetQuery() *string {
+ switch vt := u.any.(type) {
+ case *BetaResponseFunctionWebSearchActionUnionParam:
+ return vt.GetQuery()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAction) GetSources() []BetaResponseFunctionWebSearchActionSearchSourceParam {
+ switch vt := u.any.(type) {
+ case *BetaResponseFunctionWebSearchActionUnionParam:
+ return vt.GetSources()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAction) GetPattern() *string {
+ switch vt := u.any.(type) {
+ case *BetaResponseFunctionWebSearchActionUnionParam:
+ return vt.GetPattern()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAction) GetCommand() []string {
+ switch vt := u.any.(type) {
+ case *BetaResponseInputItemLocalShellCallActionParam:
+ return vt.Command
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAction) GetEnv() map[string]string {
+ switch vt := u.any.(type) {
+ case *BetaResponseInputItemLocalShellCallActionParam:
+ return vt.Env
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAction) GetUser() *string {
+ switch vt := u.any.(type) {
+ case *BetaResponseInputItemLocalShellCallActionParam:
+ return paramutil.AddrIfPresent(vt.User)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAction) GetWorkingDirectory() *string {
+ switch vt := u.any.(type) {
+ case *BetaResponseInputItemLocalShellCallActionParam:
+ return paramutil.AddrIfPresent(vt.WorkingDirectory)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAction) GetCommands() []string {
+ switch vt := u.any.(type) {
+ case *BetaResponseInputItemShellCallActionParam:
+ return vt.Commands
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAction) GetMaxOutputLength() *int64 {
+ switch vt := u.any.(type) {
+ case *BetaResponseInputItemShellCallActionParam:
+ return paramutil.AddrIfPresent(vt.MaxOutputLength)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAction) GetType() *string {
+ switch vt := u.any.(type) {
+ case *BetaComputerActionUnionParam:
+ return vt.GetType()
+ case *BetaResponseFunctionWebSearchActionUnionParam:
+ return vt.GetType()
+ case *BetaResponseInputItemLocalShellCallActionParam:
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAction) GetX() *int64 {
+ switch vt := u.any.(type) {
+ case *BetaComputerActionUnionParam:
+ return vt.GetX()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAction) GetY() *int64 {
+ switch vt := u.any.(type) {
+ case *BetaComputerActionUnionParam:
+ return vt.GetY()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAction) GetURL() *string {
+ switch vt := u.any.(type) {
+ case *BetaResponseFunctionWebSearchActionUnionParam:
+ return vt.GetURL()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamAction) GetTimeoutMs() *int64 {
+ switch vt := u.any.(type) {
+ case *BetaResponseInputItemLocalShellCallActionParam:
+ return paramutil.AddrIfPresent(vt.TimeoutMs)
+ case *BetaResponseInputItemShellCallActionParam:
+ return paramutil.AddrIfPresent(vt.TimeoutMs)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's Keys property, if present.
+func (u betaResponseInputItemUnionParamAction) GetKeys() []string {
+ switch vt := u.any.(type) {
+ case *BetaComputerActionUnionParam:
+ return vt.GetKeys()
+ }
+ return nil
+}
+
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u BetaResponseInputItemUnionParam) GetOutput() (res betaResponseInputItemUnionParamOutput) {
+ if vt := u.OfComputerCallOutput; vt != nil {
+ res.any = &vt.Output
+ } else if vt := u.OfFunctionCallOutput; vt != nil {
+ res.any = vt.Output.asAny()
+ } else if vt := u.OfMultiAgentCallOutput; vt != nil {
+ res.any = &vt.Output
+ } else if vt := u.OfLocalShellCallOutput; vt != nil {
+ res.any = &vt.Output
+ } else if vt := u.OfShellCallOutput; vt != nil {
+ res.any = &vt.Output
+ } else if vt := u.OfApplyPatchCallOutput; vt != nil && vt.Output.Valid() {
+ res.any = &vt.Output.Value
+ } else if vt := u.OfMcpCall; vt != nil && vt.Output.Valid() {
+ res.any = &vt.Output.Value
+ } else if vt := u.OfCustomToolCallOutput; vt != nil {
+ res.any = vt.Output.asAny()
+ }
+ return
+}
+
+// Can have the runtime types [*BetaResponseComputerToolCallOutputScreenshotParam],
+// [*string], [*BetaResponseFunctionCallOutputItemListParam],
+// [_[]BetaResponseInputItemMultiAgentCallOutputOutputParam],
+// [_[]BetaResponseFunctionShellCallOutputContentParam],
+// [\*[]BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionParam]
+type betaResponseInputItemUnionParamOutput struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *openai.BetaResponseComputerToolCallOutputScreenshotParam:
+// case *string:
+// case *openai.BetaResponseFunctionCallOutputItemListParam:
+// case *[]openai.BetaResponseInputItemMultiAgentCallOutputOutputParam:
+// case *[]openai.BetaResponseFunctionShellCallOutputContentParam:
+// case *[]openai.BetaResponseCustomToolCallOutputOutputOutputContentListItemUnionParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u betaResponseInputItemUnionParamOutput) AsAny() any { return u.any }
+
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u BetaResponseInputItemUnionParam) GetArguments() (res betaResponseInputItemUnionParamArguments) {
+ if vt := u.OfFunctionCall; vt != nil {
+ res.any = &vt.Arguments
+ } else if vt := u.OfMultiAgentCall; vt != nil {
+ res.any = &vt.Arguments
+ } else if vt := u.OfToolSearchCall; vt != nil {
+ res.any = &vt.Arguments
+ } else if vt := u.OfMcpApprovalRequest; vt != nil {
+ res.any = &vt.Arguments
+ } else if vt := u.OfMcpCall; vt != nil {
+ res.any = &vt.Arguments
+ }
+ return
+}
+
+// Can have the runtime types [*string], [*any]
+type betaResponseInputItemUnionParamArguments struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *string:
+// case *any:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u betaResponseInputItemUnionParamArguments) AsAny() any { return u.any }
+
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u BetaResponseInputItemUnionParam) GetCaller() (res betaResponseInputItemUnionParamCaller) {
+ if vt := u.OfFunctionCall; vt != nil {
+ res.any = vt.Caller.asAny()
+ } else if vt := u.OfFunctionCallOutput; vt != nil {
+ res.any = vt.Caller.asAny()
+ } else if vt := u.OfShellCall; vt != nil {
+ res.any = vt.Caller.asAny()
+ } else if vt := u.OfShellCallOutput; vt != nil {
+ res.any = vt.Caller.asAny()
+ } else if vt := u.OfApplyPatchCall; vt != nil {
+ res.any = vt.Caller.asAny()
+ } else if vt := u.OfApplyPatchCallOutput; vt != nil {
+ res.any = vt.Caller.asAny()
+ } else if vt := u.OfCustomToolCallOutput; vt != nil {
+ res.any = vt.Caller.asAny()
+ } else if vt := u.OfCustomToolCall; vt != nil {
+ res.any = vt.Caller.asAny()
+ }
+ return
+}
+
+// Can have the runtime types [*BetaResponseFunctionToolCallCallerDirectParam],
+// [*BetaResponseFunctionToolCallCallerProgramParam],
+// [*BetaResponseInputItemFunctionCallOutputCallerDirectParam],
+// [*BetaResponseInputItemFunctionCallOutputCallerProgramParam],
+// [*BetaResponseInputItemShellCallCallerDirectParam],
+// [*BetaResponseInputItemShellCallCallerProgramParam],
+// [*BetaResponseInputItemShellCallOutputCallerDirectParam],
+// [*BetaResponseInputItemShellCallOutputCallerProgramParam],
+// [*BetaResponseInputItemApplyPatchCallCallerDirectParam],
+// [*BetaResponseInputItemApplyPatchCallCallerProgramParam],
+// [*BetaResponseInputItemApplyPatchCallOutputCallerDirectParam],
+// [*BetaResponseInputItemApplyPatchCallOutputCallerProgramParam],
+// [*BetaResponseCustomToolCallOutputCallerDirectParam],
+// [*BetaResponseCustomToolCallOutputCallerProgramParam],
+// [*BetaResponseCustomToolCallCallerDirectParam],
+// [*BetaResponseCustomToolCallCallerProgramParam]
+type betaResponseInputItemUnionParamCaller struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *openai.BetaResponseFunctionToolCallCallerDirectParam:
+// case *openai.BetaResponseFunctionToolCallCallerProgramParam:
+// case *openai.BetaResponseInputItemFunctionCallOutputCallerDirectParam:
+// case *openai.BetaResponseInputItemFunctionCallOutputCallerProgramParam:
+// case *openai.BetaResponseInputItemShellCallCallerDirectParam:
+// case *openai.BetaResponseInputItemShellCallCallerProgramParam:
+// case *openai.BetaResponseInputItemShellCallOutputCallerDirectParam:
+// case *openai.BetaResponseInputItemShellCallOutputCallerProgramParam:
+// case *openai.BetaResponseInputItemApplyPatchCallCallerDirectParam:
+// case *openai.BetaResponseInputItemApplyPatchCallCallerProgramParam:
+// case *openai.BetaResponseInputItemApplyPatchCallOutputCallerDirectParam:
+// case *openai.BetaResponseInputItemApplyPatchCallOutputCallerProgramParam:
+// case *openai.BetaResponseCustomToolCallOutputCallerDirectParam:
+// case *openai.BetaResponseCustomToolCallOutputCallerProgramParam:
+// case *openai.BetaResponseCustomToolCallCallerDirectParam:
+// case *openai.BetaResponseCustomToolCallCallerProgramParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u betaResponseInputItemUnionParamCaller) AsAny() any { return u.any }
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamCaller) GetType() *string {
+ switch vt := u.any.(type) {
+ case *BetaResponseFunctionToolCallCallerUnionParam:
+ return vt.GetType()
+ case *BetaResponseInputItemFunctionCallOutputCallerUnionParam:
+ return vt.GetType()
+ case *BetaResponseInputItemShellCallCallerUnionParam:
+ return vt.GetType()
+ case *BetaResponseInputItemShellCallOutputCallerUnionParam:
+ return vt.GetType()
+ case *BetaResponseInputItemApplyPatchCallCallerUnionParam:
+ return vt.GetType()
+ case *BetaResponseInputItemApplyPatchCallOutputCallerUnionParam:
+ return vt.GetType()
+ case *BetaResponseCustomToolCallOutputCallerUnionParam:
+ return vt.GetType()
+ case *BetaResponseCustomToolCallCallerUnionParam:
+ return vt.GetType()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemUnionParamCaller) GetCallerID() *string {
+ switch vt := u.any.(type) {
+ case *BetaResponseFunctionToolCallCallerUnionParam:
+ return vt.GetCallerID()
+ case *BetaResponseInputItemFunctionCallOutputCallerUnionParam:
+ return vt.GetCallerID()
+ case *BetaResponseInputItemShellCallCallerUnionParam:
+ return vt.GetCallerID()
+ case *BetaResponseInputItemShellCallOutputCallerUnionParam:
+ return vt.GetCallerID()
+ case *BetaResponseInputItemApplyPatchCallCallerUnionParam:
+ return vt.GetCallerID()
+ case *BetaResponseInputItemApplyPatchCallOutputCallerUnionParam:
+ return vt.GetCallerID()
+ case *BetaResponseCustomToolCallOutputCallerUnionParam:
+ return vt.GetCallerID()
+ case *BetaResponseCustomToolCallCallerUnionParam:
+ return vt.GetCallerID()
+ }
+ return nil
+}
+
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u BetaResponseInputItemUnionParam) GetTools() (res betaResponseInputItemUnionParamTools) {
+ if vt := u.OfToolSearchOutput; vt != nil {
+ res.any = &vt.Tools
+ } else if vt := u.OfAdditionalTools; vt != nil {
+ res.any = &vt.Tools
+ } else if vt := u.OfMcpListTools; vt != nil {
+ res.any = &vt.Tools
+ }
+ return
+}
+
+// Can have the runtime types [_[]BetaToolUnionParam],
+// [_[]BetaResponseInputItemMcpListToolsToolParam]
+type betaResponseInputItemUnionParamTools struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *[]openai.BetaToolUnionParam:
+// case *[]openai.BetaResponseInputItemMcpListToolsToolParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u betaResponseInputItemUnionParamTools) AsAny() any { return u.any }
+
+func init() {
+ apijson.RegisterUnion[BetaResponseInputItemUnionParam](
+ "type",
+ apijson.Discriminator[BetaEasyInputMessageParam]("message"),
+ apijson.Discriminator[BetaResponseInputItemMessageParam]("message"),
+ apijson.Discriminator[BetaResponseOutputMessageParam]("message"),
+ apijson.Discriminator[BetaResponseFileSearchToolCallParam]("file_search_call"),
+ apijson.Discriminator[BetaResponseComputerToolCallParam]("computer_call"),
+ apijson.Discriminator[BetaResponseInputItemComputerCallOutputParam]("computer_call_output"),
+ apijson.Discriminator[BetaResponseFunctionWebSearchParam]("web_search_call"),
+ apijson.Discriminator[BetaResponseFunctionToolCallParam]("function_call"),
+ apijson.Discriminator[BetaResponseInputItemFunctionCallOutputParam]("function_call_output"),
+ apijson.Discriminator[BetaResponseInputItemAgentMessageParam]("agent_message"),
+ apijson.Discriminator[BetaResponseInputItemMultiAgentCallParam]("multi_agent_call"),
+ apijson.Discriminator[BetaResponseInputItemMultiAgentCallOutputParam]("multi_agent_call_output"),
+ apijson.Discriminator[BetaResponseInputItemToolSearchCallParam]("tool_search_call"),
+ apijson.Discriminator[BetaResponseToolSearchOutputItemParam]("tool_search_output"),
+ apijson.Discriminator[BetaResponseInputItemAdditionalToolsParam]("additional_tools"),
+ apijson.Discriminator[BetaResponseReasoningItemParam]("reasoning"),
+ apijson.Discriminator[BetaResponseCompactionItemParam]("compaction"),
+ apijson.Discriminator[BetaResponseInputItemImageGenerationCallParam]("image_generation_call"),
+ apijson.Discriminator[BetaResponseCodeInterpreterToolCallParam]("code_interpreter_call"),
+ apijson.Discriminator[BetaResponseInputItemLocalShellCallParam]("local_shell_call"),
+ apijson.Discriminator[BetaResponseInputItemLocalShellCallOutputParam]("local_shell_call_output"),
+ apijson.Discriminator[BetaResponseInputItemShellCallParam]("shell_call"),
+ apijson.Discriminator[BetaResponseInputItemShellCallOutputParam]("shell_call_output"),
+ apijson.Discriminator[BetaResponseInputItemApplyPatchCallParam]("apply_patch_call"),
+ apijson.Discriminator[BetaResponseInputItemApplyPatchCallOutputParam]("apply_patch_call_output"),
+ apijson.Discriminator[BetaResponseInputItemMcpListToolsParam]("mcp_list_tools"),
+ apijson.Discriminator[BetaResponseInputItemMcpApprovalRequestParam]("mcp_approval_request"),
+ apijson.Discriminator[BetaResponseInputItemMcpApprovalResponseParam]("mcp_approval_response"),
+ apijson.Discriminator[BetaResponseInputItemMcpCallParam]("mcp_call"),
+ apijson.Discriminator[BetaResponseCustomToolCallOutputParam]("custom_tool_call_output"),
+ apijson.Discriminator[BetaResponseCustomToolCallParam]("custom_tool_call"),
+ apijson.Discriminator[BetaResponseInputItemCompactionTriggerParam]("compaction_trigger"),
+ apijson.Discriminator[BetaResponseInputItemItemReferenceParam]("item_reference"),
+ apijson.Discriminator[BetaResponseInputItemProgramParam]("program"),
+ apijson.Discriminator[BetaResponseInputItemProgramOutputParam]("program_output"),
+ )
+}
+
+// A message input to the model with a role indicating instruction following
+// hierarchy. Instructions given with the `developer` or `system` role take
+// precedence over instructions given with the `user` role.
+//
+// The properties Content, Role are required.
+type BetaResponseInputItemMessageParam struct {
+ // A list of one or many input items to the model, containing different content
+ // types.
+ Content BetaResponseInputMessageContentListParam `json:"content,omitzero" api:"required"`
+ // The role of the message input. One of `user`, `system`, or `developer`.
+ //
+ // Any of "user", "system", "developer".
+ Role string `json:"role,omitzero" api:"required"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemMessageAgentParam `json:"agent,omitzero"`
+ // The status of item. One of `in_progress`, `completed`, or `incomplete`.
+ // Populated when items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status,omitzero"`
+ // The type of the message input. Always set to `message`.
+ //
+ // Any of "message".
+ Type string `json:"type,omitzero"`
+ paramObj
+}
+
+func (r BetaResponseInputItemMessageParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemMessageParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemMessageParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseInputItemMessageParam](
+ "role", "user", "system", "developer",
+ )
+ apijson.RegisterFieldValidator[BetaResponseInputItemMessageParam](
+ "status", "in_progress", "completed", "incomplete",
+ )
+ apijson.RegisterFieldValidator[BetaResponseInputItemMessageParam](
+ "type", "message",
+ )
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemMessageAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemMessageAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemMessageAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemMessageAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The output of a computer tool call.
+//
+// The properties CallID, Output, Type are required.
+type BetaResponseInputItemComputerCallOutputParam struct {
+ // The ID of the computer tool call that produced the output.
+ CallID string `json:"call_id" api:"required"`
+ // A computer screenshot image used with the computer use tool.
+ Output BetaResponseComputerToolCallOutputScreenshotParam `json:"output,omitzero" api:"required"`
+ // The ID of the computer tool call output.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // The safety checks reported by the API that have been acknowledged by the
+ // developer.
+ AcknowledgedSafetyChecks []BetaResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam `json:"acknowledged_safety_checks,omitzero"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemComputerCallOutputAgentParam `json:"agent,omitzero"`
+ // The status of the message input. One of `in_progress`, `completed`, or
+ // `incomplete`. Populated when input items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status,omitzero"`
+ // The type of the computer tool call output. Always `computer_call_output`.
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "computer_call_output".
+ Type constant.ComputerCallOutput `json:"type" default:"computer_call_output"`
+ paramObj
+}
+
+func (r BetaResponseInputItemComputerCallOutputParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemComputerCallOutputParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemComputerCallOutputParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseInputItemComputerCallOutputParam](
+ "status", "in_progress", "completed", "incomplete",
+ )
+}
+
+// A pending safety check for the computer call.
+//
+// The property ID is required.
+type BetaResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam struct {
+ // The ID of the pending safety check.
+ ID string `json:"id" api:"required"`
+ // The type of the pending safety check.
+ Code param.Opt[string] `json:"code,omitzero"`
+ // Details about the pending safety check.
+ Message param.Opt[string] `json:"message,omitzero"`
+ paramObj
+}
+
+func (r BetaResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemComputerCallOutputAcknowledgedSafetyCheckParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemComputerCallOutputAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemComputerCallOutputAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemComputerCallOutputAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemComputerCallOutputAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The output of a function tool call.
+//
+// The properties CallID, Output, Type are required.
+type BetaResponseInputItemFunctionCallOutputParam struct {
+ // The unique ID of the function tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // Text, image, or file output of the function tool call.
+ Output BetaResponseInputItemFunctionCallOutputOutputUnionParam `json:"output,omitzero" api:"required"`
+ // The unique ID of the function tool call output. Populated when this item is
+ // returned via API.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemFunctionCallOutputAgentParam `json:"agent,omitzero"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseInputItemFunctionCallOutputCallerUnionParam `json:"caller,omitzero"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ // Populated when items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status,omitzero"`
+ // The type of the function tool call output. Always `function_call_output`.
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "function_call_output".
+ Type constant.FunctionCallOutput `json:"type" default:"function_call_output"`
+ paramObj
+}
+
+func (r BetaResponseInputItemFunctionCallOutputParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemFunctionCallOutputParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemFunctionCallOutputParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseInputItemFunctionCallOutputParam](
+ "status", "in_progress", "completed", "incomplete",
+ )
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseInputItemFunctionCallOutputOutputUnionParam struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfBetaResponseFunctionCallOutputItemArray BetaResponseFunctionCallOutputItemListParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseInputItemFunctionCallOutputOutputUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfBetaResponseFunctionCallOutputItemArray)
+}
+func (u *BetaResponseInputItemFunctionCallOutputOutputUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseInputItemFunctionCallOutputOutputUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfBetaResponseFunctionCallOutputItemArray) {
+ return &u.OfBetaResponseFunctionCallOutputItemArray
+ }
+ return nil
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemFunctionCallOutputAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemFunctionCallOutputAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemFunctionCallOutputAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemFunctionCallOutputAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseInputItemFunctionCallOutputCallerUnionParam struct {
+ OfDirect *BetaResponseInputItemFunctionCallOutputCallerDirectParam `json:",omitzero,inline"`
+ OfProgram *BetaResponseInputItemFunctionCallOutputCallerProgramParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseInputItemFunctionCallOutputCallerUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfDirect, u.OfProgram)
+}
+func (u *BetaResponseInputItemFunctionCallOutputCallerUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseInputItemFunctionCallOutputCallerUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfDirect) {
+ return u.OfDirect
+ } else if !param.IsOmitted(u.OfProgram) {
+ return u.OfProgram
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemFunctionCallOutputCallerUnionParam) GetCallerID() *string {
+ if vt := u.OfProgram; vt != nil {
+ return &vt.CallerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemFunctionCallOutputCallerUnionParam) GetType() *string {
+ if vt := u.OfDirect; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseInputItemFunctionCallOutputCallerUnionParam](
+ "type",
+ apijson.Discriminator[BetaResponseInputItemFunctionCallOutputCallerDirectParam]("direct"),
+ apijson.Discriminator[BetaResponseInputItemFunctionCallOutputCallerProgramParam]("program"),
+ )
+}
+
+func NewBetaResponseInputItemFunctionCallOutputCallerDirectParam() BetaResponseInputItemFunctionCallOutputCallerDirectParam {
+ return BetaResponseInputItemFunctionCallOutputCallerDirectParam{
+ Type: "direct",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewBetaResponseInputItemFunctionCallOutputCallerDirectParam].
+type BetaResponseInputItemFunctionCallOutputCallerDirectParam struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ paramObj
+}
+
+func (r BetaResponseInputItemFunctionCallOutputCallerDirectParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemFunctionCallOutputCallerDirectParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemFunctionCallOutputCallerDirectParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties CallerID, Type are required.
+type BetaResponseInputItemFunctionCallOutputCallerProgramParam struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ //
+ // This field can be elided, and will marshal its zero value as "program".
+ Type constant.Program `json:"type" default:"program"`
+ paramObj
+}
+
+func (r BetaResponseInputItemFunctionCallOutputCallerProgramParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemFunctionCallOutputCallerProgramParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemFunctionCallOutputCallerProgramParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A message routed between agents.
+//
+// The properties Author, Content, Recipient, Type are required.
+type BetaResponseInputItemAgentMessageParam struct {
+ // The sending agent identity.
+ Author string `json:"author" api:"required"`
+ // Plaintext, image, or encrypted content sent between agents.
+ Content []BetaResponseInputItemAgentMessageContentUnionParam `json:"content,omitzero" api:"required"`
+ // The destination agent identity.
+ Recipient string `json:"recipient" api:"required"`
+ // The unique ID of this agent message item.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemAgentMessageAgentParam `json:"agent,omitzero"`
+ // The item type. Always `agent_message`.
+ //
+ // This field can be elided, and will marshal its zero value as "agent_message".
+ Type constant.AgentMessage `json:"type" default:"agent_message"`
+ paramObj
+}
+
+func (r BetaResponseInputItemAgentMessageParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemAgentMessageParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemAgentMessageParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseInputItemAgentMessageContentUnionParam struct {
+ OfInputText *BetaResponseInputTextContentParam `json:",omitzero,inline"`
+ OfInputImage *BetaResponseInputImageContentParam `json:",omitzero,inline"`
+ OfEncryptedContent *BetaResponseInputItemAgentMessageContentEncryptedContentParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseInputItemAgentMessageContentUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfInputText, u.OfInputImage, u.OfEncryptedContent)
+}
+func (u *BetaResponseInputItemAgentMessageContentUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseInputItemAgentMessageContentUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfInputText) {
+ return u.OfInputText
+ } else if !param.IsOmitted(u.OfInputImage) {
+ return u.OfInputImage
+ } else if !param.IsOmitted(u.OfEncryptedContent) {
+ return u.OfEncryptedContent
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemAgentMessageContentUnionParam) GetText() *string {
+ if vt := u.OfInputText; vt != nil {
+ return &vt.Text
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemAgentMessageContentUnionParam) GetDetail() *string {
+ if vt := u.OfInputImage; vt != nil {
+ return (*string)(&vt.Detail)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemAgentMessageContentUnionParam) GetFileID() *string {
+ if vt := u.OfInputImage; vt != nil && vt.FileID.Valid() {
+ return &vt.FileID.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemAgentMessageContentUnionParam) GetImageURL() *string {
+ if vt := u.OfInputImage; vt != nil && vt.ImageURL.Valid() {
+ return &vt.ImageURL.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemAgentMessageContentUnionParam) GetEncryptedContent() *string {
+ if vt := u.OfEncryptedContent; vt != nil {
+ return &vt.EncryptedContent
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemAgentMessageContentUnionParam) GetType() *string {
+ if vt := u.OfInputText; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfInputImage; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfEncryptedContent; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u BetaResponseInputItemAgentMessageContentUnionParam) GetPromptCacheBreakpoint() (res betaResponseInputItemAgentMessageContentUnionParamPromptCacheBreakpoint) {
+ if vt := u.OfInputText; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ } else if vt := u.OfInputImage; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ }
+ return
+}
+
+// Can have the runtime types
+// [*BetaResponseInputTextContentPromptCacheBreakpointParam],
+// [*BetaResponseInputImageContentPromptCacheBreakpointParam]
+type betaResponseInputItemAgentMessageContentUnionParamPromptCacheBreakpoint struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *openai.BetaResponseInputTextContentPromptCacheBreakpointParam:
+// case *openai.BetaResponseInputImageContentPromptCacheBreakpointParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u betaResponseInputItemAgentMessageContentUnionParamPromptCacheBreakpoint) AsAny() any {
+ return u.any
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponseInputItemAgentMessageContentUnionParamPromptCacheBreakpoint) GetMode() *string {
+ switch vt := u.any.(type) {
+ case *BetaResponseInputTextContentPromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ case *BetaResponseInputImageContentPromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseInputItemAgentMessageContentUnionParam](
+ "type",
+ apijson.Discriminator[BetaResponseInputTextContentParam]("input_text"),
+ apijson.Discriminator[BetaResponseInputImageContentParam]("input_image"),
+ apijson.Discriminator[BetaResponseInputItemAgentMessageContentEncryptedContentParam]("encrypted_content"),
+ )
+}
+
+// Opaque encrypted content that Responses API decrypts inside trusted model
+// execution.
+//
+// The properties EncryptedContent, Type are required.
+type BetaResponseInputItemAgentMessageContentEncryptedContentParam struct {
+ // Opaque encrypted content.
+ EncryptedContent string `json:"encrypted_content" api:"required"`
+ // The type of the input item. Always `encrypted_content`.
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "encrypted_content".
+ Type constant.EncryptedContent `json:"type" default:"encrypted_content"`
+ paramObj
+}
+
+func (r BetaResponseInputItemAgentMessageContentEncryptedContentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemAgentMessageContentEncryptedContentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemAgentMessageContentEncryptedContentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemAgentMessageAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemAgentMessageAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemAgentMessageAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemAgentMessageAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties Action, Arguments, CallID, Type are required.
+type BetaResponseInputItemMultiAgentCallParam struct {
+ // The multi-agent action that was executed.
+ //
+ // Any of "spawn_agent", "interrupt_agent", "list_agents", "send_message",
+ // "followup_task", "wait_agent".
+ Action string `json:"action,omitzero" api:"required"`
+ // The action arguments as a JSON string.
+ Arguments string `json:"arguments" api:"required"`
+ // The unique ID linking this call to its output.
+ CallID string `json:"call_id" api:"required"`
+ // The unique ID of this multi-agent call.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemMultiAgentCallAgentParam `json:"agent,omitzero"`
+ // The item type. Always `multi_agent_call`.
+ //
+ // This field can be elided, and will marshal its zero value as "multi_agent_call".
+ Type constant.MultiAgentCall `json:"type" default:"multi_agent_call"`
+ paramObj
+}
+
+func (r BetaResponseInputItemMultiAgentCallParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemMultiAgentCallParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemMultiAgentCallParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseInputItemMultiAgentCallParam](
+ "action", "spawn_agent", "interrupt_agent", "list_agents", "send_message", "followup_task", "wait_agent",
+ )
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemMultiAgentCallAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemMultiAgentCallAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemMultiAgentCallAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemMultiAgentCallAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties Action, CallID, Output, Type are required.
+type BetaResponseInputItemMultiAgentCallOutputParam struct {
+ // The multi-agent action that produced this result.
+ //
+ // Any of "spawn_agent", "interrupt_agent", "list_agents", "send_message",
+ // "followup_task", "wait_agent".
+ Action string `json:"action,omitzero" api:"required"`
+ // The unique ID of the multi-agent call.
+ CallID string `json:"call_id" api:"required"`
+ // Text output returned by the multi-agent action.
+ Output []BetaResponseInputItemMultiAgentCallOutputOutputParam `json:"output,omitzero" api:"required"`
+ // The unique ID of this multi-agent call output.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemMultiAgentCallOutputAgentParam `json:"agent,omitzero"`
+ // The item type. Always `multi_agent_call_output`.
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "multi_agent_call_output".
+ Type constant.MultiAgentCallOutput `json:"type" default:"multi_agent_call_output"`
+ paramObj
+}
+
+func (r BetaResponseInputItemMultiAgentCallOutputParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemMultiAgentCallOutputParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemMultiAgentCallOutputParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseInputItemMultiAgentCallOutputParam](
+ "action", "spawn_agent", "interrupt_agent", "list_agents", "send_message", "followup_task", "wait_agent",
+ )
+}
+
+// The properties Text, Type are required.
+type BetaResponseInputItemMultiAgentCallOutputOutputParam struct {
+ // The text content.
+ Text string `json:"text" api:"required"`
+ // Citations associated with the text content.
+ Annotations []BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnionParam `json:"annotations,omitzero"`
+ // The content type. Always `output_text`.
+ //
+ // This field can be elided, and will marshal its zero value as "output_text".
+ Type constant.OutputText `json:"type" default:"output_text"`
+ paramObj
+}
+
+func (r BetaResponseInputItemMultiAgentCallOutputOutputParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemMultiAgentCallOutputOutputParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemMultiAgentCallOutputOutputParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnionParam struct {
+ OfFileCitation *BetaResponseInputItemMultiAgentCallOutputOutputAnnotationFileCitationParam `json:",omitzero,inline"`
+ OfURLCitation *BetaResponseInputItemMultiAgentCallOutputOutputAnnotationURLCitationParam `json:",omitzero,inline"`
+ OfContainerFileCitation *BetaResponseInputItemMultiAgentCallOutputOutputAnnotationContainerFileCitationParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfFileCitation, u.OfURLCitation, u.OfContainerFileCitation)
+}
+func (u *BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfFileCitation) {
+ return u.OfFileCitation
+ } else if !param.IsOmitted(u.OfURLCitation) {
+ return u.OfURLCitation
+ } else if !param.IsOmitted(u.OfContainerFileCitation) {
+ return u.OfContainerFileCitation
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnionParam) GetIndex() *int64 {
+ if vt := u.OfFileCitation; vt != nil {
+ return &vt.Index
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnionParam) GetTitle() *string {
+ if vt := u.OfURLCitation; vt != nil {
+ return &vt.Title
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnionParam) GetURL() *string {
+ if vt := u.OfURLCitation; vt != nil {
+ return &vt.URL
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnionParam) GetContainerID() *string {
+ if vt := u.OfContainerFileCitation; vt != nil {
+ return &vt.ContainerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnionParam) GetFileID() *string {
+ if vt := u.OfFileCitation; vt != nil {
+ return (*string)(&vt.FileID)
+ } else if vt := u.OfContainerFileCitation; vt != nil {
+ return (*string)(&vt.FileID)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnionParam) GetFilename() *string {
+ if vt := u.OfFileCitation; vt != nil {
+ return (*string)(&vt.Filename)
+ } else if vt := u.OfContainerFileCitation; vt != nil {
+ return (*string)(&vt.Filename)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnionParam) GetType() *string {
+ if vt := u.OfFileCitation; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfURLCitation; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfContainerFileCitation; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnionParam) GetEndIndex() *int64 {
+ if vt := u.OfURLCitation; vt != nil {
+ return (*int64)(&vt.EndIndex)
+ } else if vt := u.OfContainerFileCitation; vt != nil {
+ return (*int64)(&vt.EndIndex)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnionParam) GetStartIndex() *int64 {
+ if vt := u.OfURLCitation; vt != nil {
+ return (*int64)(&vt.StartIndex)
+ } else if vt := u.OfContainerFileCitation; vt != nil {
+ return (*int64)(&vt.StartIndex)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseInputItemMultiAgentCallOutputOutputAnnotationUnionParam](
+ "type",
+ apijson.Discriminator[BetaResponseInputItemMultiAgentCallOutputOutputAnnotationFileCitationParam]("file_citation"),
+ apijson.Discriminator[BetaResponseInputItemMultiAgentCallOutputOutputAnnotationURLCitationParam]("url_citation"),
+ apijson.Discriminator[BetaResponseInputItemMultiAgentCallOutputOutputAnnotationContainerFileCitationParam]("container_file_citation"),
+ )
+}
+
+// The properties FileID, Filename, Index, Type are required.
+type BetaResponseInputItemMultiAgentCallOutputOutputAnnotationFileCitationParam struct {
+ // The ID of the file.
+ FileID string `json:"file_id" api:"required"`
+ // The filename of the file cited.
+ Filename string `json:"filename" api:"required"`
+ // The index of the file in the list of files.
+ Index int64 `json:"index" api:"required"`
+ // The citation type. Always `file_citation`.
+ //
+ // This field can be elided, and will marshal its zero value as "file_citation".
+ Type constant.FileCitation `json:"type" default:"file_citation"`
+ paramObj
+}
+
+func (r BetaResponseInputItemMultiAgentCallOutputOutputAnnotationFileCitationParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemMultiAgentCallOutputOutputAnnotationFileCitationParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemMultiAgentCallOutputOutputAnnotationFileCitationParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties EndIndex, StartIndex, Title, Type, URL are required.
+type BetaResponseInputItemMultiAgentCallOutputOutputAnnotationURLCitationParam struct {
+ // The index of the last character of the citation in the message.
+ EndIndex int64 `json:"end_index" api:"required"`
+ // The index of the first character of the citation in the message.
+ StartIndex int64 `json:"start_index" api:"required"`
+ // The title of the cited resource.
+ Title string `json:"title" api:"required"`
+ // The URL of the cited resource.
+ URL string `json:"url" api:"required" format:"uri"`
+ // The citation type. Always `url_citation`.
+ //
+ // This field can be elided, and will marshal its zero value as "url_citation".
+ Type constant.URLCitation `json:"type" default:"url_citation"`
+ paramObj
+}
+
+func (r BetaResponseInputItemMultiAgentCallOutputOutputAnnotationURLCitationParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemMultiAgentCallOutputOutputAnnotationURLCitationParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemMultiAgentCallOutputOutputAnnotationURLCitationParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties ContainerID, EndIndex, FileID, Filename, StartIndex, Type are
+// required.
+type BetaResponseInputItemMultiAgentCallOutputOutputAnnotationContainerFileCitationParam struct {
+ // The ID of the container.
+ ContainerID string `json:"container_id" api:"required"`
+ // The index of the last character of the citation in the message.
+ EndIndex int64 `json:"end_index" api:"required"`
+ // The ID of the container file.
+ FileID string `json:"file_id" api:"required"`
+ // The filename of the container file cited.
+ Filename string `json:"filename" api:"required"`
+ // The index of the first character of the citation in the message.
+ StartIndex int64 `json:"start_index" api:"required"`
+ // The citation type. Always `container_file_citation`.
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "container_file_citation".
+ Type constant.ContainerFileCitation `json:"type" default:"container_file_citation"`
+ paramObj
+}
+
+func (r BetaResponseInputItemMultiAgentCallOutputOutputAnnotationContainerFileCitationParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemMultiAgentCallOutputOutputAnnotationContainerFileCitationParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemMultiAgentCallOutputOutputAnnotationContainerFileCitationParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemMultiAgentCallOutputAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemMultiAgentCallOutputAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemMultiAgentCallOutputAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemMultiAgentCallOutputAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties Arguments, Type are required.
+type BetaResponseInputItemToolSearchCallParam struct {
+ // The arguments supplied to the tool search call.
+ Arguments any `json:"arguments,omitzero" api:"required"`
+ // The unique ID of this tool search call.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // The unique ID of the tool search call generated by the model.
+ CallID param.Opt[string] `json:"call_id,omitzero"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemToolSearchCallAgentParam `json:"agent,omitzero"`
+ // The status of the tool search call.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status,omitzero"`
+ // Whether tool search was executed by the server or by the client.
+ //
+ // Any of "server", "client".
+ Execution string `json:"execution,omitzero"`
+ // The item type. Always `tool_search_call`.
+ //
+ // This field can be elided, and will marshal its zero value as "tool_search_call".
+ Type constant.ToolSearchCall `json:"type" default:"tool_search_call"`
+ paramObj
+}
+
+func (r BetaResponseInputItemToolSearchCallParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemToolSearchCallParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemToolSearchCallParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseInputItemToolSearchCallParam](
+ "execution", "server", "client",
+ )
+ apijson.RegisterFieldValidator[BetaResponseInputItemToolSearchCallParam](
+ "status", "in_progress", "completed", "incomplete",
+ )
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemToolSearchCallAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemToolSearchCallAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemToolSearchCallAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemToolSearchCallAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties Role, Tools, Type are required.
+type BetaResponseInputItemAdditionalToolsParam struct {
+ // A list of additional tools made available at this item.
+ Tools []BetaToolUnionParam `json:"tools,omitzero" api:"required"`
+ // The unique ID of this additional tools item.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemAdditionalToolsAgentParam `json:"agent,omitzero"`
+ // The role that provided the additional tools. Only `developer` is supported.
+ //
+ // This field can be elided, and will marshal its zero value as "developer".
+ Role constant.Developer `json:"role" default:"developer"`
+ // The item type. Always `additional_tools`.
+ //
+ // This field can be elided, and will marshal its zero value as "additional_tools".
+ Type constant.AdditionalTools `json:"type" default:"additional_tools"`
+ paramObj
+}
+
+func (r BetaResponseInputItemAdditionalToolsParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemAdditionalToolsParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemAdditionalToolsParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemAdditionalToolsAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemAdditionalToolsAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemAdditionalToolsAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemAdditionalToolsAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An image generation request made by the model.
+//
+// The properties ID, Result, Status, Type are required.
+type BetaResponseInputItemImageGenerationCallParam struct {
+ // The generated image encoded in base64.
+ Result param.Opt[string] `json:"result,omitzero" api:"required"`
+ // The unique ID of the image generation call.
+ ID string `json:"id" api:"required"`
+ // The status of the image generation call.
+ //
+ // Any of "in_progress", "completed", "generating", "failed".
+ Status string `json:"status,omitzero" api:"required"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemImageGenerationCallAgentParam `json:"agent,omitzero"`
+ // The type of the image generation call. Always `image_generation_call`.
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "image_generation_call".
+ Type constant.ImageGenerationCall `json:"type" default:"image_generation_call"`
+ paramObj
+}
+
+func (r BetaResponseInputItemImageGenerationCallParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemImageGenerationCallParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemImageGenerationCallParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseInputItemImageGenerationCallParam](
+ "status", "in_progress", "completed", "generating", "failed",
+ )
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemImageGenerationCallAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemImageGenerationCallAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemImageGenerationCallAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemImageGenerationCallAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool call to run a command on the local shell.
+//
+// The properties ID, Action, CallID, Status, Type are required.
+type BetaResponseInputItemLocalShellCallParam struct {
+ // The unique ID of the local shell call.
+ ID string `json:"id" api:"required"`
+ // Execute a shell command on the server.
+ Action BetaResponseInputItemLocalShellCallActionParam `json:"action,omitzero" api:"required"`
+ // The unique ID of the local shell tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // The status of the local shell call.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status,omitzero" api:"required"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemLocalShellCallAgentParam `json:"agent,omitzero"`
+ // The type of the local shell call. Always `local_shell_call`.
+ //
+ // This field can be elided, and will marshal its zero value as "local_shell_call".
+ Type constant.LocalShellCall `json:"type" default:"local_shell_call"`
+ paramObj
+}
+
+func (r BetaResponseInputItemLocalShellCallParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemLocalShellCallParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemLocalShellCallParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseInputItemLocalShellCallParam](
+ "status", "in_progress", "completed", "incomplete",
+ )
+}
+
+// Execute a shell command on the server.
+//
+// The properties Command, Env, Type are required.
+type BetaResponseInputItemLocalShellCallActionParam struct {
+ // The command to run.
+ Command []string `json:"command,omitzero" api:"required"`
+ // Environment variables to set for the command.
+ Env map[string]string `json:"env,omitzero" api:"required"`
+ // Optional timeout in milliseconds for the command.
+ TimeoutMs param.Opt[int64] `json:"timeout_ms,omitzero"`
+ // Optional user to run the command as.
+ User param.Opt[string] `json:"user,omitzero"`
+ // Optional working directory to run the command in.
+ WorkingDirectory param.Opt[string] `json:"working_directory,omitzero"`
+ // The type of the local shell action. Always `exec`.
+ //
+ // This field can be elided, and will marshal its zero value as "exec".
+ Type constant.Exec `json:"type" default:"exec"`
+ paramObj
+}
+
+func (r BetaResponseInputItemLocalShellCallActionParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemLocalShellCallActionParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemLocalShellCallActionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemLocalShellCallAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemLocalShellCallAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemLocalShellCallAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemLocalShellCallAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The output of a local shell tool call.
+//
+// The properties ID, Output, Type are required.
+type BetaResponseInputItemLocalShellCallOutputParam struct {
+ // The unique ID of the local shell tool call generated by the model.
+ ID string `json:"id" api:"required"`
+ // A JSON string of the output of the local shell tool call.
+ Output string `json:"output" api:"required"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemLocalShellCallOutputAgentParam `json:"agent,omitzero"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status,omitzero"`
+ // The type of the local shell tool call output. Always `local_shell_call_output`.
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "local_shell_call_output".
+ Type constant.LocalShellCallOutput `json:"type" default:"local_shell_call_output"`
+ paramObj
+}
+
+func (r BetaResponseInputItemLocalShellCallOutputParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemLocalShellCallOutputParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemLocalShellCallOutputParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseInputItemLocalShellCallOutputParam](
+ "status", "in_progress", "completed", "incomplete",
+ )
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemLocalShellCallOutputAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemLocalShellCallOutputAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemLocalShellCallOutputAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemLocalShellCallOutputAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool representing a request to execute one or more shell commands.
+//
+// The properties Action, CallID, Type are required.
+type BetaResponseInputItemShellCallParam struct {
+ // The shell commands and limits that describe how to run the tool call.
+ Action BetaResponseInputItemShellCallActionParam `json:"action,omitzero" api:"required"`
+ // The unique ID of the shell tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // The unique ID of the shell tool call. Populated when this item is returned via
+ // API.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemShellCallAgentParam `json:"agent,omitzero"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseInputItemShellCallCallerUnionParam `json:"caller,omitzero"`
+ // The environment to execute the shell commands in.
+ Environment BetaResponseInputItemShellCallEnvironmentUnionParam `json:"environment,omitzero"`
+ // The status of the shell call. One of `in_progress`, `completed`, or
+ // `incomplete`.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status,omitzero"`
+ // The type of the item. Always `shell_call`.
+ //
+ // This field can be elided, and will marshal its zero value as "shell_call".
+ Type constant.ShellCall `json:"type" default:"shell_call"`
+ paramObj
+}
+
+func (r BetaResponseInputItemShellCallParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemShellCallParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemShellCallParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseInputItemShellCallParam](
+ "status", "in_progress", "completed", "incomplete",
+ )
+}
+
+// The shell commands and limits that describe how to run the tool call.
+//
+// The property Commands is required.
+type BetaResponseInputItemShellCallActionParam struct {
+ // Ordered shell commands for the execution environment to run.
+ Commands []string `json:"commands,omitzero" api:"required"`
+ // Maximum number of UTF-8 characters to capture from combined stdout and stderr
+ // output.
+ MaxOutputLength param.Opt[int64] `json:"max_output_length,omitzero"`
+ // Maximum wall-clock time in milliseconds to allow the shell commands to run.
+ TimeoutMs param.Opt[int64] `json:"timeout_ms,omitzero"`
+ paramObj
+}
+
+func (r BetaResponseInputItemShellCallActionParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemShellCallActionParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemShellCallActionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemShellCallAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemShellCallAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemShellCallAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemShellCallAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseInputItemShellCallCallerUnionParam struct {
+ OfDirect *BetaResponseInputItemShellCallCallerDirectParam `json:",omitzero,inline"`
+ OfProgram *BetaResponseInputItemShellCallCallerProgramParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseInputItemShellCallCallerUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfDirect, u.OfProgram)
+}
+func (u *BetaResponseInputItemShellCallCallerUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseInputItemShellCallCallerUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfDirect) {
+ return u.OfDirect
+ } else if !param.IsOmitted(u.OfProgram) {
+ return u.OfProgram
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemShellCallCallerUnionParam) GetCallerID() *string {
+ if vt := u.OfProgram; vt != nil {
+ return &vt.CallerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemShellCallCallerUnionParam) GetType() *string {
+ if vt := u.OfDirect; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseInputItemShellCallCallerUnionParam](
+ "type",
+ apijson.Discriminator[BetaResponseInputItemShellCallCallerDirectParam]("direct"),
+ apijson.Discriminator[BetaResponseInputItemShellCallCallerProgramParam]("program"),
+ )
+}
+
+func NewBetaResponseInputItemShellCallCallerDirectParam() BetaResponseInputItemShellCallCallerDirectParam {
+ return BetaResponseInputItemShellCallCallerDirectParam{
+ Type: "direct",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewBetaResponseInputItemShellCallCallerDirectParam].
+type BetaResponseInputItemShellCallCallerDirectParam struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ paramObj
+}
+
+func (r BetaResponseInputItemShellCallCallerDirectParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemShellCallCallerDirectParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemShellCallCallerDirectParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties CallerID, Type are required.
+type BetaResponseInputItemShellCallCallerProgramParam struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ //
+ // This field can be elided, and will marshal its zero value as "program".
+ Type constant.Program `json:"type" default:"program"`
+ paramObj
+}
+
+func (r BetaResponseInputItemShellCallCallerProgramParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemShellCallCallerProgramParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemShellCallCallerProgramParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseInputItemShellCallEnvironmentUnionParam struct {
+ OfLocal *BetaLocalEnvironmentParam `json:",omitzero,inline"`
+ OfContainerReference *BetaContainerReferenceParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseInputItemShellCallEnvironmentUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfLocal, u.OfContainerReference)
+}
+func (u *BetaResponseInputItemShellCallEnvironmentUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseInputItemShellCallEnvironmentUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfLocal) {
+ return u.OfLocal
+ } else if !param.IsOmitted(u.OfContainerReference) {
+ return u.OfContainerReference
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemShellCallEnvironmentUnionParam) GetSkills() []BetaLocalSkillParam {
+ if vt := u.OfLocal; vt != nil {
+ return vt.Skills
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemShellCallEnvironmentUnionParam) GetContainerID() *string {
+ if vt := u.OfContainerReference; vt != nil {
+ return &vt.ContainerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemShellCallEnvironmentUnionParam) GetType() *string {
+ if vt := u.OfLocal; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfContainerReference; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseInputItemShellCallEnvironmentUnionParam](
+ "type",
+ apijson.Discriminator[BetaLocalEnvironmentParam]("local"),
+ apijson.Discriminator[BetaContainerReferenceParam]("container_reference"),
+ )
+}
+
+// The streamed output items emitted by a shell tool call.
+//
+// The properties CallID, Output, Type are required.
+type BetaResponseInputItemShellCallOutputParam struct {
+ // The unique ID of the shell tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // Captured chunks of stdout and stderr output, along with their associated
+ // outcomes.
+ Output []BetaResponseFunctionShellCallOutputContentParam `json:"output,omitzero" api:"required"`
+ // The unique ID of the shell tool call output. Populated when this item is
+ // returned via API.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // The maximum number of UTF-8 characters captured for this shell call's combined
+ // output.
+ MaxOutputLength param.Opt[int64] `json:"max_output_length,omitzero"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemShellCallOutputAgentParam `json:"agent,omitzero"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseInputItemShellCallOutputCallerUnionParam `json:"caller,omitzero"`
+ // The status of the shell call output.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status,omitzero"`
+ // The type of the item. Always `shell_call_output`.
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "shell_call_output".
+ Type constant.ShellCallOutput `json:"type" default:"shell_call_output"`
+ paramObj
+}
+
+func (r BetaResponseInputItemShellCallOutputParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemShellCallOutputParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemShellCallOutputParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseInputItemShellCallOutputParam](
+ "status", "in_progress", "completed", "incomplete",
+ )
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemShellCallOutputAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemShellCallOutputAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemShellCallOutputAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemShellCallOutputAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseInputItemShellCallOutputCallerUnionParam struct {
+ OfDirect *BetaResponseInputItemShellCallOutputCallerDirectParam `json:",omitzero,inline"`
+ OfProgram *BetaResponseInputItemShellCallOutputCallerProgramParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseInputItemShellCallOutputCallerUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfDirect, u.OfProgram)
+}
+func (u *BetaResponseInputItemShellCallOutputCallerUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseInputItemShellCallOutputCallerUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfDirect) {
+ return u.OfDirect
+ } else if !param.IsOmitted(u.OfProgram) {
+ return u.OfProgram
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemShellCallOutputCallerUnionParam) GetCallerID() *string {
+ if vt := u.OfProgram; vt != nil {
+ return &vt.CallerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemShellCallOutputCallerUnionParam) GetType() *string {
+ if vt := u.OfDirect; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseInputItemShellCallOutputCallerUnionParam](
+ "type",
+ apijson.Discriminator[BetaResponseInputItemShellCallOutputCallerDirectParam]("direct"),
+ apijson.Discriminator[BetaResponseInputItemShellCallOutputCallerProgramParam]("program"),
+ )
+}
+
+func NewBetaResponseInputItemShellCallOutputCallerDirectParam() BetaResponseInputItemShellCallOutputCallerDirectParam {
+ return BetaResponseInputItemShellCallOutputCallerDirectParam{
+ Type: "direct",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewBetaResponseInputItemShellCallOutputCallerDirectParam].
+type BetaResponseInputItemShellCallOutputCallerDirectParam struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ paramObj
+}
+
+func (r BetaResponseInputItemShellCallOutputCallerDirectParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemShellCallOutputCallerDirectParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemShellCallOutputCallerDirectParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties CallerID, Type are required.
+type BetaResponseInputItemShellCallOutputCallerProgramParam struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ //
+ // This field can be elided, and will marshal its zero value as "program".
+ Type constant.Program `json:"type" default:"program"`
+ paramObj
+}
+
+func (r BetaResponseInputItemShellCallOutputCallerProgramParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemShellCallOutputCallerProgramParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemShellCallOutputCallerProgramParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool call representing a request to create, delete, or update files using diff
+// patches.
+//
+// The properties CallID, Operation, Status, Type are required.
+type BetaResponseInputItemApplyPatchCallParam struct {
+ // The unique ID of the apply patch tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // The specific create, delete, or update instruction for the apply_patch tool
+ // call.
+ Operation BetaResponseInputItemApplyPatchCallOperationUnionParam `json:"operation,omitzero" api:"required"`
+ // The status of the apply patch tool call. One of `in_progress` or `completed`.
+ //
+ // Any of "in_progress", "completed".
+ Status string `json:"status,omitzero" api:"required"`
+ // The unique ID of the apply patch tool call. Populated when this item is returned
+ // via API.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemApplyPatchCallAgentParam `json:"agent,omitzero"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseInputItemApplyPatchCallCallerUnionParam `json:"caller,omitzero"`
+ // The type of the item. Always `apply_patch_call`.
+ //
+ // This field can be elided, and will marshal its zero value as "apply_patch_call".
+ Type constant.ApplyPatchCall `json:"type" default:"apply_patch_call"`
+ paramObj
+}
+
+func (r BetaResponseInputItemApplyPatchCallParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemApplyPatchCallParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemApplyPatchCallParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseInputItemApplyPatchCallParam](
+ "status", "in_progress", "completed",
+ )
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseInputItemApplyPatchCallOperationUnionParam struct {
+ OfCreateFile *BetaResponseInputItemApplyPatchCallOperationCreateFileParam `json:",omitzero,inline"`
+ OfDeleteFile *BetaResponseInputItemApplyPatchCallOperationDeleteFileParam `json:",omitzero,inline"`
+ OfUpdateFile *BetaResponseInputItemApplyPatchCallOperationUpdateFileParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseInputItemApplyPatchCallOperationUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfCreateFile, u.OfDeleteFile, u.OfUpdateFile)
+}
+func (u *BetaResponseInputItemApplyPatchCallOperationUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseInputItemApplyPatchCallOperationUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfCreateFile) {
+ return u.OfCreateFile
+ } else if !param.IsOmitted(u.OfDeleteFile) {
+ return u.OfDeleteFile
+ } else if !param.IsOmitted(u.OfUpdateFile) {
+ return u.OfUpdateFile
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemApplyPatchCallOperationUnionParam) GetDiff() *string {
+ if vt := u.OfCreateFile; vt != nil {
+ return (*string)(&vt.Diff)
+ } else if vt := u.OfUpdateFile; vt != nil {
+ return (*string)(&vt.Diff)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemApplyPatchCallOperationUnionParam) GetPath() *string {
+ if vt := u.OfCreateFile; vt != nil {
+ return (*string)(&vt.Path)
+ } else if vt := u.OfDeleteFile; vt != nil {
+ return (*string)(&vt.Path)
+ } else if vt := u.OfUpdateFile; vt != nil {
+ return (*string)(&vt.Path)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemApplyPatchCallOperationUnionParam) GetType() *string {
+ if vt := u.OfCreateFile; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfDeleteFile; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfUpdateFile; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseInputItemApplyPatchCallOperationUnionParam](
+ "type",
+ apijson.Discriminator[BetaResponseInputItemApplyPatchCallOperationCreateFileParam]("create_file"),
+ apijson.Discriminator[BetaResponseInputItemApplyPatchCallOperationDeleteFileParam]("delete_file"),
+ apijson.Discriminator[BetaResponseInputItemApplyPatchCallOperationUpdateFileParam]("update_file"),
+ )
+}
+
+// Instruction for creating a new file via the apply_patch tool.
+//
+// The properties Diff, Path, Type are required.
+type BetaResponseInputItemApplyPatchCallOperationCreateFileParam struct {
+ // Unified diff content to apply when creating the file.
+ Diff string `json:"diff" api:"required"`
+ // Path of the file to create relative to the workspace root.
+ Path string `json:"path" api:"required"`
+ // The operation type. Always `create_file`.
+ //
+ // This field can be elided, and will marshal its zero value as "create_file".
+ Type constant.CreateFile `json:"type" default:"create_file"`
+ paramObj
+}
+
+func (r BetaResponseInputItemApplyPatchCallOperationCreateFileParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemApplyPatchCallOperationCreateFileParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemApplyPatchCallOperationCreateFileParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Instruction for deleting an existing file via the apply_patch tool.
+//
+// The properties Path, Type are required.
+type BetaResponseInputItemApplyPatchCallOperationDeleteFileParam struct {
+ // Path of the file to delete relative to the workspace root.
+ Path string `json:"path" api:"required"`
+ // The operation type. Always `delete_file`.
+ //
+ // This field can be elided, and will marshal its zero value as "delete_file".
+ Type constant.DeleteFile `json:"type" default:"delete_file"`
+ paramObj
+}
+
+func (r BetaResponseInputItemApplyPatchCallOperationDeleteFileParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemApplyPatchCallOperationDeleteFileParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemApplyPatchCallOperationDeleteFileParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Instruction for updating an existing file via the apply_patch tool.
+//
+// The properties Diff, Path, Type are required.
+type BetaResponseInputItemApplyPatchCallOperationUpdateFileParam struct {
+ // Unified diff content to apply to the existing file.
+ Diff string `json:"diff" api:"required"`
+ // Path of the file to update relative to the workspace root.
+ Path string `json:"path" api:"required"`
+ // The operation type. Always `update_file`.
+ //
+ // This field can be elided, and will marshal its zero value as "update_file".
+ Type constant.UpdateFile `json:"type" default:"update_file"`
+ paramObj
+}
+
+func (r BetaResponseInputItemApplyPatchCallOperationUpdateFileParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemApplyPatchCallOperationUpdateFileParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemApplyPatchCallOperationUpdateFileParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemApplyPatchCallAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemApplyPatchCallAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemApplyPatchCallAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemApplyPatchCallAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseInputItemApplyPatchCallCallerUnionParam struct {
+ OfDirect *BetaResponseInputItemApplyPatchCallCallerDirectParam `json:",omitzero,inline"`
+ OfProgram *BetaResponseInputItemApplyPatchCallCallerProgramParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseInputItemApplyPatchCallCallerUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfDirect, u.OfProgram)
+}
+func (u *BetaResponseInputItemApplyPatchCallCallerUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseInputItemApplyPatchCallCallerUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfDirect) {
+ return u.OfDirect
+ } else if !param.IsOmitted(u.OfProgram) {
+ return u.OfProgram
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemApplyPatchCallCallerUnionParam) GetCallerID() *string {
+ if vt := u.OfProgram; vt != nil {
+ return &vt.CallerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemApplyPatchCallCallerUnionParam) GetType() *string {
+ if vt := u.OfDirect; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseInputItemApplyPatchCallCallerUnionParam](
+ "type",
+ apijson.Discriminator[BetaResponseInputItemApplyPatchCallCallerDirectParam]("direct"),
+ apijson.Discriminator[BetaResponseInputItemApplyPatchCallCallerProgramParam]("program"),
+ )
+}
+
+func NewBetaResponseInputItemApplyPatchCallCallerDirectParam() BetaResponseInputItemApplyPatchCallCallerDirectParam {
+ return BetaResponseInputItemApplyPatchCallCallerDirectParam{
+ Type: "direct",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewBetaResponseInputItemApplyPatchCallCallerDirectParam].
+type BetaResponseInputItemApplyPatchCallCallerDirectParam struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ paramObj
+}
+
+func (r BetaResponseInputItemApplyPatchCallCallerDirectParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemApplyPatchCallCallerDirectParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemApplyPatchCallCallerDirectParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties CallerID, Type are required.
+type BetaResponseInputItemApplyPatchCallCallerProgramParam struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ //
+ // This field can be elided, and will marshal its zero value as "program".
+ Type constant.Program `json:"type" default:"program"`
+ paramObj
+}
+
+func (r BetaResponseInputItemApplyPatchCallCallerProgramParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemApplyPatchCallCallerProgramParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemApplyPatchCallCallerProgramParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The streamed output emitted by an apply patch tool call.
+//
+// The properties CallID, Status, Type are required.
+type BetaResponseInputItemApplyPatchCallOutputParam struct {
+ // The unique ID of the apply patch tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // The status of the apply patch tool call output. One of `completed` or `failed`.
+ //
+ // Any of "completed", "failed".
+ Status string `json:"status,omitzero" api:"required"`
+ // The unique ID of the apply patch tool call output. Populated when this item is
+ // returned via API.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // Optional human-readable log text from the apply patch tool (e.g., patch results
+ // or errors).
+ Output param.Opt[string] `json:"output,omitzero"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemApplyPatchCallOutputAgentParam `json:"agent,omitzero"`
+ // The execution context that produced this tool call.
+ Caller BetaResponseInputItemApplyPatchCallOutputCallerUnionParam `json:"caller,omitzero"`
+ // The type of the item. Always `apply_patch_call_output`.
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "apply_patch_call_output".
+ Type constant.ApplyPatchCallOutput `json:"type" default:"apply_patch_call_output"`
+ paramObj
+}
+
+func (r BetaResponseInputItemApplyPatchCallOutputParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemApplyPatchCallOutputParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemApplyPatchCallOutputParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseInputItemApplyPatchCallOutputParam](
+ "status", "completed", "failed",
+ )
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemApplyPatchCallOutputAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemApplyPatchCallOutputAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemApplyPatchCallOutputAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemApplyPatchCallOutputAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseInputItemApplyPatchCallOutputCallerUnionParam struct {
+ OfDirect *BetaResponseInputItemApplyPatchCallOutputCallerDirectParam `json:",omitzero,inline"`
+ OfProgram *BetaResponseInputItemApplyPatchCallOutputCallerProgramParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseInputItemApplyPatchCallOutputCallerUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfDirect, u.OfProgram)
+}
+func (u *BetaResponseInputItemApplyPatchCallOutputCallerUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseInputItemApplyPatchCallOutputCallerUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfDirect) {
+ return u.OfDirect
+ } else if !param.IsOmitted(u.OfProgram) {
+ return u.OfProgram
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemApplyPatchCallOutputCallerUnionParam) GetCallerID() *string {
+ if vt := u.OfProgram; vt != nil {
+ return &vt.CallerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputItemApplyPatchCallOutputCallerUnionParam) GetType() *string {
+ if vt := u.OfDirect; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseInputItemApplyPatchCallOutputCallerUnionParam](
+ "type",
+ apijson.Discriminator[BetaResponseInputItemApplyPatchCallOutputCallerDirectParam]("direct"),
+ apijson.Discriminator[BetaResponseInputItemApplyPatchCallOutputCallerProgramParam]("program"),
+ )
+}
+
+func NewBetaResponseInputItemApplyPatchCallOutputCallerDirectParam() BetaResponseInputItemApplyPatchCallOutputCallerDirectParam {
+ return BetaResponseInputItemApplyPatchCallOutputCallerDirectParam{
+ Type: "direct",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewBetaResponseInputItemApplyPatchCallOutputCallerDirectParam].
+type BetaResponseInputItemApplyPatchCallOutputCallerDirectParam struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ paramObj
+}
+
+func (r BetaResponseInputItemApplyPatchCallOutputCallerDirectParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemApplyPatchCallOutputCallerDirectParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemApplyPatchCallOutputCallerDirectParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties CallerID, Type are required.
+type BetaResponseInputItemApplyPatchCallOutputCallerProgramParam struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ //
+ // This field can be elided, and will marshal its zero value as "program".
+ Type constant.Program `json:"type" default:"program"`
+ paramObj
+}
+
+func (r BetaResponseInputItemApplyPatchCallOutputCallerProgramParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemApplyPatchCallOutputCallerProgramParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemApplyPatchCallOutputCallerProgramParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A list of tools available on an MCP server.
+//
+// The properties ID, ServerLabel, Tools, Type are required.
+type BetaResponseInputItemMcpListToolsParam struct {
+ // The unique ID of the list.
+ ID string `json:"id" api:"required"`
+ // The label of the MCP server.
+ ServerLabel string `json:"server_label" api:"required"`
+ // The tools available on the server.
+ Tools []BetaResponseInputItemMcpListToolsToolParam `json:"tools,omitzero" api:"required"`
+ // Error message if the server could not list tools.
+ Error param.Opt[string] `json:"error,omitzero"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemMcpListToolsAgentParam `json:"agent,omitzero"`
+ // The type of the item. Always `mcp_list_tools`.
+ //
+ // This field can be elided, and will marshal its zero value as "mcp_list_tools".
+ Type constant.McpListTools `json:"type" default:"mcp_list_tools"`
+ paramObj
+}
+
+func (r BetaResponseInputItemMcpListToolsParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemMcpListToolsParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemMcpListToolsParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool available on an MCP server.
+//
+// The properties InputSchema, Name are required.
+type BetaResponseInputItemMcpListToolsToolParam struct {
+ // The JSON schema describing the tool's input.
+ InputSchema any `json:"input_schema,omitzero" api:"required"`
+ // The name of the tool.
+ Name string `json:"name" api:"required"`
+ // The description of the tool.
+ Description param.Opt[string] `json:"description,omitzero"`
+ // Additional annotations about the tool.
+ Annotations any `json:"annotations,omitzero"`
+ paramObj
+}
+
+func (r BetaResponseInputItemMcpListToolsToolParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemMcpListToolsToolParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemMcpListToolsToolParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemMcpListToolsAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemMcpListToolsAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemMcpListToolsAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemMcpListToolsAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A request for human approval of a tool invocation.
+//
+// The properties ID, Arguments, Name, ServerLabel, Type are required.
+type BetaResponseInputItemMcpApprovalRequestParam struct {
+ // The unique ID of the approval request.
+ ID string `json:"id" api:"required"`
+ // A JSON string of arguments for the tool.
+ Arguments string `json:"arguments" api:"required"`
+ // The name of the tool to run.
+ Name string `json:"name" api:"required"`
+ // The label of the MCP server making the request.
+ ServerLabel string `json:"server_label" api:"required"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemMcpApprovalRequestAgentParam `json:"agent,omitzero"`
+ // The type of the item. Always `mcp_approval_request`.
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "mcp_approval_request".
+ Type constant.McpApprovalRequest `json:"type" default:"mcp_approval_request"`
+ paramObj
+}
+
+func (r BetaResponseInputItemMcpApprovalRequestParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemMcpApprovalRequestParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemMcpApprovalRequestParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemMcpApprovalRequestAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemMcpApprovalRequestAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemMcpApprovalRequestAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemMcpApprovalRequestAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A response to an MCP approval request.
+//
+// The properties ApprovalRequestID, Approve, Type are required.
+type BetaResponseInputItemMcpApprovalResponseParam struct {
+ // The ID of the approval request being answered.
+ ApprovalRequestID string `json:"approval_request_id" api:"required"`
+ // Whether the request was approved.
+ Approve bool `json:"approve" api:"required"`
+ // The unique ID of the approval response
+ ID param.Opt[string] `json:"id,omitzero"`
+ // Optional reason for the decision.
+ Reason param.Opt[string] `json:"reason,omitzero"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemMcpApprovalResponseAgentParam `json:"agent,omitzero"`
+ // The type of the item. Always `mcp_approval_response`.
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "mcp_approval_response".
+ Type constant.McpApprovalResponse `json:"type" default:"mcp_approval_response"`
+ paramObj
+}
+
+func (r BetaResponseInputItemMcpApprovalResponseParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemMcpApprovalResponseParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemMcpApprovalResponseParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemMcpApprovalResponseAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemMcpApprovalResponseAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemMcpApprovalResponseAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemMcpApprovalResponseAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An invocation of a tool on an MCP server.
+//
+// The properties ID, Arguments, Name, ServerLabel, Type are required.
+type BetaResponseInputItemMcpCallParam struct {
+ // The unique ID of the tool call.
+ ID string `json:"id" api:"required"`
+ // A JSON string of the arguments passed to the tool.
+ Arguments string `json:"arguments" api:"required"`
+ // The name of the tool that was run.
+ Name string `json:"name" api:"required"`
+ // The label of the MCP server running the tool.
+ ServerLabel string `json:"server_label" api:"required"`
+ // Unique identifier for the MCP tool call approval request. Include this value in
+ // a subsequent `mcp_approval_response` input to approve or reject the
+ // corresponding tool call.
+ ApprovalRequestID param.Opt[string] `json:"approval_request_id,omitzero"`
+ // The error from the tool call, if any.
+ Error param.Opt[string] `json:"error,omitzero"`
+ // The output from the tool call.
+ Output param.Opt[string] `json:"output,omitzero"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemMcpCallAgentParam `json:"agent,omitzero"`
+ // The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
+ // `calling`, or `failed`.
+ //
+ // Any of "in_progress", "completed", "incomplete", "calling", "failed".
+ Status string `json:"status,omitzero"`
+ // The type of the item. Always `mcp_call`.
+ //
+ // This field can be elided, and will marshal its zero value as "mcp_call".
+ Type constant.McpCall `json:"type" default:"mcp_call"`
+ paramObj
+}
+
+func (r BetaResponseInputItemMcpCallParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemMcpCallParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemMcpCallParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseInputItemMcpCallParam](
+ "status", "in_progress", "completed", "incomplete", "calling", "failed",
+ )
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemMcpCallAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemMcpCallAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemMcpCallAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemMcpCallAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Compacts the current context. Must be the final input item.
+//
+// The property Type is required.
+type BetaResponseInputItemCompactionTriggerParam struct {
+ // The agent that produced this item.
+ Agent BetaResponseInputItemCompactionTriggerAgentParam `json:"agent,omitzero"`
+ // The type of the item. Always `compaction_trigger`.
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "compaction_trigger".
+ Type constant.CompactionTrigger `json:"type" default:"compaction_trigger"`
+ paramObj
+}
+
+func (r BetaResponseInputItemCompactionTriggerParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemCompactionTriggerParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemCompactionTriggerParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemCompactionTriggerAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemCompactionTriggerAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemCompactionTriggerAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemCompactionTriggerAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An internal identifier for an item to reference.
+//
+// The property ID is required.
+type BetaResponseInputItemItemReferenceParam struct {
+ // The ID of the item to reference.
+ ID string `json:"id" api:"required"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemItemReferenceAgentParam `json:"agent,omitzero"`
+ // The type of item to reference. Always `item_reference`.
+ //
+ // Any of "item_reference".
+ Type string `json:"type,omitzero"`
+ paramObj
+}
+
+func (r BetaResponseInputItemItemReferenceParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemItemReferenceParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemItemReferenceParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseInputItemItemReferenceParam](
+ "type", "item_reference",
+ )
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemItemReferenceAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemItemReferenceAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemItemReferenceAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemItemReferenceAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties ID, CallID, Code, Fingerprint, Type are required.
+type BetaResponseInputItemProgramParam struct {
+ // The unique ID of this program item.
+ ID string `json:"id" api:"required"`
+ // The stable call ID of the program item.
+ CallID string `json:"call_id" api:"required"`
+ // The JavaScript source executed by programmatic tool calling.
+ Code string `json:"code" api:"required"`
+ // Opaque program replay fingerprint that must be round-tripped.
+ Fingerprint string `json:"fingerprint" api:"required"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemProgramAgentParam `json:"agent,omitzero"`
+ // The item type. Always `program`.
+ //
+ // This field can be elided, and will marshal its zero value as "program".
+ Type constant.Program `json:"type" default:"program"`
+ paramObj
+}
+
+func (r BetaResponseInputItemProgramParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemProgramParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemProgramParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemProgramAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemProgramAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemProgramAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemProgramAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties ID, CallID, Result, Status, Type are required.
+type BetaResponseInputItemProgramOutputParam struct {
+ // The unique ID of this program output item.
+ ID string `json:"id" api:"required"`
+ // The call ID of the program item.
+ CallID string `json:"call_id" api:"required"`
+ // The result produced by the program item.
+ Result string `json:"result" api:"required"`
+ // The terminal status of the program output.
+ //
+ // Any of "completed", "incomplete".
+ Status string `json:"status,omitzero" api:"required"`
+ // The agent that produced this item.
+ Agent BetaResponseInputItemProgramOutputAgentParam `json:"agent,omitzero"`
+ // The item type. Always `program_output`.
+ //
+ // This field can be elided, and will marshal its zero value as "program_output".
+ Type constant.ProgramOutput `json:"type" default:"program_output"`
+ paramObj
+}
+
+func (r BetaResponseInputItemProgramOutputParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemProgramOutputParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemProgramOutputParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseInputItemProgramOutputParam](
+ "status", "completed", "incomplete",
+ )
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseInputItemProgramOutputAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseInputItemProgramOutputAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputItemProgramOutputAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputItemProgramOutputAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputMessageContentList []BetaResponseInputContentUnion
+
+type BetaResponseInputMessageContentListParam []BetaResponseInputContentUnionParam
+
+type BetaResponseInputMessageItem struct {
+ // The unique ID of the message input.
+ ID string `json:"id" api:"required"`
+ // A list of one or many input items to the model, containing different content
+ // types.
+ Content BetaResponseInputMessageContentList `json:"content" api:"required"`
+ // The role of the message input. One of `user`, `system`, or `developer`.
+ //
+ // Any of "user", "system", "developer".
+ Role BetaResponseInputMessageItemRole `json:"role" api:"required"`
+ // The type of the message input. Always set to `message`.
+ Type constant.Message `json:"type" default:"message"`
+ // The agent that produced this item.
+ Agent BetaResponseInputMessageItemAgent `json:"agent" api:"nullable"`
+ // The status of item. One of `in_progress`, `completed`, or `incomplete`.
+ // Populated when items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status BetaResponseInputMessageItemStatus `json:"status"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Content respjson.Field
+ Role respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputMessageItem) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputMessageItem) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The role of the message input. One of `user`, `system`, or `developer`.
+type BetaResponseInputMessageItemRole string
+
+const (
+ BetaResponseInputMessageItemRoleUser BetaResponseInputMessageItemRole = "user"
+ BetaResponseInputMessageItemRoleSystem BetaResponseInputMessageItemRole = "system"
+ BetaResponseInputMessageItemRoleDeveloper BetaResponseInputMessageItemRole = "developer"
+)
+
+// The agent that produced this item.
+type BetaResponseInputMessageItemAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputMessageItemAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputMessageItemAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The status of item. One of `in_progress`, `completed`, or `incomplete`.
+// Populated when items are returned via API.
+type BetaResponseInputMessageItemStatus string
+
+const (
+ BetaResponseInputMessageItemStatusInProgress BetaResponseInputMessageItemStatus = "in_progress"
+ BetaResponseInputMessageItemStatusCompleted BetaResponseInputMessageItemStatus = "completed"
+ BetaResponseInputMessageItemStatusIncomplete BetaResponseInputMessageItemStatus = "incomplete"
+)
+
+// A text input to the model.
+type BetaResponseInputText struct {
+ // The text input to the model.
+ Text string `json:"text" api:"required"`
+ // The type of the input item. Always `input_text`.
+ Type constant.InputText `json:"type" default:"input_text"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint BetaResponseInputTextPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputText) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputText) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseInputText to a BetaResponseInputTextParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseInputTextParam.Overrides()
+func (r BetaResponseInputText) ToParam() BetaResponseInputTextParam {
+ return param.Override[BetaResponseInputTextParam](json.RawMessage(r.RawJSON()))
+}
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+type BetaResponseInputTextPromptCacheBreakpoint struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Mode respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputTextPromptCacheBreakpoint) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputTextPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A text input to the model.
+//
+// The properties Text, Type are required.
+type BetaResponseInputTextParam struct {
+ // The text input to the model.
+ Text string `json:"text" api:"required"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint BetaResponseInputTextPromptCacheBreakpointParam `json:"prompt_cache_breakpoint,omitzero"`
+ // The type of the input item. Always `input_text`.
+ //
+ // This field can be elided, and will marshal its zero value as "input_text".
+ Type constant.InputText `json:"type" default:"input_text"`
+ paramObj
+}
+
+func (r BetaResponseInputTextParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputTextParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputTextParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func NewBetaResponseInputTextPromptCacheBreakpointParam() BetaResponseInputTextPromptCacheBreakpointParam {
+ return BetaResponseInputTextPromptCacheBreakpointParam{
+ Mode: "explicit",
+ }
+}
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+//
+// This struct has a constant value, construct it with
+// [NewBetaResponseInputTextPromptCacheBreakpointParam].
+type BetaResponseInputTextPromptCacheBreakpointParam struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ paramObj
+}
+
+func (r BetaResponseInputTextPromptCacheBreakpointParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputTextPromptCacheBreakpointParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputTextPromptCacheBreakpointParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A text input to the model.
+type BetaResponseInputTextContent struct {
+ // The text input to the model.
+ Text string `json:"text" api:"required"`
+ // The type of the input item. Always `input_text`.
+ Type constant.InputText `json:"type" default:"input_text"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint BetaResponseInputTextContentPromptCacheBreakpoint `json:"prompt_cache_breakpoint" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputTextContent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputTextContent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseInputTextContent to a
+// BetaResponseInputTextContentParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseInputTextContentParam.Overrides()
+func (r BetaResponseInputTextContent) ToParam() BetaResponseInputTextContentParam {
+ return param.Override[BetaResponseInputTextContentParam](json.RawMessage(r.RawJSON()))
+}
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+type BetaResponseInputTextContentPromptCacheBreakpoint struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Mode respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputTextContentPromptCacheBreakpoint) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputTextContentPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A text input to the model.
+//
+// The properties Text, Type are required.
+type BetaResponseInputTextContentParam struct {
+ // The text input to the model.
+ Text string `json:"text" api:"required"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint BetaResponseInputTextContentPromptCacheBreakpointParam `json:"prompt_cache_breakpoint,omitzero"`
+ // The type of the input item. Always `input_text`.
+ //
+ // This field can be elided, and will marshal its zero value as "input_text".
+ Type constant.InputText `json:"type" default:"input_text"`
+ paramObj
+}
+
+func (r BetaResponseInputTextContentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputTextContentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputTextContentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func NewBetaResponseInputTextContentPromptCacheBreakpointParam() BetaResponseInputTextContentPromptCacheBreakpointParam {
+ return BetaResponseInputTextContentPromptCacheBreakpointParam{
+ Mode: "explicit",
+ }
+}
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+//
+// This struct has a constant value, construct it with
+// [NewBetaResponseInputTextContentPromptCacheBreakpointParam].
+type BetaResponseInputTextContentPromptCacheBreakpointParam struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ paramObj
+}
+
+func (r BetaResponseInputTextContentPromptCacheBreakpointParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputTextContentPromptCacheBreakpointParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputTextContentPromptCacheBreakpointParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseItemUnion contains all possible properties and values from
+// [BetaResponseInputMessageItem], [BetaResponseOutputMessage],
+// [BetaResponseFileSearchToolCall], [BetaResponseComputerToolCall],
+// [BetaResponseComputerToolCallOutputItem], [BetaResponseFunctionWebSearch],
+// [BetaResponseFunctionToolCallItem], [BetaResponseFunctionToolCallOutputItem],
+// [BetaResponseItemAgentMessage], [BetaResponseItemMultiAgentCall],
+// [BetaResponseItemMultiAgentCallOutput], [BetaResponseToolSearchCall],
+// [BetaResponseToolSearchOutputItem], [BetaResponseItemAdditionalTools],
+// [BetaResponseReasoningItem], [BetaResponseItemProgram],
+// [BetaResponseItemProgramOutput], [BetaResponseCompactionItem],
+// [BetaResponseItemImageGenerationCall], [BetaResponseCodeInterpreterToolCall],
+// [BetaResponseItemLocalShellCall], [BetaResponseItemLocalShellCallOutput],
+// [BetaResponseFunctionShellToolCall], [BetaResponseFunctionShellToolCallOutput],
+// [BetaResponseApplyPatchToolCall], [BetaResponseApplyPatchToolCallOutput],
+// [BetaResponseItemMcpListTools], [BetaResponseItemMcpApprovalRequest],
+// [BetaResponseItemMcpApprovalResponse], [BetaResponseItemMcpCall],
+// [BetaResponseCustomToolCallItem], [BetaResponseCustomToolCallOutputItem].
+//
+// Use the [BetaResponseItemUnion.AsAny] method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseItemUnion struct {
+ ID string `json:"id"`
+ // This field is a union of [BetaResponseInputMessageContentList],
+ // [[]BetaResponseOutputMessageContentUnion],
+ // [[]BetaResponseItemAgentMessageContentUnion],
+ // [[]BetaResponseReasoningItemContent]
+ Content BetaResponseItemUnionContent `json:"content"`
+ Role string `json:"role"`
+ // Any of "message", "message", "file_search_call", "computer_call",
+ // "computer_call_output", "web_search_call", "function_call",
+ // "function_call_output", "agent_message", "multi_agent_call",
+ // "multi_agent_call_output", "tool_search_call", "tool_search_output",
+ // "additional_tools", "reasoning", "program", "program_output", "compaction",
+ // "image_generation_call", "code_interpreter_call", "local_shell_call",
+ // "local_shell_call_output", "shell_call", "shell_call_output",
+ // "apply_patch_call", "apply_patch_call_output", "mcp_list_tools",
+ // "mcp_approval_request", "mcp_approval_response", "mcp_call", "custom_tool_call",
+ // "custom_tool_call_output".
+ Type string `json:"type"`
+ // This field is a union of [BetaResponseInputMessageItemAgent],
+ // [BetaResponseOutputMessageAgent], [BetaResponseFileSearchToolCallAgent],
+ // [BetaResponseComputerToolCallAgent],
+ // [BetaResponseComputerToolCallOutputItemAgent],
+ // [BetaResponseFunctionWebSearchAgent], [BetaResponseFunctionToolCallAgent],
+ // [BetaResponseFunctionToolCallOutputItemAgent],
+ // [BetaResponseItemAgentMessageAgent], [BetaResponseItemMultiAgentCallAgent],
+ // [BetaResponseItemMultiAgentCallOutputAgent], [BetaResponseToolSearchCallAgent],
+ // [BetaResponseToolSearchOutputItemAgent], [BetaResponseItemAdditionalToolsAgent],
+ // [BetaResponseReasoningItemAgent], [BetaResponseItemProgramAgent],
+ // [BetaResponseItemProgramOutputAgent], [BetaResponseCompactionItemAgent],
+ // [BetaResponseItemImageGenerationCallAgent],
+ // [BetaResponseCodeInterpreterToolCallAgent],
+ // [BetaResponseItemLocalShellCallAgent],
+ // [BetaResponseItemLocalShellCallOutputAgent],
+ // [BetaResponseFunctionShellToolCallAgent],
+ // [BetaResponseFunctionShellToolCallOutputAgent],
+ // [BetaResponseApplyPatchToolCallAgent],
+ // [BetaResponseApplyPatchToolCallOutputAgent],
+ // [BetaResponseItemMcpListToolsAgent], [BetaResponseItemMcpApprovalRequestAgent],
+ // [BetaResponseItemMcpApprovalResponseAgent], [BetaResponseItemMcpCallAgent],
+ // [BetaResponseCustomToolCallAgent], [BetaResponseCustomToolCallOutputAgent]
+ Agent BetaResponseItemUnionAgent `json:"agent"`
+ Status string `json:"status"`
+ // This field is from variant [BetaResponseOutputMessage].
+ Phase BetaResponseOutputMessagePhase `json:"phase"`
+ // This field is from variant [BetaResponseFileSearchToolCall].
+ Queries []string `json:"queries"`
+ // This field is from variant [BetaResponseFileSearchToolCall].
+ Results []BetaResponseFileSearchToolCallResult `json:"results"`
+ CallID string `json:"call_id"`
+ // This field is from variant [BetaResponseComputerToolCall].
+ PendingSafetyChecks []BetaResponseComputerToolCallPendingSafetyCheck `json:"pending_safety_checks"`
+ // This field is a union of [BetaComputerActionUnion],
+ // [BetaResponseFunctionWebSearchActionUnion], [string], [string],
+ // [BetaResponseItemLocalShellCallAction],
+ // [BetaResponseFunctionShellToolCallAction]
+ Action BetaResponseItemUnionAction `json:"action"`
+ // This field is from variant [BetaResponseComputerToolCall].
+ Actions BetaComputerActionList `json:"actions"`
+ // This field is a union of [BetaResponseComputerToolCallOutputScreenshot],
+ // [BetaResponseFunctionToolCallOutputItemOutputUnion], [[]BetaResponseOutputText],
+ // [string], [[]BetaResponseFunctionShellToolCallOutputOutput], [string], [string],
+ // [BetaResponseCustomToolCallOutputOutputUnion]
+ Output BetaResponseItemUnionOutput `json:"output"`
+ // This field is from variant [BetaResponseComputerToolCallOutputItem].
+ AcknowledgedSafetyChecks []BetaResponseComputerToolCallOutputItemAcknowledgedSafetyCheck `json:"acknowledged_safety_checks"`
+ CreatedBy string `json:"created_by"`
+ // This field is a union of [string], [string], [any], [string], [string]
+ Arguments BetaResponseItemUnionArguments `json:"arguments"`
+ Name string `json:"name"`
+ // This field is a union of [BetaResponseFunctionToolCallCallerUnion],
+ // [BetaResponseFunctionToolCallOutputItemCallerUnion],
+ // [BetaResponseFunctionShellToolCallCallerUnion],
+ // [BetaResponseFunctionShellToolCallOutputCallerUnion],
+ // [BetaResponseApplyPatchToolCallCallerUnion],
+ // [BetaResponseApplyPatchToolCallOutputCallerUnion],
+ // [BetaResponseCustomToolCallCallerUnion],
+ // [BetaResponseCustomToolCallOutputCallerUnion]
+ Caller BetaResponseItemUnionCaller `json:"caller"`
+ Namespace string `json:"namespace"`
+ // This field is from variant [BetaResponseItemAgentMessage].
+ Author string `json:"author"`
+ // This field is from variant [BetaResponseItemAgentMessage].
+ Recipient string `json:"recipient"`
+ Execution string `json:"execution"`
+ // This field is a union of [[]BetaToolUnion], [[]BetaToolUnion],
+ // [[]BetaResponseItemMcpListToolsTool]
+ Tools BetaResponseItemUnionTools `json:"tools"`
+ // This field is from variant [BetaResponseReasoningItem].
+ Summary []BetaResponseReasoningItemSummary `json:"summary"`
+ EncryptedContent string `json:"encrypted_content"`
+ Code string `json:"code"`
+ // This field is from variant [BetaResponseItemProgram].
+ Fingerprint string `json:"fingerprint"`
+ Result string `json:"result"`
+ // This field is from variant [BetaResponseCodeInterpreterToolCall].
+ ContainerID string `json:"container_id"`
+ // This field is from variant [BetaResponseCodeInterpreterToolCall].
+ Outputs []BetaResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
+ // This field is from variant [BetaResponseFunctionShellToolCall].
+ Environment BetaResponseFunctionShellToolCallEnvironmentUnion `json:"environment"`
+ // This field is from variant [BetaResponseFunctionShellToolCallOutput].
+ MaxOutputLength int64 `json:"max_output_length"`
+ // This field is from variant [BetaResponseApplyPatchToolCall].
+ Operation BetaResponseApplyPatchToolCallOperationUnion `json:"operation"`
+ ServerLabel string `json:"server_label"`
+ Error string `json:"error"`
+ ApprovalRequestID string `json:"approval_request_id"`
+ // This field is from variant [BetaResponseItemMcpApprovalResponse].
+ Approve bool `json:"approve"`
+ // This field is from variant [BetaResponseItemMcpApprovalResponse].
+ Reason string `json:"reason"`
+ // This field is from variant [BetaResponseCustomToolCallItem].
+ Input string `json:"input"`
+ JSON struct {
+ ID respjson.Field
+ Content respjson.Field
+ Role respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Status respjson.Field
+ Phase respjson.Field
+ Queries respjson.Field
+ Results respjson.Field
+ CallID respjson.Field
+ PendingSafetyChecks respjson.Field
+ Action respjson.Field
+ Actions respjson.Field
+ Output respjson.Field
+ AcknowledgedSafetyChecks respjson.Field
+ CreatedBy respjson.Field
+ Arguments respjson.Field
+ Name respjson.Field
+ Caller respjson.Field
+ Namespace respjson.Field
+ Author respjson.Field
+ Recipient respjson.Field
+ Execution respjson.Field
+ Tools respjson.Field
+ Summary respjson.Field
+ EncryptedContent respjson.Field
+ Code respjson.Field
+ Fingerprint respjson.Field
+ Result respjson.Field
+ ContainerID respjson.Field
+ Outputs respjson.Field
+ Environment respjson.Field
+ MaxOutputLength respjson.Field
+ Operation respjson.Field
+ ServerLabel respjson.Field
+ Error respjson.Field
+ ApprovalRequestID respjson.Field
+ Approve respjson.Field
+ Reason respjson.Field
+ Input respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseItem is implemented by each variant of [BetaResponseItemUnion] to
+// add type safety for the return type of [BetaResponseItemUnion.AsAny]
+type anyBetaResponseItem interface {
+ implBetaResponseItemUnion()
+}
+
+func (BetaResponseInputMessageItem) implBetaResponseItemUnion() {}
+func (BetaResponseOutputMessage) implBetaResponseItemUnion() {}
+func (BetaResponseFileSearchToolCall) implBetaResponseItemUnion() {}
+func (BetaResponseComputerToolCall) implBetaResponseItemUnion() {}
+func (BetaResponseComputerToolCallOutputItem) implBetaResponseItemUnion() {}
+func (BetaResponseFunctionWebSearch) implBetaResponseItemUnion() {}
+func (BetaResponseFunctionToolCallItem) implBetaResponseItemUnion() {}
+func (BetaResponseFunctionToolCallOutputItem) implBetaResponseItemUnion() {}
+func (BetaResponseItemAgentMessage) implBetaResponseItemUnion() {}
+func (BetaResponseItemMultiAgentCall) implBetaResponseItemUnion() {}
+func (BetaResponseItemMultiAgentCallOutput) implBetaResponseItemUnion() {}
+func (BetaResponseToolSearchCall) implBetaResponseItemUnion() {}
+func (BetaResponseToolSearchOutputItem) implBetaResponseItemUnion() {}
+func (BetaResponseItemAdditionalTools) implBetaResponseItemUnion() {}
+func (BetaResponseReasoningItem) implBetaResponseItemUnion() {}
+func (BetaResponseItemProgram) implBetaResponseItemUnion() {}
+func (BetaResponseItemProgramOutput) implBetaResponseItemUnion() {}
+func (BetaResponseCompactionItem) implBetaResponseItemUnion() {}
+func (BetaResponseItemImageGenerationCall) implBetaResponseItemUnion() {}
+func (BetaResponseCodeInterpreterToolCall) implBetaResponseItemUnion() {}
+func (BetaResponseItemLocalShellCall) implBetaResponseItemUnion() {}
+func (BetaResponseItemLocalShellCallOutput) implBetaResponseItemUnion() {}
+func (BetaResponseFunctionShellToolCall) implBetaResponseItemUnion() {}
+func (BetaResponseFunctionShellToolCallOutput) implBetaResponseItemUnion() {}
+func (BetaResponseApplyPatchToolCall) implBetaResponseItemUnion() {}
+func (BetaResponseApplyPatchToolCallOutput) implBetaResponseItemUnion() {}
+func (BetaResponseItemMcpListTools) implBetaResponseItemUnion() {}
+func (BetaResponseItemMcpApprovalRequest) implBetaResponseItemUnion() {}
+func (BetaResponseItemMcpApprovalResponse) implBetaResponseItemUnion() {}
+func (BetaResponseItemMcpCall) implBetaResponseItemUnion() {}
+func (BetaResponseCustomToolCallItem) implBetaResponseItemUnion() {}
+func (BetaResponseCustomToolCallOutputItem) implBetaResponseItemUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseItemUnion.AsAny().(type) {
+// case openai.BetaResponseInputMessageItem:
+// case openai.BetaResponseOutputMessage:
+// case openai.BetaResponseFileSearchToolCall:
+// case openai.BetaResponseComputerToolCall:
+// case openai.BetaResponseComputerToolCallOutputItem:
+// case openai.BetaResponseFunctionWebSearch:
+// case openai.BetaResponseFunctionToolCallItem:
+// case openai.BetaResponseFunctionToolCallOutputItem:
+// case openai.BetaResponseItemAgentMessage:
+// case openai.BetaResponseItemMultiAgentCall:
+// case openai.BetaResponseItemMultiAgentCallOutput:
+// case openai.BetaResponseToolSearchCall:
+// case openai.BetaResponseToolSearchOutputItem:
+// case openai.BetaResponseItemAdditionalTools:
+// case openai.BetaResponseReasoningItem:
+// case openai.BetaResponseItemProgram:
+// case openai.BetaResponseItemProgramOutput:
+// case openai.BetaResponseCompactionItem:
+// case openai.BetaResponseItemImageGenerationCall:
+// case openai.BetaResponseCodeInterpreterToolCall:
+// case openai.BetaResponseItemLocalShellCall:
+// case openai.BetaResponseItemLocalShellCallOutput:
+// case openai.BetaResponseFunctionShellToolCall:
+// case openai.BetaResponseFunctionShellToolCallOutput:
+// case openai.BetaResponseApplyPatchToolCall:
+// case openai.BetaResponseApplyPatchToolCallOutput:
+// case openai.BetaResponseItemMcpListTools:
+// case openai.BetaResponseItemMcpApprovalRequest:
+// case openai.BetaResponseItemMcpApprovalResponse:
+// case openai.BetaResponseItemMcpCall:
+// case openai.BetaResponseCustomToolCallItem:
+// case openai.BetaResponseCustomToolCallOutputItem:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseItemUnion) AsAny() anyBetaResponseItem {
+ switch u.Type {
+ case "message":
+ return u.AsOutputMessage()
+ case "file_search_call":
+ return u.AsFileSearchCall()
+ case "computer_call":
+ return u.AsComputerCall()
+ case "computer_call_output":
+ return u.AsComputerCallOutput()
+ case "web_search_call":
+ return u.AsWebSearchCall()
+ case "function_call":
+ return u.AsFunctionCall()
+ case "function_call_output":
+ return u.AsFunctionCallOutput()
+ case "agent_message":
+ return u.AsAgentMessage()
+ case "multi_agent_call":
+ return u.AsMultiAgentCall()
+ case "multi_agent_call_output":
+ return u.AsMultiAgentCallOutput()
+ case "tool_search_call":
+ return u.AsToolSearchCall()
+ case "tool_search_output":
+ return u.AsToolSearchOutput()
+ case "additional_tools":
+ return u.AsAdditionalTools()
+ case "reasoning":
+ return u.AsReasoning()
+ case "program":
+ return u.AsProgram()
+ case "program_output":
+ return u.AsProgramOutput()
+ case "compaction":
+ return u.AsCompaction()
+ case "image_generation_call":
+ return u.AsImageGenerationCall()
+ case "code_interpreter_call":
+ return u.AsCodeInterpreterCall()
+ case "local_shell_call":
+ return u.AsLocalShellCall()
+ case "local_shell_call_output":
+ return u.AsLocalShellCallOutput()
+ case "shell_call":
+ return u.AsShellCall()
+ case "shell_call_output":
+ return u.AsShellCallOutput()
+ case "apply_patch_call":
+ return u.AsApplyPatchCall()
+ case "apply_patch_call_output":
+ return u.AsApplyPatchCallOutput()
+ case "mcp_list_tools":
+ return u.AsMcpListTools()
+ case "mcp_approval_request":
+ return u.AsMcpApprovalRequest()
+ case "mcp_approval_response":
+ return u.AsMcpApprovalResponse()
+ case "mcp_call":
+ return u.AsMcpCall()
+ case "custom_tool_call":
+ return u.AsCustomToolCall()
+ case "custom_tool_call_output":
+ return u.AsCustomToolCallOutput()
+ }
+ return nil
+}
+
+func (u BetaResponseItemUnion) AsMessage() (v BetaResponseInputMessageItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsOutputMessage() (v BetaResponseOutputMessage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsFileSearchCall() (v BetaResponseFileSearchToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsComputerCall() (v BetaResponseComputerToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsComputerCallOutput() (v BetaResponseComputerToolCallOutputItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsWebSearchCall() (v BetaResponseFunctionWebSearch) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsFunctionCall() (v BetaResponseFunctionToolCallItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsFunctionCallOutput() (v BetaResponseFunctionToolCallOutputItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsAgentMessage() (v BetaResponseItemAgentMessage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsMultiAgentCall() (v BetaResponseItemMultiAgentCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsMultiAgentCallOutput() (v BetaResponseItemMultiAgentCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsToolSearchCall() (v BetaResponseToolSearchCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsToolSearchOutput() (v BetaResponseToolSearchOutputItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsAdditionalTools() (v BetaResponseItemAdditionalTools) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsReasoning() (v BetaResponseReasoningItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsProgram() (v BetaResponseItemProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsProgramOutput() (v BetaResponseItemProgramOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsCompaction() (v BetaResponseCompactionItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsImageGenerationCall() (v BetaResponseItemImageGenerationCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsCodeInterpreterCall() (v BetaResponseCodeInterpreterToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsLocalShellCall() (v BetaResponseItemLocalShellCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsLocalShellCallOutput() (v BetaResponseItemLocalShellCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsShellCall() (v BetaResponseFunctionShellToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsShellCallOutput() (v BetaResponseFunctionShellToolCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsApplyPatchCall() (v BetaResponseApplyPatchToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsApplyPatchCallOutput() (v BetaResponseApplyPatchToolCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsMcpListTools() (v BetaResponseItemMcpListTools) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsMcpApprovalRequest() (v BetaResponseItemMcpApprovalRequest) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsMcpApprovalResponse() (v BetaResponseItemMcpApprovalResponse) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsMcpCall() (v BetaResponseItemMcpCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsCustomToolCall() (v BetaResponseCustomToolCallItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemUnion) AsCustomToolCallOutput() (v BetaResponseCustomToolCallOutputItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseItemUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseItemUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseItemUnionContent is an implicit subunion of [BetaResponseItemUnion].
+// BetaResponseItemUnionContent provides convenient access to the sub-properties of
+// the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseItemUnion].
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfInputItemContentList OfBetaResponseOutputMessageContentArray
+// OfBetaResponseItemAgentMessageContentArray
+// OfBetaResponseReasoningItemContentArray]
+type BetaResponseItemUnionContent struct {
+ // This field will be present if the value is a
+ // [BetaResponseInputMessageContentList] instead of an object.
+ OfInputItemContentList BetaResponseInputMessageContentList `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseOutputMessageContentUnion] instead of an object.
+ OfBetaResponseOutputMessageContentArray []BetaResponseOutputMessageContentUnion `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseItemAgentMessageContentUnion] instead of an object.
+ OfBetaResponseItemAgentMessageContentArray []BetaResponseItemAgentMessageContentUnion `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseReasoningItemContent] instead of an object.
+ OfBetaResponseReasoningItemContentArray []BetaResponseReasoningItemContent `json:",inline"`
+ JSON struct {
+ OfInputItemContentList respjson.Field
+ OfBetaResponseOutputMessageContentArray respjson.Field
+ OfBetaResponseItemAgentMessageContentArray respjson.Field
+ OfBetaResponseReasoningItemContentArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseItemUnionContent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseItemUnionAgent is an implicit subunion of [BetaResponseItemUnion].
+// BetaResponseItemUnionAgent provides convenient access to the sub-properties of
+// the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseItemUnion].
+type BetaResponseItemUnionAgent struct {
+ AgentName string `json:"agent_name"`
+ JSON struct {
+ AgentName respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseItemUnionAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseItemUnionAction is an implicit subunion of [BetaResponseItemUnion].
+// BetaResponseItemUnionAction provides convenient access to the sub-properties of
+// the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseItemUnion].
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfBetaResponseItemMultiAgentCallOutputAction]
+type BetaResponseItemUnionAction struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfBetaResponseItemMultiAgentCallOutputAction string `json:",inline"`
+ // This field is from variant [BetaComputerActionUnion].
+ Button string `json:"button"`
+ Type string `json:"type"`
+ X int64 `json:"x"`
+ Y int64 `json:"y"`
+ Keys []string `json:"keys"`
+ // This field is from variant [BetaComputerActionUnion].
+ Path []BetaComputerActionDragPath `json:"path"`
+ // This field is from variant [BetaComputerActionUnion].
+ ScrollX int64 `json:"scroll_x"`
+ // This field is from variant [BetaComputerActionUnion].
+ ScrollY int64 `json:"scroll_y"`
+ // This field is from variant [BetaComputerActionUnion].
+ Text string `json:"text"`
+ // This field is from variant [BetaResponseFunctionWebSearchActionUnion].
+ Queries []string `json:"queries"`
+ // This field is from variant [BetaResponseFunctionWebSearchActionUnion].
+ Query string `json:"query"`
+ // This field is from variant [BetaResponseFunctionWebSearchActionUnion].
+ Sources []BetaResponseFunctionWebSearchActionSearchSource `json:"sources"`
+ URL string `json:"url"`
+ // This field is from variant [BetaResponseFunctionWebSearchActionUnion].
+ Pattern string `json:"pattern"`
+ // This field is from variant [BetaResponseItemLocalShellCallAction].
+ Command []string `json:"command"`
+ // This field is from variant [BetaResponseItemLocalShellCallAction].
+ Env map[string]string `json:"env"`
+ TimeoutMs int64 `json:"timeout_ms"`
+ // This field is from variant [BetaResponseItemLocalShellCallAction].
+ User string `json:"user"`
+ // This field is from variant [BetaResponseItemLocalShellCallAction].
+ WorkingDirectory string `json:"working_directory"`
+ // This field is from variant [BetaResponseFunctionShellToolCallAction].
+ Commands []string `json:"commands"`
+ // This field is from variant [BetaResponseFunctionShellToolCallAction].
+ MaxOutputLength int64 `json:"max_output_length"`
+ JSON struct {
+ OfBetaResponseItemMultiAgentCallOutputAction respjson.Field
+ Button respjson.Field
+ Type respjson.Field
+ X respjson.Field
+ Y respjson.Field
+ Keys respjson.Field
+ Path respjson.Field
+ ScrollX respjson.Field
+ ScrollY respjson.Field
+ Text respjson.Field
+ Queries respjson.Field
+ Query respjson.Field
+ Sources respjson.Field
+ URL respjson.Field
+ Pattern respjson.Field
+ Command respjson.Field
+ Env respjson.Field
+ TimeoutMs respjson.Field
+ User respjson.Field
+ WorkingDirectory respjson.Field
+ Commands respjson.Field
+ MaxOutputLength respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseItemUnionAction) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseItemUnionOutput is an implicit subunion of [BetaResponseItemUnion].
+// BetaResponseItemUnionOutput provides convenient access to the sub-properties of
+// the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseItemUnion].
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString OfOutputContentList OfBetaResponseOutputTextArray
+// OfBetaResponseFunctionShellToolCallOutputOutputArray]
+type BetaResponseItemUnionOutput struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion]
+ // instead of an object.
+ OfOutputContentList []BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion `json:",inline"`
+ // This field will be present if the value is a [[]BetaResponseOutputText] instead
+ // of an object.
+ OfBetaResponseOutputTextArray []BetaResponseOutputText `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseFunctionShellToolCallOutputOutput] instead of an object.
+ OfBetaResponseFunctionShellToolCallOutputOutputArray []BetaResponseFunctionShellToolCallOutputOutput `json:",inline"`
+ // This field is from variant [BetaResponseComputerToolCallOutputScreenshot].
+ Type constant.ComputerScreenshot `json:"type"`
+ // This field is from variant [BetaResponseComputerToolCallOutputScreenshot].
+ FileID string `json:"file_id"`
+ // This field is from variant [BetaResponseComputerToolCallOutputScreenshot].
+ ImageURL string `json:"image_url"`
+ JSON struct {
+ OfString respjson.Field
+ OfOutputContentList respjson.Field
+ OfBetaResponseOutputTextArray respjson.Field
+ OfBetaResponseFunctionShellToolCallOutputOutputArray respjson.Field
+ Type respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseItemUnionOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseItemUnionArguments is an implicit subunion of
+// [BetaResponseItemUnion]. BetaResponseItemUnionArguments provides convenient
+// access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseItemUnion].
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString OfBetaResponseToolSearchCallArguments]
+type BetaResponseItemUnionArguments struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [any] instead of an object.
+ OfBetaResponseToolSearchCallArguments any `json:",inline"`
+ JSON struct {
+ OfString respjson.Field
+ OfBetaResponseToolSearchCallArguments respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseItemUnionArguments) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseItemUnionCaller is an implicit subunion of [BetaResponseItemUnion].
+// BetaResponseItemUnionCaller provides convenient access to the sub-properties of
+// the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseItemUnion].
+type BetaResponseItemUnionCaller struct {
+ Type string `json:"type"`
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseItemUnionCaller) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseItemUnionTools is an implicit subunion of [BetaResponseItemUnion].
+// BetaResponseItemUnionTools provides convenient access to the sub-properties of
+// the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseItemUnion].
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfBetaToolArray OfBetaResponseItemMcpListToolsTools]
+type BetaResponseItemUnionTools struct {
+ // This field will be present if the value is a [[]BetaToolUnion] instead of an
+ // object.
+ OfBetaToolArray []BetaToolUnion `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseItemMcpListToolsTool] instead of an object.
+ OfBetaResponseItemMcpListToolsTools []BetaResponseItemMcpListToolsTool `json:",inline"`
+ JSON struct {
+ OfBetaToolArray respjson.Field
+ OfBetaResponseItemMcpListToolsTools respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseItemUnionTools) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseItemAgentMessage struct {
+ // The unique ID of the agent message.
+ ID string `json:"id" api:"required"`
+ // The sending agent identity.
+ Author string `json:"author" api:"required"`
+ // Encrypted content sent between agents.
+ Content []BetaResponseItemAgentMessageContentUnion `json:"content" api:"required"`
+ // The destination agent identity.
+ Recipient string `json:"recipient" api:"required"`
+ // The type of the item. Always `agent_message`.
+ Type constant.AgentMessage `json:"type" default:"agent_message"`
+ // The agent that produced this item.
+ Agent BetaResponseItemAgentMessageAgent `json:"agent"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Author respjson.Field
+ Content respjson.Field
+ Recipient respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemAgentMessage) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemAgentMessage) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseItemAgentMessageContentUnion contains all possible properties and
+// values from [BetaResponseInputText], [BetaResponseOutputText],
+// [BetaResponseItemAgentMessageContentText],
+// [BetaResponseItemAgentMessageContentSummaryText],
+// [BetaResponseItemAgentMessageContentReasoningText], [BetaResponseOutputRefusal],
+// [BetaResponseInputImage],
+// [BetaResponseItemAgentMessageContentComputerScreenshot],
+// [BetaResponseInputFile], [BetaResponseItemAgentMessageContentEncryptedContent].
+//
+// Use the [BetaResponseItemAgentMessageContentUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseItemAgentMessageContentUnion struct {
+ Text string `json:"text"`
+ // Any of "input_text", "output_text", "text", "summary_text", "reasoning_text",
+ // "refusal", "input_image", "computer_screenshot", "input_file",
+ // "encrypted_content".
+ Type string `json:"type"`
+ // This field is a union of [BetaResponseInputTextPromptCacheBreakpoint],
+ // [BetaResponseInputImagePromptCacheBreakpoint],
+ // [BetaResponseItemAgentMessageContentComputerScreenshotPromptCacheBreakpoint],
+ // [BetaResponseInputFilePromptCacheBreakpoint]
+ PromptCacheBreakpoint BetaResponseItemAgentMessageContentUnionPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
+ // This field is from variant [BetaResponseOutputText].
+ Annotations []BetaResponseOutputTextAnnotationUnion `json:"annotations"`
+ // This field is from variant [BetaResponseOutputText].
+ Logprobs []BetaResponseOutputTextLogprob `json:"logprobs"`
+ // This field is from variant [BetaResponseOutputRefusal].
+ Refusal string `json:"refusal"`
+ Detail string `json:"detail"`
+ FileID string `json:"file_id"`
+ ImageURL string `json:"image_url"`
+ // This field is from variant [BetaResponseInputFile].
+ FileData string `json:"file_data"`
+ // This field is from variant [BetaResponseInputFile].
+ FileURL string `json:"file_url"`
+ // This field is from variant [BetaResponseInputFile].
+ Filename string `json:"filename"`
+ // This field is from variant
+ // [BetaResponseItemAgentMessageContentEncryptedContent].
+ EncryptedContent string `json:"encrypted_content"`
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ Annotations respjson.Field
+ Logprobs respjson.Field
+ Refusal respjson.Field
+ Detail respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ FileData respjson.Field
+ FileURL respjson.Field
+ Filename respjson.Field
+ EncryptedContent respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseItemAgentMessageContent is implemented by each variant of
+// [BetaResponseItemAgentMessageContentUnion] to add type safety for the return
+// type of [BetaResponseItemAgentMessageContentUnion.AsAny]
+type anyBetaResponseItemAgentMessageContent interface {
+ implBetaResponseItemAgentMessageContentUnion()
+}
+
+func (BetaResponseInputText) implBetaResponseItemAgentMessageContentUnion() {}
+func (BetaResponseOutputText) implBetaResponseItemAgentMessageContentUnion() {}
+func (BetaResponseItemAgentMessageContentText) implBetaResponseItemAgentMessageContentUnion() {}
+func (BetaResponseItemAgentMessageContentSummaryText) implBetaResponseItemAgentMessageContentUnion() {
+}
+func (BetaResponseItemAgentMessageContentReasoningText) implBetaResponseItemAgentMessageContentUnion() {
+}
+func (BetaResponseOutputRefusal) implBetaResponseItemAgentMessageContentUnion() {}
+func (BetaResponseInputImage) implBetaResponseItemAgentMessageContentUnion() {}
+func (BetaResponseItemAgentMessageContentComputerScreenshot) implBetaResponseItemAgentMessageContentUnion() {
+}
+func (BetaResponseInputFile) implBetaResponseItemAgentMessageContentUnion() {}
+func (BetaResponseItemAgentMessageContentEncryptedContent) implBetaResponseItemAgentMessageContentUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseItemAgentMessageContentUnion.AsAny().(type) {
+// case openai.BetaResponseInputText:
+// case openai.BetaResponseOutputText:
+// case openai.BetaResponseItemAgentMessageContentText:
+// case openai.BetaResponseItemAgentMessageContentSummaryText:
+// case openai.BetaResponseItemAgentMessageContentReasoningText:
+// case openai.BetaResponseOutputRefusal:
+// case openai.BetaResponseInputImage:
+// case openai.BetaResponseItemAgentMessageContentComputerScreenshot:
+// case openai.BetaResponseInputFile:
+// case openai.BetaResponseItemAgentMessageContentEncryptedContent:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseItemAgentMessageContentUnion) AsAny() anyBetaResponseItemAgentMessageContent {
+ switch u.Type {
+ case "input_text":
+ return u.AsInputText()
+ case "output_text":
+ return u.AsOutputText()
+ case "text":
+ return u.AsText()
+ case "summary_text":
+ return u.AsSummaryText()
+ case "reasoning_text":
+ return u.AsReasoningText()
+ case "refusal":
+ return u.AsRefusal()
+ case "input_image":
+ return u.AsInputImage()
+ case "computer_screenshot":
+ return u.AsComputerScreenshot()
+ case "input_file":
+ return u.AsInputFile()
+ case "encrypted_content":
+ return u.AsEncryptedContent()
+ }
+ return nil
+}
+
+func (u BetaResponseItemAgentMessageContentUnion) AsInputText() (v BetaResponseInputText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemAgentMessageContentUnion) AsOutputText() (v BetaResponseOutputText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemAgentMessageContentUnion) AsText() (v BetaResponseItemAgentMessageContentText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemAgentMessageContentUnion) AsSummaryText() (v BetaResponseItemAgentMessageContentSummaryText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemAgentMessageContentUnion) AsReasoningText() (v BetaResponseItemAgentMessageContentReasoningText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemAgentMessageContentUnion) AsRefusal() (v BetaResponseOutputRefusal) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemAgentMessageContentUnion) AsInputImage() (v BetaResponseInputImage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemAgentMessageContentUnion) AsComputerScreenshot() (v BetaResponseItemAgentMessageContentComputerScreenshot) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemAgentMessageContentUnion) AsInputFile() (v BetaResponseInputFile) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseItemAgentMessageContentUnion) AsEncryptedContent() (v BetaResponseItemAgentMessageContentEncryptedContent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseItemAgentMessageContentUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseItemAgentMessageContentUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseItemAgentMessageContentUnionPromptCacheBreakpoint is an implicit
+// subunion of [BetaResponseItemAgentMessageContentUnion].
+// BetaResponseItemAgentMessageContentUnionPromptCacheBreakpoint provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseItemAgentMessageContentUnion].
+type BetaResponseItemAgentMessageContentUnionPromptCacheBreakpoint struct {
+ // This field is from variant [BetaResponseInputTextPromptCacheBreakpoint].
+ Mode constant.Explicit `json:"mode"`
+ JSON struct {
+ Mode respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseItemAgentMessageContentUnionPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A text content.
+type BetaResponseItemAgentMessageContentText struct {
+ Text string `json:"text" api:"required"`
+ Type constant.Text `json:"type" default:"text"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemAgentMessageContentText) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemAgentMessageContentText) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A summary text from the model.
+type BetaResponseItemAgentMessageContentSummaryText struct {
+ // A summary of the reasoning output from the model so far.
+ Text string `json:"text" api:"required"`
+ // The type of the object. Always `summary_text`.
+ Type constant.SummaryText `json:"type" default:"summary_text"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemAgentMessageContentSummaryText) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemAgentMessageContentSummaryText) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Reasoning text from the model.
+type BetaResponseItemAgentMessageContentReasoningText struct {
+ // The reasoning text from the model.
+ Text string `json:"text" api:"required"`
+ // The type of the reasoning text. Always `reasoning_text`.
+ Type constant.ReasoningText `json:"type" default:"reasoning_text"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemAgentMessageContentReasoningText) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemAgentMessageContentReasoningText) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A screenshot of a computer.
+type BetaResponseItemAgentMessageContentComputerScreenshot struct {
+ // The detail level of the screenshot image to be sent to the model. One of `high`,
+ // `low`, `auto`, or `original`. Defaults to `auto`.
+ //
+ // Any of "low", "high", "auto", "original".
+ Detail string `json:"detail" api:"required"`
+ // The identifier of an uploaded file that contains the screenshot.
+ FileID string `json:"file_id" api:"required"`
+ // The URL of the screenshot image.
+ ImageURL string `json:"image_url" api:"required" format:"uri"`
+ // Specifies the event type. For a computer screenshot, this property is always set
+ // to `computer_screenshot`.
+ Type constant.ComputerScreenshot `json:"type" default:"computer_screenshot"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint BetaResponseItemAgentMessageContentComputerScreenshotPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Detail respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemAgentMessageContentComputerScreenshot) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemAgentMessageContentComputerScreenshot) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+type BetaResponseItemAgentMessageContentComputerScreenshotPromptCacheBreakpoint struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Mode respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemAgentMessageContentComputerScreenshotPromptCacheBreakpoint) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *BetaResponseItemAgentMessageContentComputerScreenshotPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Opaque encrypted content that Responses API decrypts inside trusted model
+// execution.
+type BetaResponseItemAgentMessageContentEncryptedContent struct {
+ // Opaque encrypted content.
+ EncryptedContent string `json:"encrypted_content" api:"required"`
+ // The type of the input item. Always `encrypted_content`.
+ Type constant.EncryptedContent `json:"type" default:"encrypted_content"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ EncryptedContent respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemAgentMessageContentEncryptedContent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemAgentMessageContentEncryptedContent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseItemAgentMessageAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemAgentMessageAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemAgentMessageAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseItemMultiAgentCall struct {
+ // The unique ID of the multi-agent call item.
+ ID string `json:"id" api:"required"`
+ // The multi-agent action to execute.
+ //
+ // Any of "spawn_agent", "interrupt_agent", "list_agents", "send_message",
+ // "followup_task", "wait_agent".
+ Action string `json:"action" api:"required"`
+ // The JSON string of arguments generated for the action.
+ Arguments string `json:"arguments" api:"required"`
+ // The unique ID linking this call to its output.
+ CallID string `json:"call_id" api:"required"`
+ // The type of the multi-agent call. Always `multi_agent_call`.
+ Type constant.MultiAgentCall `json:"type" default:"multi_agent_call"`
+ // The agent that produced this item.
+ Agent BetaResponseItemMultiAgentCallAgent `json:"agent"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Action respjson.Field
+ Arguments respjson.Field
+ CallID respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemMultiAgentCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemMultiAgentCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseItemMultiAgentCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemMultiAgentCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemMultiAgentCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseItemMultiAgentCallOutput struct {
+ // The unique ID of the multi-agent call output item.
+ ID string `json:"id" api:"required"`
+ // The multi-agent action that produced this result.
+ //
+ // Any of "spawn_agent", "interrupt_agent", "list_agents", "send_message",
+ // "followup_task", "wait_agent".
+ Action string `json:"action" api:"required"`
+ // The unique ID of the multi-agent call.
+ CallID string `json:"call_id" api:"required"`
+ // Text output returned by the multi-agent action.
+ Output []BetaResponseOutputText `json:"output" api:"required"`
+ // The type of the multi-agent result. Always `multi_agent_call_output`.
+ Type constant.MultiAgentCallOutput `json:"type" default:"multi_agent_call_output"`
+ // The agent that produced this item.
+ Agent BetaResponseItemMultiAgentCallOutputAgent `json:"agent"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Action respjson.Field
+ CallID respjson.Field
+ Output respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemMultiAgentCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemMultiAgentCallOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseItemMultiAgentCallOutputAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemMultiAgentCallOutputAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemMultiAgentCallOutputAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseItemAdditionalTools struct {
+ // The unique ID of the additional tools item.
+ ID string `json:"id" api:"required"`
+ // The role that provided the additional tools.
+ //
+ // Any of "unknown", "user", "assistant", "system", "critic", "discriminator",
+ // "developer", "tool".
+ Role string `json:"role" api:"required"`
+ // The additional tool definitions made available at this item.
+ Tools []BetaToolUnion `json:"tools" api:"required"`
+ // The type of the item. Always `additional_tools`.
+ Type constant.AdditionalTools `json:"type" default:"additional_tools"`
+ // The agent that produced this item.
+ Agent BetaResponseItemAdditionalToolsAgent `json:"agent"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Role respjson.Field
+ Tools respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemAdditionalTools) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemAdditionalTools) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseItemAdditionalToolsAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemAdditionalToolsAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemAdditionalToolsAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseItemProgram struct {
+ // The unique ID of the program item.
+ ID string `json:"id" api:"required"`
+ // The stable call ID of the program item.
+ CallID string `json:"call_id" api:"required"`
+ // The JavaScript source executed by programmatic tool calling.
+ Code string `json:"code" api:"required"`
+ // Opaque program replay fingerprint that must be round-tripped.
+ Fingerprint string `json:"fingerprint" api:"required"`
+ // The type of the item. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
+ // The agent that produced this item.
+ Agent BetaResponseItemProgramAgent `json:"agent"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Code respjson.Field
+ Fingerprint respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemProgram) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseItemProgramAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemProgramAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemProgramAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseItemProgramOutput struct {
+ // The unique ID of the program output item.
+ ID string `json:"id" api:"required"`
+ // The call ID of the program item.
+ CallID string `json:"call_id" api:"required"`
+ // The result produced by the program item.
+ Result string `json:"result" api:"required"`
+ // The terminal status of the program output item.
+ //
+ // Any of "completed", "incomplete".
+ Status string `json:"status" api:"required"`
+ // The type of the item. Always `program_output`.
+ Type constant.ProgramOutput `json:"type" default:"program_output"`
+ // The agent that produced this item.
+ Agent BetaResponseItemProgramOutputAgent `json:"agent"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Result respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemProgramOutput) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemProgramOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseItemProgramOutputAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemProgramOutputAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemProgramOutputAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An image generation request made by the model.
+type BetaResponseItemImageGenerationCall struct {
+ // The unique ID of the image generation call.
+ ID string `json:"id" api:"required"`
+ // The generated image encoded in base64.
+ Result string `json:"result" api:"required"`
+ // The status of the image generation call.
+ //
+ // Any of "in_progress", "completed", "generating", "failed".
+ Status string `json:"status" api:"required"`
+ // The type of the image generation call. Always `image_generation_call`.
+ Type constant.ImageGenerationCall `json:"type" default:"image_generation_call"`
+ // The agent that produced this item.
+ Agent BetaResponseItemImageGenerationCallAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Result respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemImageGenerationCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemImageGenerationCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseItemImageGenerationCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemImageGenerationCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemImageGenerationCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool call to run a command on the local shell.
+type BetaResponseItemLocalShellCall struct {
+ // The unique ID of the local shell call.
+ ID string `json:"id" api:"required"`
+ // Execute a shell command on the server.
+ Action BetaResponseItemLocalShellCallAction `json:"action" api:"required"`
+ // The unique ID of the local shell tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // The status of the local shell call.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status" api:"required"`
+ // The type of the local shell call. Always `local_shell_call`.
+ Type constant.LocalShellCall `json:"type" default:"local_shell_call"`
+ // The agent that produced this item.
+ Agent BetaResponseItemLocalShellCallAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Action respjson.Field
+ CallID respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemLocalShellCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemLocalShellCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Execute a shell command on the server.
+type BetaResponseItemLocalShellCallAction struct {
+ // The command to run.
+ Command []string `json:"command" api:"required"`
+ // Environment variables to set for the command.
+ Env map[string]string `json:"env" api:"required"`
+ // The type of the local shell action. Always `exec`.
+ Type constant.Exec `json:"type" default:"exec"`
+ // Optional timeout in milliseconds for the command.
+ TimeoutMs int64 `json:"timeout_ms" api:"nullable"`
+ // Optional user to run the command as.
+ User string `json:"user" api:"nullable"`
+ // Optional working directory to run the command in.
+ WorkingDirectory string `json:"working_directory" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Command respjson.Field
+ Env respjson.Field
+ Type respjson.Field
+ TimeoutMs respjson.Field
+ User respjson.Field
+ WorkingDirectory respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemLocalShellCallAction) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemLocalShellCallAction) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseItemLocalShellCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemLocalShellCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemLocalShellCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The output of a local shell tool call.
+type BetaResponseItemLocalShellCallOutput struct {
+ // The unique ID of the local shell tool call generated by the model.
+ ID string `json:"id" api:"required"`
+ // A JSON string of the output of the local shell tool call.
+ Output string `json:"output" api:"required"`
+ // The type of the local shell tool call output. Always `local_shell_call_output`.
+ Type constant.LocalShellCallOutput `json:"type" default:"local_shell_call_output"`
+ // The agent that produced this item.
+ Agent BetaResponseItemLocalShellCallOutputAgent `json:"agent" api:"nullable"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Output respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemLocalShellCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemLocalShellCallOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseItemLocalShellCallOutputAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemLocalShellCallOutputAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemLocalShellCallOutputAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A list of tools available on an MCP server.
+type BetaResponseItemMcpListTools struct {
+ // The unique ID of the list.
+ ID string `json:"id" api:"required"`
+ // The label of the MCP server.
+ ServerLabel string `json:"server_label" api:"required"`
+ // The tools available on the server.
+ Tools []BetaResponseItemMcpListToolsTool `json:"tools" api:"required"`
+ // The type of the item. Always `mcp_list_tools`.
+ Type constant.McpListTools `json:"type" default:"mcp_list_tools"`
+ // The agent that produced this item.
+ Agent BetaResponseItemMcpListToolsAgent `json:"agent" api:"nullable"`
+ // Error message if the server could not list tools.
+ Error string `json:"error" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ ServerLabel respjson.Field
+ Tools respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Error respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemMcpListTools) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemMcpListTools) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool available on an MCP server.
+type BetaResponseItemMcpListToolsTool struct {
+ // The JSON schema describing the tool's input.
+ InputSchema any `json:"input_schema" api:"required"`
+ // The name of the tool.
+ Name string `json:"name" api:"required"`
+ // Additional annotations about the tool.
+ Annotations any `json:"annotations" api:"nullable"`
+ // The description of the tool.
+ Description string `json:"description" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ InputSchema respjson.Field
+ Name respjson.Field
+ Annotations respjson.Field
+ Description respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemMcpListToolsTool) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemMcpListToolsTool) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseItemMcpListToolsAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemMcpListToolsAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemMcpListToolsAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A request for human approval of a tool invocation.
+type BetaResponseItemMcpApprovalRequest struct {
+ // The unique ID of the approval request.
+ ID string `json:"id" api:"required"`
+ // A JSON string of arguments for the tool.
+ Arguments string `json:"arguments" api:"required"`
+ // The name of the tool to run.
+ Name string `json:"name" api:"required"`
+ // The label of the MCP server making the request.
+ ServerLabel string `json:"server_label" api:"required"`
+ // The type of the item. Always `mcp_approval_request`.
+ Type constant.McpApprovalRequest `json:"type" default:"mcp_approval_request"`
+ // The agent that produced this item.
+ Agent BetaResponseItemMcpApprovalRequestAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Arguments respjson.Field
+ Name respjson.Field
+ ServerLabel respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemMcpApprovalRequest) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemMcpApprovalRequest) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseItemMcpApprovalRequestAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemMcpApprovalRequestAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemMcpApprovalRequestAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A response to an MCP approval request.
+type BetaResponseItemMcpApprovalResponse struct {
+ // The unique ID of the approval response
+ ID string `json:"id" api:"required"`
+ // The ID of the approval request being answered.
+ ApprovalRequestID string `json:"approval_request_id" api:"required"`
+ // Whether the request was approved.
+ Approve bool `json:"approve" api:"required"`
+ // The type of the item. Always `mcp_approval_response`.
+ Type constant.McpApprovalResponse `json:"type" default:"mcp_approval_response"`
+ // The agent that produced this item.
+ Agent BetaResponseItemMcpApprovalResponseAgent `json:"agent" api:"nullable"`
+ // Optional reason for the decision.
+ Reason string `json:"reason" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ ApprovalRequestID respjson.Field
+ Approve respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Reason respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemMcpApprovalResponse) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemMcpApprovalResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseItemMcpApprovalResponseAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemMcpApprovalResponseAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemMcpApprovalResponseAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An invocation of a tool on an MCP server.
+type BetaResponseItemMcpCall struct {
+ // The unique ID of the tool call.
+ ID string `json:"id" api:"required"`
+ // A JSON string of the arguments passed to the tool.
+ Arguments string `json:"arguments" api:"required"`
+ // The name of the tool that was run.
+ Name string `json:"name" api:"required"`
+ // The label of the MCP server running the tool.
+ ServerLabel string `json:"server_label" api:"required"`
+ // The type of the item. Always `mcp_call`.
+ Type constant.McpCall `json:"type" default:"mcp_call"`
+ // The agent that produced this item.
+ Agent BetaResponseItemMcpCallAgent `json:"agent" api:"nullable"`
+ // Unique identifier for the MCP tool call approval request. Include this value in
+ // a subsequent `mcp_approval_response` input to approve or reject the
+ // corresponding tool call.
+ ApprovalRequestID string `json:"approval_request_id" api:"nullable"`
+ // The error from the tool call, if any.
+ Error string `json:"error" api:"nullable"`
+ // The output from the tool call.
+ Output string `json:"output" api:"nullable"`
+ // The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
+ // `calling`, or `failed`.
+ //
+ // Any of "in_progress", "completed", "incomplete", "calling", "failed".
+ Status string `json:"status"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Arguments respjson.Field
+ Name respjson.Field
+ ServerLabel respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ApprovalRequestID respjson.Field
+ Error respjson.Field
+ Output respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemMcpCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemMcpCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseItemMcpCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemMcpCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemMcpCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Represents the use of a local environment to perform shell actions.
+type BetaResponseLocalEnvironment struct {
+ // The environment type. Always `local`.
+ Type constant.Local `json:"type" default:"local"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseLocalEnvironment) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseLocalEnvironment) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when there is a delta (partial update) to the arguments of an MCP tool
+// call.
+type BetaResponseMcpCallArgumentsDeltaEvent struct {
+ // A JSON string containing the partial update to the arguments for the MCP tool
+ // call.
+ Delta string `json:"delta" api:"required"`
+ // The unique identifier of the MCP tool call item being processed.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item in the response's output array.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always 'response.mcp_call_arguments.delta'.
+ Type constant.ResponseMcpCallArgumentsDelta `json:"type" default:"response.mcp_call_arguments.delta"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseMcpCallArgumentsDeltaEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Delta respjson.Field
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseMcpCallArgumentsDeltaEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseMcpCallArgumentsDeltaEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseMcpCallArgumentsDeltaEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseMcpCallArgumentsDeltaEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseMcpCallArgumentsDeltaEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when the arguments for an MCP tool call are finalized.
+type BetaResponseMcpCallArgumentsDoneEvent struct {
+ // A JSON string containing the finalized arguments for the MCP tool call.
+ Arguments string `json:"arguments" api:"required"`
+ // The unique identifier of the MCP tool call item being processed.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item in the response's output array.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always 'response.mcp_call_arguments.done'.
+ Type constant.ResponseMcpCallArgumentsDone `json:"type" default:"response.mcp_call_arguments.done"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseMcpCallArgumentsDoneEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Arguments respjson.Field
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseMcpCallArgumentsDoneEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseMcpCallArgumentsDoneEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseMcpCallArgumentsDoneEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseMcpCallArgumentsDoneEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseMcpCallArgumentsDoneEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when an MCP tool call has completed successfully.
+type BetaResponseMcpCallCompletedEvent struct {
+ // The ID of the MCP tool call item that completed.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item that completed.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always 'response.mcp_call.completed'.
+ Type constant.ResponseMcpCallCompleted `json:"type" default:"response.mcp_call.completed"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseMcpCallCompletedEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseMcpCallCompletedEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseMcpCallCompletedEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseMcpCallCompletedEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseMcpCallCompletedEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseMcpCallCompletedEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when an MCP tool call has failed.
+type BetaResponseMcpCallFailedEvent struct {
+ // The ID of the MCP tool call item that failed.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item that failed.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always 'response.mcp_call.failed'.
+ Type constant.ResponseMcpCallFailed `json:"type" default:"response.mcp_call.failed"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseMcpCallFailedEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseMcpCallFailedEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseMcpCallFailedEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseMcpCallFailedEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseMcpCallFailedEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseMcpCallFailedEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when an MCP tool call is in progress.
+type BetaResponseMcpCallInProgressEvent struct {
+ // The unique identifier of the MCP tool call item being processed.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item in the response's output array.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always 'response.mcp_call.in_progress'.
+ Type constant.ResponseMcpCallInProgress `json:"type" default:"response.mcp_call.in_progress"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseMcpCallInProgressEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseMcpCallInProgressEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseMcpCallInProgressEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseMcpCallInProgressEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseMcpCallInProgressEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseMcpCallInProgressEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when the list of available MCP tools has been successfully retrieved.
+type BetaResponseMcpListToolsCompletedEvent struct {
+ // The ID of the MCP tool call item that produced this output.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item that was processed.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always 'response.mcp_list_tools.completed'.
+ Type constant.ResponseMcpListToolsCompleted `json:"type" default:"response.mcp_list_tools.completed"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseMcpListToolsCompletedEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseMcpListToolsCompletedEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseMcpListToolsCompletedEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseMcpListToolsCompletedEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseMcpListToolsCompletedEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseMcpListToolsCompletedEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when the attempt to list available MCP tools has failed.
+type BetaResponseMcpListToolsFailedEvent struct {
+ // The ID of the MCP tool call item that failed.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item that failed.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always 'response.mcp_list_tools.failed'.
+ Type constant.ResponseMcpListToolsFailed `json:"type" default:"response.mcp_list_tools.failed"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseMcpListToolsFailedEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseMcpListToolsFailedEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseMcpListToolsFailedEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseMcpListToolsFailedEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseMcpListToolsFailedEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseMcpListToolsFailedEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when the system is in the process of retrieving the list of available
+// MCP tools.
+type BetaResponseMcpListToolsInProgressEvent struct {
+ // The ID of the MCP tool call item that is being processed.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item that is being processed.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always 'response.mcp_list_tools.in_progress'.
+ Type constant.ResponseMcpListToolsInProgress `json:"type" default:"response.mcp_list_tools.in_progress"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseMcpListToolsInProgressEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseMcpListToolsInProgressEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseMcpListToolsInProgressEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseMcpListToolsInProgressEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseMcpListToolsInProgressEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseMcpListToolsInProgressEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseOutputItemUnion contains all possible properties and values from
+// [BetaResponseOutputMessage], [BetaResponseFileSearchToolCall],
+// [BetaResponseFunctionToolCall], [BetaResponseFunctionToolCallOutputItem],
+// [BetaResponseOutputItemAgentMessage], [BetaResponseOutputItemMultiAgentCall],
+// [BetaResponseOutputItemMultiAgentCallOutput], [BetaResponseFunctionWebSearch],
+// [BetaResponseComputerToolCall], [BetaResponseComputerToolCallOutputItem],
+// [BetaResponseReasoningItem], [BetaResponseOutputItemProgram],
+// [BetaResponseOutputItemProgramOutput], [BetaResponseToolSearchCall],
+// [BetaResponseToolSearchOutputItem], [BetaResponseOutputItemAdditionalTools],
+// [BetaResponseCompactionItem], [BetaResponseOutputItemImageGenerationCall],
+// [BetaResponseCodeInterpreterToolCall], [BetaResponseOutputItemLocalShellCall],
+// [BetaResponseOutputItemLocalShellCallOutput],
+// [BetaResponseFunctionShellToolCall], [BetaResponseFunctionShellToolCallOutput],
+// [BetaResponseApplyPatchToolCall], [BetaResponseApplyPatchToolCallOutput],
+// [BetaResponseOutputItemMcpCall], [BetaResponseOutputItemMcpListTools],
+// [BetaResponseOutputItemMcpApprovalRequest],
+// [BetaResponseOutputItemMcpApprovalResponse], [BetaResponseCustomToolCall],
+// [BetaResponseCustomToolCallOutputItem].
+//
+// Use the [BetaResponseOutputItemUnion.AsAny] method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseOutputItemUnion struct {
+ ID string `json:"id"`
+ // This field is a union of [[]BetaResponseOutputMessageContentUnion],
+ // [[]BetaResponseOutputItemAgentMessageContentUnion],
+ // [[]BetaResponseReasoningItemContent]
+ Content BetaResponseOutputItemUnionContent `json:"content"`
+ Role string `json:"role"`
+ Status string `json:"status"`
+ // Any of "message", "file_search_call", "function_call", "function_call_output",
+ // "agent_message", "multi_agent_call", "multi_agent_call_output",
+ // "web_search_call", "computer_call", "computer_call_output", "reasoning",
+ // "program", "program_output", "tool_search_call", "tool_search_output",
+ // "additional_tools", "compaction", "image_generation_call",
+ // "code_interpreter_call", "local_shell_call", "local_shell_call_output",
+ // "shell_call", "shell_call_output", "apply_patch_call",
+ // "apply_patch_call_output", "mcp_call", "mcp_list_tools", "mcp_approval_request",
+ // "mcp_approval_response", "custom_tool_call", "custom_tool_call_output".
+ Type string `json:"type"`
+ // This field is a union of [BetaResponseOutputMessageAgent],
+ // [BetaResponseFileSearchToolCallAgent], [BetaResponseFunctionToolCallAgent],
+ // [BetaResponseFunctionToolCallOutputItemAgent],
+ // [BetaResponseOutputItemAgentMessageAgent],
+ // [BetaResponseOutputItemMultiAgentCallAgent],
+ // [BetaResponseOutputItemMultiAgentCallOutputAgent],
+ // [BetaResponseFunctionWebSearchAgent], [BetaResponseComputerToolCallAgent],
+ // [BetaResponseComputerToolCallOutputItemAgent], [BetaResponseReasoningItemAgent],
+ // [BetaResponseOutputItemProgramAgent],
+ // [BetaResponseOutputItemProgramOutputAgent], [BetaResponseToolSearchCallAgent],
+ // [BetaResponseToolSearchOutputItemAgent],
+ // [BetaResponseOutputItemAdditionalToolsAgent], [BetaResponseCompactionItemAgent],
+ // [BetaResponseOutputItemImageGenerationCallAgent],
+ // [BetaResponseCodeInterpreterToolCallAgent],
+ // [BetaResponseOutputItemLocalShellCallAgent],
+ // [BetaResponseOutputItemLocalShellCallOutputAgent],
+ // [BetaResponseFunctionShellToolCallAgent],
+ // [BetaResponseFunctionShellToolCallOutputAgent],
+ // [BetaResponseApplyPatchToolCallAgent],
+ // [BetaResponseApplyPatchToolCallOutputAgent],
+ // [BetaResponseOutputItemMcpCallAgent], [BetaResponseOutputItemMcpListToolsAgent],
+ // [BetaResponseOutputItemMcpApprovalRequestAgent],
+ // [BetaResponseOutputItemMcpApprovalResponseAgent],
+ // [BetaResponseCustomToolCallAgent], [BetaResponseCustomToolCallOutputAgent]
+ Agent BetaResponseOutputItemUnionAgent `json:"agent"`
+ // This field is from variant [BetaResponseOutputMessage].
+ Phase BetaResponseOutputMessagePhase `json:"phase"`
+ // This field is from variant [BetaResponseFileSearchToolCall].
+ Queries []string `json:"queries"`
+ // This field is from variant [BetaResponseFileSearchToolCall].
+ Results []BetaResponseFileSearchToolCallResult `json:"results"`
+ // This field is a union of [string], [string], [any], [string], [string]
+ Arguments BetaResponseOutputItemUnionArguments `json:"arguments"`
+ CallID string `json:"call_id"`
+ Name string `json:"name"`
+ // This field is a union of [BetaResponseFunctionToolCallCallerUnion],
+ // [BetaResponseFunctionToolCallOutputItemCallerUnion],
+ // [BetaResponseFunctionShellToolCallCallerUnion],
+ // [BetaResponseFunctionShellToolCallOutputCallerUnion],
+ // [BetaResponseApplyPatchToolCallCallerUnion],
+ // [BetaResponseApplyPatchToolCallOutputCallerUnion],
+ // [BetaResponseCustomToolCallCallerUnion],
+ // [BetaResponseCustomToolCallOutputCallerUnion]
+ Caller BetaResponseOutputItemUnionCaller `json:"caller"`
+ Namespace string `json:"namespace"`
+ // This field is a union of [BetaResponseFunctionToolCallOutputItemOutputUnion],
+ // [[]BetaResponseOutputText], [BetaResponseComputerToolCallOutputScreenshot],
+ // [string], [[]BetaResponseFunctionShellToolCallOutputOutput], [string], [string],
+ // [BetaResponseCustomToolCallOutputOutputUnion]
+ Output BetaResponseOutputItemUnionOutput `json:"output"`
+ CreatedBy string `json:"created_by"`
+ // This field is from variant [BetaResponseOutputItemAgentMessage].
+ Author string `json:"author"`
+ // This field is from variant [BetaResponseOutputItemAgentMessage].
+ Recipient string `json:"recipient"`
+ // This field is a union of [string], [string],
+ // [BetaResponseFunctionWebSearchActionUnion], [BetaComputerActionUnion],
+ // [BetaResponseOutputItemLocalShellCallAction],
+ // [BetaResponseFunctionShellToolCallAction]
+ Action BetaResponseOutputItemUnionAction `json:"action"`
+ // This field is from variant [BetaResponseComputerToolCall].
+ PendingSafetyChecks []BetaResponseComputerToolCallPendingSafetyCheck `json:"pending_safety_checks"`
+ // This field is from variant [BetaResponseComputerToolCall].
+ Actions BetaComputerActionList `json:"actions"`
+ // This field is from variant [BetaResponseComputerToolCallOutputItem].
+ AcknowledgedSafetyChecks []BetaResponseComputerToolCallOutputItemAcknowledgedSafetyCheck `json:"acknowledged_safety_checks"`
+ // This field is from variant [BetaResponseReasoningItem].
+ Summary []BetaResponseReasoningItemSummary `json:"summary"`
+ EncryptedContent string `json:"encrypted_content"`
+ Code string `json:"code"`
+ // This field is from variant [BetaResponseOutputItemProgram].
+ Fingerprint string `json:"fingerprint"`
+ Result string `json:"result"`
+ Execution string `json:"execution"`
+ // This field is a union of [[]BetaToolUnion], [[]BetaToolUnion],
+ // [[]BetaResponseOutputItemMcpListToolsTool]
+ Tools BetaResponseOutputItemUnionTools `json:"tools"`
+ // This field is from variant [BetaResponseCodeInterpreterToolCall].
+ ContainerID string `json:"container_id"`
+ // This field is from variant [BetaResponseCodeInterpreterToolCall].
+ Outputs []BetaResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
+ // This field is from variant [BetaResponseFunctionShellToolCall].
+ Environment BetaResponseFunctionShellToolCallEnvironmentUnion `json:"environment"`
+ // This field is from variant [BetaResponseFunctionShellToolCallOutput].
+ MaxOutputLength int64 `json:"max_output_length"`
+ // This field is from variant [BetaResponseApplyPatchToolCall].
+ Operation BetaResponseApplyPatchToolCallOperationUnion `json:"operation"`
+ ServerLabel string `json:"server_label"`
+ ApprovalRequestID string `json:"approval_request_id"`
+ Error string `json:"error"`
+ // This field is from variant [BetaResponseOutputItemMcpApprovalResponse].
+ Approve bool `json:"approve"`
+ // This field is from variant [BetaResponseOutputItemMcpApprovalResponse].
+ Reason string `json:"reason"`
+ // This field is from variant [BetaResponseCustomToolCall].
+ Input string `json:"input"`
+ JSON struct {
+ ID respjson.Field
+ Content respjson.Field
+ Role respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Phase respjson.Field
+ Queries respjson.Field
+ Results respjson.Field
+ Arguments respjson.Field
+ CallID respjson.Field
+ Name respjson.Field
+ Caller respjson.Field
+ Namespace respjson.Field
+ Output respjson.Field
+ CreatedBy respjson.Field
+ Author respjson.Field
+ Recipient respjson.Field
+ Action respjson.Field
+ PendingSafetyChecks respjson.Field
+ Actions respjson.Field
+ AcknowledgedSafetyChecks respjson.Field
+ Summary respjson.Field
+ EncryptedContent respjson.Field
+ Code respjson.Field
+ Fingerprint respjson.Field
+ Result respjson.Field
+ Execution respjson.Field
+ Tools respjson.Field
+ ContainerID respjson.Field
+ Outputs respjson.Field
+ Environment respjson.Field
+ MaxOutputLength respjson.Field
+ Operation respjson.Field
+ ServerLabel respjson.Field
+ ApprovalRequestID respjson.Field
+ Error respjson.Field
+ Approve respjson.Field
+ Reason respjson.Field
+ Input respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseOutputItem is implemented by each variant of
+// [BetaResponseOutputItemUnion] to add type safety for the return type of
+// [BetaResponseOutputItemUnion.AsAny]
+type anyBetaResponseOutputItem interface {
+ implBetaResponseOutputItemUnion()
+}
+
+func (BetaResponseOutputMessage) implBetaResponseOutputItemUnion() {}
+func (BetaResponseFileSearchToolCall) implBetaResponseOutputItemUnion() {}
+func (BetaResponseFunctionToolCall) implBetaResponseOutputItemUnion() {}
+func (BetaResponseFunctionToolCallOutputItem) implBetaResponseOutputItemUnion() {}
+func (BetaResponseOutputItemAgentMessage) implBetaResponseOutputItemUnion() {}
+func (BetaResponseOutputItemMultiAgentCall) implBetaResponseOutputItemUnion() {}
+func (BetaResponseOutputItemMultiAgentCallOutput) implBetaResponseOutputItemUnion() {}
+func (BetaResponseFunctionWebSearch) implBetaResponseOutputItemUnion() {}
+func (BetaResponseComputerToolCall) implBetaResponseOutputItemUnion() {}
+func (BetaResponseComputerToolCallOutputItem) implBetaResponseOutputItemUnion() {}
+func (BetaResponseReasoningItem) implBetaResponseOutputItemUnion() {}
+func (BetaResponseOutputItemProgram) implBetaResponseOutputItemUnion() {}
+func (BetaResponseOutputItemProgramOutput) implBetaResponseOutputItemUnion() {}
+func (BetaResponseToolSearchCall) implBetaResponseOutputItemUnion() {}
+func (BetaResponseToolSearchOutputItem) implBetaResponseOutputItemUnion() {}
+func (BetaResponseOutputItemAdditionalTools) implBetaResponseOutputItemUnion() {}
+func (BetaResponseCompactionItem) implBetaResponseOutputItemUnion() {}
+func (BetaResponseOutputItemImageGenerationCall) implBetaResponseOutputItemUnion() {}
+func (BetaResponseCodeInterpreterToolCall) implBetaResponseOutputItemUnion() {}
+func (BetaResponseOutputItemLocalShellCall) implBetaResponseOutputItemUnion() {}
+func (BetaResponseOutputItemLocalShellCallOutput) implBetaResponseOutputItemUnion() {}
+func (BetaResponseFunctionShellToolCall) implBetaResponseOutputItemUnion() {}
+func (BetaResponseFunctionShellToolCallOutput) implBetaResponseOutputItemUnion() {}
+func (BetaResponseApplyPatchToolCall) implBetaResponseOutputItemUnion() {}
+func (BetaResponseApplyPatchToolCallOutput) implBetaResponseOutputItemUnion() {}
+func (BetaResponseOutputItemMcpCall) implBetaResponseOutputItemUnion() {}
+func (BetaResponseOutputItemMcpListTools) implBetaResponseOutputItemUnion() {}
+func (BetaResponseOutputItemMcpApprovalRequest) implBetaResponseOutputItemUnion() {}
+func (BetaResponseOutputItemMcpApprovalResponse) implBetaResponseOutputItemUnion() {}
+func (BetaResponseCustomToolCall) implBetaResponseOutputItemUnion() {}
+func (BetaResponseCustomToolCallOutputItem) implBetaResponseOutputItemUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseOutputItemUnion.AsAny().(type) {
+// case openai.BetaResponseOutputMessage:
+// case openai.BetaResponseFileSearchToolCall:
+// case openai.BetaResponseFunctionToolCall:
+// case openai.BetaResponseFunctionToolCallOutputItem:
+// case openai.BetaResponseOutputItemAgentMessage:
+// case openai.BetaResponseOutputItemMultiAgentCall:
+// case openai.BetaResponseOutputItemMultiAgentCallOutput:
+// case openai.BetaResponseFunctionWebSearch:
+// case openai.BetaResponseComputerToolCall:
+// case openai.BetaResponseComputerToolCallOutputItem:
+// case openai.BetaResponseReasoningItem:
+// case openai.BetaResponseOutputItemProgram:
+// case openai.BetaResponseOutputItemProgramOutput:
+// case openai.BetaResponseToolSearchCall:
+// case openai.BetaResponseToolSearchOutputItem:
+// case openai.BetaResponseOutputItemAdditionalTools:
+// case openai.BetaResponseCompactionItem:
+// case openai.BetaResponseOutputItemImageGenerationCall:
+// case openai.BetaResponseCodeInterpreterToolCall:
+// case openai.BetaResponseOutputItemLocalShellCall:
+// case openai.BetaResponseOutputItemLocalShellCallOutput:
+// case openai.BetaResponseFunctionShellToolCall:
+// case openai.BetaResponseFunctionShellToolCallOutput:
+// case openai.BetaResponseApplyPatchToolCall:
+// case openai.BetaResponseApplyPatchToolCallOutput:
+// case openai.BetaResponseOutputItemMcpCall:
+// case openai.BetaResponseOutputItemMcpListTools:
+// case openai.BetaResponseOutputItemMcpApprovalRequest:
+// case openai.BetaResponseOutputItemMcpApprovalResponse:
+// case openai.BetaResponseCustomToolCall:
+// case openai.BetaResponseCustomToolCallOutputItem:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseOutputItemUnion) AsAny() anyBetaResponseOutputItem {
+ switch u.Type {
+ case "message":
+ return u.AsMessage()
+ case "file_search_call":
+ return u.AsFileSearchCall()
+ case "function_call":
+ return u.AsFunctionCall()
+ case "function_call_output":
+ return u.AsFunctionCallOutput()
+ case "agent_message":
+ return u.AsAgentMessage()
+ case "multi_agent_call":
+ return u.AsMultiAgentCall()
+ case "multi_agent_call_output":
+ return u.AsMultiAgentCallOutput()
+ case "web_search_call":
+ return u.AsWebSearchCall()
+ case "computer_call":
+ return u.AsComputerCall()
+ case "computer_call_output":
+ return u.AsComputerCallOutput()
+ case "reasoning":
+ return u.AsReasoning()
+ case "program":
+ return u.AsProgram()
+ case "program_output":
+ return u.AsProgramOutput()
+ case "tool_search_call":
+ return u.AsToolSearchCall()
+ case "tool_search_output":
+ return u.AsToolSearchOutput()
+ case "additional_tools":
+ return u.AsAdditionalTools()
+ case "compaction":
+ return u.AsCompaction()
+ case "image_generation_call":
+ return u.AsImageGenerationCall()
+ case "code_interpreter_call":
+ return u.AsCodeInterpreterCall()
+ case "local_shell_call":
+ return u.AsLocalShellCall()
+ case "local_shell_call_output":
+ return u.AsLocalShellCallOutput()
+ case "shell_call":
+ return u.AsShellCall()
+ case "shell_call_output":
+ return u.AsShellCallOutput()
+ case "apply_patch_call":
+ return u.AsApplyPatchCall()
+ case "apply_patch_call_output":
+ return u.AsApplyPatchCallOutput()
+ case "mcp_call":
+ return u.AsMcpCall()
+ case "mcp_list_tools":
+ return u.AsMcpListTools()
+ case "mcp_approval_request":
+ return u.AsMcpApprovalRequest()
+ case "mcp_approval_response":
+ return u.AsMcpApprovalResponse()
+ case "custom_tool_call":
+ return u.AsCustomToolCall()
+ case "custom_tool_call_output":
+ return u.AsCustomToolCallOutput()
+ }
+ return nil
+}
+
+func (u BetaResponseOutputItemUnion) AsMessage() (v BetaResponseOutputMessage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsFileSearchCall() (v BetaResponseFileSearchToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsFunctionCall() (v BetaResponseFunctionToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsFunctionCallOutput() (v BetaResponseFunctionToolCallOutputItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsAgentMessage() (v BetaResponseOutputItemAgentMessage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsMultiAgentCall() (v BetaResponseOutputItemMultiAgentCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsMultiAgentCallOutput() (v BetaResponseOutputItemMultiAgentCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsWebSearchCall() (v BetaResponseFunctionWebSearch) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsComputerCall() (v BetaResponseComputerToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsComputerCallOutput() (v BetaResponseComputerToolCallOutputItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsReasoning() (v BetaResponseReasoningItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsProgram() (v BetaResponseOutputItemProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsProgramOutput() (v BetaResponseOutputItemProgramOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsToolSearchCall() (v BetaResponseToolSearchCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsToolSearchOutput() (v BetaResponseToolSearchOutputItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsAdditionalTools() (v BetaResponseOutputItemAdditionalTools) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsCompaction() (v BetaResponseCompactionItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsImageGenerationCall() (v BetaResponseOutputItemImageGenerationCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsCodeInterpreterCall() (v BetaResponseCodeInterpreterToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsLocalShellCall() (v BetaResponseOutputItemLocalShellCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsLocalShellCallOutput() (v BetaResponseOutputItemLocalShellCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsShellCall() (v BetaResponseFunctionShellToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsShellCallOutput() (v BetaResponseFunctionShellToolCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsApplyPatchCall() (v BetaResponseApplyPatchToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsApplyPatchCallOutput() (v BetaResponseApplyPatchToolCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsMcpCall() (v BetaResponseOutputItemMcpCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsMcpListTools() (v BetaResponseOutputItemMcpListTools) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsMcpApprovalRequest() (v BetaResponseOutputItemMcpApprovalRequest) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsMcpApprovalResponse() (v BetaResponseOutputItemMcpApprovalResponse) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsCustomToolCall() (v BetaResponseCustomToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemUnion) AsCustomToolCallOutput() (v BetaResponseCustomToolCallOutputItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseOutputItemUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseOutputItemUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseOutputItemUnionContent is an implicit subunion of
+// [BetaResponseOutputItemUnion]. BetaResponseOutputItemUnionContent provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseOutputItemUnion].
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfBetaResponseOutputMessageContentArray
+// OfBetaResponseOutputItemAgentMessageContentArray
+// OfBetaResponseReasoningItemContentArray]
+type BetaResponseOutputItemUnionContent struct {
+ // This field will be present if the value is a
+ // [[]BetaResponseOutputMessageContentUnion] instead of an object.
+ OfBetaResponseOutputMessageContentArray []BetaResponseOutputMessageContentUnion `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseOutputItemAgentMessageContentUnion] instead of an object.
+ OfBetaResponseOutputItemAgentMessageContentArray []BetaResponseOutputItemAgentMessageContentUnion `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseReasoningItemContent] instead of an object.
+ OfBetaResponseReasoningItemContentArray []BetaResponseReasoningItemContent `json:",inline"`
+ JSON struct {
+ OfBetaResponseOutputMessageContentArray respjson.Field
+ OfBetaResponseOutputItemAgentMessageContentArray respjson.Field
+ OfBetaResponseReasoningItemContentArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseOutputItemUnionContent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseOutputItemUnionAgent is an implicit subunion of
+// [BetaResponseOutputItemUnion]. BetaResponseOutputItemUnionAgent provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseOutputItemUnion].
+type BetaResponseOutputItemUnionAgent struct {
+ AgentName string `json:"agent_name"`
+ JSON struct {
+ AgentName respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseOutputItemUnionAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseOutputItemUnionArguments is an implicit subunion of
+// [BetaResponseOutputItemUnion]. BetaResponseOutputItemUnionArguments provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseOutputItemUnion].
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString OfBetaResponseToolSearchCallArguments]
+type BetaResponseOutputItemUnionArguments struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [any] instead of an object.
+ OfBetaResponseToolSearchCallArguments any `json:",inline"`
+ JSON struct {
+ OfString respjson.Field
+ OfBetaResponseToolSearchCallArguments respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseOutputItemUnionArguments) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseOutputItemUnionCaller is an implicit subunion of
+// [BetaResponseOutputItemUnion]. BetaResponseOutputItemUnionCaller provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseOutputItemUnion].
+type BetaResponseOutputItemUnionCaller struct {
+ Type string `json:"type"`
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseOutputItemUnionCaller) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseOutputItemUnionOutput is an implicit subunion of
+// [BetaResponseOutputItemUnion]. BetaResponseOutputItemUnionOutput provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseOutputItemUnion].
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString OfOutputContentList OfBetaResponseOutputTextArray
+// OfBetaResponseFunctionShellToolCallOutputOutputArray]
+type BetaResponseOutputItemUnionOutput struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion]
+ // instead of an object.
+ OfOutputContentList []BetaResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion `json:",inline"`
+ // This field will be present if the value is a [[]BetaResponseOutputText] instead
+ // of an object.
+ OfBetaResponseOutputTextArray []BetaResponseOutputText `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseFunctionShellToolCallOutputOutput] instead of an object.
+ OfBetaResponseFunctionShellToolCallOutputOutputArray []BetaResponseFunctionShellToolCallOutputOutput `json:",inline"`
+ // This field is from variant [BetaResponseComputerToolCallOutputScreenshot].
+ Type constant.ComputerScreenshot `json:"type"`
+ // This field is from variant [BetaResponseComputerToolCallOutputScreenshot].
+ FileID string `json:"file_id"`
+ // This field is from variant [BetaResponseComputerToolCallOutputScreenshot].
+ ImageURL string `json:"image_url"`
+ JSON struct {
+ OfString respjson.Field
+ OfOutputContentList respjson.Field
+ OfBetaResponseOutputTextArray respjson.Field
+ OfBetaResponseFunctionShellToolCallOutputOutputArray respjson.Field
+ Type respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseOutputItemUnionOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseOutputItemUnionAction is an implicit subunion of
+// [BetaResponseOutputItemUnion]. BetaResponseOutputItemUnionAction provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseOutputItemUnion].
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfBetaResponseOutputItemMultiAgentCallOutputAction]
+type BetaResponseOutputItemUnionAction struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfBetaResponseOutputItemMultiAgentCallOutputAction string `json:",inline"`
+ Type string `json:"type"`
+ // This field is from variant [BetaResponseFunctionWebSearchActionUnion].
+ Queries []string `json:"queries"`
+ // This field is from variant [BetaResponseFunctionWebSearchActionUnion].
+ Query string `json:"query"`
+ // This field is from variant [BetaResponseFunctionWebSearchActionUnion].
+ Sources []BetaResponseFunctionWebSearchActionSearchSource `json:"sources"`
+ URL string `json:"url"`
+ // This field is from variant [BetaResponseFunctionWebSearchActionUnion].
+ Pattern string `json:"pattern"`
+ // This field is from variant [BetaComputerActionUnion].
+ Button string `json:"button"`
+ X int64 `json:"x"`
+ Y int64 `json:"y"`
+ Keys []string `json:"keys"`
+ // This field is from variant [BetaComputerActionUnion].
+ Path []BetaComputerActionDragPath `json:"path"`
+ // This field is from variant [BetaComputerActionUnion].
+ ScrollX int64 `json:"scroll_x"`
+ // This field is from variant [BetaComputerActionUnion].
+ ScrollY int64 `json:"scroll_y"`
+ // This field is from variant [BetaComputerActionUnion].
+ Text string `json:"text"`
+ // This field is from variant [BetaResponseOutputItemLocalShellCallAction].
+ Command []string `json:"command"`
+ // This field is from variant [BetaResponseOutputItemLocalShellCallAction].
+ Env map[string]string `json:"env"`
+ TimeoutMs int64 `json:"timeout_ms"`
+ // This field is from variant [BetaResponseOutputItemLocalShellCallAction].
+ User string `json:"user"`
+ // This field is from variant [BetaResponseOutputItemLocalShellCallAction].
+ WorkingDirectory string `json:"working_directory"`
+ // This field is from variant [BetaResponseFunctionShellToolCallAction].
+ Commands []string `json:"commands"`
+ // This field is from variant [BetaResponseFunctionShellToolCallAction].
+ MaxOutputLength int64 `json:"max_output_length"`
+ JSON struct {
+ OfBetaResponseOutputItemMultiAgentCallOutputAction respjson.Field
+ Type respjson.Field
+ Queries respjson.Field
+ Query respjson.Field
+ Sources respjson.Field
+ URL respjson.Field
+ Pattern respjson.Field
+ Button respjson.Field
+ X respjson.Field
+ Y respjson.Field
+ Keys respjson.Field
+ Path respjson.Field
+ ScrollX respjson.Field
+ ScrollY respjson.Field
+ Text respjson.Field
+ Command respjson.Field
+ Env respjson.Field
+ TimeoutMs respjson.Field
+ User respjson.Field
+ WorkingDirectory respjson.Field
+ Commands respjson.Field
+ MaxOutputLength respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseOutputItemUnionAction) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseOutputItemUnionTools is an implicit subunion of
+// [BetaResponseOutputItemUnion]. BetaResponseOutputItemUnionTools provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseOutputItemUnion].
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfBetaToolArray OfBetaResponseOutputItemMcpListToolsTools]
+type BetaResponseOutputItemUnionTools struct {
+ // This field will be present if the value is a [[]BetaToolUnion] instead of an
+ // object.
+ OfBetaToolArray []BetaToolUnion `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseOutputItemMcpListToolsTool] instead of an object.
+ OfBetaResponseOutputItemMcpListToolsTools []BetaResponseOutputItemMcpListToolsTool `json:",inline"`
+ JSON struct {
+ OfBetaToolArray respjson.Field
+ OfBetaResponseOutputItemMcpListToolsTools respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseOutputItemUnionTools) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseOutputItemAgentMessage struct {
+ // The unique ID of the agent message.
+ ID string `json:"id" api:"required"`
+ // The sending agent identity.
+ Author string `json:"author" api:"required"`
+ // Encrypted content sent between agents.
+ Content []BetaResponseOutputItemAgentMessageContentUnion `json:"content" api:"required"`
+ // The destination agent identity.
+ Recipient string `json:"recipient" api:"required"`
+ // The type of the item. Always `agent_message`.
+ Type constant.AgentMessage `json:"type" default:"agent_message"`
+ // The agent that produced this item.
+ Agent BetaResponseOutputItemAgentMessageAgent `json:"agent"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Author respjson.Field
+ Content respjson.Field
+ Recipient respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemAgentMessage) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemAgentMessage) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseOutputItemAgentMessageContentUnion contains all possible properties
+// and values from [BetaResponseInputText], [BetaResponseOutputText],
+// [BetaResponseOutputItemAgentMessageContentText],
+// [BetaResponseOutputItemAgentMessageContentSummaryText],
+// [BetaResponseOutputItemAgentMessageContentReasoningText],
+// [BetaResponseOutputRefusal], [BetaResponseInputImage],
+// [BetaResponseOutputItemAgentMessageContentComputerScreenshot],
+// [BetaResponseInputFile],
+// [BetaResponseOutputItemAgentMessageContentEncryptedContent].
+//
+// Use the [BetaResponseOutputItemAgentMessageContentUnion.AsAny] method to switch
+// on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseOutputItemAgentMessageContentUnion struct {
+ Text string `json:"text"`
+ // Any of "input_text", "output_text", "text", "summary_text", "reasoning_text",
+ // "refusal", "input_image", "computer_screenshot", "input_file",
+ // "encrypted_content".
+ Type string `json:"type"`
+ // This field is a union of [BetaResponseInputTextPromptCacheBreakpoint],
+ // [BetaResponseInputImagePromptCacheBreakpoint],
+ // [BetaResponseOutputItemAgentMessageContentComputerScreenshotPromptCacheBreakpoint],
+ // [BetaResponseInputFilePromptCacheBreakpoint]
+ PromptCacheBreakpoint BetaResponseOutputItemAgentMessageContentUnionPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
+ // This field is from variant [BetaResponseOutputText].
+ Annotations []BetaResponseOutputTextAnnotationUnion `json:"annotations"`
+ // This field is from variant [BetaResponseOutputText].
+ Logprobs []BetaResponseOutputTextLogprob `json:"logprobs"`
+ // This field is from variant [BetaResponseOutputRefusal].
+ Refusal string `json:"refusal"`
+ Detail string `json:"detail"`
+ FileID string `json:"file_id"`
+ ImageURL string `json:"image_url"`
+ // This field is from variant [BetaResponseInputFile].
+ FileData string `json:"file_data"`
+ // This field is from variant [BetaResponseInputFile].
+ FileURL string `json:"file_url"`
+ // This field is from variant [BetaResponseInputFile].
+ Filename string `json:"filename"`
+ // This field is from variant
+ // [BetaResponseOutputItemAgentMessageContentEncryptedContent].
+ EncryptedContent string `json:"encrypted_content"`
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ Annotations respjson.Field
+ Logprobs respjson.Field
+ Refusal respjson.Field
+ Detail respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ FileData respjson.Field
+ FileURL respjson.Field
+ Filename respjson.Field
+ EncryptedContent respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseOutputItemAgentMessageContent is implemented by each variant of
+// [BetaResponseOutputItemAgentMessageContentUnion] to add type safety for the
+// return type of [BetaResponseOutputItemAgentMessageContentUnion.AsAny]
+type anyBetaResponseOutputItemAgentMessageContent interface {
+ implBetaResponseOutputItemAgentMessageContentUnion()
+}
+
+func (BetaResponseInputText) implBetaResponseOutputItemAgentMessageContentUnion() {}
+func (BetaResponseOutputText) implBetaResponseOutputItemAgentMessageContentUnion() {}
+func (BetaResponseOutputItemAgentMessageContentText) implBetaResponseOutputItemAgentMessageContentUnion() {
+}
+func (BetaResponseOutputItemAgentMessageContentSummaryText) implBetaResponseOutputItemAgentMessageContentUnion() {
+}
+func (BetaResponseOutputItemAgentMessageContentReasoningText) implBetaResponseOutputItemAgentMessageContentUnion() {
+}
+func (BetaResponseOutputRefusal) implBetaResponseOutputItemAgentMessageContentUnion() {}
+func (BetaResponseInputImage) implBetaResponseOutputItemAgentMessageContentUnion() {}
+func (BetaResponseOutputItemAgentMessageContentComputerScreenshot) implBetaResponseOutputItemAgentMessageContentUnion() {
+}
+func (BetaResponseInputFile) implBetaResponseOutputItemAgentMessageContentUnion() {}
+func (BetaResponseOutputItemAgentMessageContentEncryptedContent) implBetaResponseOutputItemAgentMessageContentUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseOutputItemAgentMessageContentUnion.AsAny().(type) {
+// case openai.BetaResponseInputText:
+// case openai.BetaResponseOutputText:
+// case openai.BetaResponseOutputItemAgentMessageContentText:
+// case openai.BetaResponseOutputItemAgentMessageContentSummaryText:
+// case openai.BetaResponseOutputItemAgentMessageContentReasoningText:
+// case openai.BetaResponseOutputRefusal:
+// case openai.BetaResponseInputImage:
+// case openai.BetaResponseOutputItemAgentMessageContentComputerScreenshot:
+// case openai.BetaResponseInputFile:
+// case openai.BetaResponseOutputItemAgentMessageContentEncryptedContent:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseOutputItemAgentMessageContentUnion) AsAny() anyBetaResponseOutputItemAgentMessageContent {
+ switch u.Type {
+ case "input_text":
+ return u.AsInputText()
+ case "output_text":
+ return u.AsOutputText()
+ case "text":
+ return u.AsText()
+ case "summary_text":
+ return u.AsSummaryText()
+ case "reasoning_text":
+ return u.AsReasoningText()
+ case "refusal":
+ return u.AsRefusal()
+ case "input_image":
+ return u.AsInputImage()
+ case "computer_screenshot":
+ return u.AsComputerScreenshot()
+ case "input_file":
+ return u.AsInputFile()
+ case "encrypted_content":
+ return u.AsEncryptedContent()
+ }
+ return nil
+}
+
+func (u BetaResponseOutputItemAgentMessageContentUnion) AsInputText() (v BetaResponseInputText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemAgentMessageContentUnion) AsOutputText() (v BetaResponseOutputText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemAgentMessageContentUnion) AsText() (v BetaResponseOutputItemAgentMessageContentText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemAgentMessageContentUnion) AsSummaryText() (v BetaResponseOutputItemAgentMessageContentSummaryText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemAgentMessageContentUnion) AsReasoningText() (v BetaResponseOutputItemAgentMessageContentReasoningText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemAgentMessageContentUnion) AsRefusal() (v BetaResponseOutputRefusal) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemAgentMessageContentUnion) AsInputImage() (v BetaResponseInputImage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemAgentMessageContentUnion) AsComputerScreenshot() (v BetaResponseOutputItemAgentMessageContentComputerScreenshot) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemAgentMessageContentUnion) AsInputFile() (v BetaResponseInputFile) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputItemAgentMessageContentUnion) AsEncryptedContent() (v BetaResponseOutputItemAgentMessageContentEncryptedContent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseOutputItemAgentMessageContentUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseOutputItemAgentMessageContentUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseOutputItemAgentMessageContentUnionPromptCacheBreakpoint is an
+// implicit subunion of [BetaResponseOutputItemAgentMessageContentUnion].
+// BetaResponseOutputItemAgentMessageContentUnionPromptCacheBreakpoint provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseOutputItemAgentMessageContentUnion].
+type BetaResponseOutputItemAgentMessageContentUnionPromptCacheBreakpoint struct {
+ // This field is from variant [BetaResponseInputTextPromptCacheBreakpoint].
+ Mode constant.Explicit `json:"mode"`
+ JSON struct {
+ Mode respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseOutputItemAgentMessageContentUnionPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A text content.
+type BetaResponseOutputItemAgentMessageContentText struct {
+ Text string `json:"text" api:"required"`
+ Type constant.Text `json:"type" default:"text"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemAgentMessageContentText) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemAgentMessageContentText) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A summary text from the model.
+type BetaResponseOutputItemAgentMessageContentSummaryText struct {
+ // A summary of the reasoning output from the model so far.
+ Text string `json:"text" api:"required"`
+ // The type of the object. Always `summary_text`.
+ Type constant.SummaryText `json:"type" default:"summary_text"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemAgentMessageContentSummaryText) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemAgentMessageContentSummaryText) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Reasoning text from the model.
+type BetaResponseOutputItemAgentMessageContentReasoningText struct {
+ // The reasoning text from the model.
+ Text string `json:"text" api:"required"`
+ // The type of the reasoning text. Always `reasoning_text`.
+ Type constant.ReasoningText `json:"type" default:"reasoning_text"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemAgentMessageContentReasoningText) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemAgentMessageContentReasoningText) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A screenshot of a computer.
+type BetaResponseOutputItemAgentMessageContentComputerScreenshot struct {
+ // The detail level of the screenshot image to be sent to the model. One of `high`,
+ // `low`, `auto`, or `original`. Defaults to `auto`.
+ //
+ // Any of "low", "high", "auto", "original".
+ Detail string `json:"detail" api:"required"`
+ // The identifier of an uploaded file that contains the screenshot.
+ FileID string `json:"file_id" api:"required"`
+ // The URL of the screenshot image.
+ ImageURL string `json:"image_url" api:"required" format:"uri"`
+ // Specifies the event type. For a computer screenshot, this property is always set
+ // to `computer_screenshot`.
+ Type constant.ComputerScreenshot `json:"type" default:"computer_screenshot"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint BetaResponseOutputItemAgentMessageContentComputerScreenshotPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Detail respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemAgentMessageContentComputerScreenshot) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *BetaResponseOutputItemAgentMessageContentComputerScreenshot) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+type BetaResponseOutputItemAgentMessageContentComputerScreenshotPromptCacheBreakpoint struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Mode respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemAgentMessageContentComputerScreenshotPromptCacheBreakpoint) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *BetaResponseOutputItemAgentMessageContentComputerScreenshotPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Opaque encrypted content that Responses API decrypts inside trusted model
+// execution.
+type BetaResponseOutputItemAgentMessageContentEncryptedContent struct {
+ // Opaque encrypted content.
+ EncryptedContent string `json:"encrypted_content" api:"required"`
+ // The type of the input item. Always `encrypted_content`.
+ Type constant.EncryptedContent `json:"type" default:"encrypted_content"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ EncryptedContent respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemAgentMessageContentEncryptedContent) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *BetaResponseOutputItemAgentMessageContentEncryptedContent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseOutputItemAgentMessageAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemAgentMessageAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemAgentMessageAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseOutputItemMultiAgentCall struct {
+ // The unique ID of the multi-agent call item.
+ ID string `json:"id" api:"required"`
+ // The multi-agent action to execute.
+ //
+ // Any of "spawn_agent", "interrupt_agent", "list_agents", "send_message",
+ // "followup_task", "wait_agent".
+ Action string `json:"action" api:"required"`
+ // The JSON string of arguments generated for the action.
+ Arguments string `json:"arguments" api:"required"`
+ // The unique ID linking this call to its output.
+ CallID string `json:"call_id" api:"required"`
+ // The type of the multi-agent call. Always `multi_agent_call`.
+ Type constant.MultiAgentCall `json:"type" default:"multi_agent_call"`
+ // The agent that produced this item.
+ Agent BetaResponseOutputItemMultiAgentCallAgent `json:"agent"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Action respjson.Field
+ Arguments respjson.Field
+ CallID respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemMultiAgentCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemMultiAgentCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseOutputItemMultiAgentCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemMultiAgentCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemMultiAgentCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseOutputItemMultiAgentCallOutput struct {
+ // The unique ID of the multi-agent call output item.
+ ID string `json:"id" api:"required"`
+ // The multi-agent action that produced this result.
+ //
+ // Any of "spawn_agent", "interrupt_agent", "list_agents", "send_message",
+ // "followup_task", "wait_agent".
+ Action string `json:"action" api:"required"`
+ // The unique ID of the multi-agent call.
+ CallID string `json:"call_id" api:"required"`
+ // Text output returned by the multi-agent action.
+ Output []BetaResponseOutputText `json:"output" api:"required"`
+ // The type of the multi-agent result. Always `multi_agent_call_output`.
+ Type constant.MultiAgentCallOutput `json:"type" default:"multi_agent_call_output"`
+ // The agent that produced this item.
+ Agent BetaResponseOutputItemMultiAgentCallOutputAgent `json:"agent"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Action respjson.Field
+ CallID respjson.Field
+ Output respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemMultiAgentCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemMultiAgentCallOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseOutputItemMultiAgentCallOutputAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemMultiAgentCallOutputAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemMultiAgentCallOutputAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseOutputItemProgram struct {
+ // The unique ID of the program item.
+ ID string `json:"id" api:"required"`
+ // The stable call ID of the program item.
+ CallID string `json:"call_id" api:"required"`
+ // The JavaScript source executed by programmatic tool calling.
+ Code string `json:"code" api:"required"`
+ // Opaque program replay fingerprint that must be round-tripped.
+ Fingerprint string `json:"fingerprint" api:"required"`
+ // The type of the item. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
+ // The agent that produced this item.
+ Agent BetaResponseOutputItemProgramAgent `json:"agent"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Code respjson.Field
+ Fingerprint respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemProgram) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseOutputItemProgramAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemProgramAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemProgramAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseOutputItemProgramOutput struct {
+ // The unique ID of the program output item.
+ ID string `json:"id" api:"required"`
+ // The call ID of the program item.
+ CallID string `json:"call_id" api:"required"`
+ // The result produced by the program item.
+ Result string `json:"result" api:"required"`
+ // The terminal status of the program output item.
+ //
+ // Any of "completed", "incomplete".
+ Status string `json:"status" api:"required"`
+ // The type of the item. Always `program_output`.
+ Type constant.ProgramOutput `json:"type" default:"program_output"`
+ // The agent that produced this item.
+ Agent BetaResponseOutputItemProgramOutputAgent `json:"agent"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Result respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemProgramOutput) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemProgramOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseOutputItemProgramOutputAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemProgramOutputAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemProgramOutputAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseOutputItemAdditionalTools struct {
+ // The unique ID of the additional tools item.
+ ID string `json:"id" api:"required"`
+ // The role that provided the additional tools.
+ //
+ // Any of "unknown", "user", "assistant", "system", "critic", "discriminator",
+ // "developer", "tool".
+ Role string `json:"role" api:"required"`
+ // The additional tool definitions made available at this item.
+ Tools []BetaToolUnion `json:"tools" api:"required"`
+ // The type of the item. Always `additional_tools`.
+ Type constant.AdditionalTools `json:"type" default:"additional_tools"`
+ // The agent that produced this item.
+ Agent BetaResponseOutputItemAdditionalToolsAgent `json:"agent"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Role respjson.Field
+ Tools respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemAdditionalTools) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemAdditionalTools) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseOutputItemAdditionalToolsAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemAdditionalToolsAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemAdditionalToolsAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An image generation request made by the model.
+type BetaResponseOutputItemImageGenerationCall struct {
+ // The unique ID of the image generation call.
+ ID string `json:"id" api:"required"`
+ // The generated image encoded in base64.
+ Result string `json:"result" api:"required"`
+ // The status of the image generation call.
+ //
+ // Any of "in_progress", "completed", "generating", "failed".
+ Status string `json:"status" api:"required"`
+ // The type of the image generation call. Always `image_generation_call`.
+ Type constant.ImageGenerationCall `json:"type" default:"image_generation_call"`
+ // The agent that produced this item.
+ Agent BetaResponseOutputItemImageGenerationCallAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Result respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemImageGenerationCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemImageGenerationCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseOutputItemImageGenerationCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemImageGenerationCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemImageGenerationCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool call to run a command on the local shell.
+type BetaResponseOutputItemLocalShellCall struct {
+ // The unique ID of the local shell call.
+ ID string `json:"id" api:"required"`
+ // Execute a shell command on the server.
+ Action BetaResponseOutputItemLocalShellCallAction `json:"action" api:"required"`
+ // The unique ID of the local shell tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // The status of the local shell call.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status" api:"required"`
+ // The type of the local shell call. Always `local_shell_call`.
+ Type constant.LocalShellCall `json:"type" default:"local_shell_call"`
+ // The agent that produced this item.
+ Agent BetaResponseOutputItemLocalShellCallAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Action respjson.Field
+ CallID respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemLocalShellCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemLocalShellCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Execute a shell command on the server.
+type BetaResponseOutputItemLocalShellCallAction struct {
+ // The command to run.
+ Command []string `json:"command" api:"required"`
+ // Environment variables to set for the command.
+ Env map[string]string `json:"env" api:"required"`
+ // The type of the local shell action. Always `exec`.
+ Type constant.Exec `json:"type" default:"exec"`
+ // Optional timeout in milliseconds for the command.
+ TimeoutMs int64 `json:"timeout_ms" api:"nullable"`
+ // Optional user to run the command as.
+ User string `json:"user" api:"nullable"`
+ // Optional working directory to run the command in.
+ WorkingDirectory string `json:"working_directory" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Command respjson.Field
+ Env respjson.Field
+ Type respjson.Field
+ TimeoutMs respjson.Field
+ User respjson.Field
+ WorkingDirectory respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemLocalShellCallAction) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemLocalShellCallAction) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseOutputItemLocalShellCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemLocalShellCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemLocalShellCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The output of a local shell tool call.
+type BetaResponseOutputItemLocalShellCallOutput struct {
+ // The unique ID of the local shell tool call generated by the model.
+ ID string `json:"id" api:"required"`
+ // A JSON string of the output of the local shell tool call.
+ Output string `json:"output" api:"required"`
+ // The type of the local shell tool call output. Always `local_shell_call_output`.
+ Type constant.LocalShellCallOutput `json:"type" default:"local_shell_call_output"`
+ // The agent that produced this item.
+ Agent BetaResponseOutputItemLocalShellCallOutputAgent `json:"agent" api:"nullable"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Output respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemLocalShellCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemLocalShellCallOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseOutputItemLocalShellCallOutputAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemLocalShellCallOutputAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemLocalShellCallOutputAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An invocation of a tool on an MCP server.
+type BetaResponseOutputItemMcpCall struct {
+ // The unique ID of the tool call.
+ ID string `json:"id" api:"required"`
+ // A JSON string of the arguments passed to the tool.
+ Arguments string `json:"arguments" api:"required"`
+ // The name of the tool that was run.
+ Name string `json:"name" api:"required"`
+ // The label of the MCP server running the tool.
+ ServerLabel string `json:"server_label" api:"required"`
+ // The type of the item. Always `mcp_call`.
+ Type constant.McpCall `json:"type" default:"mcp_call"`
+ // The agent that produced this item.
+ Agent BetaResponseOutputItemMcpCallAgent `json:"agent" api:"nullable"`
+ // Unique identifier for the MCP tool call approval request. Include this value in
+ // a subsequent `mcp_approval_response` input to approve or reject the
+ // corresponding tool call.
+ ApprovalRequestID string `json:"approval_request_id" api:"nullable"`
+ // The error from the tool call, if any.
+ Error string `json:"error" api:"nullable"`
+ // The output from the tool call.
+ Output string `json:"output" api:"nullable"`
+ // The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
+ // `calling`, or `failed`.
+ //
+ // Any of "in_progress", "completed", "incomplete", "calling", "failed".
+ Status string `json:"status"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Arguments respjson.Field
+ Name respjson.Field
+ ServerLabel respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ApprovalRequestID respjson.Field
+ Error respjson.Field
+ Output respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemMcpCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemMcpCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseOutputItemMcpCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemMcpCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemMcpCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A list of tools available on an MCP server.
+type BetaResponseOutputItemMcpListTools struct {
+ // The unique ID of the list.
+ ID string `json:"id" api:"required"`
+ // The label of the MCP server.
+ ServerLabel string `json:"server_label" api:"required"`
+ // The tools available on the server.
+ Tools []BetaResponseOutputItemMcpListToolsTool `json:"tools" api:"required"`
+ // The type of the item. Always `mcp_list_tools`.
+ Type constant.McpListTools `json:"type" default:"mcp_list_tools"`
+ // The agent that produced this item.
+ Agent BetaResponseOutputItemMcpListToolsAgent `json:"agent" api:"nullable"`
+ // Error message if the server could not list tools.
+ Error string `json:"error" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ ServerLabel respjson.Field
+ Tools respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Error respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemMcpListTools) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemMcpListTools) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool available on an MCP server.
+type BetaResponseOutputItemMcpListToolsTool struct {
+ // The JSON schema describing the tool's input.
+ InputSchema any `json:"input_schema" api:"required"`
+ // The name of the tool.
+ Name string `json:"name" api:"required"`
+ // Additional annotations about the tool.
+ Annotations any `json:"annotations" api:"nullable"`
+ // The description of the tool.
+ Description string `json:"description" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ InputSchema respjson.Field
+ Name respjson.Field
+ Annotations respjson.Field
+ Description respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemMcpListToolsTool) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemMcpListToolsTool) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseOutputItemMcpListToolsAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemMcpListToolsAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemMcpListToolsAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A request for human approval of a tool invocation.
+type BetaResponseOutputItemMcpApprovalRequest struct {
+ // The unique ID of the approval request.
+ ID string `json:"id" api:"required"`
+ // A JSON string of arguments for the tool.
+ Arguments string `json:"arguments" api:"required"`
+ // The name of the tool to run.
+ Name string `json:"name" api:"required"`
+ // The label of the MCP server making the request.
+ ServerLabel string `json:"server_label" api:"required"`
+ // The type of the item. Always `mcp_approval_request`.
+ Type constant.McpApprovalRequest `json:"type" default:"mcp_approval_request"`
+ // The agent that produced this item.
+ Agent BetaResponseOutputItemMcpApprovalRequestAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Arguments respjson.Field
+ Name respjson.Field
+ ServerLabel respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemMcpApprovalRequest) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemMcpApprovalRequest) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseOutputItemMcpApprovalRequestAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemMcpApprovalRequestAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemMcpApprovalRequestAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A response to an MCP approval request.
+type BetaResponseOutputItemMcpApprovalResponse struct {
+ // The unique ID of the approval response
+ ID string `json:"id" api:"required"`
+ // The ID of the approval request being answered.
+ ApprovalRequestID string `json:"approval_request_id" api:"required"`
+ // Whether the request was approved.
+ Approve bool `json:"approve" api:"required"`
+ // The type of the item. Always `mcp_approval_response`.
+ Type constant.McpApprovalResponse `json:"type" default:"mcp_approval_response"`
+ // The agent that produced this item.
+ Agent BetaResponseOutputItemMcpApprovalResponseAgent `json:"agent" api:"nullable"`
+ // Optional reason for the decision.
+ Reason string `json:"reason" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ ApprovalRequestID respjson.Field
+ Approve respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Reason respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemMcpApprovalResponse) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemMcpApprovalResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseOutputItemMcpApprovalResponseAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemMcpApprovalResponseAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemMcpApprovalResponseAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when a new output item is added.
+type BetaResponseOutputItemAddedEvent struct {
+ // The output item that was added.
+ Item BetaResponseOutputItemUnion `json:"item" api:"required"`
+ // The index of the output item that was added.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.output_item.added`.
+ Type constant.ResponseOutputItemAdded `json:"type" default:"response.output_item.added"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseOutputItemAddedEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Item respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemAddedEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemAddedEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseOutputItemAddedEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemAddedEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemAddedEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when an output item is marked done.
+type BetaResponseOutputItemDoneEvent struct {
+ // The output item that was marked done.
+ Item BetaResponseOutputItemUnion `json:"item" api:"required"`
+ // The index of the output item that was marked done.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.output_item.done`.
+ Type constant.ResponseOutputItemDone `json:"type" default:"response.output_item.done"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseOutputItemDoneEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Item respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemDoneEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemDoneEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseOutputItemDoneEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputItemDoneEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputItemDoneEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An output message from the model.
+type BetaResponseOutputMessage struct {
+ // The unique ID of the output message.
+ ID string `json:"id" api:"required"`
+ // The content of the output message.
+ Content []BetaResponseOutputMessageContentUnion `json:"content" api:"required"`
+ // The role of the output message. Always `assistant`.
+ Role constant.Assistant `json:"role" default:"assistant"`
+ // The status of the message input. One of `in_progress`, `completed`, or
+ // `incomplete`. Populated when input items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status BetaResponseOutputMessageStatus `json:"status" api:"required"`
+ // The type of the output message. Always `message`.
+ Type constant.Message `json:"type" default:"message"`
+ // The agent that produced this item.
+ Agent BetaResponseOutputMessageAgent `json:"agent" api:"nullable"`
+ // Labels an `assistant` message as intermediate commentary (`commentary`) or the
+ // final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when
+ // sending follow-up requests, preserve and resend phase on all assistant messages
+ // — dropping it can degrade performance. Not used for user messages.
+ //
+ // Any of "commentary", "final_answer".
+ Phase BetaResponseOutputMessagePhase `json:"phase" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Content respjson.Field
+ Role respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Phase respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputMessage) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputMessage) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseOutputMessage to a
+// BetaResponseOutputMessageParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseOutputMessageParam.Overrides()
+func (r BetaResponseOutputMessage) ToParam() BetaResponseOutputMessageParam {
+ return param.Override[BetaResponseOutputMessageParam](json.RawMessage(r.RawJSON()))
+}
+
+// BetaResponseOutputMessageContentUnion contains all possible properties and
+// values from [BetaResponseOutputText], [BetaResponseOutputRefusal].
+//
+// Use the [BetaResponseOutputMessageContentUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseOutputMessageContentUnion struct {
+ // This field is from variant [BetaResponseOutputText].
+ Annotations []BetaResponseOutputTextAnnotationUnion `json:"annotations"`
+ // This field is from variant [BetaResponseOutputText].
+ Text string `json:"text"`
+ // Any of "output_text", "refusal".
+ Type string `json:"type"`
+ // This field is from variant [BetaResponseOutputText].
+ Logprobs []BetaResponseOutputTextLogprob `json:"logprobs"`
+ // This field is from variant [BetaResponseOutputRefusal].
+ Refusal string `json:"refusal"`
+ JSON struct {
+ Annotations respjson.Field
+ Text respjson.Field
+ Type respjson.Field
+ Logprobs respjson.Field
+ Refusal respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseOutputMessageContent is implemented by each variant of
+// [BetaResponseOutputMessageContentUnion] to add type safety for the return type
+// of [BetaResponseOutputMessageContentUnion.AsAny]
+type anyBetaResponseOutputMessageContent interface {
+ implBetaResponseOutputMessageContentUnion()
+}
+
+func (BetaResponseOutputText) implBetaResponseOutputMessageContentUnion() {}
+func (BetaResponseOutputRefusal) implBetaResponseOutputMessageContentUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseOutputMessageContentUnion.AsAny().(type) {
+// case openai.BetaResponseOutputText:
+// case openai.BetaResponseOutputRefusal:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseOutputMessageContentUnion) AsAny() anyBetaResponseOutputMessageContent {
+ switch u.Type {
+ case "output_text":
+ return u.AsOutputText()
+ case "refusal":
+ return u.AsRefusal()
+ }
+ return nil
+}
+
+func (u BetaResponseOutputMessageContentUnion) AsOutputText() (v BetaResponseOutputText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputMessageContentUnion) AsRefusal() (v BetaResponseOutputRefusal) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseOutputMessageContentUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseOutputMessageContentUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The status of the message input. One of `in_progress`, `completed`, or
+// `incomplete`. Populated when input items are returned via API.
+type BetaResponseOutputMessageStatus string
+
+const (
+ BetaResponseOutputMessageStatusInProgress BetaResponseOutputMessageStatus = "in_progress"
+ BetaResponseOutputMessageStatusCompleted BetaResponseOutputMessageStatus = "completed"
+ BetaResponseOutputMessageStatusIncomplete BetaResponseOutputMessageStatus = "incomplete"
+)
+
+// The agent that produced this item.
+type BetaResponseOutputMessageAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputMessageAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputMessageAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Labels an `assistant` message as intermediate commentary (`commentary`) or the
+// final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when
+// sending follow-up requests, preserve and resend phase on all assistant messages
+// — dropping it can degrade performance. Not used for user messages.
+type BetaResponseOutputMessagePhase string
+
+const (
+ BetaResponseOutputMessagePhaseCommentary BetaResponseOutputMessagePhase = "commentary"
+ BetaResponseOutputMessagePhaseFinalAnswer BetaResponseOutputMessagePhase = "final_answer"
+)
+
+// An output message from the model.
+//
+// The properties ID, Content, Role, Status, Type are required.
+type BetaResponseOutputMessageParam struct {
+ // The unique ID of the output message.
+ ID string `json:"id,omitzero" api:"required"`
+ // The content of the output message.
+ Content []BetaResponseOutputMessageContentUnionParam `json:"content,omitzero" api:"required"`
+ // The status of the message input. One of `in_progress`, `completed`, or
+ // `incomplete`. Populated when input items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status BetaResponseOutputMessageStatus `json:"status,omitzero" api:"required"`
+ // The agent that produced this item.
+ Agent BetaResponseOutputMessageAgentParam `json:"agent,omitzero"`
+ // Labels an `assistant` message as intermediate commentary (`commentary`) or the
+ // final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when
+ // sending follow-up requests, preserve and resend phase on all assistant messages
+ // — dropping it can degrade performance. Not used for user messages.
+ //
+ // Any of "commentary", "final_answer".
+ Phase BetaResponseOutputMessagePhase `json:"phase,omitzero"`
+ // The role of the output message. Always `assistant`.
+ //
+ // This field can be elided, and will marshal its zero value as "assistant".
+ Role constant.Assistant `json:"role" default:"assistant"`
+ // The type of the output message. Always `message`.
+ //
+ // This field can be elided, and will marshal its zero value as "message".
+ Type constant.Message `json:"type" default:"message"`
+ paramObj
+}
+
+func (r BetaResponseOutputMessageParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseOutputMessageParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseOutputMessageParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseOutputMessageContentUnionParam struct {
+ OfOutputText *BetaResponseOutputTextParam `json:",omitzero,inline"`
+ OfRefusal *BetaResponseOutputRefusalParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseOutputMessageContentUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfOutputText, u.OfRefusal)
+}
+func (u *BetaResponseOutputMessageContentUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseOutputMessageContentUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfOutputText) {
+ return u.OfOutputText
+ } else if !param.IsOmitted(u.OfRefusal) {
+ return u.OfRefusal
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseOutputMessageContentUnionParam) GetAnnotations() []BetaResponseOutputTextAnnotationUnionParam {
+ if vt := u.OfOutputText; vt != nil {
+ return vt.Annotations
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseOutputMessageContentUnionParam) GetText() *string {
+ if vt := u.OfOutputText; vt != nil {
+ return &vt.Text
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseOutputMessageContentUnionParam) GetLogprobs() []BetaResponseOutputTextLogprobParam {
+ if vt := u.OfOutputText; vt != nil {
+ return vt.Logprobs
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseOutputMessageContentUnionParam) GetRefusal() *string {
+ if vt := u.OfRefusal; vt != nil {
+ return &vt.Refusal
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseOutputMessageContentUnionParam) GetType() *string {
+ if vt := u.OfOutputText; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfRefusal; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseOutputMessageContentUnionParam](
+ "type",
+ apijson.Discriminator[BetaResponseOutputTextParam]("output_text"),
+ apijson.Discriminator[BetaResponseOutputRefusalParam]("refusal"),
+ )
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseOutputMessageAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseOutputMessageAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseOutputMessageAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseOutputMessageAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A refusal from the model.
+type BetaResponseOutputRefusal struct {
+ // The refusal explanation from the model.
+ Refusal string `json:"refusal" api:"required"`
+ // The type of the refusal. Always `refusal`.
+ Type constant.Refusal `json:"type" default:"refusal"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Refusal respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputRefusal) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputRefusal) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseOutputRefusal to a
+// BetaResponseOutputRefusalParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseOutputRefusalParam.Overrides()
+func (r BetaResponseOutputRefusal) ToParam() BetaResponseOutputRefusalParam {
+ return param.Override[BetaResponseOutputRefusalParam](json.RawMessage(r.RawJSON()))
+}
+
+// A refusal from the model.
+//
+// The properties Refusal, Type are required.
+type BetaResponseOutputRefusalParam struct {
+ // The refusal explanation from the model.
+ Refusal string `json:"refusal" api:"required"`
+ // The type of the refusal. Always `refusal`.
+ //
+ // This field can be elided, and will marshal its zero value as "refusal".
+ Type constant.Refusal `json:"type" default:"refusal"`
+ paramObj
+}
+
+func (r BetaResponseOutputRefusalParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseOutputRefusalParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseOutputRefusalParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A text output from the model.
+type BetaResponseOutputText struct {
+ // The annotations of the text output.
+ Annotations []BetaResponseOutputTextAnnotationUnion `json:"annotations" api:"required"`
+ // The text output from the model.
+ Text string `json:"text" api:"required"`
+ // The type of the output text. Always `output_text`.
+ Type constant.OutputText `json:"type" default:"output_text"`
+ Logprobs []BetaResponseOutputTextLogprob `json:"logprobs"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Annotations respjson.Field
+ Text respjson.Field
+ Type respjson.Field
+ Logprobs respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputText) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputText) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseOutputText to a BetaResponseOutputTextParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseOutputTextParam.Overrides()
+func (r BetaResponseOutputText) ToParam() BetaResponseOutputTextParam {
+ return param.Override[BetaResponseOutputTextParam](json.RawMessage(r.RawJSON()))
+}
+
+// BetaResponseOutputTextAnnotationUnion contains all possible properties and
+// values from [BetaResponseOutputTextAnnotationFileCitation],
+// [BetaResponseOutputTextAnnotationURLCitation],
+// [BetaResponseOutputTextAnnotationContainerFileCitation],
+// [BetaResponseOutputTextAnnotationFilePath].
+//
+// Use the [BetaResponseOutputTextAnnotationUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseOutputTextAnnotationUnion struct {
+ FileID string `json:"file_id"`
+ Filename string `json:"filename"`
+ Index int64 `json:"index"`
+ // Any of "file_citation", "url_citation", "container_file_citation", "file_path".
+ Type string `json:"type"`
+ EndIndex int64 `json:"end_index"`
+ StartIndex int64 `json:"start_index"`
+ // This field is from variant [BetaResponseOutputTextAnnotationURLCitation].
+ Title string `json:"title"`
+ // This field is from variant [BetaResponseOutputTextAnnotationURLCitation].
+ URL string `json:"url"`
+ // This field is from variant
+ // [BetaResponseOutputTextAnnotationContainerFileCitation].
+ ContainerID string `json:"container_id"`
+ JSON struct {
+ FileID respjson.Field
+ Filename respjson.Field
+ Index respjson.Field
+ Type respjson.Field
+ EndIndex respjson.Field
+ StartIndex respjson.Field
+ Title respjson.Field
+ URL respjson.Field
+ ContainerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseOutputTextAnnotation is implemented by each variant of
+// [BetaResponseOutputTextAnnotationUnion] to add type safety for the return type
+// of [BetaResponseOutputTextAnnotationUnion.AsAny]
+type anyBetaResponseOutputTextAnnotation interface {
+ implBetaResponseOutputTextAnnotationUnion()
+}
+
+func (BetaResponseOutputTextAnnotationFileCitation) implBetaResponseOutputTextAnnotationUnion() {}
+func (BetaResponseOutputTextAnnotationURLCitation) implBetaResponseOutputTextAnnotationUnion() {}
+func (BetaResponseOutputTextAnnotationContainerFileCitation) implBetaResponseOutputTextAnnotationUnion() {
+}
+func (BetaResponseOutputTextAnnotationFilePath) implBetaResponseOutputTextAnnotationUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseOutputTextAnnotationUnion.AsAny().(type) {
+// case openai.BetaResponseOutputTextAnnotationFileCitation:
+// case openai.BetaResponseOutputTextAnnotationURLCitation:
+// case openai.BetaResponseOutputTextAnnotationContainerFileCitation:
+// case openai.BetaResponseOutputTextAnnotationFilePath:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseOutputTextAnnotationUnion) AsAny() anyBetaResponseOutputTextAnnotation {
+ switch u.Type {
+ case "file_citation":
+ return u.AsFileCitation()
+ case "url_citation":
+ return u.AsURLCitation()
+ case "container_file_citation":
+ return u.AsContainerFileCitation()
+ case "file_path":
+ return u.AsFilePath()
+ }
+ return nil
+}
+
+func (u BetaResponseOutputTextAnnotationUnion) AsFileCitation() (v BetaResponseOutputTextAnnotationFileCitation) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputTextAnnotationUnion) AsURLCitation() (v BetaResponseOutputTextAnnotationURLCitation) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputTextAnnotationUnion) AsContainerFileCitation() (v BetaResponseOutputTextAnnotationContainerFileCitation) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseOutputTextAnnotationUnion) AsFilePath() (v BetaResponseOutputTextAnnotationFilePath) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseOutputTextAnnotationUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseOutputTextAnnotationUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A citation to a file.
+type BetaResponseOutputTextAnnotationFileCitation struct {
+ // The ID of the file.
+ FileID string `json:"file_id" api:"required"`
+ // The filename of the file cited.
+ Filename string `json:"filename" api:"required"`
+ // The index of the file in the list of files.
+ Index int64 `json:"index" api:"required"`
+ // The type of the file citation. Always `file_citation`.
+ Type constant.FileCitation `json:"type" default:"file_citation"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ FileID respjson.Field
+ Filename respjson.Field
+ Index respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputTextAnnotationFileCitation) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputTextAnnotationFileCitation) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A citation for a web resource used to generate a model response.
+type BetaResponseOutputTextAnnotationURLCitation struct {
+ // The index of the last character of the URL citation in the message.
+ EndIndex int64 `json:"end_index" api:"required"`
+ // The index of the first character of the URL citation in the message.
+ StartIndex int64 `json:"start_index" api:"required"`
+ // The title of the web resource.
+ Title string `json:"title" api:"required"`
+ // The type of the URL citation. Always `url_citation`.
+ Type constant.URLCitation `json:"type" default:"url_citation"`
+ // The URL of the web resource.
+ URL string `json:"url" api:"required" format:"uri"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ EndIndex respjson.Field
+ StartIndex respjson.Field
+ Title respjson.Field
+ Type respjson.Field
+ URL respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputTextAnnotationURLCitation) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputTextAnnotationURLCitation) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A citation for a container file used to generate a model response.
+type BetaResponseOutputTextAnnotationContainerFileCitation struct {
+ // The ID of the container file.
+ ContainerID string `json:"container_id" api:"required"`
+ // The index of the last character of the container file citation in the message.
+ EndIndex int64 `json:"end_index" api:"required"`
+ // The ID of the file.
+ FileID string `json:"file_id" api:"required"`
+ // The filename of the container file cited.
+ Filename string `json:"filename" api:"required"`
+ // The index of the first character of the container file citation in the message.
+ StartIndex int64 `json:"start_index" api:"required"`
+ // The type of the container file citation. Always `container_file_citation`.
+ Type constant.ContainerFileCitation `json:"type" default:"container_file_citation"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ContainerID respjson.Field
+ EndIndex respjson.Field
+ FileID respjson.Field
+ Filename respjson.Field
+ StartIndex respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputTextAnnotationContainerFileCitation) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputTextAnnotationContainerFileCitation) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A path to a file.
+type BetaResponseOutputTextAnnotationFilePath struct {
+ // The ID of the file.
+ FileID string `json:"file_id" api:"required"`
+ // The index of the file in the list of files.
+ Index int64 `json:"index" api:"required"`
+ // The type of the file path. Always `file_path`.
+ Type constant.FilePath `json:"type" default:"file_path"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ FileID respjson.Field
+ Index respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputTextAnnotationFilePath) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputTextAnnotationFilePath) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The log probability of a token.
+type BetaResponseOutputTextLogprob struct {
+ Token string `json:"token" api:"required"`
+ Bytes []int64 `json:"bytes" api:"required"`
+ Logprob float64 `json:"logprob" api:"required"`
+ TopLogprobs []BetaResponseOutputTextLogprobTopLogprob `json:"top_logprobs" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Token respjson.Field
+ Bytes respjson.Field
+ Logprob respjson.Field
+ TopLogprobs respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputTextLogprob) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputTextLogprob) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The top log probability of a token.
+type BetaResponseOutputTextLogprobTopLogprob struct {
+ Token string `json:"token" api:"required"`
+ Bytes []int64 `json:"bytes" api:"required"`
+ Logprob float64 `json:"logprob" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Token respjson.Field
+ Bytes respjson.Field
+ Logprob respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputTextLogprobTopLogprob) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputTextLogprobTopLogprob) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A text output from the model.
+//
+// The properties Annotations, Text, Type are required.
+type BetaResponseOutputTextParam struct {
+ // The annotations of the text output.
+ Annotations []BetaResponseOutputTextAnnotationUnionParam `json:"annotations,omitzero" api:"required"`
+ // The text output from the model.
+ Text string `json:"text" api:"required"`
+ Logprobs []BetaResponseOutputTextLogprobParam `json:"logprobs,omitzero"`
+ // The type of the output text. Always `output_text`.
+ //
+ // This field can be elided, and will marshal its zero value as "output_text".
+ Type constant.OutputText `json:"type" default:"output_text"`
+ paramObj
+}
+
+func (r BetaResponseOutputTextParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseOutputTextParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseOutputTextParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseOutputTextAnnotationUnionParam struct {
+ OfFileCitation *BetaResponseOutputTextAnnotationFileCitationParam `json:",omitzero,inline"`
+ OfURLCitation *BetaResponseOutputTextAnnotationURLCitationParam `json:",omitzero,inline"`
+ OfContainerFileCitation *BetaResponseOutputTextAnnotationContainerFileCitationParam `json:",omitzero,inline"`
+ OfFilePath *BetaResponseOutputTextAnnotationFilePathParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseOutputTextAnnotationUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfFileCitation, u.OfURLCitation, u.OfContainerFileCitation, u.OfFilePath)
+}
+func (u *BetaResponseOutputTextAnnotationUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseOutputTextAnnotationUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfFileCitation) {
+ return u.OfFileCitation
+ } else if !param.IsOmitted(u.OfURLCitation) {
+ return u.OfURLCitation
+ } else if !param.IsOmitted(u.OfContainerFileCitation) {
+ return u.OfContainerFileCitation
+ } else if !param.IsOmitted(u.OfFilePath) {
+ return u.OfFilePath
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseOutputTextAnnotationUnionParam) GetTitle() *string {
+ if vt := u.OfURLCitation; vt != nil {
+ return &vt.Title
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseOutputTextAnnotationUnionParam) GetURL() *string {
+ if vt := u.OfURLCitation; vt != nil {
+ return &vt.URL
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseOutputTextAnnotationUnionParam) GetContainerID() *string {
+ if vt := u.OfContainerFileCitation; vt != nil {
+ return &vt.ContainerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseOutputTextAnnotationUnionParam) GetFileID() *string {
+ if vt := u.OfFileCitation; vt != nil {
+ return (*string)(&vt.FileID)
+ } else if vt := u.OfContainerFileCitation; vt != nil {
+ return (*string)(&vt.FileID)
+ } else if vt := u.OfFilePath; vt != nil {
+ return (*string)(&vt.FileID)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseOutputTextAnnotationUnionParam) GetFilename() *string {
+ if vt := u.OfFileCitation; vt != nil {
+ return (*string)(&vt.Filename)
+ } else if vt := u.OfContainerFileCitation; vt != nil {
+ return (*string)(&vt.Filename)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseOutputTextAnnotationUnionParam) GetIndex() *int64 {
+ if vt := u.OfFileCitation; vt != nil {
+ return (*int64)(&vt.Index)
+ } else if vt := u.OfFilePath; vt != nil {
+ return (*int64)(&vt.Index)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseOutputTextAnnotationUnionParam) GetType() *string {
+ if vt := u.OfFileCitation; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfURLCitation; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfContainerFileCitation; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfFilePath; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseOutputTextAnnotationUnionParam) GetEndIndex() *int64 {
+ if vt := u.OfURLCitation; vt != nil {
+ return (*int64)(&vt.EndIndex)
+ } else if vt := u.OfContainerFileCitation; vt != nil {
+ return (*int64)(&vt.EndIndex)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseOutputTextAnnotationUnionParam) GetStartIndex() *int64 {
+ if vt := u.OfURLCitation; vt != nil {
+ return (*int64)(&vt.StartIndex)
+ } else if vt := u.OfContainerFileCitation; vt != nil {
+ return (*int64)(&vt.StartIndex)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaResponseOutputTextAnnotationUnionParam](
+ "type",
+ apijson.Discriminator[BetaResponseOutputTextAnnotationFileCitationParam]("file_citation"),
+ apijson.Discriminator[BetaResponseOutputTextAnnotationURLCitationParam]("url_citation"),
+ apijson.Discriminator[BetaResponseOutputTextAnnotationContainerFileCitationParam]("container_file_citation"),
+ apijson.Discriminator[BetaResponseOutputTextAnnotationFilePathParam]("file_path"),
+ )
+}
+
+// A citation to a file.
+//
+// The properties FileID, Filename, Index, Type are required.
+type BetaResponseOutputTextAnnotationFileCitationParam struct {
+ // The ID of the file.
+ FileID string `json:"file_id" api:"required"`
+ // The filename of the file cited.
+ Filename string `json:"filename" api:"required"`
+ // The index of the file in the list of files.
+ Index int64 `json:"index" api:"required"`
+ // The type of the file citation. Always `file_citation`.
+ //
+ // This field can be elided, and will marshal its zero value as "file_citation".
+ Type constant.FileCitation `json:"type" default:"file_citation"`
+ paramObj
+}
+
+func (r BetaResponseOutputTextAnnotationFileCitationParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseOutputTextAnnotationFileCitationParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseOutputTextAnnotationFileCitationParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A citation for a web resource used to generate a model response.
+//
+// The properties EndIndex, StartIndex, Title, Type, URL are required.
+type BetaResponseOutputTextAnnotationURLCitationParam struct {
+ // The index of the last character of the URL citation in the message.
+ EndIndex int64 `json:"end_index" api:"required"`
+ // The index of the first character of the URL citation in the message.
+ StartIndex int64 `json:"start_index" api:"required"`
+ // The title of the web resource.
+ Title string `json:"title" api:"required"`
+ // The URL of the web resource.
+ URL string `json:"url" api:"required" format:"uri"`
+ // The type of the URL citation. Always `url_citation`.
+ //
+ // This field can be elided, and will marshal its zero value as "url_citation".
+ Type constant.URLCitation `json:"type" default:"url_citation"`
+ paramObj
+}
+
+func (r BetaResponseOutputTextAnnotationURLCitationParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseOutputTextAnnotationURLCitationParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseOutputTextAnnotationURLCitationParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A citation for a container file used to generate a model response.
+//
+// The properties ContainerID, EndIndex, FileID, Filename, StartIndex, Type are
+// required.
+type BetaResponseOutputTextAnnotationContainerFileCitationParam struct {
+ // The ID of the container file.
+ ContainerID string `json:"container_id" api:"required"`
+ // The index of the last character of the container file citation in the message.
+ EndIndex int64 `json:"end_index" api:"required"`
+ // The ID of the file.
+ FileID string `json:"file_id" api:"required"`
+ // The filename of the container file cited.
+ Filename string `json:"filename" api:"required"`
+ // The index of the first character of the container file citation in the message.
+ StartIndex int64 `json:"start_index" api:"required"`
+ // The type of the container file citation. Always `container_file_citation`.
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "container_file_citation".
+ Type constant.ContainerFileCitation `json:"type" default:"container_file_citation"`
+ paramObj
+}
+
+func (r BetaResponseOutputTextAnnotationContainerFileCitationParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseOutputTextAnnotationContainerFileCitationParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseOutputTextAnnotationContainerFileCitationParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A path to a file.
+//
+// The properties FileID, Index, Type are required.
+type BetaResponseOutputTextAnnotationFilePathParam struct {
+ // The ID of the file.
+ FileID string `json:"file_id" api:"required"`
+ // The index of the file in the list of files.
+ Index int64 `json:"index" api:"required"`
+ // The type of the file path. Always `file_path`.
+ //
+ // This field can be elided, and will marshal its zero value as "file_path".
+ Type constant.FilePath `json:"type" default:"file_path"`
+ paramObj
+}
+
+func (r BetaResponseOutputTextAnnotationFilePathParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseOutputTextAnnotationFilePathParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseOutputTextAnnotationFilePathParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The log probability of a token.
+//
+// The properties Token, Bytes, Logprob, TopLogprobs are required.
+type BetaResponseOutputTextLogprobParam struct {
+ Token string `json:"token" api:"required"`
+ Bytes []int64 `json:"bytes,omitzero" api:"required"`
+ Logprob float64 `json:"logprob" api:"required"`
+ TopLogprobs []BetaResponseOutputTextLogprobTopLogprobParam `json:"top_logprobs,omitzero" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseOutputTextLogprobParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseOutputTextLogprobParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseOutputTextLogprobParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The top log probability of a token.
+//
+// The properties Token, Bytes, Logprob are required.
+type BetaResponseOutputTextLogprobTopLogprobParam struct {
+ Token string `json:"token" api:"required"`
+ Bytes []int64 `json:"bytes,omitzero" api:"required"`
+ Logprob float64 `json:"logprob" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseOutputTextLogprobTopLogprobParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseOutputTextLogprobTopLogprobParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseOutputTextLogprobTopLogprobParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when an annotation is added to output text content.
+type BetaResponseOutputTextAnnotationAddedEvent struct {
+ // The annotation object being added. (See annotation schema for details.)
+ Annotation any `json:"annotation" api:"required"`
+ // The index of the annotation within the content part.
+ AnnotationIndex int64 `json:"annotation_index" api:"required"`
+ // The index of the content part within the output item.
+ ContentIndex int64 `json:"content_index" api:"required"`
+ // The unique identifier of the item to which the annotation is being added.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item in the response's output array.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always 'response.output_text.annotation.added'.
+ Type constant.ResponseOutputTextAnnotationAdded `json:"type" default:"response.output_text.annotation.added"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseOutputTextAnnotationAddedEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Annotation respjson.Field
+ AnnotationIndex respjson.Field
+ ContentIndex respjson.Field
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputTextAnnotationAddedEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputTextAnnotationAddedEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseOutputTextAnnotationAddedEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseOutputTextAnnotationAddedEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseOutputTextAnnotationAddedEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Reference to a prompt template and its variables.
+// [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
+type BetaResponsePrompt struct {
+ // The unique identifier of the prompt template to use.
+ ID string `json:"id" api:"required"`
+ // Optional map of values to substitute in for variables in your prompt. The
+ // substitution values can either be strings, or other Response input types like
+ // images or files.
+ Variables map[string]BetaResponsePromptVariableUnion `json:"variables" api:"nullable"`
+ // Optional version of the prompt template.
+ Version string `json:"version" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Variables respjson.Field
+ Version respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponsePrompt) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponsePrompt) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponsePrompt to a BetaResponsePromptParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponsePromptParam.Overrides()
+func (r BetaResponsePrompt) ToParam() BetaResponsePromptParam {
+ return param.Override[BetaResponsePromptParam](json.RawMessage(r.RawJSON()))
+}
+
+// BetaResponsePromptVariableUnion contains all possible properties and values from
+// [string], [BetaResponseInputText], [BetaResponseInputImage],
+// [BetaResponseInputFile].
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString]
+type BetaResponsePromptVariableUnion struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field is from variant [BetaResponseInputText].
+ Text string `json:"text"`
+ Type string `json:"type"`
+ // This field is a union of [BetaResponseInputTextPromptCacheBreakpoint],
+ // [BetaResponseInputImagePromptCacheBreakpoint],
+ // [BetaResponseInputFilePromptCacheBreakpoint]
+ PromptCacheBreakpoint BetaResponsePromptVariableUnionPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
+ Detail string `json:"detail"`
+ FileID string `json:"file_id"`
+ // This field is from variant [BetaResponseInputImage].
+ ImageURL string `json:"image_url"`
+ // This field is from variant [BetaResponseInputFile].
+ FileData string `json:"file_data"`
+ // This field is from variant [BetaResponseInputFile].
+ FileURL string `json:"file_url"`
+ // This field is from variant [BetaResponseInputFile].
+ Filename string `json:"filename"`
+ JSON struct {
+ OfString respjson.Field
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ Detail respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ FileData respjson.Field
+ FileURL respjson.Field
+ Filename respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u BetaResponsePromptVariableUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponsePromptVariableUnion) AsInputText() (v BetaResponseInputText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponsePromptVariableUnion) AsInputImage() (v BetaResponseInputImage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponsePromptVariableUnion) AsInputFile() (v BetaResponseInputFile) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponsePromptVariableUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponsePromptVariableUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponsePromptVariableUnionPromptCacheBreakpoint is an implicit subunion of
+// [BetaResponsePromptVariableUnion].
+// BetaResponsePromptVariableUnionPromptCacheBreakpoint provides convenient access
+// to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponsePromptVariableUnion].
+type BetaResponsePromptVariableUnionPromptCacheBreakpoint struct {
+ // This field is from variant [BetaResponseInputTextPromptCacheBreakpoint].
+ Mode constant.Explicit `json:"mode"`
+ JSON struct {
+ Mode respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponsePromptVariableUnionPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Reference to a prompt template and its variables.
+// [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
+//
+// The property ID is required.
+type BetaResponsePromptParam struct {
+ // The unique identifier of the prompt template to use.
+ ID string `json:"id" api:"required"`
+ // Optional version of the prompt template.
+ Version param.Opt[string] `json:"version,omitzero"`
+ // Optional map of values to substitute in for variables in your prompt. The
+ // substitution values can either be strings, or other Response input types like
+ // images or files.
+ Variables map[string]BetaResponsePromptVariableUnionParam `json:"variables,omitzero"`
+ paramObj
+}
+
+func (r BetaResponsePromptParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponsePromptParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponsePromptParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponsePromptVariableUnionParam struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfInputText *BetaResponseInputTextParam `json:",omitzero,inline"`
+ OfInputImage *BetaResponseInputImageParam `json:",omitzero,inline"`
+ OfInputFile *BetaResponseInputFileParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponsePromptVariableUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfInputText, u.OfInputImage, u.OfInputFile)
+}
+func (u *BetaResponsePromptVariableUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponsePromptVariableUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfInputText) {
+ return u.OfInputText
+ } else if !param.IsOmitted(u.OfInputImage) {
+ return u.OfInputImage
+ } else if !param.IsOmitted(u.OfInputFile) {
+ return u.OfInputFile
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponsePromptVariableUnionParam) GetText() *string {
+ if vt := u.OfInputText; vt != nil {
+ return &vt.Text
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponsePromptVariableUnionParam) GetImageURL() *string {
+ if vt := u.OfInputImage; vt != nil && vt.ImageURL.Valid() {
+ return &vt.ImageURL.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponsePromptVariableUnionParam) GetFileData() *string {
+ if vt := u.OfInputFile; vt != nil && vt.FileData.Valid() {
+ return &vt.FileData.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponsePromptVariableUnionParam) GetFileURL() *string {
+ if vt := u.OfInputFile; vt != nil && vt.FileURL.Valid() {
+ return &vt.FileURL.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponsePromptVariableUnionParam) GetFilename() *string {
+ if vt := u.OfInputFile; vt != nil && vt.Filename.Valid() {
+ return &vt.Filename.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponsePromptVariableUnionParam) GetType() *string {
+ if vt := u.OfInputText; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfInputImage; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfInputFile; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponsePromptVariableUnionParam) GetDetail() *string {
+ if vt := u.OfInputImage; vt != nil {
+ return (*string)(&vt.Detail)
+ } else if vt := u.OfInputFile; vt != nil {
+ return (*string)(&vt.Detail)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponsePromptVariableUnionParam) GetFileID() *string {
+ if vt := u.OfInputImage; vt != nil && vt.FileID.Valid() {
+ return &vt.FileID.Value
+ } else if vt := u.OfInputFile; vt != nil && vt.FileID.Valid() {
+ return &vt.FileID.Value
+ }
+ return nil
+}
+
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u BetaResponsePromptVariableUnionParam) GetPromptCacheBreakpoint() (res betaResponsePromptVariableUnionParamPromptCacheBreakpoint) {
+ if vt := u.OfInputText; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ } else if vt := u.OfInputImage; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ } else if vt := u.OfInputFile; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ }
+ return
+}
+
+// Can have the runtime types [*BetaResponseInputTextPromptCacheBreakpointParam],
+// [*BetaResponseInputImagePromptCacheBreakpointParam],
+// [*BetaResponseInputFilePromptCacheBreakpointParam]
+type betaResponsePromptVariableUnionParamPromptCacheBreakpoint struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *openai.BetaResponseInputTextPromptCacheBreakpointParam:
+// case *openai.BetaResponseInputImagePromptCacheBreakpointParam:
+// case *openai.BetaResponseInputFilePromptCacheBreakpointParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u betaResponsePromptVariableUnionParamPromptCacheBreakpoint) AsAny() any { return u.any }
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaResponsePromptVariableUnionParamPromptCacheBreakpoint) GetMode() *string {
+ switch vt := u.any.(type) {
+ case *BetaResponseInputTextPromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ case *BetaResponseInputImagePromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ case *BetaResponseInputFilePromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ }
+ return nil
+}
+
+// Emitted when a response is queued and waiting to be processed.
+type BetaResponseQueuedEvent struct {
+ // The full response object that is queued.
+ Response BetaResponse `json:"response" api:"required"`
+ // The sequence number for this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always 'response.queued'.
+ Type constant.ResponseQueued `json:"type" default:"response.queued"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseQueuedEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Response respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseQueuedEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseQueuedEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseQueuedEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseQueuedEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseQueuedEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A description of the chain of thought used by a reasoning model while generating
+// a response. Be sure to include these items in your `input` to the Responses API
+// for subsequent turns of a conversation if you are manually
+// [managing context](https://platform.openai.com/docs/guides/conversation-state).
+type BetaResponseReasoningItem struct {
+ // The unique identifier of the reasoning content.
+ ID string `json:"id" api:"required"`
+ // Reasoning summary content.
+ Summary []BetaResponseReasoningItemSummary `json:"summary" api:"required"`
+ // The type of the object. Always `reasoning`.
+ Type constant.Reasoning `json:"type" default:"reasoning"`
+ // The agent that produced this item.
+ Agent BetaResponseReasoningItemAgent `json:"agent" api:"nullable"`
+ // Reasoning text content.
+ Content []BetaResponseReasoningItemContent `json:"content"`
+ // The encrypted content of the reasoning item. This is populated by default for
+ // reasoning items returned by `POST /v1/responses` and WebSocket `response.create`
+ // requests.
+ EncryptedContent string `json:"encrypted_content" api:"nullable"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ // Populated when items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status BetaResponseReasoningItemStatus `json:"status"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Summary respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Content respjson.Field
+ EncryptedContent respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseReasoningItem) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseReasoningItem) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseReasoningItem to a
+// BetaResponseReasoningItemParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseReasoningItemParam.Overrides()
+func (r BetaResponseReasoningItem) ToParam() BetaResponseReasoningItemParam {
+ return param.Override[BetaResponseReasoningItemParam](json.RawMessage(r.RawJSON()))
+}
+
+// A summary text from the model.
+type BetaResponseReasoningItemSummary struct {
+ // A summary of the reasoning output from the model so far.
+ Text string `json:"text" api:"required"`
+ // The type of the object. Always `summary_text`.
+ Type constant.SummaryText `json:"type" default:"summary_text"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseReasoningItemSummary) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseReasoningItemSummary) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+type BetaResponseReasoningItemAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseReasoningItemAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseReasoningItemAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Reasoning text from the model.
+type BetaResponseReasoningItemContent struct {
+ // The reasoning text from the model.
+ Text string `json:"text" api:"required"`
+ // The type of the reasoning text. Always `reasoning_text`.
+ Type constant.ReasoningText `json:"type" default:"reasoning_text"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseReasoningItemContent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseReasoningItemContent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+// Populated when items are returned via API.
+type BetaResponseReasoningItemStatus string
+
+const (
+ BetaResponseReasoningItemStatusInProgress BetaResponseReasoningItemStatus = "in_progress"
+ BetaResponseReasoningItemStatusCompleted BetaResponseReasoningItemStatus = "completed"
+ BetaResponseReasoningItemStatusIncomplete BetaResponseReasoningItemStatus = "incomplete"
+)
+
+// A description of the chain of thought used by a reasoning model while generating
+// a response. Be sure to include these items in your `input` to the Responses API
+// for subsequent turns of a conversation if you are manually
+// [managing context](https://platform.openai.com/docs/guides/conversation-state).
+//
+// The properties ID, Summary, Type are required.
+type BetaResponseReasoningItemParam struct {
+ // The unique identifier of the reasoning content.
+ ID string `json:"id" api:"required"`
+ // Reasoning summary content.
+ Summary []BetaResponseReasoningItemSummaryParam `json:"summary,omitzero" api:"required"`
+ // The encrypted content of the reasoning item. This is populated by default for
+ // reasoning items returned by `POST /v1/responses` and WebSocket `response.create`
+ // requests.
+ EncryptedContent param.Opt[string] `json:"encrypted_content,omitzero"`
+ // The agent that produced this item.
+ Agent BetaResponseReasoningItemAgentParam `json:"agent,omitzero"`
+ // Reasoning text content.
+ Content []BetaResponseReasoningItemContentParam `json:"content,omitzero"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ // Populated when items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status BetaResponseReasoningItemStatus `json:"status,omitzero"`
+ // The type of the object. Always `reasoning`.
+ //
+ // This field can be elided, and will marshal its zero value as "reasoning".
+ Type constant.Reasoning `json:"type" default:"reasoning"`
+ paramObj
+}
+
+func (r BetaResponseReasoningItemParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseReasoningItemParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseReasoningItemParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A summary text from the model.
+//
+// The properties Text, Type are required.
+type BetaResponseReasoningItemSummaryParam struct {
+ // A summary of the reasoning output from the model so far.
+ Text string `json:"text" api:"required"`
+ // The type of the object. Always `summary_text`.
+ //
+ // This field can be elided, and will marshal its zero value as "summary_text".
+ Type constant.SummaryText `json:"type" default:"summary_text"`
+ paramObj
+}
+
+func (r BetaResponseReasoningItemSummaryParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseReasoningItemSummaryParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseReasoningItemSummaryParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseReasoningItemAgentParam struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseReasoningItemAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseReasoningItemAgentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseReasoningItemAgentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Reasoning text from the model.
+//
+// The properties Text, Type are required.
+type BetaResponseReasoningItemContentParam struct {
+ // The reasoning text from the model.
+ Text string `json:"text" api:"required"`
+ // The type of the reasoning text. Always `reasoning_text`.
+ //
+ // This field can be elided, and will marshal its zero value as "reasoning_text".
+ Type constant.ReasoningText `json:"type" default:"reasoning_text"`
+ paramObj
+}
+
+func (r BetaResponseReasoningItemContentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseReasoningItemContentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseReasoningItemContentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when a new reasoning summary part is added.
+type BetaResponseReasoningSummaryPartAddedEvent struct {
+ // The ID of the item this summary part is associated with.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item this summary part is associated with.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The summary part that was added.
+ Part BetaResponseReasoningSummaryPartAddedEventPart `json:"part" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The index of the summary part within the reasoning summary.
+ SummaryIndex int64 `json:"summary_index" api:"required"`
+ // The type of the event. Always `response.reasoning_summary_part.added`.
+ Type constant.ResponseReasoningSummaryPartAdded `json:"type" default:"response.reasoning_summary_part.added"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseReasoningSummaryPartAddedEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ Part respjson.Field
+ SequenceNumber respjson.Field
+ SummaryIndex respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseReasoningSummaryPartAddedEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseReasoningSummaryPartAddedEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The summary part that was added.
+type BetaResponseReasoningSummaryPartAddedEventPart struct {
+ // The text of the summary part.
+ Text string `json:"text" api:"required"`
+ // The type of the summary part. Always `summary_text`.
+ Type constant.SummaryText `json:"type" default:"summary_text"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseReasoningSummaryPartAddedEventPart) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseReasoningSummaryPartAddedEventPart) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseReasoningSummaryPartAddedEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseReasoningSummaryPartAddedEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseReasoningSummaryPartAddedEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when a reasoning summary part is completed.
+type BetaResponseReasoningSummaryPartDoneEvent struct {
+ // The ID of the item this summary part is associated with.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item this summary part is associated with.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The completed summary part.
+ Part BetaResponseReasoningSummaryPartDoneEventPart `json:"part" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The index of the summary part within the reasoning summary.
+ SummaryIndex int64 `json:"summary_index" api:"required"`
+ // The type of the event. Always `response.reasoning_summary_part.done`.
+ Type constant.ResponseReasoningSummaryPartDone `json:"type" default:"response.reasoning_summary_part.done"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseReasoningSummaryPartDoneEventAgent `json:"agent" api:"nullable"`
+ // The completion status of the summary part. Omitted when the part completed
+ // normally and set to `incomplete` when generation was interrupted.
+ //
+ // Any of "incomplete".
+ Status BetaResponseReasoningSummaryPartDoneEventStatus `json:"status"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ Part respjson.Field
+ SequenceNumber respjson.Field
+ SummaryIndex respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseReasoningSummaryPartDoneEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseReasoningSummaryPartDoneEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The completed summary part.
+type BetaResponseReasoningSummaryPartDoneEventPart struct {
+ // The text of the summary part.
+ Text string `json:"text" api:"required"`
+ // The type of the summary part. Always `summary_text`.
+ Type constant.SummaryText `json:"type" default:"summary_text"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseReasoningSummaryPartDoneEventPart) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseReasoningSummaryPartDoneEventPart) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseReasoningSummaryPartDoneEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseReasoningSummaryPartDoneEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseReasoningSummaryPartDoneEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The completion status of the summary part. Omitted when the part completed
+// normally and set to `incomplete` when generation was interrupted.
+type BetaResponseReasoningSummaryPartDoneEventStatus string
+
+const (
+ BetaResponseReasoningSummaryPartDoneEventStatusIncomplete BetaResponseReasoningSummaryPartDoneEventStatus = "incomplete"
+)
+
+// Emitted when a delta is added to a reasoning summary text.
+type BetaResponseReasoningSummaryTextDeltaEvent struct {
+ // The text delta that was added to the summary.
+ Delta string `json:"delta" api:"required"`
+ // The ID of the item this summary text delta is associated with.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item this summary text delta is associated with.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The index of the summary part within the reasoning summary.
+ SummaryIndex int64 `json:"summary_index" api:"required"`
+ // The type of the event. Always `response.reasoning_summary_text.delta`.
+ Type constant.ResponseReasoningSummaryTextDelta `json:"type" default:"response.reasoning_summary_text.delta"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseReasoningSummaryTextDeltaEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Delta respjson.Field
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ SummaryIndex respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseReasoningSummaryTextDeltaEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseReasoningSummaryTextDeltaEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseReasoningSummaryTextDeltaEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseReasoningSummaryTextDeltaEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseReasoningSummaryTextDeltaEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when a reasoning summary text is completed.
+type BetaResponseReasoningSummaryTextDoneEvent struct {
+ // The ID of the item this summary text is associated with.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item this summary text is associated with.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The index of the summary part within the reasoning summary.
+ SummaryIndex int64 `json:"summary_index" api:"required"`
+ // The full text of the completed reasoning summary.
+ Text string `json:"text" api:"required"`
+ // The type of the event. Always `response.reasoning_summary_text.done`.
+ Type constant.ResponseReasoningSummaryTextDone `json:"type" default:"response.reasoning_summary_text.done"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseReasoningSummaryTextDoneEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ SummaryIndex respjson.Field
+ Text respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseReasoningSummaryTextDoneEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseReasoningSummaryTextDoneEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseReasoningSummaryTextDoneEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseReasoningSummaryTextDoneEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseReasoningSummaryTextDoneEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when a delta is added to a reasoning text.
+type BetaResponseReasoningTextDeltaEvent struct {
+ // The index of the reasoning content part this delta is associated with.
+ ContentIndex int64 `json:"content_index" api:"required"`
+ // The text delta that was added to the reasoning content.
+ Delta string `json:"delta" api:"required"`
+ // The ID of the item this reasoning text delta is associated with.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item this reasoning text delta is associated with.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.reasoning_text.delta`.
+ Type constant.ResponseReasoningTextDelta `json:"type" default:"response.reasoning_text.delta"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseReasoningTextDeltaEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ContentIndex respjson.Field
+ Delta respjson.Field
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseReasoningTextDeltaEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseReasoningTextDeltaEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseReasoningTextDeltaEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseReasoningTextDeltaEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseReasoningTextDeltaEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when a reasoning text is completed.
+type BetaResponseReasoningTextDoneEvent struct {
+ // The index of the reasoning content part.
+ ContentIndex int64 `json:"content_index" api:"required"`
+ // The ID of the item this reasoning text is associated with.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item this reasoning text is associated with.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The full text of the completed reasoning content.
+ Text string `json:"text" api:"required"`
+ // The type of the event. Always `response.reasoning_text.done`.
+ Type constant.ResponseReasoningTextDone `json:"type" default:"response.reasoning_text.done"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseReasoningTextDoneEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ContentIndex respjson.Field
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Text respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseReasoningTextDoneEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseReasoningTextDoneEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseReasoningTextDoneEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseReasoningTextDoneEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseReasoningTextDoneEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when there is a partial refusal text.
+type BetaResponseRefusalDeltaEvent struct {
+ // The index of the content part that the refusal text is added to.
+ ContentIndex int64 `json:"content_index" api:"required"`
+ // The refusal text that is added.
+ Delta string `json:"delta" api:"required"`
+ // The ID of the output item that the refusal text is added to.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item that the refusal text is added to.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.refusal.delta`.
+ Type constant.ResponseRefusalDelta `json:"type" default:"response.refusal.delta"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseRefusalDeltaEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ContentIndex respjson.Field
+ Delta respjson.Field
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseRefusalDeltaEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseRefusalDeltaEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseRefusalDeltaEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseRefusalDeltaEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseRefusalDeltaEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when refusal text is finalized.
+type BetaResponseRefusalDoneEvent struct {
+ // The index of the content part that the refusal text is finalized.
+ ContentIndex int64 `json:"content_index" api:"required"`
+ // The ID of the output item that the refusal text is finalized.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item that the refusal text is finalized.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The refusal text that is finalized.
+ Refusal string `json:"refusal" api:"required"`
+ // The sequence number of this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.refusal.done`.
+ Type constant.ResponseRefusalDone `json:"type" default:"response.refusal.done"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseRefusalDoneEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ContentIndex respjson.Field
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ Refusal respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseRefusalDoneEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseRefusalDoneEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseRefusalDoneEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseRefusalDoneEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseRefusalDoneEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The status of the response generation. One of `completed`, `failed`,
+// `in_progress`, `cancelled`, `queued`, or `incomplete`.
+type BetaResponseStatus string
+
+const (
+ BetaResponseStatusCompleted BetaResponseStatus = "completed"
+ BetaResponseStatusFailed BetaResponseStatus = "failed"
+ BetaResponseStatusInProgress BetaResponseStatus = "in_progress"
+ BetaResponseStatusCancelled BetaResponseStatus = "cancelled"
+ BetaResponseStatusQueued BetaResponseStatus = "queued"
+ BetaResponseStatusIncomplete BetaResponseStatus = "incomplete"
+)
+
+// BetaResponseStreamEventUnion contains all possible properties and values from
+// [BetaResponseAudioDeltaEvent], [BetaResponseAudioDoneEvent],
+// [BetaResponseAudioTranscriptDeltaEvent], [BetaResponseAudioTranscriptDoneEvent],
+// [BetaResponseCodeInterpreterCallCodeDeltaEvent],
+// [BetaResponseCodeInterpreterCallCodeDoneEvent],
+// [BetaResponseCodeInterpreterCallCompletedEvent],
+// [BetaResponseCodeInterpreterCallInProgressEvent],
+// [BetaResponseCodeInterpreterCallInterpretingEvent],
+// [BetaResponseCompletedEvent], [BetaResponseContentPartAddedEvent],
+// [BetaResponseContentPartDoneEvent], [BetaResponseCreatedEvent],
+// [BetaResponseErrorEvent], [BetaResponseFileSearchCallCompletedEvent],
+// [BetaResponseFileSearchCallInProgressEvent],
+// [BetaResponseFileSearchCallSearchingEvent],
+// [BetaResponseFunctionCallArgumentsDeltaEvent],
+// [BetaResponseFunctionCallArgumentsDoneEvent], [BetaResponseInProgressEvent],
+// [BetaResponseFailedEvent], [BetaResponseIncompleteEvent],
+// [BetaResponseOutputItemAddedEvent], [BetaResponseOutputItemDoneEvent],
+// [BetaResponseReasoningSummaryPartAddedEvent],
+// [BetaResponseReasoningSummaryPartDoneEvent],
+// [BetaResponseReasoningSummaryTextDeltaEvent],
+// [BetaResponseReasoningSummaryTextDoneEvent],
+// [BetaResponseReasoningTextDeltaEvent], [BetaResponseReasoningTextDoneEvent],
+// [BetaResponseRefusalDeltaEvent], [BetaResponseRefusalDoneEvent],
+// [BetaResponseTextDeltaEvent], [BetaResponseTextDoneEvent],
+// [BetaResponseWebSearchCallCompletedEvent],
+// [BetaResponseWebSearchCallInProgressEvent],
+// [BetaResponseWebSearchCallSearchingEvent],
+// [BetaResponseImageGenCallCompletedEvent],
+// [BetaResponseImageGenCallGeneratingEvent],
+// [BetaResponseImageGenCallInProgressEvent],
+// [BetaResponseImageGenCallPartialImageEvent],
+// [BetaResponseMcpCallArgumentsDeltaEvent],
+// [BetaResponseMcpCallArgumentsDoneEvent], [BetaResponseMcpCallCompletedEvent],
+// [BetaResponseMcpCallFailedEvent], [BetaResponseMcpCallInProgressEvent],
+// [BetaResponseMcpListToolsCompletedEvent], [BetaResponseMcpListToolsFailedEvent],
+// [BetaResponseMcpListToolsInProgressEvent],
+// [BetaResponseOutputTextAnnotationAddedEvent], [BetaResponseQueuedEvent],
+// [BetaResponseCustomToolCallInputDeltaEvent],
+// [BetaResponseCustomToolCallInputDoneEvent].
+//
+// Use the [BetaResponseStreamEventUnion.AsAny] method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaResponseStreamEventUnion struct {
+ Delta string `json:"delta"`
+ SequenceNumber int64 `json:"sequence_number"`
+ // Any of "response.audio.delta", "response.audio.done",
+ // "response.audio.transcript.delta", "response.audio.transcript.done",
+ // "response.code_interpreter_call_code.delta",
+ // "response.code_interpreter_call_code.done",
+ // "response.code_interpreter_call.completed",
+ // "response.code_interpreter_call.in_progress",
+ // "response.code_interpreter_call.interpreting", "response.completed",
+ // "response.content_part.added", "response.content_part.done", "response.created",
+ // "error", "response.file_search_call.completed",
+ // "response.file_search_call.in_progress", "response.file_search_call.searching",
+ // "response.function_call_arguments.delta",
+ // "response.function_call_arguments.done", "response.in_progress",
+ // "response.failed", "response.incomplete", "response.output_item.added",
+ // "response.output_item.done", "response.reasoning_summary_part.added",
+ // "response.reasoning_summary_part.done", "response.reasoning_summary_text.delta",
+ // "response.reasoning_summary_text.done", "response.reasoning_text.delta",
+ // "response.reasoning_text.done", "response.refusal.delta",
+ // "response.refusal.done", "response.output_text.delta",
+ // "response.output_text.done", "response.web_search_call.completed",
+ // "response.web_search_call.in_progress", "response.web_search_call.searching",
+ // "response.image_generation_call.completed",
+ // "response.image_generation_call.generating",
+ // "response.image_generation_call.in_progress",
+ // "response.image_generation_call.partial_image",
+ // "response.mcp_call_arguments.delta", "response.mcp_call_arguments.done",
+ // "response.mcp_call.completed", "response.mcp_call.failed",
+ // "response.mcp_call.in_progress", "response.mcp_list_tools.completed",
+ // "response.mcp_list_tools.failed", "response.mcp_list_tools.in_progress",
+ // "response.output_text.annotation.added", "response.queued",
+ // "response.custom_tool_call_input.delta", "response.custom_tool_call_input.done".
+ Type string `json:"type"`
+ // This field is a union of [BetaResponseAudioDeltaEventAgent],
+ // [BetaResponseAudioDoneEventAgent], [BetaResponseAudioTranscriptDeltaEventAgent],
+ // [BetaResponseAudioTranscriptDoneEventAgent],
+ // [BetaResponseCodeInterpreterCallCodeDeltaEventAgent],
+ // [BetaResponseCodeInterpreterCallCodeDoneEventAgent],
+ // [BetaResponseCodeInterpreterCallCompletedEventAgent],
+ // [BetaResponseCodeInterpreterCallInProgressEventAgent],
+ // [BetaResponseCodeInterpreterCallInterpretingEventAgent],
+ // [BetaResponseCompletedEventAgent], [BetaResponseContentPartAddedEventAgent],
+ // [BetaResponseContentPartDoneEventAgent], [BetaResponseCreatedEventAgent],
+ // [BetaResponseErrorEventAgent], [BetaResponseFileSearchCallCompletedEventAgent],
+ // [BetaResponseFileSearchCallInProgressEventAgent],
+ // [BetaResponseFileSearchCallSearchingEventAgent],
+ // [BetaResponseFunctionCallArgumentsDeltaEventAgent],
+ // [BetaResponseFunctionCallArgumentsDoneEventAgent],
+ // [BetaResponseInProgressEventAgent], [BetaResponseFailedEventAgent],
+ // [BetaResponseIncompleteEventAgent], [BetaResponseOutputItemAddedEventAgent],
+ // [BetaResponseOutputItemDoneEventAgent],
+ // [BetaResponseReasoningSummaryPartAddedEventAgent],
+ // [BetaResponseReasoningSummaryPartDoneEventAgent],
+ // [BetaResponseReasoningSummaryTextDeltaEventAgent],
+ // [BetaResponseReasoningSummaryTextDoneEventAgent],
+ // [BetaResponseReasoningTextDeltaEventAgent],
+ // [BetaResponseReasoningTextDoneEventAgent], [BetaResponseRefusalDeltaEventAgent],
+ // [BetaResponseRefusalDoneEventAgent], [BetaResponseTextDeltaEventAgent],
+ // [BetaResponseTextDoneEventAgent],
+ // [BetaResponseWebSearchCallCompletedEventAgent],
+ // [BetaResponseWebSearchCallInProgressEventAgent],
+ // [BetaResponseWebSearchCallSearchingEventAgent],
+ // [BetaResponseImageGenCallCompletedEventAgent],
+ // [BetaResponseImageGenCallGeneratingEventAgent],
+ // [BetaResponseImageGenCallInProgressEventAgent],
+ // [BetaResponseImageGenCallPartialImageEventAgent],
+ // [BetaResponseMcpCallArgumentsDeltaEventAgent],
+ // [BetaResponseMcpCallArgumentsDoneEventAgent],
+ // [BetaResponseMcpCallCompletedEventAgent], [BetaResponseMcpCallFailedEventAgent],
+ // [BetaResponseMcpCallInProgressEventAgent],
+ // [BetaResponseMcpListToolsCompletedEventAgent],
+ // [BetaResponseMcpListToolsFailedEventAgent],
+ // [BetaResponseMcpListToolsInProgressEventAgent],
+ // [BetaResponseOutputTextAnnotationAddedEventAgent],
+ // [BetaResponseQueuedEventAgent],
+ // [BetaResponseCustomToolCallInputDeltaEventAgent],
+ // [BetaResponseCustomToolCallInputDoneEventAgent]
+ Agent BetaResponseStreamEventUnionAgent `json:"agent"`
+ ItemID string `json:"item_id"`
+ OutputIndex int64 `json:"output_index"`
+ Code string `json:"code"`
+ // This field is from variant [BetaResponseCompletedEvent].
+ Response BetaResponse `json:"response"`
+ ContentIndex int64 `json:"content_index"`
+ // This field is a union of [BetaResponseContentPartAddedEventPartUnion],
+ // [BetaResponseContentPartDoneEventPartUnion],
+ // [BetaResponseReasoningSummaryPartAddedEventPart],
+ // [BetaResponseReasoningSummaryPartDoneEventPart]
+ Part BetaResponseStreamEventUnionPart `json:"part"`
+ // This field is from variant [BetaResponseErrorEvent].
+ Message string `json:"message"`
+ // This field is from variant [BetaResponseErrorEvent].
+ Param string `json:"param"`
+ Arguments string `json:"arguments"`
+ // This field is from variant [BetaResponseFunctionCallArgumentsDoneEvent].
+ Name string `json:"name"`
+ // This field is from variant [BetaResponseOutputItemAddedEvent].
+ Item BetaResponseOutputItemUnion `json:"item"`
+ SummaryIndex int64 `json:"summary_index"`
+ // This field is from variant [BetaResponseReasoningSummaryPartDoneEvent].
+ Status BetaResponseReasoningSummaryPartDoneEventStatus `json:"status"`
+ Text string `json:"text"`
+ // This field is from variant [BetaResponseRefusalDoneEvent].
+ Refusal string `json:"refusal"`
+ // This field is a union of [[]BetaResponseTextDeltaEventLogprob],
+ // [[]BetaResponseTextDoneEventLogprob]
+ Logprobs BetaResponseStreamEventUnionLogprobs `json:"logprobs"`
+ // This field is from variant [BetaResponseImageGenCallPartialImageEvent].
+ PartialImageB64 string `json:"partial_image_b64"`
+ // This field is from variant [BetaResponseImageGenCallPartialImageEvent].
+ PartialImageIndex int64 `json:"partial_image_index"`
+ // This field is from variant [BetaResponseOutputTextAnnotationAddedEvent].
+ Annotation any `json:"annotation"`
+ // This field is from variant [BetaResponseOutputTextAnnotationAddedEvent].
+ AnnotationIndex int64 `json:"annotation_index"`
+ // This field is from variant [BetaResponseCustomToolCallInputDoneEvent].
+ Input string `json:"input"`
+ JSON struct {
+ Delta respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ Code respjson.Field
+ Response respjson.Field
+ ContentIndex respjson.Field
+ Part respjson.Field
+ Message respjson.Field
+ Param respjson.Field
+ Arguments respjson.Field
+ Name respjson.Field
+ Item respjson.Field
+ SummaryIndex respjson.Field
+ Status respjson.Field
+ Text respjson.Field
+ Refusal respjson.Field
+ Logprobs respjson.Field
+ PartialImageB64 respjson.Field
+ PartialImageIndex respjson.Field
+ Annotation respjson.Field
+ AnnotationIndex respjson.Field
+ Input respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaResponseStreamEvent is implemented by each variant of
+// [BetaResponseStreamEventUnion] to add type safety for the return type of
+// [BetaResponseStreamEventUnion.AsAny]
+type anyBetaResponseStreamEvent interface {
+ implBetaResponseStreamEventUnion()
+}
+
+func (BetaResponseAudioDeltaEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseAudioDoneEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseAudioTranscriptDeltaEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseAudioTranscriptDoneEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseCodeInterpreterCallCodeDeltaEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseCodeInterpreterCallCodeDoneEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseCodeInterpreterCallCompletedEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseCodeInterpreterCallInProgressEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseCodeInterpreterCallInterpretingEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseCompletedEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseContentPartAddedEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseContentPartDoneEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseCreatedEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseErrorEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseFileSearchCallCompletedEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseFileSearchCallInProgressEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseFileSearchCallSearchingEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseFunctionCallArgumentsDeltaEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseFunctionCallArgumentsDoneEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseInProgressEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseFailedEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseIncompleteEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseOutputItemAddedEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseOutputItemDoneEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseReasoningSummaryPartAddedEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseReasoningSummaryPartDoneEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseReasoningSummaryTextDeltaEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseReasoningSummaryTextDoneEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseReasoningTextDeltaEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseReasoningTextDoneEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseRefusalDeltaEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseRefusalDoneEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseTextDeltaEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseTextDoneEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseWebSearchCallCompletedEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseWebSearchCallInProgressEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseWebSearchCallSearchingEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseImageGenCallCompletedEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseImageGenCallGeneratingEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseImageGenCallInProgressEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseImageGenCallPartialImageEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseMcpCallArgumentsDeltaEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseMcpCallArgumentsDoneEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseMcpCallCompletedEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseMcpCallFailedEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseMcpCallInProgressEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseMcpListToolsCompletedEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseMcpListToolsFailedEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseMcpListToolsInProgressEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseOutputTextAnnotationAddedEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseQueuedEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseCustomToolCallInputDeltaEvent) implBetaResponseStreamEventUnion() {}
+func (BetaResponseCustomToolCallInputDoneEvent) implBetaResponseStreamEventUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaResponseStreamEventUnion.AsAny().(type) {
+// case openai.BetaResponseAudioDeltaEvent:
+// case openai.BetaResponseAudioDoneEvent:
+// case openai.BetaResponseAudioTranscriptDeltaEvent:
+// case openai.BetaResponseAudioTranscriptDoneEvent:
+// case openai.BetaResponseCodeInterpreterCallCodeDeltaEvent:
+// case openai.BetaResponseCodeInterpreterCallCodeDoneEvent:
+// case openai.BetaResponseCodeInterpreterCallCompletedEvent:
+// case openai.BetaResponseCodeInterpreterCallInProgressEvent:
+// case openai.BetaResponseCodeInterpreterCallInterpretingEvent:
+// case openai.BetaResponseCompletedEvent:
+// case openai.BetaResponseContentPartAddedEvent:
+// case openai.BetaResponseContentPartDoneEvent:
+// case openai.BetaResponseCreatedEvent:
+// case openai.BetaResponseErrorEvent:
+// case openai.BetaResponseFileSearchCallCompletedEvent:
+// case openai.BetaResponseFileSearchCallInProgressEvent:
+// case openai.BetaResponseFileSearchCallSearchingEvent:
+// case openai.BetaResponseFunctionCallArgumentsDeltaEvent:
+// case openai.BetaResponseFunctionCallArgumentsDoneEvent:
+// case openai.BetaResponseInProgressEvent:
+// case openai.BetaResponseFailedEvent:
+// case openai.BetaResponseIncompleteEvent:
+// case openai.BetaResponseOutputItemAddedEvent:
+// case openai.BetaResponseOutputItemDoneEvent:
+// case openai.BetaResponseReasoningSummaryPartAddedEvent:
+// case openai.BetaResponseReasoningSummaryPartDoneEvent:
+// case openai.BetaResponseReasoningSummaryTextDeltaEvent:
+// case openai.BetaResponseReasoningSummaryTextDoneEvent:
+// case openai.BetaResponseReasoningTextDeltaEvent:
+// case openai.BetaResponseReasoningTextDoneEvent:
+// case openai.BetaResponseRefusalDeltaEvent:
+// case openai.BetaResponseRefusalDoneEvent:
+// case openai.BetaResponseTextDeltaEvent:
+// case openai.BetaResponseTextDoneEvent:
+// case openai.BetaResponseWebSearchCallCompletedEvent:
+// case openai.BetaResponseWebSearchCallInProgressEvent:
+// case openai.BetaResponseWebSearchCallSearchingEvent:
+// case openai.BetaResponseImageGenCallCompletedEvent:
+// case openai.BetaResponseImageGenCallGeneratingEvent:
+// case openai.BetaResponseImageGenCallInProgressEvent:
+// case openai.BetaResponseImageGenCallPartialImageEvent:
+// case openai.BetaResponseMcpCallArgumentsDeltaEvent:
+// case openai.BetaResponseMcpCallArgumentsDoneEvent:
+// case openai.BetaResponseMcpCallCompletedEvent:
+// case openai.BetaResponseMcpCallFailedEvent:
+// case openai.BetaResponseMcpCallInProgressEvent:
+// case openai.BetaResponseMcpListToolsCompletedEvent:
+// case openai.BetaResponseMcpListToolsFailedEvent:
+// case openai.BetaResponseMcpListToolsInProgressEvent:
+// case openai.BetaResponseOutputTextAnnotationAddedEvent:
+// case openai.BetaResponseQueuedEvent:
+// case openai.BetaResponseCustomToolCallInputDeltaEvent:
+// case openai.BetaResponseCustomToolCallInputDoneEvent:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaResponseStreamEventUnion) AsAny() anyBetaResponseStreamEvent {
+ switch u.Type {
+ case "response.audio.delta":
+ return u.AsResponseAudioDelta()
+ case "response.audio.done":
+ return u.AsResponseAudioDone()
+ case "response.audio.transcript.delta":
+ return u.AsResponseAudioTranscriptDelta()
+ case "response.audio.transcript.done":
+ return u.AsResponseAudioTranscriptDone()
+ case "response.code_interpreter_call_code.delta":
+ return u.AsResponseCodeInterpreterCallCodeDelta()
+ case "response.code_interpreter_call_code.done":
+ return u.AsResponseCodeInterpreterCallCodeDone()
+ case "response.code_interpreter_call.completed":
+ return u.AsResponseCodeInterpreterCallCompleted()
+ case "response.code_interpreter_call.in_progress":
+ return u.AsResponseCodeInterpreterCallInProgress()
+ case "response.code_interpreter_call.interpreting":
+ return u.AsResponseCodeInterpreterCallInterpreting()
+ case "response.completed":
+ return u.AsResponseCompleted()
+ case "response.content_part.added":
+ return u.AsResponseContentPartAdded()
+ case "response.content_part.done":
+ return u.AsResponseContentPartDone()
+ case "response.created":
+ return u.AsResponseCreated()
+ case "error":
+ return u.AsError()
+ case "response.file_search_call.completed":
+ return u.AsResponseFileSearchCallCompleted()
+ case "response.file_search_call.in_progress":
+ return u.AsResponseFileSearchCallInProgress()
+ case "response.file_search_call.searching":
+ return u.AsResponseFileSearchCallSearching()
+ case "response.function_call_arguments.delta":
+ return u.AsResponseFunctionCallArgumentsDelta()
+ case "response.function_call_arguments.done":
+ return u.AsResponseFunctionCallArgumentsDone()
+ case "response.in_progress":
+ return u.AsResponseInProgress()
+ case "response.failed":
+ return u.AsResponseFailed()
+ case "response.incomplete":
+ return u.AsResponseIncomplete()
+ case "response.output_item.added":
+ return u.AsResponseOutputItemAdded()
+ case "response.output_item.done":
+ return u.AsResponseOutputItemDone()
+ case "response.reasoning_summary_part.added":
+ return u.AsResponseReasoningSummaryPartAdded()
+ case "response.reasoning_summary_part.done":
+ return u.AsResponseReasoningSummaryPartDone()
+ case "response.reasoning_summary_text.delta":
+ return u.AsResponseReasoningSummaryTextDelta()
+ case "response.reasoning_summary_text.done":
+ return u.AsResponseReasoningSummaryTextDone()
+ case "response.reasoning_text.delta":
+ return u.AsResponseReasoningTextDelta()
+ case "response.reasoning_text.done":
+ return u.AsResponseReasoningTextDone()
+ case "response.refusal.delta":
+ return u.AsResponseRefusalDelta()
+ case "response.refusal.done":
+ return u.AsResponseRefusalDone()
+ case "response.output_text.delta":
+ return u.AsResponseOutputTextDelta()
+ case "response.output_text.done":
+ return u.AsResponseOutputTextDone()
+ case "response.web_search_call.completed":
+ return u.AsResponseWebSearchCallCompleted()
+ case "response.web_search_call.in_progress":
+ return u.AsResponseWebSearchCallInProgress()
+ case "response.web_search_call.searching":
+ return u.AsResponseWebSearchCallSearching()
+ case "response.image_generation_call.completed":
+ return u.AsResponseImageGenerationCallCompleted()
+ case "response.image_generation_call.generating":
+ return u.AsResponseImageGenerationCallGenerating()
+ case "response.image_generation_call.in_progress":
+ return u.AsResponseImageGenerationCallInProgress()
+ case "response.image_generation_call.partial_image":
+ return u.AsResponseImageGenerationCallPartialImage()
+ case "response.mcp_call_arguments.delta":
+ return u.AsResponseMcpCallArgumentsDelta()
+ case "response.mcp_call_arguments.done":
+ return u.AsResponseMcpCallArgumentsDone()
+ case "response.mcp_call.completed":
+ return u.AsResponseMcpCallCompleted()
+ case "response.mcp_call.failed":
+ return u.AsResponseMcpCallFailed()
+ case "response.mcp_call.in_progress":
+ return u.AsResponseMcpCallInProgress()
+ case "response.mcp_list_tools.completed":
+ return u.AsResponseMcpListToolsCompleted()
+ case "response.mcp_list_tools.failed":
+ return u.AsResponseMcpListToolsFailed()
+ case "response.mcp_list_tools.in_progress":
+ return u.AsResponseMcpListToolsInProgress()
+ case "response.output_text.annotation.added":
+ return u.AsResponseOutputTextAnnotationAdded()
+ case "response.queued":
+ return u.AsResponseQueued()
+ case "response.custom_tool_call_input.delta":
+ return u.AsResponseCustomToolCallInputDelta()
+ case "response.custom_tool_call_input.done":
+ return u.AsResponseCustomToolCallInputDone()
+ }
+ return nil
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseAudioDelta() (v BetaResponseAudioDeltaEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseAudioDone() (v BetaResponseAudioDoneEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseAudioTranscriptDelta() (v BetaResponseAudioTranscriptDeltaEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseAudioTranscriptDone() (v BetaResponseAudioTranscriptDoneEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseCodeInterpreterCallCodeDelta() (v BetaResponseCodeInterpreterCallCodeDeltaEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseCodeInterpreterCallCodeDone() (v BetaResponseCodeInterpreterCallCodeDoneEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseCodeInterpreterCallCompleted() (v BetaResponseCodeInterpreterCallCompletedEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseCodeInterpreterCallInProgress() (v BetaResponseCodeInterpreterCallInProgressEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseCodeInterpreterCallInterpreting() (v BetaResponseCodeInterpreterCallInterpretingEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseCompleted() (v BetaResponseCompletedEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseContentPartAdded() (v BetaResponseContentPartAddedEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseContentPartDone() (v BetaResponseContentPartDoneEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseCreated() (v BetaResponseCreatedEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsError() (v BetaResponseErrorEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseFileSearchCallCompleted() (v BetaResponseFileSearchCallCompletedEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseFileSearchCallInProgress() (v BetaResponseFileSearchCallInProgressEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseFileSearchCallSearching() (v BetaResponseFileSearchCallSearchingEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseFunctionCallArgumentsDelta() (v BetaResponseFunctionCallArgumentsDeltaEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseFunctionCallArgumentsDone() (v BetaResponseFunctionCallArgumentsDoneEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseInProgress() (v BetaResponseInProgressEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseFailed() (v BetaResponseFailedEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseIncomplete() (v BetaResponseIncompleteEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseOutputItemAdded() (v BetaResponseOutputItemAddedEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseOutputItemDone() (v BetaResponseOutputItemDoneEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseReasoningSummaryPartAdded() (v BetaResponseReasoningSummaryPartAddedEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseReasoningSummaryPartDone() (v BetaResponseReasoningSummaryPartDoneEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseReasoningSummaryTextDelta() (v BetaResponseReasoningSummaryTextDeltaEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseReasoningSummaryTextDone() (v BetaResponseReasoningSummaryTextDoneEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseReasoningTextDelta() (v BetaResponseReasoningTextDeltaEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseReasoningTextDone() (v BetaResponseReasoningTextDoneEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseRefusalDelta() (v BetaResponseRefusalDeltaEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseRefusalDone() (v BetaResponseRefusalDoneEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseOutputTextDelta() (v BetaResponseTextDeltaEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseOutputTextDone() (v BetaResponseTextDoneEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseWebSearchCallCompleted() (v BetaResponseWebSearchCallCompletedEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseWebSearchCallInProgress() (v BetaResponseWebSearchCallInProgressEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseWebSearchCallSearching() (v BetaResponseWebSearchCallSearchingEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseImageGenerationCallCompleted() (v BetaResponseImageGenCallCompletedEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseImageGenerationCallGenerating() (v BetaResponseImageGenCallGeneratingEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseImageGenerationCallInProgress() (v BetaResponseImageGenCallInProgressEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseImageGenerationCallPartialImage() (v BetaResponseImageGenCallPartialImageEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseMcpCallArgumentsDelta() (v BetaResponseMcpCallArgumentsDeltaEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseMcpCallArgumentsDone() (v BetaResponseMcpCallArgumentsDoneEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseMcpCallCompleted() (v BetaResponseMcpCallCompletedEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseMcpCallFailed() (v BetaResponseMcpCallFailedEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseMcpCallInProgress() (v BetaResponseMcpCallInProgressEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseMcpListToolsCompleted() (v BetaResponseMcpListToolsCompletedEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseMcpListToolsFailed() (v BetaResponseMcpListToolsFailedEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseMcpListToolsInProgress() (v BetaResponseMcpListToolsInProgressEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseOutputTextAnnotationAdded() (v BetaResponseOutputTextAnnotationAddedEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseQueued() (v BetaResponseQueuedEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseCustomToolCallInputDelta() (v BetaResponseCustomToolCallInputDeltaEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaResponseStreamEventUnion) AsResponseCustomToolCallInputDone() (v BetaResponseCustomToolCallInputDoneEvent) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaResponseStreamEventUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaResponseStreamEventUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseStreamEventUnionAgent is an implicit subunion of
+// [BetaResponseStreamEventUnion]. BetaResponseStreamEventUnionAgent provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseStreamEventUnion].
+type BetaResponseStreamEventUnionAgent struct {
+ AgentName string `json:"agent_name"`
+ JSON struct {
+ AgentName respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseStreamEventUnionAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseStreamEventUnionPart is an implicit subunion of
+// [BetaResponseStreamEventUnion]. BetaResponseStreamEventUnionPart provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseStreamEventUnion].
+type BetaResponseStreamEventUnionPart struct {
+ // This field is from variant [BetaResponseContentPartAddedEventPartUnion],
+ // [BetaResponseContentPartDoneEventPartUnion].
+ Annotations []BetaResponseOutputTextAnnotationUnion `json:"annotations"`
+ Text string `json:"text"`
+ Type string `json:"type"`
+ // This field is from variant [BetaResponseContentPartAddedEventPartUnion],
+ // [BetaResponseContentPartDoneEventPartUnion].
+ Logprobs []BetaResponseOutputTextLogprob `json:"logprobs"`
+ // This field is from variant [BetaResponseContentPartAddedEventPartUnion],
+ // [BetaResponseContentPartDoneEventPartUnion].
+ Refusal string `json:"refusal"`
+ JSON struct {
+ Annotations respjson.Field
+ Text respjson.Field
+ Type respjson.Field
+ Logprobs respjson.Field
+ Refusal respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseStreamEventUnionPart) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaResponseStreamEventUnionLogprobs is an implicit subunion of
+// [BetaResponseStreamEventUnion]. BetaResponseStreamEventUnionLogprobs provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaResponseStreamEventUnion].
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfBetaResponseTextDeltaEventLogprobs
+// OfBetaResponseTextDoneEventLogprobs]
+type BetaResponseStreamEventUnionLogprobs struct {
+ // This field will be present if the value is a
+ // [[]BetaResponseTextDeltaEventLogprob] instead of an object.
+ OfBetaResponseTextDeltaEventLogprobs []BetaResponseTextDeltaEventLogprob `json:",inline"`
+ // This field will be present if the value is a
+ // [[]BetaResponseTextDoneEventLogprob] instead of an object.
+ OfBetaResponseTextDoneEventLogprobs []BetaResponseTextDoneEventLogprob `json:",inline"`
+ JSON struct {
+ OfBetaResponseTextDeltaEventLogprobs respjson.Field
+ OfBetaResponseTextDoneEventLogprobs respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaResponseStreamEventUnionLogprobs) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Configuration options for a text response from the model. Can be plain text or
+// structured JSON data. Learn more:
+//
+// - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
+// - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
+type BetaResponseTextConfig struct {
+ // An object specifying the format that the model must output.
+ //
+ // Configuring `{ "type": "json_schema" }` enables Structured Outputs, which
+ // ensures the model will match your supplied JSON schema. Learn more in the
+ // [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
+ //
+ // The default format is `{ "type": "text" }` with no additional options.
+ //
+ // **Not recommended for gpt-4o and newer models:**
+ //
+ // Setting to `{ "type": "json_object" }` enables the older JSON mode, which
+ // ensures the message the model generates is valid JSON. Using `json_schema` is
+ // preferred for models that support it.
+ Format BetaResponseFormatTextConfigUnion `json:"format"`
+ // Constrains the verbosity of the model's response. Lower values will result in
+ // more concise responses, while higher values will result in more verbose
+ // responses. Currently supported values are `low`, `medium`, and `high`. The
+ // default is `medium`.
+ //
+ // Any of "low", "medium", "high".
+ Verbosity BetaResponseTextConfigVerbosity `json:"verbosity" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Format respjson.Field
+ Verbosity respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseTextConfig) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseTextConfig) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseTextConfig to a BetaResponseTextConfigParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseTextConfigParam.Overrides()
+func (r BetaResponseTextConfig) ToParam() BetaResponseTextConfigParam {
+ return param.Override[BetaResponseTextConfigParam](json.RawMessage(r.RawJSON()))
+}
+
+// Constrains the verbosity of the model's response. Lower values will result in
+// more concise responses, while higher values will result in more verbose
+// responses. Currently supported values are `low`, `medium`, and `high`. The
+// default is `medium`.
+type BetaResponseTextConfigVerbosity string
+
+const (
+ BetaResponseTextConfigVerbosityLow BetaResponseTextConfigVerbosity = "low"
+ BetaResponseTextConfigVerbosityMedium BetaResponseTextConfigVerbosity = "medium"
+ BetaResponseTextConfigVerbosityHigh BetaResponseTextConfigVerbosity = "high"
+)
+
+// Configuration options for a text response from the model. Can be plain text or
+// structured JSON data. Learn more:
+//
+// - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
+// - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
+type BetaResponseTextConfigParam struct {
+ // Constrains the verbosity of the model's response. Lower values will result in
+ // more concise responses, while higher values will result in more verbose
+ // responses. Currently supported values are `low`, `medium`, and `high`. The
+ // default is `medium`.
+ //
+ // Any of "low", "medium", "high".
+ Verbosity BetaResponseTextConfigVerbosity `json:"verbosity,omitzero"`
+ // An object specifying the format that the model must output.
+ //
+ // Configuring `{ "type": "json_schema" }` enables Structured Outputs, which
+ // ensures the model will match your supplied JSON schema. Learn more in the
+ // [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
+ //
+ // The default format is `{ "type": "text" }` with no additional options.
+ //
+ // **Not recommended for gpt-4o and newer models:**
+ //
+ // Setting to `{ "type": "json_object" }` enables the older JSON mode, which
+ // ensures the message the model generates is valid JSON. Using `json_schema` is
+ // preferred for models that support it.
+ Format BetaResponseFormatTextConfigUnionParam `json:"format,omitzero"`
+ paramObj
+}
+
+func (r BetaResponseTextConfigParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseTextConfigParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseTextConfigParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when there is an additional text delta.
+type BetaResponseTextDeltaEvent struct {
+ // The index of the content part that the text delta was added to.
+ ContentIndex int64 `json:"content_index" api:"required"`
+ // The text delta that was added.
+ Delta string `json:"delta" api:"required"`
+ // The ID of the output item that the text delta was added to.
+ ItemID string `json:"item_id" api:"required"`
+ // The log probabilities of the tokens in the delta.
+ Logprobs []BetaResponseTextDeltaEventLogprob `json:"logprobs" api:"required"`
+ // The index of the output item that the text delta was added to.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number for this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.output_text.delta`.
+ Type constant.ResponseOutputTextDelta `json:"type" default:"response.output_text.delta"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseTextDeltaEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ContentIndex respjson.Field
+ Delta respjson.Field
+ ItemID respjson.Field
+ Logprobs respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseTextDeltaEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseTextDeltaEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A logprob is the logarithmic probability that the model assigns to producing a
+// particular token at a given position in the sequence. Less-negative (higher)
+// logprob values indicate greater model confidence in that token choice.
+type BetaResponseTextDeltaEventLogprob struct {
+ // A possible text token.
+ Token string `json:"token" api:"required"`
+ // The log probability of this token.
+ Logprob float64 `json:"logprob" api:"required"`
+ // The log probabilities of up to 20 of the most likely tokens.
+ TopLogprobs []BetaResponseTextDeltaEventLogprobTopLogprob `json:"top_logprobs"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Token respjson.Field
+ Logprob respjson.Field
+ TopLogprobs respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseTextDeltaEventLogprob) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseTextDeltaEventLogprob) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseTextDeltaEventLogprobTopLogprob struct {
+ // A possible text token.
+ Token string `json:"token"`
+ // The log probability of this token.
+ Logprob float64 `json:"logprob"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Token respjson.Field
+ Logprob respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseTextDeltaEventLogprobTopLogprob) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseTextDeltaEventLogprobTopLogprob) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseTextDeltaEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseTextDeltaEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseTextDeltaEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when text content is finalized.
+type BetaResponseTextDoneEvent struct {
+ // The index of the content part that the text content is finalized.
+ ContentIndex int64 `json:"content_index" api:"required"`
+ // The ID of the output item that the text content is finalized.
+ ItemID string `json:"item_id" api:"required"`
+ // The log probabilities of the tokens in the delta.
+ Logprobs []BetaResponseTextDoneEventLogprob `json:"logprobs" api:"required"`
+ // The index of the output item that the text content is finalized.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number for this event.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The text content that is finalized.
+ Text string `json:"text" api:"required"`
+ // The type of the event. Always `response.output_text.done`.
+ Type constant.ResponseOutputTextDone `json:"type" default:"response.output_text.done"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseTextDoneEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ContentIndex respjson.Field
+ ItemID respjson.Field
+ Logprobs respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Text respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseTextDoneEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseTextDoneEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A logprob is the logarithmic probability that the model assigns to producing a
+// particular token at a given position in the sequence. Less-negative (higher)
+// logprob values indicate greater model confidence in that token choice.
+type BetaResponseTextDoneEventLogprob struct {
+ // A possible text token.
+ Token string `json:"token" api:"required"`
+ // The log probability of this token.
+ Logprob float64 `json:"logprob" api:"required"`
+ // The log probabilities of up to 20 of the most likely tokens.
+ TopLogprobs []BetaResponseTextDoneEventLogprobTopLogprob `json:"top_logprobs"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Token respjson.Field
+ Logprob respjson.Field
+ TopLogprobs respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseTextDoneEventLogprob) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseTextDoneEventLogprob) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseTextDoneEventLogprobTopLogprob struct {
+ // A possible text token.
+ Token string `json:"token"`
+ // The log probability of this token.
+ Logprob float64 `json:"logprob"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Token respjson.Field
+ Logprob respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseTextDoneEventLogprobTopLogprob) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseTextDoneEventLogprobTopLogprob) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseTextDoneEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseTextDoneEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseTextDoneEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseToolSearchCall struct {
+ // The unique ID of the tool search call item.
+ ID string `json:"id" api:"required"`
+ // Arguments used for the tool search call.
+ Arguments any `json:"arguments" api:"required"`
+ // The unique ID of the tool search call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // Whether tool search was executed by the server or by the client.
+ //
+ // Any of "server", "client".
+ Execution BetaResponseToolSearchCallExecution `json:"execution" api:"required"`
+ // The status of the tool search call item that was recorded.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status BetaResponseToolSearchCallStatus `json:"status" api:"required"`
+ // The type of the item. Always `tool_search_call`.
+ Type constant.ToolSearchCall `json:"type" default:"tool_search_call"`
+ // The agent that produced this item.
+ Agent BetaResponseToolSearchCallAgent `json:"agent"`
+ // The identifier of the actor that created the item.
+ CreatedBy string `json:"created_by"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Arguments respjson.Field
+ CallID respjson.Field
+ Execution respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ CreatedBy respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseToolSearchCall) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseToolSearchCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Whether tool search was executed by the server or by the client.
+type BetaResponseToolSearchCallExecution string
+
+const (
+ BetaResponseToolSearchCallExecutionServer BetaResponseToolSearchCallExecution = "server"
+ BetaResponseToolSearchCallExecutionClient BetaResponseToolSearchCallExecution = "client"
+)
+
+// The status of the tool search call item that was recorded.
+type BetaResponseToolSearchCallStatus string
+
+const (
+ BetaResponseToolSearchCallStatusInProgress BetaResponseToolSearchCallStatus = "in_progress"
+ BetaResponseToolSearchCallStatusCompleted BetaResponseToolSearchCallStatus = "completed"
+ BetaResponseToolSearchCallStatusIncomplete BetaResponseToolSearchCallStatus = "incomplete"
+)
+
+// The agent that produced this item.
+type BetaResponseToolSearchCallAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseToolSearchCallAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseToolSearchCallAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseToolSearchOutputItem struct {
+ // The unique ID of the tool search output item.
+ ID string `json:"id" api:"required"`
+ // The unique ID of the tool search call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // Whether tool search was executed by the server or by the client.
+ //
+ // Any of "server", "client".
+ Execution BetaResponseToolSearchOutputItemExecution `json:"execution" api:"required"`
+ // The status of the tool search output item that was recorded.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status BetaResponseToolSearchOutputItemStatus `json:"status" api:"required"`
+ // The loaded tool definitions returned by tool search.
+ Tools []BetaToolUnion `json:"tools" api:"required"`
+ // The type of the item. Always `tool_search_output`.
+ Type constant.ToolSearchOutput `json:"type" default:"tool_search_output"`
+ // The agent that produced this item.
+ Agent BetaResponseToolSearchOutputItemAgent `json:"agent"`
+ // The identifier of the actor that created the item.
+ CreatedBy string `json:"created_by"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Execution respjson.Field
+ Status respjson.Field
+ Tools respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ CreatedBy respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseToolSearchOutputItem) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseToolSearchOutputItem) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Whether tool search was executed by the server or by the client.
+type BetaResponseToolSearchOutputItemExecution string
+
+const (
+ BetaResponseToolSearchOutputItemExecutionServer BetaResponseToolSearchOutputItemExecution = "server"
+ BetaResponseToolSearchOutputItemExecutionClient BetaResponseToolSearchOutputItemExecution = "client"
+)
+
+// The status of the tool search output item that was recorded.
+type BetaResponseToolSearchOutputItemStatus string
+
+const (
+ BetaResponseToolSearchOutputItemStatusInProgress BetaResponseToolSearchOutputItemStatus = "in_progress"
+ BetaResponseToolSearchOutputItemStatusCompleted BetaResponseToolSearchOutputItemStatus = "completed"
+ BetaResponseToolSearchOutputItemStatusIncomplete BetaResponseToolSearchOutputItemStatus = "incomplete"
+)
+
+// The agent that produced this item.
+type BetaResponseToolSearchOutputItemAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseToolSearchOutputItemAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseToolSearchOutputItemAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseToolSearchOutputItemParamResp struct {
+ // The loaded tool definitions returned by the tool search output.
+ Tools []BetaToolUnion `json:"tools" api:"required"`
+ // The item type. Always `tool_search_output`.
+ Type constant.ToolSearchOutput `json:"type" default:"tool_search_output"`
+ // The unique ID of this tool search output.
+ ID string `json:"id" api:"nullable"`
+ // The agent that produced this item.
+ Agent BetaResponseToolSearchOutputItemParamAgentResp `json:"agent" api:"nullable"`
+ // The unique ID of the tool search call generated by the model.
+ CallID string `json:"call_id" api:"nullable"`
+ // Whether tool search was executed by the server or by the client.
+ //
+ // Any of "server", "client".
+ Execution BetaResponseToolSearchOutputItemParamExecution `json:"execution"`
+ // The status of the tool search output.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status BetaResponseToolSearchOutputItemParamStatus `json:"status" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Tools respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Agent respjson.Field
+ CallID respjson.Field
+ Execution respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseToolSearchOutputItemParamResp) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseToolSearchOutputItemParamResp) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaResponseToolSearchOutputItemParamResp to a
+// BetaResponseToolSearchOutputItemParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaResponseToolSearchOutputItemParam.Overrides()
+func (r BetaResponseToolSearchOutputItemParamResp) ToParam() BetaResponseToolSearchOutputItemParam {
+ return param.Override[BetaResponseToolSearchOutputItemParam](json.RawMessage(r.RawJSON()))
+}
+
+// The agent that produced this item.
+type BetaResponseToolSearchOutputItemParamAgentResp struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseToolSearchOutputItemParamAgentResp) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseToolSearchOutputItemParamAgentResp) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Whether tool search was executed by the server or by the client.
+type BetaResponseToolSearchOutputItemParamExecution string
+
+const (
+ BetaResponseToolSearchOutputItemParamExecutionServer BetaResponseToolSearchOutputItemParamExecution = "server"
+ BetaResponseToolSearchOutputItemParamExecutionClient BetaResponseToolSearchOutputItemParamExecution = "client"
+)
+
+// The status of the tool search output.
+type BetaResponseToolSearchOutputItemParamStatus string
+
+const (
+ BetaResponseToolSearchOutputItemParamStatusInProgress BetaResponseToolSearchOutputItemParamStatus = "in_progress"
+ BetaResponseToolSearchOutputItemParamStatusCompleted BetaResponseToolSearchOutputItemParamStatus = "completed"
+ BetaResponseToolSearchOutputItemParamStatusIncomplete BetaResponseToolSearchOutputItemParamStatus = "incomplete"
+)
+
+// The properties Tools, Type are required.
+type BetaResponseToolSearchOutputItemParam struct {
+ // The loaded tool definitions returned by the tool search output.
+ Tools []BetaToolUnionParam `json:"tools,omitzero" api:"required"`
+ // The unique ID of this tool search output.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // The unique ID of the tool search call generated by the model.
+ CallID param.Opt[string] `json:"call_id,omitzero"`
+ // The agent that produced this item.
+ Agent BetaResponseToolSearchOutputItemParamAgent `json:"agent,omitzero"`
+ // The status of the tool search output.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status BetaResponseToolSearchOutputItemParamStatus `json:"status,omitzero"`
+ // Whether tool search was executed by the server or by the client.
+ //
+ // Any of "server", "client".
+ Execution BetaResponseToolSearchOutputItemParamExecution `json:"execution,omitzero"`
+ // The item type. Always `tool_search_output`.
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "tool_search_output".
+ Type constant.ToolSearchOutput `json:"type" default:"tool_search_output"`
+ paramObj
+}
+
+func (r BetaResponseToolSearchOutputItemParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseToolSearchOutputItemParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseToolSearchOutputItemParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that produced this item.
+//
+// The property AgentName is required.
+type BetaResponseToolSearchOutputItemParamAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseToolSearchOutputItemParamAgent) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseToolSearchOutputItemParamAgent
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseToolSearchOutputItemParamAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Represents token usage details including input tokens, output tokens, a
+// breakdown of output tokens, and the total tokens used.
+type BetaResponseUsage struct {
+ // The number of input tokens.
+ InputTokens int64 `json:"input_tokens" api:"required"`
+ // A detailed breakdown of the input tokens.
+ InputTokensDetails BetaResponseUsageInputTokensDetails `json:"input_tokens_details" api:"required"`
+ // The number of output tokens.
+ OutputTokens int64 `json:"output_tokens" api:"required"`
+ // A detailed breakdown of the output tokens.
+ OutputTokensDetails BetaResponseUsageOutputTokensDetails `json:"output_tokens_details" api:"required"`
+ // The total number of tokens used.
+ TotalTokens int64 `json:"total_tokens" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ InputTokens respjson.Field
+ InputTokensDetails respjson.Field
+ OutputTokens respjson.Field
+ OutputTokensDetails respjson.Field
+ TotalTokens respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseUsage) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseUsage) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A detailed breakdown of the input tokens.
+type BetaResponseUsageInputTokensDetails struct {
+ // The number of input tokens that were written to the cache.
+ CacheWriteTokens int64 `json:"cache_write_tokens" api:"required"`
+ // The number of tokens that were retrieved from the cache.
+ // [More on prompt caching](https://platform.openai.com/docs/guides/prompt-caching).
+ CachedTokens int64 `json:"cached_tokens" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CacheWriteTokens respjson.Field
+ CachedTokens respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseUsageInputTokensDetails) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseUsageInputTokensDetails) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A detailed breakdown of the output tokens.
+type BetaResponseUsageOutputTokensDetails struct {
+ // The number of reasoning tokens.
+ ReasoningTokens int64 `json:"reasoning_tokens" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ReasoningTokens respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseUsageOutputTokensDetails) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseUsageOutputTokensDetails) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when a web search call is completed.
+type BetaResponseWebSearchCallCompletedEvent struct {
+ // Unique ID for the output item associated with the web search call.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item that the web search call is associated with.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of the web search call being processed.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.web_search_call.completed`.
+ Type constant.ResponseWebSearchCallCompleted `json:"type" default:"response.web_search_call.completed"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseWebSearchCallCompletedEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseWebSearchCallCompletedEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseWebSearchCallCompletedEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseWebSearchCallCompletedEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseWebSearchCallCompletedEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseWebSearchCallCompletedEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when a web search call is initiated.
+type BetaResponseWebSearchCallInProgressEvent struct {
+ // Unique ID for the output item associated with the web search call.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item that the web search call is associated with.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of the web search call being processed.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.web_search_call.in_progress`.
+ Type constant.ResponseWebSearchCallInProgress `json:"type" default:"response.web_search_call.in_progress"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseWebSearchCallInProgressEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseWebSearchCallInProgressEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseWebSearchCallInProgressEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseWebSearchCallInProgressEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseWebSearchCallInProgressEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseWebSearchCallInProgressEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Emitted when a web search call is executing.
+type BetaResponseWebSearchCallSearchingEvent struct {
+ // Unique ID for the output item associated with the web search call.
+ ItemID string `json:"item_id" api:"required"`
+ // The index of the output item that the web search call is associated with.
+ OutputIndex int64 `json:"output_index" api:"required"`
+ // The sequence number of the web search call being processed.
+ SequenceNumber int64 `json:"sequence_number" api:"required"`
+ // The type of the event. Always `response.web_search_call.searching`.
+ Type constant.ResponseWebSearchCallSearching `json:"type" default:"response.web_search_call.searching"`
+ // The agent that owns this multi-agent streaming event.
+ Agent BetaResponseWebSearchCallSearchingEventAgent `json:"agent" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ItemID respjson.Field
+ OutputIndex respjson.Field
+ SequenceNumber respjson.Field
+ Type respjson.Field
+ Agent respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseWebSearchCallSearchingEvent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseWebSearchCallSearchingEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The agent that owns this multi-agent streaming event.
+type BetaResponseWebSearchCallSearchingEventAgent struct {
+ // The canonical name of the agent that produced this item.
+ AgentName string `json:"agent_name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseWebSearchCallSearchingEventAgent) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseWebSearchCallSearchingEventAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaSkillReference struct {
+ // The ID of the referenced skill.
+ SkillID string `json:"skill_id" api:"required"`
+ // References a skill created with the /v1/skills endpoint.
+ Type constant.SkillReference `json:"type" default:"skill_reference"`
+ // Optional skill version. Use a positive integer or 'latest'. Omit for default.
+ Version string `json:"version"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ SkillID respjson.Field
+ Type respjson.Field
+ Version respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaSkillReference) RawJSON() string { return r.JSON.raw }
+func (r *BetaSkillReference) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaSkillReference to a BetaSkillReferenceParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaSkillReferenceParam.Overrides()
+func (r BetaSkillReference) ToParam() BetaSkillReferenceParam {
+ return param.Override[BetaSkillReferenceParam](json.RawMessage(r.RawJSON()))
+}
+
+// The properties SkillID, Type are required.
+type BetaSkillReferenceParam struct {
+ // The ID of the referenced skill.
+ SkillID string `json:"skill_id" api:"required"`
+ // Optional skill version. Use a positive integer or 'latest'. Omit for default.
+ Version param.Opt[string] `json:"version,omitzero"`
+ // References a skill created with the /v1/skills endpoint.
+ //
+ // This field can be elided, and will marshal its zero value as "skill_reference".
+ Type constant.SkillReference `json:"type" default:"skill_reference"`
+ paramObj
+}
+
+func (r BetaSkillReferenceParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaSkillReferenceParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaSkillReferenceParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaToolUnion contains all possible properties and values from
+// [BetaFunctionTool], [BetaFileSearchTool], [BetaComputerTool],
+// [BetaComputerUsePreviewTool], [BetaWebSearchTool], [BetaToolMcp],
+// [BetaToolCodeInterpreter], [BetaToolProgrammaticToolCalling],
+// [BetaToolImageGeneration], [BetaToolLocalShell], [BetaFunctionShellTool],
+// [BetaCustomTool], [BetaNamespaceTool], [BetaToolSearchTool],
+// [BetaWebSearchPreviewTool], [BetaApplyPatchTool].
+//
+// Use the [BetaToolUnion.AsAny] method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaToolUnion struct {
+ Name string `json:"name"`
+ Parameters any `json:"parameters"`
+ // This field is from variant [BetaFunctionTool].
+ Strict bool `json:"strict"`
+ // Any of "function", "file_search", "computer", "computer_use_preview", nil,
+ // "mcp", "code_interpreter", "programmatic_tool_calling", "image_generation",
+ // "local_shell", "shell", "custom", "namespace", "tool_search", nil,
+ // "apply_patch".
+ Type string `json:"type"`
+ AllowedCallers []string `json:"allowed_callers"`
+ DeferLoading bool `json:"defer_loading"`
+ Description string `json:"description"`
+ // This field is from variant [BetaFunctionTool].
+ OutputSchema map[string]any `json:"output_schema"`
+ // This field is from variant [BetaFileSearchTool].
+ VectorStoreIDs []string `json:"vector_store_ids"`
+ // This field is a union of [BetaFileSearchToolFiltersUnion],
+ // [BetaWebSearchToolFilters]
+ Filters BetaToolUnionFilters `json:"filters"`
+ // This field is from variant [BetaFileSearchTool].
+ MaxNumResults int64 `json:"max_num_results"`
+ // This field is from variant [BetaFileSearchTool].
+ RankingOptions BetaFileSearchToolRankingOptions `json:"ranking_options"`
+ // This field is from variant [BetaComputerUsePreviewTool].
+ DisplayHeight int64 `json:"display_height"`
+ // This field is from variant [BetaComputerUsePreviewTool].
+ DisplayWidth int64 `json:"display_width"`
+ // This field is a union of [BetaComputerUsePreviewToolEnvironment],
+ // [BetaFunctionShellToolEnvironmentUnion]
+ Environment BetaToolUnionEnvironment `json:"environment"`
+ SearchContextSize string `json:"search_context_size"`
+ // This field is a union of [BetaWebSearchToolUserLocation],
+ // [BetaWebSearchPreviewToolUserLocation]
+ UserLocation BetaToolUnionUserLocation `json:"user_location"`
+ // This field is from variant [BetaToolMcp].
+ ServerLabel string `json:"server_label"`
+ // This field is from variant [BetaToolMcp].
+ AllowedTools BetaToolMcpAllowedToolsUnion `json:"allowed_tools"`
+ // This field is from variant [BetaToolMcp].
+ Authorization string `json:"authorization"`
+ // This field is from variant [BetaToolMcp].
+ ConnectorID string `json:"connector_id"`
+ // This field is from variant [BetaToolMcp].
+ Headers map[string]string `json:"headers"`
+ // This field is from variant [BetaToolMcp].
+ RequireApproval BetaToolMcpRequireApprovalUnion `json:"require_approval"`
+ // This field is from variant [BetaToolMcp].
+ ServerDescription string `json:"server_description"`
+ // This field is from variant [BetaToolMcp].
+ ServerURL string `json:"server_url"`
+ // This field is from variant [BetaToolMcp].
+ TunnelID string `json:"tunnel_id"`
+ // This field is from variant [BetaToolCodeInterpreter].
+ Container BetaToolCodeInterpreterContainerUnion `json:"container"`
+ // This field is from variant [BetaToolImageGeneration].
+ Action string `json:"action"`
+ // This field is from variant [BetaToolImageGeneration].
+ Background string `json:"background"`
+ // This field is from variant [BetaToolImageGeneration].
+ InputFidelity string `json:"input_fidelity"`
+ // This field is from variant [BetaToolImageGeneration].
+ InputImageMask BetaToolImageGenerationInputImageMask `json:"input_image_mask"`
+ // This field is from variant [BetaToolImageGeneration].
+ Model string `json:"model"`
+ // This field is from variant [BetaToolImageGeneration].
+ Moderation string `json:"moderation"`
+ // This field is from variant [BetaToolImageGeneration].
+ OutputCompression int64 `json:"output_compression"`
+ // This field is from variant [BetaToolImageGeneration].
+ OutputFormat string `json:"output_format"`
+ // This field is from variant [BetaToolImageGeneration].
+ PartialImages int64 `json:"partial_images"`
+ // This field is from variant [BetaToolImageGeneration].
+ Quality string `json:"quality"`
+ // This field is from variant [BetaToolImageGeneration].
+ Size string `json:"size"`
+ // This field is from variant [BetaCustomTool].
+ Format BetaCustomToolFormatUnion `json:"format"`
+ // This field is from variant [BetaNamespaceTool].
+ Tools []BetaNamespaceToolToolUnion `json:"tools"`
+ // This field is from variant [BetaToolSearchTool].
+ Execution BetaToolSearchToolExecution `json:"execution"`
+ // This field is from variant [BetaWebSearchPreviewTool].
+ SearchContentTypes []string `json:"search_content_types"`
+ JSON struct {
+ Name respjson.Field
+ Parameters respjson.Field
+ Strict respjson.Field
+ Type respjson.Field
+ AllowedCallers respjson.Field
+ DeferLoading respjson.Field
+ Description respjson.Field
+ OutputSchema respjson.Field
+ VectorStoreIDs respjson.Field
+ Filters respjson.Field
+ MaxNumResults respjson.Field
+ RankingOptions respjson.Field
+ DisplayHeight respjson.Field
+ DisplayWidth respjson.Field
+ Environment respjson.Field
+ SearchContextSize respjson.Field
+ UserLocation respjson.Field
+ ServerLabel respjson.Field
+ AllowedTools respjson.Field
+ Authorization respjson.Field
+ ConnectorID respjson.Field
+ Headers respjson.Field
+ RequireApproval respjson.Field
+ ServerDescription respjson.Field
+ ServerURL respjson.Field
+ TunnelID respjson.Field
+ Container respjson.Field
+ Action respjson.Field
+ Background respjson.Field
+ InputFidelity respjson.Field
+ InputImageMask respjson.Field
+ Model respjson.Field
+ Moderation respjson.Field
+ OutputCompression respjson.Field
+ OutputFormat respjson.Field
+ PartialImages respjson.Field
+ Quality respjson.Field
+ Size respjson.Field
+ Format respjson.Field
+ Tools respjson.Field
+ Execution respjson.Field
+ SearchContentTypes respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u BetaToolUnion) AsFunction() (v BetaFunctionTool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaToolUnion) AsFileSearch() (v BetaFileSearchTool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaToolUnion) AsComputer() (v BetaComputerTool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaToolUnion) AsComputerUsePreview() (v BetaComputerUsePreviewTool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaToolUnion) AsWebSearch() (v BetaWebSearchTool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaToolUnion) AsMcp() (v BetaToolMcp) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaToolUnion) AsCodeInterpreter() (v BetaToolCodeInterpreter) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaToolUnion) AsProgrammaticToolCalling() (v BetaToolProgrammaticToolCalling) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaToolUnion) AsImageGeneration() (v BetaToolImageGeneration) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaToolUnion) AsLocalShell() (v BetaToolLocalShell) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaToolUnion) AsShell() (v BetaFunctionShellTool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaToolUnion) AsCustom() (v BetaCustomTool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaToolUnion) AsNamespace() (v BetaNamespaceTool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaToolUnion) AsToolSearch() (v BetaToolSearchTool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaToolUnion) AsWebSearchPreview() (v BetaWebSearchPreviewTool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaToolUnion) AsApplyPatch() (v BetaApplyPatchTool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaToolUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaToolUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaToolUnionFilters is an implicit subunion of [BetaToolUnion].
+// BetaToolUnionFilters provides convenient access to the sub-properties of the
+// union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaToolUnion].
+type BetaToolUnionFilters struct {
+ // This field is from variant [BetaFileSearchToolFiltersUnion].
+ Key string `json:"key"`
+ Type string `json:"type"`
+ // This field is from variant [BetaFileSearchToolFiltersUnion].
+ Value BetaFileSearchToolFiltersComparisonFilterValueUnion `json:"value"`
+ // This field is from variant [BetaFileSearchToolFiltersUnion].
+ Filters []BetaFileSearchToolFiltersCompoundFilterFilter `json:"filters"`
+ // This field is from variant [BetaWebSearchToolFilters].
+ AllowedDomains []string `json:"allowed_domains"`
+ JSON struct {
+ Key respjson.Field
+ Type respjson.Field
+ Value respjson.Field
+ Filters respjson.Field
+ AllowedDomains respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaToolUnionFilters) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaToolUnionEnvironment is an implicit subunion of [BetaToolUnion].
+// BetaToolUnionEnvironment provides convenient access to the sub-properties of the
+// union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaToolUnion].
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfBetaComputerUsePreviewToolEnvironment]
+type BetaToolUnionEnvironment struct {
+ // This field will be present if the value is a
+ // [BetaComputerUsePreviewToolEnvironment] instead of an object.
+ OfBetaComputerUsePreviewToolEnvironment BetaComputerUsePreviewToolEnvironment `json:",inline"`
+ Type string `json:"type"`
+ // This field is from variant [BetaFunctionShellToolEnvironmentUnion].
+ FileIDs []string `json:"file_ids"`
+ // This field is from variant [BetaFunctionShellToolEnvironmentUnion].
+ MemoryLimit BetaContainerAutoMemoryLimit `json:"memory_limit"`
+ // This field is from variant [BetaFunctionShellToolEnvironmentUnion].
+ NetworkPolicy BetaContainerAutoNetworkPolicyUnion `json:"network_policy"`
+ // This field is a union of [[]BetaContainerAutoSkillUnion], [[]BetaLocalSkill]
+ Skills BetaToolUnionEnvironmentSkills `json:"skills"`
+ // This field is from variant [BetaFunctionShellToolEnvironmentUnion].
+ ContainerID string `json:"container_id"`
+ JSON struct {
+ OfBetaComputerUsePreviewToolEnvironment respjson.Field
+ Type respjson.Field
+ FileIDs respjson.Field
+ MemoryLimit respjson.Field
+ NetworkPolicy respjson.Field
+ Skills respjson.Field
+ ContainerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaToolUnionEnvironment) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaToolUnionEnvironmentSkills is an implicit subunion of [BetaToolUnion].
+// BetaToolUnionEnvironmentSkills provides convenient access to the sub-properties
+// of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaToolUnion].
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfBetaContainerAutoSkills OfBetaLocalSkillArray]
+type BetaToolUnionEnvironmentSkills struct {
+ // This field will be present if the value is a [[]BetaContainerAutoSkillUnion]
+ // instead of an object.
+ OfBetaContainerAutoSkills []BetaContainerAutoSkillUnion `json:",inline"`
+ // This field will be present if the value is a [[]BetaLocalSkill] instead of an
+ // object.
+ OfBetaLocalSkillArray []BetaLocalSkill `json:",inline"`
+ JSON struct {
+ OfBetaContainerAutoSkills respjson.Field
+ OfBetaLocalSkillArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaToolUnionEnvironmentSkills) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaToolUnionUserLocation is an implicit subunion of [BetaToolUnion].
+// BetaToolUnionUserLocation provides convenient access to the sub-properties of
+// the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [BetaToolUnion].
+type BetaToolUnionUserLocation struct {
+ City string `json:"city"`
+ Country string `json:"country"`
+ Region string `json:"region"`
+ Timezone string `json:"timezone"`
+ Type string `json:"type"`
+ JSON struct {
+ City respjson.Field
+ Country respjson.Field
+ Region respjson.Field
+ Timezone respjson.Field
+ Type respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *BetaToolUnionUserLocation) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaToolUnion to a BetaToolUnionParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaToolUnionParam.Overrides()
+func (r BetaToolUnion) ToParam() BetaToolUnionParam {
+ return param.Override[BetaToolUnionParam](json.RawMessage(r.RawJSON()))
+}
+
+// Give the model access to additional tools via remote Model Context Protocol
+// (MCP) servers.
+// [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).
+type BetaToolMcp struct {
+ // A label for this MCP server, used to identify it in tool calls.
+ ServerLabel string `json:"server_label" api:"required"`
+ // The type of the MCP tool. Always `mcp`.
+ Type constant.Mcp `json:"type" default:"mcp"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers" api:"nullable"`
+ // List of allowed tool names or a filter object.
+ AllowedTools BetaToolMcpAllowedToolsUnion `json:"allowed_tools" api:"nullable"`
+ // An OAuth access token that can be used with a remote MCP server, either with a
+ // custom MCP server URL or a service connector. Your application must handle the
+ // OAuth authorization flow and provide the token here.
+ Authorization string `json:"authorization"`
+ // Identifier for service connectors, like those available in ChatGPT. One of
+ // `server_url`, `connector_id`, or `tunnel_id` must be provided. Learn more about
+ // service connectors
+ // [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
+ //
+ // Currently supported `connector_id` values are:
+ //
+ // - Dropbox: `connector_dropbox`
+ // - Gmail: `connector_gmail`
+ // - Google Calendar: `connector_googlecalendar`
+ // - Google Drive: `connector_googledrive`
+ // - Microsoft Teams: `connector_microsoftteams`
+ // - Outlook Calendar: `connector_outlookcalendar`
+ // - Outlook Email: `connector_outlookemail`
+ // - SharePoint: `connector_sharepoint`
+ //
+ // Any of "connector_dropbox", "connector_gmail", "connector_googlecalendar",
+ // "connector_googledrive", "connector_microsoftteams",
+ // "connector_outlookcalendar", "connector_outlookemail", "connector_sharepoint".
+ ConnectorID string `json:"connector_id"`
+ // Whether this MCP tool is deferred and discovered via tool search.
+ DeferLoading bool `json:"defer_loading"`
+ // Optional HTTP headers to send to the MCP server. Use for authentication or other
+ // purposes.
+ Headers map[string]string `json:"headers" api:"nullable"`
+ // Specify which of the MCP server's tools require approval.
+ RequireApproval BetaToolMcpRequireApprovalUnion `json:"require_approval" api:"nullable"`
+ // Optional description of the MCP server, used to provide more context.
+ ServerDescription string `json:"server_description"`
+ // The URL for the MCP server. One of `server_url`, `connector_id`, or `tunnel_id`
+ // must be provided.
+ ServerURL string `json:"server_url" format:"uri"`
+ // The Secure MCP Tunnel ID to use instead of a direct server URL. One of
+ // `server_url`, `connector_id`, or `tunnel_id` must be provided.
+ TunnelID string `json:"tunnel_id"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ServerLabel respjson.Field
+ Type respjson.Field
+ AllowedCallers respjson.Field
+ AllowedTools respjson.Field
+ Authorization respjson.Field
+ ConnectorID respjson.Field
+ DeferLoading respjson.Field
+ Headers respjson.Field
+ RequireApproval respjson.Field
+ ServerDescription respjson.Field
+ ServerURL respjson.Field
+ TunnelID respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaToolMcp) RawJSON() string { return r.JSON.raw }
+func (r *BetaToolMcp) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaToolMcpAllowedToolsUnion contains all possible properties and values from
+// [[]string], [BetaToolMcpAllowedToolsMcpToolFilter].
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfMcpAllowedTools]
+type BetaToolMcpAllowedToolsUnion struct {
+ // This field will be present if the value is a [[]string] instead of an object.
+ OfMcpAllowedTools []string `json:",inline"`
+ // This field is from variant [BetaToolMcpAllowedToolsMcpToolFilter].
+ ReadOnly bool `json:"read_only"`
+ // This field is from variant [BetaToolMcpAllowedToolsMcpToolFilter].
+ ToolNames []string `json:"tool_names"`
+ JSON struct {
+ OfMcpAllowedTools respjson.Field
+ ReadOnly respjson.Field
+ ToolNames respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u BetaToolMcpAllowedToolsUnion) AsMcpAllowedTools() (v []string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaToolMcpAllowedToolsUnion) AsMcpToolFilter() (v BetaToolMcpAllowedToolsMcpToolFilter) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaToolMcpAllowedToolsUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaToolMcpAllowedToolsUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A filter object to specify which tools are allowed.
+type BetaToolMcpAllowedToolsMcpToolFilter struct {
+ // Indicates whether or not a tool modifies data or is read-only. If an MCP server
+ // is
+ // [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
+ // it will match this filter.
+ ReadOnly bool `json:"read_only"`
+ // List of allowed tool names.
+ ToolNames []string `json:"tool_names"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ReadOnly respjson.Field
+ ToolNames respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaToolMcpAllowedToolsMcpToolFilter) RawJSON() string { return r.JSON.raw }
+func (r *BetaToolMcpAllowedToolsMcpToolFilter) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaToolMcpRequireApprovalUnion contains all possible properties and values from
+// [BetaToolMcpRequireApprovalMcpToolApprovalFilter], [string].
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfMcpToolApprovalSetting]
+type BetaToolMcpRequireApprovalUnion struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfMcpToolApprovalSetting string `json:",inline"`
+ // This field is from variant [BetaToolMcpRequireApprovalMcpToolApprovalFilter].
+ Always BetaToolMcpRequireApprovalMcpToolApprovalFilterAlways `json:"always"`
+ // This field is from variant [BetaToolMcpRequireApprovalMcpToolApprovalFilter].
+ Never BetaToolMcpRequireApprovalMcpToolApprovalFilterNever `json:"never"`
+ JSON struct {
+ OfMcpToolApprovalSetting respjson.Field
+ Always respjson.Field
+ Never respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u BetaToolMcpRequireApprovalUnion) AsMcpToolApprovalFilter() (v BetaToolMcpRequireApprovalMcpToolApprovalFilter) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaToolMcpRequireApprovalUnion) AsMcpToolApprovalSetting() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaToolMcpRequireApprovalUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaToolMcpRequireApprovalUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Specify which of the MCP server's tools require approval. Can be `always`,
+// `never`, or a filter object associated with tools that require approval.
+type BetaToolMcpRequireApprovalMcpToolApprovalFilter struct {
+ // A filter object to specify which tools are allowed.
+ Always BetaToolMcpRequireApprovalMcpToolApprovalFilterAlways `json:"always"`
+ // A filter object to specify which tools are allowed.
+ Never BetaToolMcpRequireApprovalMcpToolApprovalFilterNever `json:"never"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Always respjson.Field
+ Never respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaToolMcpRequireApprovalMcpToolApprovalFilter) RawJSON() string { return r.JSON.raw }
+func (r *BetaToolMcpRequireApprovalMcpToolApprovalFilter) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A filter object to specify which tools are allowed.
+type BetaToolMcpRequireApprovalMcpToolApprovalFilterAlways struct {
+ // Indicates whether or not a tool modifies data or is read-only. If an MCP server
+ // is
+ // [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
+ // it will match this filter.
+ ReadOnly bool `json:"read_only"`
+ // List of allowed tool names.
+ ToolNames []string `json:"tool_names"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ReadOnly respjson.Field
+ ToolNames respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaToolMcpRequireApprovalMcpToolApprovalFilterAlways) RawJSON() string { return r.JSON.raw }
+func (r *BetaToolMcpRequireApprovalMcpToolApprovalFilterAlways) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A filter object to specify which tools are allowed.
+type BetaToolMcpRequireApprovalMcpToolApprovalFilterNever struct {
+ // Indicates whether or not a tool modifies data or is read-only. If an MCP server
+ // is
+ // [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
+ // it will match this filter.
+ ReadOnly bool `json:"read_only"`
+ // List of allowed tool names.
+ ToolNames []string `json:"tool_names"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ReadOnly respjson.Field
+ ToolNames respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaToolMcpRequireApprovalMcpToolApprovalFilterNever) RawJSON() string { return r.JSON.raw }
+func (r *BetaToolMcpRequireApprovalMcpToolApprovalFilterNever) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Specify a single approval policy for all tools. One of `always` or `never`. When
+// set to `always`, all tools will require approval. When set to `never`, all tools
+// will not require approval.
+type BetaToolMcpRequireApprovalMcpToolApprovalSetting string
+
+const (
+ BetaToolMcpRequireApprovalMcpToolApprovalSettingAlways BetaToolMcpRequireApprovalMcpToolApprovalSetting = "always"
+ BetaToolMcpRequireApprovalMcpToolApprovalSettingNever BetaToolMcpRequireApprovalMcpToolApprovalSetting = "never"
+)
+
+// A tool that runs Python code to help generate a response to a prompt.
+type BetaToolCodeInterpreter struct {
+ // The code interpreter container. Can be a container ID or an object that
+ // specifies uploaded file IDs to make available to your code, along with an
+ // optional `memory_limit` setting.
+ Container BetaToolCodeInterpreterContainerUnion `json:"container" api:"required"`
+ // The type of the code interpreter tool. Always `code_interpreter`.
+ Type constant.CodeInterpreter `json:"type" default:"code_interpreter"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Container respjson.Field
+ Type respjson.Field
+ AllowedCallers respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaToolCodeInterpreter) RawJSON() string { return r.JSON.raw }
+func (r *BetaToolCodeInterpreter) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaToolCodeInterpreterContainerUnion contains all possible properties and
+// values from [string], [BetaToolCodeInterpreterContainerCodeInterpreterToolAuto].
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString]
+type BetaToolCodeInterpreterContainerUnion struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field is from variant
+ // [BetaToolCodeInterpreterContainerCodeInterpreterToolAuto].
+ Type constant.Auto `json:"type"`
+ // This field is from variant
+ // [BetaToolCodeInterpreterContainerCodeInterpreterToolAuto].
+ FileIDs []string `json:"file_ids"`
+ // This field is from variant
+ // [BetaToolCodeInterpreterContainerCodeInterpreterToolAuto].
+ MemoryLimit string `json:"memory_limit"`
+ // This field is from variant
+ // [BetaToolCodeInterpreterContainerCodeInterpreterToolAuto].
+ NetworkPolicy BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnion `json:"network_policy"`
+ JSON struct {
+ OfString respjson.Field
+ Type respjson.Field
+ FileIDs respjson.Field
+ MemoryLimit respjson.Field
+ NetworkPolicy respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u BetaToolCodeInterpreterContainerUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaToolCodeInterpreterContainerUnion) AsCodeInterpreterToolAuto() (v BetaToolCodeInterpreterContainerCodeInterpreterToolAuto) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaToolCodeInterpreterContainerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BetaToolCodeInterpreterContainerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Configuration for a code interpreter container. Optionally specify the IDs of
+// the files to run the code on.
+type BetaToolCodeInterpreterContainerCodeInterpreterToolAuto struct {
+ // Always `auto`.
+ Type constant.Auto `json:"type" default:"auto"`
+ // An optional list of uploaded files to make available to your code.
+ FileIDs []string `json:"file_ids"`
+ // The memory limit for the code interpreter container.
+ //
+ // Any of "1g", "4g", "16g", "64g".
+ MemoryLimit string `json:"memory_limit" api:"nullable"`
+ // Network access policy for the container.
+ NetworkPolicy BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnion `json:"network_policy"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ FileIDs respjson.Field
+ MemoryLimit respjson.Field
+ NetworkPolicy respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaToolCodeInterpreterContainerCodeInterpreterToolAuto) RawJSON() string { return r.JSON.raw }
+func (r *BetaToolCodeInterpreterContainerCodeInterpreterToolAuto) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnion
+// contains all possible properties and values from
+// [BetaContainerNetworkPolicyDisabled], [BetaContainerNetworkPolicyAllowlist].
+//
+// Use the
+// [BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnion.AsAny]
+// method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnion struct {
+ // Any of "disabled", "allowlist".
+ Type string `json:"type"`
+ // This field is from variant [BetaContainerNetworkPolicyAllowlist].
+ AllowedDomains []string `json:"allowed_domains"`
+ // This field is from variant [BetaContainerNetworkPolicyAllowlist].
+ DomainSecrets []BetaContainerNetworkPolicyDomainSecret `json:"domain_secrets"`
+ JSON struct {
+ Type respjson.Field
+ AllowedDomains respjson.Field
+ DomainSecrets respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyBetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicy is
+// implemented by each variant of
+// [BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnion] to
+// add type safety for the return type of
+// [BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnion.AsAny]
+type anyBetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicy interface {
+ implBetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnion()
+}
+
+func (BetaContainerNetworkPolicyDisabled) implBetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnion() {
+}
+func (BetaContainerNetworkPolicyAllowlist) implBetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnion.AsAny().(type) {
+// case openai.BetaContainerNetworkPolicyDisabled:
+// case openai.BetaContainerNetworkPolicyAllowlist:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnion) AsAny() anyBetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicy {
+ switch u.Type {
+ case "disabled":
+ return u.AsDisabled()
+ case "allowlist":
+ return u.AsAllowlist()
+ }
+ return nil
+}
+
+func (u BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnion) AsDisabled() (v BetaContainerNetworkPolicyDisabled) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnion) AsAllowlist() (v BetaContainerNetworkPolicyAllowlist) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnion) RawJSON() string {
+ return u.JSON.raw
+}
+
+func (r *BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaToolProgrammaticToolCalling struct {
+ // The type of the tool. Always `programmatic_tool_calling`.
+ Type constant.ProgrammaticToolCalling `json:"type" default:"programmatic_tool_calling"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaToolProgrammaticToolCalling) RawJSON() string { return r.JSON.raw }
+func (r *BetaToolProgrammaticToolCalling) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool that generates images using the GPT image models.
+type BetaToolImageGeneration struct {
+ // The type of the image generation tool. Always `image_generation`.
+ Type constant.ImageGeneration `json:"type" default:"image_generation"`
+ // Whether to generate a new image or edit an existing image. Default: `auto`.
+ //
+ // Any of "generate", "edit", "auto".
+ Action string `json:"action"`
+ // Allows to set transparency for the background of the generated image(s). This
+ // parameter is only supported for GPT image models that support transparent
+ // backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value).
+ // When `auto` is used, the model will automatically determine the best background
+ // for the image.
+ //
+ // `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent
+ // backgrounds. Requests with `background` set to `transparent` will return an
+ // error for these models; use `opaque` or `auto` instead.
+ //
+ // If `transparent`, the output format needs to support transparency, so it should
+ // be set to either `png` (default value) or `webp`.
+ //
+ // Any of "transparent", "opaque", "auto".
+ Background string `json:"background"`
+ // Control how much effort the model will exert to match the style and features,
+ // especially facial features, of input images. This parameter is only supported
+ // for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for
+ // `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
+ //
+ // Any of "high", "low".
+ InputFidelity string `json:"input_fidelity" api:"nullable"`
+ // Optional mask for inpainting. Contains `image_url` (string, optional) and
+ // `file_id` (string, optional).
+ InputImageMask BetaToolImageGenerationInputImageMask `json:"input_image_mask"`
+ // The image generation model to use. Default: `gpt-image-1`.
+ Model string `json:"model"`
+ // Moderation level for the generated image. Default: `auto`.
+ //
+ // Any of "auto", "low".
+ Moderation string `json:"moderation"`
+ // Compression level for the output image. Default: 100.
+ OutputCompression int64 `json:"output_compression"`
+ // The output format of the generated image. One of `png`, `webp`, or `jpeg`.
+ // Default: `png`.
+ //
+ // Any of "png", "webp", "jpeg".
+ OutputFormat string `json:"output_format"`
+ // Number of partial images to generate in streaming mode, from 0 (default value)
+ // to 3.
+ PartialImages int64 `json:"partial_images"`
+ // The quality of the generated image. One of `low`, `medium`, `high`, or `auto`.
+ // Default: `auto`.
+ //
+ // Any of "low", "medium", "high", "auto".
+ Quality string `json:"quality"`
+ // The size of the generated images. For `gpt-image-2` and
+ // `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT`
+ // strings, for example `1536x864`. Width and height must both be divisible by 16
+ // and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above
+ // `2560x1440` are experimental, and the maximum supported resolution is
+ // `3840x2160`. The requested size must also satisfy the model's current pixel and
+ // edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are
+ // supported by the GPT image models; `auto` is supported for models that allow
+ // automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or
+ // `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or
+ // `1024x1792`.
+ Size string `json:"size"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ Action respjson.Field
+ Background respjson.Field
+ InputFidelity respjson.Field
+ InputImageMask respjson.Field
+ Model respjson.Field
+ Moderation respjson.Field
+ OutputCompression respjson.Field
+ OutputFormat respjson.Field
+ PartialImages respjson.Field
+ Quality respjson.Field
+ Size respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaToolImageGeneration) RawJSON() string { return r.JSON.raw }
+func (r *BetaToolImageGeneration) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Optional mask for inpainting. Contains `image_url` (string, optional) and
+// `file_id` (string, optional).
+type BetaToolImageGenerationInputImageMask struct {
+ // File ID for the mask image.
+ FileID string `json:"file_id"`
+ // Base64-encoded mask image.
+ ImageURL string `json:"image_url"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ FileID respjson.Field
+ ImageURL respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaToolImageGenerationInputImageMask) RawJSON() string { return r.JSON.raw }
+func (r *BetaToolImageGenerationInputImageMask) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool that allows the model to execute shell commands in a local environment.
+type BetaToolLocalShell struct {
+ // The type of the local shell tool. Always `local_shell`.
+ Type constant.LocalShell `json:"type" default:"local_shell"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaToolLocalShell) RawJSON() string { return r.JSON.raw }
+func (r *BetaToolLocalShell) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func BetaToolParamOfFunction(name string, parameters map[string]any, strict bool) BetaToolUnionParam {
+ var function BetaFunctionToolParam
+ function.Name = name
+ function.Parameters = parameters
+ function.Strict = param.NewOpt(strict)
+ return BetaToolUnionParam{OfFunction: &function}
+}
+
+func BetaToolParamOfFileSearch(vectorStoreIDs []string) BetaToolUnionParam {
+ var fileSearch BetaFileSearchToolParam
+ fileSearch.VectorStoreIDs = vectorStoreIDs
+ return BetaToolUnionParam{OfFileSearch: &fileSearch}
+}
+
+func BetaToolParamOfComputerUsePreview(displayHeight int64, displayWidth int64, environment BetaComputerUsePreviewToolEnvironment) BetaToolUnionParam {
+ var computerUsePreview BetaComputerUsePreviewToolParam
+ computerUsePreview.DisplayHeight = displayHeight
+ computerUsePreview.DisplayWidth = displayWidth
+ computerUsePreview.Environment = environment
+ return BetaToolUnionParam{OfComputerUsePreview: &computerUsePreview}
+}
+
+func BetaToolParamOfWebSearch(type_ BetaWebSearchToolType) BetaToolUnionParam {
+ var variant BetaWebSearchToolParam
+ variant.Type = type_
+ return BetaToolUnionParam{OfWebSearch: &variant}
+}
+
+func BetaToolParamOfMcp(serverLabel string) BetaToolUnionParam {
+ var mcp BetaToolMcpParam
+ mcp.ServerLabel = serverLabel
+ return BetaToolUnionParam{OfMcp: &mcp}
+}
+
+func BetaToolParamOfCodeInterpreter[
+ T string | BetaToolCodeInterpreterContainerCodeInterpreterToolAutoParam,
+](container T) BetaToolUnionParam {
+ var codeInterpreter BetaToolCodeInterpreterParam
+ switch v := any(container).(type) {
+ case string:
+ codeInterpreter.Container.OfString = param.NewOpt(v)
+ case BetaToolCodeInterpreterContainerCodeInterpreterToolAutoParam:
+ codeInterpreter.Container.OfCodeInterpreterToolAuto = &v
+ }
+ return BetaToolUnionParam{OfCodeInterpreter: &codeInterpreter}
+}
+
+func BetaToolParamOfCustom(name string) BetaToolUnionParam {
+ var custom BetaCustomToolParam
+ custom.Name = name
+ return BetaToolUnionParam{OfCustom: &custom}
+}
+
+func BetaToolParamOfNamespace(description string, name string, tools []BetaNamespaceToolToolUnionParam) BetaToolUnionParam {
+ var namespace BetaNamespaceToolParam
+ namespace.Description = description
+ namespace.Name = name
+ namespace.Tools = tools
+ return BetaToolUnionParam{OfNamespace: &namespace}
+}
+
+func BetaToolParamOfWebSearchPreview(type_ BetaWebSearchPreviewToolType) BetaToolUnionParam {
+ var variant BetaWebSearchPreviewToolParam
+ variant.Type = type_
+ return BetaToolUnionParam{OfWebSearchPreview: &variant}
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaToolUnionParam struct {
+ OfFunction *BetaFunctionToolParam `json:",omitzero,inline"`
+ OfFileSearch *BetaFileSearchToolParam `json:",omitzero,inline"`
+ OfComputer *BetaComputerToolParam `json:",omitzero,inline"`
+ OfComputerUsePreview *BetaComputerUsePreviewToolParam `json:",omitzero,inline"`
+ OfWebSearch *BetaWebSearchToolParam `json:",omitzero,inline"`
+ OfMcp *BetaToolMcpParam `json:",omitzero,inline"`
+ OfCodeInterpreter *BetaToolCodeInterpreterParam `json:",omitzero,inline"`
+ OfProgrammaticToolCalling *BetaToolProgrammaticToolCallingParam `json:",omitzero,inline"`
+ OfImageGeneration *BetaToolImageGenerationParam `json:",omitzero,inline"`
+ OfLocalShell *BetaToolLocalShellParam `json:",omitzero,inline"`
+ OfShell *BetaFunctionShellToolParam `json:",omitzero,inline"`
+ OfCustom *BetaCustomToolParam `json:",omitzero,inline"`
+ OfNamespace *BetaNamespaceToolParam `json:",omitzero,inline"`
+ OfToolSearch *BetaToolSearchToolParam `json:",omitzero,inline"`
+ OfWebSearchPreview *BetaWebSearchPreviewToolParam `json:",omitzero,inline"`
+ OfApplyPatch *BetaApplyPatchToolParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaToolUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfFunction,
+ u.OfFileSearch,
+ u.OfComputer,
+ u.OfComputerUsePreview,
+ u.OfWebSearch,
+ u.OfMcp,
+ u.OfCodeInterpreter,
+ u.OfProgrammaticToolCalling,
+ u.OfImageGeneration,
+ u.OfLocalShell,
+ u.OfShell,
+ u.OfCustom,
+ u.OfNamespace,
+ u.OfToolSearch,
+ u.OfWebSearchPreview,
+ u.OfApplyPatch)
+}
+func (u *BetaToolUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaToolUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfFunction) {
+ return u.OfFunction
+ } else if !param.IsOmitted(u.OfFileSearch) {
+ return u.OfFileSearch
+ } else if !param.IsOmitted(u.OfComputer) {
+ return u.OfComputer
+ } else if !param.IsOmitted(u.OfComputerUsePreview) {
+ return u.OfComputerUsePreview
+ } else if !param.IsOmitted(u.OfWebSearch) {
+ return u.OfWebSearch
+ } else if !param.IsOmitted(u.OfMcp) {
+ return u.OfMcp
+ } else if !param.IsOmitted(u.OfCodeInterpreter) {
+ return u.OfCodeInterpreter
+ } else if !param.IsOmitted(u.OfProgrammaticToolCalling) {
+ return u.OfProgrammaticToolCalling
+ } else if !param.IsOmitted(u.OfImageGeneration) {
+ return u.OfImageGeneration
+ } else if !param.IsOmitted(u.OfLocalShell) {
+ return u.OfLocalShell
+ } else if !param.IsOmitted(u.OfShell) {
+ return u.OfShell
+ } else if !param.IsOmitted(u.OfCustom) {
+ return u.OfCustom
+ } else if !param.IsOmitted(u.OfNamespace) {
+ return u.OfNamespace
+ } else if !param.IsOmitted(u.OfToolSearch) {
+ return u.OfToolSearch
+ } else if !param.IsOmitted(u.OfWebSearchPreview) {
+ return u.OfWebSearchPreview
+ } else if !param.IsOmitted(u.OfApplyPatch) {
+ return u.OfApplyPatch
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetStrict() *bool {
+ if vt := u.OfFunction; vt != nil && vt.Strict.Valid() {
+ return &vt.Strict.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetOutputSchema() map[string]any {
+ if vt := u.OfFunction; vt != nil {
+ return vt.OutputSchema
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetVectorStoreIDs() []string {
+ if vt := u.OfFileSearch; vt != nil {
+ return vt.VectorStoreIDs
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetMaxNumResults() *int64 {
+ if vt := u.OfFileSearch; vt != nil && vt.MaxNumResults.Valid() {
+ return &vt.MaxNumResults.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetRankingOptions() *BetaFileSearchToolRankingOptionsParam {
+ if vt := u.OfFileSearch; vt != nil {
+ return &vt.RankingOptions
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetDisplayHeight() *int64 {
+ if vt := u.OfComputerUsePreview; vt != nil {
+ return &vt.DisplayHeight
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetDisplayWidth() *int64 {
+ if vt := u.OfComputerUsePreview; vt != nil {
+ return &vt.DisplayWidth
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetServerLabel() *string {
+ if vt := u.OfMcp; vt != nil {
+ return &vt.ServerLabel
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetAllowedTools() *BetaToolMcpAllowedToolsUnionParam {
+ if vt := u.OfMcp; vt != nil {
+ return &vt.AllowedTools
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetAuthorization() *string {
+ if vt := u.OfMcp; vt != nil && vt.Authorization.Valid() {
+ return &vt.Authorization.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetConnectorID() *string {
+ if vt := u.OfMcp; vt != nil {
+ return &vt.ConnectorID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetHeaders() map[string]string {
+ if vt := u.OfMcp; vt != nil {
+ return vt.Headers
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetRequireApproval() *BetaToolMcpRequireApprovalUnionParam {
+ if vt := u.OfMcp; vt != nil {
+ return &vt.RequireApproval
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetServerDescription() *string {
+ if vt := u.OfMcp; vt != nil && vt.ServerDescription.Valid() {
+ return &vt.ServerDescription.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetServerURL() *string {
+ if vt := u.OfMcp; vt != nil && vt.ServerURL.Valid() {
+ return &vt.ServerURL.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetTunnelID() *string {
+ if vt := u.OfMcp; vt != nil && vt.TunnelID.Valid() {
+ return &vt.TunnelID.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetContainer() *BetaToolCodeInterpreterContainerUnionParam {
+ if vt := u.OfCodeInterpreter; vt != nil {
+ return &vt.Container
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetAction() *string {
+ if vt := u.OfImageGeneration; vt != nil {
+ return &vt.Action
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetBackground() *string {
+ if vt := u.OfImageGeneration; vt != nil {
+ return &vt.Background
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetInputFidelity() *string {
+ if vt := u.OfImageGeneration; vt != nil {
+ return &vt.InputFidelity
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetInputImageMask() *BetaToolImageGenerationInputImageMaskParam {
+ if vt := u.OfImageGeneration; vt != nil {
+ return &vt.InputImageMask
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetModel() *string {
+ if vt := u.OfImageGeneration; vt != nil {
+ return &vt.Model
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetModeration() *string {
+ if vt := u.OfImageGeneration; vt != nil {
+ return &vt.Moderation
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetOutputCompression() *int64 {
+ if vt := u.OfImageGeneration; vt != nil && vt.OutputCompression.Valid() {
+ return &vt.OutputCompression.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetOutputFormat() *string {
+ if vt := u.OfImageGeneration; vt != nil {
+ return &vt.OutputFormat
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetPartialImages() *int64 {
+ if vt := u.OfImageGeneration; vt != nil && vt.PartialImages.Valid() {
+ return &vt.PartialImages.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetQuality() *string {
+ if vt := u.OfImageGeneration; vt != nil {
+ return &vt.Quality
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetSize() *string {
+ if vt := u.OfImageGeneration; vt != nil {
+ return &vt.Size
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetFormat() *BetaCustomToolFormatUnionParam {
+ if vt := u.OfCustom; vt != nil {
+ return &vt.Format
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetTools() []BetaNamespaceToolToolUnionParam {
+ if vt := u.OfNamespace; vt != nil {
+ return vt.Tools
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetExecution() *string {
+ if vt := u.OfToolSearch; vt != nil {
+ return (*string)(&vt.Execution)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetSearchContentTypes() []string {
+ if vt := u.OfWebSearchPreview; vt != nil {
+ return vt.SearchContentTypes
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetName() *string {
+ if vt := u.OfFunction; vt != nil {
+ return (*string)(&vt.Name)
+ } else if vt := u.OfCustom; vt != nil {
+ return (*string)(&vt.Name)
+ } else if vt := u.OfNamespace; vt != nil {
+ return (*string)(&vt.Name)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetType() *string {
+ if vt := u.OfFunction; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfFileSearch; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfComputer; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfComputerUsePreview; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfWebSearch; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfMcp; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfCodeInterpreter; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfProgrammaticToolCalling; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfImageGeneration; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfLocalShell; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfShell; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfCustom; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfNamespace; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfToolSearch; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfWebSearchPreview; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfApplyPatch; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetDeferLoading() *bool {
+ if vt := u.OfFunction; vt != nil && vt.DeferLoading.Valid() {
+ return &vt.DeferLoading.Value
+ } else if vt := u.OfMcp; vt != nil && vt.DeferLoading.Valid() {
+ return &vt.DeferLoading.Value
+ } else if vt := u.OfCustom; vt != nil && vt.DeferLoading.Valid() {
+ return &vt.DeferLoading.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetDescription() *string {
+ if vt := u.OfFunction; vt != nil && vt.Description.Valid() {
+ return &vt.Description.Value
+ } else if vt := u.OfCustom; vt != nil && vt.Description.Valid() {
+ return &vt.Description.Value
+ } else if vt := u.OfNamespace; vt != nil {
+ return (*string)(&vt.Description)
+ } else if vt := u.OfToolSearch; vt != nil && vt.Description.Valid() {
+ return &vt.Description.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolUnionParam) GetSearchContextSize() *string {
+ if vt := u.OfWebSearch; vt != nil {
+ return (*string)(&vt.SearchContextSize)
+ } else if vt := u.OfWebSearchPreview; vt != nil {
+ return (*string)(&vt.SearchContextSize)
+ }
+ return nil
+}
+
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u BetaToolUnionParam) GetParameters() (res betaToolUnionParamParameters) {
+ if vt := u.OfFunction; vt != nil {
+ res.any = &vt.Parameters
+ } else if vt := u.OfToolSearch; vt != nil {
+ res.any = &vt.Parameters
+ }
+ return
+}
+
+// Can have the runtime types [*map[string]any], [*any]
+type betaToolUnionParamParameters struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *map[string]any:
+// case *any:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u betaToolUnionParamParameters) AsAny() any { return u.any }
+
+// Returns a pointer to the underlying variant's AllowedCallers property, if
+// present.
+func (u BetaToolUnionParam) GetAllowedCallers() []string {
+ if vt := u.OfFunction; vt != nil {
+ return vt.AllowedCallers
+ } else if vt := u.OfMcp; vt != nil {
+ return vt.AllowedCallers
+ } else if vt := u.OfCodeInterpreter; vt != nil {
+ return vt.AllowedCallers
+ } else if vt := u.OfShell; vt != nil {
+ return vt.AllowedCallers
+ } else if vt := u.OfCustom; vt != nil {
+ return vt.AllowedCallers
+ } else if vt := u.OfApplyPatch; vt != nil {
+ return vt.AllowedCallers
+ }
+ return nil
+}
+
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u BetaToolUnionParam) GetFilters() (res betaToolUnionParamFilters) {
+ if vt := u.OfFileSearch; vt != nil {
+ res.any = vt.Filters.asAny()
+ } else if vt := u.OfWebSearch; vt != nil {
+ res.any = &vt.Filters
+ }
+ return
+}
+
+// Can have the runtime types [*BetaFileSearchToolFiltersComparisonFilterParam],
+// [*BetaFileSearchToolFiltersCompoundFilterParam],
+// [*BetaWebSearchToolFiltersParam]
+type betaToolUnionParamFilters struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *openai.BetaFileSearchToolFiltersComparisonFilterParam:
+// case *openai.BetaFileSearchToolFiltersCompoundFilterParam:
+// case *openai.BetaWebSearchToolFiltersParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u betaToolUnionParamFilters) AsAny() any { return u.any }
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaToolUnionParamFilters) GetKey() *string {
+ switch vt := u.any.(type) {
+ case *BetaFileSearchToolFiltersUnionParam:
+ return vt.GetKey()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaToolUnionParamFilters) GetValue() *BetaFileSearchToolFiltersComparisonFilterValueUnionParam {
+ switch vt := u.any.(type) {
+ case *BetaFileSearchToolFiltersUnionParam:
+ return vt.GetValue()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaToolUnionParamFilters) GetFilters() []BetaFileSearchToolFiltersCompoundFilterFilterParam {
+ switch vt := u.any.(type) {
+ case *BetaFileSearchToolFiltersUnionParam:
+ return vt.GetFilters()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaToolUnionParamFilters) GetAllowedDomains() []string {
+ switch vt := u.any.(type) {
+ case *BetaWebSearchToolFiltersParam:
+ return vt.AllowedDomains
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaToolUnionParamFilters) GetType() *string {
+ switch vt := u.any.(type) {
+ case *BetaFileSearchToolFiltersUnionParam:
+ return vt.GetType()
+ }
+ return nil
+}
+
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u BetaToolUnionParam) GetEnvironment() (res betaToolUnionParamEnvironment) {
+ if vt := u.OfComputerUsePreview; vt != nil {
+ res.any = (*string)(&vt.Environment)
+ } else if vt := u.OfShell; vt != nil {
+ res.any = vt.Environment.asAny()
+ }
+ return
+}
+
+// Can have the runtime types [*string], [*BetaContainerAutoParam],
+// [*BetaLocalEnvironmentParam], [*BetaContainerReferenceParam]
+type betaToolUnionParamEnvironment struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *string:
+// case *openai.BetaContainerAutoParam:
+// case *openai.BetaLocalEnvironmentParam:
+// case *openai.BetaContainerReferenceParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u betaToolUnionParamEnvironment) AsAny() any { return u.any }
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaToolUnionParamEnvironment) GetFileIDs() []string {
+ switch vt := u.any.(type) {
+ case *BetaFunctionShellToolEnvironmentUnionParam:
+ return vt.GetFileIDs()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaToolUnionParamEnvironment) GetMemoryLimit() *string {
+ switch vt := u.any.(type) {
+ case *BetaFunctionShellToolEnvironmentUnionParam:
+ return vt.GetMemoryLimit()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaToolUnionParamEnvironment) GetNetworkPolicy() *BetaContainerAutoNetworkPolicyUnionParam {
+ switch vt := u.any.(type) {
+ case *BetaFunctionShellToolEnvironmentUnionParam:
+ return vt.GetNetworkPolicy()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaToolUnionParamEnvironment) GetContainerID() *string {
+ switch vt := u.any.(type) {
+ case *BetaFunctionShellToolEnvironmentUnionParam:
+ return vt.GetContainerID()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaToolUnionParamEnvironment) GetType() *string {
+ switch vt := u.any.(type) {
+ case *BetaFunctionShellToolEnvironmentUnionParam:
+ return vt.GetType()
+ }
+ return nil
+}
+
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u betaToolUnionParamEnvironment) GetSkills() (res betaToolUnionParamEnvironmentSkills) {
+ switch vt := u.any.(type) {
+ case *BetaFunctionShellToolEnvironmentUnionParam:
+ res.any = vt.GetSkills()
+ }
+ return res
+}
+
+// Can have the runtime types [_[]BetaContainerAutoSkillUnionParam],
+// [_[]BetaLocalSkillParam]
+type betaToolUnionParamEnvironmentSkills struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *[]openai.BetaContainerAutoSkillUnionParam:
+// case *[]openai.BetaLocalSkillParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u betaToolUnionParamEnvironmentSkills) AsAny() any { return u.any }
+
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u BetaToolUnionParam) GetUserLocation() (res betaToolUnionParamUserLocation) {
+ if vt := u.OfWebSearch; vt != nil {
+ res.any = &vt.UserLocation
+ } else if vt := u.OfWebSearchPreview; vt != nil {
+ res.any = &vt.UserLocation
+ }
+ return
+}
+
+// Can have the runtime types [*BetaWebSearchToolUserLocationParam],
+// [*BetaWebSearchPreviewToolUserLocationParam]
+type betaToolUnionParamUserLocation struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *openai.BetaWebSearchToolUserLocationParam:
+// case *openai.BetaWebSearchPreviewToolUserLocationParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u betaToolUnionParamUserLocation) AsAny() any { return u.any }
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaToolUnionParamUserLocation) GetCity() *string {
+ switch vt := u.any.(type) {
+ case *BetaWebSearchToolUserLocationParam:
+ return paramutil.AddrIfPresent(vt.City)
+ case *BetaWebSearchPreviewToolUserLocationParam:
+ return paramutil.AddrIfPresent(vt.City)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaToolUnionParamUserLocation) GetCountry() *string {
+ switch vt := u.any.(type) {
+ case *BetaWebSearchToolUserLocationParam:
+ return paramutil.AddrIfPresent(vt.Country)
+ case *BetaWebSearchPreviewToolUserLocationParam:
+ return paramutil.AddrIfPresent(vt.Country)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaToolUnionParamUserLocation) GetRegion() *string {
+ switch vt := u.any.(type) {
+ case *BetaWebSearchToolUserLocationParam:
+ return paramutil.AddrIfPresent(vt.Region)
+ case *BetaWebSearchPreviewToolUserLocationParam:
+ return paramutil.AddrIfPresent(vt.Region)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaToolUnionParamUserLocation) GetTimezone() *string {
+ switch vt := u.any.(type) {
+ case *BetaWebSearchToolUserLocationParam:
+ return paramutil.AddrIfPresent(vt.Timezone)
+ case *BetaWebSearchPreviewToolUserLocationParam:
+ return paramutil.AddrIfPresent(vt.Timezone)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u betaToolUnionParamUserLocation) GetType() *string {
+ switch vt := u.any.(type) {
+ case *BetaWebSearchToolUserLocationParam:
+ return (*string)(&vt.Type)
+ case *BetaWebSearchPreviewToolUserLocationParam:
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaToolUnionParam](
+ "type",
+ apijson.Discriminator[BetaFunctionToolParam]("function"),
+ apijson.Discriminator[BetaFileSearchToolParam]("file_search"),
+ apijson.Discriminator[BetaComputerToolParam]("computer"),
+ apijson.Discriminator[BetaComputerUsePreviewToolParam]("computer_use_preview"),
+ apijson.Discriminator[BetaWebSearchToolParam]("web_search"),
+ apijson.Discriminator[BetaWebSearchToolParam]("web_search_2025_08_26"),
+ apijson.Discriminator[BetaToolMcpParam]("mcp"),
+ apijson.Discriminator[BetaToolCodeInterpreterParam]("code_interpreter"),
+ apijson.Discriminator[BetaToolProgrammaticToolCallingParam]("programmatic_tool_calling"),
+ apijson.Discriminator[BetaToolImageGenerationParam]("image_generation"),
+ apijson.Discriminator[BetaToolLocalShellParam]("local_shell"),
+ apijson.Discriminator[BetaFunctionShellToolParam]("shell"),
+ apijson.Discriminator[BetaCustomToolParam]("custom"),
+ apijson.Discriminator[BetaNamespaceToolParam]("namespace"),
+ apijson.Discriminator[BetaToolSearchToolParam]("tool_search"),
+ apijson.Discriminator[BetaWebSearchPreviewToolParam]("web_search_preview"),
+ apijson.Discriminator[BetaWebSearchPreviewToolParam]("web_search_preview_2025_03_11"),
+ apijson.Discriminator[BetaApplyPatchToolParam]("apply_patch"),
+ )
+}
+
+// Give the model access to additional tools via remote Model Context Protocol
+// (MCP) servers.
+// [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).
+//
+// The properties ServerLabel, Type are required.
+type BetaToolMcpParam struct {
+ // A label for this MCP server, used to identify it in tool calls.
+ ServerLabel string `json:"server_label" api:"required"`
+ // An OAuth access token that can be used with a remote MCP server, either with a
+ // custom MCP server URL or a service connector. Your application must handle the
+ // OAuth authorization flow and provide the token here.
+ Authorization param.Opt[string] `json:"authorization,omitzero"`
+ // Whether this MCP tool is deferred and discovered via tool search.
+ DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
+ // Optional description of the MCP server, used to provide more context.
+ ServerDescription param.Opt[string] `json:"server_description,omitzero"`
+ // The URL for the MCP server. One of `server_url`, `connector_id`, or `tunnel_id`
+ // must be provided.
+ ServerURL param.Opt[string] `json:"server_url,omitzero" format:"uri"`
+ // The Secure MCP Tunnel ID to use instead of a direct server URL. One of
+ // `server_url`, `connector_id`, or `tunnel_id` must be provided.
+ TunnelID param.Opt[string] `json:"tunnel_id,omitzero"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers,omitzero"`
+ // List of allowed tool names or a filter object.
+ AllowedTools BetaToolMcpAllowedToolsUnionParam `json:"allowed_tools,omitzero"`
+ // Optional HTTP headers to send to the MCP server. Use for authentication or other
+ // purposes.
+ Headers map[string]string `json:"headers,omitzero"`
+ // Specify which of the MCP server's tools require approval.
+ RequireApproval BetaToolMcpRequireApprovalUnionParam `json:"require_approval,omitzero"`
+ // Identifier for service connectors, like those available in ChatGPT. One of
+ // `server_url`, `connector_id`, or `tunnel_id` must be provided. Learn more about
+ // service connectors
+ // [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
+ //
+ // Currently supported `connector_id` values are:
+ //
+ // - Dropbox: `connector_dropbox`
+ // - Gmail: `connector_gmail`
+ // - Google Calendar: `connector_googlecalendar`
+ // - Google Drive: `connector_googledrive`
+ // - Microsoft Teams: `connector_microsoftteams`
+ // - Outlook Calendar: `connector_outlookcalendar`
+ // - Outlook Email: `connector_outlookemail`
+ // - SharePoint: `connector_sharepoint`
+ //
+ // Any of "connector_dropbox", "connector_gmail", "connector_googlecalendar",
+ // "connector_googledrive", "connector_microsoftteams",
+ // "connector_outlookcalendar", "connector_outlookemail", "connector_sharepoint".
+ ConnectorID string `json:"connector_id,omitzero"`
+ // The type of the MCP tool. Always `mcp`.
+ //
+ // This field can be elided, and will marshal its zero value as "mcp".
+ Type constant.Mcp `json:"type" default:"mcp"`
+ paramObj
+}
+
+func (r BetaToolMcpParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaToolMcpParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaToolMcpParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaToolMcpParam](
+ "connector_id", "connector_dropbox", "connector_gmail", "connector_googlecalendar", "connector_googledrive", "connector_microsoftteams", "connector_outlookcalendar", "connector_outlookemail", "connector_sharepoint",
+ )
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaToolMcpAllowedToolsUnionParam struct {
+ OfMcpAllowedTools []string `json:",omitzero,inline"`
+ OfMcpToolFilter *BetaToolMcpAllowedToolsMcpToolFilterParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaToolMcpAllowedToolsUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfMcpAllowedTools, u.OfMcpToolFilter)
+}
+func (u *BetaToolMcpAllowedToolsUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaToolMcpAllowedToolsUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfMcpAllowedTools) {
+ return &u.OfMcpAllowedTools
+ } else if !param.IsOmitted(u.OfMcpToolFilter) {
+ return u.OfMcpToolFilter
+ }
+ return nil
+}
+
+// A filter object to specify which tools are allowed.
+type BetaToolMcpAllowedToolsMcpToolFilterParam struct {
+ // Indicates whether or not a tool modifies data or is read-only. If an MCP server
+ // is
+ // [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
+ // it will match this filter.
+ ReadOnly param.Opt[bool] `json:"read_only,omitzero"`
+ // List of allowed tool names.
+ ToolNames []string `json:"tool_names,omitzero"`
+ paramObj
+}
+
+func (r BetaToolMcpAllowedToolsMcpToolFilterParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaToolMcpAllowedToolsMcpToolFilterParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaToolMcpAllowedToolsMcpToolFilterParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaToolMcpRequireApprovalUnionParam struct {
+ OfMcpToolApprovalFilter *BetaToolMcpRequireApprovalMcpToolApprovalFilterParam `json:",omitzero,inline"`
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfMcpToolApprovalSetting)
+ OfMcpToolApprovalSetting param.Opt[string] `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaToolMcpRequireApprovalUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfMcpToolApprovalFilter, u.OfMcpToolApprovalSetting)
+}
+func (u *BetaToolMcpRequireApprovalUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaToolMcpRequireApprovalUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfMcpToolApprovalFilter) {
+ return u.OfMcpToolApprovalFilter
+ } else if !param.IsOmitted(u.OfMcpToolApprovalSetting) {
+ return &u.OfMcpToolApprovalSetting
+ }
+ return nil
+}
+
+// Specify which of the MCP server's tools require approval. Can be `always`,
+// `never`, or a filter object associated with tools that require approval.
+type BetaToolMcpRequireApprovalMcpToolApprovalFilterParam struct {
+ // A filter object to specify which tools are allowed.
+ Always BetaToolMcpRequireApprovalMcpToolApprovalFilterAlwaysParam `json:"always,omitzero"`
+ // A filter object to specify which tools are allowed.
+ Never BetaToolMcpRequireApprovalMcpToolApprovalFilterNeverParam `json:"never,omitzero"`
+ paramObj
+}
+
+func (r BetaToolMcpRequireApprovalMcpToolApprovalFilterParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaToolMcpRequireApprovalMcpToolApprovalFilterParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaToolMcpRequireApprovalMcpToolApprovalFilterParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A filter object to specify which tools are allowed.
+type BetaToolMcpRequireApprovalMcpToolApprovalFilterAlwaysParam struct {
+ // Indicates whether or not a tool modifies data or is read-only. If an MCP server
+ // is
+ // [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
+ // it will match this filter.
+ ReadOnly param.Opt[bool] `json:"read_only,omitzero"`
+ // List of allowed tool names.
+ ToolNames []string `json:"tool_names,omitzero"`
+ paramObj
+}
+
+func (r BetaToolMcpRequireApprovalMcpToolApprovalFilterAlwaysParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaToolMcpRequireApprovalMcpToolApprovalFilterAlwaysParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaToolMcpRequireApprovalMcpToolApprovalFilterAlwaysParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A filter object to specify which tools are allowed.
+type BetaToolMcpRequireApprovalMcpToolApprovalFilterNeverParam struct {
+ // Indicates whether or not a tool modifies data or is read-only. If an MCP server
+ // is
+ // [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
+ // it will match this filter.
+ ReadOnly param.Opt[bool] `json:"read_only,omitzero"`
+ // List of allowed tool names.
+ ToolNames []string `json:"tool_names,omitzero"`
+ paramObj
+}
+
+func (r BetaToolMcpRequireApprovalMcpToolApprovalFilterNeverParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaToolMcpRequireApprovalMcpToolApprovalFilterNeverParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaToolMcpRequireApprovalMcpToolApprovalFilterNeverParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool that runs Python code to help generate a response to a prompt.
+//
+// The properties Container, Type are required.
+type BetaToolCodeInterpreterParam struct {
+ // The code interpreter container. Can be a container ID or an object that
+ // specifies uploaded file IDs to make available to your code, along with an
+ // optional `memory_limit` setting.
+ Container BetaToolCodeInterpreterContainerUnionParam `json:"container,omitzero" api:"required"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers,omitzero"`
+ // The type of the code interpreter tool. Always `code_interpreter`.
+ //
+ // This field can be elided, and will marshal its zero value as "code_interpreter".
+ Type constant.CodeInterpreter `json:"type" default:"code_interpreter"`
+ paramObj
+}
+
+func (r BetaToolCodeInterpreterParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaToolCodeInterpreterParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaToolCodeInterpreterParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaToolCodeInterpreterContainerUnionParam struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfCodeInterpreterToolAuto *BetaToolCodeInterpreterContainerCodeInterpreterToolAutoParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaToolCodeInterpreterContainerUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfCodeInterpreterToolAuto)
+}
+func (u *BetaToolCodeInterpreterContainerUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaToolCodeInterpreterContainerUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfCodeInterpreterToolAuto) {
+ return u.OfCodeInterpreterToolAuto
+ }
+ return nil
+}
+
+// Configuration for a code interpreter container. Optionally specify the IDs of
+// the files to run the code on.
+//
+// The property Type is required.
+type BetaToolCodeInterpreterContainerCodeInterpreterToolAutoParam struct {
+ // The memory limit for the code interpreter container.
+ //
+ // Any of "1g", "4g", "16g", "64g".
+ MemoryLimit string `json:"memory_limit,omitzero"`
+ // An optional list of uploaded files to make available to your code.
+ FileIDs []string `json:"file_ids,omitzero"`
+ // Network access policy for the container.
+ NetworkPolicy BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnionParam `json:"network_policy,omitzero"`
+ // Always `auto`.
+ //
+ // This field can be elided, and will marshal its zero value as "auto".
+ Type constant.Auto `json:"type" default:"auto"`
+ paramObj
+}
+
+func (r BetaToolCodeInterpreterContainerCodeInterpreterToolAutoParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaToolCodeInterpreterContainerCodeInterpreterToolAutoParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaToolCodeInterpreterContainerCodeInterpreterToolAutoParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaToolCodeInterpreterContainerCodeInterpreterToolAutoParam](
+ "memory_limit", "1g", "4g", "16g", "64g",
+ )
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnionParam struct {
+ OfDisabled *BetaContainerNetworkPolicyDisabledParam `json:",omitzero,inline"`
+ OfAllowlist *BetaContainerNetworkPolicyAllowlistParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfDisabled, u.OfAllowlist)
+}
+func (u *BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfDisabled) {
+ return u.OfDisabled
+ } else if !param.IsOmitted(u.OfAllowlist) {
+ return u.OfAllowlist
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnionParam) GetAllowedDomains() []string {
+ if vt := u.OfAllowlist; vt != nil {
+ return vt.AllowedDomains
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnionParam) GetDomainSecrets() []BetaContainerNetworkPolicyDomainSecretParam {
+ if vt := u.OfAllowlist; vt != nil {
+ return vt.DomainSecrets
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnionParam) GetType() *string {
+ if vt := u.OfDisabled; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfAllowlist; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[BetaToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnionParam](
+ "type",
+ apijson.Discriminator[BetaContainerNetworkPolicyDisabledParam]("disabled"),
+ apijson.Discriminator[BetaContainerNetworkPolicyAllowlistParam]("allowlist"),
+ )
+}
+
+func NewBetaToolProgrammaticToolCallingParam() BetaToolProgrammaticToolCallingParam {
+ return BetaToolProgrammaticToolCallingParam{
+ Type: "programmatic_tool_calling",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewBetaToolProgrammaticToolCallingParam].
+type BetaToolProgrammaticToolCallingParam struct {
+ // The type of the tool. Always `programmatic_tool_calling`.
+ Type constant.ProgrammaticToolCalling `json:"type" default:"programmatic_tool_calling"`
+ paramObj
+}
+
+func (r BetaToolProgrammaticToolCallingParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaToolProgrammaticToolCallingParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaToolProgrammaticToolCallingParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool that generates images using the GPT image models.
+//
+// The property Type is required.
+type BetaToolImageGenerationParam struct {
+ // Compression level for the output image. Default: 100.
+ OutputCompression param.Opt[int64] `json:"output_compression,omitzero"`
+ // Number of partial images to generate in streaming mode, from 0 (default value)
+ // to 3.
+ PartialImages param.Opt[int64] `json:"partial_images,omitzero"`
+ // Control how much effort the model will exert to match the style and features,
+ // especially facial features, of input images. This parameter is only supported
+ // for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for
+ // `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
+ //
+ // Any of "high", "low".
+ InputFidelity string `json:"input_fidelity,omitzero"`
+ // Whether to generate a new image or edit an existing image. Default: `auto`.
+ //
+ // Any of "generate", "edit", "auto".
+ Action string `json:"action,omitzero"`
+ // Allows to set transparency for the background of the generated image(s). This
+ // parameter is only supported for GPT image models that support transparent
+ // backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value).
+ // When `auto` is used, the model will automatically determine the best background
+ // for the image.
+ //
+ // `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent
+ // backgrounds. Requests with `background` set to `transparent` will return an
+ // error for these models; use `opaque` or `auto` instead.
+ //
+ // If `transparent`, the output format needs to support transparency, so it should
+ // be set to either `png` (default value) or `webp`.
+ //
+ // Any of "transparent", "opaque", "auto".
+ Background string `json:"background,omitzero"`
+ // Optional mask for inpainting. Contains `image_url` (string, optional) and
+ // `file_id` (string, optional).
+ InputImageMask BetaToolImageGenerationInputImageMaskParam `json:"input_image_mask,omitzero"`
+ // The image generation model to use. Default: `gpt-image-1`.
+ Model string `json:"model,omitzero"`
+ // Moderation level for the generated image. Default: `auto`.
+ //
+ // Any of "auto", "low".
+ Moderation string `json:"moderation,omitzero"`
+ // The output format of the generated image. One of `png`, `webp`, or `jpeg`.
+ // Default: `png`.
+ //
+ // Any of "png", "webp", "jpeg".
+ OutputFormat string `json:"output_format,omitzero"`
+ // The quality of the generated image. One of `low`, `medium`, `high`, or `auto`.
+ // Default: `auto`.
+ //
+ // Any of "low", "medium", "high", "auto".
+ Quality string `json:"quality,omitzero"`
+ // The size of the generated images. For `gpt-image-2` and
+ // `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT`
+ // strings, for example `1536x864`. Width and height must both be divisible by 16
+ // and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above
+ // `2560x1440` are experimental, and the maximum supported resolution is
+ // `3840x2160`. The requested size must also satisfy the model's current pixel and
+ // edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are
+ // supported by the GPT image models; `auto` is supported for models that allow
+ // automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or
+ // `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or
+ // `1024x1792`.
+ Size string `json:"size,omitzero"`
+ // The type of the image generation tool. Always `image_generation`.
+ //
+ // This field can be elided, and will marshal its zero value as "image_generation".
+ Type constant.ImageGeneration `json:"type" default:"image_generation"`
+ paramObj
+}
+
+func (r BetaToolImageGenerationParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaToolImageGenerationParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaToolImageGenerationParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaToolImageGenerationParam](
+ "action", "generate", "edit", "auto",
+ )
+ apijson.RegisterFieldValidator[BetaToolImageGenerationParam](
+ "background", "transparent", "opaque", "auto",
+ )
+ apijson.RegisterFieldValidator[BetaToolImageGenerationParam](
+ "input_fidelity", "high", "low",
+ )
+ apijson.RegisterFieldValidator[BetaToolImageGenerationParam](
+ "moderation", "auto", "low",
+ )
+ apijson.RegisterFieldValidator[BetaToolImageGenerationParam](
+ "output_format", "png", "webp", "jpeg",
+ )
+ apijson.RegisterFieldValidator[BetaToolImageGenerationParam](
+ "quality", "low", "medium", "high", "auto",
+ )
+}
+
+// Optional mask for inpainting. Contains `image_url` (string, optional) and
+// `file_id` (string, optional).
+type BetaToolImageGenerationInputImageMaskParam struct {
+ // File ID for the mask image.
+ FileID param.Opt[string] `json:"file_id,omitzero"`
+ // Base64-encoded mask image.
+ ImageURL param.Opt[string] `json:"image_url,omitzero"`
+ paramObj
+}
+
+func (r BetaToolImageGenerationInputImageMaskParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaToolImageGenerationInputImageMaskParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaToolImageGenerationInputImageMaskParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func NewBetaToolLocalShellParam() BetaToolLocalShellParam {
+ return BetaToolLocalShellParam{
+ Type: "local_shell",
+ }
+}
+
+// A tool that allows the model to execute shell commands in a local environment.
+//
+// This struct has a constant value, construct it with
+// [NewBetaToolLocalShellParam].
+type BetaToolLocalShellParam struct {
+ // The type of the local shell tool. Always `local_shell`.
+ Type constant.LocalShell `json:"type" default:"local_shell"`
+ paramObj
+}
+
+func (r BetaToolLocalShellParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaToolLocalShellParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaToolLocalShellParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Constrains the tools available to the model to a pre-defined set.
+type BetaToolChoiceAllowed struct {
+ // Constrains the tools available to the model to a pre-defined set.
+ //
+ // `auto` allows the model to pick from among the allowed tools and generate a
+ // message.
+ //
+ // `required` requires the model to call one or more of the allowed tools.
+ //
+ // Any of "auto", "required".
+ Mode BetaToolChoiceAllowedMode `json:"mode" api:"required"`
+ // A list of tool definitions that the model should be allowed to call.
+ //
+ // For the Responses API, the list of tool definitions might look like:
+ //
+ // ```json
+ // [
+ //
+ // { "type": "function", "name": "get_weather" },
+ // { "type": "mcp", "server_label": "deepwiki" },
+ // { "type": "image_generation" }
+ //
+ // ]
+ // ```
+ Tools []map[string]any `json:"tools" api:"required"`
+ // Allowed tool configuration type. Always `allowed_tools`.
+ Type constant.AllowedTools `json:"type" default:"allowed_tools"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Mode respjson.Field
+ Tools respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaToolChoiceAllowed) RawJSON() string { return r.JSON.raw }
+func (r *BetaToolChoiceAllowed) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaToolChoiceAllowed to a BetaToolChoiceAllowedParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaToolChoiceAllowedParam.Overrides()
+func (r BetaToolChoiceAllowed) ToParam() BetaToolChoiceAllowedParam {
+ return param.Override[BetaToolChoiceAllowedParam](json.RawMessage(r.RawJSON()))
+}
+
+// Constrains the tools available to the model to a pre-defined set.
+//
+// `auto` allows the model to pick from among the allowed tools and generate a
+// message.
+//
+// `required` requires the model to call one or more of the allowed tools.
+type BetaToolChoiceAllowedMode string
+
+const (
+ BetaToolChoiceAllowedModeAuto BetaToolChoiceAllowedMode = "auto"
+ BetaToolChoiceAllowedModeRequired BetaToolChoiceAllowedMode = "required"
+)
+
+// Constrains the tools available to the model to a pre-defined set.
+//
+// The properties Mode, Tools, Type are required.
+type BetaToolChoiceAllowedParam struct {
+ // Constrains the tools available to the model to a pre-defined set.
+ //
+ // `auto` allows the model to pick from among the allowed tools and generate a
+ // message.
+ //
+ // `required` requires the model to call one or more of the allowed tools.
+ //
+ // Any of "auto", "required".
+ Mode BetaToolChoiceAllowedMode `json:"mode,omitzero" api:"required"`
+ // A list of tool definitions that the model should be allowed to call.
+ //
+ // For the Responses API, the list of tool definitions might look like:
+ //
+ // ```json
+ // [
+ //
+ // { "type": "function", "name": "get_weather" },
+ // { "type": "mcp", "server_label": "deepwiki" },
+ // { "type": "image_generation" }
+ //
+ // ]
+ // ```
+ Tools []map[string]any `json:"tools,omitzero" api:"required"`
+ // Allowed tool configuration type. Always `allowed_tools`.
+ //
+ // This field can be elided, and will marshal its zero value as "allowed_tools".
+ Type constant.AllowedTools `json:"type" default:"allowed_tools"`
+ paramObj
+}
+
+func (r BetaToolChoiceAllowedParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaToolChoiceAllowedParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaToolChoiceAllowedParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Forces the model to call the apply_patch tool when executing a tool call.
+type BetaToolChoiceApplyPatch struct {
+ // The tool to call. Always `apply_patch`.
+ Type constant.ApplyPatch `json:"type" default:"apply_patch"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaToolChoiceApplyPatch) RawJSON() string { return r.JSON.raw }
+func (r *BetaToolChoiceApplyPatch) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaToolChoiceApplyPatch to a
+// BetaToolChoiceApplyPatchParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaToolChoiceApplyPatchParam.Overrides()
+func (r BetaToolChoiceApplyPatch) ToParam() BetaToolChoiceApplyPatchParam {
+ return param.Override[BetaToolChoiceApplyPatchParam](json.RawMessage(r.RawJSON()))
+}
+
+func NewBetaToolChoiceApplyPatchParam() BetaToolChoiceApplyPatchParam {
+ return BetaToolChoiceApplyPatchParam{
+ Type: "apply_patch",
+ }
+}
+
+// Forces the model to call the apply_patch tool when executing a tool call.
+//
+// This struct has a constant value, construct it with
+// [NewBetaToolChoiceApplyPatchParam].
+type BetaToolChoiceApplyPatchParam struct {
+ // The tool to call. Always `apply_patch`.
+ Type constant.ApplyPatch `json:"type" default:"apply_patch"`
+ paramObj
+}
+
+func (r BetaToolChoiceApplyPatchParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaToolChoiceApplyPatchParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaToolChoiceApplyPatchParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Use this option to force the model to call a specific custom tool.
+type BetaToolChoiceCustom struct {
+ // The name of the custom tool to call.
+ Name string `json:"name" api:"required"`
+ // For custom tool calling, the type is always `custom`.
+ Type constant.Custom `json:"type" default:"custom"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Name respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaToolChoiceCustom) RawJSON() string { return r.JSON.raw }
+func (r *BetaToolChoiceCustom) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaToolChoiceCustom to a BetaToolChoiceCustomParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaToolChoiceCustomParam.Overrides()
+func (r BetaToolChoiceCustom) ToParam() BetaToolChoiceCustomParam {
+ return param.Override[BetaToolChoiceCustomParam](json.RawMessage(r.RawJSON()))
+}
+
+// Use this option to force the model to call a specific custom tool.
+//
+// The properties Name, Type are required.
+type BetaToolChoiceCustomParam struct {
+ // The name of the custom tool to call.
+ Name string `json:"name" api:"required"`
+ // For custom tool calling, the type is always `custom`.
+ //
+ // This field can be elided, and will marshal its zero value as "custom".
+ Type constant.Custom `json:"type" default:"custom"`
+ paramObj
+}
+
+func (r BetaToolChoiceCustomParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaToolChoiceCustomParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaToolChoiceCustomParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Use this option to force the model to call a specific function.
+type BetaToolChoiceFunction struct {
+ // The name of the function to call.
+ Name string `json:"name" api:"required"`
+ // For function calling, the type is always `function`.
+ Type constant.Function `json:"type" default:"function"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Name respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaToolChoiceFunction) RawJSON() string { return r.JSON.raw }
+func (r *BetaToolChoiceFunction) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaToolChoiceFunction to a BetaToolChoiceFunctionParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaToolChoiceFunctionParam.Overrides()
+func (r BetaToolChoiceFunction) ToParam() BetaToolChoiceFunctionParam {
+ return param.Override[BetaToolChoiceFunctionParam](json.RawMessage(r.RawJSON()))
+}
+
+// Use this option to force the model to call a specific function.
+//
+// The properties Name, Type are required.
+type BetaToolChoiceFunctionParam struct {
+ // The name of the function to call.
+ Name string `json:"name" api:"required"`
+ // For function calling, the type is always `function`.
+ //
+ // This field can be elided, and will marshal its zero value as "function".
+ Type constant.Function `json:"type" default:"function"`
+ paramObj
+}
+
+func (r BetaToolChoiceFunctionParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaToolChoiceFunctionParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaToolChoiceFunctionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Use this option to force the model to call a specific tool on a remote MCP
+// server.
+type BetaToolChoiceMcp struct {
+ // The label of the MCP server to use.
+ ServerLabel string `json:"server_label" api:"required"`
+ // For MCP tools, the type is always `mcp`.
+ Type constant.Mcp `json:"type" default:"mcp"`
+ // The name of the tool to call on the server.
+ Name string `json:"name" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ServerLabel respjson.Field
+ Type respjson.Field
+ Name respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaToolChoiceMcp) RawJSON() string { return r.JSON.raw }
+func (r *BetaToolChoiceMcp) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaToolChoiceMcp to a BetaToolChoiceMcpParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaToolChoiceMcpParam.Overrides()
+func (r BetaToolChoiceMcp) ToParam() BetaToolChoiceMcpParam {
+ return param.Override[BetaToolChoiceMcpParam](json.RawMessage(r.RawJSON()))
+}
+
+// Use this option to force the model to call a specific tool on a remote MCP
+// server.
+//
+// The properties ServerLabel, Type are required.
+type BetaToolChoiceMcpParam struct {
+ // The label of the MCP server to use.
+ ServerLabel string `json:"server_label" api:"required"`
+ // The name of the tool to call on the server.
+ Name param.Opt[string] `json:"name,omitzero"`
+ // For MCP tools, the type is always `mcp`.
+ //
+ // This field can be elided, and will marshal its zero value as "mcp".
+ Type constant.Mcp `json:"type" default:"mcp"`
+ paramObj
+}
+
+func (r BetaToolChoiceMcpParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaToolChoiceMcpParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaToolChoiceMcpParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Controls which (if any) tool is called by the model.
+//
+// `none` means the model will not call any tool and instead generates a message.
+//
+// `auto` means the model can pick between generating a message or calling one or
+// more tools.
+//
+// `required` means the model must call one or more tools.
+type BetaToolChoiceOptions string
+
+const (
+ BetaToolChoiceOptionsNone BetaToolChoiceOptions = "none"
+ BetaToolChoiceOptionsAuto BetaToolChoiceOptions = "auto"
+ BetaToolChoiceOptionsRequired BetaToolChoiceOptions = "required"
+)
+
+// Forces the model to call the shell tool when a tool call is required.
+type BetaToolChoiceShell struct {
+ // The tool to call. Always `shell`.
+ Type constant.Shell `json:"type" default:"shell"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaToolChoiceShell) RawJSON() string { return r.JSON.raw }
+func (r *BetaToolChoiceShell) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaToolChoiceShell to a BetaToolChoiceShellParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaToolChoiceShellParam.Overrides()
+func (r BetaToolChoiceShell) ToParam() BetaToolChoiceShellParam {
+ return param.Override[BetaToolChoiceShellParam](json.RawMessage(r.RawJSON()))
+}
+
+func NewBetaToolChoiceShellParam() BetaToolChoiceShellParam {
+ return BetaToolChoiceShellParam{
+ Type: "shell",
+ }
+}
+
+// Forces the model to call the shell tool when a tool call is required.
+//
+// This struct has a constant value, construct it with
+// [NewBetaToolChoiceShellParam].
+type BetaToolChoiceShellParam struct {
+ // The tool to call. Always `shell`.
+ Type constant.Shell `json:"type" default:"shell"`
+ paramObj
+}
+
+func (r BetaToolChoiceShellParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaToolChoiceShellParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaToolChoiceShellParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Indicates that the model should use a built-in tool to generate a response.
+// [Learn more about built-in tools](https://platform.openai.com/docs/guides/tools).
+type BetaToolChoiceTypes struct {
+ // The type of hosted tool the model should to use. Learn more about
+ // [built-in tools](https://platform.openai.com/docs/guides/tools).
+ //
+ // Allowed values are:
+ //
+ // - `file_search`
+ // - `web_search_preview`
+ // - `computer`
+ // - `computer_use_preview`
+ // - `computer_use`
+ // - `code_interpreter`
+ // - `image_generation`
+ //
+ // Any of "file_search", "web_search_preview", "computer", "computer_use_preview",
+ // "computer_use", "web_search_preview_2025_03_11", "image_generation",
+ // "code_interpreter".
+ Type BetaToolChoiceTypesType `json:"type" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaToolChoiceTypes) RawJSON() string { return r.JSON.raw }
+func (r *BetaToolChoiceTypes) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaToolChoiceTypes to a BetaToolChoiceTypesParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaToolChoiceTypesParam.Overrides()
+func (r BetaToolChoiceTypes) ToParam() BetaToolChoiceTypesParam {
+ return param.Override[BetaToolChoiceTypesParam](json.RawMessage(r.RawJSON()))
+}
+
+// The type of hosted tool the model should to use. Learn more about
+// [built-in tools](https://platform.openai.com/docs/guides/tools).
+//
+// Allowed values are:
+//
+// - `file_search`
+// - `web_search_preview`
+// - `computer`
+// - `computer_use_preview`
+// - `computer_use`
+// - `code_interpreter`
+// - `image_generation`
+type BetaToolChoiceTypesType string
+
+const (
+ BetaToolChoiceTypesTypeFileSearch BetaToolChoiceTypesType = "file_search"
+ BetaToolChoiceTypesTypeWebSearchPreview BetaToolChoiceTypesType = "web_search_preview"
+ BetaToolChoiceTypesTypeComputer BetaToolChoiceTypesType = "computer"
+ BetaToolChoiceTypesTypeComputerUsePreview BetaToolChoiceTypesType = "computer_use_preview"
+ BetaToolChoiceTypesTypeComputerUse BetaToolChoiceTypesType = "computer_use"
+ BetaToolChoiceTypesTypeWebSearchPreview2025_03_11 BetaToolChoiceTypesType = "web_search_preview_2025_03_11"
+ BetaToolChoiceTypesTypeImageGeneration BetaToolChoiceTypesType = "image_generation"
+ BetaToolChoiceTypesTypeCodeInterpreter BetaToolChoiceTypesType = "code_interpreter"
+)
+
+// Indicates that the model should use a built-in tool to generate a response.
+// [Learn more about built-in tools](https://platform.openai.com/docs/guides/tools).
+//
+// The property Type is required.
+type BetaToolChoiceTypesParam struct {
+ // The type of hosted tool the model should to use. Learn more about
+ // [built-in tools](https://platform.openai.com/docs/guides/tools).
+ //
+ // Allowed values are:
+ //
+ // - `file_search`
+ // - `web_search_preview`
+ // - `computer`
+ // - `computer_use_preview`
+ // - `computer_use`
+ // - `code_interpreter`
+ // - `image_generation`
+ //
+ // Any of "file_search", "web_search_preview", "computer", "computer_use_preview",
+ // "computer_use", "web_search_preview_2025_03_11", "image_generation",
+ // "code_interpreter".
+ Type BetaToolChoiceTypesType `json:"type,omitzero" api:"required"`
+ paramObj
+}
+
+func (r BetaToolChoiceTypesParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaToolChoiceTypesParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaToolChoiceTypesParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Hosted or BYOT tool search configuration for deferred tools.
+type BetaToolSearchTool struct {
+ // The type of the tool. Always `tool_search`.
+ Type constant.ToolSearch `json:"type" default:"tool_search"`
+ // Description shown to the model for a client-executed tool search tool.
+ Description string `json:"description" api:"nullable"`
+ // Whether tool search is executed by the server or by the client.
+ //
+ // Any of "server", "client".
+ Execution BetaToolSearchToolExecution `json:"execution"`
+ // Parameter schema for a client-executed tool search tool.
+ Parameters any `json:"parameters" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ Description respjson.Field
+ Execution respjson.Field
+ Parameters respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaToolSearchTool) RawJSON() string { return r.JSON.raw }
+func (r *BetaToolSearchTool) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaToolSearchTool to a BetaToolSearchToolParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaToolSearchToolParam.Overrides()
+func (r BetaToolSearchTool) ToParam() BetaToolSearchToolParam {
+ return param.Override[BetaToolSearchToolParam](json.RawMessage(r.RawJSON()))
+}
+
+// Whether tool search is executed by the server or by the client.
+type BetaToolSearchToolExecution string
+
+const (
+ BetaToolSearchToolExecutionServer BetaToolSearchToolExecution = "server"
+ BetaToolSearchToolExecutionClient BetaToolSearchToolExecution = "client"
+)
+
+// Hosted or BYOT tool search configuration for deferred tools.
+//
+// The property Type is required.
+type BetaToolSearchToolParam struct {
+ // Description shown to the model for a client-executed tool search tool.
+ Description param.Opt[string] `json:"description,omitzero"`
+ // Parameter schema for a client-executed tool search tool.
+ Parameters any `json:"parameters,omitzero"`
+ // Whether tool search is executed by the server or by the client.
+ //
+ // Any of "server", "client".
+ Execution BetaToolSearchToolExecution `json:"execution,omitzero"`
+ // The type of the tool. Always `tool_search`.
+ //
+ // This field can be elided, and will marshal its zero value as "tool_search".
+ Type constant.ToolSearch `json:"type" default:"tool_search"`
+ paramObj
+}
+
+func (r BetaToolSearchToolParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaToolSearchToolParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaToolSearchToolParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// This tool searches the web for relevant results to use in a response. Learn more
+// about the
+// [web search tool](https://platform.openai.com/docs/guides/tools-web-search).
+type BetaWebSearchPreviewTool struct {
+ // The type of the web search tool. One of `web_search_preview` or
+ // `web_search_preview_2025_03_11`.
+ //
+ // Any of "web_search_preview", "web_search_preview_2025_03_11".
+ Type BetaWebSearchPreviewToolType `json:"type" api:"required"`
+ // Any of "text", "image".
+ SearchContentTypes []string `json:"search_content_types"`
+ // High level guidance for the amount of context window space to use for the
+ // search. One of `low`, `medium`, or `high`. `medium` is the default.
+ //
+ // Any of "low", "medium", "high".
+ SearchContextSize BetaWebSearchPreviewToolSearchContextSize `json:"search_context_size"`
+ // The user's location.
+ UserLocation BetaWebSearchPreviewToolUserLocation `json:"user_location" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ SearchContentTypes respjson.Field
+ SearchContextSize respjson.Field
+ UserLocation respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaWebSearchPreviewTool) RawJSON() string { return r.JSON.raw }
+func (r *BetaWebSearchPreviewTool) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaWebSearchPreviewTool to a
+// BetaWebSearchPreviewToolParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaWebSearchPreviewToolParam.Overrides()
+func (r BetaWebSearchPreviewTool) ToParam() BetaWebSearchPreviewToolParam {
+ return param.Override[BetaWebSearchPreviewToolParam](json.RawMessage(r.RawJSON()))
+}
+
+// The type of the web search tool. One of `web_search_preview` or
+// `web_search_preview_2025_03_11`.
+type BetaWebSearchPreviewToolType string
+
+const (
+ BetaWebSearchPreviewToolTypeWebSearchPreview BetaWebSearchPreviewToolType = "web_search_preview"
+ BetaWebSearchPreviewToolTypeWebSearchPreview2025_03_11 BetaWebSearchPreviewToolType = "web_search_preview_2025_03_11"
+)
+
+// High level guidance for the amount of context window space to use for the
+// search. One of `low`, `medium`, or `high`. `medium` is the default.
+type BetaWebSearchPreviewToolSearchContextSize string
+
+const (
+ BetaWebSearchPreviewToolSearchContextSizeLow BetaWebSearchPreviewToolSearchContextSize = "low"
+ BetaWebSearchPreviewToolSearchContextSizeMedium BetaWebSearchPreviewToolSearchContextSize = "medium"
+ BetaWebSearchPreviewToolSearchContextSizeHigh BetaWebSearchPreviewToolSearchContextSize = "high"
+)
+
+// The user's location.
+type BetaWebSearchPreviewToolUserLocation struct {
+ // The type of location approximation. Always `approximate`.
+ Type constant.Approximate `json:"type" default:"approximate"`
+ // Free text input for the city of the user, e.g. `San Francisco`.
+ City string `json:"city" api:"nullable"`
+ // The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of
+ // the user, e.g. `US`.
+ Country string `json:"country" api:"nullable"`
+ // Free text input for the region of the user, e.g. `California`.
+ Region string `json:"region" api:"nullable"`
+ // The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the
+ // user, e.g. `America/Los_Angeles`.
+ Timezone string `json:"timezone" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ City respjson.Field
+ Country respjson.Field
+ Region respjson.Field
+ Timezone respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaWebSearchPreviewToolUserLocation) RawJSON() string { return r.JSON.raw }
+func (r *BetaWebSearchPreviewToolUserLocation) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// This tool searches the web for relevant results to use in a response. Learn more
+// about the
+// [web search tool](https://platform.openai.com/docs/guides/tools-web-search).
+//
+// The property Type is required.
+type BetaWebSearchPreviewToolParam struct {
+ // The type of the web search tool. One of `web_search_preview` or
+ // `web_search_preview_2025_03_11`.
+ //
+ // Any of "web_search_preview", "web_search_preview_2025_03_11".
+ Type BetaWebSearchPreviewToolType `json:"type,omitzero" api:"required"`
+ // The user's location.
+ UserLocation BetaWebSearchPreviewToolUserLocationParam `json:"user_location,omitzero"`
+ // Any of "text", "image".
+ SearchContentTypes []string `json:"search_content_types,omitzero"`
+ // High level guidance for the amount of context window space to use for the
+ // search. One of `low`, `medium`, or `high`. `medium` is the default.
+ //
+ // Any of "low", "medium", "high".
+ SearchContextSize BetaWebSearchPreviewToolSearchContextSize `json:"search_context_size,omitzero"`
+ paramObj
+}
+
+func (r BetaWebSearchPreviewToolParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaWebSearchPreviewToolParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaWebSearchPreviewToolParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The user's location.
+//
+// The property Type is required.
+type BetaWebSearchPreviewToolUserLocationParam struct {
+ // Free text input for the city of the user, e.g. `San Francisco`.
+ City param.Opt[string] `json:"city,omitzero"`
+ // The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of
+ // the user, e.g. `US`.
+ Country param.Opt[string] `json:"country,omitzero"`
+ // Free text input for the region of the user, e.g. `California`.
+ Region param.Opt[string] `json:"region,omitzero"`
+ // The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the
+ // user, e.g. `America/Los_Angeles`.
+ Timezone param.Opt[string] `json:"timezone,omitzero"`
+ // The type of location approximation. Always `approximate`.
+ //
+ // This field can be elided, and will marshal its zero value as "approximate".
+ Type constant.Approximate `json:"type" default:"approximate"`
+ paramObj
+}
+
+func (r BetaWebSearchPreviewToolUserLocationParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaWebSearchPreviewToolUserLocationParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaWebSearchPreviewToolUserLocationParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Search the Internet for sources related to the prompt. Learn more about the
+// [web search tool](https://platform.openai.com/docs/guides/tools-web-search).
+type BetaWebSearchTool struct {
+ // The type of the web search tool. One of `web_search` or `web_search_2025_08_26`.
+ //
+ // Any of "web_search", "web_search_2025_08_26".
+ Type BetaWebSearchToolType `json:"type" api:"required"`
+ // Filters for the search.
+ Filters BetaWebSearchToolFilters `json:"filters" api:"nullable"`
+ // High level guidance for the amount of context window space to use for the
+ // search. One of `low`, `medium`, or `high`. `medium` is the default.
+ //
+ // Any of "low", "medium", "high".
+ SearchContextSize BetaWebSearchToolSearchContextSize `json:"search_context_size"`
+ // The approximate location of the user.
+ UserLocation BetaWebSearchToolUserLocation `json:"user_location" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ Filters respjson.Field
+ SearchContextSize respjson.Field
+ UserLocation respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaWebSearchTool) RawJSON() string { return r.JSON.raw }
+func (r *BetaWebSearchTool) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this BetaWebSearchTool to a BetaWebSearchToolParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// BetaWebSearchToolParam.Overrides()
+func (r BetaWebSearchTool) ToParam() BetaWebSearchToolParam {
+ return param.Override[BetaWebSearchToolParam](json.RawMessage(r.RawJSON()))
+}
+
+// The type of the web search tool. One of `web_search` or `web_search_2025_08_26`.
+type BetaWebSearchToolType string
+
+const (
+ BetaWebSearchToolTypeWebSearch BetaWebSearchToolType = "web_search"
+ BetaWebSearchToolTypeWebSearch2025_08_26 BetaWebSearchToolType = "web_search_2025_08_26"
+)
+
+// Filters for the search.
+type BetaWebSearchToolFilters struct {
+ // Allowed domains for the search. If not provided, all domains are allowed.
+ // Subdomains of the provided domains are allowed as well.
+ //
+ // Example: `["pubmed.ncbi.nlm.nih.gov"]`
+ AllowedDomains []string `json:"allowed_domains" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AllowedDomains respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaWebSearchToolFilters) RawJSON() string { return r.JSON.raw }
+func (r *BetaWebSearchToolFilters) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// High level guidance for the amount of context window space to use for the
+// search. One of `low`, `medium`, or `high`. `medium` is the default.
+type BetaWebSearchToolSearchContextSize string
+
+const (
+ BetaWebSearchToolSearchContextSizeLow BetaWebSearchToolSearchContextSize = "low"
+ BetaWebSearchToolSearchContextSizeMedium BetaWebSearchToolSearchContextSize = "medium"
+ BetaWebSearchToolSearchContextSizeHigh BetaWebSearchToolSearchContextSize = "high"
+)
+
+// The approximate location of the user.
+type BetaWebSearchToolUserLocation struct {
+ // Free text input for the city of the user, e.g. `San Francisco`.
+ City string `json:"city" api:"nullable"`
+ // The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of
+ // the user, e.g. `US`.
+ Country string `json:"country" api:"nullable"`
+ // Free text input for the region of the user, e.g. `California`.
+ Region string `json:"region" api:"nullable"`
+ // The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the
+ // user, e.g. `America/Los_Angeles`.
+ Timezone string `json:"timezone" api:"nullable"`
+ // The type of location approximation. Always `approximate`.
+ //
+ // Any of "approximate".
+ Type string `json:"type"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ City respjson.Field
+ Country respjson.Field
+ Region respjson.Field
+ Timezone respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaWebSearchToolUserLocation) RawJSON() string { return r.JSON.raw }
+func (r *BetaWebSearchToolUserLocation) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Search the Internet for sources related to the prompt. Learn more about the
+// [web search tool](https://platform.openai.com/docs/guides/tools-web-search).
+//
+// The property Type is required.
+type BetaWebSearchToolParam struct {
+ // The type of the web search tool. One of `web_search` or `web_search_2025_08_26`.
+ //
+ // Any of "web_search", "web_search_2025_08_26".
+ Type BetaWebSearchToolType `json:"type,omitzero" api:"required"`
+ // Filters for the search.
+ Filters BetaWebSearchToolFiltersParam `json:"filters,omitzero"`
+ // The approximate location of the user.
+ UserLocation BetaWebSearchToolUserLocationParam `json:"user_location,omitzero"`
+ // High level guidance for the amount of context window space to use for the
+ // search. One of `low`, `medium`, or `high`. `medium` is the default.
+ //
+ // Any of "low", "medium", "high".
+ SearchContextSize BetaWebSearchToolSearchContextSize `json:"search_context_size,omitzero"`
+ paramObj
+}
+
+func (r BetaWebSearchToolParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaWebSearchToolParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaWebSearchToolParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Filters for the search.
+type BetaWebSearchToolFiltersParam struct {
+ // Allowed domains for the search. If not provided, all domains are allowed.
+ // Subdomains of the provided domains are allowed as well.
+ //
+ // Example: `["pubmed.ncbi.nlm.nih.gov"]`
+ AllowedDomains []string `json:"allowed_domains,omitzero"`
+ paramObj
+}
+
+func (r BetaWebSearchToolFiltersParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaWebSearchToolFiltersParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaWebSearchToolFiltersParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The approximate location of the user.
+type BetaWebSearchToolUserLocationParam struct {
+ // Free text input for the city of the user, e.g. `San Francisco`.
+ City param.Opt[string] `json:"city,omitzero"`
+ // The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of
+ // the user, e.g. `US`.
+ Country param.Opt[string] `json:"country,omitzero"`
+ // Free text input for the region of the user, e.g. `California`.
+ Region param.Opt[string] `json:"region,omitzero"`
+ // The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the
+ // user, e.g. `America/Los_Angeles`.
+ Timezone param.Opt[string] `json:"timezone,omitzero"`
+ // The type of location approximation. Always `approximate`.
+ //
+ // Any of "approximate".
+ Type string `json:"type,omitzero"`
+ paramObj
+}
+
+func (r BetaWebSearchToolUserLocationParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaWebSearchToolUserLocationParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaWebSearchToolUserLocationParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaWebSearchToolUserLocationParam](
+ "type", "approximate",
+ )
+}
+
+type BetaResponseNewParams struct {
+ // Whether to run the model response in the background.
+ // [Learn more](https://platform.openai.com/docs/guides/background).
+ Background param.Opt[bool] `json:"background,omitzero"`
+ // A system (or developer) message inserted into the model's context.
+ //
+ // When using along with `previous_response_id`, the instructions from a previous
+ // response will not be carried over to the next response. This makes it simple to
+ // swap out system (or developer) messages in new responses.
+ Instructions param.Opt[string] `json:"instructions,omitzero"`
+ // An upper bound for the number of tokens that can be generated for a response,
+ // including visible output tokens and
+ // [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).
+ MaxOutputTokens param.Opt[int64] `json:"max_output_tokens,omitzero"`
+ // The maximum number of total calls to built-in tools that can be processed in a
+ // response. This maximum number applies across all built-in tool calls, not per
+ // individual tool. Any further attempts to call a tool by the model will be
+ // ignored.
+ MaxToolCalls param.Opt[int64] `json:"max_tool_calls,omitzero"`
+ // Whether to allow the model to run tool calls in parallel.
+ ParallelToolCalls param.Opt[bool] `json:"parallel_tool_calls,omitzero"`
+ // The unique ID of the previous response to the model. Use this to create
+ // multi-turn conversations. Learn more about
+ // [conversation state](https://platform.openai.com/docs/guides/conversation-state).
+ // Cannot be used in conjunction with `conversation`.
+ PreviousResponseID param.Opt[string] `json:"previous_response_id,omitzero"`
+ // Used by OpenAI to cache responses for similar requests to optimize your cache
+ // hit rates. Replaces the `user` field.
+ // [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
+ PromptCacheKey param.Opt[string] `json:"prompt_cache_key,omitzero"`
+ // A stable identifier used to help detect users of your application that may be
+ // violating OpenAI's usage policies. The IDs should be a string that uniquely
+ // identifies each user, with a maximum length of 64 characters. We recommend
+ // hashing their username or email address, in order to avoid sending us any
+ // identifying information.
+ // [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
+ SafetyIdentifier param.Opt[string] `json:"safety_identifier,omitzero"`
+ // Whether to store the generated model response for later retrieval via API.
+ Store param.Opt[bool] `json:"store,omitzero"`
+ // What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
+ // make the output more random, while lower values like 0.2 will make it more
+ // focused and deterministic. We generally recommend altering this or `top_p` but
+ // not both.
+ Temperature param.Opt[float64] `json:"temperature,omitzero"`
+ // An integer between 0 and 20 specifying the maximum number of most likely tokens
+ // to return at each token position, each with an associated log probability. In
+ // some cases, the number of returned tokens may be fewer than requested.
+ TopLogprobs param.Opt[int64] `json:"top_logprobs,omitzero"`
+ // An alternative to sampling with temperature, called nucleus sampling, where the
+ // model considers the results of the tokens with top_p probability mass. So 0.1
+ // means only the tokens comprising the top 10% probability mass are considered.
+ //
+ // We generally recommend altering this or `temperature` but not both.
+ TopP param.Opt[float64] `json:"top_p,omitzero"`
+ // This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use
+ // `prompt_cache_key` instead to maintain caching optimizations. A stable
+ // identifier for your end-users. Used to boost cache hit rates by better bucketing
+ // similar requests and to help OpenAI detect and prevent abuse.
+ // [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
+ User param.Opt[string] `json:"user,omitzero"`
+ // Context management configuration for this request.
+ ContextManagement []BetaResponseNewParamsContextManagement `json:"context_management,omitzero"`
+ // The conversation that this response belongs to. Items from this conversation are
+ // prepended to `input_items` for this response request. Input items and output
+ // items from this response are automatically added to this conversation after this
+ // response completes.
+ Conversation BetaResponseNewParamsConversationUnion `json:"conversation,omitzero"`
+ // Specify additional output data to include in the model response. Currently
+ // supported values are:
+ //
+ // - `web_search_call.action.sources`: Include the sources of the web search tool
+ // call.
+ // - `code_interpreter_call.outputs`: Includes the outputs of python code execution
+ // in code interpreter tool call items.
+ // - `computer_call_output.output.image_url`: Include image urls from the computer
+ // call output.
+ // - `file_search_call.results`: Include the search results of the file search tool
+ // call.
+ // - `message.input_image.image_url`: Include image urls from the input message.
+ // - `message.output_text.logprobs`: Include logprobs with assistant messages.
+ // - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
+ // tokens in reasoning item outputs. This enables reasoning items to be used in
+ // multi-turn conversations when using the Responses API statelessly (like when
+ // the `store` parameter is set to `false`, or when an organization is enrolled
+ // in the zero data retention program).
+ Include []BetaResponseIncludable `json:"include,omitzero"`
+ // Set of 16 key-value pairs that can be attached to an object. This can be useful
+ // for storing additional information about the object in a structured format, and
+ // querying for objects via API or the dashboard.
+ //
+ // Keys are strings with a maximum length of 64 characters. Values are strings with
+ // a maximum length of 512 characters.
+ Metadata map[string]string `json:"metadata,omitzero"`
+ // Configuration for running moderation on the input and output of this response.
+ Moderation BetaResponseNewParamsModeration `json:"moderation,omitzero"`
+ // Configuration for server-hosted multi-agent execution.
+ MultiAgent BetaResponseNewParamsMultiAgent `json:"multi_agent,omitzero"`
+ // Reference to a prompt template and its variables.
+ // [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
+ Prompt BetaResponsePromptParam `json:"prompt,omitzero"`
+ // Deprecated. Use `prompt_cache_options.ttl` instead.
+ //
+ // The retention policy for the prompt cache. Set to `24h` to enable extended
+ // prompt caching, which keeps cached prefixes active for longer, up to a maximum
+ // of 24 hours.
+ // [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
+ // This field expresses a maximum retention policy, while
+ // `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
+ // are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
+ // models, only `24h` is supported.
+ //
+ // For older models that support both `in_memory` and `24h`, the default depends on
+ // your organization's data retention policy:
+ //
+ // - Organizations without ZDR enabled default to `24h`.
+ // - Organizations with ZDR enabled default to `in_memory` when
+ // `prompt_cache_retention` is not specified.
+ //
+ // Any of "in_memory", "24h".
+ PromptCacheRetention BetaResponseNewParamsPromptCacheRetention `json:"prompt_cache_retention,omitzero"`
+ // **gpt-5 and o-series models only**
+ //
+ // Configuration options for
+ // [reasoning models](https://platform.openai.com/docs/guides/reasoning).
+ Reasoning BetaResponseNewParamsReasoning `json:"reasoning,omitzero"`
+ // Specifies the processing type used for serving the request.
+ //
+ // - If set to 'auto', then the request will be processed with the service tier
+ // configured in the Project settings. Unless otherwise configured, the Project
+ // will use 'default'.
+ // - If set to 'default', then the request will be processed with the standard
+ // pricing and performance for the selected model.
+ // - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
+ // '[priority](https://openai.com/api-priority-processing/)', then the request
+ // will be processed with the corresponding service tier.
+ // - When not set, the default behavior is 'auto'.
+ //
+ // When the `service_tier` parameter is set, the response body will include the
+ // `service_tier` value based on the processing mode actually used to serve the
+ // request. This response value may be different from the value set in the
+ // parameter.
+ //
+ // Any of "auto", "default", "flex", "scale", "priority".
+ ServiceTier BetaResponseNewParamsServiceTier `json:"service_tier,omitzero"`
+ // Options for streaming responses. Only set this when you set `stream: true`.
+ StreamOptions BetaResponseNewParamsStreamOptions `json:"stream_options,omitzero"`
+ // The truncation strategy to use for the model response.
+ //
+ // - `auto`: If the input to this Response exceeds the model's context window size,
+ // the model will truncate the response to fit the context window by dropping
+ // items from the beginning of the conversation.
+ // - `disabled` (default): If the input size will exceed the context window size
+ // for a model, the request will fail with a 400 error.
+ //
+ // Any of "auto", "disabled".
+ Truncation BetaResponseNewParamsTruncation `json:"truncation,omitzero"`
+ // Text, image, or file inputs to the model, used to generate a response.
+ //
+ // Learn more:
+ //
+ // - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
+ // - [Image inputs](https://platform.openai.com/docs/guides/images)
+ // - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
+ // - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
+ // - [Function calling](https://platform.openai.com/docs/guides/function-calling)
+ Input BetaResponseNewParamsInputUnion `json:"input,omitzero"`
+ // Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
+ // wide range of models with different capabilities, performance characteristics,
+ // and price points. Refer to the
+ // [model guide](https://platform.openai.com/docs/models) to browse and compare
+ // available models.
+ Model BetaResponseNewParamsModel `json:"model,omitzero"`
+ // Options for prompt caching. Supported for `gpt-5.6` and later models. By
+ // default, OpenAI automatically chooses one implicit cache breakpoint. You can add
+ // explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
+ // request can write up to four breakpoints. For cache matching, OpenAI considers
+ // up to the latest 80 breakpoints in the conversation, without a content-block
+ // lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
+ // `ttl` defaults to `30m`, which is currently the only supported value. See the
+ // [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
+ // for current details.
+ PromptCacheOptions BetaResponseNewParamsPromptCacheOptions `json:"prompt_cache_options,omitzero"`
+ // Configuration options for a text response from the model. Can be plain text or
+ // structured JSON data. Learn more:
+ //
+ // - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
+ // - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
+ Text BetaResponseTextConfigParam `json:"text,omitzero"`
+ // How the model should select which tool (or tools) to use when generating a
+ // response. See the `tools` parameter to see how to specify which tools the model
+ // can call.
+ ToolChoice BetaResponseNewParamsToolChoiceUnion `json:"tool_choice,omitzero"`
+ // An array of tools the model may call while generating a response. You can
+ // specify which tool to use by setting the `tool_choice` parameter.
+ //
+ // We support the following categories of tools:
+ //
+ // - **Built-in tools**: Tools that are provided by OpenAI that extend the model's
+ // capabilities, like
+ // [web search](https://platform.openai.com/docs/guides/tools-web-search) or
+ // [file search](https://platform.openai.com/docs/guides/tools-file-search).
+ // Learn more about
+ // [built-in tools](https://platform.openai.com/docs/guides/tools).
+ // - **MCP Tools**: Integrations with third-party systems via custom MCP servers or
+ // predefined connectors such as Google Drive and SharePoint. Learn more about
+ // [MCP Tools](https://platform.openai.com/docs/guides/tools-connectors-mcp).
+ // - **Function calls (custom tools)**: Functions that are defined by you, enabling
+ // the model to call your own code with strongly typed arguments and outputs.
+ // Learn more about
+ // [function calling](https://platform.openai.com/docs/guides/function-calling).
+ // You can also use custom tools to call your own code.
+ Tools []BetaToolUnionParam `json:"tools,omitzero"`
+ // Any of "responses_multi_agent=v1".
+ Betas []string `header:"openai-beta,omitzero" json:"-"`
+ paramObj
+}
+
+func (r BetaResponseNewParams) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseNewParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseNewParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The property Type is required.
+type BetaResponseNewParamsContextManagement struct {
+ // The context management entry type. Currently only 'compaction' is supported.
+ Type string `json:"type" api:"required"`
+ // Token threshold at which compaction should be triggered for this entry.
+ CompactThreshold param.Opt[int64] `json:"compact_threshold,omitzero"`
+ paramObj
+}
+
+func (r BetaResponseNewParamsContextManagement) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseNewParamsContextManagement
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseNewParamsContextManagement) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseNewParamsConversationUnion struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfConversationObject *BetaResponseConversationParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseNewParamsConversationUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfConversationObject)
+}
+func (u *BetaResponseNewParamsConversationUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseNewParamsConversationUnion) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfConversationObject) {
+ return u.OfConversationObject
+ }
+ return nil
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseNewParamsInputUnion struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfInputItemList BetaResponseInputParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseNewParamsInputUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfInputItemList)
+}
+func (u *BetaResponseNewParamsInputUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseNewParamsInputUnion) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfInputItemList) {
+ return &u.OfInputItemList
+ }
+ return nil
+}
+
+// Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
+// wide range of models with different capabilities, performance characteristics,
+// and price points. Refer to the
+// [model guide](https://platform.openai.com/docs/models) to browse and compare
+// available models.
+type BetaResponseNewParamsModel string
+
+const (
+ BetaResponseNewParamsModelGPT5_6Sol BetaResponseNewParamsModel = "gpt-5.6-sol"
+ BetaResponseNewParamsModelGPT5_6Terra BetaResponseNewParamsModel = "gpt-5.6-terra"
+ BetaResponseNewParamsModelGPT5_6Luna BetaResponseNewParamsModel = "gpt-5.6-luna"
+ BetaResponseNewParamsModelGPT5_4 BetaResponseNewParamsModel = "gpt-5.4"
+ BetaResponseNewParamsModelGPT5_4Mini BetaResponseNewParamsModel = "gpt-5.4-mini"
+ BetaResponseNewParamsModelGPT5_4Nano BetaResponseNewParamsModel = "gpt-5.4-nano"
+ BetaResponseNewParamsModelGPT5_4Mini2026_03_17 BetaResponseNewParamsModel = "gpt-5.4-mini-2026-03-17"
+ BetaResponseNewParamsModelGPT5_4Nano2026_03_17 BetaResponseNewParamsModel = "gpt-5.4-nano-2026-03-17"
+ BetaResponseNewParamsModelGPT5_3ChatLatest BetaResponseNewParamsModel = "gpt-5.3-chat-latest"
+ BetaResponseNewParamsModelGPT5_2 BetaResponseNewParamsModel = "gpt-5.2"
+ BetaResponseNewParamsModelGPT5_2_2025_12_11 BetaResponseNewParamsModel = "gpt-5.2-2025-12-11"
+ BetaResponseNewParamsModelGPT5_2ChatLatest BetaResponseNewParamsModel = "gpt-5.2-chat-latest"
+ BetaResponseNewParamsModelGPT5_2Pro BetaResponseNewParamsModel = "gpt-5.2-pro"
+ BetaResponseNewParamsModelGPT5_2Pro2025_12_11 BetaResponseNewParamsModel = "gpt-5.2-pro-2025-12-11"
+ BetaResponseNewParamsModelGPT5_1 BetaResponseNewParamsModel = "gpt-5.1"
+ BetaResponseNewParamsModelGPT5_1_2025_11_13 BetaResponseNewParamsModel = "gpt-5.1-2025-11-13"
+ BetaResponseNewParamsModelGPT5_1Codex BetaResponseNewParamsModel = "gpt-5.1-codex"
+ BetaResponseNewParamsModelGPT5_1Mini BetaResponseNewParamsModel = "gpt-5.1-mini"
+ BetaResponseNewParamsModelGPT5_1ChatLatest BetaResponseNewParamsModel = "gpt-5.1-chat-latest"
+ BetaResponseNewParamsModelGPT5 BetaResponseNewParamsModel = "gpt-5"
+ BetaResponseNewParamsModelGPT5Mini BetaResponseNewParamsModel = "gpt-5-mini"
+ BetaResponseNewParamsModelGPT5Nano BetaResponseNewParamsModel = "gpt-5-nano"
+ BetaResponseNewParamsModelGPT5_2025_08_07 BetaResponseNewParamsModel = "gpt-5-2025-08-07"
+ BetaResponseNewParamsModelGPT5Mini2025_08_07 BetaResponseNewParamsModel = "gpt-5-mini-2025-08-07"
+ BetaResponseNewParamsModelGPT5Nano2025_08_07 BetaResponseNewParamsModel = "gpt-5-nano-2025-08-07"
+ BetaResponseNewParamsModelGPT5ChatLatest BetaResponseNewParamsModel = "gpt-5-chat-latest"
+ BetaResponseNewParamsModelGPT4_1 BetaResponseNewParamsModel = "gpt-4.1"
+ BetaResponseNewParamsModelGPT4_1Mini BetaResponseNewParamsModel = "gpt-4.1-mini"
+ BetaResponseNewParamsModelGPT4_1Nano BetaResponseNewParamsModel = "gpt-4.1-nano"
+ BetaResponseNewParamsModelGPT4_1_2025_04_14 BetaResponseNewParamsModel = "gpt-4.1-2025-04-14"
+ BetaResponseNewParamsModelGPT4_1Mini2025_04_14 BetaResponseNewParamsModel = "gpt-4.1-mini-2025-04-14"
+ BetaResponseNewParamsModelGPT4_1Nano2025_04_14 BetaResponseNewParamsModel = "gpt-4.1-nano-2025-04-14"
+ BetaResponseNewParamsModelO4Mini BetaResponseNewParamsModel = "o4-mini"
+ BetaResponseNewParamsModelO4Mini2025_04_16 BetaResponseNewParamsModel = "o4-mini-2025-04-16"
+ BetaResponseNewParamsModelO3 BetaResponseNewParamsModel = "o3"
+ BetaResponseNewParamsModelO3_2025_04_16 BetaResponseNewParamsModel = "o3-2025-04-16"
+ BetaResponseNewParamsModelO3Mini BetaResponseNewParamsModel = "o3-mini"
+ BetaResponseNewParamsModelO3Mini2025_01_31 BetaResponseNewParamsModel = "o3-mini-2025-01-31"
+ BetaResponseNewParamsModelO1 BetaResponseNewParamsModel = "o1"
+ BetaResponseNewParamsModelO1_2024_12_17 BetaResponseNewParamsModel = "o1-2024-12-17"
+ BetaResponseNewParamsModelO1Preview BetaResponseNewParamsModel = "o1-preview"
+ BetaResponseNewParamsModelO1Preview2024_09_12 BetaResponseNewParamsModel = "o1-preview-2024-09-12"
+ BetaResponseNewParamsModelO1Mini BetaResponseNewParamsModel = "o1-mini"
+ BetaResponseNewParamsModelO1Mini2024_09_12 BetaResponseNewParamsModel = "o1-mini-2024-09-12"
+ BetaResponseNewParamsModelGPT4o BetaResponseNewParamsModel = "gpt-4o"
+ BetaResponseNewParamsModelGPT4o2024_11_20 BetaResponseNewParamsModel = "gpt-4o-2024-11-20"
+ BetaResponseNewParamsModelGPT4o2024_08_06 BetaResponseNewParamsModel = "gpt-4o-2024-08-06"
+ BetaResponseNewParamsModelGPT4o2024_05_13 BetaResponseNewParamsModel = "gpt-4o-2024-05-13"
+ BetaResponseNewParamsModelGPT4oAudioPreview BetaResponseNewParamsModel = "gpt-4o-audio-preview"
+ BetaResponseNewParamsModelGPT4oAudioPreview2024_10_01 BetaResponseNewParamsModel = "gpt-4o-audio-preview-2024-10-01"
+ BetaResponseNewParamsModelGPT4oAudioPreview2024_12_17 BetaResponseNewParamsModel = "gpt-4o-audio-preview-2024-12-17"
+ BetaResponseNewParamsModelGPT4oAudioPreview2025_06_03 BetaResponseNewParamsModel = "gpt-4o-audio-preview-2025-06-03"
+ BetaResponseNewParamsModelGPT4oMiniAudioPreview BetaResponseNewParamsModel = "gpt-4o-mini-audio-preview"
+ BetaResponseNewParamsModelGPT4oMiniAudioPreview2024_12_17 BetaResponseNewParamsModel = "gpt-4o-mini-audio-preview-2024-12-17"
+ BetaResponseNewParamsModelGPT4oSearchPreview BetaResponseNewParamsModel = "gpt-4o-search-preview"
+ BetaResponseNewParamsModelGPT4oMiniSearchPreview BetaResponseNewParamsModel = "gpt-4o-mini-search-preview"
+ BetaResponseNewParamsModelGPT4oSearchPreview2025_03_11 BetaResponseNewParamsModel = "gpt-4o-search-preview-2025-03-11"
+ BetaResponseNewParamsModelGPT4oMiniSearchPreview2025_03_11 BetaResponseNewParamsModel = "gpt-4o-mini-search-preview-2025-03-11"
+ BetaResponseNewParamsModelChatgpt4oLatest BetaResponseNewParamsModel = "chatgpt-4o-latest"
+ BetaResponseNewParamsModelCodexMiniLatest BetaResponseNewParamsModel = "codex-mini-latest"
+ BetaResponseNewParamsModelGPT4oMini BetaResponseNewParamsModel = "gpt-4o-mini"
+ BetaResponseNewParamsModelGPT4oMini2024_07_18 BetaResponseNewParamsModel = "gpt-4o-mini-2024-07-18"
+ BetaResponseNewParamsModelGPT4Turbo BetaResponseNewParamsModel = "gpt-4-turbo"
+ BetaResponseNewParamsModelGPT4Turbo2024_04_09 BetaResponseNewParamsModel = "gpt-4-turbo-2024-04-09"
+ BetaResponseNewParamsModelGPT4_0125Preview BetaResponseNewParamsModel = "gpt-4-0125-preview"
+ BetaResponseNewParamsModelGPT4TurboPreview BetaResponseNewParamsModel = "gpt-4-turbo-preview"
+ BetaResponseNewParamsModelGPT4_1106Preview BetaResponseNewParamsModel = "gpt-4-1106-preview"
+ BetaResponseNewParamsModelGPT4VisionPreview BetaResponseNewParamsModel = "gpt-4-vision-preview"
+ BetaResponseNewParamsModelGPT4 BetaResponseNewParamsModel = "gpt-4"
+ BetaResponseNewParamsModelGPT4_0314 BetaResponseNewParamsModel = "gpt-4-0314"
+ BetaResponseNewParamsModelGPT4_0613 BetaResponseNewParamsModel = "gpt-4-0613"
+ BetaResponseNewParamsModelGPT4_32k BetaResponseNewParamsModel = "gpt-4-32k"
+ BetaResponseNewParamsModelGPT4_32k0314 BetaResponseNewParamsModel = "gpt-4-32k-0314"
+ BetaResponseNewParamsModelGPT4_32k0613 BetaResponseNewParamsModel = "gpt-4-32k-0613"
+ BetaResponseNewParamsModelGPT3_5Turbo BetaResponseNewParamsModel = "gpt-3.5-turbo"
+ BetaResponseNewParamsModelGPT3_5Turbo16k BetaResponseNewParamsModel = "gpt-3.5-turbo-16k"
+ BetaResponseNewParamsModelGPT3_5Turbo0301 BetaResponseNewParamsModel = "gpt-3.5-turbo-0301"
+ BetaResponseNewParamsModelGPT3_5Turbo0613 BetaResponseNewParamsModel = "gpt-3.5-turbo-0613"
+ BetaResponseNewParamsModelGPT3_5Turbo1106 BetaResponseNewParamsModel = "gpt-3.5-turbo-1106"
+ BetaResponseNewParamsModelGPT3_5Turbo0125 BetaResponseNewParamsModel = "gpt-3.5-turbo-0125"
+ BetaResponseNewParamsModelGPT3_5Turbo16k0613 BetaResponseNewParamsModel = "gpt-3.5-turbo-16k-0613"
+ BetaResponseNewParamsModelO1Pro BetaResponseNewParamsModel = "o1-pro"
+ BetaResponseNewParamsModelO1Pro2025_03_19 BetaResponseNewParamsModel = "o1-pro-2025-03-19"
+ BetaResponseNewParamsModelO3Pro BetaResponseNewParamsModel = "o3-pro"
+ BetaResponseNewParamsModelO3Pro2025_06_10 BetaResponseNewParamsModel = "o3-pro-2025-06-10"
+ BetaResponseNewParamsModelO3DeepResearch BetaResponseNewParamsModel = "o3-deep-research"
+ BetaResponseNewParamsModelO3DeepResearch2025_06_26 BetaResponseNewParamsModel = "o3-deep-research-2025-06-26"
+ BetaResponseNewParamsModelO4MiniDeepResearch BetaResponseNewParamsModel = "o4-mini-deep-research"
+ BetaResponseNewParamsModelO4MiniDeepResearch2025_06_26 BetaResponseNewParamsModel = "o4-mini-deep-research-2025-06-26"
+ BetaResponseNewParamsModelComputerUsePreview BetaResponseNewParamsModel = "computer-use-preview"
+ BetaResponseNewParamsModelComputerUsePreview2025_03_11 BetaResponseNewParamsModel = "computer-use-preview-2025-03-11"
+ BetaResponseNewParamsModelGPT5Codex BetaResponseNewParamsModel = "gpt-5-codex"
+ BetaResponseNewParamsModelGPT5Pro BetaResponseNewParamsModel = "gpt-5-pro"
+ BetaResponseNewParamsModelGPT5Pro2025_10_06 BetaResponseNewParamsModel = "gpt-5-pro-2025-10-06"
+ BetaResponseNewParamsModelGPT5_1CodexMax BetaResponseNewParamsModel = "gpt-5.1-codex-max"
+)
+
+// Configuration for running moderation on the input and output of this response.
+//
+// The property Model is required.
+type BetaResponseNewParamsModeration struct {
+ // The moderation model to use for moderated completions, e.g.
+ // 'omni-moderation-latest'.
+ Model string `json:"model" api:"required"`
+ // The policy to apply to moderated response input and output.
+ Policy BetaResponseNewParamsModerationPolicy `json:"policy,omitzero"`
+ paramObj
+}
+
+func (r BetaResponseNewParamsModeration) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseNewParamsModeration
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseNewParamsModeration) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The policy to apply to moderated response input and output.
+type BetaResponseNewParamsModerationPolicy struct {
+ // The moderation policy for the response input.
+ Input BetaResponseNewParamsModerationPolicyInput `json:"input,omitzero"`
+ // The moderation policy for the response output.
+ Output BetaResponseNewParamsModerationPolicyOutput `json:"output,omitzero"`
+ paramObj
+}
+
+func (r BetaResponseNewParamsModerationPolicy) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseNewParamsModerationPolicy
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseNewParamsModerationPolicy) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The moderation policy for the response input.
+//
+// The property Mode is required.
+type BetaResponseNewParamsModerationPolicyInput struct {
+ // Any of "score", "block".
+ Mode string `json:"mode,omitzero" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseNewParamsModerationPolicyInput) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseNewParamsModerationPolicyInput
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseNewParamsModerationPolicyInput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseNewParamsModerationPolicyInput](
+ "mode", "score", "block",
+ )
+}
+
+// The moderation policy for the response output.
+//
+// The property Mode is required.
+type BetaResponseNewParamsModerationPolicyOutput struct {
+ // Any of "score", "block".
+ Mode string `json:"mode,omitzero" api:"required"`
+ paramObj
+}
+
+func (r BetaResponseNewParamsModerationPolicyOutput) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseNewParamsModerationPolicyOutput
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseNewParamsModerationPolicyOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseNewParamsModerationPolicyOutput](
+ "mode", "score", "block",
+ )
+}
+
+// Configuration for server-hosted multi-agent execution.
+//
+// The property Enabled is required.
+type BetaResponseNewParamsMultiAgent struct {
+ // Whether to enable server-hosted multi-agent execution for this response.
+ Enabled bool `json:"enabled" api:"required"`
+ // `max_concurrent_subagents` sets the maximum number of subagents that can be
+ // active simultaneously across the entire agent tree. It includes all
+ // descendants—children, grandchildren, and deeper subagents—but excludes the root
+ // agent. The API does not impose a fixed upper bound on this setting. The default
+ // is `3`, which is recommended for most workloads. Multi-agent runs also have no
+ // fixed limit on tree depth or the total number of subagents created during a run.
+ MaxConcurrentSubagents param.Opt[int64] `json:"max_concurrent_subagents,omitzero"`
+ paramObj
+}
+
+func (r BetaResponseNewParamsMultiAgent) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseNewParamsMultiAgent
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseNewParamsMultiAgent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Options for prompt caching. Supported for `gpt-5.6` and later models. By
+// default, OpenAI automatically chooses one implicit cache breakpoint. You can add
+// explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
+// request can write up to four breakpoints. For cache matching, OpenAI considers
+// up to the latest 80 breakpoints in the conversation, without a content-block
+// lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
+// `ttl` defaults to `30m`, which is currently the only supported value. See the
+// [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
+// for current details.
+type BetaResponseNewParamsPromptCacheOptions struct {
+ // Controls whether OpenAI automatically creates an implicit cache breakpoint.
+ // Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
+ // and writes up to the latest three explicit breakpoints in the request. With
+ // `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
+ // latest four explicit breakpoints. If there are no explicit breakpoints, the
+ // request does not use prompt caching.
+ //
+ // Any of "implicit", "explicit".
+ Mode string `json:"mode,omitzero"`
+ // The minimum lifetime applied to every implicit and explicit cache breakpoint
+ // written by the request. Defaults to `30m`, which is currently the only supported
+ // value. The backend may retain cache entries for longer.
+ //
+ // Any of "30m".
+ Ttl string `json:"ttl,omitzero"`
+ paramObj
+}
+
+func (r BetaResponseNewParamsPromptCacheOptions) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseNewParamsPromptCacheOptions
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseNewParamsPromptCacheOptions) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseNewParamsPromptCacheOptions](
+ "mode", "implicit", "explicit",
+ )
+ apijson.RegisterFieldValidator[BetaResponseNewParamsPromptCacheOptions](
+ "ttl", "30m",
+ )
+}
+
+// Deprecated. Use `prompt_cache_options.ttl` instead.
+//
+// The retention policy for the prompt cache. Set to `24h` to enable extended
+// prompt caching, which keeps cached prefixes active for longer, up to a maximum
+// of 24 hours.
+// [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
+// This field expresses a maximum retention policy, while
+// `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
+// are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
+// models, only `24h` is supported.
+//
+// For older models that support both `in_memory` and `24h`, the default depends on
+// your organization's data retention policy:
+//
+// - Organizations without ZDR enabled default to `24h`.
+// - Organizations with ZDR enabled default to `in_memory` when
+// `prompt_cache_retention` is not specified.
+type BetaResponseNewParamsPromptCacheRetention string
+
+const (
+ BetaResponseNewParamsPromptCacheRetentionInMemory BetaResponseNewParamsPromptCacheRetention = "in_memory"
+ BetaResponseNewParamsPromptCacheRetention24h BetaResponseNewParamsPromptCacheRetention = "24h"
+)
+
+// **gpt-5 and o-series models only**
+//
+// Configuration options for
+// [reasoning models](https://platform.openai.com/docs/guides/reasoning).
+type BetaResponseNewParamsReasoning struct {
+ // Controls which reasoning items are rendered back to the model on later turns. If
+ // omitted or set to `auto`, the model determines the context mode. The `gpt-5.6`
+ // model family defaults to `all_turns`; earlier models default to `current_turn`.
+ //
+ // When returned on a response, this is the effective reasoning context mode used
+ // for the response.
+ //
+ // Any of "auto", "current_turn", "all_turns".
+ Context string `json:"context,omitzero"`
+ // Constrains effort on reasoning for reasoning models. Currently supported values
+ // are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. Reducing
+ // reasoning effort can result in faster responses and fewer tokens used on
+ // reasoning in a response. Not all reasoning models support every value. See the
+ // [reasoning guide](https://platform.openai.com/docs/guides/reasoning) for
+ // model-specific support.
+ //
+ // Any of "none", "minimal", "low", "medium", "high", "xhigh", "max".
+ Effort string `json:"effort,omitzero"`
+ // **Deprecated:** use `summary` instead.
+ //
+ // A summary of the reasoning performed by the model. This can be useful for
+ // debugging and understanding the model's reasoning process. One of `auto`,
+ // `concise`, or `detailed`.
+ //
+ // Any of "auto", "concise", "detailed".
+ //
+ // Deprecated: deprecated
+ GenerateSummary string `json:"generate_summary,omitzero"`
+ // A summary of the reasoning performed by the model. This can be useful for
+ // debugging and understanding the model's reasoning process. One of `auto`,
+ // `concise`, or `detailed`.
+ //
+ // `concise` is supported for `computer-use-preview` models and all reasoning
+ // models after `gpt-5`.
+ //
+ // Any of "auto", "concise", "detailed".
+ Summary string `json:"summary,omitzero"`
+ // Controls the reasoning execution mode for the request.
+ //
+ // When returned on a response, this is the effective execution mode.
+ Mode string `json:"mode,omitzero"`
+ paramObj
+}
+
+func (r BetaResponseNewParamsReasoning) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseNewParamsReasoning
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseNewParamsReasoning) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseNewParamsReasoning](
+ "context", "auto", "current_turn", "all_turns",
+ )
+ apijson.RegisterFieldValidator[BetaResponseNewParamsReasoning](
+ "effort", "none", "minimal", "low", "medium", "high", "xhigh", "max",
+ )
+ apijson.RegisterFieldValidator[BetaResponseNewParamsReasoning](
+ "generate_summary", "auto", "concise", "detailed",
+ )
+ apijson.RegisterFieldValidator[BetaResponseNewParamsReasoning](
+ "summary", "auto", "concise", "detailed",
+ )
+}
+
+// Specifies the processing type used for serving the request.
+//
+// - If set to 'auto', then the request will be processed with the service tier
+// configured in the Project settings. Unless otherwise configured, the Project
+// will use 'default'.
+// - If set to 'default', then the request will be processed with the standard
+// pricing and performance for the selected model.
+// - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
+// '[priority](https://openai.com/api-priority-processing/)', then the request
+// will be processed with the corresponding service tier.
+// - When not set, the default behavior is 'auto'.
+//
+// When the `service_tier` parameter is set, the response body will include the
+// `service_tier` value based on the processing mode actually used to serve the
+// request. This response value may be different from the value set in the
+// parameter.
+type BetaResponseNewParamsServiceTier string
+
+const (
+ BetaResponseNewParamsServiceTierAuto BetaResponseNewParamsServiceTier = "auto"
+ BetaResponseNewParamsServiceTierDefault BetaResponseNewParamsServiceTier = "default"
+ BetaResponseNewParamsServiceTierFlex BetaResponseNewParamsServiceTier = "flex"
+ BetaResponseNewParamsServiceTierScale BetaResponseNewParamsServiceTier = "scale"
+ BetaResponseNewParamsServiceTierPriority BetaResponseNewParamsServiceTier = "priority"
+)
+
+// Options for streaming responses. Only set this when you set `stream: true`.
+type BetaResponseNewParamsStreamOptions struct {
+ // When true, stream obfuscation will be enabled. Stream obfuscation adds random
+ // characters to an `obfuscation` field on streaming delta events to normalize
+ // payload sizes as a mitigation to certain side-channel attacks. These obfuscation
+ // fields are included by default, but add a small amount of overhead to the data
+ // stream. You can set `include_obfuscation` to false to optimize for bandwidth if
+ // you trust the network links between your application and the OpenAI API.
+ IncludeObfuscation param.Opt[bool] `json:"include_obfuscation,omitzero"`
+ paramObj
+}
+
+func (r BetaResponseNewParamsStreamOptions) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseNewParamsStreamOptions
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseNewParamsStreamOptions) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseNewParamsToolChoiceUnion struct {
+ // Check if union is this variant with !param.IsOmitted(union.OfToolChoiceMode)
+ OfToolChoiceMode param.Opt[BetaToolChoiceOptions] `json:",omitzero,inline"`
+ OfAllowedTools *BetaToolChoiceAllowedParam `json:",omitzero,inline"`
+ OfHostedTool *BetaToolChoiceTypesParam `json:",omitzero,inline"`
+ OfFunctionTool *BetaToolChoiceFunctionParam `json:",omitzero,inline"`
+ OfMcpTool *BetaToolChoiceMcpParam `json:",omitzero,inline"`
+ OfCustomTool *BetaToolChoiceCustomParam `json:",omitzero,inline"`
+ OfBetaResponseNewsToolChoiceBetaSpecificProgrammaticToolCallingParam *BetaResponseNewParamsToolChoiceBetaSpecificProgrammaticToolCallingParam `json:",omitzero,inline"`
+ OfSpecificApplyPatchToolChoice *BetaToolChoiceApplyPatchParam `json:",omitzero,inline"`
+ OfSpecificShellToolChoice *BetaToolChoiceShellParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseNewParamsToolChoiceUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfToolChoiceMode,
+ u.OfAllowedTools,
+ u.OfHostedTool,
+ u.OfFunctionTool,
+ u.OfMcpTool,
+ u.OfCustomTool,
+ u.OfBetaResponseNewsToolChoiceBetaSpecificProgrammaticToolCallingParam,
+ u.OfSpecificApplyPatchToolChoice,
+ u.OfSpecificShellToolChoice)
+}
+func (u *BetaResponseNewParamsToolChoiceUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseNewParamsToolChoiceUnion) asAny() any {
+ if !param.IsOmitted(u.OfToolChoiceMode) {
+ return &u.OfToolChoiceMode
+ } else if !param.IsOmitted(u.OfAllowedTools) {
+ return u.OfAllowedTools
+ } else if !param.IsOmitted(u.OfHostedTool) {
+ return u.OfHostedTool
+ } else if !param.IsOmitted(u.OfFunctionTool) {
+ return u.OfFunctionTool
+ } else if !param.IsOmitted(u.OfMcpTool) {
+ return u.OfMcpTool
+ } else if !param.IsOmitted(u.OfCustomTool) {
+ return u.OfCustomTool
+ } else if !param.IsOmitted(u.OfBetaResponseNewsToolChoiceBetaSpecificProgrammaticToolCallingParam) {
+ return u.OfBetaResponseNewsToolChoiceBetaSpecificProgrammaticToolCallingParam
+ } else if !param.IsOmitted(u.OfSpecificApplyPatchToolChoice) {
+ return u.OfSpecificApplyPatchToolChoice
+ } else if !param.IsOmitted(u.OfSpecificShellToolChoice) {
+ return u.OfSpecificShellToolChoice
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseNewParamsToolChoiceUnion) GetMode() *string {
+ if vt := u.OfAllowedTools; vt != nil {
+ return (*string)(&vt.Mode)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseNewParamsToolChoiceUnion) GetTools() []map[string]any {
+ if vt := u.OfAllowedTools; vt != nil {
+ return vt.Tools
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseNewParamsToolChoiceUnion) GetServerLabel() *string {
+ if vt := u.OfMcpTool; vt != nil {
+ return &vt.ServerLabel
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseNewParamsToolChoiceUnion) GetType() *string {
+ if vt := u.OfAllowedTools; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfHostedTool; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfFunctionTool; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfMcpTool; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfCustomTool; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfBetaResponseNewsToolChoiceBetaSpecificProgrammaticToolCallingParam; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfSpecificApplyPatchToolChoice; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfSpecificShellToolChoice; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseNewParamsToolChoiceUnion) GetName() *string {
+ if vt := u.OfFunctionTool; vt != nil {
+ return (*string)(&vt.Name)
+ } else if vt := u.OfMcpTool; vt != nil && vt.Name.Valid() {
+ return &vt.Name.Value
+ } else if vt := u.OfCustomTool; vt != nil {
+ return (*string)(&vt.Name)
+ }
+ return nil
+}
+
+func NewBetaResponseNewParamsToolChoiceBetaSpecificProgrammaticToolCallingParam() BetaResponseNewParamsToolChoiceBetaSpecificProgrammaticToolCallingParam {
+ return BetaResponseNewParamsToolChoiceBetaSpecificProgrammaticToolCallingParam{
+ Type: "programmatic_tool_calling",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewBetaResponseNewParamsToolChoiceBetaSpecificProgrammaticToolCallingParam].
+type BetaResponseNewParamsToolChoiceBetaSpecificProgrammaticToolCallingParam struct {
+ // The tool to call. Always `programmatic_tool_calling`.
+ Type constant.ProgrammaticToolCalling `json:"type" default:"programmatic_tool_calling"`
+ paramObj
+}
+
+func (r BetaResponseNewParamsToolChoiceBetaSpecificProgrammaticToolCallingParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseNewParamsToolChoiceBetaSpecificProgrammaticToolCallingParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseNewParamsToolChoiceBetaSpecificProgrammaticToolCallingParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The truncation strategy to use for the model response.
+//
+// - `auto`: If the input to this Response exceeds the model's context window size,
+// the model will truncate the response to fit the context window by dropping
+// items from the beginning of the conversation.
+// - `disabled` (default): If the input size will exceed the context window size
+// for a model, the request will fail with a 400 error.
+type BetaResponseNewParamsTruncation string
+
+const (
+ BetaResponseNewParamsTruncationAuto BetaResponseNewParamsTruncation = "auto"
+ BetaResponseNewParamsTruncationDisabled BetaResponseNewParamsTruncation = "disabled"
+)
+
+type BetaResponseGetParams struct {
+ // When true, stream obfuscation will be enabled. Stream obfuscation adds random
+ // characters to an `obfuscation` field on streaming delta events to normalize
+ // payload sizes as a mitigation to certain side-channel attacks. These obfuscation
+ // fields are included by default, but add a small amount of overhead to the data
+ // stream. You can set `include_obfuscation` to false to optimize for bandwidth if
+ // you trust the network links between your application and the OpenAI API.
+ IncludeObfuscation param.Opt[bool] `query:"include_obfuscation,omitzero" json:"-"`
+ // The sequence number of the event after which to start streaming.
+ StartingAfter param.Opt[int64] `query:"starting_after,omitzero" json:"-"`
+ // Additional fields to include in the response. See the `include` parameter for
+ // Response creation above for more information.
+ Include []BetaResponseIncludable `query:"include,omitzero" json:"-"`
+ // Any of "responses_multi_agent=v1".
+ Betas []string `header:"openai-beta,omitzero" json:"-"`
+ paramObj
+}
+
+// URLQuery serializes [BetaResponseGetParams]'s query parameters as `url.Values`.
+func (r BetaResponseGetParams) URLQuery() (v url.Values, err error) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatBrackets,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
+type BetaResponseDeleteParams struct {
+ // Any of "responses_multi_agent=v1".
+ Betas []string `header:"openai-beta,omitzero" json:"-"`
+ paramObj
+}
+
+type BetaResponseCancelParams struct {
+ // Any of "responses_multi_agent=v1".
+ Betas []string `header:"openai-beta,omitzero" json:"-"`
+ paramObj
+}
+
+type BetaResponseCompactParams struct {
+ // Model ID used to generate the response, like `gpt-5` or `o3`. OpenAI offers a
+ // wide range of models with different capabilities, performance characteristics,
+ // and price points. Refer to the
+ // [model guide](https://platform.openai.com/docs/models) to browse and compare
+ // available models.
+ Model BetaResponseCompactParamsModel `json:"model,omitzero" api:"required"`
+ // A system (or developer) message inserted into the model's context. When used
+ // along with `previous_response_id`, the instructions from a previous response
+ // will not be carried over to the next response. This makes it simple to swap out
+ // system (or developer) messages in new responses.
+ Instructions param.Opt[string] `json:"instructions,omitzero"`
+ // The unique ID of the previous response to the model. Use this to create
+ // multi-turn conversations. Learn more about
+ // [conversation state](https://platform.openai.com/docs/guides/conversation-state).
+ // Cannot be used in conjunction with `conversation`.
+ PreviousResponseID param.Opt[string] `json:"previous_response_id,omitzero"`
+ // A key to use when reading from or writing to the prompt cache.
+ PromptCacheKey param.Opt[string] `json:"prompt_cache_key,omitzero"`
+ // Text, image, or file inputs to the model, used to generate a response
+ Input BetaResponseCompactParamsInputUnion `json:"input,omitzero"`
+ // Options for prompt caching. Supported for `gpt-5.6` and later models. By
+ // default, OpenAI automatically chooses one implicit cache breakpoint. You can add
+ // explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
+ // request can write up to four breakpoints. For cache matching, OpenAI considers
+ // up to the latest 80 breakpoints in the conversation, without a content-block
+ // lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
+ // `ttl` defaults to `30m`, which is currently the only supported value. See the
+ // [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
+ // for current details.
+ PromptCacheOptions BetaResponseCompactParamsPromptCacheOptions `json:"prompt_cache_options,omitzero"`
+ // How long to retain a prompt cache entry created by this request.
+ //
+ // Any of "in_memory", "24h".
+ PromptCacheRetention BetaResponseCompactParamsPromptCacheRetention `json:"prompt_cache_retention,omitzero"`
+ // The service tier to use for this request.
+ //
+ // Any of "auto", "default", "flex", "priority".
+ ServiceTier BetaResponseCompactParamsServiceTier `json:"service_tier,omitzero"`
+ // Any of "responses_multi_agent=v1".
+ Betas []string `header:"openai-beta,omitzero" json:"-"`
+ paramObj
+}
+
+func (r BetaResponseCompactParams) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseCompactParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseCompactParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Model ID used to generate the response, like `gpt-5` or `o3`. OpenAI offers a
+// wide range of models with different capabilities, performance characteristics,
+// and price points. Refer to the
+// [model guide](https://platform.openai.com/docs/models) to browse and compare
+// available models.
+type BetaResponseCompactParamsModel string
+
+const (
+ BetaResponseCompactParamsModelGPT5_6Sol BetaResponseCompactParamsModel = "gpt-5.6-sol"
+ BetaResponseCompactParamsModelGPT5_6Terra BetaResponseCompactParamsModel = "gpt-5.6-terra"
+ BetaResponseCompactParamsModelGPT5_6Luna BetaResponseCompactParamsModel = "gpt-5.6-luna"
+ BetaResponseCompactParamsModelGPT5_4 BetaResponseCompactParamsModel = "gpt-5.4"
+ BetaResponseCompactParamsModelGPT5_4Mini BetaResponseCompactParamsModel = "gpt-5.4-mini"
+ BetaResponseCompactParamsModelGPT5_4Nano BetaResponseCompactParamsModel = "gpt-5.4-nano"
+ BetaResponseCompactParamsModelGPT5_4Mini2026_03_17 BetaResponseCompactParamsModel = "gpt-5.4-mini-2026-03-17"
+ BetaResponseCompactParamsModelGPT5_4Nano2026_03_17 BetaResponseCompactParamsModel = "gpt-5.4-nano-2026-03-17"
+ BetaResponseCompactParamsModelGPT5_3ChatLatest BetaResponseCompactParamsModel = "gpt-5.3-chat-latest"
+ BetaResponseCompactParamsModelGPT5_2 BetaResponseCompactParamsModel = "gpt-5.2"
+ BetaResponseCompactParamsModelGPT5_2_2025_12_11 BetaResponseCompactParamsModel = "gpt-5.2-2025-12-11"
+ BetaResponseCompactParamsModelGPT5_2ChatLatest BetaResponseCompactParamsModel = "gpt-5.2-chat-latest"
+ BetaResponseCompactParamsModelGPT5_2Pro BetaResponseCompactParamsModel = "gpt-5.2-pro"
+ BetaResponseCompactParamsModelGPT5_2Pro2025_12_11 BetaResponseCompactParamsModel = "gpt-5.2-pro-2025-12-11"
+ BetaResponseCompactParamsModelGPT5_1 BetaResponseCompactParamsModel = "gpt-5.1"
+ BetaResponseCompactParamsModelGPT5_1_2025_11_13 BetaResponseCompactParamsModel = "gpt-5.1-2025-11-13"
+ BetaResponseCompactParamsModelGPT5_1Codex BetaResponseCompactParamsModel = "gpt-5.1-codex"
+ BetaResponseCompactParamsModelGPT5_1Mini BetaResponseCompactParamsModel = "gpt-5.1-mini"
+ BetaResponseCompactParamsModelGPT5_1ChatLatest BetaResponseCompactParamsModel = "gpt-5.1-chat-latest"
+ BetaResponseCompactParamsModelGPT5 BetaResponseCompactParamsModel = "gpt-5"
+ BetaResponseCompactParamsModelGPT5Mini BetaResponseCompactParamsModel = "gpt-5-mini"
+ BetaResponseCompactParamsModelGPT5Nano BetaResponseCompactParamsModel = "gpt-5-nano"
+ BetaResponseCompactParamsModelGPT5_2025_08_07 BetaResponseCompactParamsModel = "gpt-5-2025-08-07"
+ BetaResponseCompactParamsModelGPT5Mini2025_08_07 BetaResponseCompactParamsModel = "gpt-5-mini-2025-08-07"
+ BetaResponseCompactParamsModelGPT5Nano2025_08_07 BetaResponseCompactParamsModel = "gpt-5-nano-2025-08-07"
+ BetaResponseCompactParamsModelGPT5ChatLatest BetaResponseCompactParamsModel = "gpt-5-chat-latest"
+ BetaResponseCompactParamsModelGPT4_1 BetaResponseCompactParamsModel = "gpt-4.1"
+ BetaResponseCompactParamsModelGPT4_1Mini BetaResponseCompactParamsModel = "gpt-4.1-mini"
+ BetaResponseCompactParamsModelGPT4_1Nano BetaResponseCompactParamsModel = "gpt-4.1-nano"
+ BetaResponseCompactParamsModelGPT4_1_2025_04_14 BetaResponseCompactParamsModel = "gpt-4.1-2025-04-14"
+ BetaResponseCompactParamsModelGPT4_1Mini2025_04_14 BetaResponseCompactParamsModel = "gpt-4.1-mini-2025-04-14"
+ BetaResponseCompactParamsModelGPT4_1Nano2025_04_14 BetaResponseCompactParamsModel = "gpt-4.1-nano-2025-04-14"
+ BetaResponseCompactParamsModelO4Mini BetaResponseCompactParamsModel = "o4-mini"
+ BetaResponseCompactParamsModelO4Mini2025_04_16 BetaResponseCompactParamsModel = "o4-mini-2025-04-16"
+ BetaResponseCompactParamsModelO3 BetaResponseCompactParamsModel = "o3"
+ BetaResponseCompactParamsModelO3_2025_04_16 BetaResponseCompactParamsModel = "o3-2025-04-16"
+ BetaResponseCompactParamsModelO3Mini BetaResponseCompactParamsModel = "o3-mini"
+ BetaResponseCompactParamsModelO3Mini2025_01_31 BetaResponseCompactParamsModel = "o3-mini-2025-01-31"
+ BetaResponseCompactParamsModelO1 BetaResponseCompactParamsModel = "o1"
+ BetaResponseCompactParamsModelO1_2024_12_17 BetaResponseCompactParamsModel = "o1-2024-12-17"
+ BetaResponseCompactParamsModelO1Preview BetaResponseCompactParamsModel = "o1-preview"
+ BetaResponseCompactParamsModelO1Preview2024_09_12 BetaResponseCompactParamsModel = "o1-preview-2024-09-12"
+ BetaResponseCompactParamsModelO1Mini BetaResponseCompactParamsModel = "o1-mini"
+ BetaResponseCompactParamsModelO1Mini2024_09_12 BetaResponseCompactParamsModel = "o1-mini-2024-09-12"
+ BetaResponseCompactParamsModelGPT4o BetaResponseCompactParamsModel = "gpt-4o"
+ BetaResponseCompactParamsModelGPT4o2024_11_20 BetaResponseCompactParamsModel = "gpt-4o-2024-11-20"
+ BetaResponseCompactParamsModelGPT4o2024_08_06 BetaResponseCompactParamsModel = "gpt-4o-2024-08-06"
+ BetaResponseCompactParamsModelGPT4o2024_05_13 BetaResponseCompactParamsModel = "gpt-4o-2024-05-13"
+ BetaResponseCompactParamsModelGPT4oAudioPreview BetaResponseCompactParamsModel = "gpt-4o-audio-preview"
+ BetaResponseCompactParamsModelGPT4oAudioPreview2024_10_01 BetaResponseCompactParamsModel = "gpt-4o-audio-preview-2024-10-01"
+ BetaResponseCompactParamsModelGPT4oAudioPreview2024_12_17 BetaResponseCompactParamsModel = "gpt-4o-audio-preview-2024-12-17"
+ BetaResponseCompactParamsModelGPT4oAudioPreview2025_06_03 BetaResponseCompactParamsModel = "gpt-4o-audio-preview-2025-06-03"
+ BetaResponseCompactParamsModelGPT4oMiniAudioPreview BetaResponseCompactParamsModel = "gpt-4o-mini-audio-preview"
+ BetaResponseCompactParamsModelGPT4oMiniAudioPreview2024_12_17 BetaResponseCompactParamsModel = "gpt-4o-mini-audio-preview-2024-12-17"
+ BetaResponseCompactParamsModelGPT4oSearchPreview BetaResponseCompactParamsModel = "gpt-4o-search-preview"
+ BetaResponseCompactParamsModelGPT4oMiniSearchPreview BetaResponseCompactParamsModel = "gpt-4o-mini-search-preview"
+ BetaResponseCompactParamsModelGPT4oSearchPreview2025_03_11 BetaResponseCompactParamsModel = "gpt-4o-search-preview-2025-03-11"
+ BetaResponseCompactParamsModelGPT4oMiniSearchPreview2025_03_11 BetaResponseCompactParamsModel = "gpt-4o-mini-search-preview-2025-03-11"
+ BetaResponseCompactParamsModelChatgpt4oLatest BetaResponseCompactParamsModel = "chatgpt-4o-latest"
+ BetaResponseCompactParamsModelCodexMiniLatest BetaResponseCompactParamsModel = "codex-mini-latest"
+ BetaResponseCompactParamsModelGPT4oMini BetaResponseCompactParamsModel = "gpt-4o-mini"
+ BetaResponseCompactParamsModelGPT4oMini2024_07_18 BetaResponseCompactParamsModel = "gpt-4o-mini-2024-07-18"
+ BetaResponseCompactParamsModelGPT4Turbo BetaResponseCompactParamsModel = "gpt-4-turbo"
+ BetaResponseCompactParamsModelGPT4Turbo2024_04_09 BetaResponseCompactParamsModel = "gpt-4-turbo-2024-04-09"
+ BetaResponseCompactParamsModelGPT4_0125Preview BetaResponseCompactParamsModel = "gpt-4-0125-preview"
+ BetaResponseCompactParamsModelGPT4TurboPreview BetaResponseCompactParamsModel = "gpt-4-turbo-preview"
+ BetaResponseCompactParamsModelGPT4_1106Preview BetaResponseCompactParamsModel = "gpt-4-1106-preview"
+ BetaResponseCompactParamsModelGPT4VisionPreview BetaResponseCompactParamsModel = "gpt-4-vision-preview"
+ BetaResponseCompactParamsModelGPT4 BetaResponseCompactParamsModel = "gpt-4"
+ BetaResponseCompactParamsModelGPT4_0314 BetaResponseCompactParamsModel = "gpt-4-0314"
+ BetaResponseCompactParamsModelGPT4_0613 BetaResponseCompactParamsModel = "gpt-4-0613"
+ BetaResponseCompactParamsModelGPT4_32k BetaResponseCompactParamsModel = "gpt-4-32k"
+ BetaResponseCompactParamsModelGPT4_32k0314 BetaResponseCompactParamsModel = "gpt-4-32k-0314"
+ BetaResponseCompactParamsModelGPT4_32k0613 BetaResponseCompactParamsModel = "gpt-4-32k-0613"
+ BetaResponseCompactParamsModelGPT3_5Turbo BetaResponseCompactParamsModel = "gpt-3.5-turbo"
+ BetaResponseCompactParamsModelGPT3_5Turbo16k BetaResponseCompactParamsModel = "gpt-3.5-turbo-16k"
+ BetaResponseCompactParamsModelGPT3_5Turbo0301 BetaResponseCompactParamsModel = "gpt-3.5-turbo-0301"
+ BetaResponseCompactParamsModelGPT3_5Turbo0613 BetaResponseCompactParamsModel = "gpt-3.5-turbo-0613"
+ BetaResponseCompactParamsModelGPT3_5Turbo1106 BetaResponseCompactParamsModel = "gpt-3.5-turbo-1106"
+ BetaResponseCompactParamsModelGPT3_5Turbo0125 BetaResponseCompactParamsModel = "gpt-3.5-turbo-0125"
+ BetaResponseCompactParamsModelGPT3_5Turbo16k0613 BetaResponseCompactParamsModel = "gpt-3.5-turbo-16k-0613"
+ BetaResponseCompactParamsModelO1Pro BetaResponseCompactParamsModel = "o1-pro"
+ BetaResponseCompactParamsModelO1Pro2025_03_19 BetaResponseCompactParamsModel = "o1-pro-2025-03-19"
+ BetaResponseCompactParamsModelO3Pro BetaResponseCompactParamsModel = "o3-pro"
+ BetaResponseCompactParamsModelO3Pro2025_06_10 BetaResponseCompactParamsModel = "o3-pro-2025-06-10"
+ BetaResponseCompactParamsModelO3DeepResearch BetaResponseCompactParamsModel = "o3-deep-research"
+ BetaResponseCompactParamsModelO3DeepResearch2025_06_26 BetaResponseCompactParamsModel = "o3-deep-research-2025-06-26"
+ BetaResponseCompactParamsModelO4MiniDeepResearch BetaResponseCompactParamsModel = "o4-mini-deep-research"
+ BetaResponseCompactParamsModelO4MiniDeepResearch2025_06_26 BetaResponseCompactParamsModel = "o4-mini-deep-research-2025-06-26"
+ BetaResponseCompactParamsModelComputerUsePreview BetaResponseCompactParamsModel = "computer-use-preview"
+ BetaResponseCompactParamsModelComputerUsePreview2025_03_11 BetaResponseCompactParamsModel = "computer-use-preview-2025-03-11"
+ BetaResponseCompactParamsModelGPT5Codex BetaResponseCompactParamsModel = "gpt-5-codex"
+ BetaResponseCompactParamsModelGPT5Pro BetaResponseCompactParamsModel = "gpt-5-pro"
+ BetaResponseCompactParamsModelGPT5Pro2025_10_06 BetaResponseCompactParamsModel = "gpt-5-pro-2025-10-06"
+ BetaResponseCompactParamsModelGPT5_1CodexMax BetaResponseCompactParamsModel = "gpt-5.1-codex-max"
+)
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseCompactParamsInputUnion struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfBetaResponseInputItemArray []BetaResponseInputItemUnionParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseCompactParamsInputUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfBetaResponseInputItemArray)
+}
+func (u *BetaResponseCompactParamsInputUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseCompactParamsInputUnion) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfBetaResponseInputItemArray) {
+ return &u.OfBetaResponseInputItemArray
+ }
+ return nil
+}
+
+// Options for prompt caching. Supported for `gpt-5.6` and later models. By
+// default, OpenAI automatically chooses one implicit cache breakpoint. You can add
+// explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
+// request can write up to four breakpoints. For cache matching, OpenAI considers
+// up to the latest 80 breakpoints in the conversation, without a content-block
+// lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
+// `ttl` defaults to `30m`, which is currently the only supported value. See the
+// [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
+// for current details.
+type BetaResponseCompactParamsPromptCacheOptions struct {
+ // Controls whether OpenAI automatically creates an implicit cache breakpoint.
+ // Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
+ // and writes up to the latest three explicit breakpoints in the request. With
+ // `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
+ // latest four explicit breakpoints. If there are no explicit breakpoints, the
+ // request does not use prompt caching.
+ //
+ // Any of "implicit", "explicit".
+ Mode string `json:"mode,omitzero"`
+ // The minimum lifetime applied to every implicit and explicit cache breakpoint
+ // written by the request. Defaults to `30m`, which is currently the only supported
+ // value. The backend may retain cache entries for longer.
+ //
+ // Any of "30m".
+ Ttl string `json:"ttl,omitzero"`
+ paramObj
+}
+
+func (r BetaResponseCompactParamsPromptCacheOptions) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseCompactParamsPromptCacheOptions
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseCompactParamsPromptCacheOptions) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseCompactParamsPromptCacheOptions](
+ "mode", "implicit", "explicit",
+ )
+ apijson.RegisterFieldValidator[BetaResponseCompactParamsPromptCacheOptions](
+ "ttl", "30m",
+ )
+}
+
+// How long to retain a prompt cache entry created by this request.
+type BetaResponseCompactParamsPromptCacheRetention string
+
+const (
+ BetaResponseCompactParamsPromptCacheRetentionInMemory BetaResponseCompactParamsPromptCacheRetention = "in_memory"
+ BetaResponseCompactParamsPromptCacheRetention24h BetaResponseCompactParamsPromptCacheRetention = "24h"
+)
+
+// The service tier to use for this request.
+type BetaResponseCompactParamsServiceTier string
+
+const (
+ BetaResponseCompactParamsServiceTierAuto BetaResponseCompactParamsServiceTier = "auto"
+ BetaResponseCompactParamsServiceTierDefault BetaResponseCompactParamsServiceTier = "default"
+ BetaResponseCompactParamsServiceTierFlex BetaResponseCompactParamsServiceTier = "flex"
+ BetaResponseCompactParamsServiceTierPriority BetaResponseCompactParamsServiceTier = "priority"
+)
diff --git a/vendor/github.com/openai/openai-go/v3/betaresponseinputitem.go b/vendor/github.com/openai/openai-go/v3/betaresponseinputitem.go
new file mode 100644
index 000000000..b9b4ba5dc
--- /dev/null
+++ b/vendor/github.com/openai/openai-go/v3/betaresponseinputitem.go
@@ -0,0 +1,142 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package openai
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "net/http"
+ "net/url"
+ "slices"
+
+ "github.com/openai/openai-go/v3/internal/apijson"
+ "github.com/openai/openai-go/v3/internal/apiquery"
+ "github.com/openai/openai-go/v3/internal/requestconfig"
+ "github.com/openai/openai-go/v3/option"
+ "github.com/openai/openai-go/v3/packages/pagination"
+ "github.com/openai/openai-go/v3/packages/param"
+ "github.com/openai/openai-go/v3/packages/respjson"
+ "github.com/openai/openai-go/v3/shared/constant"
+)
+
+// BetaResponseInputItemService contains methods and other services that help with
+// interacting with the openai API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewBetaResponseInputItemService] method instead.
+type BetaResponseInputItemService struct {
+ Options []option.RequestOption
+}
+
+// NewBetaResponseInputItemService generates a new service that applies the given
+// options to each request. These options are applied after the parent client's
+// options (if there is one), and before any request-specific options.
+func NewBetaResponseInputItemService(opts ...option.RequestOption) (r BetaResponseInputItemService) {
+ r = BetaResponseInputItemService{}
+ r.Options = opts
+ return
+}
+
+// Returns a list of input items for a given response.
+func (r *BetaResponseInputItemService) List(ctx context.Context, responseID string, params BetaResponseInputItemListParams, opts ...option.RequestOption) (res *pagination.CursorPage[BetaResponseItemUnion], err error) {
+ var raw *http.Response
+ for _, v := range params.Betas {
+ opts = append(opts, option.WithHeaderAdd("openai-beta", fmt.Sprintf("%v", v)))
+ }
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
+ opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
+ if responseID == "" {
+ err = errors.New("missing required response_id parameter")
+ return nil, err
+ }
+ path := requestconfig.FormatPath("responses/%s/input_items?beta=true", responseID)
+ cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, params, &res, opts...)
+ if err != nil {
+ return nil, err
+ }
+ err = cfg.Execute()
+ if err != nil {
+ return nil, err
+ }
+ res.SetPageConfig(cfg, raw)
+ return res, nil
+}
+
+// Returns a list of input items for a given response.
+func (r *BetaResponseInputItemService) ListAutoPaging(ctx context.Context, responseID string, params BetaResponseInputItemListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[BetaResponseItemUnion] {
+ return pagination.NewCursorPageAutoPager(r.List(ctx, responseID, params, opts...))
+}
+
+// A list of Response items.
+type BetaResponseItemList struct {
+ // A list of items used to generate this response.
+ Data []BetaResponseItemUnion `json:"data" api:"required"`
+ // The ID of the first item in the list.
+ FirstID string `json:"first_id" api:"required"`
+ // Whether there are more items available.
+ HasMore bool `json:"has_more" api:"required"`
+ // The ID of the last item in the list.
+ LastID string `json:"last_id" api:"required"`
+ // The type of object returned, must be `list`.
+ Object constant.List `json:"object" default:"list"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Data respjson.Field
+ FirstID respjson.Field
+ HasMore respjson.Field
+ LastID respjson.Field
+ Object respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseItemList) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseItemList) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputItemListParams struct {
+ // An item ID to list items after, used in pagination.
+ After param.Opt[string] `query:"after,omitzero" json:"-"`
+ // A limit on the number of objects to be returned. Limit can range between 1 and
+ // 100, and the default is 20.
+ Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
+ // Additional fields to include in the response. See the `include` parameter for
+ // Response creation above for more information.
+ Include []BetaResponseIncludable `query:"include,omitzero" json:"-"`
+ // The order to return the input items in. Default is `desc`.
+ //
+ // - `asc`: Return the input items in ascending order.
+ // - `desc`: Return the input items in descending order.
+ //
+ // Any of "asc", "desc".
+ Order BetaResponseInputItemListParamsOrder `query:"order,omitzero" json:"-"`
+ // Any of "responses_multi_agent=v1".
+ Betas []string `header:"openai-beta,omitzero" json:"-"`
+ paramObj
+}
+
+// URLQuery serializes [BetaResponseInputItemListParams]'s query parameters as
+// `url.Values`.
+func (r BetaResponseInputItemListParams) URLQuery() (v url.Values, err error) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatBrackets,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
+// The order to return the input items in. Default is `desc`.
+//
+// - `asc`: Return the input items in ascending order.
+// - `desc`: Return the input items in descending order.
+type BetaResponseInputItemListParamsOrder string
+
+const (
+ BetaResponseInputItemListParamsOrderAsc BetaResponseInputItemListParamsOrder = "asc"
+ BetaResponseInputItemListParamsOrderDesc BetaResponseInputItemListParamsOrder = "desc"
+)
diff --git a/vendor/github.com/openai/openai-go/v3/betaresponseinputtoken.go b/vendor/github.com/openai/openai-go/v3/betaresponseinputtoken.go
new file mode 100644
index 000000000..0460fa9f0
--- /dev/null
+++ b/vendor/github.com/openai/openai-go/v3/betaresponseinputtoken.go
@@ -0,0 +1,455 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package openai
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+ "slices"
+
+ "github.com/openai/openai-go/v3/internal/apijson"
+ "github.com/openai/openai-go/v3/internal/requestconfig"
+ "github.com/openai/openai-go/v3/option"
+ "github.com/openai/openai-go/v3/packages/param"
+ "github.com/openai/openai-go/v3/packages/respjson"
+ "github.com/openai/openai-go/v3/shared/constant"
+)
+
+// BetaResponseInputTokenService contains methods and other services that help with
+// interacting with the openai API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewBetaResponseInputTokenService] method instead.
+type BetaResponseInputTokenService struct {
+ Options []option.RequestOption
+}
+
+// NewBetaResponseInputTokenService generates a new service that applies the given
+// options to each request. These options are applied after the parent client's
+// options (if there is one), and before any request-specific options.
+func NewBetaResponseInputTokenService(opts ...option.RequestOption) (r BetaResponseInputTokenService) {
+ r = BetaResponseInputTokenService{}
+ r.Options = opts
+ return
+}
+
+// Returns input token counts of the request.
+//
+// Returns an object with `object` set to `response.input_tokens` and an
+// `input_tokens` count.
+func (r *BetaResponseInputTokenService) Count(ctx context.Context, params BetaResponseInputTokenCountParams, opts ...option.RequestOption) (res *BetaResponseInputTokenCountResponse, err error) {
+ for _, v := range params.Betas {
+ opts = append(opts, option.WithHeaderAdd("openai-beta", fmt.Sprintf("%v", v)))
+ }
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
+ path := "responses/input_tokens?beta=true"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
+ return res, err
+}
+
+type BetaResponseInputTokenCountResponse struct {
+ InputTokens int64 `json:"input_tokens" api:"required"`
+ Object constant.ResponseInputTokens `json:"object" default:"response.input_tokens"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ InputTokens respjson.Field
+ Object respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r BetaResponseInputTokenCountResponse) RawJSON() string { return r.JSON.raw }
+func (r *BetaResponseInputTokenCountResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BetaResponseInputTokenCountParams struct {
+ // A system (or developer) message inserted into the model's context. When used
+ // along with `previous_response_id`, the instructions from a previous response
+ // will not be carried over to the next response. This makes it simple to swap out
+ // system (or developer) messages in new responses.
+ Instructions param.Opt[string] `json:"instructions,omitzero"`
+ // Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
+ // wide range of models with different capabilities, performance characteristics,
+ // and price points. Refer to the
+ // [model guide](https://platform.openai.com/docs/models) to browse and compare
+ // available models.
+ Model param.Opt[string] `json:"model,omitzero"`
+ // Whether to allow the model to run tool calls in parallel.
+ ParallelToolCalls param.Opt[bool] `json:"parallel_tool_calls,omitzero"`
+ // The unique ID of the previous response to the model. Use this to create
+ // multi-turn conversations. Learn more about
+ // [conversation state](https://platform.openai.com/docs/guides/conversation-state).
+ // Cannot be used in conjunction with `conversation`.
+ PreviousResponseID param.Opt[string] `json:"previous_response_id,omitzero"`
+ // The conversation that this response belongs to. Items from this conversation are
+ // prepended to `input_items` for this response request. Input items and output
+ // items from this response are automatically added to this conversation after this
+ // response completes.
+ Conversation BetaResponseInputTokenCountParamsConversationUnion `json:"conversation,omitzero"`
+ // Text, image, or file inputs to the model, used to generate a response
+ Input BetaResponseInputTokenCountParamsInputUnion `json:"input,omitzero"`
+ // **gpt-5 and o-series models only** Configuration options for
+ // [reasoning models](https://platform.openai.com/docs/guides/reasoning).
+ Reasoning BetaResponseInputTokenCountParamsReasoning `json:"reasoning,omitzero"`
+ // Configuration options for a text response from the model. Can be plain text or
+ // structured JSON data. Learn more:
+ //
+ // - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
+ // - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
+ Text BetaResponseInputTokenCountParamsText `json:"text,omitzero"`
+ // Controls which tool the model should use, if any.
+ ToolChoice BetaResponseInputTokenCountParamsToolChoiceUnion `json:"tool_choice,omitzero"`
+ // An array of tools the model may call while generating a response. You can
+ // specify which tool to use by setting the `tool_choice` parameter.
+ Tools []BetaToolUnionParam `json:"tools,omitzero"`
+ // A model-owned style preset to apply to this request. Omit this parameter to use
+ // the model's default style. Supported values may expand over time. Values must be
+ // at most 64 characters.
+ Personality BetaResponseInputTokenCountParamsPersonality `json:"personality,omitzero"`
+ // The truncation strategy to use for the model response. - `auto`: If the input to
+ // this Response exceeds the model's context window size, the model will truncate
+ // the response to fit the context window by dropping items from the beginning of
+ // the conversation. - `disabled` (default): If the input size will exceed the
+ // context window size for a model, the request will fail with a 400 error.
+ //
+ // Any of "auto", "disabled".
+ Truncation BetaResponseInputTokenCountParamsTruncation `json:"truncation,omitzero"`
+ // Any of "responses_multi_agent=v1".
+ Betas []string `header:"openai-beta,omitzero" json:"-"`
+ paramObj
+}
+
+func (r BetaResponseInputTokenCountParams) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputTokenCountParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputTokenCountParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseInputTokenCountParamsConversationUnion struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfConversationObject *BetaResponseConversationParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseInputTokenCountParamsConversationUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfConversationObject)
+}
+func (u *BetaResponseInputTokenCountParamsConversationUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseInputTokenCountParamsConversationUnion) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfConversationObject) {
+ return u.OfConversationObject
+ }
+ return nil
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseInputTokenCountParamsInputUnion struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfBetaResponseInputItemArray []BetaResponseInputItemUnionParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseInputTokenCountParamsInputUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfBetaResponseInputItemArray)
+}
+func (u *BetaResponseInputTokenCountParamsInputUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseInputTokenCountParamsInputUnion) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfBetaResponseInputItemArray) {
+ return &u.OfBetaResponseInputItemArray
+ }
+ return nil
+}
+
+// A model-owned style preset to apply to this request. Omit this parameter to use
+// the model's default style. Supported values may expand over time. Values must be
+// at most 64 characters.
+type BetaResponseInputTokenCountParamsPersonality string
+
+const (
+ BetaResponseInputTokenCountParamsPersonalityFriendly BetaResponseInputTokenCountParamsPersonality = "friendly"
+ BetaResponseInputTokenCountParamsPersonalityPragmatic BetaResponseInputTokenCountParamsPersonality = "pragmatic"
+)
+
+// **gpt-5 and o-series models only** Configuration options for
+// [reasoning models](https://platform.openai.com/docs/guides/reasoning).
+type BetaResponseInputTokenCountParamsReasoning struct {
+ // Controls which reasoning items are rendered back to the model on later turns. If
+ // omitted or set to `auto`, the model determines the context mode. The `gpt-5.6`
+ // model family defaults to `all_turns`; earlier models default to `current_turn`.
+ //
+ // When returned on a response, this is the effective reasoning context mode used
+ // for the response.
+ //
+ // Any of "auto", "current_turn", "all_turns".
+ Context string `json:"context,omitzero"`
+ // Constrains effort on reasoning for reasoning models. Currently supported values
+ // are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. Reducing
+ // reasoning effort can result in faster responses and fewer tokens used on
+ // reasoning in a response. Not all reasoning models support every value. See the
+ // [reasoning guide](https://platform.openai.com/docs/guides/reasoning) for
+ // model-specific support.
+ //
+ // Any of "none", "minimal", "low", "medium", "high", "xhigh", "max".
+ Effort string `json:"effort,omitzero"`
+ // **Deprecated:** use `summary` instead.
+ //
+ // A summary of the reasoning performed by the model. This can be useful for
+ // debugging and understanding the model's reasoning process. One of `auto`,
+ // `concise`, or `detailed`.
+ //
+ // Any of "auto", "concise", "detailed".
+ //
+ // Deprecated: deprecated
+ GenerateSummary string `json:"generate_summary,omitzero"`
+ // A summary of the reasoning performed by the model. This can be useful for
+ // debugging and understanding the model's reasoning process. One of `auto`,
+ // `concise`, or `detailed`.
+ //
+ // `concise` is supported for `computer-use-preview` models and all reasoning
+ // models after `gpt-5`.
+ //
+ // Any of "auto", "concise", "detailed".
+ Summary string `json:"summary,omitzero"`
+ // Controls the reasoning execution mode for the request.
+ //
+ // When returned on a response, this is the effective execution mode.
+ Mode string `json:"mode,omitzero"`
+ paramObj
+}
+
+func (r BetaResponseInputTokenCountParamsReasoning) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputTokenCountParamsReasoning
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputTokenCountParamsReasoning) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseInputTokenCountParamsReasoning](
+ "context", "auto", "current_turn", "all_turns",
+ )
+ apijson.RegisterFieldValidator[BetaResponseInputTokenCountParamsReasoning](
+ "effort", "none", "minimal", "low", "medium", "high", "xhigh", "max",
+ )
+ apijson.RegisterFieldValidator[BetaResponseInputTokenCountParamsReasoning](
+ "generate_summary", "auto", "concise", "detailed",
+ )
+ apijson.RegisterFieldValidator[BetaResponseInputTokenCountParamsReasoning](
+ "summary", "auto", "concise", "detailed",
+ )
+}
+
+// Configuration options for a text response from the model. Can be plain text or
+// structured JSON data. Learn more:
+//
+// - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
+// - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
+type BetaResponseInputTokenCountParamsText struct {
+ // Constrains the verbosity of the model's response. Lower values will result in
+ // more concise responses, while higher values will result in more verbose
+ // responses. Currently supported values are `low`, `medium`, and `high`. The
+ // default is `medium`.
+ //
+ // Any of "low", "medium", "high".
+ Verbosity string `json:"verbosity,omitzero"`
+ // An object specifying the format that the model must output.
+ //
+ // Configuring `{ "type": "json_schema" }` enables Structured Outputs, which
+ // ensures the model will match your supplied JSON schema. Learn more in the
+ // [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
+ //
+ // The default format is `{ "type": "text" }` with no additional options.
+ //
+ // **Not recommended for gpt-4o and newer models:**
+ //
+ // Setting to `{ "type": "json_object" }` enables the older JSON mode, which
+ // ensures the message the model generates is valid JSON. Using `json_schema` is
+ // preferred for models that support it.
+ Format BetaResponseFormatTextConfigUnionParam `json:"format,omitzero"`
+ paramObj
+}
+
+func (r BetaResponseInputTokenCountParamsText) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputTokenCountParamsText
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputTokenCountParamsText) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[BetaResponseInputTokenCountParamsText](
+ "verbosity", "low", "medium", "high",
+ )
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BetaResponseInputTokenCountParamsToolChoiceUnion struct {
+ // Check if union is this variant with !param.IsOmitted(union.OfToolChoiceMode)
+ OfToolChoiceMode param.Opt[BetaToolChoiceOptions] `json:",omitzero,inline"`
+ OfAllowedTools *BetaToolChoiceAllowedParam `json:",omitzero,inline"`
+ OfHostedTool *BetaToolChoiceTypesParam `json:",omitzero,inline"`
+ OfFunctionTool *BetaToolChoiceFunctionParam `json:",omitzero,inline"`
+ OfMcpTool *BetaToolChoiceMcpParam `json:",omitzero,inline"`
+ OfCustomTool *BetaToolChoiceCustomParam `json:",omitzero,inline"`
+ OfBetaResponseInputTokenCountsToolChoiceBetaSpecificProgrammaticToolCallingParam *BetaResponseInputTokenCountParamsToolChoiceBetaSpecificProgrammaticToolCallingParam `json:",omitzero,inline"`
+ OfSpecificApplyPatchToolChoice *BetaToolChoiceApplyPatchParam `json:",omitzero,inline"`
+ OfSpecificShellToolChoice *BetaToolChoiceShellParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BetaResponseInputTokenCountParamsToolChoiceUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfToolChoiceMode,
+ u.OfAllowedTools,
+ u.OfHostedTool,
+ u.OfFunctionTool,
+ u.OfMcpTool,
+ u.OfCustomTool,
+ u.OfBetaResponseInputTokenCountsToolChoiceBetaSpecificProgrammaticToolCallingParam,
+ u.OfSpecificApplyPatchToolChoice,
+ u.OfSpecificShellToolChoice)
+}
+func (u *BetaResponseInputTokenCountParamsToolChoiceUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BetaResponseInputTokenCountParamsToolChoiceUnion) asAny() any {
+ if !param.IsOmitted(u.OfToolChoiceMode) {
+ return &u.OfToolChoiceMode
+ } else if !param.IsOmitted(u.OfAllowedTools) {
+ return u.OfAllowedTools
+ } else if !param.IsOmitted(u.OfHostedTool) {
+ return u.OfHostedTool
+ } else if !param.IsOmitted(u.OfFunctionTool) {
+ return u.OfFunctionTool
+ } else if !param.IsOmitted(u.OfMcpTool) {
+ return u.OfMcpTool
+ } else if !param.IsOmitted(u.OfCustomTool) {
+ return u.OfCustomTool
+ } else if !param.IsOmitted(u.OfBetaResponseInputTokenCountsToolChoiceBetaSpecificProgrammaticToolCallingParam) {
+ return u.OfBetaResponseInputTokenCountsToolChoiceBetaSpecificProgrammaticToolCallingParam
+ } else if !param.IsOmitted(u.OfSpecificApplyPatchToolChoice) {
+ return u.OfSpecificApplyPatchToolChoice
+ } else if !param.IsOmitted(u.OfSpecificShellToolChoice) {
+ return u.OfSpecificShellToolChoice
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputTokenCountParamsToolChoiceUnion) GetMode() *string {
+ if vt := u.OfAllowedTools; vt != nil {
+ return (*string)(&vt.Mode)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputTokenCountParamsToolChoiceUnion) GetTools() []map[string]any {
+ if vt := u.OfAllowedTools; vt != nil {
+ return vt.Tools
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputTokenCountParamsToolChoiceUnion) GetServerLabel() *string {
+ if vt := u.OfMcpTool; vt != nil {
+ return &vt.ServerLabel
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputTokenCountParamsToolChoiceUnion) GetType() *string {
+ if vt := u.OfAllowedTools; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfHostedTool; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfFunctionTool; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfMcpTool; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfCustomTool; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfBetaResponseInputTokenCountsToolChoiceBetaSpecificProgrammaticToolCallingParam; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfSpecificApplyPatchToolChoice; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfSpecificShellToolChoice; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u BetaResponseInputTokenCountParamsToolChoiceUnion) GetName() *string {
+ if vt := u.OfFunctionTool; vt != nil {
+ return (*string)(&vt.Name)
+ } else if vt := u.OfMcpTool; vt != nil && vt.Name.Valid() {
+ return &vt.Name.Value
+ } else if vt := u.OfCustomTool; vt != nil {
+ return (*string)(&vt.Name)
+ }
+ return nil
+}
+
+func NewBetaResponseInputTokenCountParamsToolChoiceBetaSpecificProgrammaticToolCallingParam() BetaResponseInputTokenCountParamsToolChoiceBetaSpecificProgrammaticToolCallingParam {
+ return BetaResponseInputTokenCountParamsToolChoiceBetaSpecificProgrammaticToolCallingParam{
+ Type: "programmatic_tool_calling",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewBetaResponseInputTokenCountParamsToolChoiceBetaSpecificProgrammaticToolCallingParam].
+type BetaResponseInputTokenCountParamsToolChoiceBetaSpecificProgrammaticToolCallingParam struct {
+ // The tool to call. Always `programmatic_tool_calling`.
+ Type constant.ProgrammaticToolCalling `json:"type" default:"programmatic_tool_calling"`
+ paramObj
+}
+
+func (r BetaResponseInputTokenCountParamsToolChoiceBetaSpecificProgrammaticToolCallingParam) MarshalJSON() (data []byte, err error) {
+ type shadow BetaResponseInputTokenCountParamsToolChoiceBetaSpecificProgrammaticToolCallingParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BetaResponseInputTokenCountParamsToolChoiceBetaSpecificProgrammaticToolCallingParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The truncation strategy to use for the model response. - `auto`: If the input to
+// this Response exceeds the model's context window size, the model will truncate
+// the response to fit the context window by dropping items from the beginning of
+// the conversation. - `disabled` (default): If the input size will exceed the
+// context window size for a model, the request will fail with a 400 error.
+type BetaResponseInputTokenCountParamsTruncation string
+
+const (
+ BetaResponseInputTokenCountParamsTruncationAuto BetaResponseInputTokenCountParamsTruncation = "auto"
+ BetaResponseInputTokenCountParamsTruncationDisabled BetaResponseInputTokenCountParamsTruncation = "disabled"
+)
diff --git a/vendor/github.com/openai/openai-go/v3/betathread.go b/vendor/github.com/openai/openai-go/v3/betathread.go
index 524e4be02..9384998d6 100644
--- a/vendor/github.com/openai/openai-go/v3/betathread.go
+++ b/vendor/github.com/openai/openai-go/v3/betathread.go
@@ -6,7 +6,6 @@ import (
"context"
"encoding/json"
"errors"
- "fmt"
"net/http"
"slices"
@@ -57,7 +56,8 @@ func NewBetaThreadService(opts ...option.RequestOption) (r BetaThreadService) {
//
// Deprecated: The Assistants API is deprecated in favor of the Responses API
func (r *BetaThreadService) New(ctx context.Context, body BetaThreadNewParams, opts ...option.RequestOption) (res *Thread, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
path := "threads"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
@@ -68,13 +68,14 @@ func (r *BetaThreadService) New(ctx context.Context, body BetaThreadNewParams, o
//
// Deprecated: The Assistants API is deprecated in favor of the Responses API
func (r *BetaThreadService) Get(ctx context.Context, threadID string, opts ...option.RequestOption) (res *Thread, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if threadID == "" {
err = errors.New("missing required thread_id parameter")
return nil, err
}
- path := fmt.Sprintf("threads/%s", threadID)
+ path := requestconfig.FormatPath("threads/%s", threadID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
@@ -83,13 +84,14 @@ func (r *BetaThreadService) Get(ctx context.Context, threadID string, opts ...op
//
// Deprecated: The Assistants API is deprecated in favor of the Responses API
func (r *BetaThreadService) Update(ctx context.Context, threadID string, body BetaThreadUpdateParams, opts ...option.RequestOption) (res *Thread, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if threadID == "" {
err = errors.New("missing required thread_id parameter")
return nil, err
}
- path := fmt.Sprintf("threads/%s", threadID)
+ path := requestconfig.FormatPath("threads/%s", threadID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
@@ -98,13 +100,14 @@ func (r *BetaThreadService) Update(ctx context.Context, threadID string, body Be
//
// Deprecated: The Assistants API is deprecated in favor of the Responses API
func (r *BetaThreadService) Delete(ctx context.Context, threadID string, opts ...option.RequestOption) (res *ThreadDeleted, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if threadID == "" {
err = errors.New("missing required thread_id parameter")
return nil, err
}
- path := fmt.Sprintf("threads/%s", threadID)
+ path := requestconfig.FormatPath("threads/%s", threadID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
return res, err
}
@@ -113,7 +116,8 @@ func (r *BetaThreadService) Delete(ctx context.Context, threadID string, opts ..
//
// Deprecated: The Assistants API is deprecated in favor of the Responses API
func (r *BetaThreadService) NewAndRun(ctx context.Context, body BetaThreadNewAndRunParams, opts ...option.RequestOption) (res *Run, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
path := "threads/runs"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
@@ -128,7 +132,8 @@ func (r *BetaThreadService) NewAndRunStreaming(ctx context.Context, body BetaThr
raw *http.Response
err error
)
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
opts = append(opts, option.WithJSONSet("stream", true))
path := "threads/runs"
@@ -461,7 +466,7 @@ type Thread struct {
// The identifier, which can be referenced in API endpoints.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) for when the thread was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Set of 16 key-value pairs that can be attached to an object. This can be useful
// for storing additional information about the object in a structured format, and
// querying for objects via API or the dashboard.
diff --git a/vendor/github.com/openai/openai-go/v3/betathreadmessage.go b/vendor/github.com/openai/openai-go/v3/betathreadmessage.go
index 110e709bd..69c6b19da 100644
--- a/vendor/github.com/openai/openai-go/v3/betathreadmessage.go
+++ b/vendor/github.com/openai/openai-go/v3/betathreadmessage.go
@@ -6,7 +6,6 @@ import (
"context"
"encoding/json"
"errors"
- "fmt"
"net/http"
"net/url"
"slices"
@@ -49,13 +48,14 @@ func NewBetaThreadMessageService(opts ...option.RequestOption) (r BetaThreadMess
//
// Deprecated: The Assistants API is deprecated in favor of the Responses API
func (r *BetaThreadMessageService) New(ctx context.Context, threadID string, body BetaThreadMessageNewParams, opts ...option.RequestOption) (res *Message, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if threadID == "" {
err = errors.New("missing required thread_id parameter")
return nil, err
}
- path := fmt.Sprintf("threads/%s/messages", threadID)
+ path := requestconfig.FormatPath("threads/%s/messages", threadID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
@@ -64,7 +64,8 @@ func (r *BetaThreadMessageService) New(ctx context.Context, threadID string, bod
//
// Deprecated: The Assistants API is deprecated in favor of the Responses API
func (r *BetaThreadMessageService) Get(ctx context.Context, threadID string, messageID string, opts ...option.RequestOption) (res *Message, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if threadID == "" {
err = errors.New("missing required thread_id parameter")
@@ -74,7 +75,7 @@ func (r *BetaThreadMessageService) Get(ctx context.Context, threadID string, mes
err = errors.New("missing required message_id parameter")
return nil, err
}
- path := fmt.Sprintf("threads/%s/messages/%s", threadID, messageID)
+ path := requestconfig.FormatPath("threads/%s/messages/%s", threadID, messageID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
@@ -83,7 +84,8 @@ func (r *BetaThreadMessageService) Get(ctx context.Context, threadID string, mes
//
// Deprecated: The Assistants API is deprecated in favor of the Responses API
func (r *BetaThreadMessageService) Update(ctx context.Context, threadID string, messageID string, body BetaThreadMessageUpdateParams, opts ...option.RequestOption) (res *Message, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if threadID == "" {
err = errors.New("missing required thread_id parameter")
@@ -93,7 +95,7 @@ func (r *BetaThreadMessageService) Update(ctx context.Context, threadID string,
err = errors.New("missing required message_id parameter")
return nil, err
}
- path := fmt.Sprintf("threads/%s/messages/%s", threadID, messageID)
+ path := requestconfig.FormatPath("threads/%s/messages/%s", threadID, messageID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
@@ -103,13 +105,14 @@ func (r *BetaThreadMessageService) Update(ctx context.Context, threadID string,
// Deprecated: The Assistants API is deprecated in favor of the Responses API
func (r *BetaThreadMessageService) List(ctx context.Context, threadID string, query BetaThreadMessageListParams, opts ...option.RequestOption) (res *pagination.CursorPage[Message], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2"), option.WithResponseInto(&raw)}, opts...)
if threadID == "" {
err = errors.New("missing required thread_id parameter")
return nil, err
}
- path := fmt.Sprintf("threads/%s/messages", threadID)
+ path := requestconfig.FormatPath("threads/%s/messages", threadID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
@@ -133,7 +136,8 @@ func (r *BetaThreadMessageService) ListAutoPaging(ctx context.Context, threadID
//
// Deprecated: The Assistants API is deprecated in favor of the Responses API
func (r *BetaThreadMessageService) Delete(ctx context.Context, threadID string, messageID string, opts ...option.RequestOption) (res *MessageDeleted, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if threadID == "" {
err = errors.New("missing required thread_id parameter")
@@ -143,7 +147,7 @@ func (r *BetaThreadMessageService) Delete(ctx context.Context, threadID string,
err = errors.New("missing required message_id parameter")
return nil, err
}
- path := fmt.Sprintf("threads/%s/messages/%s", threadID, messageID)
+ path := requestconfig.FormatPath("threads/%s/messages/%s", threadID, messageID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
return res, err
}
@@ -780,7 +784,7 @@ type ImageURLDelta struct {
Detail ImageURLDeltaDetail `json:"detail"`
// The URL of the image, must be a supported image types: jpeg, jpg, png, gif,
// webp.
- URL string `json:"url"`
+ URL string `json:"url" format:"uri"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Detail respjson.Field
@@ -841,13 +845,13 @@ type Message struct {
// A list of files attached to the message, and the tools they were added to.
Attachments []MessageAttachment `json:"attachments" api:"required"`
// The Unix timestamp (in seconds) for when the message was completed.
- CompletedAt int64 `json:"completed_at" api:"required"`
+ CompletedAt int64 `json:"completed_at" api:"required" format:"unixtime"`
// The content of the message in array of text and/or images.
Content []MessageContentUnion `json:"content" api:"required"`
// The Unix timestamp (in seconds) for when the message was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The Unix timestamp (in seconds) for when the message was marked as incomplete.
- IncompleteAt int64 `json:"incomplete_at" api:"required"`
+ IncompleteAt int64 `json:"incomplete_at" api:"required" format:"unixtime"`
// On an incomplete message, details about why the message is incomplete.
IncompleteDetails MessageIncompleteDetails `json:"incomplete_details" api:"required"`
// Set of 16 key-value pairs that can be attached to an object. This can be useful
diff --git a/vendor/github.com/openai/openai-go/v3/betathreadrun.go b/vendor/github.com/openai/openai-go/v3/betathreadrun.go
index 9f43bcb24..d986860f5 100644
--- a/vendor/github.com/openai/openai-go/v3/betathreadrun.go
+++ b/vendor/github.com/openai/openai-go/v3/betathreadrun.go
@@ -5,7 +5,6 @@ package openai
import (
"context"
"errors"
- "fmt"
"net/http"
"net/url"
"slices"
@@ -54,13 +53,14 @@ func NewBetaThreadRunService(opts ...option.RequestOption) (r BetaThreadRunServi
//
// Deprecated: The Assistants API is deprecated in favor of the Responses API
func (r *BetaThreadRunService) New(ctx context.Context, threadID string, params BetaThreadRunNewParams, opts ...option.RequestOption) (res *Run, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if threadID == "" {
err = errors.New("missing required thread_id parameter")
return nil, err
}
- path := fmt.Sprintf("threads/%s/runs", threadID)
+ path := requestconfig.FormatPath("threads/%s/runs", threadID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
return res, err
}
@@ -73,14 +73,15 @@ func (r *BetaThreadRunService) NewStreaming(ctx context.Context, threadID string
raw *http.Response
err error
)
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
opts = append(opts, option.WithJSONSet("stream", true))
if threadID == "" {
err = errors.New("missing required thread_id parameter")
return ssestream.NewStream[AssistantStreamEventUnion](nil, err)
}
- path := fmt.Sprintf("threads/%s/runs", threadID)
+ path := requestconfig.FormatPath("threads/%s/runs", threadID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &raw, opts...)
return ssestream.NewStreamWithSynthesizeEventData[AssistantStreamEventUnion](ssestream.NewDecoder(raw), err)
}
@@ -89,7 +90,8 @@ func (r *BetaThreadRunService) NewStreaming(ctx context.Context, threadID string
//
// Deprecated: The Assistants API is deprecated in favor of the Responses API
func (r *BetaThreadRunService) Get(ctx context.Context, threadID string, runID string, opts ...option.RequestOption) (res *Run, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if threadID == "" {
err = errors.New("missing required thread_id parameter")
@@ -99,7 +101,7 @@ func (r *BetaThreadRunService) Get(ctx context.Context, threadID string, runID s
err = errors.New("missing required run_id parameter")
return nil, err
}
- path := fmt.Sprintf("threads/%s/runs/%s", threadID, runID)
+ path := requestconfig.FormatPath("threads/%s/runs/%s", threadID, runID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
@@ -108,7 +110,8 @@ func (r *BetaThreadRunService) Get(ctx context.Context, threadID string, runID s
//
// Deprecated: The Assistants API is deprecated in favor of the Responses API
func (r *BetaThreadRunService) Update(ctx context.Context, threadID string, runID string, body BetaThreadRunUpdateParams, opts ...option.RequestOption) (res *Run, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if threadID == "" {
err = errors.New("missing required thread_id parameter")
@@ -118,7 +121,7 @@ func (r *BetaThreadRunService) Update(ctx context.Context, threadID string, runI
err = errors.New("missing required run_id parameter")
return nil, err
}
- path := fmt.Sprintf("threads/%s/runs/%s", threadID, runID)
+ path := requestconfig.FormatPath("threads/%s/runs/%s", threadID, runID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
@@ -128,13 +131,14 @@ func (r *BetaThreadRunService) Update(ctx context.Context, threadID string, runI
// Deprecated: The Assistants API is deprecated in favor of the Responses API
func (r *BetaThreadRunService) List(ctx context.Context, threadID string, query BetaThreadRunListParams, opts ...option.RequestOption) (res *pagination.CursorPage[Run], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2"), option.WithResponseInto(&raw)}, opts...)
if threadID == "" {
err = errors.New("missing required thread_id parameter")
return nil, err
}
- path := fmt.Sprintf("threads/%s/runs", threadID)
+ path := requestconfig.FormatPath("threads/%s/runs", threadID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
@@ -158,7 +162,8 @@ func (r *BetaThreadRunService) ListAutoPaging(ctx context.Context, threadID stri
//
// Deprecated: The Assistants API is deprecated in favor of the Responses API
func (r *BetaThreadRunService) Cancel(ctx context.Context, threadID string, runID string, opts ...option.RequestOption) (res *Run, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if threadID == "" {
err = errors.New("missing required thread_id parameter")
@@ -168,7 +173,7 @@ func (r *BetaThreadRunService) Cancel(ctx context.Context, threadID string, runI
err = errors.New("missing required run_id parameter")
return nil, err
}
- path := fmt.Sprintf("threads/%s/runs/%s/cancel", threadID, runID)
+ path := requestconfig.FormatPath("threads/%s/runs/%s/cancel", threadID, runID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
return res, err
}
@@ -180,7 +185,8 @@ func (r *BetaThreadRunService) Cancel(ctx context.Context, threadID string, runI
//
// Deprecated: The Assistants API is deprecated in favor of the Responses API
func (r *BetaThreadRunService) SubmitToolOutputs(ctx context.Context, threadID string, runID string, body BetaThreadRunSubmitToolOutputsParams, opts ...option.RequestOption) (res *Run, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if threadID == "" {
err = errors.New("missing required thread_id parameter")
@@ -190,7 +196,7 @@ func (r *BetaThreadRunService) SubmitToolOutputs(ctx context.Context, threadID s
err = errors.New("missing required run_id parameter")
return nil, err
}
- path := fmt.Sprintf("threads/%s/runs/%s/submit_tool_outputs", threadID, runID)
+ path := requestconfig.FormatPath("threads/%s/runs/%s/submit_tool_outputs", threadID, runID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
@@ -206,7 +212,8 @@ func (r *BetaThreadRunService) SubmitToolOutputsStreaming(ctx context.Context, t
raw *http.Response
err error
)
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
opts = append(opts, option.WithJSONSet("stream", true))
if threadID == "" {
@@ -217,7 +224,7 @@ func (r *BetaThreadRunService) SubmitToolOutputsStreaming(ctx context.Context, t
err = errors.New("missing required run_id parameter")
return ssestream.NewStream[AssistantStreamEventUnion](nil, err)
}
- path := fmt.Sprintf("threads/%s/runs/%s/submit_tool_outputs", threadID, runID)
+ path := requestconfig.FormatPath("threads/%s/runs/%s/submit_tool_outputs", threadID, runID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &raw, opts...)
return ssestream.NewStreamWithSynthesizeEventData[AssistantStreamEventUnion](ssestream.NewDecoder(raw), err)
}
@@ -281,15 +288,15 @@ type Run struct {
// execution of this run.
AssistantID string `json:"assistant_id" api:"required"`
// The Unix timestamp (in seconds) for when the run was cancelled.
- CancelledAt int64 `json:"cancelled_at" api:"required"`
+ CancelledAt int64 `json:"cancelled_at" api:"required" format:"unixtime"`
// The Unix timestamp (in seconds) for when the run was completed.
- CompletedAt int64 `json:"completed_at" api:"required"`
+ CompletedAt int64 `json:"completed_at" api:"required" format:"unixtime"`
// The Unix timestamp (in seconds) for when the run was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The Unix timestamp (in seconds) for when the run will expire.
- ExpiresAt int64 `json:"expires_at" api:"required"`
+ ExpiresAt int64 `json:"expires_at" api:"required" format:"unixtime"`
// The Unix timestamp (in seconds) for when the run failed.
- FailedAt int64 `json:"failed_at" api:"required"`
+ FailedAt int64 `json:"failed_at" api:"required" format:"unixtime"`
// Details on why the run is incomplete. Will be `null` if the run is not
// incomplete.
IncompleteDetails RunIncompleteDetails `json:"incomplete_details" api:"required"`
@@ -347,7 +354,7 @@ type Run struct {
// max context length.
ResponseFormat AssistantResponseFormatOptionUnion `json:"response_format" api:"required"`
// The Unix timestamp (in seconds) for when the run was started.
- StartedAt int64 `json:"started_at" api:"required"`
+ StartedAt int64 `json:"started_at" api:"required" format:"unixtime"`
// The status of the run, which can be either `queued`, `in_progress`,
// `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`,
// `incomplete`, or `expired`.
@@ -628,21 +635,14 @@ type BetaThreadRunNewParams struct {
// model associated with the assistant. If not, the model associated with the
// assistant will be used.
Model shared.ChatModel `json:"model,omitzero"`
- // Constrains effort on reasoning for
- // [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
- // supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`.
- // Reducing reasoning effort can result in faster responses and fewer tokens used
- // on reasoning in a response.
+ // Constrains effort on reasoning for reasoning models. Currently supported values
+ // are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. Reducing
+ // reasoning effort can result in faster responses and fewer tokens used on
+ // reasoning in a response. Not all reasoning models support every value. See the
+ // [reasoning guide](https://platform.openai.com/docs/guides/reasoning) for
+ // model-specific support.
//
- // - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported
- // reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool
- // calls are supported for all reasoning values in gpt-5.1.
- // - All models before `gpt-5.1` default to `medium` reasoning effort, and do not
- // support `none`.
- // - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
- // - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
- //
- // Any of "none", "minimal", "low", "medium", "high", "xhigh".
+ // Any of "none", "minimal", "low", "medium", "high", "xhigh", "max".
ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"`
// Override the tools the assistant can use for this run. This is useful for
// modifying the behavior on a per-run basis.
diff --git a/vendor/github.com/openai/openai-go/v3/betathreadrunstep.go b/vendor/github.com/openai/openai-go/v3/betathreadrunstep.go
index d7073939e..d5e72267d 100644
--- a/vendor/github.com/openai/openai-go/v3/betathreadrunstep.go
+++ b/vendor/github.com/openai/openai-go/v3/betathreadrunstep.go
@@ -6,7 +6,6 @@ import (
"context"
"encoding/json"
"errors"
- "fmt"
"net/http"
"net/url"
"slices"
@@ -49,7 +48,8 @@ func NewBetaThreadRunStepService(opts ...option.RequestOption) (r BetaThreadRunS
//
// Deprecated: The Assistants API is deprecated in favor of the Responses API
func (r *BetaThreadRunStepService) Get(ctx context.Context, threadID string, runID string, stepID string, query BetaThreadRunStepGetParams, opts ...option.RequestOption) (res *RunStep, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if threadID == "" {
err = errors.New("missing required thread_id parameter")
@@ -63,7 +63,7 @@ func (r *BetaThreadRunStepService) Get(ctx context.Context, threadID string, run
err = errors.New("missing required step_id parameter")
return nil, err
}
- path := fmt.Sprintf("threads/%s/runs/%s/steps/%s", threadID, runID, stepID)
+ path := requestconfig.FormatPath("threads/%s/runs/%s/steps/%s", threadID, runID, stepID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
return res, err
}
@@ -73,7 +73,8 @@ func (r *BetaThreadRunStepService) Get(ctx context.Context, threadID string, run
// Deprecated: The Assistants API is deprecated in favor of the Responses API
func (r *BetaThreadRunStepService) List(ctx context.Context, threadID string, runID string, query BetaThreadRunStepListParams, opts ...option.RequestOption) (res *pagination.CursorPage[RunStep], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2"), option.WithResponseInto(&raw)}, opts...)
if threadID == "" {
err = errors.New("missing required thread_id parameter")
@@ -83,7 +84,7 @@ func (r *BetaThreadRunStepService) List(ctx context.Context, threadID string, ru
err = errors.New("missing required run_id parameter")
return nil, err
}
- path := fmt.Sprintf("threads/%s/runs/%s/steps", threadID, runID)
+ path := requestconfig.FormatPath("threads/%s/runs/%s/steps", threadID, runID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
@@ -761,16 +762,16 @@ type RunStep struct {
// associated with the run step.
AssistantID string `json:"assistant_id" api:"required"`
// The Unix timestamp (in seconds) for when the run step was cancelled.
- CancelledAt int64 `json:"cancelled_at" api:"required"`
+ CancelledAt int64 `json:"cancelled_at" api:"required" format:"unixtime"`
// The Unix timestamp (in seconds) for when the run step completed.
- CompletedAt int64 `json:"completed_at" api:"required"`
+ CompletedAt int64 `json:"completed_at" api:"required" format:"unixtime"`
// The Unix timestamp (in seconds) for when the run step was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The Unix timestamp (in seconds) for when the run step expired. A step is
// considered expired if the parent run is expired.
- ExpiredAt int64 `json:"expired_at" api:"required"`
+ ExpiredAt int64 `json:"expired_at" api:"required" format:"unixtime"`
// The Unix timestamp (in seconds) for when the run step failed.
- FailedAt int64 `json:"failed_at" api:"required"`
+ FailedAt int64 `json:"failed_at" api:"required" format:"unixtime"`
// The last error associated with this run step. Will be `null` if there are no
// errors.
LastError RunStepLastError `json:"last_error" api:"required"`
diff --git a/vendor/github.com/openai/openai-go/v3/chatcompletion.go b/vendor/github.com/openai/openai-go/v3/chatcompletion.go
index a465632bd..39d7d9073 100644
--- a/vendor/github.com/openai/openai-go/v3/chatcompletion.go
+++ b/vendor/github.com/openai/openai-go/v3/chatcompletion.go
@@ -6,7 +6,6 @@ import (
"context"
"encoding/json"
"errors"
- "fmt"
"net/http"
"net/url"
"slices"
@@ -70,7 +69,8 @@ func NewChatCompletionService(opts ...option.RequestOption) (r ChatCompletionSer
// Returns a chat completion object, or a streamed sequence of chat completion
// chunk objects if the request is streamed.
func (r *ChatCompletionService) New(ctx context.Context, body ChatCompletionNewParams, opts ...option.RequestOption) (res *ChatCompletion, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "chat/completions"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -101,7 +101,8 @@ func (r *ChatCompletionService) NewStreaming(ctx context.Context, body ChatCompl
raw *http.Response
err error
)
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append(opts, option.WithJSONSet("stream", true))
path := "chat/completions"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &raw, opts...)
@@ -111,12 +112,13 @@ func (r *ChatCompletionService) NewStreaming(ctx context.Context, body ChatCompl
// Get a stored chat completion. Only Chat Completions that have been created with
// the `store` parameter set to `true` will be returned.
func (r *ChatCompletionService) Get(ctx context.Context, completionID string, opts ...option.RequestOption) (res *ChatCompletion, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if completionID == "" {
err = errors.New("missing required completion_id parameter")
return nil, err
}
- path := fmt.Sprintf("chat/completions/%s", completionID)
+ path := requestconfig.FormatPath("chat/completions/%s", completionID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
@@ -125,12 +127,13 @@ func (r *ChatCompletionService) Get(ctx context.Context, completionID string, op
// with the `store` parameter set to `true` can be modified. Currently, the only
// supported modification is to update the `metadata` field.
func (r *ChatCompletionService) Update(ctx context.Context, completionID string, body ChatCompletionUpdateParams, opts ...option.RequestOption) (res *ChatCompletion, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if completionID == "" {
err = errors.New("missing required completion_id parameter")
return nil, err
}
- path := fmt.Sprintf("chat/completions/%s", completionID)
+ path := requestconfig.FormatPath("chat/completions/%s", completionID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
@@ -139,7 +142,8 @@ func (r *ChatCompletionService) Update(ctx context.Context, completionID string,
// the `store` parameter set to `true` will be returned.
func (r *ChatCompletionService) List(ctx context.Context, query ChatCompletionListParams, opts ...option.RequestOption) (res *pagination.CursorPage[ChatCompletion], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "chat/completions"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
@@ -163,12 +167,13 @@ func (r *ChatCompletionService) ListAutoPaging(ctx context.Context, query ChatCo
// Delete a stored chat completion. Only Chat Completions that have been created
// with the `store` parameter set to `true` can be deleted.
func (r *ChatCompletionService) Delete(ctx context.Context, completionID string, opts ...option.RequestOption) (res *ChatCompletionDeleted, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if completionID == "" {
err = errors.New("missing required completion_id parameter")
return nil, err
}
- path := fmt.Sprintf("chat/completions/%s", completionID)
+ path := requestconfig.FormatPath("chat/completions/%s", completionID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
return res, err
}
@@ -182,11 +187,14 @@ type ChatCompletion struct {
// than 1.
Choices []ChatCompletionChoice `json:"choices" api:"required"`
// The Unix timestamp (in seconds) of when the chat completion was created.
- Created int64 `json:"created" api:"required"`
+ Created int64 `json:"created" api:"required" format:"unixtime"`
// The model used for the chat completion.
Model string `json:"model" api:"required"`
// The object type, which is always `chat.completion`.
Object constant.ChatCompletion `json:"object" default:"chat.completion"`
+ // Moderation results for the request input and generated output, if moderated
+ // completions were requested.
+ Moderation ChatCompletionModeration `json:"moderation" api:"nullable"`
// Specifies the processing type used for serving the request.
//
// - If set to 'auto', then the request will be processed with the service tier
@@ -222,6 +230,7 @@ type ChatCompletion struct {
Created respjson.Field
Model respjson.Field
Object respjson.Field
+ Moderation respjson.Field
ServiceTier respjson.Field
SystemFingerprint respjson.Field
Usage respjson.Field
@@ -242,7 +251,8 @@ type ChatCompletionChoice struct {
// number of tokens specified in the request was reached, `content_filter` if
// content was omitted due to a flag from our content filters, `tool_calls` if the
// model called a tool, or `function_call` (deprecated) if the model called a
- // function.
+ // function. Read the [Model Spec](https://model-spec.openai.com/2025-12-18.html)
+ // for more.
//
// Any of "stop", "length", "tool_calls", "content_filter", "function_call".
FinishReason string `json:"finish_reason" api:"required"`
@@ -290,6 +300,342 @@ func (r *ChatCompletionChoiceLogprobs) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// Moderation results for the request input and generated output, if moderated
+// completions were requested.
+type ChatCompletionModeration struct {
+ // Moderation for the request input.
+ Input ChatCompletionModerationInputUnion `json:"input" api:"required"`
+ // Moderation for the generated output.
+ Output ChatCompletionModerationOutputUnion `json:"output" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Input respjson.Field
+ Output respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ChatCompletionModeration) RawJSON() string { return r.JSON.raw }
+func (r *ChatCompletionModeration) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ChatCompletionModerationInputUnion contains all possible properties and values
+// from [ChatCompletionModerationInputModerationResults],
+// [ChatCompletionModerationInputError].
+//
+// Use the [ChatCompletionModerationInputUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ChatCompletionModerationInputUnion struct {
+ // This field is from variant [ChatCompletionModerationInputModerationResults].
+ Model string `json:"model"`
+ // This field is from variant [ChatCompletionModerationInputModerationResults].
+ Results []ChatCompletionModerationInputModerationResultsResult `json:"results"`
+ // Any of "moderation_results", "error".
+ Type string `json:"type"`
+ // This field is from variant [ChatCompletionModerationInputError].
+ Code string `json:"code"`
+ // This field is from variant [ChatCompletionModerationInputError].
+ Message string `json:"message"`
+ JSON struct {
+ Model respjson.Field
+ Results respjson.Field
+ Type respjson.Field
+ Code respjson.Field
+ Message respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyChatCompletionModerationInput is implemented by each variant of
+// [ChatCompletionModerationInputUnion] to add type safety for the return type of
+// [ChatCompletionModerationInputUnion.AsAny]
+type anyChatCompletionModerationInput interface {
+ implChatCompletionModerationInputUnion()
+}
+
+func (ChatCompletionModerationInputModerationResults) implChatCompletionModerationInputUnion() {}
+func (ChatCompletionModerationInputError) implChatCompletionModerationInputUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ChatCompletionModerationInputUnion.AsAny().(type) {
+// case openai.ChatCompletionModerationInputModerationResults:
+// case openai.ChatCompletionModerationInputError:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ChatCompletionModerationInputUnion) AsAny() anyChatCompletionModerationInput {
+ switch u.Type {
+ case "moderation_results":
+ return u.AsModerationResults()
+ case "error":
+ return u.AsError()
+ }
+ return nil
+}
+
+func (u ChatCompletionModerationInputUnion) AsModerationResults() (v ChatCompletionModerationInputModerationResults) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ChatCompletionModerationInputUnion) AsError() (v ChatCompletionModerationInputError) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ChatCompletionModerationInputUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ChatCompletionModerationInputUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Successful moderation results for the request input or generated output.
+type ChatCompletionModerationInputModerationResults struct {
+ // The moderation model used to generate the results.
+ Model string `json:"model" api:"required"`
+ // A list of moderation results.
+ Results []ChatCompletionModerationInputModerationResultsResult `json:"results" api:"required"`
+ // The object type, which is always `moderation_results`.
+ Type constant.ModerationResults `json:"type" default:"moderation_results"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Model respjson.Field
+ Results respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ChatCompletionModerationInputModerationResults) RawJSON() string { return r.JSON.raw }
+func (r *ChatCompletionModerationInputModerationResults) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A moderation result produced for the response input or output.
+type ChatCompletionModerationInputModerationResultsResult struct {
+ // A dictionary of moderation categories to booleans, True if the input is flagged
+ // under this category.
+ Categories map[string]bool `json:"categories" api:"required"`
+ // Which modalities of input are reflected by the score for each category.
+ CategoryAppliedInputTypes map[string][]string `json:"category_applied_input_types" api:"required"`
+ // A dictionary of moderation categories to scores.
+ CategoryScores map[string]float64 `json:"category_scores" api:"required"`
+ // A boolean indicating whether the content was flagged by any category.
+ Flagged bool `json:"flagged" api:"required"`
+ // The moderation model that produced this result.
+ Model string `json:"model" api:"required"`
+ // The object type, which was always `moderation_result` for successful moderation
+ // results.
+ Type constant.ModerationResult `json:"type" default:"moderation_result"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Categories respjson.Field
+ CategoryAppliedInputTypes respjson.Field
+ CategoryScores respjson.Field
+ Flagged respjson.Field
+ Model respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ChatCompletionModerationInputModerationResultsResult) RawJSON() string { return r.JSON.raw }
+func (r *ChatCompletionModerationInputModerationResultsResult) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An error produced while attempting moderation.
+type ChatCompletionModerationInputError struct {
+ // The error code.
+ Code string `json:"code" api:"required"`
+ // The error message.
+ Message string `json:"message" api:"required"`
+ // The object type, which is always `error`.
+ Type constant.Error `json:"type" default:"error"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Code respjson.Field
+ Message respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ChatCompletionModerationInputError) RawJSON() string { return r.JSON.raw }
+func (r *ChatCompletionModerationInputError) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ChatCompletionModerationOutputUnion contains all possible properties and values
+// from [ChatCompletionModerationOutputModerationResults],
+// [ChatCompletionModerationOutputError].
+//
+// Use the [ChatCompletionModerationOutputUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ChatCompletionModerationOutputUnion struct {
+ // This field is from variant [ChatCompletionModerationOutputModerationResults].
+ Model string `json:"model"`
+ // This field is from variant [ChatCompletionModerationOutputModerationResults].
+ Results []ChatCompletionModerationOutputModerationResultsResult `json:"results"`
+ // Any of "moderation_results", "error".
+ Type string `json:"type"`
+ // This field is from variant [ChatCompletionModerationOutputError].
+ Code string `json:"code"`
+ // This field is from variant [ChatCompletionModerationOutputError].
+ Message string `json:"message"`
+ JSON struct {
+ Model respjson.Field
+ Results respjson.Field
+ Type respjson.Field
+ Code respjson.Field
+ Message respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyChatCompletionModerationOutput is implemented by each variant of
+// [ChatCompletionModerationOutputUnion] to add type safety for the return type of
+// [ChatCompletionModerationOutputUnion.AsAny]
+type anyChatCompletionModerationOutput interface {
+ implChatCompletionModerationOutputUnion()
+}
+
+func (ChatCompletionModerationOutputModerationResults) implChatCompletionModerationOutputUnion() {}
+func (ChatCompletionModerationOutputError) implChatCompletionModerationOutputUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ChatCompletionModerationOutputUnion.AsAny().(type) {
+// case openai.ChatCompletionModerationOutputModerationResults:
+// case openai.ChatCompletionModerationOutputError:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ChatCompletionModerationOutputUnion) AsAny() anyChatCompletionModerationOutput {
+ switch u.Type {
+ case "moderation_results":
+ return u.AsModerationResults()
+ case "error":
+ return u.AsError()
+ }
+ return nil
+}
+
+func (u ChatCompletionModerationOutputUnion) AsModerationResults() (v ChatCompletionModerationOutputModerationResults) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ChatCompletionModerationOutputUnion) AsError() (v ChatCompletionModerationOutputError) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ChatCompletionModerationOutputUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ChatCompletionModerationOutputUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Successful moderation results for the request input or generated output.
+type ChatCompletionModerationOutputModerationResults struct {
+ // The moderation model used to generate the results.
+ Model string `json:"model" api:"required"`
+ // A list of moderation results.
+ Results []ChatCompletionModerationOutputModerationResultsResult `json:"results" api:"required"`
+ // The object type, which is always `moderation_results`.
+ Type constant.ModerationResults `json:"type" default:"moderation_results"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Model respjson.Field
+ Results respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ChatCompletionModerationOutputModerationResults) RawJSON() string { return r.JSON.raw }
+func (r *ChatCompletionModerationOutputModerationResults) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A moderation result produced for the response input or output.
+type ChatCompletionModerationOutputModerationResultsResult struct {
+ // A dictionary of moderation categories to booleans, True if the input is flagged
+ // under this category.
+ Categories map[string]bool `json:"categories" api:"required"`
+ // Which modalities of input are reflected by the score for each category.
+ CategoryAppliedInputTypes map[string][]string `json:"category_applied_input_types" api:"required"`
+ // A dictionary of moderation categories to scores.
+ CategoryScores map[string]float64 `json:"category_scores" api:"required"`
+ // A boolean indicating whether the content was flagged by any category.
+ Flagged bool `json:"flagged" api:"required"`
+ // The moderation model that produced this result.
+ Model string `json:"model" api:"required"`
+ // The object type, which was always `moderation_result` for successful moderation
+ // results.
+ Type constant.ModerationResult `json:"type" default:"moderation_result"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Categories respjson.Field
+ CategoryAppliedInputTypes respjson.Field
+ CategoryScores respjson.Field
+ Flagged respjson.Field
+ Model respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ChatCompletionModerationOutputModerationResultsResult) RawJSON() string { return r.JSON.raw }
+func (r *ChatCompletionModerationOutputModerationResultsResult) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An error produced while attempting moderation.
+type ChatCompletionModerationOutputError struct {
+ // The error code.
+ Code string `json:"code" api:"required"`
+ // The error message.
+ Message string `json:"message" api:"required"`
+ // The object type, which is always `error`.
+ Type constant.Error `json:"type" default:"error"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Code respjson.Field
+ Message respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ChatCompletionModerationOutputError) RawJSON() string { return r.JSON.raw }
+func (r *ChatCompletionModerationOutputError) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// Specifies the processing type used for serving the request.
//
// - If set to 'auto', then the request will be processed with the service tier
@@ -450,6 +796,14 @@ func (u ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion) GetTe
return nil
}
+// Returns a pointer to the underlying variant's property, if present.
+func (u ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion) GetPromptCacheBreakpoint() *ChatCompletionContentPartTextPromptCacheBreakpointParam {
+ if vt := u.OfText; vt != nil {
+ return &vt.PromptCacheBreakpoint
+ }
+ return nil
+}
+
// Returns a pointer to the underlying variant's property, if present.
func (u ChatCompletionAssistantMessageParamContentArrayOfContentPartUnion) GetRefusal() *string {
if vt := u.OfRefusal; vt != nil {
@@ -512,7 +866,7 @@ type ChatCompletionAudio struct {
Data string `json:"data" api:"required"`
// The Unix timestamp (in seconds) for when this audio response will no longer be
// accessible on the server for use in multi-turn conversations.
- ExpiresAt int64 `json:"expires_at" api:"required"`
+ ExpiresAt int64 `json:"expires_at" api:"required" format:"unixtime"`
// Transcript of the audio generated by the model.
Transcript string `json:"transcript" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
@@ -646,11 +1000,14 @@ type ChatCompletionChunk struct {
Choices []ChatCompletionChunkChoice `json:"choices" api:"required"`
// The Unix timestamp (in seconds) of when the chat completion was created. Each
// chunk has the same timestamp.
- Created int64 `json:"created" api:"required"`
+ Created int64 `json:"created" api:"required" format:"unixtime"`
// The model to generate the completion.
Model string `json:"model" api:"required"`
// The object type, which is always `chat.completion.chunk`.
Object constant.ChatCompletionChunk `json:"object" default:"chat.completion.chunk"`
+ // Moderation results for the request input and generated output. Present on the
+ // moderation chunk when moderated completions are requested.
+ Moderation ChatCompletionChunkModeration `json:"moderation" api:"nullable"`
// Specifies the processing type used for serving the request.
//
// - If set to 'auto', then the request will be processed with the service tier
@@ -691,6 +1048,7 @@ type ChatCompletionChunk struct {
Created respjson.Field
Model respjson.Field
Object respjson.Field
+ Moderation respjson.Field
ServiceTier respjson.Field
SystemFingerprint respjson.Field
Usage respjson.Field
@@ -794,25 +1152,354 @@ type ChatCompletionChunkChoiceDeltaFunctionCall struct {
}
// Returns the unmodified JSON received from the API
-func (r ChatCompletionChunkChoiceDeltaFunctionCall) RawJSON() string { return r.JSON.raw }
-func (r *ChatCompletionChunkChoiceDeltaFunctionCall) UnmarshalJSON(data []byte) error {
+func (r ChatCompletionChunkChoiceDeltaFunctionCall) RawJSON() string { return r.JSON.raw }
+func (r *ChatCompletionChunkChoiceDeltaFunctionCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ChatCompletionChunkChoiceDeltaToolCall struct {
+ Index int64 `json:"index" api:"required"`
+ // The ID of the tool call.
+ ID string `json:"id"`
+ Function ChatCompletionChunkChoiceDeltaToolCallFunction `json:"function"`
+ // The type of the tool. Currently, only `function` is supported.
+ //
+ // Any of "function".
+ Type string `json:"type"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Index respjson.Field
+ ID respjson.Field
+ Function respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ChatCompletionChunkChoiceDeltaToolCall) RawJSON() string { return r.JSON.raw }
+func (r *ChatCompletionChunkChoiceDeltaToolCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ChatCompletionChunkChoiceDeltaToolCallFunction struct {
+ // The arguments to call the function with, as generated by the model in JSON
+ // format. Note that the model does not always generate valid JSON, and may
+ // hallucinate parameters not defined by your function schema. Validate the
+ // arguments in your code before calling your function.
+ Arguments string `json:"arguments"`
+ // The name of the function to call.
+ Name string `json:"name"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Arguments respjson.Field
+ Name respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ChatCompletionChunkChoiceDeltaToolCallFunction) RawJSON() string { return r.JSON.raw }
+func (r *ChatCompletionChunkChoiceDeltaToolCallFunction) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Log probability information for the choice.
+type ChatCompletionChunkChoiceLogprobs struct {
+ // A list of message content tokens with log probability information.
+ Content []ChatCompletionTokenLogprob `json:"content" api:"required"`
+ // A list of message refusal tokens with log probability information.
+ Refusal []ChatCompletionTokenLogprob `json:"refusal" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Content respjson.Field
+ Refusal respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ChatCompletionChunkChoiceLogprobs) RawJSON() string { return r.JSON.raw }
+func (r *ChatCompletionChunkChoiceLogprobs) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Moderation results for the request input and generated output. Present on the
+// moderation chunk when moderated completions are requested.
+type ChatCompletionChunkModeration struct {
+ // Moderation for the request input.
+ Input ChatCompletionChunkModerationInputUnion `json:"input" api:"required"`
+ // Moderation for the generated output.
+ Output ChatCompletionChunkModerationOutputUnion `json:"output" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Input respjson.Field
+ Output respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ChatCompletionChunkModeration) RawJSON() string { return r.JSON.raw }
+func (r *ChatCompletionChunkModeration) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ChatCompletionChunkModerationInputUnion contains all possible properties and
+// values from [ChatCompletionChunkModerationInputModerationResults],
+// [ChatCompletionChunkModerationInputError].
+//
+// Use the [ChatCompletionChunkModerationInputUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ChatCompletionChunkModerationInputUnion struct {
+ // This field is from variant
+ // [ChatCompletionChunkModerationInputModerationResults].
+ Model string `json:"model"`
+ // This field is from variant
+ // [ChatCompletionChunkModerationInputModerationResults].
+ Results []ChatCompletionChunkModerationInputModerationResultsResult `json:"results"`
+ // Any of "moderation_results", "error".
+ Type string `json:"type"`
+ // This field is from variant [ChatCompletionChunkModerationInputError].
+ Code string `json:"code"`
+ // This field is from variant [ChatCompletionChunkModerationInputError].
+ Message string `json:"message"`
+ JSON struct {
+ Model respjson.Field
+ Results respjson.Field
+ Type respjson.Field
+ Code respjson.Field
+ Message respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyChatCompletionChunkModerationInput is implemented by each variant of
+// [ChatCompletionChunkModerationInputUnion] to add type safety for the return type
+// of [ChatCompletionChunkModerationInputUnion.AsAny]
+type anyChatCompletionChunkModerationInput interface {
+ implChatCompletionChunkModerationInputUnion()
+}
+
+func (ChatCompletionChunkModerationInputModerationResults) implChatCompletionChunkModerationInputUnion() {
+}
+func (ChatCompletionChunkModerationInputError) implChatCompletionChunkModerationInputUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ChatCompletionChunkModerationInputUnion.AsAny().(type) {
+// case openai.ChatCompletionChunkModerationInputModerationResults:
+// case openai.ChatCompletionChunkModerationInputError:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ChatCompletionChunkModerationInputUnion) AsAny() anyChatCompletionChunkModerationInput {
+ switch u.Type {
+ case "moderation_results":
+ return u.AsModerationResults()
+ case "error":
+ return u.AsError()
+ }
+ return nil
+}
+
+func (u ChatCompletionChunkModerationInputUnion) AsModerationResults() (v ChatCompletionChunkModerationInputModerationResults) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ChatCompletionChunkModerationInputUnion) AsError() (v ChatCompletionChunkModerationInputError) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ChatCompletionChunkModerationInputUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ChatCompletionChunkModerationInputUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Successful moderation results for the request input or generated output.
+type ChatCompletionChunkModerationInputModerationResults struct {
+ // The moderation model used to generate the results.
+ Model string `json:"model" api:"required"`
+ // A list of moderation results.
+ Results []ChatCompletionChunkModerationInputModerationResultsResult `json:"results" api:"required"`
+ // The object type, which is always `moderation_results`.
+ Type constant.ModerationResults `json:"type" default:"moderation_results"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Model respjson.Field
+ Results respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ChatCompletionChunkModerationInputModerationResults) RawJSON() string { return r.JSON.raw }
+func (r *ChatCompletionChunkModerationInputModerationResults) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A moderation result produced for the response input or output.
+type ChatCompletionChunkModerationInputModerationResultsResult struct {
+ // A dictionary of moderation categories to booleans, True if the input is flagged
+ // under this category.
+ Categories map[string]bool `json:"categories" api:"required"`
+ // Which modalities of input are reflected by the score for each category.
+ CategoryAppliedInputTypes map[string][]string `json:"category_applied_input_types" api:"required"`
+ // A dictionary of moderation categories to scores.
+ CategoryScores map[string]float64 `json:"category_scores" api:"required"`
+ // A boolean indicating whether the content was flagged by any category.
+ Flagged bool `json:"flagged" api:"required"`
+ // The moderation model that produced this result.
+ Model string `json:"model" api:"required"`
+ // The object type, which was always `moderation_result` for successful moderation
+ // results.
+ Type constant.ModerationResult `json:"type" default:"moderation_result"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Categories respjson.Field
+ CategoryAppliedInputTypes respjson.Field
+ CategoryScores respjson.Field
+ Flagged respjson.Field
+ Model respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ChatCompletionChunkModerationInputModerationResultsResult) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *ChatCompletionChunkModerationInputModerationResultsResult) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An error produced while attempting moderation.
+type ChatCompletionChunkModerationInputError struct {
+ // The error code.
+ Code string `json:"code" api:"required"`
+ // The error message.
+ Message string `json:"message" api:"required"`
+ // The object type, which is always `error`.
+ Type constant.Error `json:"type" default:"error"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Code respjson.Field
+ Message respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ChatCompletionChunkModerationInputError) RawJSON() string { return r.JSON.raw }
+func (r *ChatCompletionChunkModerationInputError) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ChatCompletionChunkModerationOutputUnion contains all possible properties and
+// values from [ChatCompletionChunkModerationOutputModerationResults],
+// [ChatCompletionChunkModerationOutputError].
+//
+// Use the [ChatCompletionChunkModerationOutputUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ChatCompletionChunkModerationOutputUnion struct {
+ // This field is from variant
+ // [ChatCompletionChunkModerationOutputModerationResults].
+ Model string `json:"model"`
+ // This field is from variant
+ // [ChatCompletionChunkModerationOutputModerationResults].
+ Results []ChatCompletionChunkModerationOutputModerationResultsResult `json:"results"`
+ // Any of "moderation_results", "error".
+ Type string `json:"type"`
+ // This field is from variant [ChatCompletionChunkModerationOutputError].
+ Code string `json:"code"`
+ // This field is from variant [ChatCompletionChunkModerationOutputError].
+ Message string `json:"message"`
+ JSON struct {
+ Model respjson.Field
+ Results respjson.Field
+ Type respjson.Field
+ Code respjson.Field
+ Message respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyChatCompletionChunkModerationOutput is implemented by each variant of
+// [ChatCompletionChunkModerationOutputUnion] to add type safety for the return
+// type of [ChatCompletionChunkModerationOutputUnion.AsAny]
+type anyChatCompletionChunkModerationOutput interface {
+ implChatCompletionChunkModerationOutputUnion()
+}
+
+func (ChatCompletionChunkModerationOutputModerationResults) implChatCompletionChunkModerationOutputUnion() {
+}
+func (ChatCompletionChunkModerationOutputError) implChatCompletionChunkModerationOutputUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ChatCompletionChunkModerationOutputUnion.AsAny().(type) {
+// case openai.ChatCompletionChunkModerationOutputModerationResults:
+// case openai.ChatCompletionChunkModerationOutputError:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ChatCompletionChunkModerationOutputUnion) AsAny() anyChatCompletionChunkModerationOutput {
+ switch u.Type {
+ case "moderation_results":
+ return u.AsModerationResults()
+ case "error":
+ return u.AsError()
+ }
+ return nil
+}
+
+func (u ChatCompletionChunkModerationOutputUnion) AsModerationResults() (v ChatCompletionChunkModerationOutputModerationResults) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ChatCompletionChunkModerationOutputUnion) AsError() (v ChatCompletionChunkModerationOutputError) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ChatCompletionChunkModerationOutputUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ChatCompletionChunkModerationOutputUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ChatCompletionChunkChoiceDeltaToolCall struct {
- Index int64 `json:"index" api:"required"`
- // The ID of the tool call.
- ID string `json:"id"`
- Function ChatCompletionChunkChoiceDeltaToolCallFunction `json:"function"`
- // The type of the tool. Currently, only `function` is supported.
- //
- // Any of "function".
- Type string `json:"type"`
+// Successful moderation results for the request input or generated output.
+type ChatCompletionChunkModerationOutputModerationResults struct {
+ // The moderation model used to generate the results.
+ Model string `json:"model" api:"required"`
+ // A list of moderation results.
+ Results []ChatCompletionChunkModerationOutputModerationResultsResult `json:"results" api:"required"`
+ // The object type, which is always `moderation_results`.
+ Type constant.ModerationResults `json:"type" default:"moderation_results"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Index respjson.Field
- ID respjson.Field
- Function respjson.Field
+ Model respjson.Field
+ Results respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
raw string
@@ -820,52 +1507,69 @@ type ChatCompletionChunkChoiceDeltaToolCall struct {
}
// Returns the unmodified JSON received from the API
-func (r ChatCompletionChunkChoiceDeltaToolCall) RawJSON() string { return r.JSON.raw }
-func (r *ChatCompletionChunkChoiceDeltaToolCall) UnmarshalJSON(data []byte) error {
+func (r ChatCompletionChunkModerationOutputModerationResults) RawJSON() string { return r.JSON.raw }
+func (r *ChatCompletionChunkModerationOutputModerationResults) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ChatCompletionChunkChoiceDeltaToolCallFunction struct {
- // The arguments to call the function with, as generated by the model in JSON
- // format. Note that the model does not always generate valid JSON, and may
- // hallucinate parameters not defined by your function schema. Validate the
- // arguments in your code before calling your function.
- Arguments string `json:"arguments"`
- // The name of the function to call.
- Name string `json:"name"`
+// A moderation result produced for the response input or output.
+type ChatCompletionChunkModerationOutputModerationResultsResult struct {
+ // A dictionary of moderation categories to booleans, True if the input is flagged
+ // under this category.
+ Categories map[string]bool `json:"categories" api:"required"`
+ // Which modalities of input are reflected by the score for each category.
+ CategoryAppliedInputTypes map[string][]string `json:"category_applied_input_types" api:"required"`
+ // A dictionary of moderation categories to scores.
+ CategoryScores map[string]float64 `json:"category_scores" api:"required"`
+ // A boolean indicating whether the content was flagged by any category.
+ Flagged bool `json:"flagged" api:"required"`
+ // The moderation model that produced this result.
+ Model string `json:"model" api:"required"`
+ // The object type, which was always `moderation_result` for successful moderation
+ // results.
+ Type constant.ModerationResult `json:"type" default:"moderation_result"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Arguments respjson.Field
- Name respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Categories respjson.Field
+ CategoryAppliedInputTypes respjson.Field
+ CategoryScores respjson.Field
+ Flagged respjson.Field
+ Model respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
-func (r ChatCompletionChunkChoiceDeltaToolCallFunction) RawJSON() string { return r.JSON.raw }
-func (r *ChatCompletionChunkChoiceDeltaToolCallFunction) UnmarshalJSON(data []byte) error {
+func (r ChatCompletionChunkModerationOutputModerationResultsResult) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *ChatCompletionChunkModerationOutputModerationResultsResult) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Log probability information for the choice.
-type ChatCompletionChunkChoiceLogprobs struct {
- // A list of message content tokens with log probability information.
- Content []ChatCompletionTokenLogprob `json:"content" api:"required"`
- // A list of message refusal tokens with log probability information.
- Refusal []ChatCompletionTokenLogprob `json:"refusal" api:"required"`
+// An error produced while attempting moderation.
+type ChatCompletionChunkModerationOutputError struct {
+ // The error code.
+ Code string `json:"code" api:"required"`
+ // The error message.
+ Message string `json:"message" api:"required"`
+ // The object type, which is always `error`.
+ Type constant.Error `json:"type" default:"error"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Content respjson.Field
- Refusal respjson.Field
+ Code respjson.Field
+ Message respjson.Field
+ Type respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
-func (r ChatCompletionChunkChoiceLogprobs) RawJSON() string { return r.JSON.raw }
-func (r *ChatCompletionChunkChoiceLogprobs) UnmarshalJSON(data []byte) error {
+func (r ChatCompletionChunkModerationOutputError) RawJSON() string { return r.JSON.raw }
+func (r *ChatCompletionChunkModerationOutputError) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
@@ -996,6 +1700,56 @@ func (u ChatCompletionContentPartUnionParam) GetType() *string {
return nil
}
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u ChatCompletionContentPartUnionParam) GetPromptCacheBreakpoint() (res chatCompletionContentPartUnionParamPromptCacheBreakpoint) {
+ if vt := u.OfText; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ } else if vt := u.OfImageURL; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ } else if vt := u.OfInputAudio; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ } else if vt := u.OfFile; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ }
+ return
+}
+
+// Can have the runtime types
+// [*ChatCompletionContentPartTextPromptCacheBreakpointParam],
+// [*ChatCompletionContentPartImagePromptCacheBreakpointParam],
+// [*ChatCompletionContentPartInputAudioPromptCacheBreakpointParam],
+// [*ChatCompletionContentPartFilePromptCacheBreakpointParam]
+type chatCompletionContentPartUnionParamPromptCacheBreakpoint struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *openai.ChatCompletionContentPartTextPromptCacheBreakpointParam:
+// case *openai.ChatCompletionContentPartImagePromptCacheBreakpointParam:
+// case *openai.ChatCompletionContentPartInputAudioPromptCacheBreakpointParam:
+// case *openai.ChatCompletionContentPartFilePromptCacheBreakpointParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u chatCompletionContentPartUnionParamPromptCacheBreakpoint) AsAny() any { return u.any }
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u chatCompletionContentPartUnionParamPromptCacheBreakpoint) GetMode() *string {
+ switch vt := u.any.(type) {
+ case *ChatCompletionContentPartTextPromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ case *ChatCompletionContentPartImagePromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ case *ChatCompletionContentPartInputAudioPromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ case *ChatCompletionContentPartFilePromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ }
+ return nil
+}
+
func init() {
apijson.RegisterUnion[ChatCompletionContentPartUnionParam](
"type",
@@ -1012,6 +1766,10 @@ func init() {
// The properties File, Type are required.
type ChatCompletionContentPartFileParam struct {
File ChatCompletionContentPartFileFileParam `json:"file,omitzero" api:"required"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint ChatCompletionContentPartFilePromptCacheBreakpointParam `json:"prompt_cache_breakpoint,omitzero"`
// The type of the content part. Always `file`.
//
// This field can be elided, and will marshal its zero value as "file".
@@ -1046,17 +1804,48 @@ func (r *ChatCompletionContentPartFileFileParam) UnmarshalJSON(data []byte) erro
return apijson.UnmarshalRoot(data, r)
}
+func NewChatCompletionContentPartFilePromptCacheBreakpointParam() ChatCompletionContentPartFilePromptCacheBreakpointParam {
+ return ChatCompletionContentPartFilePromptCacheBreakpointParam{
+ Mode: "explicit",
+ }
+}
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+//
+// This struct has a constant value, construct it with
+// [NewChatCompletionContentPartFilePromptCacheBreakpointParam].
+type ChatCompletionContentPartFilePromptCacheBreakpointParam struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ paramObj
+}
+
+func (r ChatCompletionContentPartFilePromptCacheBreakpointParam) MarshalJSON() (data []byte, err error) {
+ type shadow ChatCompletionContentPartFilePromptCacheBreakpointParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ChatCompletionContentPartFilePromptCacheBreakpointParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// Learn about [image inputs](https://platform.openai.com/docs/guides/vision).
type ChatCompletionContentPartImage struct {
ImageURL ChatCompletionContentPartImageImageURL `json:"image_url" api:"required"`
// The type of the content part.
Type constant.ImageURL `json:"type" default:"image_url"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint ChatCompletionContentPartImagePromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- ImageURL respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ ImageURL respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -1099,11 +1888,35 @@ func (r *ChatCompletionContentPartImageImageURL) UnmarshalJSON(data []byte) erro
return apijson.UnmarshalRoot(data, r)
}
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+type ChatCompletionContentPartImagePromptCacheBreakpoint struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Mode respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ChatCompletionContentPartImagePromptCacheBreakpoint) RawJSON() string { return r.JSON.raw }
+func (r *ChatCompletionContentPartImagePromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// Learn about [image inputs](https://platform.openai.com/docs/guides/vision).
//
// The properties ImageURL, Type are required.
type ChatCompletionContentPartImageParam struct {
ImageURL ChatCompletionContentPartImageImageURLParam `json:"image_url,omitzero" api:"required"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint ChatCompletionContentPartImagePromptCacheBreakpointParam `json:"prompt_cache_breakpoint,omitzero"`
// The type of the content part.
//
// This field can be elided, and will marshal its zero value as "image_url".
@@ -1145,11 +1958,41 @@ func init() {
)
}
+func NewChatCompletionContentPartImagePromptCacheBreakpointParam() ChatCompletionContentPartImagePromptCacheBreakpointParam {
+ return ChatCompletionContentPartImagePromptCacheBreakpointParam{
+ Mode: "explicit",
+ }
+}
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+//
+// This struct has a constant value, construct it with
+// [NewChatCompletionContentPartImagePromptCacheBreakpointParam].
+type ChatCompletionContentPartImagePromptCacheBreakpointParam struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ paramObj
+}
+
+func (r ChatCompletionContentPartImagePromptCacheBreakpointParam) MarshalJSON() (data []byte, err error) {
+ type shadow ChatCompletionContentPartImagePromptCacheBreakpointParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ChatCompletionContentPartImagePromptCacheBreakpointParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// Learn about [audio inputs](https://platform.openai.com/docs/guides/audio).
//
// The properties InputAudio, Type are required.
type ChatCompletionContentPartInputAudioParam struct {
InputAudio ChatCompletionContentPartInputAudioInputAudioParam `json:"input_audio,omitzero" api:"required"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint ChatCompletionContentPartInputAudioPromptCacheBreakpointParam `json:"prompt_cache_breakpoint,omitzero"`
// The type of the content part. Always `input_audio`.
//
// This field can be elided, and will marshal its zero value as "input_audio".
@@ -1190,6 +2033,32 @@ func init() {
)
}
+func NewChatCompletionContentPartInputAudioPromptCacheBreakpointParam() ChatCompletionContentPartInputAudioPromptCacheBreakpointParam {
+ return ChatCompletionContentPartInputAudioPromptCacheBreakpointParam{
+ Mode: "explicit",
+ }
+}
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+//
+// This struct has a constant value, construct it with
+// [NewChatCompletionContentPartInputAudioPromptCacheBreakpointParam].
+type ChatCompletionContentPartInputAudioPromptCacheBreakpointParam struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ paramObj
+}
+
+func (r ChatCompletionContentPartInputAudioPromptCacheBreakpointParam) MarshalJSON() (data []byte, err error) {
+ type shadow ChatCompletionContentPartInputAudioPromptCacheBreakpointParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ChatCompletionContentPartInputAudioPromptCacheBreakpointParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// The properties Refusal, Type are required.
type ChatCompletionContentPartRefusalParam struct {
// The refusal message generated by the model.
@@ -1216,12 +2085,17 @@ type ChatCompletionContentPartText struct {
Text string `json:"text" api:"required"`
// The type of the content part.
Type constant.Text `json:"type" default:"text"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint ChatCompletionContentPartTextPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Text respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -1241,6 +2115,26 @@ func (r ChatCompletionContentPartText) ToParam() ChatCompletionContentPartTextPa
return param.Override[ChatCompletionContentPartTextParam](json.RawMessage(r.RawJSON()))
}
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+type ChatCompletionContentPartTextPromptCacheBreakpoint struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Mode respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ChatCompletionContentPartTextPromptCacheBreakpoint) RawJSON() string { return r.JSON.raw }
+func (r *ChatCompletionContentPartTextPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// Learn about
// [text inputs](https://platform.openai.com/docs/guides/text-generation).
//
@@ -1248,6 +2142,10 @@ func (r ChatCompletionContentPartText) ToParam() ChatCompletionContentPartTextPa
type ChatCompletionContentPartTextParam struct {
// The text content.
Text string `json:"text" api:"required"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint ChatCompletionContentPartTextPromptCacheBreakpointParam `json:"prompt_cache_breakpoint,omitzero"`
// The type of the content part.
//
// This field can be elided, and will marshal its zero value as "text".
@@ -1263,6 +2161,32 @@ func (r *ChatCompletionContentPartTextParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+func NewChatCompletionContentPartTextPromptCacheBreakpointParam() ChatCompletionContentPartTextPromptCacheBreakpointParam {
+ return ChatCompletionContentPartTextPromptCacheBreakpointParam{
+ Mode: "explicit",
+ }
+}
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+//
+// This struct has a constant value, construct it with
+// [NewChatCompletionContentPartTextPromptCacheBreakpointParam].
+type ChatCompletionContentPartTextPromptCacheBreakpointParam struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ paramObj
+}
+
+func (r ChatCompletionContentPartTextPromptCacheBreakpointParam) MarshalJSON() (data []byte, err error) {
+ type shadow ChatCompletionContentPartTextPromptCacheBreakpointParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ChatCompletionContentPartTextPromptCacheBreakpointParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A custom tool that processes input using a specified format.
//
// The properties Custom, Type are required.
@@ -1688,7 +2612,7 @@ type ChatCompletionMessageAnnotationURLCitation struct {
// The title of the web resource.
Title string `json:"title" api:"required"`
// The URL of the web resource.
- URL string `json:"url" api:"required"`
+ URL string `json:"url" api:"required" format:"uri"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
EndIndex respjson.Field
@@ -2476,13 +3400,17 @@ type ChatCompletionStoreMessageContentPartUnion struct {
// This field is from variant [ChatCompletionContentPartText].
Text string `json:"text"`
Type string `json:"type"`
+ // This field is a union of [ChatCompletionContentPartTextPromptCacheBreakpoint],
+ // [ChatCompletionContentPartImagePromptCacheBreakpoint]
+ PromptCacheBreakpoint ChatCompletionStoreMessageContentPartUnionPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
// This field is from variant [ChatCompletionContentPartImage].
ImageURL ChatCompletionContentPartImageImageURL `json:"image_url"`
JSON struct {
- Text respjson.Field
- Type respjson.Field
- ImageURL respjson.Field
- raw string
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ ImageURL respjson.Field
+ raw string
} `json:"-"`
}
@@ -2503,6 +3431,26 @@ func (r *ChatCompletionStoreMessageContentPartUnion) UnmarshalJSON(data []byte)
return apijson.UnmarshalRoot(data, r)
}
+// ChatCompletionStoreMessageContentPartUnionPromptCacheBreakpoint is an implicit
+// subunion of [ChatCompletionStoreMessageContentPartUnion].
+// ChatCompletionStoreMessageContentPartUnionPromptCacheBreakpoint provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [ChatCompletionStoreMessageContentPartUnion].
+type ChatCompletionStoreMessageContentPartUnionPromptCacheBreakpoint struct {
+ // This field is from variant [ChatCompletionContentPartTextPromptCacheBreakpoint].
+ Mode constant.Explicit `json:"mode"`
+ JSON struct {
+ Mode respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *ChatCompletionStoreMessageContentPartUnionPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// Options for streaming response. Only set this when you set `stream: true`.
type ChatCompletionStreamOptionsParam struct {
// When true, stream obfuscation will be enabled. Stream obfuscation adds random
@@ -2595,8 +3543,7 @@ type ChatCompletionTokenLogprob struct {
// unlikely.
Logprob float64 `json:"logprob" api:"required"`
// List of the most likely tokens and their log probability, at this token
- // position. In rare cases, there may be fewer than the number of requested
- // `top_logprobs` returned.
+ // position. The number of entries may be fewer than the requested `top_logprobs`.
TopLogprobs []ChatCompletionTokenLogprobTopLogprob `json:"top_logprobs" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
@@ -2999,6 +3946,17 @@ type ChatCompletionNewParams struct {
// whether they appear in the text so far, increasing the model's likelihood to
// talk about new topics.
PresencePenalty param.Opt[float64] `json:"presence_penalty,omitzero"`
+ // Used by OpenAI to cache responses for similar requests to optimize your cache
+ // hit rates. Replaces the `user` field.
+ // [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
+ PromptCacheKey param.Opt[string] `json:"prompt_cache_key,omitzero"`
+ // A stable identifier used to help detect users of your application that may be
+ // violating OpenAI's usage policies. The IDs should be a string that uniquely
+ // identifies each user, with a maximum length of 64 characters. We recommend
+ // hashing their username or email address, in order to avoid sending us any
+ // identifying information.
+ // [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
+ SafetyIdentifier param.Opt[string] `json:"safety_identifier,omitzero"`
// This feature is in Beta. If specified, our system will make a best effort to
// sample deterministically, such that repeated requests with the same `seed` and
// parameters should return the same result. Determinism is not guaranteed, and you
@@ -3016,8 +3974,9 @@ type ChatCompletionNewParams struct {
// focused and deterministic. We generally recommend altering this or `top_p` but
// not both.
Temperature param.Opt[float64] `json:"temperature,omitzero"`
- // An integer between 0 and 20 specifying the number of most likely tokens to
- // return at each token position, each with an associated log probability.
+ // An integer between 0 and 20 specifying the maximum number of most likely tokens
+ // to return at each token position, each with an associated log probability. In
+ // some cases, the number of returned tokens may be fewer than requested.
// `logprobs` must be set to `true` if this parameter is used.
TopLogprobs param.Opt[int64] `json:"top_logprobs,omitzero"`
// An alternative to sampling with temperature, called nucleus sampling, where the
@@ -3030,17 +3989,6 @@ type ChatCompletionNewParams struct {
// [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
// during tool use.
ParallelToolCalls param.Opt[bool] `json:"parallel_tool_calls,omitzero"`
- // Used by OpenAI to cache responses for similar requests to optimize your cache
- // hit rates. Replaces the `user` field.
- // [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
- PromptCacheKey param.Opt[string] `json:"prompt_cache_key,omitzero"`
- // A stable identifier used to help detect users of your application that may be
- // violating OpenAI's usage policies. The IDs should be a string that uniquely
- // identifies each user, with a maximum length of 64 characters. We recommend
- // hashing their username or email address, in order to avoid sending us any
- // identifying information.
- // [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
- SafetyIdentifier param.Opt[string] `json:"safety_identifier,omitzero"`
// This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use
// `prompt_cache_key` instead to maintain caching optimizations. A stable
// identifier for your end-users. Used to boost cache hit rates by better bucketing
@@ -3080,28 +4028,36 @@ type ChatCompletionNewParams struct {
//
// Any of "text", "audio".
Modalities []string `json:"modalities,omitzero"`
+ // Configuration for running moderation on the request input and generated output.
+ Moderation ChatCompletionNewParamsModeration `json:"moderation,omitzero"`
+ // Deprecated. Use `prompt_cache_options.ttl` instead.
+ //
// The retention policy for the prompt cache. Set to `24h` to enable extended
// prompt caching, which keeps cached prefixes active for longer, up to a maximum
// of 24 hours.
// [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
+ // This field expresses a maximum retention policy, while
+ // `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
+ // are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
+ // models, only `24h` is supported.
+ //
+ // For older models that support both `in_memory` and `24h`, the default depends on
+ // your organization's data retention policy:
//
- // Any of "in-memory", "24h".
+ // - Organizations without ZDR enabled default to `24h`.
+ // - Organizations with ZDR enabled default to `in_memory` when
+ // `prompt_cache_retention` is not specified.
+ //
+ // Any of "in_memory", "24h".
PromptCacheRetention ChatCompletionNewParamsPromptCacheRetention `json:"prompt_cache_retention,omitzero"`
- // Constrains effort on reasoning for
- // [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
- // supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`.
- // Reducing reasoning effort can result in faster responses and fewer tokens used
- // on reasoning in a response.
- //
- // - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported
- // reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool
- // calls are supported for all reasoning values in gpt-5.1.
- // - All models before `gpt-5.1` default to `medium` reasoning effort, and do not
- // support `none`.
- // - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
- // - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
- //
- // Any of "none", "minimal", "low", "medium", "high", "xhigh".
+ // Constrains effort on reasoning for reasoning models. Currently supported values
+ // are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. Reducing
+ // reasoning effort can result in faster responses and fewer tokens used on
+ // reasoning in a response. Not all reasoning models support every value. See the
+ // [reasoning guide](https://platform.openai.com/docs/guides/reasoning) for
+ // model-specific support.
+ //
+ // Any of "none", "minimal", "low", "medium", "high", "xhigh", "max".
ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"`
// Specifies the processing type used for serving the request.
//
@@ -3131,7 +4087,8 @@ type ChatCompletionNewParams struct {
StreamOptions ChatCompletionStreamOptionsParam `json:"stream_options,omitzero"`
// Constrains the verbosity of the model's response. Lower values will result in
// more concise responses, while higher values will result in more verbose
- // responses. Currently supported values are `low`, `medium`, and `high`.
+ // responses. Currently supported values are `low`, `medium`, and `high`. The
+ // default is `medium`.
//
// Any of "low", "medium", "high".
Verbosity ChatCompletionNewParamsVerbosity `json:"verbosity,omitzero"`
@@ -3157,6 +4114,16 @@ type ChatCompletionNewParams struct {
// Static predicted output content, such as the content of a text file that is
// being regenerated.
Prediction ChatCompletionPredictionContentParam `json:"prediction,omitzero"`
+ // Options for prompt caching. Supported for `gpt-5.6` and later models. By
+ // default, OpenAI automatically chooses one implicit cache breakpoint. You can add
+ // explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
+ // request can write up to four breakpoints. For cache matching, OpenAI considers
+ // up to the latest 80 breakpoints in the conversation, without a content-block
+ // lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
+ // `ttl` defaults to `30m`, which is currently the only supported value. See the
+ // [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
+ // for current details.
+ PromptCacheOptions ChatCompletionNewParamsPromptCacheOptions `json:"prompt_cache_options,omitzero"`
// An object specifying the format that the model must output.
//
// Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
@@ -3262,14 +4229,155 @@ func (r *ChatCompletionNewParamsFunction) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// Configuration for running moderation on the request input and generated output.
+//
+// The property Model is required.
+type ChatCompletionNewParamsModeration struct {
+ // The moderation model to use for moderated completions, e.g.
+ // 'omni-moderation-latest'.
+ Model string `json:"model" api:"required"`
+ // The policy to apply to moderated response input and output.
+ Policy ChatCompletionNewParamsModerationPolicy `json:"policy,omitzero"`
+ paramObj
+}
+
+func (r ChatCompletionNewParamsModeration) MarshalJSON() (data []byte, err error) {
+ type shadow ChatCompletionNewParamsModeration
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ChatCompletionNewParamsModeration) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The policy to apply to moderated response input and output.
+type ChatCompletionNewParamsModerationPolicy struct {
+ // The moderation policy for the response input.
+ Input ChatCompletionNewParamsModerationPolicyInput `json:"input,omitzero"`
+ // The moderation policy for the response output.
+ Output ChatCompletionNewParamsModerationPolicyOutput `json:"output,omitzero"`
+ paramObj
+}
+
+func (r ChatCompletionNewParamsModerationPolicy) MarshalJSON() (data []byte, err error) {
+ type shadow ChatCompletionNewParamsModerationPolicy
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ChatCompletionNewParamsModerationPolicy) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The moderation policy for the response input.
+//
+// The property Mode is required.
+type ChatCompletionNewParamsModerationPolicyInput struct {
+ // Any of "score", "block".
+ Mode string `json:"mode,omitzero" api:"required"`
+ paramObj
+}
+
+func (r ChatCompletionNewParamsModerationPolicyInput) MarshalJSON() (data []byte, err error) {
+ type shadow ChatCompletionNewParamsModerationPolicyInput
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ChatCompletionNewParamsModerationPolicyInput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[ChatCompletionNewParamsModerationPolicyInput](
+ "mode", "score", "block",
+ )
+}
+
+// The moderation policy for the response output.
+//
+// The property Mode is required.
+type ChatCompletionNewParamsModerationPolicyOutput struct {
+ // Any of "score", "block".
+ Mode string `json:"mode,omitzero" api:"required"`
+ paramObj
+}
+
+func (r ChatCompletionNewParamsModerationPolicyOutput) MarshalJSON() (data []byte, err error) {
+ type shadow ChatCompletionNewParamsModerationPolicyOutput
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ChatCompletionNewParamsModerationPolicyOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[ChatCompletionNewParamsModerationPolicyOutput](
+ "mode", "score", "block",
+ )
+}
+
+// Options for prompt caching. Supported for `gpt-5.6` and later models. By
+// default, OpenAI automatically chooses one implicit cache breakpoint. You can add
+// explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
+// request can write up to four breakpoints. For cache matching, OpenAI considers
+// up to the latest 80 breakpoints in the conversation, without a content-block
+// lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
+// `ttl` defaults to `30m`, which is currently the only supported value. See the
+// [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
+// for current details.
+type ChatCompletionNewParamsPromptCacheOptions struct {
+ // Controls whether OpenAI automatically creates an implicit cache breakpoint.
+ // Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
+ // and writes up to the latest three explicit breakpoints in the request. With
+ // `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
+ // latest four explicit breakpoints. If there are no explicit breakpoints, the
+ // request does not use prompt caching.
+ //
+ // Any of "implicit", "explicit".
+ Mode string `json:"mode,omitzero"`
+ // The minimum lifetime applied to every implicit and explicit cache breakpoint
+ // written by the request. Defaults to `30m`, which is currently the only supported
+ // value. The backend may retain cache entries for longer.
+ //
+ // Any of "30m".
+ Ttl string `json:"ttl,omitzero"`
+ paramObj
+}
+
+func (r ChatCompletionNewParamsPromptCacheOptions) MarshalJSON() (data []byte, err error) {
+ type shadow ChatCompletionNewParamsPromptCacheOptions
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ChatCompletionNewParamsPromptCacheOptions) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[ChatCompletionNewParamsPromptCacheOptions](
+ "mode", "implicit", "explicit",
+ )
+ apijson.RegisterFieldValidator[ChatCompletionNewParamsPromptCacheOptions](
+ "ttl", "30m",
+ )
+}
+
+// Deprecated. Use `prompt_cache_options.ttl` instead.
+//
// The retention policy for the prompt cache. Set to `24h` to enable extended
// prompt caching, which keeps cached prefixes active for longer, up to a maximum
// of 24 hours.
// [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
+// This field expresses a maximum retention policy, while
+// `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
+// are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
+// models, only `24h` is supported.
+//
+// For older models that support both `in_memory` and `24h`, the default depends on
+// your organization's data retention policy:
+//
+// - Organizations without ZDR enabled default to `24h`.
+// - Organizations with ZDR enabled default to `in_memory` when
+// `prompt_cache_retention` is not specified.
type ChatCompletionNewParamsPromptCacheRetention string
const (
- ChatCompletionNewParamsPromptCacheRetentionInMemory ChatCompletionNewParamsPromptCacheRetention = "in-memory"
+ ChatCompletionNewParamsPromptCacheRetentionInMemory ChatCompletionNewParamsPromptCacheRetention = "in_memory"
ChatCompletionNewParamsPromptCacheRetention24h ChatCompletionNewParamsPromptCacheRetention = "24h"
)
@@ -3383,7 +4491,8 @@ func (u *ChatCompletionNewParamsStopUnion) asAny() any {
// Constrains the verbosity of the model's response. Lower values will result in
// more concise responses, while higher values will result in more verbose
-// responses. Currently supported values are `low`, `medium`, and `high`.
+// responses. Currently supported values are `low`, `medium`, and `high`. The
+// default is `medium`.
type ChatCompletionNewParamsVerbosity string
const (
diff --git a/vendor/github.com/openai/openai-go/v3/chatcompletionmessage.go b/vendor/github.com/openai/openai-go/v3/chatcompletionmessage.go
index 169afc889..65a315b4e 100644
--- a/vendor/github.com/openai/openai-go/v3/chatcompletionmessage.go
+++ b/vendor/github.com/openai/openai-go/v3/chatcompletionmessage.go
@@ -5,7 +5,6 @@ package openai
import (
"context"
"errors"
- "fmt"
"net/http"
"net/url"
"slices"
@@ -43,13 +42,14 @@ func NewChatCompletionMessageService(opts ...option.RequestOption) (r ChatComple
// been created with the `store` parameter set to `true` will be returned.
func (r *ChatCompletionMessageService) List(ctx context.Context, completionID string, query ChatCompletionMessageListParams, opts ...option.RequestOption) (res *pagination.CursorPage[ChatCompletionStoreMessage], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
if completionID == "" {
err = errors.New("missing required completion_id parameter")
return nil, err
}
- path := fmt.Sprintf("chat/completions/%s/messages", completionID)
+ path := requestconfig.FormatPath("chat/completions/%s/messages", completionID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
diff --git a/vendor/github.com/openai/openai-go/v3/client.go b/vendor/github.com/openai/openai-go/v3/client.go
index 62af45c67..8982a680f 100644
--- a/vendor/github.com/openai/openai-go/v3/client.go
+++ b/vendor/github.com/openai/openai-go/v3/client.go
@@ -7,6 +7,7 @@ import (
"net/http"
"os"
"slices"
+ "strings"
"github.com/openai/openai-go/v3/conversations"
"github.com/openai/openai-go/v3/internal/requestconfig"
@@ -48,6 +49,7 @@ type Client struct {
Batches BatchService
// Use Uploads to upload large files in multiple parts.
Uploads UploadService
+ Admin AdminService
Responses responses.ResponseService
Realtime realtime.RealtimeService
// Manage conversations and conversation items.
@@ -57,17 +59,20 @@ type Client struct {
Videos VideoService
}
-// DefaultClientOptions read from the environment (OPENAI_API_KEY, OPENAI_ORG_ID,
-// OPENAI_PROJECT_ID, OPENAI_WEBHOOK_SECRET, OPENAI_BASE_URL). This should be used
-// to initialize new clients.
+// DefaultClientOptions read from the environment (OPENAI_API_KEY,
+// OPENAI_ADMIN_KEY, OPENAI_ORG_ID, OPENAI_PROJECT_ID, OPENAI_WEBHOOK_SECRET,
+// OPENAI_BASE_URL). This should be used to initialize new clients.
func DefaultClientOptions() []option.RequestOption {
- defaults := []option.RequestOption{option.WithEnvironmentProduction()}
+ defaults := defaultClientOptionsWithoutEnvironment()
if o, ok := os.LookupEnv("OPENAI_BASE_URL"); ok {
defaults = append(defaults, option.WithBaseURL(o))
}
if o, ok := os.LookupEnv("OPENAI_API_KEY"); ok {
defaults = append(defaults, option.WithAPIKey(o))
}
+ if o, ok := os.LookupEnv("OPENAI_ADMIN_KEY"); ok {
+ defaults = append(defaults, option.WithAdminAPIKey(o))
+ }
if o, ok := os.LookupEnv("OPENAI_ORG_ID"); ok {
defaults = append(defaults, option.WithOrganization(o))
}
@@ -77,16 +82,32 @@ func DefaultClientOptions() []option.RequestOption {
if o, ok := os.LookupEnv("OPENAI_WEBHOOK_SECRET"); ok {
defaults = append(defaults, option.WithWebhookSecret(o))
}
+ if o, ok := os.LookupEnv("OPENAI_CUSTOM_HEADERS"); ok {
+ for _, line := range strings.Split(o, "\n") {
+ colon := strings.Index(line, ":")
+ if colon >= 0 {
+ defaults = append(defaults, option.WithHeader(strings.TrimSpace(line[:colon]), strings.TrimSpace(line[colon+1:])))
+ }
+ }
+ }
return defaults
}
+func defaultClientOptionsWithoutEnvironment() []option.RequestOption {
+ return []option.RequestOption{option.WithHTTPClient(defaultHTTPClient()), option.WithEnvironmentProduction()}
+}
+
// NewClient generates a new client with the default option read from the
-// environment (OPENAI_API_KEY, OPENAI_ORG_ID, OPENAI_PROJECT_ID,
+// environment (OPENAI_API_KEY, OPENAI_ADMIN_KEY, OPENAI_ORG_ID, OPENAI_PROJECT_ID,
// OPENAI_WEBHOOK_SECRET, OPENAI_BASE_URL). The option passed in as arguments are
// applied after these default arguments, and all option will be passed down to the
// services and requests that this client makes.
func NewClient(opts ...option.RequestOption) (r Client) {
- opts = append(DefaultClientOptions(), opts...)
+ defaults := DefaultClientOptions()
+ if requestconfig.EnvironmentDefaultsDisabled(opts...) {
+ defaults = defaultClientOptionsWithoutEnvironment()
+ }
+ opts = append(defaults, opts...)
r = Client{Options: opts}
@@ -105,6 +126,7 @@ func NewClient(opts ...option.RequestOption) (r Client) {
r.Beta = NewBetaService(opts...)
r.Batches = NewBatchService(opts...)
r.Uploads = NewUploadService(opts...)
+ r.Admin = NewAdminService(opts...)
r.Responses = responses.NewResponseService(opts...)
r.Realtime = realtime.NewRealtimeService(opts...)
r.Conversations = conversations.NewConversationService(opts...)
@@ -147,7 +169,7 @@ func NewClient(opts ...option.RequestOption) (r Client) {
// For even greater flexibility, see [option.WithResponseInto] and
// [option.WithResponseBodyInto].
func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error {
- opts = slices.Concat(r.Options, opts)
+ opts = slices.Concat(r.Options, []option.RequestOption{requestconfig.WithBearerAuthPreference()}, opts)
return requestconfig.ExecuteNewRequest(ctx, method, path, params, res, opts...)
}
diff --git a/vendor/github.com/openai/openai-go/v3/completion.go b/vendor/github.com/openai/openai-go/v3/completion.go
index d738745af..5a4af5cc4 100644
--- a/vendor/github.com/openai/openai-go/v3/completion.go
+++ b/vendor/github.com/openai/openai-go/v3/completion.go
@@ -43,7 +43,8 @@ func NewCompletionService(opts ...option.RequestOption) (r CompletionService) {
// Returns a completion object, or a sequence of completion objects if the request
// is streamed.
func (r *CompletionService) New(ctx context.Context, body CompletionNewParams, opts ...option.RequestOption) (res *Completion, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "completions"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -58,7 +59,8 @@ func (r *CompletionService) NewStreaming(ctx context.Context, body CompletionNew
raw *http.Response
err error
)
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append(opts, option.WithJSONSet("stream", true))
path := "completions"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &raw, opts...)
@@ -73,7 +75,7 @@ type Completion struct {
// The list of completion choices the model generated for the input prompt.
Choices []CompletionChoice `json:"choices" api:"required"`
// The Unix timestamp (in seconds) of when the completion was created.
- Created int64 `json:"created" api:"required"`
+ Created int64 `json:"created" api:"required" format:"unixtime"`
// The model used for completion.
Model string `json:"model" api:"required"`
// The object type, which is always "text_completion"
@@ -232,14 +234,17 @@ func (r *CompletionUsageCompletionTokensDetails) UnmarshalJSON(data []byte) erro
type CompletionUsagePromptTokensDetails struct {
// Audio input tokens present in the prompt.
AudioTokens int64 `json:"audio_tokens"`
+ // The unadjusted number of prompt tokens written to cache.
+ CacheWriteTokens int64 `json:"cache_write_tokens"`
// Cached tokens present in the prompt.
CachedTokens int64 `json:"cached_tokens"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- AudioTokens respjson.Field
- CachedTokens respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ AudioTokens respjson.Field
+ CacheWriteTokens respjson.Field
+ CachedTokens respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
diff --git a/vendor/github.com/openai/openai-go/v3/container.go b/vendor/github.com/openai/openai-go/v3/container.go
index bf109262a..09d5396de 100644
--- a/vendor/github.com/openai/openai-go/v3/container.go
+++ b/vendor/github.com/openai/openai-go/v3/container.go
@@ -5,7 +5,6 @@ package openai
import (
"context"
"errors"
- "fmt"
"net/http"
"net/url"
"slices"
@@ -43,7 +42,8 @@ func NewContainerService(opts ...option.RequestOption) (r ContainerService) {
// Create Container
func (r *ContainerService) New(ctx context.Context, body ContainerNewParams, opts ...option.RequestOption) (res *ContainerNewResponse, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "containers"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -51,12 +51,13 @@ func (r *ContainerService) New(ctx context.Context, body ContainerNewParams, opt
// Retrieve Container
func (r *ContainerService) Get(ctx context.Context, containerID string, opts ...option.RequestOption) (res *ContainerGetResponse, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if containerID == "" {
err = errors.New("missing required container_id parameter")
return nil, err
}
- path := fmt.Sprintf("containers/%s", containerID)
+ path := requestconfig.FormatPath("containers/%s", containerID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
@@ -64,7 +65,8 @@ func (r *ContainerService) Get(ctx context.Context, containerID string, opts ...
// List Containers
func (r *ContainerService) List(ctx context.Context, query ContainerListParams, opts ...option.RequestOption) (res *pagination.CursorPage[ContainerListResponse], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "containers"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
@@ -86,13 +88,14 @@ func (r *ContainerService) ListAutoPaging(ctx context.Context, query ContainerLi
// Delete Container
func (r *ContainerService) Delete(ctx context.Context, containerID string, opts ...option.RequestOption) (err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...)
if containerID == "" {
err = errors.New("missing required container_id parameter")
return err
}
- path := fmt.Sprintf("containers/%s", containerID)
+ path := requestconfig.FormatPath("containers/%s", containerID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...)
return err
}
@@ -101,7 +104,7 @@ type ContainerNewResponse struct {
// Unique identifier for the container.
ID string `json:"id" api:"required"`
// Unix timestamp (in seconds) when the container was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Name of the container.
Name string `json:"name" api:"required"`
// The type of this object.
@@ -113,7 +116,7 @@ type ContainerNewResponse struct {
// before the container expires.
ExpiresAfter ContainerNewResponseExpiresAfter `json:"expires_after"`
// Unix timestamp (in seconds) when the container was last active.
- LastActiveAt int64 `json:"last_active_at"`
+ LastActiveAt int64 `json:"last_active_at" format:"unixtime"`
// The memory limit configured for the container.
//
// Any of "1g", "4g", "16g", "64g".
@@ -204,7 +207,7 @@ type ContainerGetResponse struct {
// Unique identifier for the container.
ID string `json:"id" api:"required"`
// Unix timestamp (in seconds) when the container was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Name of the container.
Name string `json:"name" api:"required"`
// The type of this object.
@@ -216,7 +219,7 @@ type ContainerGetResponse struct {
// before the container expires.
ExpiresAfter ContainerGetResponseExpiresAfter `json:"expires_after"`
// Unix timestamp (in seconds) when the container was last active.
- LastActiveAt int64 `json:"last_active_at"`
+ LastActiveAt int64 `json:"last_active_at" format:"unixtime"`
// The memory limit configured for the container.
//
// Any of "1g", "4g", "16g", "64g".
@@ -307,7 +310,7 @@ type ContainerListResponse struct {
// Unique identifier for the container.
ID string `json:"id" api:"required"`
// Unix timestamp (in seconds) when the container was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Name of the container.
Name string `json:"name" api:"required"`
// The type of this object.
@@ -319,7 +322,7 @@ type ContainerListResponse struct {
// before the container expires.
ExpiresAfter ContainerListResponseExpiresAfter `json:"expires_after"`
// Unix timestamp (in seconds) when the container was last active.
- LastActiveAt int64 `json:"last_active_at"`
+ LastActiveAt int64 `json:"last_active_at" format:"unixtime"`
// The memory limit configured for the container.
//
// Any of "1g", "4g", "16g", "64g".
diff --git a/vendor/github.com/openai/openai-go/v3/containerfile.go b/vendor/github.com/openai/openai-go/v3/containerfile.go
index 8ecc90c01..c3bdc7dc2 100644
--- a/vendor/github.com/openai/openai-go/v3/containerfile.go
+++ b/vendor/github.com/openai/openai-go/v3/containerfile.go
@@ -6,7 +6,6 @@ import (
"bytes"
"context"
"errors"
- "fmt"
"io"
"mime/multipart"
"net/http"
@@ -50,19 +49,21 @@ func NewContainerFileService(opts ...option.RequestOption) (r ContainerFileServi
// You can send either a multipart/form-data request with the raw file content, or
// a JSON request with a file ID.
func (r *ContainerFileService) New(ctx context.Context, containerID string, body ContainerFileNewParams, opts ...option.RequestOption) (res *ContainerFileNewResponse, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if containerID == "" {
err = errors.New("missing required container_id parameter")
return nil, err
}
- path := fmt.Sprintf("containers/%s/files", containerID)
+ path := requestconfig.FormatPath("containers/%s/files", containerID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
// Retrieve Container File
func (r *ContainerFileService) Get(ctx context.Context, containerID string, fileID string, opts ...option.RequestOption) (res *ContainerFileGetResponse, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if containerID == "" {
err = errors.New("missing required container_id parameter")
return nil, err
@@ -71,7 +72,7 @@ func (r *ContainerFileService) Get(ctx context.Context, containerID string, file
err = errors.New("missing required file_id parameter")
return nil, err
}
- path := fmt.Sprintf("containers/%s/files/%s", containerID, fileID)
+ path := requestconfig.FormatPath("containers/%s/files/%s", containerID, fileID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
@@ -79,13 +80,14 @@ func (r *ContainerFileService) Get(ctx context.Context, containerID string, file
// List Container files
func (r *ContainerFileService) List(ctx context.Context, containerID string, query ContainerFileListParams, opts ...option.RequestOption) (res *pagination.CursorPage[ContainerFileListResponse], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
if containerID == "" {
err = errors.New("missing required container_id parameter")
return nil, err
}
- path := fmt.Sprintf("containers/%s/files", containerID)
+ path := requestconfig.FormatPath("containers/%s/files", containerID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
@@ -105,7 +107,8 @@ func (r *ContainerFileService) ListAutoPaging(ctx context.Context, containerID s
// Delete Container File
func (r *ContainerFileService) Delete(ctx context.Context, containerID string, fileID string, opts ...option.RequestOption) (err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...)
if containerID == "" {
err = errors.New("missing required container_id parameter")
@@ -115,7 +118,7 @@ func (r *ContainerFileService) Delete(ctx context.Context, containerID string, f
err = errors.New("missing required file_id parameter")
return err
}
- path := fmt.Sprintf("containers/%s/files/%s", containerID, fileID)
+ path := requestconfig.FormatPath("containers/%s/files/%s", containerID, fileID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...)
return err
}
@@ -128,7 +131,7 @@ type ContainerFileNewResponse struct {
// The container this file belongs to.
ContainerID string `json:"container_id" api:"required"`
// Unix timestamp (in seconds) when the file was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The type of this object (`container.file`).
Object constant.ContainerFile `json:"object" default:"container.file"`
// Path of the file in the container.
@@ -163,7 +166,7 @@ type ContainerFileGetResponse struct {
// The container this file belongs to.
ContainerID string `json:"container_id" api:"required"`
// Unix timestamp (in seconds) when the file was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The type of this object (`container.file`).
Object constant.ContainerFile `json:"object" default:"container.file"`
// Path of the file in the container.
@@ -198,7 +201,7 @@ type ContainerFileListResponse struct {
// The container this file belongs to.
ContainerID string `json:"container_id" api:"required"`
// Unix timestamp (in seconds) when the file was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The type of this object (`container.file`).
Object constant.ContainerFile `json:"object" default:"container.file"`
// Path of the file in the container.
diff --git a/vendor/github.com/openai/openai-go/v3/containerfilecontent.go b/vendor/github.com/openai/openai-go/v3/containerfilecontent.go
index 288c1fa01..b80faa61a 100644
--- a/vendor/github.com/openai/openai-go/v3/containerfilecontent.go
+++ b/vendor/github.com/openai/openai-go/v3/containerfilecontent.go
@@ -5,7 +5,6 @@ package openai
import (
"context"
"errors"
- "fmt"
"net/http"
"slices"
@@ -34,7 +33,8 @@ func NewContainerFileContentService(opts ...option.RequestOption) (r ContainerFi
// Retrieve Container File Content
func (r *ContainerFileContentService) Get(ctx context.Context, containerID string, fileID string, opts ...option.RequestOption) (res *http.Response, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "application/binary")}, opts...)
if containerID == "" {
err = errors.New("missing required container_id parameter")
@@ -44,7 +44,7 @@ func (r *ContainerFileContentService) Get(ctx context.Context, containerID strin
err = errors.New("missing required file_id parameter")
return nil, err
}
- path := fmt.Sprintf("containers/%s/files/%s/content", containerID, fileID)
+ path := requestconfig.FormatPath("containers/%s/files/%s/content", containerID, fileID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
diff --git a/vendor/github.com/openai/openai-go/v3/conversations/aliases.go b/vendor/github.com/openai/openai-go/v3/conversations/aliases.go
index 74c6ff9ae..2cd4c5d39 100644
--- a/vendor/github.com/openai/openai-go/v3/conversations/aliases.go
+++ b/vendor/github.com/openai/openai-go/v3/conversations/aliases.go
@@ -64,6 +64,15 @@ const AllModelsGPT5_1CodexMax = shared.AllModelsGPT5_1CodexMax
// This is an alias to an internal type.
type ChatModel = shared.ChatModel
+// Equals "gpt-5.6-sol"
+const ChatModelGPT5_6Sol = shared.ChatModelGPT5_6Sol
+
+// Equals "gpt-5.6-terra"
+const ChatModelGPT5_6Terra = shared.ChatModelGPT5_6Terra
+
+// Equals "gpt-5.6-luna"
+const ChatModelGPT5_6Luna = shared.ChatModelGPT5_6Luna
+
// Equals "gpt-5.4"
const ChatModelGPT5_4 = shared.ChatModelGPT5_4
@@ -465,6 +474,25 @@ const OAuthErrorCodeInvalidSubjectToken = shared.OAuthErrorCodeInvalidSubjectTok
// This is an alias to an internal type.
type Reasoning = shared.Reasoning
+// Controls which reasoning items are rendered back to the model on later turns. If
+// omitted or set to `auto`, the model determines the context mode. The `gpt-5.6`
+// model family defaults to `all_turns`; earlier models default to `current_turn`.
+//
+// When returned on a response, this is the effective reasoning context mode used
+// for the response.
+//
+// This is an alias to an internal type.
+type ReasoningContext = shared.ReasoningContext
+
+// Equals "auto"
+const ReasoningContextAuto = shared.ReasoningContextAuto
+
+// Equals "current_turn"
+const ReasoningContextCurrentTurn = shared.ReasoningContextCurrentTurn
+
+// Equals "all_turns"
+const ReasoningContextAllTurns = shared.ReasoningContextAllTurns
+
// **Deprecated:** use `summary` instead.
//
// A summary of the reasoning performed by the model. This can be useful for
@@ -483,6 +511,19 @@ const ReasoningGenerateSummaryConcise = shared.ReasoningGenerateSummaryConcise
// Equals "detailed"
const ReasoningGenerateSummaryDetailed = shared.ReasoningGenerateSummaryDetailed
+// Controls the reasoning execution mode for the request.
+//
+// When returned on a response, this is the effective execution mode.
+//
+// This is an alias to an internal type.
+type ReasoningMode = shared.ReasoningMode
+
+// Equals "standard"
+const ReasoningModeStandard = shared.ReasoningModeStandard
+
+// Equals "pro"
+const ReasoningModePro = shared.ReasoningModePro
+
// A summary of the reasoning performed by the model. This can be useful for
// debugging and understanding the model's reasoning process. One of `auto`,
// `concise`, or `detailed`.
@@ -510,19 +551,12 @@ const ReasoningSummaryDetailed = shared.ReasoningSummaryDetailed
// This is an alias to an internal type.
type ReasoningParam = shared.ReasoningParam
-// Constrains effort on reasoning for
-// [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
-// supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`.
-// Reducing reasoning effort can result in faster responses and fewer tokens used
-// on reasoning in a response.
-//
-// - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported
-// reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool
-// calls are supported for all reasoning values in gpt-5.1.
-// - All models before `gpt-5.1` default to `medium` reasoning effort, and do not
-// support `none`.
-// - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
-// - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
+// Constrains effort on reasoning for reasoning models. Currently supported values
+// are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. Reducing
+// reasoning effort can result in faster responses and fewer tokens used on
+// reasoning in a response. Not all reasoning models support every value. See the
+// [reasoning guide](https://platform.openai.com/docs/guides/reasoning) for
+// model-specific support.
//
// This is an alias to an internal type.
type ReasoningEffort = shared.ReasoningEffort
@@ -545,6 +579,9 @@ const ReasoningEffortHigh = shared.ReasoningEffortHigh
// Equals "xhigh"
const ReasoningEffortXhigh = shared.ReasoningEffortXhigh
+// Equals "max"
+const ReasoningEffortMax = shared.ReasoningEffortMax
+
// JSON object response format. An older method of generating JSON responses. Using
// `json_schema` is recommended for models that support it. Note that the model
// will not generate JSON without a system or user message instructing it to do so.
diff --git a/vendor/github.com/openai/openai-go/v3/conversations/conversation.go b/vendor/github.com/openai/openai-go/v3/conversations/conversation.go
index f016e692e..74c681115 100644
--- a/vendor/github.com/openai/openai-go/v3/conversations/conversation.go
+++ b/vendor/github.com/openai/openai-go/v3/conversations/conversation.go
@@ -6,7 +6,6 @@ import (
"context"
"encoding/json"
"errors"
- "fmt"
"net/http"
"slices"
@@ -46,7 +45,8 @@ func NewConversationService(opts ...option.RequestOption) (r ConversationService
// Create a conversation.
func (r *ConversationService) New(ctx context.Context, body ConversationNewParams, opts ...option.RequestOption) (res *Conversation, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "conversations"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -54,36 +54,39 @@ func (r *ConversationService) New(ctx context.Context, body ConversationNewParam
// Get a conversation
func (r *ConversationService) Get(ctx context.Context, conversationID string, opts ...option.RequestOption) (res *Conversation, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if conversationID == "" {
err = errors.New("missing required conversation_id parameter")
return nil, err
}
- path := fmt.Sprintf("conversations/%s", conversationID)
+ path := requestconfig.FormatPath("conversations/%s", conversationID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
// Update a conversation
func (r *ConversationService) Update(ctx context.Context, conversationID string, body ConversationUpdateParams, opts ...option.RequestOption) (res *Conversation, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if conversationID == "" {
err = errors.New("missing required conversation_id parameter")
return nil, err
}
- path := fmt.Sprintf("conversations/%s", conversationID)
+ path := requestconfig.FormatPath("conversations/%s", conversationID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
// Delete a conversation. Items in the conversation will not be deleted.
func (r *ConversationService) Delete(ctx context.Context, conversationID string, opts ...option.RequestOption) (res *ConversationDeletedResource, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if conversationID == "" {
err = errors.New("missing required conversation_id parameter")
return nil, err
}
- path := fmt.Sprintf("conversations/%s", conversationID)
+ path := requestconfig.FormatPath("conversations/%s", conversationID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
return res, err
}
@@ -98,18 +101,23 @@ type ComputerScreenshotContent struct {
// The identifier of an uploaded file that contains the screenshot.
FileID string `json:"file_id" api:"required"`
// The URL of the screenshot image.
- ImageURL string `json:"image_url" api:"required"`
+ ImageURL string `json:"image_url" api:"required" format:"uri"`
// Specifies the event type. For a computer screenshot, this property is always set
// to `computer_screenshot`.
Type constant.ComputerScreenshot `json:"type" default:"computer_screenshot"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint ComputerScreenshotContentPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Detail respjson.Field
- FileID respjson.Field
- ImageURL respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Detail respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -130,12 +138,32 @@ const (
ComputerScreenshotContentDetailOriginal ComputerScreenshotContentDetail = "original"
)
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+type ComputerScreenshotContentPromptCacheBreakpoint struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Mode respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ComputerScreenshotContentPromptCacheBreakpoint) RawJSON() string { return r.JSON.raw }
+func (r *ComputerScreenshotContentPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
type Conversation struct {
// The unique ID of the conversation.
ID string `json:"id" api:"required"`
// The time at which the conversation was created, measured in seconds since the
// Unix epoch.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Set of 16 key-value pairs that can be attached to an object. This can be useful
// for storing additional information about the object in a structured format, and
// querying for objects via API or the dashboard. Keys are strings with a maximum
@@ -240,6 +268,11 @@ type MessageContentUnion struct {
// Any of "input_text", "output_text", "text", "summary_text", "reasoning_text",
// "refusal", "input_image", "computer_screenshot", "input_file".
Type string `json:"type"`
+ // This field is a union of [responses.ResponseInputTextPromptCacheBreakpoint],
+ // [responses.ResponseInputImagePromptCacheBreakpoint],
+ // [ComputerScreenshotContentPromptCacheBreakpoint],
+ // [responses.ResponseInputFilePromptCacheBreakpoint]
+ PromptCacheBreakpoint MessageContentUnionPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
// This field is from variant [responses.ResponseOutputText].
Annotations []responses.ResponseOutputTextAnnotationUnion `json:"annotations"`
// This field is from variant [responses.ResponseOutputText].
@@ -256,18 +289,19 @@ type MessageContentUnion struct {
// This field is from variant [responses.ResponseInputFile].
Filename string `json:"filename"`
JSON struct {
- Text respjson.Field
- Type respjson.Field
- Annotations respjson.Field
- Logprobs respjson.Field
- Refusal respjson.Field
- Detail respjson.Field
- FileID respjson.Field
- ImageURL respjson.Field
- FileData respjson.Field
- FileURL respjson.Field
- Filename respjson.Field
- raw string
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ Annotations respjson.Field
+ Logprobs respjson.Field
+ Refusal respjson.Field
+ Detail respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ FileData respjson.Field
+ FileURL respjson.Field
+ Filename respjson.Field
+ raw string
} `json:"-"`
}
@@ -373,6 +407,25 @@ func (r *MessageContentUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// MessageContentUnionPromptCacheBreakpoint is an implicit subunion of
+// [MessageContentUnion]. MessageContentUnionPromptCacheBreakpoint provides
+// convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [MessageContentUnion].
+type MessageContentUnionPromptCacheBreakpoint struct {
+ // This field is from variant [responses.ResponseInputTextPromptCacheBreakpoint].
+ Mode constant.Explicit `json:"mode"`
+ JSON struct {
+ Mode respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *MessageContentUnionPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// Reasoning text from the model.
type MessageContentReasoningText struct {
// The reasoning text from the model.
diff --git a/vendor/github.com/openai/openai-go/v3/conversations/item.go b/vendor/github.com/openai/openai-go/v3/conversations/item.go
index 0ce05a8dc..0c925fdca 100644
--- a/vendor/github.com/openai/openai-go/v3/conversations/item.go
+++ b/vendor/github.com/openai/openai-go/v3/conversations/item.go
@@ -6,7 +6,6 @@ import (
"context"
"encoding/json"
"errors"
- "fmt"
"net/http"
"net/url"
"slices"
@@ -45,19 +44,21 @@ func NewItemService(opts ...option.RequestOption) (r ItemService) {
// Create items in a conversation with the given ID.
func (r *ItemService) New(ctx context.Context, conversationID string, params ItemNewParams, opts ...option.RequestOption) (res *ConversationItemList, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if conversationID == "" {
err = errors.New("missing required conversation_id parameter")
return nil, err
}
- path := fmt.Sprintf("conversations/%s/items", conversationID)
+ path := requestconfig.FormatPath("conversations/%s/items", conversationID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
return res, err
}
// Get a single item from a conversation with the given IDs.
func (r *ItemService) Get(ctx context.Context, conversationID string, itemID string, query ItemGetParams, opts ...option.RequestOption) (res *ConversationItemUnion, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if conversationID == "" {
err = errors.New("missing required conversation_id parameter")
return nil, err
@@ -66,7 +67,7 @@ func (r *ItemService) Get(ctx context.Context, conversationID string, itemID str
err = errors.New("missing required item_id parameter")
return nil, err
}
- path := fmt.Sprintf("conversations/%s/items/%s", conversationID, itemID)
+ path := requestconfig.FormatPath("conversations/%s/items/%s", conversationID, itemID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
return res, err
}
@@ -74,13 +75,14 @@ func (r *ItemService) Get(ctx context.Context, conversationID string, itemID str
// List all items for a conversation with the given ID.
func (r *ItemService) List(ctx context.Context, conversationID string, query ItemListParams, opts ...option.RequestOption) (res *pagination.ConversationCursorPage[ConversationItemUnion], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
if conversationID == "" {
err = errors.New("missing required conversation_id parameter")
return nil, err
}
- path := fmt.Sprintf("conversations/%s/items", conversationID)
+ path := requestconfig.FormatPath("conversations/%s/items", conversationID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
@@ -100,7 +102,8 @@ func (r *ItemService) ListAutoPaging(ctx context.Context, conversationID string,
// Delete an item from a conversation with the given IDs.
func (r *ItemService) Delete(ctx context.Context, conversationID string, itemID string, opts ...option.RequestOption) (res *Conversation, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if conversationID == "" {
err = errors.New("missing required conversation_id parameter")
return nil, err
@@ -109,7 +112,7 @@ func (r *ItemService) Delete(ctx context.Context, conversationID string, itemID
err = errors.New("missing required item_id parameter")
return nil, err
}
- path := fmt.Sprintf("conversations/%s/items/%s", conversationID, itemID)
+ path := requestconfig.FormatPath("conversations/%s/items/%s", conversationID, itemID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
return res, err
}
@@ -121,9 +124,10 @@ func (r *ItemService) Delete(ctx context.Context, conversationID string, itemID
// [ConversationItemImageGenerationCall], [responses.ResponseComputerToolCall],
// [responses.ResponseComputerToolCallOutputItem],
// [responses.ResponseToolSearchCall], [responses.ResponseToolSearchOutputItem],
-// [responses.ResponseReasoningItem], [responses.ResponseCompactionItem],
-// [responses.ResponseCodeInterpreterToolCall], [ConversationItemLocalShellCall],
-// [ConversationItemLocalShellCallOutput],
+// [ConversationItemAdditionalTools], [responses.ResponseReasoningItem],
+// [ConversationItemProgram], [ConversationItemProgramOutput],
+// [responses.ResponseCompactionItem], [responses.ResponseCodeInterpreterToolCall],
+// [ConversationItemLocalShellCall], [ConversationItemLocalShellCallOutput],
// [responses.ResponseFunctionShellToolCall],
// [responses.ResponseFunctionShellToolCallOutput],
// [responses.ResponseApplyPatchToolCall],
@@ -140,16 +144,16 @@ type ConversationItemUnion struct {
// This field is a union of [[]MessageContentUnion],
// [[]responses.ResponseReasoningItemContent]
Content ConversationItemUnionContent `json:"content"`
- // This field is from variant [Message].
- Role MessageRole `json:"role"`
- Status string `json:"status"`
+ Role string `json:"role"`
+ Status string `json:"status"`
// Any of "message", "function_call", "function_call_output", "file_search_call",
// "web_search_call", "image_generation_call", "computer_call",
- // "computer_call_output", "tool_search_call", "tool_search_output", "reasoning",
- // "compaction", "code_interpreter_call", "local_shell_call",
- // "local_shell_call_output", "shell_call", "shell_call_output",
- // "apply_patch_call", "apply_patch_call_output", "mcp_list_tools",
- // "mcp_approval_request", "mcp_approval_response", "mcp_call", "custom_tool_call",
+ // "computer_call_output", "tool_search_call", "tool_search_output",
+ // "additional_tools", "reasoning", "program", "program_output", "compaction",
+ // "code_interpreter_call", "local_shell_call", "local_shell_call_output",
+ // "shell_call", "shell_call_output", "apply_patch_call",
+ // "apply_patch_call_output", "mcp_list_tools", "mcp_approval_request",
+ // "mcp_approval_response", "mcp_call", "custom_tool_call",
// "custom_tool_call_output".
Type string `json:"type"`
// This field is from variant [Message].
@@ -158,8 +162,17 @@ type ConversationItemUnion struct {
Arguments ConversationItemUnionArguments `json:"arguments"`
CallID string `json:"call_id"`
Name string `json:"name"`
- Namespace string `json:"namespace"`
- CreatedBy string `json:"created_by"`
+ // This field is a union of [responses.ResponseFunctionToolCallCallerUnion],
+ // [responses.ResponseFunctionToolCallOutputItemCallerUnion],
+ // [responses.ResponseFunctionShellToolCallCallerUnion],
+ // [responses.ResponseFunctionShellToolCallOutputCallerUnion],
+ // [responses.ResponseApplyPatchToolCallCallerUnion],
+ // [responses.ResponseApplyPatchToolCallOutputCallerUnion],
+ // [responses.ResponseCustomToolCallCallerUnion],
+ // [responses.ResponseCustomToolCallOutputCallerUnion]
+ Caller ConversationItemUnionCaller `json:"caller"`
+ Namespace string `json:"namespace"`
+ CreatedBy string `json:"created_by"`
// This field is a union of
// [responses.ResponseFunctionToolCallOutputItemOutputUnion],
// [responses.ResponseComputerToolCallOutputScreenshot], [string],
@@ -175,8 +188,7 @@ type ConversationItemUnion struct {
// [ConversationItemLocalShellCallAction],
// [responses.ResponseFunctionShellToolCallAction]
Action ConversationItemUnionAction `json:"action"`
- // This field is from variant [ConversationItemImageGenerationCall].
- Result string `json:"result"`
+ Result string `json:"result"`
// This field is from variant [responses.ResponseComputerToolCall].
PendingSafetyChecks []responses.ResponseComputerToolCallPendingSafetyCheck `json:"pending_safety_checks"`
// This field is from variant [responses.ResponseComputerToolCall].
@@ -184,14 +196,15 @@ type ConversationItemUnion struct {
// This field is from variant [responses.ResponseComputerToolCallOutputItem].
AcknowledgedSafetyChecks []responses.ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck `json:"acknowledged_safety_checks"`
Execution string `json:"execution"`
- // This field is a union of [[]responses.ToolUnion],
+ // This field is a union of [[]responses.ToolUnion], [[]responses.ToolUnion],
// [[]ConversationItemMcpListToolsTool]
Tools ConversationItemUnionTools `json:"tools"`
// This field is from variant [responses.ResponseReasoningItem].
Summary []responses.ResponseReasoningItemSummary `json:"summary"`
EncryptedContent string `json:"encrypted_content"`
- // This field is from variant [responses.ResponseCodeInterpreterToolCall].
- Code string `json:"code"`
+ Code string `json:"code"`
+ // This field is from variant [ConversationItemProgram].
+ Fingerprint string `json:"fingerprint"`
// This field is from variant [responses.ResponseCodeInterpreterToolCall].
ContainerID string `json:"container_id"`
// This field is from variant [responses.ResponseCodeInterpreterToolCall].
@@ -221,6 +234,7 @@ type ConversationItemUnion struct {
Arguments respjson.Field
CallID respjson.Field
Name respjson.Field
+ Caller respjson.Field
Namespace respjson.Field
CreatedBy respjson.Field
Output respjson.Field
@@ -236,6 +250,7 @@ type ConversationItemUnion struct {
Summary respjson.Field
EncryptedContent respjson.Field
Code respjson.Field
+ Fingerprint respjson.Field
ContainerID respjson.Field
Outputs respjson.Field
Environment respjson.Field
@@ -259,6 +274,9 @@ type anyConversationItem interface {
func (Message) ImplConversationItemUnion() {}
func (ConversationItemImageGenerationCall) ImplConversationItemUnion() {}
+func (ConversationItemAdditionalTools) ImplConversationItemUnion() {}
+func (ConversationItemProgram) ImplConversationItemUnion() {}
+func (ConversationItemProgramOutput) ImplConversationItemUnion() {}
func (ConversationItemLocalShellCall) ImplConversationItemUnion() {}
func (ConversationItemLocalShellCallOutput) ImplConversationItemUnion() {}
func (ConversationItemMcpListTools) ImplConversationItemUnion() {}
@@ -279,7 +297,10 @@ func (ConversationItemMcpCall) ImplConversationItemUnion() {}
// case responses.ResponseComputerToolCallOutputItem:
// case responses.ResponseToolSearchCall:
// case responses.ResponseToolSearchOutputItem:
+// case conversations.ConversationItemAdditionalTools:
// case responses.ResponseReasoningItem:
+// case conversations.ConversationItemProgram:
+// case conversations.ConversationItemProgramOutput:
// case responses.ResponseCompactionItem:
// case responses.ResponseCodeInterpreterToolCall:
// case conversations.ConversationItemLocalShellCall:
@@ -319,8 +340,14 @@ func (u ConversationItemUnion) AsAny() anyConversationItem {
return u.AsToolSearchCall()
case "tool_search_output":
return u.AsToolSearchOutput()
+ case "additional_tools":
+ return u.AsAdditionalTools()
case "reasoning":
return u.AsReasoning()
+ case "program":
+ return u.AsProgram()
+ case "program_output":
+ return u.AsProgramOutput()
case "compaction":
return u.AsCompaction()
case "code_interpreter_call":
@@ -403,11 +430,26 @@ func (u ConversationItemUnion) AsToolSearchOutput() (v responses.ResponseToolSea
return
}
+func (u ConversationItemUnion) AsAdditionalTools() (v ConversationItemAdditionalTools) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
func (u ConversationItemUnion) AsReasoning() (v responses.ResponseReasoningItem) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
+func (u ConversationItemUnion) AsProgram() (v ConversationItemProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ConversationItemUnion) AsProgramOutput() (v ConversationItemProgramOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
func (u ConversationItemUnion) AsCompaction() (v responses.ResponseCompactionItem) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
@@ -537,6 +579,26 @@ func (r *ConversationItemUnionArguments) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// ConversationItemUnionCaller is an implicit subunion of [ConversationItemUnion].
+// ConversationItemUnionCaller provides convenient access to the sub-properties of
+// the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [ConversationItemUnion].
+type ConversationItemUnionCaller struct {
+ Type string `json:"type"`
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *ConversationItemUnionCaller) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// ConversationItemUnionOutput is an implicit subunion of [ConversationItemUnion].
// ConversationItemUnionOutput provides convenient access to the sub-properties of
// the union.
@@ -585,12 +647,12 @@ func (r *ConversationItemUnionOutput) UnmarshalJSON(data []byte) error {
// For type safety it is recommended to directly use a variant of the
// [ConversationItemUnion].
type ConversationItemUnionAction struct {
- // This field is from variant [responses.ResponseFunctionWebSearchActionUnion].
- Query string `json:"query"`
- Type string `json:"type"`
+ Type string `json:"type"`
// This field is from variant [responses.ResponseFunctionWebSearchActionUnion].
Queries []string `json:"queries"`
// This field is from variant [responses.ResponseFunctionWebSearchActionUnion].
+ Query string `json:"query"`
+ // This field is from variant [responses.ResponseFunctionWebSearchActionUnion].
Sources []responses.ResponseFunctionWebSearchActionSearchSource `json:"sources"`
URL string `json:"url"`
// This field is from variant [responses.ResponseFunctionWebSearchActionUnion].
@@ -622,9 +684,9 @@ type ConversationItemUnionAction struct {
// This field is from variant [responses.ResponseFunctionShellToolCallAction].
MaxOutputLength int64 `json:"max_output_length"`
JSON struct {
- Query respjson.Field
Type respjson.Field
Queries respjson.Field
+ Query respjson.Field
Sources respjson.Field
URL respjson.Field
Pattern respjson.Field
@@ -707,6 +769,95 @@ func (r *ConversationItemImageGenerationCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+type ConversationItemAdditionalTools struct {
+ // The unique ID of the additional tools item.
+ ID string `json:"id" api:"required"`
+ // The role that provided the additional tools.
+ //
+ // Any of "unknown", "user", "assistant", "system", "critic", "discriminator",
+ // "developer", "tool".
+ Role string `json:"role" api:"required"`
+ // The additional tool definitions made available at this item.
+ Tools []responses.ToolUnion `json:"tools" api:"required"`
+ // The type of the item. Always `additional_tools`.
+ Type constant.AdditionalTools `json:"type" default:"additional_tools"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Role respjson.Field
+ Tools respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ConversationItemAdditionalTools) RawJSON() string { return r.JSON.raw }
+func (r *ConversationItemAdditionalTools) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ConversationItemProgram struct {
+ // The unique ID of the program item.
+ ID string `json:"id" api:"required"`
+ // The stable call ID of the program item.
+ CallID string `json:"call_id" api:"required"`
+ // The JavaScript source executed by programmatic tool calling.
+ Code string `json:"code" api:"required"`
+ // Opaque program replay fingerprint that must be round-tripped.
+ Fingerprint string `json:"fingerprint" api:"required"`
+ // The type of the item. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Code respjson.Field
+ Fingerprint respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ConversationItemProgram) RawJSON() string { return r.JSON.raw }
+func (r *ConversationItemProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ConversationItemProgramOutput struct {
+ // The unique ID of the program output item.
+ ID string `json:"id" api:"required"`
+ // The call ID of the program item.
+ CallID string `json:"call_id" api:"required"`
+ // The result produced by the program item.
+ Result string `json:"result" api:"required"`
+ // The terminal status of the program output item.
+ //
+ // Any of "completed", "incomplete".
+ Status string `json:"status" api:"required"`
+ // The type of the item. Always `program_output`.
+ Type constant.ProgramOutput `json:"type" default:"program_output"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Result respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ConversationItemProgramOutput) RawJSON() string { return r.JSON.raw }
+func (r *ConversationItemProgramOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A tool call to run a command on the local shell.
type ConversationItemLocalShellCall struct {
// The unique ID of the local shell call.
diff --git a/vendor/github.com/openai/openai-go/v3/default_http_client.go b/vendor/github.com/openai/openai-go/v3/default_http_client.go
new file mode 100644
index 000000000..33259bee9
--- /dev/null
+++ b/vendor/github.com/openai/openai-go/v3/default_http_client.go
@@ -0,0 +1,30 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package openai
+
+import (
+ "net/http"
+ "time"
+)
+
+// defaultResponseHeaderTimeout bounds the time between a fully written request
+// and the server's response headers. It does not apply to the response body,
+// so long-running streams are unaffected. Without this, a server that accepts
+// the connection but never responds would hang the request indefinitely.
+const defaultResponseHeaderTimeout = 10 * time.Minute
+
+// defaultHTTPClient returns an [*http.Client] used when the caller does not
+// supply one via [option.WithHTTPClient]. When [http.DefaultTransport] is the
+// stdlib [*http.Transport], it is cloned and a [http.Transport.ResponseHeaderTimeout]
+// is set so stuck connections fail fast instead of compounding across retries.
+// If [http.DefaultTransport] has been wrapped (for example by otelhttp for
+// distributed tracing), the wrapping is preserved and the header timeout is
+// skipped.
+func defaultHTTPClient() *http.Client {
+ if t, ok := http.DefaultTransport.(*http.Transport); ok {
+ t = t.Clone()
+ t.ResponseHeaderTimeout = defaultResponseHeaderTimeout
+ return &http.Client{Transport: t}
+ }
+ return &http.Client{Transport: http.DefaultTransport}
+}
diff --git a/vendor/github.com/openai/openai-go/v3/embedding.go b/vendor/github.com/openai/openai-go/v3/embedding.go
index b88d2c335..610db8417 100644
--- a/vendor/github.com/openai/openai-go/v3/embedding.go
+++ b/vendor/github.com/openai/openai-go/v3/embedding.go
@@ -39,7 +39,8 @@ func NewEmbeddingService(opts ...option.RequestOption) (r EmbeddingService) {
// Creates an embedding vector representing the input text.
func (r *EmbeddingService) New(ctx context.Context, body EmbeddingNewParams, opts ...option.RequestOption) (res *CreateEmbeddingResponse, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "embeddings"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
diff --git a/vendor/github.com/openai/openai-go/v3/file.go b/vendor/github.com/openai/openai-go/v3/file.go
index 88dc08993..91877323e 100644
--- a/vendor/github.com/openai/openai-go/v3/file.go
+++ b/vendor/github.com/openai/openai-go/v3/file.go
@@ -6,7 +6,6 @@ import (
"bytes"
"context"
"errors"
- "fmt"
"io"
"mime/multipart"
"net/http"
@@ -48,7 +47,8 @@ func NewFileService(opts ...option.RequestOption) (r FileService) {
// Upload a file that can be used across various endpoints. Individual files can be
// up to 512 MB, and each project can store up to 2.5 TB of files in total. There
-// is no organization-wide storage limit.
+// is no organization-wide storage limit. Uploads to this endpoint are rate-limited
+// to 1,000 requests per minute per authenticated user.
//
// - The Assistants API supports files up to 2 million tokens and of specific file
// types. See the
@@ -63,11 +63,18 @@ func NewFileService(opts ...option.RequestOption) (r FileService) {
// - The Batch API only supports `.jsonl` files up to 200 MB in size. The input
// also has a specific required
// [format](https://platform.openai.com/docs/api-reference/batch/request-input).
+// - For Retrieval or `file_search` ingestion, upload files here first. If you need
+// to attach multiple uploaded files to the same vector store, use
+// [`/vector_stores/{vector_store_id}/file_batches`](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch)
+// instead of attaching them one by one. Vector store attachment has separate
+// limits from file upload, including 2,000 attached files per minute per
+// organization.
//
// Please [contact us](https://help.openai.com/) if you need to increase these
// storage limits.
func (r *FileService) New(ctx context.Context, body FileNewParams, opts ...option.RequestOption) (res *FileObject, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "files"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -75,12 +82,13 @@ func (r *FileService) New(ctx context.Context, body FileNewParams, opts ...optio
// Returns information about a specific file.
func (r *FileService) Get(ctx context.Context, fileID string, opts ...option.RequestOption) (res *FileObject, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if fileID == "" {
err = errors.New("missing required file_id parameter")
return nil, err
}
- path := fmt.Sprintf("files/%s", fileID)
+ path := requestconfig.FormatPath("files/%s", fileID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
@@ -88,7 +96,8 @@ func (r *FileService) Get(ctx context.Context, fileID string, opts ...option.Req
// Returns a list of files.
func (r *FileService) List(ctx context.Context, query FileListParams, opts ...option.RequestOption) (res *pagination.CursorPage[FileObject], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "files"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
@@ -110,25 +119,27 @@ func (r *FileService) ListAutoPaging(ctx context.Context, query FileListParams,
// Delete a file and remove it from all vector stores.
func (r *FileService) Delete(ctx context.Context, fileID string, opts ...option.RequestOption) (res *FileDeleted, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if fileID == "" {
err = errors.New("missing required file_id parameter")
return nil, err
}
- path := fmt.Sprintf("files/%s", fileID)
+ path := requestconfig.FormatPath("files/%s", fileID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
return res, err
}
// Returns the contents of the specified file.
func (r *FileService) Content(ctx context.Context, fileID string, opts ...option.RequestOption) (res *http.Response, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "application/binary")}, opts...)
if fileID == "" {
err = errors.New("missing required file_id parameter")
return nil, err
}
- path := fmt.Sprintf("files/%s/content", fileID)
+ path := requestconfig.FormatPath("files/%s/content", fileID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
@@ -160,7 +171,7 @@ type FileObject struct {
// The size of the file, in bytes.
Bytes int64 `json:"bytes" api:"required"`
// The Unix timestamp (in seconds) for when the file was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The name of the file.
Filename string `json:"filename" api:"required"`
// The object type, which is always `file`.
@@ -180,7 +191,7 @@ type FileObject struct {
// Deprecated: deprecated
Status FileObjectStatus `json:"status" api:"required"`
// The Unix timestamp (in seconds) for when the file will expire.
- ExpiresAt int64 `json:"expires_at"`
+ ExpiresAt int64 `json:"expires_at" format:"unixtime"`
// Deprecated. For details on why a fine-tuning training file failed validation,
// see the `error` field on `fine_tuning.job`.
//
diff --git a/vendor/github.com/openai/openai-go/v3/finetuningalphagrader.go b/vendor/github.com/openai/openai-go/v3/finetuningalphagrader.go
index e09d8db22..07a159905 100644
--- a/vendor/github.com/openai/openai-go/v3/finetuningalphagrader.go
+++ b/vendor/github.com/openai/openai-go/v3/finetuningalphagrader.go
@@ -38,7 +38,8 @@ func NewFineTuningAlphaGraderService(opts ...option.RequestOption) (r FineTuning
// Run a grader.
func (r *FineTuningAlphaGraderService) Run(ctx context.Context, body FineTuningAlphaGraderRunParams, opts ...option.RequestOption) (res *FineTuningAlphaGraderRunResponse, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "fine_tuning/alpha/graders/run"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -46,7 +47,8 @@ func (r *FineTuningAlphaGraderService) Run(ctx context.Context, body FineTuningA
// Validate a grader.
func (r *FineTuningAlphaGraderService) Validate(ctx context.Context, body FineTuningAlphaGraderValidateParams, opts ...option.RequestOption) (res *FineTuningAlphaGraderValidateResponse, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "fine_tuning/alpha/graders/validate"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
diff --git a/vendor/github.com/openai/openai-go/v3/finetuningcheckpointpermission.go b/vendor/github.com/openai/openai-go/v3/finetuningcheckpointpermission.go
index 44bb8d6e2..b9e88df5a 100644
--- a/vendor/github.com/openai/openai-go/v3/finetuningcheckpointpermission.go
+++ b/vendor/github.com/openai/openai-go/v3/finetuningcheckpointpermission.go
@@ -5,7 +5,6 @@ package openai
import (
"context"
"errors"
- "fmt"
"net/http"
"net/url"
"slices"
@@ -47,13 +46,14 @@ func NewFineTuningCheckpointPermissionService(opts ...option.RequestOption) (r F
// in their organization.
func (r *FineTuningCheckpointPermissionService) New(ctx context.Context, fineTunedModelCheckpoint string, body FineTuningCheckpointPermissionNewParams, opts ...option.RequestOption) (res *pagination.Page[FineTuningCheckpointPermissionNewResponse], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithAdminAPIKeyAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
if fineTunedModelCheckpoint == "" {
err = errors.New("missing required fine_tuned_model_checkpoint parameter")
return nil, err
}
- path := fmt.Sprintf("fine_tuning/checkpoints/%s/permissions", fineTunedModelCheckpoint)
+ path := requestconfig.FormatPath("fine_tuning/checkpoints/%s/permissions", fineTunedModelCheckpoint)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, body, &res, opts...)
if err != nil {
return nil, err
@@ -82,12 +82,13 @@ func (r *FineTuningCheckpointPermissionService) NewAutoPaging(ctx context.Contex
// Deprecated: Retrieve is deprecated. Please swap to the paginated list method
// instead.
func (r *FineTuningCheckpointPermissionService) Get(ctx context.Context, fineTunedModelCheckpoint string, query FineTuningCheckpointPermissionGetParams, opts ...option.RequestOption) (res *FineTuningCheckpointPermissionGetResponse, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithAdminAPIKeyAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if fineTunedModelCheckpoint == "" {
err = errors.New("missing required fine_tuned_model_checkpoint parameter")
return nil, err
}
- path := fmt.Sprintf("fine_tuning/checkpoints/%s/permissions", fineTunedModelCheckpoint)
+ path := requestconfig.FormatPath("fine_tuning/checkpoints/%s/permissions", fineTunedModelCheckpoint)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
return res, err
}
@@ -98,13 +99,14 @@ func (r *FineTuningCheckpointPermissionService) Get(ctx context.Context, fineTun
// fine-tuned model checkpoint.
func (r *FineTuningCheckpointPermissionService) List(ctx context.Context, fineTunedModelCheckpoint string, query FineTuningCheckpointPermissionListParams, opts ...option.RequestOption) (res *pagination.ConversationCursorPage[FineTuningCheckpointPermissionListResponse], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithAdminAPIKeyAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
if fineTunedModelCheckpoint == "" {
err = errors.New("missing required fine_tuned_model_checkpoint parameter")
return nil, err
}
- path := fmt.Sprintf("fine_tuning/checkpoints/%s/permissions", fineTunedModelCheckpoint)
+ path := requestconfig.FormatPath("fine_tuning/checkpoints/%s/permissions", fineTunedModelCheckpoint)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
@@ -130,7 +132,8 @@ func (r *FineTuningCheckpointPermissionService) ListAutoPaging(ctx context.Conte
// Organization owners can use this endpoint to delete a permission for a
// fine-tuned model checkpoint.
func (r *FineTuningCheckpointPermissionService) Delete(ctx context.Context, fineTunedModelCheckpoint string, permissionID string, opts ...option.RequestOption) (res *FineTuningCheckpointPermissionDeleteResponse, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithAdminAPIKeyAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if fineTunedModelCheckpoint == "" {
err = errors.New("missing required fine_tuned_model_checkpoint parameter")
return nil, err
@@ -139,7 +142,7 @@ func (r *FineTuningCheckpointPermissionService) Delete(ctx context.Context, fine
err = errors.New("missing required permission_id parameter")
return nil, err
}
- path := fmt.Sprintf("fine_tuning/checkpoints/%s/permissions/%s", fineTunedModelCheckpoint, permissionID)
+ path := requestconfig.FormatPath("fine_tuning/checkpoints/%s/permissions/%s", fineTunedModelCheckpoint, permissionID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
return res, err
}
@@ -150,7 +153,7 @@ type FineTuningCheckpointPermissionNewResponse struct {
// The permission identifier, which can be referenced in the API endpoints.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) for when the permission was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The object type, which is always "checkpoint.permission".
Object constant.CheckpointPermission `json:"object" default:"checkpoint.permission"`
// The project identifier that the permission is for.
@@ -202,7 +205,7 @@ type FineTuningCheckpointPermissionGetResponseData struct {
// The permission identifier, which can be referenced in the API endpoints.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) for when the permission was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The object type, which is always "checkpoint.permission".
Object constant.CheckpointPermission `json:"object" default:"checkpoint.permission"`
// The project identifier that the permission is for.
@@ -230,7 +233,7 @@ type FineTuningCheckpointPermissionListResponse struct {
// The permission identifier, which can be referenced in the API endpoints.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) for when the permission was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The object type, which is always "checkpoint.permission".
Object constant.CheckpointPermission `json:"object" default:"checkpoint.permission"`
// The project identifier that the permission is for.
diff --git a/vendor/github.com/openai/openai-go/v3/finetuningjob.go b/vendor/github.com/openai/openai-go/v3/finetuningjob.go
index df3fcb0bd..68c3bcd62 100644
--- a/vendor/github.com/openai/openai-go/v3/finetuningjob.go
+++ b/vendor/github.com/openai/openai-go/v3/finetuningjob.go
@@ -6,7 +6,6 @@ import (
"context"
"encoding/json"
"errors"
- "fmt"
"net/http"
"net/url"
"slices"
@@ -54,7 +53,8 @@ func NewFineTuningJobService(opts ...option.RequestOption) (r FineTuningJobServi
//
// [Learn more about fine-tuning](https://platform.openai.com/docs/guides/model-optimization)
func (r *FineTuningJobService) New(ctx context.Context, body FineTuningJobNewParams, opts ...option.RequestOption) (res *FineTuningJob, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "fine_tuning/jobs"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -64,12 +64,13 @@ func (r *FineTuningJobService) New(ctx context.Context, body FineTuningJobNewPar
//
// [Learn more about fine-tuning](https://platform.openai.com/docs/guides/model-optimization)
func (r *FineTuningJobService) Get(ctx context.Context, fineTuningJobID string, opts ...option.RequestOption) (res *FineTuningJob, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if fineTuningJobID == "" {
err = errors.New("missing required fine_tuning_job_id parameter")
return nil, err
}
- path := fmt.Sprintf("fine_tuning/jobs/%s", fineTuningJobID)
+ path := requestconfig.FormatPath("fine_tuning/jobs/%s", fineTuningJobID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
@@ -77,7 +78,8 @@ func (r *FineTuningJobService) Get(ctx context.Context, fineTuningJobID string,
// List your organization's fine-tuning jobs
func (r *FineTuningJobService) List(ctx context.Context, query FineTuningJobListParams, opts ...option.RequestOption) (res *pagination.CursorPage[FineTuningJob], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "fine_tuning/jobs"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
@@ -99,12 +101,13 @@ func (r *FineTuningJobService) ListAutoPaging(ctx context.Context, query FineTun
// Immediately cancel a fine-tune job.
func (r *FineTuningJobService) Cancel(ctx context.Context, fineTuningJobID string, opts ...option.RequestOption) (res *FineTuningJob, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if fineTuningJobID == "" {
err = errors.New("missing required fine_tuning_job_id parameter")
return nil, err
}
- path := fmt.Sprintf("fine_tuning/jobs/%s/cancel", fineTuningJobID)
+ path := requestconfig.FormatPath("fine_tuning/jobs/%s/cancel", fineTuningJobID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
return res, err
}
@@ -112,13 +115,14 @@ func (r *FineTuningJobService) Cancel(ctx context.Context, fineTuningJobID strin
// Get status updates for a fine-tuning job.
func (r *FineTuningJobService) ListEvents(ctx context.Context, fineTuningJobID string, query FineTuningJobListEventsParams, opts ...option.RequestOption) (res *pagination.CursorPage[FineTuningJobEvent], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
if fineTuningJobID == "" {
err = errors.New("missing required fine_tuning_job_id parameter")
return nil, err
}
- path := fmt.Sprintf("fine_tuning/jobs/%s/events", fineTuningJobID)
+ path := requestconfig.FormatPath("fine_tuning/jobs/%s/events", fineTuningJobID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
@@ -138,24 +142,26 @@ func (r *FineTuningJobService) ListEventsAutoPaging(ctx context.Context, fineTun
// Pause a fine-tune job.
func (r *FineTuningJobService) Pause(ctx context.Context, fineTuningJobID string, opts ...option.RequestOption) (res *FineTuningJob, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if fineTuningJobID == "" {
err = errors.New("missing required fine_tuning_job_id parameter")
return nil, err
}
- path := fmt.Sprintf("fine_tuning/jobs/%s/pause", fineTuningJobID)
+ path := requestconfig.FormatPath("fine_tuning/jobs/%s/pause", fineTuningJobID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
return res, err
}
// Resume a fine-tune job.
func (r *FineTuningJobService) Resume(ctx context.Context, fineTuningJobID string, opts ...option.RequestOption) (res *FineTuningJob, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if fineTuningJobID == "" {
err = errors.New("missing required fine_tuning_job_id parameter")
return nil, err
}
- path := fmt.Sprintf("fine_tuning/jobs/%s/resume", fineTuningJobID)
+ path := requestconfig.FormatPath("fine_tuning/jobs/%s/resume", fineTuningJobID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
return res, err
}
@@ -166,7 +172,7 @@ type FineTuningJob struct {
// The object identifier, which can be referenced in the API endpoints.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) for when the fine-tuning job was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// For fine-tuning jobs that have `failed`, this will contain more information on
// the cause of the failure.
Error FineTuningJobError `json:"error" api:"required"`
@@ -175,7 +181,7 @@ type FineTuningJob struct {
FineTunedModel string `json:"fine_tuned_model" api:"required"`
// The Unix timestamp (in seconds) for when the fine-tuning job was finished. The
// value will be null if the fine-tuning job is still running.
- FinishedAt int64 `json:"finished_at" api:"required"`
+ FinishedAt int64 `json:"finished_at" api:"required" format:"unixtime"`
// The hyperparameters used for the fine-tuning job. This value will only be
// returned when running `supervised` jobs.
Hyperparameters FineTuningJobHyperparameters `json:"hyperparameters" api:"required"`
@@ -209,7 +215,7 @@ type FineTuningJob struct {
ValidationFile string `json:"validation_file" api:"required"`
// The Unix timestamp (in seconds) for when the fine-tuning job is estimated to
// finish. The value will be null if the fine-tuning job is not running.
- EstimatedFinish int64 `json:"estimated_finish" api:"nullable"`
+ EstimatedFinish int64 `json:"estimated_finish" api:"nullable" format:"unixtime"`
// A list of integrations to enable for this fine-tuning job.
Integrations []FineTuningJobWandbIntegrationObject `json:"integrations" api:"nullable"`
// Set of 16 key-value pairs that can be attached to an object. This can be useful
@@ -465,7 +471,7 @@ type FineTuningJobEvent struct {
// The object identifier.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) for when the fine-tuning job was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The log level of the event.
//
// Any of "info", "warn", "error".
diff --git a/vendor/github.com/openai/openai-go/v3/finetuningjobcheckpoint.go b/vendor/github.com/openai/openai-go/v3/finetuningjobcheckpoint.go
index 4f8e85650..37ee90a1b 100644
--- a/vendor/github.com/openai/openai-go/v3/finetuningjobcheckpoint.go
+++ b/vendor/github.com/openai/openai-go/v3/finetuningjobcheckpoint.go
@@ -5,7 +5,6 @@ package openai
import (
"context"
"errors"
- "fmt"
"net/http"
"net/url"
"slices"
@@ -44,13 +43,14 @@ func NewFineTuningJobCheckpointService(opts ...option.RequestOption) (r FineTuni
// List checkpoints for a fine-tuning job.
func (r *FineTuningJobCheckpointService) List(ctx context.Context, fineTuningJobID string, query FineTuningJobCheckpointListParams, opts ...option.RequestOption) (res *pagination.CursorPage[FineTuningJobCheckpoint], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
if fineTuningJobID == "" {
err = errors.New("missing required fine_tuning_job_id parameter")
return nil, err
}
- path := fmt.Sprintf("fine_tuning/jobs/%s/checkpoints", fineTuningJobID)
+ path := requestconfig.FormatPath("fine_tuning/jobs/%s/checkpoints", fineTuningJobID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
@@ -74,7 +74,7 @@ type FineTuningJobCheckpoint struct {
// The checkpoint identifier, which can be referenced in the API endpoints.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) for when the checkpoint was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The name of the fine-tuned checkpoint model that is created.
FineTunedModelCheckpoint string `json:"fine_tuned_model_checkpoint" api:"required"`
// The name of the fine-tuning job that this checkpoint was created from.
diff --git a/vendor/github.com/openai/openai-go/v3/gradergradermodel.go b/vendor/github.com/openai/openai-go/v3/gradergradermodel.go
index a86b41ce3..523a9de8b 100644
--- a/vendor/github.com/openai/openai-go/v3/gradergradermodel.go
+++ b/vendor/github.com/openai/openai-go/v3/gradergradermodel.go
@@ -48,6 +48,8 @@ type GraderInputUnion struct {
OfString string `json:",inline"`
Text string `json:"text"`
Type string `json:"type"`
+ // This field is from variant [responses.ResponseInputText].
+ PromptCacheBreakpoint responses.ResponseInputTextPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
// This field is from variant [GraderInputInputImage].
ImageURL string `json:"image_url"`
// This field is from variant [GraderInputInputImage].
@@ -55,13 +57,14 @@ type GraderInputUnion struct {
// This field is from variant [responses.ResponseInputAudio].
InputAudio responses.ResponseInputAudioInputAudio `json:"input_audio"`
JSON struct {
- OfString respjson.Field
- Text respjson.Field
- Type respjson.Field
- ImageURL respjson.Field
- Detail respjson.Field
- InputAudio respjson.Field
- raw string
+ OfString respjson.Field
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ ImageURL respjson.Field
+ Detail respjson.Field
+ InputAudio respjson.Field
+ raw string
} `json:"-"`
}
@@ -121,7 +124,7 @@ func (r *GraderInputOutputText) UnmarshalJSON(data []byte) error {
// An image input block used within EvalItem content arrays.
type GraderInputInputImage struct {
// The URL of the image input.
- ImageURL string `json:"image_url" api:"required"`
+ ImageURL string `json:"image_url" api:"required" format:"uri"`
// The type of the image input. Always `input_image`.
Type constant.InputImage `json:"type" default:"input_image"`
// The detail level of the image to be sent to the model. One of `high`, `low`, or
@@ -183,6 +186,14 @@ func (u *GraderInputUnionParam) asAny() any {
return nil
}
+// Returns a pointer to the underlying variant's property, if present.
+func (u GraderInputUnionParam) GetPromptCacheBreakpoint() *responses.ResponseInputTextPromptCacheBreakpointParam {
+ if vt := u.OfInputText; vt != nil {
+ return &vt.PromptCacheBreakpoint
+ }
+ return nil
+}
+
// Returns a pointer to the underlying variant's property, if present.
func (u GraderInputUnionParam) GetImageURL() *string {
if vt := u.OfInputImage; vt != nil {
@@ -257,7 +268,7 @@ func (r *GraderInputOutputTextParam) UnmarshalJSON(data []byte) error {
// The properties ImageURL, Type are required.
type GraderInputInputImageParam struct {
// The URL of the image input.
- ImageURL string `json:"image_url" api:"required"`
+ ImageURL string `json:"image_url" api:"required" format:"uri"`
// The detail level of the image to be sent to the model. One of `high`, `low`, or
// `auto`. Defaults to `auto`.
Detail param.Opt[string] `json:"detail,omitzero"`
@@ -370,6 +381,8 @@ type LabelModelGraderInputContentUnion struct {
OfAnArrayOfInputTextOutputTextInputImageAndInputAudio GraderInputs `json:",inline"`
Text string `json:"text"`
Type string `json:"type"`
+ // This field is from variant [responses.ResponseInputText].
+ PromptCacheBreakpoint responses.ResponseInputTextPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
// This field is from variant [LabelModelGraderInputContentInputImage].
ImageURL string `json:"image_url"`
// This field is from variant [LabelModelGraderInputContentInputImage].
@@ -381,6 +394,7 @@ type LabelModelGraderInputContentUnion struct {
OfAnArrayOfInputTextOutputTextInputImageAndInputAudio respjson.Field
Text respjson.Field
Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
ImageURL respjson.Field
Detail respjson.Field
InputAudio respjson.Field
@@ -449,7 +463,7 @@ func (r *LabelModelGraderInputContentOutputText) UnmarshalJSON(data []byte) erro
// An image input block used within EvalItem content arrays.
type LabelModelGraderInputContentInputImage struct {
// The URL of the image input.
- ImageURL string `json:"image_url" api:"required"`
+ ImageURL string `json:"image_url" api:"required" format:"uri"`
// The type of the image input. Always `input_image`.
Type constant.InputImage `json:"type" default:"input_image"`
// The detail level of the image to be sent to the model. One of `high`, `low`, or
@@ -582,6 +596,14 @@ func (u *LabelModelGraderInputContentUnionParam) asAny() any {
return nil
}
+// Returns a pointer to the underlying variant's property, if present.
+func (u LabelModelGraderInputContentUnionParam) GetPromptCacheBreakpoint() *responses.ResponseInputTextPromptCacheBreakpointParam {
+ if vt := u.OfInputText; vt != nil {
+ return &vt.PromptCacheBreakpoint
+ }
+ return nil
+}
+
// Returns a pointer to the underlying variant's property, if present.
func (u LabelModelGraderInputContentUnionParam) GetImageURL() *string {
if vt := u.OfInputImage; vt != nil {
@@ -656,7 +678,7 @@ func (r *LabelModelGraderInputContentOutputTextParam) UnmarshalJSON(data []byte)
// The properties ImageURL, Type are required.
type LabelModelGraderInputContentInputImageParam struct {
// The URL of the image input.
- ImageURL string `json:"image_url" api:"required"`
+ ImageURL string `json:"image_url" api:"required" format:"uri"`
// The detail level of the image to be sent to the model. One of `high`, `low`, or
// `auto`. Defaults to `auto`.
Detail param.Opt[string] `json:"detail,omitzero"`
@@ -1191,6 +1213,8 @@ type ScoreModelGraderInputContentUnion struct {
OfAnArrayOfInputTextOutputTextInputImageAndInputAudio GraderInputs `json:",inline"`
Text string `json:"text"`
Type string `json:"type"`
+ // This field is from variant [responses.ResponseInputText].
+ PromptCacheBreakpoint responses.ResponseInputTextPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
// This field is from variant [ScoreModelGraderInputContentInputImage].
ImageURL string `json:"image_url"`
// This field is from variant [ScoreModelGraderInputContentInputImage].
@@ -1202,6 +1226,7 @@ type ScoreModelGraderInputContentUnion struct {
OfAnArrayOfInputTextOutputTextInputImageAndInputAudio respjson.Field
Text respjson.Field
Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
ImageURL respjson.Field
Detail respjson.Field
InputAudio respjson.Field
@@ -1270,7 +1295,7 @@ func (r *ScoreModelGraderInputContentOutputText) UnmarshalJSON(data []byte) erro
// An image input block used within EvalItem content arrays.
type ScoreModelGraderInputContentInputImage struct {
// The URL of the image input.
- ImageURL string `json:"image_url" api:"required"`
+ ImageURL string `json:"image_url" api:"required" format:"uri"`
// The type of the image input. Always `input_image`.
Type constant.InputImage `json:"type" default:"input_image"`
// The detail level of the image to be sent to the model. One of `high`, `low`, or
@@ -1296,21 +1321,14 @@ func (r *ScoreModelGraderInputContentInputImage) UnmarshalJSON(data []byte) erro
type ScoreModelGraderSamplingParams struct {
// The maximum number of tokens the grader model may generate in its response.
MaxCompletionsTokens int64 `json:"max_completions_tokens" api:"nullable"`
- // Constrains effort on reasoning for
- // [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
- // supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`.
- // Reducing reasoning effort can result in faster responses and fewer tokens used
- // on reasoning in a response.
- //
- // - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported
- // reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool
- // calls are supported for all reasoning values in gpt-5.1.
- // - All models before `gpt-5.1` default to `medium` reasoning effort, and do not
- // support `none`.
- // - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
- // - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
+ // Constrains effort on reasoning for reasoning models. Currently supported values
+ // are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. Reducing
+ // reasoning effort can result in faster responses and fewer tokens used on
+ // reasoning in a response. Not all reasoning models support every value. See the
+ // [reasoning guide](https://platform.openai.com/docs/guides/reasoning) for
+ // model-specific support.
//
- // Any of "none", "minimal", "low", "medium", "high", "xhigh".
+ // Any of "none", "minimal", "low", "medium", "high", "xhigh", "max".
ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort" api:"nullable"`
// A seed value to initialize the randomness, during sampling.
Seed int64 `json:"seed" api:"nullable"`
@@ -1448,6 +1466,14 @@ func (u *ScoreModelGraderInputContentUnionParam) asAny() any {
return nil
}
+// Returns a pointer to the underlying variant's property, if present.
+func (u ScoreModelGraderInputContentUnionParam) GetPromptCacheBreakpoint() *responses.ResponseInputTextPromptCacheBreakpointParam {
+ if vt := u.OfInputText; vt != nil {
+ return &vt.PromptCacheBreakpoint
+ }
+ return nil
+}
+
// Returns a pointer to the underlying variant's property, if present.
func (u ScoreModelGraderInputContentUnionParam) GetImageURL() *string {
if vt := u.OfInputImage; vt != nil {
@@ -1522,7 +1548,7 @@ func (r *ScoreModelGraderInputContentOutputTextParam) UnmarshalJSON(data []byte)
// The properties ImageURL, Type are required.
type ScoreModelGraderInputContentInputImageParam struct {
// The URL of the image input.
- ImageURL string `json:"image_url" api:"required"`
+ ImageURL string `json:"image_url" api:"required" format:"uri"`
// The detail level of the image to be sent to the model. One of `high`, `low`, or
// `auto`. Defaults to `auto`.
Detail param.Opt[string] `json:"detail,omitzero"`
@@ -1551,21 +1577,14 @@ type ScoreModelGraderSamplingParamsParam struct {
Temperature param.Opt[float64] `json:"temperature,omitzero"`
// An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
TopP param.Opt[float64] `json:"top_p,omitzero"`
- // Constrains effort on reasoning for
- // [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
- // supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`.
- // Reducing reasoning effort can result in faster responses and fewer tokens used
- // on reasoning in a response.
- //
- // - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported
- // reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool
- // calls are supported for all reasoning values in gpt-5.1.
- // - All models before `gpt-5.1` default to `medium` reasoning effort, and do not
- // support `none`.
- // - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
- // - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
+ // Constrains effort on reasoning for reasoning models. Currently supported values
+ // are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. Reducing
+ // reasoning effort can result in faster responses and fewer tokens used on
+ // reasoning in a response. Not all reasoning models support every value. See the
+ // [reasoning guide](https://platform.openai.com/docs/guides/reasoning) for
+ // model-specific support.
//
- // Any of "none", "minimal", "low", "medium", "high", "xhigh".
+ // Any of "none", "minimal", "low", "medium", "high", "xhigh", "max".
ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"`
paramObj
}
diff --git a/vendor/github.com/openai/openai-go/v3/image.go b/vendor/github.com/openai/openai-go/v3/image.go
index ec0ae828e..4c2f2d04c 100644
--- a/vendor/github.com/openai/openai-go/v3/image.go
+++ b/vendor/github.com/openai/openai-go/v3/image.go
@@ -44,7 +44,8 @@ func NewImageService(opts ...option.RequestOption) (r ImageService) {
// Creates a variation of a given image. This endpoint only supports `dall-e-2`.
func (r *ImageService) NewVariation(ctx context.Context, body ImageNewVariationParams, opts ...option.RequestOption) (res *ImagesResponse, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "images/variations"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -54,7 +55,8 @@ func (r *ImageService) NewVariation(ctx context.Context, body ImageNewVariationP
// prompt. This endpoint supports GPT Image models (`gpt-image-1.5`, `gpt-image-1`,
// `gpt-image-1-mini`, and `chatgpt-image-latest`) and `dall-e-2`.
func (r *ImageService) Edit(ctx context.Context, body ImageEditParams, opts ...option.RequestOption) (res *ImagesResponse, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "images/edits"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -68,7 +70,8 @@ func (r *ImageService) EditStreaming(ctx context.Context, body ImageEditParams,
raw *http.Response
err error
)
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
body.SetExtraFields(map[string]any{
"stream": "true",
})
@@ -80,7 +83,8 @@ func (r *ImageService) EditStreaming(ctx context.Context, body ImageEditParams,
// Creates an image given a prompt.
// [Learn more](https://platform.openai.com/docs/guides/images).
func (r *ImageService) Generate(ctx context.Context, body ImageGenerateParams, opts ...option.RequestOption) (res *ImagesResponse, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "images/generations"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -93,7 +97,8 @@ func (r *ImageService) GenerateStreaming(ctx context.Context, body ImageGenerate
raw *http.Response
err error
)
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append(opts, option.WithJSONSet("stream", true))
path := "images/generations"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &raw, opts...)
@@ -111,7 +116,7 @@ type Image struct {
// When using `dall-e-2` or `dall-e-3`, the URL of the generated image if
// `response_format` is set to `url` (default value). Unsupported for the GPT image
// models.
- URL string `json:"url"`
+ URL string `json:"url" format:"uri"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
B64JSON respjson.Field
@@ -137,7 +142,7 @@ type ImageEditCompletedEvent struct {
// Any of "transparent", "opaque", "auto".
Background ImageEditCompletedEventBackground `json:"background" api:"required"`
// The Unix timestamp when the event was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The output format for the edited image.
//
// Any of "png", "webp", "jpeg".
@@ -272,7 +277,7 @@ type ImageEditPartialImageEvent struct {
// Any of "transparent", "opaque", "auto".
Background ImageEditPartialImageEventBackground `json:"background" api:"required"`
// The Unix timestamp when the event was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The output format for the requested edited image.
//
// Any of "png", "webp", "jpeg".
@@ -435,7 +440,7 @@ type ImageGenCompletedEvent struct {
// Any of "transparent", "opaque", "auto".
Background ImageGenCompletedEventBackground `json:"background" api:"required"`
// The Unix timestamp when the event was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The output format for the generated image.
//
// Any of "png", "webp", "jpeg".
@@ -570,7 +575,7 @@ type ImageGenPartialImageEvent struct {
// Any of "transparent", "opaque", "auto".
Background ImageGenPartialImageEventBackground `json:"background" api:"required"`
// The Unix timestamp when the event was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The output format for the requested image.
//
// Any of "png", "webp", "jpeg".
@@ -727,17 +732,20 @@ func (r *ImageGenStreamEventUnion) UnmarshalJSON(data []byte) error {
type ImageModel = string
const (
- ImageModelGPTImage1_5 ImageModel = "gpt-image-1.5"
- ImageModelDallE2 ImageModel = "dall-e-2"
- ImageModelDallE3 ImageModel = "dall-e-3"
- ImageModelGPTImage1 ImageModel = "gpt-image-1"
- ImageModelGPTImage1Mini ImageModel = "gpt-image-1-mini"
+ ImageModelGPTImage1 ImageModel = "gpt-image-1"
+ ImageModelGPTImage1Mini ImageModel = "gpt-image-1-mini"
+ ImageModelGPTImage2 ImageModel = "gpt-image-2"
+ ImageModelGPTImage2_2026_04_21 ImageModel = "gpt-image-2-2026-04-21"
+ ImageModelGPTImage1_5 ImageModel = "gpt-image-1.5"
+ ImageModelChatgptImageLatest ImageModel = "chatgpt-image-latest"
+ ImageModelDallE2 ImageModel = "dall-e-2"
+ ImageModelDallE3 ImageModel = "dall-e-3"
)
// The response from the image generation endpoint.
type ImagesResponse struct {
// The Unix timestamp (in seconds) of when the image was created.
- Created int64 `json:"created" api:"required"`
+ Created int64 `json:"created" api:"required" format:"unixtime"`
// The background parameter used for the image generation. Either `transparent` or
// `opaque`.
//
@@ -957,10 +965,10 @@ const (
type ImageEditParams struct {
// The image(s) to edit. Must be a supported image file or an array of images.
//
- // For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and
- // `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` file less than
- // 50MB. You can provide up to 16 images. `chatgpt-image-latest` follows the same
- // input constraints as GPT image models.
+ // For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`,
+ // `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image
+ // should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to
+ // 16 images.
//
// For `dall-e-2`, you can only provide one image, and it should be a square `png`
// file less than 4MB.
@@ -986,9 +994,14 @@ type ImageEditParams struct {
// [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
User param.Opt[string] `json:"user,omitzero"`
// Allows to set transparency for the background of the generated image(s). This
- // parameter is only supported for the GPT image models. Must be one of
- // `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
- // model will automatically determine the best background for the image.
+ // parameter is only supported for GPT image models that support transparent
+ // backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value).
+ // When `auto` is used, the model will automatically determine the best background
+ // for the image.
+ //
+ // `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent
+ // backgrounds. Requests with `background` set to `transparent` will return an
+ // error for these models; use `opaque` or `auto` instead.
//
// If `transparent`, the output format needs to support transparency, so it should
// be set to either `png` (default value) or `webp`.
@@ -1002,7 +1015,10 @@ type ImageEditParams struct {
//
// Any of "high", "low".
InputFidelity ImageEditParamsInputFidelity `json:"input_fidelity,omitzero"`
- // The model to use for image generation. Defaults to `gpt-image-1.5`.
+ // The model to use for image generation. One of `dall-e-2` or a GPT image model
+ // (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
+ // `gpt-image-2-2026-04-21`, or `chatgpt-image-latest`). Defaults to
+ // `gpt-image-1.5`.
Model ImageModel `json:"model,omitzero"`
// The format in which the generated images are returned. This parameter is only
// supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`. The
@@ -1022,11 +1038,17 @@ type ImageEditParams struct {
//
// Any of "url", "b64_json".
ResponseFormat ImageEditParamsResponseFormat `json:"response_format,omitzero"`
- // The size of the generated images. Must be one of `1024x1024`, `1536x1024`
- // (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image
- // models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.
- //
- // Any of "256x256", "512x512", "1024x1024", "1536x1024", "1024x1536", "auto".
+ // The size of the generated images. For `gpt-image-2` and
+ // `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT`
+ // strings, for example `1536x864`. Width and height must both be divisible by 16
+ // and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above
+ // `2560x1440` are experimental, and the maximum supported resolution is
+ // `3840x2160`. The requested size must also satisfy the model's current pixel and
+ // edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are
+ // supported by the GPT image models; `auto` is supported for models that allow
+ // automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or
+ // `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or
+ // `1024x1792`.
Size ImageEditParamsSize `json:"size,omitzero"`
// An additional image whose fully transparent areas (e.g. where alpha is zero)
// indicate where `image` should be edited. If there are multiple images provided,
@@ -1080,9 +1102,14 @@ func (u *ImageEditParamsImageUnion) asAny() any {
}
// Allows to set transparency for the background of the generated image(s). This
-// parameter is only supported for the GPT image models. Must be one of
-// `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
-// model will automatically determine the best background for the image.
+// parameter is only supported for GPT image models that support transparent
+// backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value).
+// When `auto` is used, the model will automatically determine the best background
+// for the image.
+//
+// `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent
+// backgrounds. Requests with `background` set to `transparent` will return an
+// error for these models; use `opaque` or `auto` instead.
//
// If `transparent`, the output format needs to support transparency, so it should
// be set to either `png` (default value) or `webp`.
@@ -1139,9 +1166,17 @@ const (
ImageEditParamsResponseFormatB64JSON ImageEditParamsResponseFormat = "b64_json"
)
-// The size of the generated images. Must be one of `1024x1024`, `1536x1024`
-// (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image
-// models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.
+// The size of the generated images. For `gpt-image-2` and
+// `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT`
+// strings, for example `1536x864`. Width and height must both be divisible by 16
+// and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above
+// `2560x1440` are experimental, and the maximum supported resolution is
+// `3840x2160`. The requested size must also satisfy the model's current pixel and
+// edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are
+// supported by the GPT image models; `auto` is supported for models that allow
+// automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or
+// `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or
+// `1024x1792`.
type ImageEditParamsSize string
const (
@@ -1177,9 +1212,14 @@ type ImageGenerateParams struct {
// [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
User param.Opt[string] `json:"user,omitzero"`
// Allows to set transparency for the background of the generated image(s). This
- // parameter is only supported for the GPT image models. Must be one of
- // `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
- // model will automatically determine the best background for the image.
+ // parameter is only supported for GPT image models that support transparent
+ // backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value).
+ // When `auto` is used, the model will automatically determine the best background
+ // for the image.
+ //
+ // `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent
+ // backgrounds. Requests with `background` set to `transparent` will return an
+ // error for these models; use `opaque` or `auto` instead.
//
// If `transparent`, the output format needs to support transparency, so it should
// be set to either `png` (default value) or `webp`.
@@ -1187,8 +1227,9 @@ type ImageGenerateParams struct {
// Any of "transparent", "opaque", "auto".
Background ImageGenerateParamsBackground `json:"background,omitzero"`
// The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT
- // image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`). Defaults to
- // `dall-e-2` unless a parameter specific to the GPT image models is used.
+ // image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
+ // or `gpt-image-2-2026-04-21`). Defaults to `dall-e-2` unless a parameter specific
+ // to the GPT image models is used.
Model ImageModel `json:"model,omitzero"`
// Control the content-moderation level for images generated by the GPT image
// models. Must be either `low` for less restrictive filtering or `auto` (default
@@ -1218,13 +1259,17 @@ type ImageGenerateParams struct {
//
// Any of "url", "b64_json".
ResponseFormat ImageGenerateParamsResponseFormat `json:"response_format,omitzero"`
- // The size of the generated images. Must be one of `1024x1024`, `1536x1024`
- // (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image
- // models, one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and one of
- // `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3`.
- //
- // Any of "auto", "1024x1024", "1536x1024", "1024x1536", "256x256", "512x512",
- // "1792x1024", "1024x1792".
+ // The size of the generated images. For `gpt-image-2` and
+ // `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT`
+ // strings, for example `1536x864`. Width and height must both be divisible by 16
+ // and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above
+ // `2560x1440` are experimental, and the maximum supported resolution is
+ // `3840x2160`. The requested size must also satisfy the model's current pixel and
+ // edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are
+ // supported by the GPT image models; `auto` is supported for models that allow
+ // automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or
+ // `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or
+ // `1024x1792`.
Size ImageGenerateParamsSize `json:"size,omitzero"`
// The style of the generated images. This parameter is only supported for
// `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean
@@ -1245,9 +1290,14 @@ func (r *ImageGenerateParams) UnmarshalJSON(data []byte) error {
}
// Allows to set transparency for the background of the generated image(s). This
-// parameter is only supported for the GPT image models. Must be one of
-// `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
-// model will automatically determine the best background for the image.
+// parameter is only supported for GPT image models that support transparent
+// backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value).
+// When `auto` is used, the model will automatically determine the best background
+// for the image.
+//
+// `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent
+// backgrounds. Requests with `background` set to `transparent` will return an
+// error for these models; use `opaque` or `auto` instead.
//
// If `transparent`, the output format needs to support transparency, so it should
// be set to either `png` (default value) or `webp`.
@@ -1308,10 +1358,17 @@ const (
ImageGenerateParamsResponseFormatB64JSON ImageGenerateParamsResponseFormat = "b64_json"
)
-// The size of the generated images. Must be one of `1024x1024`, `1536x1024`
-// (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image
-// models, one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and one of
-// `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3`.
+// The size of the generated images. For `gpt-image-2` and
+// `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT`
+// strings, for example `1536x864`. Width and height must both be divisible by 16
+// and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above
+// `2560x1440` are experimental, and the maximum supported resolution is
+// `3840x2160`. The requested size must also satisfy the model's current pixel and
+// edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are
+// supported by the GPT image models; `auto` is supported for models that allow
+// automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or
+// `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or
+// `1024x1792`.
type ImageGenerateParamsSize string
const (
diff --git a/vendor/github.com/openai/openai-go/v3/internal/apiform/encoder.go b/vendor/github.com/openai/openai-go/v3/internal/apiform/encoder.go
index 0a5bfc8e8..6cf398eaa 100644
--- a/vendor/github.com/openai/openai-go/v3/internal/apiform/encoder.go
+++ b/vendor/github.com/openai/openai-go/v3/internal/apiform/encoder.go
@@ -58,7 +58,7 @@ type encoderField struct {
}
type encoderEntry struct {
- reflect.Type
+ typ reflect.Type
dateFormat string
arrayFmt string
root bool
@@ -76,7 +76,7 @@ func (e *encoder) marshal(value any, writer *multipart.Writer) error {
func (e *encoder) typeEncoder(t reflect.Type) encoderFunc {
entry := encoderEntry{
- Type: t,
+ typ: t,
dateFormat: e.dateFormat,
arrayFmt: e.arrayFmt,
root: e.root,
diff --git a/vendor/github.com/openai/openai-go/v3/internal/apijson/decoder.go b/vendor/github.com/openai/openai-go/v3/internal/apijson/decoder.go
index 5da1f0a1b..055637318 100644
--- a/vendor/github.com/openai/openai-go/v3/internal/apijson/decoder.go
+++ b/vendor/github.com/openai/openai-go/v3/internal/apijson/decoder.go
@@ -80,7 +80,7 @@ type decoderField struct {
}
type decoderEntry struct {
- reflect.Type
+ typ reflect.Type
dateFormat string
root bool
}
@@ -108,7 +108,7 @@ func (d *decoderBuilder) unmarshalWithExactness(raw []byte, to any) (exactness,
func (d *decoderBuilder) typeDecoder(t reflect.Type) decoderFunc {
entry := decoderEntry{
- Type: t,
+ typ: t,
dateFormat: d.dateFormat,
root: d.root,
}
diff --git a/vendor/github.com/openai/openai-go/v3/internal/apijson/encoder.go b/vendor/github.com/openai/openai-go/v3/internal/apijson/encoder.go
index 9b7e8ee85..7c1c77341 100644
--- a/vendor/github.com/openai/openai-go/v3/internal/apijson/encoder.go
+++ b/vendor/github.com/openai/openai-go/v3/internal/apijson/encoder.go
@@ -46,7 +46,7 @@ type encoderField struct {
}
type encoderEntry struct {
- reflect.Type
+ typ reflect.Type
dateFormat string
root bool
}
@@ -63,7 +63,7 @@ func (e *encoder) marshal(value any) ([]byte, error) {
func (e *encoder) typeEncoder(t reflect.Type) encoderFunc {
entry := encoderEntry{
- Type: t,
+ typ: t,
dateFormat: e.dateFormat,
root: e.root,
}
diff --git a/vendor/github.com/openai/openai-go/v3/internal/apiquery/encoder.go b/vendor/github.com/openai/openai-go/v3/internal/apiquery/encoder.go
index 75c408a1b..1c7a6e488 100644
--- a/vendor/github.com/openai/openai-go/v3/internal/apiquery/encoder.go
+++ b/vendor/github.com/openai/openai-go/v3/internal/apiquery/encoder.go
@@ -29,7 +29,7 @@ type encoderField struct {
}
type encoderEntry struct {
- reflect.Type
+ typ reflect.Type
dateFormat string
root bool
settings QuerySettings
@@ -42,7 +42,7 @@ type Pair struct {
func (e *encoder) typeEncoder(t reflect.Type) encoderFunc {
entry := encoderEntry{
- Type: t,
+ typ: t,
dateFormat: e.dateFormat,
root: e.root,
settings: e.settings,
diff --git a/vendor/github.com/openai/openai-go/v3/internal/encoding/json/encode.go b/vendor/github.com/openai/openai-go/v3/internal/encoding/json/encode.go
index acd343ba6..d91200ce9 100644
--- a/vendor/github.com/openai/openai-go/v3/internal/encoding/json/encode.go
+++ b/vendor/github.com/openai/openai-go/v3/internal/encoding/json/encode.go
@@ -174,15 +174,21 @@ import (
// JSON cannot represent cyclic data structures and Marshal does not
// handle them. Passing cyclic structures to Marshal will result in
// an error.
-func Marshal(v any) ([]byte, error) {
+// EDIT(begin): add optimization options
+func Marshal(v any, opts ...Option) ([]byte, error) {
+ // EDIT(end): add optimization options
e := newEncodeState()
defer encodeStatePool.Put(e)
- // SHIM(begin): don't escape HTML by default
- err := e.marshal(v, encOpts{escapeHTML: shims.EscapeHTMLByDefault})
+ // EDIT(begin): don't escape HTML by default, and apply options
+ encOpts := encOpts{escapeHTML: shims.EscapeHTMLByDefault}
+ if opts != nil {
+ encOpts = encOpts.apply(opts...)
+ }
+ err := e.marshal(v, encOpts)
// ORIGINAL:
// err := e.marshal(v, encOpts{escapeHTML: true})
- // SHIM(end)
+ // EDIT(end)
if err != nil {
return nil, err
}
@@ -353,6 +359,9 @@ type encOpts struct {
// EDIT(begin): save the timefmt
timefmt string
// EDIT(end)
+ // EDIT(begin): add optimization to skip compaction
+ skipCompaction bool
+ // EDIT(end)
}
type encoderFunc func(e *encodeState, v reflect.Value, opts encOpts)
@@ -484,7 +493,7 @@ func marshalerEncoder(e *encodeState, v reflect.Value, opts encOpts) {
if err == nil {
e.Grow(len(b))
out := e.AvailableBuffer()
- out, err = appendCompact(out, b, opts.escapeHTML)
+ out, err = appendCompact(out, b, opts)
e.Buffer.Write(out)
}
if err != nil {
@@ -510,7 +519,7 @@ func addrMarshalerEncoder(e *encodeState, v reflect.Value, opts encOpts) {
if err == nil {
e.Grow(len(b))
out := e.AvailableBuffer()
- out, err = appendCompact(out, b, opts.escapeHTML)
+ out, err = appendCompact(out, b, opts)
e.Buffer.Write(out)
}
if err != nil {
diff --git a/vendor/github.com/openai/openai-go/v3/internal/encoding/json/indent.go b/vendor/github.com/openai/openai-go/v3/internal/encoding/json/indent.go
index 01bfdf65e..c9d6ca5b1 100644
--- a/vendor/github.com/openai/openai-go/v3/internal/encoding/json/indent.go
+++ b/vendor/github.com/openai/openai-go/v3/internal/encoding/json/indent.go
@@ -4,7 +4,9 @@
package json
-import "bytes"
+import (
+ "bytes"
+)
// HTMLEscape appends to dst the JSON-encoded src with <, >, &, U+2028 and U+2029
// characters inside string literals changed to \u003c, \u003e, \u0026, \u2028, \u2029
@@ -41,12 +43,21 @@ func appendHTMLEscape(dst, src []byte) []byte {
func Compact(dst *bytes.Buffer, src []byte) error {
dst.Grow(len(src))
b := dst.AvailableBuffer()
- b, err := appendCompact(b, src, false)
+ b, err := appendCompact(b, src, encOpts{})
dst.Write(b)
return err
}
-func appendCompact(dst, src []byte, escape bool) ([]byte, error) {
+func appendCompact(dst, src []byte, opts encOpts) ([]byte, error) {
+ // EDIT(begin): optimize for skipCompaction
+ if opts.skipCompaction {
+ dst = append(dst, src...)
+ return dst, nil
+ }
+
+ escape := opts.escapeHTML
+ // EDIT(end)
+
origLen := len(dst)
scan := newScanner()
defer freeScanner(scan)
diff --git a/vendor/github.com/openai/openai-go/v3/internal/encoding/json/opt.go b/vendor/github.com/openai/openai-go/v3/internal/encoding/json/opt.go
new file mode 100644
index 000000000..fd6f8d2fe
--- /dev/null
+++ b/vendor/github.com/openai/openai-go/v3/internal/encoding/json/opt.go
@@ -0,0 +1,24 @@
+// EDIT(begin): add custom options for JSON encoding
+package json
+
+type Option func(*encOpts)
+
+// Every time a sub-type of [json.Marshaler] is encountered,
+// skip a redundant and costly compaction step, trust it to self-compact.
+//
+// This is a divergence from the standard library behavior, and is only guaranteed
+// safe with SDK types.
+func WithSkipCompaction(b bool) Option {
+ return func(eos *encOpts) {
+ eos.skipCompaction = true
+ }
+}
+
+func (eos encOpts) apply(opts ...Option) encOpts {
+ for _, opt := range opts {
+ opt(&eos)
+ }
+ return eos
+}
+
+// EDIT(end)
diff --git a/vendor/github.com/openai/openai-go/v3/internal/encoding/json/stream.go b/vendor/github.com/openai/openai-go/v3/internal/encoding/json/stream.go
index e2d9470bc..652522c3a 100644
--- a/vendor/github.com/openai/openai-go/v3/internal/encoding/json/stream.go
+++ b/vendor/github.com/openai/openai-go/v3/internal/encoding/json/stream.go
@@ -6,7 +6,6 @@ package json
import (
"bytes"
- "errors"
"io"
)
@@ -253,30 +252,34 @@ func (enc *Encoder) SetEscapeHTML(on bool) {
enc.escapeHTML = on
}
-// RawMessage is a raw encoded JSON value.
-// It implements [Marshaler] and [Unmarshaler] and can
-// be used to delay JSON decoding or precompute a JSON encoding.
-type RawMessage []byte
-
-// MarshalJSON returns m as the JSON encoding of m.
-func (m RawMessage) MarshalJSON() ([]byte, error) {
- if m == nil {
- return []byte("null"), nil
- }
- return m, nil
-}
-
-// UnmarshalJSON sets *m to a copy of data.
-func (m *RawMessage) UnmarshalJSON(data []byte) error {
- if m == nil {
- return errors.New("json.RawMessage: UnmarshalJSON on nil pointer")
- }
- *m = append((*m)[0:0], data...)
- return nil
-}
-
-var _ Marshaler = (*RawMessage)(nil)
-var _ Unmarshaler = (*RawMessage)(nil)
+// EDIT(begin): remove RawMessage
+//
+// // RawMessage is a raw encoded JSON value.
+// // It implements [Marshaler] and [Unmarshaler] and can
+// // be used to delay JSON decoding or precompute a JSON encoding.
+// type RawMessage []byte
+//
+// // MarshalJSON returns m as the JSON encoding of m.
+// func (m RawMessage) MarshalJSON() ([]byte, error) {
+// if m == nil {
+// return []byte("null"), nil
+// }
+// return m, nil
+// }
+//
+// // UnmarshalJSON sets *m to a copy of data.
+// func (m *RawMessage) UnmarshalJSON(data []byte) error {
+// if m == nil {
+// return errors.New("json.RawMessage: UnmarshalJSON on nil pointer")
+// }
+// *m = append((*m)[0:0], data...)
+// return nil
+// }
+//
+// var _ Marshaler = (*RawMessage)(nil)
+// var _ Unmarshaler = (*RawMessage)(nil)
+//
+// EDIT(end)
// A Token holds a value of one of these types:
//
diff --git a/vendor/github.com/openai/openai-go/v3/internal/encoding/json/time.go b/vendor/github.com/openai/openai-go/v3/internal/encoding/json/time.go
index d4548e431..e236d6765 100644
--- a/vendor/github.com/openai/openai-go/v3/internal/encoding/json/time.go
+++ b/vendor/github.com/openai/openai-go/v3/internal/encoding/json/time.go
@@ -50,7 +50,7 @@ func timeMarshalEncoder(e *encodeState, v reflect.Value, opts encOpts) bool {
if b != nil {
e.Grow(len(b))
out := e.AvailableBuffer()
- out, _ = appendCompact(out, b, opts.escapeHTML)
+ out, _ = appendCompact(out, b, opts)
e.Buffer.Write(out)
return true
}
diff --git a/vendor/github.com/openai/openai-go/v3/internal/requestconfig/requestconfig.go b/vendor/github.com/openai/openai-go/v3/internal/requestconfig/requestconfig.go
index 153cbab65..3b8a67e87 100644
--- a/vendor/github.com/openai/openai-go/v3/internal/requestconfig/requestconfig.go
+++ b/vendor/github.com/openai/openai-go/v3/internal/requestconfig/requestconfig.go
@@ -6,6 +6,7 @@ import (
"bytes"
"context"
"encoding/json"
+ "errors"
"fmt"
"io"
"math"
@@ -16,6 +17,7 @@ import (
"runtime"
"strconv"
"strings"
+ "sync"
"time"
"github.com/openai/openai-go/v3/internal"
@@ -31,6 +33,25 @@ func getDefaultHeaders() map[string]string {
}
}
+func encodePathParam(value string) string {
+ switch value {
+ case ".":
+ return "%2E"
+ case "..":
+ return "%2E%2E"
+ }
+ return url.PathEscape(value)
+}
+
+// FormatPath escapes path parameters and inserts them into a request path.
+func FormatPath(format string, params ...string) string {
+ args := make([]any, len(params))
+ for i, param := range params {
+ args[i] = encodePathParam(param)
+ }
+ return fmt.Sprintf(format, args...)
+}
+
func getNormalizedOS() string {
switch runtime.GOOS {
case "ios":
@@ -85,6 +106,78 @@ type RequestOption interface {
type RequestOptionFunc func(*RequestConfig) error
type PreRequestOptionFunc func(*RequestConfig) error
+// requestFinalizer is an internal extension point for provider integrations
+// that must inspect the fully configured request and install middleware after
+// all client- and method-level options have been applied.
+type requestFinalizer func(*RequestConfig) error
+
+type requestFinalizerOption struct {
+ finalize func(*RequestConfig) error
+}
+
+// noRetryError marks deterministic request setup or policy failures that
+// cannot be fixed by replaying the same request. It deliberately remains an
+// internal implementation detail so public error strings and wrapping stay
+// unchanged.
+type noRetryError struct {
+ err error
+}
+
+func (e *noRetryError) Error() string { return e.err.Error() }
+func (e *noRetryError) Unwrap() error { return e.err }
+func (e *noRetryError) noRetry() {}
+
+// WithNoRetryError marks err as deterministic for the generic request retry
+// loop while preserving its message and unwrap chain. This function is
+// internal API and may change without notice.
+func WithNoRetryError(err error) error {
+ if err == nil {
+ return nil
+ }
+ return &noRetryError{err: err}
+}
+
+func (o requestFinalizerOption) Apply(cfg *RequestConfig) error {
+ cfg.finalizers = append(cfg.finalizers, o.finalize)
+ return nil
+}
+
+// WithRequestFinalizer registers an internal provider finalizer. Finalizers run
+// after every RequestOption has been applied and before request security is
+// selected. This keeps provider authentication closest to the wire, including
+// when callers add method-level middleware.
+//
+// This function is internal API and may change without notice.
+func WithRequestFinalizer(finalize func(*RequestConfig) error) RequestOption {
+ return requestFinalizerOption{finalize: finalize}
+}
+
+type environmentDefaultsDisabledOption struct{}
+
+func (environmentDefaultsDisabledOption) Apply(*RequestConfig) error {
+ return nil
+}
+
+// WithEnvironmentDefaultsDisabled marks a provider-owned client that must not
+// inherit ambient OPENAI_* configuration. The regular transport defaults still
+// apply.
+//
+// This function is internal API and may change without notice.
+func WithEnvironmentDefaultsDisabled() RequestOption {
+ return environmentDefaultsDisabledOption{}
+}
+
+// EnvironmentDefaultsDisabled reports whether opts contains the internal
+// provider marker returned by WithEnvironmentDefaultsDisabled.
+func EnvironmentDefaultsDisabled(opts ...RequestOption) bool {
+ for _, opt := range opts {
+ if _, ok := opt.(environmentDefaultsDisabledOption); ok {
+ return true
+ }
+ }
+ return false
+}
+
func (s RequestOptionFunc) Apply(r *RequestConfig) error { return s(r) }
func (s PreRequestOptionFunc) Apply(r *RequestConfig) error { return s(r) }
@@ -178,11 +271,26 @@ func NewRequestConfig(ctx context.Context, method string, u string, body any, ds
Body: reader,
}
cfg.ResponseBodyInto = dst
+ cfg.Security = Security{
+ BearerAuth: true,
+ AdminAPIKeyAuth: true,
+ }
err = cfg.Apply(opts...)
if err != nil {
return nil, err
}
+ // Provider finalizers intentionally run after every regular option so they
+ // can sign the final URL, headers, and serialized body on each attempt.
+ for _, finalizer := range cfg.finalizers {
+ if err := finalizer(&cfg); err != nil {
+ return nil, err
+ }
+ }
+
+ // This must run after `cfg.Apply(...)` above so we know which specific security scheme to add
+ ApplySecurity(cfg)
+
// This must run after `cfg.Apply(...)` above in case the request timeout gets modified. We also only
// apply our own logic for it if it's still "0" from above. If it's not, then it was deleted or modified
// by the user and we should respect that.
@@ -215,14 +323,20 @@ type RequestConfig struct {
BaseURL *url.URL
// DefaultBaseURL will be used if BaseURL is not explicitly overridden using
// WithBaseURL.
- DefaultBaseURL *url.URL
- CustomHTTPDoer HTTPDoer
- HTTPClient *http.Client
- Middlewares []middleware
- APIKey string
- Organization string
- Project string
- WebhookSecret string
+ DefaultBaseURL *url.URL
+ CustomHTTPDoer HTTPDoer
+ HTTPClient *http.Client
+ Middlewares []middleware
+ APIKey string
+ AdminAPIKey string
+ Organization string
+ Project string
+ WebhookSecret string
+ finalizers []requestFinalizer
+ authHeaderOverride bool
+ authPreference authCredentialPreference
+ // Configure which security scheme(s) should be enabled for this request
+ Security Security
// If ResponseBodyInto not nil, then we will attempt to deserialize into
// ResponseBodyInto. If Destination is a []byte, then it will return the body as
// is.
@@ -247,12 +361,17 @@ func applyMiddleware(middleware middleware, next middlewareNext) middlewareNext
}
}
-func shouldRetry(req *http.Request, res *http.Response) bool {
+func shouldRetry(req *http.Request, res *http.Response, err error) bool {
// If there is no way to recover the Body, then we shouldn't retry.
if req.Body != nil && req.GetBody == nil {
return false
}
+ var deterministic interface{ noRetry() }
+ if errors.As(err, &deterministic) {
+ return false
+ }
+
// If there is no response, that indicates that there is a connection error
// so we retry the request.
if res == nil {
@@ -364,6 +483,22 @@ func (b *bodyWithTimeout) Close() error {
return err
}
+// closeOnceReadCloser lets Execute clean up bodies when middleware returns an
+// error before reaching the transport, without double-closing bodies that a
+// transport has already closed.
+type closeOnceReadCloser struct {
+ io.ReadCloser
+ once sync.Once
+ err error
+}
+
+func (b *closeOnceReadCloser) Close() error {
+ b.once.Do(func() {
+ b.err = b.ReadCloser.Close()
+ })
+ return b.err
+}
+
func retryDelay(res *http.Response, retryCount int) time.Duration {
// If the backend tells us to wait a certain amount of time, use that value
if retryAfterDelay, ok := parseRetryAfterHeader(res); ok {
@@ -444,15 +579,21 @@ func (cfg *RequestConfig) Execute() (err error) {
}
req := cfg.Request.Clone(ctx)
+ if req.Body != nil {
+ req.Body = &closeOnceReadCloser{ReadCloser: req.Body}
+ }
if shouldSendRetryCount {
req.Header.Set("X-Stainless-Retry-Count", strconv.Itoa(retryCount))
}
res, err = handler(req)
+ if err != nil && req.Body != nil {
+ _ = req.Body.Close()
+ }
if ctx != nil && ctx.Err() != nil {
return ctx.Err()
}
- if !shouldRetry(cfg.Request, res) || retryCount >= cfg.MaxRetries {
+ if !shouldRetry(cfg.Request, res, err) || retryCount >= cfg.MaxRetries {
break
}
@@ -590,22 +731,59 @@ func (cfg *RequestConfig) Clone(ctx context.Context) *RequestConfig {
return nil
}
new := &RequestConfig{
- MaxRetries: cfg.MaxRetries,
- RequestTimeout: cfg.RequestTimeout,
- Context: ctx,
- Request: req,
- BaseURL: cfg.BaseURL,
- HTTPClient: cfg.HTTPClient,
- Middlewares: cfg.Middlewares,
- APIKey: cfg.APIKey,
- Organization: cfg.Organization,
- Project: cfg.Project,
- WebhookSecret: cfg.WebhookSecret,
+ MaxRetries: cfg.MaxRetries,
+ RequestTimeout: cfg.RequestTimeout,
+ Context: ctx,
+ Request: req,
+ BaseURL: cfg.BaseURL,
+ HTTPClient: cfg.HTTPClient,
+ Middlewares: cfg.Middlewares,
+ APIKey: cfg.APIKey,
+ AdminAPIKey: cfg.AdminAPIKey,
+ Organization: cfg.Organization,
+ Project: cfg.Project,
+ WebhookSecret: cfg.WebhookSecret,
+ finalizers: append([]requestFinalizer(nil), cfg.finalizers...),
+ authHeaderOverride: cfg.authHeaderOverride,
+ authPreference: cfg.authPreference,
}
return new
}
+func (cfg *RequestConfig) SetHeader(key, value string) {
+ cfg.Request.Header.Set(key, value)
+ if strings.EqualFold(key, "Authorization") {
+ cfg.authHeaderOverride = true
+ }
+}
+
+func (cfg *RequestConfig) AddHeader(key, value string) {
+ cfg.Request.Header.Add(key, value)
+ if strings.EqualFold(key, "Authorization") {
+ cfg.authHeaderOverride = true
+ }
+}
+
+func (cfg *RequestConfig) DelHeader(key string) {
+ cfg.Request.Header.Del(key)
+ if strings.EqualFold(key, "Authorization") {
+ cfg.authHeaderOverride = true
+ }
+}
+
+func (cfg *RequestConfig) SetAPIKey(value string) {
+ cfg.APIKey = value
+ cfg.authHeaderOverride = false
+ cfg.authPreference = authCredentialPreferenceBearer
+}
+
+func (cfg *RequestConfig) SetAdminAPIKey(value string) {
+ cfg.AdminAPIKey = value
+ cfg.authHeaderOverride = false
+ cfg.authPreference = authCredentialPreferenceAdmin
+}
+
func (cfg *RequestConfig) Apply(opts ...RequestOption) error {
for _, opt := range opts {
err := opt.Apply(cfg)
@@ -648,3 +826,81 @@ func WithDefaultBaseURL(baseURL string) RequestOption {
return nil
})
}
+
+type Security struct {
+ BearerAuth bool
+ AdminAPIKeyAuth bool
+}
+
+type authCredentialPreference int
+
+const (
+ authCredentialPreferenceNone authCredentialPreference = iota
+ authCredentialPreferenceBearer
+ authCredentialPreferenceAdmin
+)
+
+func WithSecurity(security Security) RequestOption {
+ return RequestOptionFunc(func(r *RequestConfig) error {
+ r.Security = security
+ return nil
+ })
+}
+
+// WithBearerAuthSecurity() should only be used within a method, not provided to at
+// the client-level.
+func WithBearerAuthSecurity() RequestOption {
+ return RequestOptionFunc(func(r *RequestConfig) error {
+ r.Security = Security{
+ BearerAuth: true,
+ AdminAPIKeyAuth: false,
+ }
+ return nil
+ })
+}
+
+// WithAdminAPIKeyAuthSecurity() should only be used within a method, not provided
+// to at the client-level.
+func WithAdminAPIKeyAuthSecurity() RequestOption {
+ return RequestOptionFunc(func(r *RequestConfig) error {
+ r.Security = Security{
+ BearerAuth: false,
+ AdminAPIKeyAuth: true,
+ }
+ return nil
+ })
+}
+
+// WithBearerAuthPreference() should only be used when a request supports multiple
+// auth schemes and has no endpoint-specific security preference.
+func WithBearerAuthPreference() RequestOption {
+ return RequestOptionFunc(func(r *RequestConfig) error {
+ r.authPreference = authCredentialPreferenceBearer
+ return nil
+ })
+}
+
+func ApplySecurity(r RequestConfig) {
+ if r.authHeaderOverride {
+ return
+ }
+
+ if r.authPreference == authCredentialPreferenceBearer && r.Security.BearerAuth && r.APIKey != "" {
+ r.Request.Header.Set("authorization", fmt.Sprintf("Bearer %s", r.APIKey))
+ return
+ }
+
+ if r.authPreference == authCredentialPreferenceAdmin && r.Security.AdminAPIKeyAuth && r.AdminAPIKey != "" {
+ r.Request.Header.Set("authorization", fmt.Sprintf("Bearer %s", r.AdminAPIKey))
+ return
+ }
+
+ if r.Security.AdminAPIKeyAuth && r.AdminAPIKey != "" {
+ r.Request.Header.Set("authorization", fmt.Sprintf("Bearer %s", r.AdminAPIKey))
+ return
+ }
+
+ if r.Security.BearerAuth && r.APIKey != "" {
+ r.Request.Header.Set("authorization", fmt.Sprintf("Bearer %s", r.APIKey))
+ }
+}
diff --git a/vendor/github.com/openai/openai-go/v3/internal/version.go b/vendor/github.com/openai/openai-go/v3/internal/version.go
index 1025b99f9..c612018dd 100644
--- a/vendor/github.com/openai/openai-go/v3/internal/version.go
+++ b/vendor/github.com/openai/openai-go/v3/internal/version.go
@@ -2,4 +2,4 @@
package internal
-const PackageVersion = "3.32.0" // x-release-please-version
+const PackageVersion = "3.45.0" // x-release-please-version
diff --git a/vendor/github.com/openai/openai-go/v3/model.go b/vendor/github.com/openai/openai-go/v3/model.go
index e1ab4a799..46c7a915c 100644
--- a/vendor/github.com/openai/openai-go/v3/model.go
+++ b/vendor/github.com/openai/openai-go/v3/model.go
@@ -5,7 +5,6 @@ package openai
import (
"context"
"errors"
- "fmt"
"net/http"
"slices"
@@ -41,12 +40,13 @@ func NewModelService(opts ...option.RequestOption) (r ModelService) {
// Retrieves a model instance, providing basic information about the model such as
// the owner and permissioning.
func (r *ModelService) Get(ctx context.Context, model string, opts ...option.RequestOption) (res *Model, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if model == "" {
err = errors.New("missing required model parameter")
return nil, err
}
- path := fmt.Sprintf("models/%s", model)
+ path := requestconfig.FormatPath("models/%s", model)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
@@ -55,7 +55,8 @@ func (r *ModelService) Get(ctx context.Context, model string, opts ...option.Req
// one such as the owner and availability.
func (r *ModelService) List(ctx context.Context, opts ...option.RequestOption) (res *pagination.Page[Model], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "models"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...)
@@ -79,12 +80,13 @@ func (r *ModelService) ListAutoPaging(ctx context.Context, opts ...option.Reques
// Delete a fine-tuned model. You must have the Owner role in your organization to
// delete a model.
func (r *ModelService) Delete(ctx context.Context, model string, opts ...option.RequestOption) (res *ModelDeleted, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if model == "" {
err = errors.New("missing required model parameter")
return nil, err
}
- path := fmt.Sprintf("models/%s", model)
+ path := requestconfig.FormatPath("models/%s", model)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
return res, err
}
@@ -94,7 +96,7 @@ type Model struct {
// The model identifier, which can be referenced in the API endpoints.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) when the model was created.
- Created int64 `json:"created" api:"required"`
+ Created int64 `json:"created" api:"required" format:"unixtime"`
// The object type, which is always "model".
Object constant.Model `json:"object" default:"model"`
// The organization that owns the model.
diff --git a/vendor/github.com/openai/openai-go/v3/moderation.go b/vendor/github.com/openai/openai-go/v3/moderation.go
index b5a71dd36..a73365125 100644
--- a/vendor/github.com/openai/openai-go/v3/moderation.go
+++ b/vendor/github.com/openai/openai-go/v3/moderation.go
@@ -40,7 +40,8 @@ func NewModerationService(opts ...option.RequestOption) (r ModerationService) {
// Classifies if text and/or image inputs are potentially harmful. Learn more in
// the [moderation guide](https://platform.openai.com/docs/guides/moderation).
func (r *ModerationService) New(ctx context.Context, body ModerationNewParams, opts ...option.RequestOption) (res *ModerationNewResponse, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "moderations"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
diff --git a/vendor/github.com/openai/openai-go/v3/option/middleware.go b/vendor/github.com/openai/openai-go/v3/option/middleware.go
index 8ec9dd60b..65757596e 100644
--- a/vendor/github.com/openai/openai-go/v3/option/middleware.go
+++ b/vendor/github.com/openai/openai-go/v3/option/middleware.go
@@ -8,6 +8,17 @@ import (
"net/http/httputil"
)
+// sensitiveLogHeaders are redacted before request and response content is
+// written to the debug logger.
+var sensitiveLogHeaders = []string{
+ "authorization",
+ "api-key",
+ "x-api-key",
+ "x-amz-security-token",
+ "cookie",
+ "set-cookie",
+}
+
// WithDebugLog logs the HTTP request and response content.
// If the logger parameter is nil, it uses the default logger.
//
@@ -20,7 +31,7 @@ func WithDebugLog(logger *log.Logger) RequestOption {
logger = log.Default()
}
- if reqBytes, err := httputil.DumpRequest(req, true); err == nil {
+ if reqBytes, err := dumpRedactedRequest(req); err == nil {
logger.Printf("Request Content:\n%s\n", reqBytes)
}
@@ -29,10 +40,48 @@ func WithDebugLog(logger *log.Logger) RequestOption {
return resp, err
}
- if respBytes, err := httputil.DumpResponse(resp, true); err == nil {
+ if respBytes, err := dumpRedactedResponse(resp); err == nil {
logger.Printf("Response Content:\n%s\n", respBytes)
}
return resp, err
})
}
+
+// dumpRedactedRequest dumps req with sensitive headers replaced. The
+// original headers are restored via defer so a panic in DumpRequest cannot
+// leak the placeholder map into the live request sent downstream.
+func dumpRedactedRequest(req *http.Request) ([]byte, error) {
+ origHeaders := req.Header
+ req.Header = redactDebugHeaders(origHeaders)
+ defer func() { req.Header = origHeaders }()
+ return httputil.DumpRequest(req, true)
+}
+
+func dumpRedactedResponse(resp *http.Response) ([]byte, error) {
+ origHeaders := resp.Header
+ resp.Header = redactDebugHeaders(origHeaders)
+ defer func() { resp.Header = origHeaders }()
+ return httputil.DumpResponse(resp, true)
+}
+
+func redactDebugHeaders(headers http.Header) http.Header {
+ var redacted http.Header
+ for _, name := range sensitiveLogHeaders {
+ values := headers.Values(name)
+ if len(values) == 0 {
+ continue
+ }
+ if redacted == nil {
+ redacted = headers.Clone()
+ }
+ redacted.Del(name)
+ for range values {
+ redacted.Add(name, "***")
+ }
+ }
+ if redacted == nil {
+ return headers
+ }
+ return redacted
+}
diff --git a/vendor/github.com/openai/openai-go/v3/option/requestoption.go b/vendor/github.com/openai/openai-go/v3/option/requestoption.go
index bee4622c9..1ce529ace 100644
--- a/vendor/github.com/openai/openai-go/v3/option/requestoption.go
+++ b/vendor/github.com/openai/openai-go/v3/option/requestoption.go
@@ -112,7 +112,7 @@ func WithMaxRetries(retries int) RequestOption {
// any value if there was one already present.
func WithHeader(key, value string) RequestOption {
return requestconfig.RequestOptionFunc(func(r *requestconfig.RequestConfig) error {
- r.Request.Header.Set(key, value)
+ r.SetHeader(key, value)
return nil
})
}
@@ -121,7 +121,7 @@ func WithHeader(key, value string) RequestOption {
// onto any existing values.
func WithHeaderAdd(key, value string) RequestOption {
return requestconfig.RequestOptionFunc(func(r *requestconfig.RequestConfig) error {
- r.Request.Header.Add(key, value)
+ r.AddHeader(key, value)
return nil
})
}
@@ -129,7 +129,7 @@ func WithHeaderAdd(key, value string) RequestOption {
// WithHeaderDel returns a RequestOption that deletes the header value(s) associated with the given key.
func WithHeaderDel(key string) RequestOption {
return requestconfig.RequestOptionFunc(func(r *requestconfig.RequestConfig) error {
- r.Request.Header.Del(key)
+ r.DelHeader(key)
return nil
})
}
@@ -271,8 +271,16 @@ func WithEnvironmentProduction() RequestOption {
// WithAPIKey returns a RequestOption that sets the client setting "api_key".
func WithAPIKey(value string) RequestOption {
return requestconfig.RequestOptionFunc(func(r *requestconfig.RequestConfig) error {
- r.APIKey = value
- return r.Apply(WithHeader("authorization", fmt.Sprintf("Bearer %s", r.APIKey)))
+ r.SetAPIKey(value)
+ return nil
+ })
+}
+
+// WithAdminAPIKey returns a RequestOption that sets the client setting "admin_api_key".
+func WithAdminAPIKey(value string) RequestOption {
+ return requestconfig.RequestOptionFunc(func(r *requestconfig.RequestConfig) error {
+ r.SetAdminAPIKey(value)
+ return nil
})
}
@@ -309,7 +317,7 @@ func WithWorkloadIdentity(config auth.WorkloadIdentity) RequestOption {
var initErr error
return requestconfig.RequestOptionFunc(func(r *requestconfig.RequestConfig) error {
- r.APIKey = ""
+ r.SetAPIKey("")
r.Middlewares = append(r.Middlewares, func(req *http.Request, next func(*http.Request) (*http.Response, error)) (*http.Response, error) {
initOnce.Do(func() {
diff --git a/vendor/github.com/openai/openai-go/v3/packages/pagination/pagination.go b/vendor/github.com/openai/openai-go/v3/packages/pagination/pagination.go
index 302ced16c..14fc9930d 100644
--- a/vendor/github.com/openai/openai-go/v3/packages/pagination/pagination.go
+++ b/vendor/github.com/openai/openai-go/v3/packages/pagination/pagination.go
@@ -327,3 +327,109 @@ func (r *ConversationCursorPageAutoPager[T]) Err() error {
func (r *ConversationCursorPageAutoPager[T]) Index() int {
return r.run
}
+
+type NextCursorPage[T any] struct {
+ Data []T `json:"data"`
+ HasMore bool `json:"has_more"`
+ Next string `json:"next" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Data respjson.Field
+ HasMore respjson.Field
+ Next respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+ cfg *requestconfig.RequestConfig
+ res *http.Response
+}
+
+// Returns the unmodified JSON received from the API
+func (r NextCursorPage[T]) RawJSON() string { return r.JSON.raw }
+func (r *NextCursorPage[T]) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// GetNextPage returns the next page as defined by this pagination style. When
+// there is no next page, this function will return a 'nil' for the page value, but
+// will not return an error
+func (r *NextCursorPage[T]) GetNextPage() (res *NextCursorPage[T], err error) {
+ if len(r.Data) == 0 {
+ return nil, nil
+ }
+
+ if r.JSON.HasMore.Valid() && r.HasMore == false {
+ return nil, nil
+ }
+ next := r.Next
+ if len(next) == 0 {
+ return nil, nil
+ }
+ cfg := r.cfg.Clone(r.cfg.Context)
+ err = cfg.Apply(option.WithQuery("after", next))
+ if err != nil {
+ return nil, err
+ }
+ var raw *http.Response
+ cfg.ResponseInto = &raw
+ cfg.ResponseBodyInto = &res
+ err = cfg.Execute()
+ if err != nil {
+ return nil, err
+ }
+ res.SetPageConfig(cfg, raw)
+ return res, nil
+}
+
+func (r *NextCursorPage[T]) SetPageConfig(cfg *requestconfig.RequestConfig, res *http.Response) {
+ if r == nil {
+ r = &NextCursorPage[T]{}
+ }
+ r.cfg = cfg
+ r.res = res
+}
+
+type NextCursorPageAutoPager[T any] struct {
+ page *NextCursorPage[T]
+ cur T
+ idx int
+ run int
+ err error
+ paramObj
+}
+
+func NewNextCursorPageAutoPager[T any](page *NextCursorPage[T], err error) *NextCursorPageAutoPager[T] {
+ return &NextCursorPageAutoPager[T]{
+ page: page,
+ err: err,
+ }
+}
+
+func (r *NextCursorPageAutoPager[T]) Next() bool {
+ if r.page == nil || len(r.page.Data) == 0 {
+ return false
+ }
+ if r.idx >= len(r.page.Data) {
+ r.idx = 0
+ r.page, r.err = r.page.GetNextPage()
+ if r.err != nil || r.page == nil || len(r.page.Data) == 0 {
+ return false
+ }
+ }
+ r.cur = r.page.Data[r.idx]
+ r.run += 1
+ r.idx += 1
+ return true
+}
+
+func (r *NextCursorPageAutoPager[T]) Current() T {
+ return r.cur
+}
+
+func (r *NextCursorPageAutoPager[T]) Err() error {
+ return r.err
+}
+
+func (r *NextCursorPageAutoPager[T]) Index() int {
+ return r.run
+}
diff --git a/vendor/github.com/openai/openai-go/v3/packages/param/encoder.go b/vendor/github.com/openai/openai-go/v3/packages/param/encoder.go
index c503c967f..f3d489260 100644
--- a/vendor/github.com/openai/openai-go/v3/packages/param/encoder.go
+++ b/vendor/github.com/openai/openai-go/v3/packages/param/encoder.go
@@ -66,7 +66,7 @@ func MarshalWithExtras[T ParamStruct, R any](f T, underlying any, extras map[str
} else if ovr, ok := f.Overrides(); ok {
return shimjson.Marshal(ovr)
} else {
- return shimjson.Marshal(underlying)
+ return shimjson.Marshal(underlying, shimjson.WithSkipCompaction(true))
}
}
@@ -96,7 +96,7 @@ func MarshalUnion[T ParamStruct](metadata T, variants ...any) ([]byte, error) {
Err: fmt.Errorf("expected union to have only one present variant, got %d", nPresent),
}
}
- return shimjson.Marshal(variants[presentIdx])
+ return shimjson.Marshal(variants[presentIdx], shimjson.WithSkipCompaction(true))
}
// typeFor is shimmed from Go 1.23 "reflect" package
diff --git a/vendor/github.com/openai/openai-go/v3/packages/ssestream/ssestream.go b/vendor/github.com/openai/openai-go/v3/packages/ssestream/ssestream.go
index 07e190ce2..773e8345d 100644
--- a/vendor/github.com/openai/openai-go/v3/packages/ssestream/ssestream.go
+++ b/vendor/github.com/openai/openai-go/v3/packages/ssestream/ssestream.go
@@ -82,6 +82,10 @@ func (s *eventStreamDecoder) Next() bool {
// Dispatch event on an empty line
if len(txt) == 0 {
+ if data.Len() == 0 {
+ event = ""
+ continue
+ }
s.evt = Event{
Type: event,
Data: data.Bytes(),
diff --git a/vendor/github.com/openai/openai-go/v3/realtime/aliases.go b/vendor/github.com/openai/openai-go/v3/realtime/aliases.go
index 98c0ca804..894b8d55f 100644
--- a/vendor/github.com/openai/openai-go/v3/realtime/aliases.go
+++ b/vendor/github.com/openai/openai-go/v3/realtime/aliases.go
@@ -64,6 +64,15 @@ const AllModelsGPT5_1CodexMax = shared.AllModelsGPT5_1CodexMax
// This is an alias to an internal type.
type ChatModel = shared.ChatModel
+// Equals "gpt-5.6-sol"
+const ChatModelGPT5_6Sol = shared.ChatModelGPT5_6Sol
+
+// Equals "gpt-5.6-terra"
+const ChatModelGPT5_6Terra = shared.ChatModelGPT5_6Terra
+
+// Equals "gpt-5.6-luna"
+const ChatModelGPT5_6Luna = shared.ChatModelGPT5_6Luna
+
// Equals "gpt-5.4"
const ChatModelGPT5_4 = shared.ChatModelGPT5_4
@@ -465,6 +474,25 @@ const OAuthErrorCodeInvalidSubjectToken = shared.OAuthErrorCodeInvalidSubjectTok
// This is an alias to an internal type.
type Reasoning = shared.Reasoning
+// Controls which reasoning items are rendered back to the model on later turns. If
+// omitted or set to `auto`, the model determines the context mode. The `gpt-5.6`
+// model family defaults to `all_turns`; earlier models default to `current_turn`.
+//
+// When returned on a response, this is the effective reasoning context mode used
+// for the response.
+//
+// This is an alias to an internal type.
+type ReasoningContext = shared.ReasoningContext
+
+// Equals "auto"
+const ReasoningContextAuto = shared.ReasoningContextAuto
+
+// Equals "current_turn"
+const ReasoningContextCurrentTurn = shared.ReasoningContextCurrentTurn
+
+// Equals "all_turns"
+const ReasoningContextAllTurns = shared.ReasoningContextAllTurns
+
// **Deprecated:** use `summary` instead.
//
// A summary of the reasoning performed by the model. This can be useful for
@@ -483,6 +511,19 @@ const ReasoningGenerateSummaryConcise = shared.ReasoningGenerateSummaryConcise
// Equals "detailed"
const ReasoningGenerateSummaryDetailed = shared.ReasoningGenerateSummaryDetailed
+// Controls the reasoning execution mode for the request.
+//
+// When returned on a response, this is the effective execution mode.
+//
+// This is an alias to an internal type.
+type ReasoningMode = shared.ReasoningMode
+
+// Equals "standard"
+const ReasoningModeStandard = shared.ReasoningModeStandard
+
+// Equals "pro"
+const ReasoningModePro = shared.ReasoningModePro
+
// A summary of the reasoning performed by the model. This can be useful for
// debugging and understanding the model's reasoning process. One of `auto`,
// `concise`, or `detailed`.
@@ -510,19 +551,12 @@ const ReasoningSummaryDetailed = shared.ReasoningSummaryDetailed
// This is an alias to an internal type.
type ReasoningParam = shared.ReasoningParam
-// Constrains effort on reasoning for
-// [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
-// supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`.
-// Reducing reasoning effort can result in faster responses and fewer tokens used
-// on reasoning in a response.
-//
-// - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported
-// reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool
-// calls are supported for all reasoning values in gpt-5.1.
-// - All models before `gpt-5.1` default to `medium` reasoning effort, and do not
-// support `none`.
-// - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
-// - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
+// Constrains effort on reasoning for reasoning models. Currently supported values
+// are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. Reducing
+// reasoning effort can result in faster responses and fewer tokens used on
+// reasoning in a response. Not all reasoning models support every value. See the
+// [reasoning guide](https://platform.openai.com/docs/guides/reasoning) for
+// model-specific support.
//
// This is an alias to an internal type.
type ReasoningEffort = shared.ReasoningEffort
@@ -545,6 +579,9 @@ const ReasoningEffortHigh = shared.ReasoningEffortHigh
// Equals "xhigh"
const ReasoningEffortXhigh = shared.ReasoningEffortXhigh
+// Equals "max"
+const ReasoningEffortMax = shared.ReasoningEffortMax
+
// JSON object response format. An older method of generating JSON responses. Using
// `json_schema` is recommended for models that support it. Note that the model
// will not generate JSON without a system or user message instructing it to do so.
diff --git a/vendor/github.com/openai/openai-go/v3/realtime/api.md b/vendor/github.com/openai/openai-go/v3/realtime/api.md
index 61e21f5ca..693276f39 100644
--- a/vendor/github.com/openai/openai-go/v3/realtime/api.md
+++ b/vendor/github.com/openai/openai-go/v3/realtime/api.md
@@ -10,6 +10,8 @@ Params Types:
- realtime.RealtimeAudioFormatsUnionParam
- realtime.RealtimeAudioInputTurnDetectionUnionParam
- realtime.RealtimeFunctionToolParam
+- realtime.RealtimeReasoningParam
+- realtime.RealtimeReasoningEffort
- realtime.RealtimeSessionCreateRequestParam
- realtime.RealtimeToolChoiceConfigUnionParam
- realtime.RealtimeToolsConfigParam
@@ -28,6 +30,8 @@ Response Types:
- realtime.NoiseReductionType
- realtime.RealtimeAudioFormatsUnion
- realtime.RealtimeFunctionTool
+- realtime.RealtimeReasoning
+- realtime.RealtimeReasoningEffort
- realtime.RealtimeTruncationUnion
- realtime.RealtimeTruncationRetentionRatio
@@ -35,7 +39,6 @@ Response Types:
Response Types:
-- realtime.RealtimeSessionClientSecret
- realtime.RealtimeSessionCreateResponse
- realtime.RealtimeTranscriptionSessionCreateResponse
- realtime.RealtimeTranscriptionSessionTurnDetection
diff --git a/vendor/github.com/openai/openai-go/v3/realtime/call.go b/vendor/github.com/openai/openai-go/v3/realtime/call.go
index e261509be..d3f6ea88e 100644
--- a/vendor/github.com/openai/openai-go/v3/realtime/call.go
+++ b/vendor/github.com/openai/openai-go/v3/realtime/call.go
@@ -5,7 +5,6 @@ package realtime
import (
"context"
"errors"
- "fmt"
"net/http"
"slices"
@@ -38,52 +37,56 @@ func NewCallService(opts ...option.RequestOption) (r CallService) {
// Accept an incoming SIP call and configure the realtime session that will handle
// it.
func (r *CallService) Accept(ctx context.Context, callID string, body CallAcceptParams, opts ...option.RequestOption) (err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...)
if callID == "" {
err = errors.New("missing required call_id parameter")
return err
}
- path := fmt.Sprintf("realtime/calls/%s/accept", callID)
+ path := requestconfig.FormatPath("realtime/calls/%s/accept", callID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
return err
}
// End an active Realtime API call, whether it was initiated over SIP or WebRTC.
func (r *CallService) Hangup(ctx context.Context, callID string, opts ...option.RequestOption) (err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...)
if callID == "" {
err = errors.New("missing required call_id parameter")
return err
}
- path := fmt.Sprintf("realtime/calls/%s/hangup", callID)
+ path := requestconfig.FormatPath("realtime/calls/%s/hangup", callID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, nil, opts...)
return err
}
// Transfer an active SIP call to a new destination using the SIP REFER verb.
func (r *CallService) Refer(ctx context.Context, callID string, body CallReferParams, opts ...option.RequestOption) (err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...)
if callID == "" {
err = errors.New("missing required call_id parameter")
return err
}
- path := fmt.Sprintf("realtime/calls/%s/refer", callID)
+ path := requestconfig.FormatPath("realtime/calls/%s/refer", callID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
return err
}
// Decline an incoming SIP call by returning a SIP status code to the caller.
func (r *CallService) Reject(ctx context.Context, callID string, body CallRejectParams, opts ...option.RequestOption) (err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...)
if callID == "" {
err = errors.New("missing required call_id parameter")
return err
}
- path := fmt.Sprintf("realtime/calls/%s/reject", callID)
+ path := requestconfig.FormatPath("realtime/calls/%s/reject", callID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
return err
}
diff --git a/vendor/github.com/openai/openai-go/v3/realtime/clientsecret.go b/vendor/github.com/openai/openai-go/v3/realtime/clientsecret.go
index 79a9fac54..34eee0b52 100644
--- a/vendor/github.com/openai/openai-go/v3/realtime/clientsecret.go
+++ b/vendor/github.com/openai/openai-go/v3/realtime/clientsecret.go
@@ -52,45 +52,25 @@ func NewClientSecretService(opts ...option.RequestOption) (r ClientSecretService
// Returns the created client secret and the effective session object. The client
// secret is a string that looks like `ek_1234`.
func (r *ClientSecretService) New(ctx context.Context, body ClientSecretNewParams, opts ...option.RequestOption) (res *ClientSecretNewResponse, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "realtime/client_secrets"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
-// Ephemeral key returned by the API.
-type RealtimeSessionClientSecret struct {
- // Timestamp for when the token expires. Currently, all tokens expire after one
- // minute.
- ExpiresAt int64 `json:"expires_at" api:"required"`
- // Ephemeral key usable in client environments to authenticate connections to the
- // Realtime API. Use this in client-side environments rather than a standard API
- // token, which should only be used server-side.
- Value string `json:"value" api:"required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ExpiresAt respjson.Field
- Value respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r RealtimeSessionClientSecret) RawJSON() string { return r.JSON.raw }
-func (r *RealtimeSessionClientSecret) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A new Realtime session configuration, with an ephemeral key. Default TTL for
-// keys is one minute.
+// A Realtime session configuration object.
type RealtimeSessionCreateResponse struct {
- // Ephemeral key returned by the API.
- ClientSecret RealtimeSessionClientSecret `json:"client_secret" api:"required"`
+ // Unique identifier for the session that looks like `sess_1234567890abcdef`.
+ ID string `json:"id" api:"required"`
+ // The object type. Always `realtime.session`.
+ Object constant.RealtimeSession `json:"object" default:"realtime.session"`
// The type of session to create. Always `realtime` for the Realtime API.
Type constant.Realtime `json:"type" default:"realtime"`
// Configuration for input and output audio.
Audio RealtimeSessionCreateResponseAudio `json:"audio"`
+ // Expiration timestamp for the session, in seconds since epoch.
+ ExpiresAt int64 `json:"expires_at" format:"unixtime"`
// Additional fields to include in server outputs.
//
// `item.input_audio_transcription.logprobs`: Include logprobs for input audio
@@ -126,6 +106,8 @@ type RealtimeSessionCreateResponse struct {
// Reference to a prompt template and its variables.
// [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
Prompt responses.ResponsePrompt `json:"prompt" api:"nullable"`
+ // Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`.
+ Reasoning RealtimeReasoning `json:"reasoning"`
// How the model chooses tools. Provide one of the string modes or force a specific
// function/MCP tool.
ToolChoice RealtimeSessionCreateResponseToolChoiceUnion `json:"tool_choice"`
@@ -160,15 +142,18 @@ type RealtimeSessionCreateResponse struct {
Truncation RealtimeTruncationUnion `json:"truncation"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- ClientSecret respjson.Field
+ ID respjson.Field
+ Object respjson.Field
Type respjson.Field
Audio respjson.Field
+ ExpiresAt respjson.Field
Include respjson.Field
Instructions respjson.Field
MaxOutputTokens respjson.Field
Model respjson.Field
OutputModalities respjson.Field
Prompt respjson.Field
+ Reasoning respjson.Field
ToolChoice respjson.Field
Tools respjson.Field
Tracing respjson.Field
@@ -212,15 +197,7 @@ type RealtimeSessionCreateResponseAudioInput struct {
// detection accuracy (reducing false positives) and model performance by improving
// perception of the input audio.
NoiseReduction RealtimeSessionCreateResponseAudioInputNoiseReduction `json:"noise_reduction"`
- // Configuration for input audio transcription, defaults to off and can be set to
- // `null` to turn off once on. Input audio transcription is not native to the
- // model, since the model consumes audio directly. Transcription runs
- // asynchronously through
- // [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription)
- // and should be treated as guidance of input audio content rather than precisely
- // what the model heard. The client can optionally set the language and prompt for
- // transcription, these offer additional guidance to the transcription service.
- Transcription AudioTranscription `json:"transcription"`
+ Transcription AudioTranscription `json:"transcription"`
// Configuration for turn detection, ether Server VAD or Semantic VAD. This can be
// set to `null` to turn off, in which case the client must manually trigger model
// response.
@@ -234,6 +211,9 @@ type RealtimeSessionCreateResponseAudioInput struct {
// trails off with "uhhm", the model will score a low probability of turn end and
// wait longer for the user to continue speaking. This can be useful for more
// natural conversations, but may have a higher latency.
+ //
+ // For `gpt-realtime-whisper` transcription sessions, turn detection must be set to
+ // `null`; VAD is not supported.
TurnDetection RealtimeSessionCreateResponseAudioInputTurnDetectionUnion `json:"turn_detection" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
@@ -549,6 +529,9 @@ type RealtimeSessionCreateResponseModel string
const (
RealtimeSessionCreateResponseModelGPTRealtime RealtimeSessionCreateResponseModel = "gpt-realtime"
RealtimeSessionCreateResponseModelGPTRealtime1_5 RealtimeSessionCreateResponseModel = "gpt-realtime-1.5"
+ RealtimeSessionCreateResponseModelGPTRealtime2 RealtimeSessionCreateResponseModel = "gpt-realtime-2"
+ RealtimeSessionCreateResponseModelGPTRealtime2_1 RealtimeSessionCreateResponseModel = "gpt-realtime-2.1"
+ RealtimeSessionCreateResponseModelGPTRealtime2_1Mini RealtimeSessionCreateResponseModel = "gpt-realtime-2.1-mini"
RealtimeSessionCreateResponseModelGPTRealtime2025_08_28 RealtimeSessionCreateResponseModel = "gpt-realtime-2025-08-28"
RealtimeSessionCreateResponseModelGPT4oRealtimePreview RealtimeSessionCreateResponseModel = "gpt-4o-realtime-preview"
RealtimeSessionCreateResponseModelGPT4oRealtimePreview2024_10_01 RealtimeSessionCreateResponseModel = "gpt-4o-realtime-preview-2024-10-01"
@@ -627,6 +610,8 @@ type RealtimeSessionCreateResponseToolUnion struct {
// This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
ServerLabel string `json:"server_label"`
// This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
+ AllowedCallers []string `json:"allowed_callers"`
+ // This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
AllowedTools RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion `json:"allowed_tools"`
// This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
Authorization string `json:"authorization"`
@@ -642,12 +627,15 @@ type RealtimeSessionCreateResponseToolUnion struct {
ServerDescription string `json:"server_description"`
// This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
ServerURL string `json:"server_url"`
- JSON struct {
+ // This field is from variant [RealtimeSessionCreateResponseToolMcpTool].
+ TunnelID string `json:"tunnel_id"`
+ JSON struct {
Description respjson.Field
Name respjson.Field
Parameters respjson.Field
Type respjson.Field
ServerLabel respjson.Field
+ AllowedCallers respjson.Field
AllowedTools respjson.Field
Authorization respjson.Field
ConnectorID respjson.Field
@@ -656,6 +644,7 @@ type RealtimeSessionCreateResponseToolUnion struct {
RequireApproval respjson.Field
ServerDescription respjson.Field
ServerURL respjson.Field
+ TunnelID respjson.Field
raw string
} `json:"-"`
}
@@ -685,6 +674,10 @@ type RealtimeSessionCreateResponseToolMcpTool struct {
ServerLabel string `json:"server_label" api:"required"`
// The type of the MCP tool. Always `mcp`.
Type constant.Mcp `json:"type" default:"mcp"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers" api:"nullable"`
// List of allowed tool names or a filter object.
AllowedTools RealtimeSessionCreateResponseToolMcpToolAllowedToolsUnion `json:"allowed_tools" api:"nullable"`
// An OAuth access token that can be used with a remote MCP server, either with a
@@ -692,8 +685,8 @@ type RealtimeSessionCreateResponseToolMcpTool struct {
// OAuth authorization flow and provide the token here.
Authorization string `json:"authorization"`
// Identifier for service connectors, like those available in ChatGPT. One of
- // `server_url` or `connector_id` must be provided. Learn more about service
- // connectors
+ // `server_url`, `connector_id`, or `tunnel_id` must be provided. Learn more about
+ // service connectors
// [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
//
// Currently supported `connector_id` values are:
@@ -720,13 +713,17 @@ type RealtimeSessionCreateResponseToolMcpTool struct {
RequireApproval RealtimeSessionCreateResponseToolMcpToolRequireApprovalUnion `json:"require_approval" api:"nullable"`
// Optional description of the MCP server, used to provide more context.
ServerDescription string `json:"server_description"`
- // The URL for the MCP server. One of `server_url` or `connector_id` must be
- // provided.
- ServerURL string `json:"server_url"`
+ // The URL for the MCP server. One of `server_url`, `connector_id`, or `tunnel_id`
+ // must be provided.
+ ServerURL string `json:"server_url" format:"uri"`
+ // The Secure MCP Tunnel ID to use instead of a direct server URL. One of
+ // `server_url`, `connector_id`, or `tunnel_id` must be provided.
+ TunnelID string `json:"tunnel_id"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ServerLabel respjson.Field
Type respjson.Field
+ AllowedCallers respjson.Field
AllowedTools respjson.Field
Authorization respjson.Field
ConnectorID respjson.Field
@@ -735,6 +732,7 @@ type RealtimeSessionCreateResponseToolMcpTool struct {
RequireApproval respjson.Field
ServerDescription respjson.Field
ServerURL respjson.Field
+ TunnelID respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
@@ -1032,7 +1030,7 @@ type RealtimeTranscriptionSessionCreateResponse struct {
// Configuration for input audio for the session.
Audio RealtimeTranscriptionSessionCreateResponseAudio `json:"audio"`
// Expiration timestamp for the session, in seconds since epoch.
- ExpiresAt int64 `json:"expires_at"`
+ ExpiresAt int64 `json:"expires_at" format:"unixtime"`
// Additional fields to include in server outputs.
//
// - `item.input_audio_transcription.logprobs`: Include logprobs for input audio
@@ -1081,12 +1079,12 @@ type RealtimeTranscriptionSessionCreateResponseAudioInput struct {
Format RealtimeAudioFormatsUnion `json:"format"`
// Configuration for input audio noise reduction.
NoiseReduction RealtimeTranscriptionSessionCreateResponseAudioInputNoiseReduction `json:"noise_reduction"`
- // Configuration of the transcription model.
- Transcription AudioTranscription `json:"transcription"`
+ Transcription AudioTranscription `json:"transcription"`
// Configuration for turn detection. Can be set to `null` to turn off. Server VAD
// means that the model will detect the start and end of speech based on audio
- // volume and respond at the end of user speech.
- TurnDetection RealtimeTranscriptionSessionTurnDetection `json:"turn_detection"`
+ // volume and respond at the end of user speech. For `gpt-realtime-whisper`, this
+ // must be `null`; VAD is not supported.
+ TurnDetection RealtimeTranscriptionSessionTurnDetection `json:"turn_detection" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Format respjson.Field
@@ -1130,7 +1128,8 @@ func (r *RealtimeTranscriptionSessionCreateResponseAudioInputNoiseReduction) Unm
// Configuration for turn detection. Can be set to `null` to turn off. Server VAD
// means that the model will detect the start and end of speech based on audio
-// volume and respond at the end of user speech.
+// volume and respond at the end of user speech. For `gpt-realtime-whisper`, this
+// must be `null`; VAD is not supported.
type RealtimeTranscriptionSessionTurnDetection struct {
// Amount of audio to include before the VAD detected speech (in milliseconds).
// Defaults to 300ms.
@@ -1165,7 +1164,7 @@ func (r *RealtimeTranscriptionSessionTurnDetection) UnmarshalJSON(data []byte) e
// Response from creating a session and client secret for the Realtime API.
type ClientSecretNewResponse struct {
// Expiration timestamp for the client secret, in seconds since epoch.
- ExpiresAt int64 `json:"expires_at" api:"required"`
+ ExpiresAt int64 `json:"expires_at" api:"required" format:"unixtime"`
// The session configuration for either a realtime or transcription session.
Session ClientSecretNewResponseSessionUnion `json:"session" api:"required"`
// The generated client secret value.
@@ -1195,14 +1194,15 @@ func (r *ClientSecretNewResponse) UnmarshalJSON(data []byte) error {
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
type ClientSecretNewResponseSessionUnion struct {
- // This field is from variant [RealtimeSessionCreateResponse].
- ClientSecret RealtimeSessionClientSecret `json:"client_secret"`
+ ID string `json:"id"`
+ Object string `json:"object"`
// Any of "realtime", "transcription".
Type string `json:"type"`
// This field is a union of [RealtimeSessionCreateResponseAudio],
// [RealtimeTranscriptionSessionCreateResponseAudio]
- Audio ClientSecretNewResponseSessionUnionAudio `json:"audio"`
- Include []string `json:"include"`
+ Audio ClientSecretNewResponseSessionUnionAudio `json:"audio"`
+ ExpiresAt int64 `json:"expires_at"`
+ Include []string `json:"include"`
// This field is from variant [RealtimeSessionCreateResponse].
Instructions string `json:"instructions"`
// This field is from variant [RealtimeSessionCreateResponse].
@@ -1214,6 +1214,8 @@ type ClientSecretNewResponseSessionUnion struct {
// This field is from variant [RealtimeSessionCreateResponse].
Prompt responses.ResponsePrompt `json:"prompt"`
// This field is from variant [RealtimeSessionCreateResponse].
+ Reasoning RealtimeReasoning `json:"reasoning"`
+ // This field is from variant [RealtimeSessionCreateResponse].
ToolChoice RealtimeSessionCreateResponseToolChoiceUnion `json:"tool_choice"`
// This field is from variant [RealtimeSessionCreateResponse].
Tools []RealtimeSessionCreateResponseToolUnion `json:"tools"`
@@ -1221,29 +1223,23 @@ type ClientSecretNewResponseSessionUnion struct {
Tracing RealtimeSessionCreateResponseTracingUnion `json:"tracing"`
// This field is from variant [RealtimeSessionCreateResponse].
Truncation RealtimeTruncationUnion `json:"truncation"`
- // This field is from variant [RealtimeTranscriptionSessionCreateResponse].
- ID string `json:"id"`
- // This field is from variant [RealtimeTranscriptionSessionCreateResponse].
- Object string `json:"object"`
- // This field is from variant [RealtimeTranscriptionSessionCreateResponse].
- ExpiresAt int64 `json:"expires_at"`
- JSON struct {
- ClientSecret respjson.Field
+ JSON struct {
+ ID respjson.Field
+ Object respjson.Field
Type respjson.Field
Audio respjson.Field
+ ExpiresAt respjson.Field
Include respjson.Field
Instructions respjson.Field
MaxOutputTokens respjson.Field
Model respjson.Field
OutputModalities respjson.Field
Prompt respjson.Field
+ Reasoning respjson.Field
ToolChoice respjson.Field
Tools respjson.Field
Tracing respjson.Field
Truncation respjson.Field
- ID respjson.Field
- Object respjson.Field
- ExpiresAt respjson.Field
raw string
} `json:"-"`
}
@@ -1516,6 +1512,14 @@ func (u ClientSecretNewParamsSessionUnion) GetOutputModalities() []string {
return nil
}
+// Returns a pointer to the underlying variant's property, if present.
+func (u ClientSecretNewParamsSessionUnion) GetParallelToolCalls() *bool {
+ if vt := u.OfRealtime; vt != nil && vt.ParallelToolCalls.Valid() {
+ return &vt.ParallelToolCalls.Value
+ }
+ return nil
+}
+
// Returns a pointer to the underlying variant's property, if present.
func (u ClientSecretNewParamsSessionUnion) GetPrompt() *responses.ResponsePromptParam {
if vt := u.OfRealtime; vt != nil {
@@ -1524,6 +1528,14 @@ func (u ClientSecretNewParamsSessionUnion) GetPrompt() *responses.ResponsePrompt
return nil
}
+// Returns a pointer to the underlying variant's property, if present.
+func (u ClientSecretNewParamsSessionUnion) GetReasoning() *RealtimeReasoningParam {
+ if vt := u.OfRealtime; vt != nil {
+ return &vt.Reasoning
+ }
+ return nil
+}
+
// Returns a pointer to the underlying variant's property, if present.
func (u ClientSecretNewParamsSessionUnion) GetToolChoice() *RealtimeToolChoiceConfigUnionParam {
if vt := u.OfRealtime; vt != nil {
diff --git a/vendor/github.com/openai/openai-go/v3/realtime/realtime.go b/vendor/github.com/openai/openai-go/v3/realtime/realtime.go
index b904ace3f..7f76b249d 100644
--- a/vendor/github.com/openai/openai-go/v3/realtime/realtime.go
+++ b/vendor/github.com/openai/openai-go/v3/realtime/realtime.go
@@ -37,23 +37,31 @@ func NewRealtimeService(opts ...option.RequestOption) (r RealtimeService) {
}
type AudioTranscription struct {
+ // Controls how long the model waits before emitting transcription text. Higher
+ // values can improve transcription accuracy at the cost of latency. Only supported
+ // with `gpt-realtime-whisper` in GA Realtime sessions.
+ //
+ // Any of "minimal", "low", "medium", "high", "xhigh".
+ Delay AudioTranscriptionDelay `json:"delay"`
// The language of the input audio. Supplying the input language in
// [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
// format will improve accuracy and latency.
Language string `json:"language"`
// The model to use for transcription. Current options are `whisper-1`,
// `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`,
- // `gpt-4o-transcribe`, and `gpt-4o-transcribe-diarize`. Use
- // `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.
+ // `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`.
+ // Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.
Model AudioTranscriptionModel `json:"model"`
// An optional text to guide the model's style or continue a previous audio
// segment. For `whisper-1`, the
// [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting).
// For `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the
// prompt is a free text string, for example "expect words related to technology".
+ // Prompt is not supported with `gpt-realtime-whisper` in GA Realtime sessions.
Prompt string `json:"prompt"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
+ Delay respjson.Field
Language respjson.Field
Model respjson.Field
Prompt respjson.Field
@@ -77,10 +85,23 @@ func (r AudioTranscription) ToParam() AudioTranscriptionParam {
return param.Override[AudioTranscriptionParam](json.RawMessage(r.RawJSON()))
}
+// Controls how long the model waits before emitting transcription text. Higher
+// values can improve transcription accuracy at the cost of latency. Only supported
+// with `gpt-realtime-whisper` in GA Realtime sessions.
+type AudioTranscriptionDelay string
+
+const (
+ AudioTranscriptionDelayMinimal AudioTranscriptionDelay = "minimal"
+ AudioTranscriptionDelayLow AudioTranscriptionDelay = "low"
+ AudioTranscriptionDelayMedium AudioTranscriptionDelay = "medium"
+ AudioTranscriptionDelayHigh AudioTranscriptionDelay = "high"
+ AudioTranscriptionDelayXhigh AudioTranscriptionDelay = "xhigh"
+)
+
// The model to use for transcription. Current options are `whisper-1`,
// `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`,
-// `gpt-4o-transcribe`, and `gpt-4o-transcribe-diarize`. Use
-// `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.
+// `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`.
+// Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.
type AudioTranscriptionModel string
const (
@@ -89,6 +110,7 @@ const (
AudioTranscriptionModelGPT4oMiniTranscribe2025_12_15 AudioTranscriptionModel = "gpt-4o-mini-transcribe-2025-12-15"
AudioTranscriptionModelGPT4oTranscribe AudioTranscriptionModel = "gpt-4o-transcribe"
AudioTranscriptionModelGPT4oTranscribeDiarize AudioTranscriptionModel = "gpt-4o-transcribe-diarize"
+ AudioTranscriptionModelGPTRealtimeWhisper AudioTranscriptionModel = "gpt-realtime-whisper"
)
type AudioTranscriptionParam struct {
@@ -101,11 +123,18 @@ type AudioTranscriptionParam struct {
// [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting).
// For `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the
// prompt is a free text string, for example "expect words related to technology".
+ // Prompt is not supported with `gpt-realtime-whisper` in GA Realtime sessions.
Prompt param.Opt[string] `json:"prompt,omitzero"`
+ // Controls how long the model waits before emitting transcription text. Higher
+ // values can improve transcription accuracy at the cost of latency. Only supported
+ // with `gpt-realtime-whisper` in GA Realtime sessions.
+ //
+ // Any of "minimal", "low", "medium", "high", "xhigh".
+ Delay AudioTranscriptionDelay `json:"delay,omitzero"`
// The model to use for transcription. Current options are `whisper-1`,
// `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`,
- // `gpt-4o-transcribe`, and `gpt-4o-transcribe-diarize`. Use
- // `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.
+ // `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`.
+ // Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.
Model AudioTranscriptionModel `json:"model,omitzero"`
paramObj
}
@@ -157,6 +186,9 @@ type RealtimeAudioConfigInputParam struct {
// trails off with "uhhm", the model will score a low probability of turn end and
// wait longer for the user to continue speaking. This can be useful for more
// natural conversations, but may have a higher latency.
+ //
+ // For `gpt-realtime-whisper` transcription sessions, turn detection must be set to
+ // `null`; VAD is not supported.
TurnDetection RealtimeAudioInputTurnDetectionUnionParam `json:"turn_detection,omitzero"`
// The format of the input audio.
Format RealtimeAudioFormatsUnionParam `json:"format,omitzero"`
@@ -851,6 +883,66 @@ func (r *RealtimeFunctionToolParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`.
+type RealtimeReasoning struct {
+ // Constrains effort on reasoning for reasoning-capable Realtime models such as
+ // `gpt-realtime-2`.
+ //
+ // Any of "minimal", "low", "medium", "high", "xhigh".
+ Effort RealtimeReasoningEffort `json:"effort"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Effort respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r RealtimeReasoning) RawJSON() string { return r.JSON.raw }
+func (r *RealtimeReasoning) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this RealtimeReasoning to a RealtimeReasoningParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// RealtimeReasoningParam.Overrides()
+func (r RealtimeReasoning) ToParam() RealtimeReasoningParam {
+ return param.Override[RealtimeReasoningParam](json.RawMessage(r.RawJSON()))
+}
+
+// Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`.
+type RealtimeReasoningParam struct {
+ // Constrains effort on reasoning for reasoning-capable Realtime models such as
+ // `gpt-realtime-2`.
+ //
+ // Any of "minimal", "low", "medium", "high", "xhigh".
+ Effort RealtimeReasoningEffort `json:"effort,omitzero"`
+ paramObj
+}
+
+func (r RealtimeReasoningParam) MarshalJSON() (data []byte, err error) {
+ type shadow RealtimeReasoningParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *RealtimeReasoningParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Constrains effort on reasoning for reasoning-capable Realtime models such as
+// `gpt-realtime-2`.
+type RealtimeReasoningEffort string
+
+const (
+ RealtimeReasoningEffortMinimal RealtimeReasoningEffort = "minimal"
+ RealtimeReasoningEffortLow RealtimeReasoningEffort = "low"
+ RealtimeReasoningEffortMedium RealtimeReasoningEffort = "medium"
+ RealtimeReasoningEffortHigh RealtimeReasoningEffort = "high"
+ RealtimeReasoningEffortXhigh RealtimeReasoningEffort = "xhigh"
+)
+
// Realtime session object configuration.
//
// The property Type is required.
@@ -867,6 +959,9 @@ type RealtimeSessionCreateRequestParam struct {
// is not set and are visible in the `session.created` event at the start of the
// session.
Instructions param.Opt[string] `json:"instructions,omitzero"`
+ // Whether the model may call multiple tools in parallel. Only supported by
+ // reasoning Realtime models such as `gpt-realtime-2`.
+ ParallelToolCalls param.Opt[bool] `json:"parallel_tool_calls,omitzero"`
// Reference to a prompt template and its variables.
// [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
Prompt responses.ResponsePromptParam `json:"prompt,omitzero"`
@@ -900,6 +995,8 @@ type RealtimeSessionCreateRequestParam struct {
//
// Any of "text", "audio".
OutputModalities []string `json:"output_modalities,omitzero"`
+ // Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`.
+ Reasoning RealtimeReasoningParam `json:"reasoning,omitzero"`
// How the model chooses tools. Provide one of the string modes or force a specific
// function/MCP tool.
ToolChoice RealtimeToolChoiceConfigUnionParam `json:"tool_choice,omitzero"`
@@ -971,6 +1068,9 @@ type RealtimeSessionCreateRequestModel = string
const (
RealtimeSessionCreateRequestModelGPTRealtime RealtimeSessionCreateRequestModel = "gpt-realtime"
RealtimeSessionCreateRequestModelGPTRealtime1_5 RealtimeSessionCreateRequestModel = "gpt-realtime-1.5"
+ RealtimeSessionCreateRequestModelGPTRealtime2 RealtimeSessionCreateRequestModel = "gpt-realtime-2"
+ RealtimeSessionCreateRequestModelGPTRealtime2_1 RealtimeSessionCreateRequestModel = "gpt-realtime-2.1"
+ RealtimeSessionCreateRequestModelGPTRealtime2_1Mini RealtimeSessionCreateRequestModel = "gpt-realtime-2.1-mini"
RealtimeSessionCreateRequestModelGPTRealtime2025_08_28 RealtimeSessionCreateRequestModel = "gpt-realtime-2025-08-28"
RealtimeSessionCreateRequestModelGPT4oRealtimePreview RealtimeSessionCreateRequestModel = "gpt-4o-realtime-preview"
RealtimeSessionCreateRequestModelGPT4oRealtimePreview2024_10_01 RealtimeSessionCreateRequestModel = "gpt-4o-realtime-preview-2024-10-01"
@@ -1121,6 +1221,14 @@ func (u RealtimeToolsConfigUnionParam) GetServerLabel() *string {
return nil
}
+// Returns a pointer to the underlying variant's property, if present.
+func (u RealtimeToolsConfigUnionParam) GetAllowedCallers() []string {
+ if vt := u.OfMcp; vt != nil {
+ return vt.AllowedCallers
+ }
+ return nil
+}
+
// Returns a pointer to the underlying variant's property, if present.
func (u RealtimeToolsConfigUnionParam) GetAllowedTools() *RealtimeToolsConfigUnionMcpAllowedToolsParam {
if vt := u.OfMcp; vt != nil {
@@ -1185,6 +1293,14 @@ func (u RealtimeToolsConfigUnionParam) GetServerURL() *string {
return nil
}
+// Returns a pointer to the underlying variant's property, if present.
+func (u RealtimeToolsConfigUnionParam) GetTunnelID() *string {
+ if vt := u.OfMcp; vt != nil && vt.TunnelID.Valid() {
+ return &vt.TunnelID.Value
+ }
+ return nil
+}
+
// Returns a pointer to the underlying variant's property, if present.
func (u RealtimeToolsConfigUnionParam) GetType() *string {
if vt := u.OfFunction; vt != nil {
@@ -1219,9 +1335,16 @@ type RealtimeToolsConfigUnionMcpParam struct {
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// Optional description of the MCP server, used to provide more context.
ServerDescription param.Opt[string] `json:"server_description,omitzero"`
- // The URL for the MCP server. One of `server_url` or `connector_id` must be
- // provided.
- ServerURL param.Opt[string] `json:"server_url,omitzero"`
+ // The URL for the MCP server. One of `server_url`, `connector_id`, or `tunnel_id`
+ // must be provided.
+ ServerURL param.Opt[string] `json:"server_url,omitzero" format:"uri"`
+ // The Secure MCP Tunnel ID to use instead of a direct server URL. One of
+ // `server_url`, `connector_id`, or `tunnel_id` must be provided.
+ TunnelID param.Opt[string] `json:"tunnel_id,omitzero"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers,omitzero"`
// List of allowed tool names or a filter object.
AllowedTools RealtimeToolsConfigUnionMcpAllowedToolsParam `json:"allowed_tools,omitzero"`
// Optional HTTP headers to send to the MCP server. Use for authentication or other
@@ -1230,8 +1353,8 @@ type RealtimeToolsConfigUnionMcpParam struct {
// Specify which of the MCP server's tools require approval.
RequireApproval RealtimeToolsConfigUnionMcpRequireApprovalParam `json:"require_approval,omitzero"`
// Identifier for service connectors, like those available in ChatGPT. One of
- // `server_url` or `connector_id` must be provided. Learn more about service
- // connectors
+ // `server_url`, `connector_id`, or `tunnel_id` must be provided. Learn more about
+ // service connectors
// [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
//
// Currently supported `connector_id` values are:
@@ -1490,6 +1613,9 @@ type RealtimeTranscriptionSessionAudioInputParam struct {
// trails off with "uhhm", the model will score a low probability of turn end and
// wait longer for the user to continue speaking. This can be useful for more
// natural conversations, but may have a higher latency.
+ //
+ // For `gpt-realtime-whisper` transcription sessions, turn detection must be set to
+ // `null`; VAD is not supported.
TurnDetection RealtimeTranscriptionSessionAudioInputTurnDetectionUnionParam `json:"turn_detection,omitzero"`
// The PCM audio format. Only a 24kHz sample rate is supported.
Format RealtimeAudioFormatsUnionParam `json:"format,omitzero"`
diff --git a/vendor/github.com/openai/openai-go/v3/responses/aliases.go b/vendor/github.com/openai/openai-go/v3/responses/aliases.go
index eae852236..4f70078e0 100644
--- a/vendor/github.com/openai/openai-go/v3/responses/aliases.go
+++ b/vendor/github.com/openai/openai-go/v3/responses/aliases.go
@@ -64,6 +64,15 @@ const AllModelsGPT5_1CodexMax = shared.AllModelsGPT5_1CodexMax
// This is an alias to an internal type.
type ChatModel = shared.ChatModel
+// Equals "gpt-5.6-sol"
+const ChatModelGPT5_6Sol = shared.ChatModelGPT5_6Sol
+
+// Equals "gpt-5.6-terra"
+const ChatModelGPT5_6Terra = shared.ChatModelGPT5_6Terra
+
+// Equals "gpt-5.6-luna"
+const ChatModelGPT5_6Luna = shared.ChatModelGPT5_6Luna
+
// Equals "gpt-5.4"
const ChatModelGPT5_4 = shared.ChatModelGPT5_4
@@ -465,6 +474,25 @@ const OAuthErrorCodeInvalidSubjectToken = shared.OAuthErrorCodeInvalidSubjectTok
// This is an alias to an internal type.
type Reasoning = shared.Reasoning
+// Controls which reasoning items are rendered back to the model on later turns. If
+// omitted or set to `auto`, the model determines the context mode. The `gpt-5.6`
+// model family defaults to `all_turns`; earlier models default to `current_turn`.
+//
+// When returned on a response, this is the effective reasoning context mode used
+// for the response.
+//
+// This is an alias to an internal type.
+type ReasoningContext = shared.ReasoningContext
+
+// Equals "auto"
+const ReasoningContextAuto = shared.ReasoningContextAuto
+
+// Equals "current_turn"
+const ReasoningContextCurrentTurn = shared.ReasoningContextCurrentTurn
+
+// Equals "all_turns"
+const ReasoningContextAllTurns = shared.ReasoningContextAllTurns
+
// **Deprecated:** use `summary` instead.
//
// A summary of the reasoning performed by the model. This can be useful for
@@ -483,6 +511,19 @@ const ReasoningGenerateSummaryConcise = shared.ReasoningGenerateSummaryConcise
// Equals "detailed"
const ReasoningGenerateSummaryDetailed = shared.ReasoningGenerateSummaryDetailed
+// Controls the reasoning execution mode for the request.
+//
+// When returned on a response, this is the effective execution mode.
+//
+// This is an alias to an internal type.
+type ReasoningMode = shared.ReasoningMode
+
+// Equals "standard"
+const ReasoningModeStandard = shared.ReasoningModeStandard
+
+// Equals "pro"
+const ReasoningModePro = shared.ReasoningModePro
+
// A summary of the reasoning performed by the model. This can be useful for
// debugging and understanding the model's reasoning process. One of `auto`,
// `concise`, or `detailed`.
@@ -510,19 +551,12 @@ const ReasoningSummaryDetailed = shared.ReasoningSummaryDetailed
// This is an alias to an internal type.
type ReasoningParam = shared.ReasoningParam
-// Constrains effort on reasoning for
-// [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
-// supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`.
-// Reducing reasoning effort can result in faster responses and fewer tokens used
-// on reasoning in a response.
-//
-// - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported
-// reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool
-// calls are supported for all reasoning values in gpt-5.1.
-// - All models before `gpt-5.1` default to `medium` reasoning effort, and do not
-// support `none`.
-// - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
-// - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
+// Constrains effort on reasoning for reasoning models. Currently supported values
+// are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. Reducing
+// reasoning effort can result in faster responses and fewer tokens used on
+// reasoning in a response. Not all reasoning models support every value. See the
+// [reasoning guide](https://platform.openai.com/docs/guides/reasoning) for
+// model-specific support.
//
// This is an alias to an internal type.
type ReasoningEffort = shared.ReasoningEffort
@@ -545,6 +579,9 @@ const ReasoningEffortHigh = shared.ReasoningEffortHigh
// Equals "xhigh"
const ReasoningEffortXhigh = shared.ReasoningEffortXhigh
+// Equals "max"
+const ReasoningEffortMax = shared.ReasoningEffortMax
+
// JSON object response format. An older method of generating JSON responses. Using
// `json_schema` is recommended for models that support it. Note that the model
// will not generate JSON without a system or user message instructing it to do so.
diff --git a/vendor/github.com/openai/openai-go/v3/responses/inputitem.go b/vendor/github.com/openai/openai-go/v3/responses/inputitem.go
index 3926a30f4..d8f803e39 100644
--- a/vendor/github.com/openai/openai-go/v3/responses/inputitem.go
+++ b/vendor/github.com/openai/openai-go/v3/responses/inputitem.go
@@ -5,7 +5,6 @@ package responses
import (
"context"
"errors"
- "fmt"
"net/http"
"net/url"
"slices"
@@ -42,13 +41,14 @@ func NewInputItemService(opts ...option.RequestOption) (r InputItemService) {
// Returns a list of input items for a given response.
func (r *InputItemService) List(ctx context.Context, responseID string, query InputItemListParams, opts ...option.RequestOption) (res *pagination.CursorPage[ResponseItemUnion], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
if responseID == "" {
err = errors.New("missing required response_id parameter")
return nil, err
}
- path := fmt.Sprintf("responses/%s/input_items", responseID)
+ path := requestconfig.FormatPath("responses/%s/input_items", responseID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
diff --git a/vendor/github.com/openai/openai-go/v3/responses/inputtoken.go b/vendor/github.com/openai/openai-go/v3/responses/inputtoken.go
index 7d86241d9..7dee27214 100644
--- a/vendor/github.com/openai/openai-go/v3/responses/inputtoken.go
+++ b/vendor/github.com/openai/openai-go/v3/responses/inputtoken.go
@@ -40,7 +40,8 @@ func NewInputTokenService(opts ...option.RequestOption) (r InputTokenService) {
// Returns an object with `object` set to `response.input_tokens` and an
// `input_tokens` count.
func (r *InputTokenService) Count(ctx context.Context, body InputTokenCountParams, opts ...option.RequestOption) (res *InputTokenCountResponse, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "responses/input_tokens"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -101,6 +102,10 @@ type InputTokenCountParams struct {
// An array of tools the model may call while generating a response. You can
// specify which tool to use by setting the `tool_choice` parameter.
Tools []ToolUnionParam `json:"tools,omitzero"`
+ // A model-owned style preset to apply to this request. Omit this parameter to use
+ // the model's default style. Supported values may expand over time. Values must be
+ // at most 64 characters.
+ Personality InputTokenCountParamsPersonality `json:"personality,omitzero"`
// **gpt-5 and o-series models only** Configuration options for
// [reasoning models](https://platform.openai.com/docs/guides/reasoning).
Reasoning shared.ReasoningParam `json:"reasoning,omitzero"`
@@ -173,6 +178,16 @@ func (u *InputTokenCountParamsInputUnion) asAny() any {
return nil
}
+// A model-owned style preset to apply to this request. Omit this parameter to use
+// the model's default style. Supported values may expand over time. Values must be
+// at most 64 characters.
+type InputTokenCountParamsPersonality string
+
+const (
+ InputTokenCountParamsPersonalityFriendly InputTokenCountParamsPersonality = "friendly"
+ InputTokenCountParamsPersonalityPragmatic InputTokenCountParamsPersonality = "pragmatic"
+)
+
// Configuration options for a text response from the model. Can be plain text or
// structured JSON data. Learn more:
//
@@ -181,7 +196,8 @@ func (u *InputTokenCountParamsInputUnion) asAny() any {
type InputTokenCountParamsText struct {
// Constrains the verbosity of the model's response. Lower values will result in
// more concise responses, while higher values will result in more verbose
- // responses. Currently supported values are `low`, `medium`, and `high`.
+ // responses. Currently supported values are `low`, `medium`, and `high`. The
+ // default is `medium`.
//
// Any of "low", "medium", "high".
Verbosity string `json:"verbosity,omitzero"`
@@ -221,14 +237,15 @@ func init() {
// Use [param.IsOmitted] to confirm if a field is set.
type InputTokenCountParamsToolChoiceUnion struct {
// Check if union is this variant with !param.IsOmitted(union.OfToolChoiceMode)
- OfToolChoiceMode param.Opt[ToolChoiceOptions] `json:",omitzero,inline"`
- OfAllowedTools *ToolChoiceAllowedParam `json:",omitzero,inline"`
- OfHostedTool *ToolChoiceTypesParam `json:",omitzero,inline"`
- OfFunctionTool *ToolChoiceFunctionParam `json:",omitzero,inline"`
- OfMcpTool *ToolChoiceMcpParam `json:",omitzero,inline"`
- OfCustomTool *ToolChoiceCustomParam `json:",omitzero,inline"`
- OfSpecificApplyPatchToolChoice *ToolChoiceApplyPatchParam `json:",omitzero,inline"`
- OfSpecificShellToolChoice *ToolChoiceShellParam `json:",omitzero,inline"`
+ OfToolChoiceMode param.Opt[ToolChoiceOptions] `json:",omitzero,inline"`
+ OfAllowedTools *ToolChoiceAllowedParam `json:",omitzero,inline"`
+ OfHostedTool *ToolChoiceTypesParam `json:",omitzero,inline"`
+ OfFunctionTool *ToolChoiceFunctionParam `json:",omitzero,inline"`
+ OfMcpTool *ToolChoiceMcpParam `json:",omitzero,inline"`
+ OfCustomTool *ToolChoiceCustomParam `json:",omitzero,inline"`
+ OfInputTokenCountsToolChoiceSpecificProgrammaticToolCallingParam *InputTokenCountParamsToolChoiceSpecificProgrammaticToolCallingParam `json:",omitzero,inline"`
+ OfSpecificApplyPatchToolChoice *ToolChoiceApplyPatchParam `json:",omitzero,inline"`
+ OfSpecificShellToolChoice *ToolChoiceShellParam `json:",omitzero,inline"`
paramUnion
}
@@ -239,6 +256,7 @@ func (u InputTokenCountParamsToolChoiceUnion) MarshalJSON() ([]byte, error) {
u.OfFunctionTool,
u.OfMcpTool,
u.OfCustomTool,
+ u.OfInputTokenCountsToolChoiceSpecificProgrammaticToolCallingParam,
u.OfSpecificApplyPatchToolChoice,
u.OfSpecificShellToolChoice)
}
@@ -259,6 +277,8 @@ func (u *InputTokenCountParamsToolChoiceUnion) asAny() any {
return u.OfMcpTool
} else if !param.IsOmitted(u.OfCustomTool) {
return u.OfCustomTool
+ } else if !param.IsOmitted(u.OfInputTokenCountsToolChoiceSpecificProgrammaticToolCallingParam) {
+ return u.OfInputTokenCountsToolChoiceSpecificProgrammaticToolCallingParam
} else if !param.IsOmitted(u.OfSpecificApplyPatchToolChoice) {
return u.OfSpecificApplyPatchToolChoice
} else if !param.IsOmitted(u.OfSpecificShellToolChoice) {
@@ -303,6 +323,8 @@ func (u InputTokenCountParamsToolChoiceUnion) GetType() *string {
return (*string)(&vt.Type)
} else if vt := u.OfCustomTool; vt != nil {
return (*string)(&vt.Type)
+ } else if vt := u.OfInputTokenCountsToolChoiceSpecificProgrammaticToolCallingParam; vt != nil {
+ return (*string)(&vt.Type)
} else if vt := u.OfSpecificApplyPatchToolChoice; vt != nil {
return (*string)(&vt.Type)
} else if vt := u.OfSpecificShellToolChoice; vt != nil {
@@ -323,6 +345,28 @@ func (u InputTokenCountParamsToolChoiceUnion) GetName() *string {
return nil
}
+func NewInputTokenCountParamsToolChoiceSpecificProgrammaticToolCallingParam() InputTokenCountParamsToolChoiceSpecificProgrammaticToolCallingParam {
+ return InputTokenCountParamsToolChoiceSpecificProgrammaticToolCallingParam{
+ Type: "programmatic_tool_calling",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewInputTokenCountParamsToolChoiceSpecificProgrammaticToolCallingParam].
+type InputTokenCountParamsToolChoiceSpecificProgrammaticToolCallingParam struct {
+ // The tool to call. Always `programmatic_tool_calling`.
+ Type constant.ProgrammaticToolCalling `json:"type" default:"programmatic_tool_calling"`
+ paramObj
+}
+
+func (r InputTokenCountParamsToolChoiceSpecificProgrammaticToolCallingParam) MarshalJSON() (data []byte, err error) {
+ type shadow InputTokenCountParamsToolChoiceSpecificProgrammaticToolCallingParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *InputTokenCountParamsToolChoiceSpecificProgrammaticToolCallingParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// The truncation strategy to use for the model response. - `auto`: If the input to
// this Response exceeds the model's context window size, the model will truncate
// the response to fit the context window by dropping items from the beginning of
diff --git a/vendor/github.com/openai/openai-go/v3/responses/response.go b/vendor/github.com/openai/openai-go/v3/responses/response.go
index 9982dbf9b..726f952ee 100644
--- a/vendor/github.com/openai/openai-go/v3/responses/response.go
+++ b/vendor/github.com/openai/openai-go/v3/responses/response.go
@@ -6,7 +6,6 @@ import (
"context"
"encoding/json"
"errors"
- "fmt"
"net/http"
"net/url"
"slices"
@@ -59,7 +58,8 @@ func NewResponseService(opts ...option.RequestOption) (r ResponseService) {
// [file search](https://platform.openai.com/docs/guides/tools-file-search) to use
// your own data as input for the model's response.
func (r *ResponseService) New(ctx context.Context, body ResponseNewParams, opts ...option.RequestOption) (res *Response, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "responses"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -81,7 +81,8 @@ func (r *ResponseService) NewStreaming(ctx context.Context, body ResponseNewPara
raw *http.Response
err error
)
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append(opts, option.WithJSONSet("stream", true))
path := "responses"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &raw, opts...)
@@ -90,12 +91,13 @@ func (r *ResponseService) NewStreaming(ctx context.Context, body ResponseNewPara
// Retrieves a model response with the given ID.
func (r *ResponseService) Get(ctx context.Context, responseID string, query ResponseGetParams, opts ...option.RequestOption) (res *Response, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if responseID == "" {
err = errors.New("missing required response_id parameter")
return nil, err
}
- path := fmt.Sprintf("responses/%s", responseID)
+ path := requestconfig.FormatPath("responses/%s", responseID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
return res, err
}
@@ -106,26 +108,28 @@ func (r *ResponseService) GetStreaming(ctx context.Context, responseID string, q
raw *http.Response
err error
)
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append(opts, option.WithJSONSet("stream", true))
if responseID == "" {
err = errors.New("missing required response_id parameter")
return ssestream.NewStream[ResponseStreamEventUnion](nil, err)
}
- path := fmt.Sprintf("responses/%s", responseID)
+ path := requestconfig.FormatPath("responses/%s", responseID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &raw, opts...)
return ssestream.NewStream[ResponseStreamEventUnion](ssestream.NewDecoder(raw), err)
}
// Deletes a model response with the given ID.
func (r *ResponseService) Delete(ctx context.Context, responseID string, opts ...option.RequestOption) (err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...)
if responseID == "" {
err = errors.New("missing required response_id parameter")
return err
}
- path := fmt.Sprintf("responses/%s", responseID)
+ path := requestconfig.FormatPath("responses/%s", responseID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...)
return err
}
@@ -134,12 +138,13 @@ func (r *ResponseService) Delete(ctx context.Context, responseID string, opts ..
// `background` parameter set to `true` can be cancelled.
// [Learn more](https://platform.openai.com/docs/guides/background).
func (r *ResponseService) Cancel(ctx context.Context, responseID string, opts ...option.RequestOption) (res *Response, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if responseID == "" {
err = errors.New("missing required response_id parameter")
return nil, err
}
- path := fmt.Sprintf("responses/%s/cancel", responseID)
+ path := requestconfig.FormatPath("responses/%s/cancel", responseID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
return res, err
}
@@ -151,7 +156,8 @@ func (r *ResponseService) Cancel(ctx context.Context, responseID string, opts ..
// For ZDR-compatible compaction details, see
// [Compaction (advanced)](https://platform.openai.com/docs/guides/conversation-state#compaction-advanced).
func (r *ResponseService) Compact(ctx context.Context, body ResponseCompactParams, opts ...option.RequestOption) (res *CompactedResponse, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "responses/compact"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -161,11 +167,16 @@ func (r *ResponseService) Compact(ctx context.Context, body ResponseCompactParam
type ApplyPatchTool struct {
// The type of the tool. Always `apply_patch`.
Type constant.ApplyPatch `json:"type" default:"apply_patch"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Type respjson.Field
+ AllowedCallers respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -184,17 +195,17 @@ func (r ApplyPatchTool) ToParam() ApplyPatchToolParam {
return param.Override[ApplyPatchToolParam](json.RawMessage(r.RawJSON()))
}
-func NewApplyPatchToolParam() ApplyPatchToolParam {
- return ApplyPatchToolParam{
- Type: "apply_patch",
- }
-}
-
// Allows the assistant to create, delete, or update files using unified diffs.
//
-// This struct has a constant value, construct it with [NewApplyPatchToolParam].
+// The property Type is required.
type ApplyPatchToolParam struct {
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers,omitzero"`
// The type of the tool. Always `apply_patch`.
+ //
+ // This field can be elided, and will marshal its zero value as "apply_patch".
Type constant.ApplyPatch `json:"type" default:"apply_patch"`
paramObj
}
@@ -211,7 +222,7 @@ type CompactedResponse struct {
// The unique identifier for the compacted response.
ID string `json:"id" api:"required"`
// Unix timestamp (in seconds) when the compacted conversation was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The object type. Always `response.compaction`.
Object constant.ResponseCompaction `json:"object" default:"response.compaction"`
// The compacted list of output items. This is a list of all user messages,
@@ -1847,6 +1858,10 @@ type CustomTool struct {
Name string `json:"name" api:"required"`
// The type of the custom tool. Always `custom`.
Type constant.Custom `json:"type" default:"custom"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers" api:"nullable"`
// Whether this tool should be deferred and discovered via tool search.
DeferLoading bool `json:"defer_loading"`
// Optional description of the custom tool, used to provide more context.
@@ -1855,13 +1870,14 @@ type CustomTool struct {
Format shared.CustomToolInputFormatUnion `json:"format"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Name respjson.Field
- Type respjson.Field
- DeferLoading respjson.Field
- Description respjson.Field
- Format respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Name respjson.Field
+ Type respjson.Field
+ AllowedCallers respjson.Field
+ DeferLoading respjson.Field
+ Description respjson.Field
+ Format respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -1891,6 +1907,10 @@ type CustomToolParam struct {
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// Optional description of the custom tool, used to provide more context.
Description param.Opt[string] `json:"description,omitzero"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers,omitzero"`
// The input format for the custom tool. Default is unconstrained text.
Format shared.CustomToolInputFormatUnionParam `json:"format,omitzero"`
// The type of the custom tool. Always `custom`.
@@ -2361,14 +2381,19 @@ func (r *FileSearchToolRankingOptionsHybridSearchParam) UnmarshalJSON(data []byt
// A tool that allows the model to execute shell commands.
type FunctionShellTool struct {
// The type of the shell tool. Always `shell`.
- Type constant.Shell `json:"type" default:"shell"`
- Environment FunctionShellToolEnvironmentUnion `json:"environment" api:"nullable"`
+ Type constant.Shell `json:"type" default:"shell"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers" api:"nullable"`
+ Environment FunctionShellToolEnvironmentUnion `json:"environment" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Type respjson.Field
- Environment respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Type respjson.Field
+ AllowedCallers respjson.Field
+ Environment respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -2503,7 +2528,11 @@ func (r *FunctionShellToolEnvironmentUnionSkills) UnmarshalJSON(data []byte) err
//
// The property Type is required.
type FunctionShellToolParam struct {
- Environment FunctionShellToolEnvironmentUnionParam `json:"environment,omitzero"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers,omitzero"`
+ Environment FunctionShellToolEnvironmentUnionParam `json:"environment,omitzero"`
// The type of the shell tool. Always `shell`.
//
// This field can be elided, and will marshal its zero value as "shell".
@@ -2634,25 +2663,34 @@ type FunctionTool struct {
Name string `json:"name" api:"required"`
// A JSON schema object describing the parameters of the function.
Parameters map[string]any `json:"parameters" api:"required"`
- // Whether to enforce strict parameter validation. Default `true`.
+ // Whether strict parameter validation is enforced for this function tool.
Strict bool `json:"strict" api:"required"`
// The type of the function tool. Always `function`.
Type constant.Function `json:"type" default:"function"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers" api:"nullable"`
// Whether this function is deferred and loaded via tool search.
DeferLoading bool `json:"defer_loading"`
// A description of the function. Used by the model to determine whether or not to
// call the function.
Description string `json:"description" api:"nullable"`
+ // A JSON schema object describing the JSON value encoded in string outputs for
+ // this function.
+ OutputSchema map[string]any `json:"output_schema" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Name respjson.Field
- Parameters respjson.Field
- Strict respjson.Field
- Type respjson.Field
- DeferLoading respjson.Field
- Description respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Name respjson.Field
+ Parameters respjson.Field
+ Strict respjson.Field
+ Type respjson.Field
+ AllowedCallers respjson.Field
+ DeferLoading respjson.Field
+ Description respjson.Field
+ OutputSchema respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -2677,7 +2715,7 @@ func (r FunctionTool) ToParam() FunctionToolParam {
//
// The properties Name, Parameters, Strict, Type are required.
type FunctionToolParam struct {
- // Whether to enforce strict parameter validation. Default `true`.
+ // Whether strict parameter validation is enforced for this function tool.
Strict param.Opt[bool] `json:"strict,omitzero" api:"required"`
// A JSON schema object describing the parameters of the function.
Parameters map[string]any `json:"parameters,omitzero" api:"required"`
@@ -2688,6 +2726,13 @@ type FunctionToolParam struct {
Description param.Opt[string] `json:"description,omitzero"`
// Whether this function is deferred and loaded via tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers,omitzero"`
+ // A JSON schema object describing the JSON value encoded in string outputs for
+ // this function.
+ OutputSchema map[string]any `json:"output_schema,omitzero"`
// The type of the function tool. Always `function`.
//
// This field can be elided, and will marshal its zero value as "function".
@@ -2963,9 +3008,12 @@ func (r NamespaceTool) ToParam() NamespaceToolParam {
type NamespaceToolToolUnion struct {
Name string `json:"name"`
// Any of "function", "custom".
- Type string `json:"type"`
- DeferLoading bool `json:"defer_loading"`
- Description string `json:"description"`
+ Type string `json:"type"`
+ AllowedCallers []string `json:"allowed_callers"`
+ DeferLoading bool `json:"defer_loading"`
+ Description string `json:"description"`
+ // This field is from variant [NamespaceToolToolFunction].
+ OutputSchema map[string]any `json:"output_schema"`
// This field is from variant [NamespaceToolToolFunction].
Parameters any `json:"parameters"`
// This field is from variant [NamespaceToolToolFunction].
@@ -2973,14 +3021,16 @@ type NamespaceToolToolUnion struct {
// This field is from variant [CustomTool].
Format shared.CustomToolInputFormatUnion `json:"format"`
JSON struct {
- Name respjson.Field
- Type respjson.Field
- DeferLoading respjson.Field
- Description respjson.Field
- Parameters respjson.Field
- Strict respjson.Field
- Format respjson.Field
- raw string
+ Name respjson.Field
+ Type respjson.Field
+ AllowedCallers respjson.Field
+ DeferLoading respjson.Field
+ Description respjson.Field
+ OutputSchema respjson.Field
+ Parameters respjson.Field
+ Strict respjson.Field
+ Format respjson.Field
+ raw string
} `json:"-"`
}
@@ -3031,21 +3081,33 @@ func (r *NamespaceToolToolUnion) UnmarshalJSON(data []byte) error {
type NamespaceToolToolFunction struct {
Name string `json:"name" api:"required"`
Type constant.Function `json:"type" default:"function"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers" api:"nullable"`
// Whether this function should be deferred and discovered via tool search.
DeferLoading bool `json:"defer_loading"`
Description string `json:"description" api:"nullable"`
- Parameters any `json:"parameters" api:"nullable"`
- Strict bool `json:"strict" api:"nullable"`
+ // A JSON Schema describing the JSON value encoded in string outputs for this
+ // function tool. This does not describe content-array outputs.
+ OutputSchema map[string]any `json:"output_schema" api:"nullable"`
+ Parameters any `json:"parameters" api:"nullable"`
+ // Whether to enforce strict parameter validation. If omitted, Responses attempts
+ // to use strict validation when the schema is compatible, and falls back to
+ // non-strict validation otherwise.
+ Strict bool `json:"strict" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Name respjson.Field
- Type respjson.Field
- DeferLoading respjson.Field
- Description respjson.Field
- Parameters respjson.Field
- Strict respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Name respjson.Field
+ Type respjson.Field
+ AllowedCallers respjson.Field
+ DeferLoading respjson.Field
+ Description respjson.Field
+ OutputSchema respjson.Field
+ Parameters respjson.Field
+ Strict respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -3105,6 +3167,14 @@ func (u *NamespaceToolToolUnionParam) asAny() any {
return nil
}
+// Returns a pointer to the underlying variant's property, if present.
+func (u NamespaceToolToolUnionParam) GetOutputSchema() map[string]any {
+ if vt := u.OfFunction; vt != nil {
+ return vt.OutputSchema
+ }
+ return nil
+}
+
// Returns a pointer to the underlying variant's property, if present.
func (u NamespaceToolToolUnionParam) GetParameters() *any {
if vt := u.OfFunction; vt != nil {
@@ -3169,6 +3239,17 @@ func (u NamespaceToolToolUnionParam) GetDescription() *string {
return nil
}
+// Returns a pointer to the underlying variant's AllowedCallers property, if
+// present.
+func (u NamespaceToolToolUnionParam) GetAllowedCallers() []string {
+ if vt := u.OfFunction; vt != nil {
+ return vt.AllowedCallers
+ } else if vt := u.OfCustom; vt != nil {
+ return vt.AllowedCallers
+ }
+ return nil
+}
+
func init() {
apijson.RegisterUnion[NamespaceToolToolUnionParam](
"type",
@@ -3181,10 +3262,20 @@ func init() {
type NamespaceToolToolFunctionParam struct {
Name string `json:"name" api:"required"`
Description param.Opt[string] `json:"description,omitzero"`
- Strict param.Opt[bool] `json:"strict,omitzero"`
+ // Whether to enforce strict parameter validation. If omitted, Responses attempts
+ // to use strict validation when the schema is compatible, and falls back to
+ // non-strict validation otherwise.
+ Strict param.Opt[bool] `json:"strict,omitzero"`
// Whether this function should be deferred and discovered via tool search.
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
- Parameters any `json:"parameters,omitzero"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers,omitzero"`
+ // A JSON Schema describing the JSON value encoded in string outputs for this
+ // function tool. This does not describe content-array outputs.
+ OutputSchema map[string]any `json:"output_schema,omitzero"`
+ Parameters any `json:"parameters,omitzero"`
// This field can be elided, and will marshal its zero value as "function".
Type constant.Function `json:"type" default:"function"`
paramObj
@@ -3202,7 +3293,7 @@ type Response struct {
// Unique identifier for this Response.
ID string `json:"id" api:"required"`
// Unix timestamp (in seconds) of when this Response was created.
- CreatedAt float64 `json:"created_at" api:"required"`
+ CreatedAt float64 `json:"created_at" api:"required" format:"unixtime"`
// An error object returned when the model fails to generate a Response.
Error ResponseError `json:"error" api:"required"`
// Details about why the response is incomplete.
@@ -3278,7 +3369,7 @@ type Response struct {
Background bool `json:"background" api:"nullable"`
// Unix timestamp (in seconds) of when this Response was completed. Only present
// when the status is `completed`.
- CompletedAt float64 `json:"completed_at" api:"nullable"`
+ CompletedAt float64 `json:"completed_at" api:"nullable" format:"unixtime"`
// The conversation that this response belonged to. Input items and output items
// from this response were automatically added to this conversation.
Conversation ResponseConversation `json:"conversation" api:"nullable"`
@@ -3291,6 +3382,9 @@ type Response struct {
// individual tool. Any further attempts to call a tool by the model will be
// ignored.
MaxToolCalls int64 `json:"max_tool_calls" api:"nullable"`
+ // Moderation results for the response input and output, if moderated completions
+ // were requested.
+ Moderation ResponseModeration `json:"moderation" api:"nullable"`
// The unique ID of the previous response to the model. Use this to create
// multi-turn conversations. Learn more about
// [conversation state](https://platform.openai.com/docs/guides/conversation-state).
@@ -3302,13 +3396,31 @@ type Response struct {
// Used by OpenAI to cache responses for similar requests to optimize your cache
// hit rates. Replaces the `user` field.
// [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
- PromptCacheKey string `json:"prompt_cache_key"`
+ PromptCacheKey string `json:"prompt_cache_key" api:"nullable"`
+ // The prompt-caching options that were applied to the response. Supported for
+ // `gpt-5.6` and later models.
+ PromptCacheOptions ResponsePromptCacheOptions `json:"prompt_cache_options"`
+ // Deprecated. Use `prompt_cache_options.ttl` instead.
+ //
// The retention policy for the prompt cache. Set to `24h` to enable extended
// prompt caching, which keeps cached prefixes active for longer, up to a maximum
// of 24 hours.
// [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
+ // This field expresses a maximum retention policy, while
+ // `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
+ // are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
+ // models, only `24h` is supported.
+ //
+ // For older models that support both `in_memory` and `24h`, the default depends on
+ // your organization's data retention policy:
+ //
+ // - Organizations without ZDR enabled default to `24h`.
+ // - Organizations with ZDR enabled default to `in_memory` when
+ // `prompt_cache_retention` is not specified.
+ //
+ // Any of "in_memory", "24h".
//
- // Any of "in-memory", "24h".
+ // Deprecated: deprecated
PromptCacheRetention ResponsePromptCacheRetention `json:"prompt_cache_retention" api:"nullable"`
// **gpt-5 and o-series models only**
//
@@ -3321,7 +3433,7 @@ type Response struct {
// hashing their username or email address, in order to avoid sending us any
// identifying information.
// [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
- SafetyIdentifier string `json:"safety_identifier"`
+ SafetyIdentifier string `json:"safety_identifier" api:"nullable"`
// Specifies the processing type used for serving the request.
//
// - If set to 'auto', then the request will be processed with the service tier
@@ -3353,8 +3465,9 @@ type Response struct {
// - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
// - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
Text ResponseTextConfig `json:"text"`
- // An integer between 0 and 20 specifying the number of most likely tokens to
- // return at each token position, each with an associated log probability.
+ // An integer between 0 and 20 specifying the maximum number of most likely tokens
+ // to return at each token position, each with an associated log probability. In
+ // some cases, the number of returned tokens may be fewer than requested.
TopLogprobs int64 `json:"top_logprobs" api:"nullable"`
// The truncation strategy to use for the model response.
//
@@ -3398,9 +3511,11 @@ type Response struct {
Conversation respjson.Field
MaxOutputTokens respjson.Field
MaxToolCalls respjson.Field
+ Moderation respjson.Field
PreviousResponseID respjson.Field
Prompt respjson.Field
PromptCacheKey respjson.Field
+ PromptCacheOptions respjson.Field
PromptCacheRetention respjson.Field
Reasoning respjson.Field
SafetyIdentifier respjson.Field
@@ -3494,6 +3609,7 @@ func (r *ResponseInstructionsUnion) UnmarshalJSON(data []byte) error {
// ResponseToolChoiceUnion contains all possible properties and values from
// [ToolChoiceOptions], [ToolChoiceAllowed], [ToolChoiceTypes],
// [ToolChoiceFunction], [ToolChoiceMcp], [ToolChoiceCustom],
+// [ResponseToolChoiceSpecificProgrammaticToolCallingParam],
// [ToolChoiceApplyPatch], [ToolChoiceShell].
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
@@ -3553,6 +3669,11 @@ func (u ResponseToolChoiceUnion) AsCustomTool() (v ToolChoiceCustom) {
return
}
+func (u ResponseToolChoiceUnion) AsResponseToolChoiceSpecificProgrammaticToolCallingParam() (v ResponseToolChoiceSpecificProgrammaticToolCallingParam) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
func (u ResponseToolChoiceUnion) AsSpecificApplyPatchToolChoice() (v ToolChoiceApplyPatch) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
@@ -3570,6 +3691,23 @@ func (r *ResponseToolChoiceUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+type ResponseToolChoiceSpecificProgrammaticToolCallingParam struct {
+ // The tool to call. Always `programmatic_tool_calling`.
+ Type constant.ProgrammaticToolCalling `json:"type" default:"programmatic_tool_calling"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseToolChoiceSpecificProgrammaticToolCallingParam) RawJSON() string { return r.JSON.raw }
+func (r *ResponseToolChoiceSpecificProgrammaticToolCallingParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// The conversation that this response belonged to. Input items and output items
// from this response were automatically added to this conversation.
type ResponseConversation struct {
@@ -3589,14 +3727,355 @@ func (r *ResponseConversation) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// Moderation results for the response input and output, if moderated completions
+// were requested.
+type ResponseModeration struct {
+ // Moderation for the response input.
+ Input ResponseModerationInputUnion `json:"input" api:"required"`
+ // Moderation for the response output.
+ Output ResponseModerationOutputUnion `json:"output" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Input respjson.Field
+ Output respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseModeration) RawJSON() string { return r.JSON.raw }
+func (r *ResponseModeration) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ResponseModerationInputUnion contains all possible properties and values from
+// [ResponseModerationInputModerationResult], [ResponseModerationInputError].
+//
+// Use the [ResponseModerationInputUnion.AsAny] method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseModerationInputUnion struct {
+ // This field is from variant [ResponseModerationInputModerationResult].
+ Categories map[string]bool `json:"categories"`
+ // This field is from variant [ResponseModerationInputModerationResult].
+ CategoryAppliedInputTypes map[string][]string `json:"category_applied_input_types"`
+ // This field is from variant [ResponseModerationInputModerationResult].
+ CategoryScores map[string]float64 `json:"category_scores"`
+ // This field is from variant [ResponseModerationInputModerationResult].
+ Flagged bool `json:"flagged"`
+ // This field is from variant [ResponseModerationInputModerationResult].
+ Model string `json:"model"`
+ // Any of "moderation_result", "error".
+ Type string `json:"type"`
+ // This field is from variant [ResponseModerationInputError].
+ Code string `json:"code"`
+ // This field is from variant [ResponseModerationInputError].
+ Message string `json:"message"`
+ JSON struct {
+ Categories respjson.Field
+ CategoryAppliedInputTypes respjson.Field
+ CategoryScores respjson.Field
+ Flagged respjson.Field
+ Model respjson.Field
+ Type respjson.Field
+ Code respjson.Field
+ Message respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyResponseModerationInput is implemented by each variant of
+// [ResponseModerationInputUnion] to add type safety for the return type of
+// [ResponseModerationInputUnion.AsAny]
+type anyResponseModerationInput interface {
+ implResponseModerationInputUnion()
+}
+
+func (ResponseModerationInputModerationResult) implResponseModerationInputUnion() {}
+func (ResponseModerationInputError) implResponseModerationInputUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseModerationInputUnion.AsAny().(type) {
+// case responses.ResponseModerationInputModerationResult:
+// case responses.ResponseModerationInputError:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseModerationInputUnion) AsAny() anyResponseModerationInput {
+ switch u.Type {
+ case "moderation_result":
+ return u.AsModerationResult()
+ case "error":
+ return u.AsError()
+ }
+ return nil
+}
+
+func (u ResponseModerationInputUnion) AsModerationResult() (v ResponseModerationInputModerationResult) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseModerationInputUnion) AsError() (v ResponseModerationInputError) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseModerationInputUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseModerationInputUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A moderation result produced for the response input or output.
+type ResponseModerationInputModerationResult struct {
+ // A dictionary of moderation categories to booleans, True if the input is flagged
+ // under this category.
+ Categories map[string]bool `json:"categories" api:"required"`
+ // Which modalities of input are reflected by the score for each category.
+ CategoryAppliedInputTypes map[string][]string `json:"category_applied_input_types" api:"required"`
+ // A dictionary of moderation categories to scores.
+ CategoryScores map[string]float64 `json:"category_scores" api:"required"`
+ // A boolean indicating whether the content was flagged by any category.
+ Flagged bool `json:"flagged" api:"required"`
+ // The moderation model that produced this result.
+ Model string `json:"model" api:"required"`
+ // The object type, which was always `moderation_result` for successful moderation
+ // results.
+ Type constant.ModerationResult `json:"type" default:"moderation_result"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Categories respjson.Field
+ CategoryAppliedInputTypes respjson.Field
+ CategoryScores respjson.Field
+ Flagged respjson.Field
+ Model respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseModerationInputModerationResult) RawJSON() string { return r.JSON.raw }
+func (r *ResponseModerationInputModerationResult) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An error produced while attempting moderation for the response input or output.
+type ResponseModerationInputError struct {
+ // The error code.
+ Code string `json:"code" api:"required"`
+ // The error message.
+ Message string `json:"message" api:"required"`
+ // The object type, which was always `error` for moderation failures.
+ Type constant.Error `json:"type" default:"error"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Code respjson.Field
+ Message respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseModerationInputError) RawJSON() string { return r.JSON.raw }
+func (r *ResponseModerationInputError) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ResponseModerationOutputUnion contains all possible properties and values from
+// [ResponseModerationOutputModerationResult], [ResponseModerationOutputError].
+//
+// Use the [ResponseModerationOutputUnion.AsAny] method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseModerationOutputUnion struct {
+ // This field is from variant [ResponseModerationOutputModerationResult].
+ Categories map[string]bool `json:"categories"`
+ // This field is from variant [ResponseModerationOutputModerationResult].
+ CategoryAppliedInputTypes map[string][]string `json:"category_applied_input_types"`
+ // This field is from variant [ResponseModerationOutputModerationResult].
+ CategoryScores map[string]float64 `json:"category_scores"`
+ // This field is from variant [ResponseModerationOutputModerationResult].
+ Flagged bool `json:"flagged"`
+ // This field is from variant [ResponseModerationOutputModerationResult].
+ Model string `json:"model"`
+ // Any of "moderation_result", "error".
+ Type string `json:"type"`
+ // This field is from variant [ResponseModerationOutputError].
+ Code string `json:"code"`
+ // This field is from variant [ResponseModerationOutputError].
+ Message string `json:"message"`
+ JSON struct {
+ Categories respjson.Field
+ CategoryAppliedInputTypes respjson.Field
+ CategoryScores respjson.Field
+ Flagged respjson.Field
+ Model respjson.Field
+ Type respjson.Field
+ Code respjson.Field
+ Message respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyResponseModerationOutput is implemented by each variant of
+// [ResponseModerationOutputUnion] to add type safety for the return type of
+// [ResponseModerationOutputUnion.AsAny]
+type anyResponseModerationOutput interface {
+ implResponseModerationOutputUnion()
+}
+
+func (ResponseModerationOutputModerationResult) implResponseModerationOutputUnion() {}
+func (ResponseModerationOutputError) implResponseModerationOutputUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseModerationOutputUnion.AsAny().(type) {
+// case responses.ResponseModerationOutputModerationResult:
+// case responses.ResponseModerationOutputError:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseModerationOutputUnion) AsAny() anyResponseModerationOutput {
+ switch u.Type {
+ case "moderation_result":
+ return u.AsModerationResult()
+ case "error":
+ return u.AsError()
+ }
+ return nil
+}
+
+func (u ResponseModerationOutputUnion) AsModerationResult() (v ResponseModerationOutputModerationResult) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseModerationOutputUnion) AsError() (v ResponseModerationOutputError) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseModerationOutputUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseModerationOutputUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A moderation result produced for the response input or output.
+type ResponseModerationOutputModerationResult struct {
+ // A dictionary of moderation categories to booleans, True if the input is flagged
+ // under this category.
+ Categories map[string]bool `json:"categories" api:"required"`
+ // Which modalities of input are reflected by the score for each category.
+ CategoryAppliedInputTypes map[string][]string `json:"category_applied_input_types" api:"required"`
+ // A dictionary of moderation categories to scores.
+ CategoryScores map[string]float64 `json:"category_scores" api:"required"`
+ // A boolean indicating whether the content was flagged by any category.
+ Flagged bool `json:"flagged" api:"required"`
+ // The moderation model that produced this result.
+ Model string `json:"model" api:"required"`
+ // The object type, which was always `moderation_result` for successful moderation
+ // results.
+ Type constant.ModerationResult `json:"type" default:"moderation_result"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Categories respjson.Field
+ CategoryAppliedInputTypes respjson.Field
+ CategoryScores respjson.Field
+ Flagged respjson.Field
+ Model respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseModerationOutputModerationResult) RawJSON() string { return r.JSON.raw }
+func (r *ResponseModerationOutputModerationResult) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An error produced while attempting moderation for the response input or output.
+type ResponseModerationOutputError struct {
+ // The error code.
+ Code string `json:"code" api:"required"`
+ // The error message.
+ Message string `json:"message" api:"required"`
+ // The object type, which was always `error` for moderation failures.
+ Type constant.Error `json:"type" default:"error"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Code respjson.Field
+ Message respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseModerationOutputError) RawJSON() string { return r.JSON.raw }
+func (r *ResponseModerationOutputError) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The prompt-caching options that were applied to the response. Supported for
+// `gpt-5.6` and later models.
+type ResponsePromptCacheOptions struct {
+ // Whether implicit prompt-cache breakpoints were enabled.
+ //
+ // Any of "implicit", "explicit".
+ Mode string `json:"mode" api:"required"`
+ // The minimum lifetime applied to each cache breakpoint.
+ //
+ // Any of "30m".
+ Ttl string `json:"ttl" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Mode respjson.Field
+ Ttl respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponsePromptCacheOptions) RawJSON() string { return r.JSON.raw }
+func (r *ResponsePromptCacheOptions) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Deprecated. Use `prompt_cache_options.ttl` instead.
+//
// The retention policy for the prompt cache. Set to `24h` to enable extended
// prompt caching, which keeps cached prefixes active for longer, up to a maximum
// of 24 hours.
// [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
+// This field expresses a maximum retention policy, while
+// `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
+// are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
+// models, only `24h` is supported.
+//
+// For older models that support both `in_memory` and `24h`, the default depends on
+// your organization's data retention policy:
+//
+// - Organizations without ZDR enabled default to `24h`.
+// - Organizations with ZDR enabled default to `in_memory` when
+// `prompt_cache_retention` is not specified.
type ResponsePromptCacheRetention string
const (
- ResponsePromptCacheRetentionInMemory ResponsePromptCacheRetention = "in-memory"
+ ResponsePromptCacheRetentionInMemory ResponsePromptCacheRetention = "in_memory"
ResponsePromptCacheRetention24h ResponsePromptCacheRetention = "24h"
)
@@ -3656,6 +4135,8 @@ type ResponseApplyPatchToolCall struct {
Status ResponseApplyPatchToolCallStatus `json:"status" api:"required"`
// The type of the item. Always `apply_patch_call`.
Type constant.ApplyPatchCall `json:"type" default:"apply_patch_call"`
+ // The execution context that produced this tool call.
+ Caller ResponseApplyPatchToolCallCallerUnion `json:"caller" api:"nullable"`
// The ID of the entity that created this tool call.
CreatedBy string `json:"created_by"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
@@ -3665,6 +4146,7 @@ type ResponseApplyPatchToolCall struct {
Operation respjson.Field
Status respjson.Field
Type respjson.Field
+ Caller respjson.Field
CreatedBy respjson.Field
ExtraFields map[string]respjson.Field
raw string
@@ -3832,19 +4314,121 @@ const (
ResponseApplyPatchToolCallStatusCompleted ResponseApplyPatchToolCallStatus = "completed"
)
-// The output emitted by an apply patch tool call.
-type ResponseApplyPatchToolCallOutput struct {
- // The unique ID of the apply patch tool call output. Populated when this item is
- // returned via API.
- ID string `json:"id" api:"required"`
- // The unique ID of the apply patch tool call generated by the model.
- CallID string `json:"call_id" api:"required"`
- // The status of the apply patch tool call output. One of `completed` or `failed`.
- //
- // Any of "completed", "failed".
+// ResponseApplyPatchToolCallCallerUnion contains all possible properties and
+// values from [ResponseApplyPatchToolCallCallerDirect],
+// [ResponseApplyPatchToolCallCallerProgram].
+//
+// Use the [ResponseApplyPatchToolCallCallerUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseApplyPatchToolCallCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [ResponseApplyPatchToolCallCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyResponseApplyPatchToolCallCaller is implemented by each variant of
+// [ResponseApplyPatchToolCallCallerUnion] to add type safety for the return type
+// of [ResponseApplyPatchToolCallCallerUnion.AsAny]
+type anyResponseApplyPatchToolCallCaller interface {
+ implResponseApplyPatchToolCallCallerUnion()
+}
+
+func (ResponseApplyPatchToolCallCallerDirect) implResponseApplyPatchToolCallCallerUnion() {}
+func (ResponseApplyPatchToolCallCallerProgram) implResponseApplyPatchToolCallCallerUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseApplyPatchToolCallCallerUnion.AsAny().(type) {
+// case responses.ResponseApplyPatchToolCallCallerDirect:
+// case responses.ResponseApplyPatchToolCallCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseApplyPatchToolCallCallerUnion) AsAny() anyResponseApplyPatchToolCallCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u ResponseApplyPatchToolCallCallerUnion) AsDirect() (v ResponseApplyPatchToolCallCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseApplyPatchToolCallCallerUnion) AsProgram() (v ResponseApplyPatchToolCallCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseApplyPatchToolCallCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseApplyPatchToolCallCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseApplyPatchToolCallCallerDirect struct {
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseApplyPatchToolCallCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *ResponseApplyPatchToolCallCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseApplyPatchToolCallCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseApplyPatchToolCallCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *ResponseApplyPatchToolCallCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The output emitted by an apply patch tool call.
+type ResponseApplyPatchToolCallOutput struct {
+ // The unique ID of the apply patch tool call output. Populated when this item is
+ // returned via API.
+ ID string `json:"id" api:"required"`
+ // The unique ID of the apply patch tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // The status of the apply patch tool call output. One of `completed` or `failed`.
+ //
+ // Any of "completed", "failed".
Status ResponseApplyPatchToolCallOutputStatus `json:"status" api:"required"`
// The type of the item. Always `apply_patch_call_output`.
Type constant.ApplyPatchCallOutput `json:"type" default:"apply_patch_call_output"`
+ // The execution context that produced this tool call.
+ Caller ResponseApplyPatchToolCallOutputCallerUnion `json:"caller" api:"nullable"`
// The ID of the entity that created this tool call output.
CreatedBy string `json:"created_by"`
// Optional textual output returned by the apply patch tool.
@@ -3855,6 +4439,7 @@ type ResponseApplyPatchToolCallOutput struct {
CallID respjson.Field
Status respjson.Field
Type respjson.Field
+ Caller respjson.Field
CreatedBy respjson.Field
Output respjson.Field
ExtraFields map[string]respjson.Field
@@ -3878,6 +4463,108 @@ const (
ResponseApplyPatchToolCallOutputStatusFailed ResponseApplyPatchToolCallOutputStatus = "failed"
)
+// ResponseApplyPatchToolCallOutputCallerUnion contains all possible properties and
+// values from [ResponseApplyPatchToolCallOutputCallerDirect],
+// [ResponseApplyPatchToolCallOutputCallerProgram].
+//
+// Use the [ResponseApplyPatchToolCallOutputCallerUnion.AsAny] method to switch on
+// the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseApplyPatchToolCallOutputCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [ResponseApplyPatchToolCallOutputCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyResponseApplyPatchToolCallOutputCaller is implemented by each variant of
+// [ResponseApplyPatchToolCallOutputCallerUnion] to add type safety for the return
+// type of [ResponseApplyPatchToolCallOutputCallerUnion.AsAny]
+type anyResponseApplyPatchToolCallOutputCaller interface {
+ implResponseApplyPatchToolCallOutputCallerUnion()
+}
+
+func (ResponseApplyPatchToolCallOutputCallerDirect) implResponseApplyPatchToolCallOutputCallerUnion() {
+}
+func (ResponseApplyPatchToolCallOutputCallerProgram) implResponseApplyPatchToolCallOutputCallerUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseApplyPatchToolCallOutputCallerUnion.AsAny().(type) {
+// case responses.ResponseApplyPatchToolCallOutputCallerDirect:
+// case responses.ResponseApplyPatchToolCallOutputCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseApplyPatchToolCallOutputCallerUnion) AsAny() anyResponseApplyPatchToolCallOutputCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u ResponseApplyPatchToolCallOutputCallerUnion) AsDirect() (v ResponseApplyPatchToolCallOutputCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseApplyPatchToolCallOutputCallerUnion) AsProgram() (v ResponseApplyPatchToolCallOutputCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseApplyPatchToolCallOutputCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseApplyPatchToolCallOutputCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseApplyPatchToolCallOutputCallerDirect struct {
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseApplyPatchToolCallOutputCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *ResponseApplyPatchToolCallOutputCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseApplyPatchToolCallOutputCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseApplyPatchToolCallOutputCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *ResponseApplyPatchToolCallOutputCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// Emitted when there is a partial audio response.
type ResponseAudioDeltaEvent struct {
// A chunk of Base64 encoded response audio bytes.
@@ -4256,7 +4943,7 @@ type ResponseCodeInterpreterToolCallOutputImage struct {
// The type of the output. Always `image`.
Type constant.Image `json:"type" default:"image"`
// The URL of the image output from the code interpreter.
- URL string `json:"url" api:"required"`
+ URL string `json:"url" api:"required" format:"uri"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
@@ -4403,7 +5090,7 @@ func (r *ResponseCodeInterpreterToolCallOutputLogsParam) UnmarshalJSON(data []by
// The properties Type, URL are required.
type ResponseCodeInterpreterToolCallOutputImageParam struct {
// The URL of the image output from the code interpreter.
- URL string `json:"url" api:"required"`
+ URL string `json:"url" api:"required" format:"uri"`
// The type of the output. Always `image`.
//
// This field can be elided, and will marshal its zero value as "image".
@@ -5632,7 +6319,7 @@ type ResponseComputerToolCallOutputScreenshot struct {
// The identifier of an uploaded file that contains the screenshot.
FileID string `json:"file_id"`
// The URL of the screenshot image.
- ImageURL string `json:"image_url"`
+ ImageURL string `json:"image_url" format:"uri"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
@@ -5666,7 +6353,7 @@ type ResponseComputerToolCallOutputScreenshotParam struct {
// The identifier of an uploaded file that contains the screenshot.
FileID param.Opt[string] `json:"file_id,omitzero"`
// The URL of the screenshot image.
- ImageURL param.Opt[string] `json:"image_url,omitzero"`
+ ImageURL param.Opt[string] `json:"image_url,omitzero" format:"uri"`
// Specifies the event type. For a computer screenshot, this property is always set
// to `computer_screenshot`.
//
@@ -6029,6 +6716,8 @@ type ResponseCustomToolCall struct {
Type constant.CustomToolCall `json:"type" default:"custom_tool_call"`
// The unique ID of the custom tool call in the OpenAI platform.
ID string `json:"id"`
+ // The execution context that produced this tool call.
+ Caller ResponseCustomToolCallCallerUnion `json:"caller" api:"nullable"`
// The namespace of the custom tool being called.
Namespace string `json:"namespace"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
@@ -6038,6 +6727,7 @@ type ResponseCustomToolCall struct {
Name respjson.Field
Type respjson.Field
ID respjson.Field
+ Caller respjson.Field
Namespace respjson.Field
ExtraFields map[string]respjson.Field
raw string
@@ -6061,6 +6751,106 @@ func (r ResponseCustomToolCall) ToParam() ResponseCustomToolCallParam {
return param.Override[ResponseCustomToolCallParam](json.RawMessage(r.RawJSON()))
}
+// ResponseCustomToolCallCallerUnion contains all possible properties and values
+// from [ResponseCustomToolCallCallerDirect],
+// [ResponseCustomToolCallCallerProgram].
+//
+// Use the [ResponseCustomToolCallCallerUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseCustomToolCallCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [ResponseCustomToolCallCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyResponseCustomToolCallCaller is implemented by each variant of
+// [ResponseCustomToolCallCallerUnion] to add type safety for the return type of
+// [ResponseCustomToolCallCallerUnion.AsAny]
+type anyResponseCustomToolCallCaller interface {
+ implResponseCustomToolCallCallerUnion()
+}
+
+func (ResponseCustomToolCallCallerDirect) implResponseCustomToolCallCallerUnion() {}
+func (ResponseCustomToolCallCallerProgram) implResponseCustomToolCallCallerUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseCustomToolCallCallerUnion.AsAny().(type) {
+// case responses.ResponseCustomToolCallCallerDirect:
+// case responses.ResponseCustomToolCallCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseCustomToolCallCallerUnion) AsAny() anyResponseCustomToolCallCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u ResponseCustomToolCallCallerUnion) AsDirect() (v ResponseCustomToolCallCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseCustomToolCallCallerUnion) AsProgram() (v ResponseCustomToolCallCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseCustomToolCallCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseCustomToolCallCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseCustomToolCallCallerDirect struct {
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseCustomToolCallCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *ResponseCustomToolCallCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseCustomToolCallCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseCustomToolCallCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *ResponseCustomToolCallCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A call to a custom tool created by the model.
//
// The properties CallID, Input, Name, Type are required.
@@ -6075,6 +6865,8 @@ type ResponseCustomToolCallParam struct {
ID param.Opt[string] `json:"id,omitzero"`
// The namespace of the custom tool being called.
Namespace param.Opt[string] `json:"namespace,omitzero"`
+ // The execution context that produced this tool call.
+ Caller ResponseCustomToolCallCallerUnionParam `json:"caller,omitzero"`
// The type of the custom tool call. Always `custom_tool_call`.
//
// This field can be elided, and will marshal its zero value as "custom_tool_call".
@@ -6090,6 +6882,95 @@ func (r *ResponseCustomToolCallParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseCustomToolCallCallerUnionParam struct {
+ OfDirect *ResponseCustomToolCallCallerDirectParam `json:",omitzero,inline"`
+ OfProgram *ResponseCustomToolCallCallerProgramParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ResponseCustomToolCallCallerUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfDirect, u.OfProgram)
+}
+func (u *ResponseCustomToolCallCallerUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ResponseCustomToolCallCallerUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfDirect) {
+ return u.OfDirect
+ } else if !param.IsOmitted(u.OfProgram) {
+ return u.OfProgram
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseCustomToolCallCallerUnionParam) GetCallerID() *string {
+ if vt := u.OfProgram; vt != nil {
+ return &vt.CallerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseCustomToolCallCallerUnionParam) GetType() *string {
+ if vt := u.OfDirect; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[ResponseCustomToolCallCallerUnionParam](
+ "type",
+ apijson.Discriminator[ResponseCustomToolCallCallerDirectParam]("direct"),
+ apijson.Discriminator[ResponseCustomToolCallCallerProgramParam]("program"),
+ )
+}
+
+func NewResponseCustomToolCallCallerDirectParam() ResponseCustomToolCallCallerDirectParam {
+ return ResponseCustomToolCallCallerDirectParam{
+ Type: "direct",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewResponseCustomToolCallCallerDirectParam].
+type ResponseCustomToolCallCallerDirectParam struct {
+ Type constant.Direct `json:"type" default:"direct"`
+ paramObj
+}
+
+func (r ResponseCustomToolCallCallerDirectParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseCustomToolCallCallerDirectParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseCustomToolCallCallerDirectParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties CallerID, Type are required.
+type ResponseCustomToolCallCallerProgramParam struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // This field can be elided, and will marshal its zero value as "program".
+ Type constant.Program `json:"type" default:"program"`
+ paramObj
+}
+
+func (r ResponseCustomToolCallCallerProgramParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseCustomToolCallCallerProgramParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseCustomToolCallCallerProgramParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// Event representing a delta (partial update) to the input of a custom tool call.
type ResponseCustomToolCallInputDeltaEvent struct {
// The incremental input data (delta) for the custom tool call.
@@ -6189,12 +7070,15 @@ type ResponseCustomToolCallOutput struct {
Type constant.CustomToolCallOutput `json:"type" default:"custom_tool_call_output"`
// The unique ID of the custom tool call output in the OpenAI platform.
ID string `json:"id"`
+ // The execution context that produced this tool call.
+ Caller ResponseCustomToolCallOutputCallerUnion `json:"caller" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CallID respjson.Field
Output respjson.Field
Type respjson.Field
ID respjson.Field
+ Caller respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
@@ -6269,9 +7153,13 @@ type ResponseCustomToolCallOutputOutputOutputContentListItemUnion struct {
// This field is from variant [ResponseInputText].
Text string `json:"text"`
// Any of "input_text", "input_image", "input_file".
- Type string `json:"type"`
- Detail string `json:"detail"`
- FileID string `json:"file_id"`
+ Type string `json:"type"`
+ // This field is a union of [ResponseInputTextPromptCacheBreakpoint],
+ // [ResponseInputImagePromptCacheBreakpoint],
+ // [ResponseInputFilePromptCacheBreakpoint]
+ PromptCacheBreakpoint ResponseCustomToolCallOutputOutputOutputContentListItemUnionPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
+ Detail string `json:"detail"`
+ FileID string `json:"file_id"`
// This field is from variant [ResponseInputImage].
ImageURL string `json:"image_url"`
// This field is from variant [ResponseInputFile].
@@ -6281,15 +7169,16 @@ type ResponseCustomToolCallOutputOutputOutputContentListItemUnion struct {
// This field is from variant [ResponseInputFile].
Filename string `json:"filename"`
JSON struct {
- Text respjson.Field
- Type respjson.Field
- Detail respjson.Field
- FileID respjson.Field
- ImageURL respjson.Field
- FileData respjson.Field
- FileURL respjson.Field
- Filename respjson.Field
- raw string
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ Detail respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ FileData respjson.Field
+ FileURL respjson.Field
+ Filename respjson.Field
+ raw string
} `json:"-"`
}
@@ -6350,6 +7239,129 @@ func (r *ResponseCustomToolCallOutputOutputOutputContentListItemUnion) Unmarshal
return apijson.UnmarshalRoot(data, r)
}
+// ResponseCustomToolCallOutputOutputOutputContentListItemUnionPromptCacheBreakpoint
+// is an implicit subunion of
+// [ResponseCustomToolCallOutputOutputOutputContentListItemUnion].
+// ResponseCustomToolCallOutputOutputOutputContentListItemUnionPromptCacheBreakpoint
+// provides convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [ResponseCustomToolCallOutputOutputOutputContentListItemUnion].
+type ResponseCustomToolCallOutputOutputOutputContentListItemUnionPromptCacheBreakpoint struct {
+ // This field is from variant [ResponseInputTextPromptCacheBreakpoint].
+ Mode constant.Explicit `json:"mode"`
+ JSON struct {
+ Mode respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *ResponseCustomToolCallOutputOutputOutputContentListItemUnionPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ResponseCustomToolCallOutputCallerUnion contains all possible properties and
+// values from [ResponseCustomToolCallOutputCallerDirect],
+// [ResponseCustomToolCallOutputCallerProgram].
+//
+// Use the [ResponseCustomToolCallOutputCallerUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseCustomToolCallOutputCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [ResponseCustomToolCallOutputCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyResponseCustomToolCallOutputCaller is implemented by each variant of
+// [ResponseCustomToolCallOutputCallerUnion] to add type safety for the return type
+// of [ResponseCustomToolCallOutputCallerUnion.AsAny]
+type anyResponseCustomToolCallOutputCaller interface {
+ implResponseCustomToolCallOutputCallerUnion()
+}
+
+func (ResponseCustomToolCallOutputCallerDirect) implResponseCustomToolCallOutputCallerUnion() {}
+func (ResponseCustomToolCallOutputCallerProgram) implResponseCustomToolCallOutputCallerUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseCustomToolCallOutputCallerUnion.AsAny().(type) {
+// case responses.ResponseCustomToolCallOutputCallerDirect:
+// case responses.ResponseCustomToolCallOutputCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseCustomToolCallOutputCallerUnion) AsAny() anyResponseCustomToolCallOutputCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u ResponseCustomToolCallOutputCallerUnion) AsDirect() (v ResponseCustomToolCallOutputCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseCustomToolCallOutputCallerUnion) AsProgram() (v ResponseCustomToolCallOutputCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseCustomToolCallOutputCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseCustomToolCallOutputCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseCustomToolCallOutputCallerDirect struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseCustomToolCallOutputCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *ResponseCustomToolCallOutputCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseCustomToolCallOutputCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseCustomToolCallOutputCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *ResponseCustomToolCallOutputCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// The output of a custom tool call from your code, being sent back to the model.
//
// The properties CallID, Output, Type are required.
@@ -6361,6 +7373,8 @@ type ResponseCustomToolCallOutputParam struct {
Output ResponseCustomToolCallOutputOutputUnionParam `json:"output,omitzero" api:"required"`
// The unique ID of the custom tool call output in the OpenAI platform.
ID param.Opt[string] `json:"id,omitzero"`
+ // The execution context that produced this tool call.
+ Caller ResponseCustomToolCallOutputCallerUnionParam `json:"caller,omitzero"`
// The type of the custom tool call output. Always `custom_tool_call_output`.
//
// This field can be elided, and will marshal its zero value as
@@ -6502,6 +7516,51 @@ func (u ResponseCustomToolCallOutputOutputOutputContentListItemUnionParam) GetFi
return nil
}
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u ResponseCustomToolCallOutputOutputOutputContentListItemUnionParam) GetPromptCacheBreakpoint() (res responseCustomToolCallOutputOutputOutputContentListItemUnionParamPromptCacheBreakpoint) {
+ if vt := u.OfInputText; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ } else if vt := u.OfInputImage; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ } else if vt := u.OfInputFile; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ }
+ return
+}
+
+// Can have the runtime types [*ResponseInputTextPromptCacheBreakpointParam],
+// [*ResponseInputImagePromptCacheBreakpointParam],
+// [*ResponseInputFilePromptCacheBreakpointParam]
+type responseCustomToolCallOutputOutputOutputContentListItemUnionParamPromptCacheBreakpoint struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *responses.ResponseInputTextPromptCacheBreakpointParam:
+// case *responses.ResponseInputImagePromptCacheBreakpointParam:
+// case *responses.ResponseInputFilePromptCacheBreakpointParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u responseCustomToolCallOutputOutputOutputContentListItemUnionParamPromptCacheBreakpoint) AsAny() any {
+ return u.any
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u responseCustomToolCallOutputOutputOutputContentListItemUnionParamPromptCacheBreakpoint) GetMode() *string {
+ switch vt := u.any.(type) {
+ case *ResponseInputTextPromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ case *ResponseInputImagePromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ case *ResponseInputFilePromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ }
+ return nil
+}
+
func init() {
apijson.RegisterUnion[ResponseCustomToolCallOutputOutputOutputContentListItemUnionParam](
"type",
@@ -6511,6 +7570,98 @@ func init() {
)
}
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseCustomToolCallOutputCallerUnionParam struct {
+ OfDirect *ResponseCustomToolCallOutputCallerDirectParam `json:",omitzero,inline"`
+ OfProgram *ResponseCustomToolCallOutputCallerProgramParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ResponseCustomToolCallOutputCallerUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfDirect, u.OfProgram)
+}
+func (u *ResponseCustomToolCallOutputCallerUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ResponseCustomToolCallOutputCallerUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfDirect) {
+ return u.OfDirect
+ } else if !param.IsOmitted(u.OfProgram) {
+ return u.OfProgram
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseCustomToolCallOutputCallerUnionParam) GetCallerID() *string {
+ if vt := u.OfProgram; vt != nil {
+ return &vt.CallerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseCustomToolCallOutputCallerUnionParam) GetType() *string {
+ if vt := u.OfDirect; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[ResponseCustomToolCallOutputCallerUnionParam](
+ "type",
+ apijson.Discriminator[ResponseCustomToolCallOutputCallerDirectParam]("direct"),
+ apijson.Discriminator[ResponseCustomToolCallOutputCallerProgramParam]("program"),
+ )
+}
+
+func NewResponseCustomToolCallOutputCallerDirectParam() ResponseCustomToolCallOutputCallerDirectParam {
+ return ResponseCustomToolCallOutputCallerDirectParam{
+ Type: "direct",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewResponseCustomToolCallOutputCallerDirectParam].
+type ResponseCustomToolCallOutputCallerDirectParam struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ paramObj
+}
+
+func (r ResponseCustomToolCallOutputCallerDirectParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseCustomToolCallOutputCallerDirectParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseCustomToolCallOutputCallerDirectParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties CallerID, Type are required.
+type ResponseCustomToolCallOutputCallerProgramParam struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ //
+ // This field can be elided, and will marshal its zero value as "program".
+ Type constant.Program `json:"type" default:"program"`
+ paramObj
+}
+
+func (r ResponseCustomToolCallOutputCallerProgramParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseCustomToolCallOutputCallerProgramParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseCustomToolCallOutputCallerProgramParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// The output of a custom tool call from your code, being sent back to the model.
type ResponseCustomToolCallOutputItem struct {
// The unique ID of the custom tool call output item.
@@ -6544,11 +7695,12 @@ type ResponseError struct {
// The error code for the response.
//
// Any of "server_error", "rate_limit_exceeded", "invalid_prompt",
- // "vector_store_timeout", "invalid_image", "invalid_image_format",
- // "invalid_base64_image", "invalid_image_url", "image_too_large",
- // "image_too_small", "image_parse_error", "image_content_policy_violation",
- // "invalid_image_mode", "image_file_too_large", "unsupported_image_media_type",
- // "empty_image_file", "failed_to_download_image", "image_file_not_found".
+ // "data_residency_mismatch", "bio_policy", "vector_store_timeout",
+ // "invalid_image", "invalid_image_format", "invalid_base64_image",
+ // "invalid_image_url", "image_too_large", "image_too_small", "image_parse_error",
+ // "image_content_policy_violation", "invalid_image_mode", "image_file_too_large",
+ // "unsupported_image_media_type", "empty_image_file", "failed_to_download_image",
+ // "image_file_not_found".
Code ResponseErrorCode `json:"code" api:"required"`
// A human-readable description of the error.
Message string `json:"message" api:"required"`
@@ -6574,6 +7726,8 @@ const (
ResponseErrorCodeServerError ResponseErrorCode = "server_error"
ResponseErrorCodeRateLimitExceeded ResponseErrorCode = "rate_limit_exceeded"
ResponseErrorCodeInvalidPrompt ResponseErrorCode = "invalid_prompt"
+ ResponseErrorCodeDataResidencyMismatch ResponseErrorCode = "data_residency_mismatch"
+ ResponseErrorCodeBioPolicy ResponseErrorCode = "bio_policy"
ResponseErrorCodeVectorStoreTimeout ResponseErrorCode = "vector_store_timeout"
ResponseErrorCodeInvalidImage ResponseErrorCode = "invalid_image"
ResponseErrorCodeInvalidImageFormat ResponseErrorCode = "invalid_image_format"
@@ -7285,9 +8439,13 @@ type ResponseFunctionCallOutputItemUnion struct {
// This field is from variant [ResponseInputTextContent].
Text string `json:"text"`
// Any of "input_text", "input_image", "input_file".
- Type string `json:"type"`
- Detail string `json:"detail"`
- FileID string `json:"file_id"`
+ Type string `json:"type"`
+ // This field is a union of [ResponseInputTextContentPromptCacheBreakpoint],
+ // [ResponseInputImageContentPromptCacheBreakpoint],
+ // [ResponseInputFileContentPromptCacheBreakpoint]
+ PromptCacheBreakpoint ResponseFunctionCallOutputItemUnionPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
+ Detail string `json:"detail"`
+ FileID string `json:"file_id"`
// This field is from variant [ResponseInputImageContent].
ImageURL string `json:"image_url"`
// This field is from variant [ResponseInputFileContent].
@@ -7297,15 +8455,16 @@ type ResponseFunctionCallOutputItemUnion struct {
// This field is from variant [ResponseInputFileContent].
Filename string `json:"filename"`
JSON struct {
- Text respjson.Field
- Type respjson.Field
- Detail respjson.Field
- FileID respjson.Field
- ImageURL respjson.Field
- FileData respjson.Field
- FileURL respjson.Field
- Filename respjson.Field
- raw string
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ Detail respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ FileData respjson.Field
+ FileURL respjson.Field
+ Filename respjson.Field
+ raw string
} `json:"-"`
}
@@ -7363,6 +8522,26 @@ func (r *ResponseFunctionCallOutputItemUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// ResponseFunctionCallOutputItemUnionPromptCacheBreakpoint is an implicit subunion
+// of [ResponseFunctionCallOutputItemUnion].
+// ResponseFunctionCallOutputItemUnionPromptCacheBreakpoint provides convenient
+// access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [ResponseFunctionCallOutputItemUnion].
+type ResponseFunctionCallOutputItemUnionPromptCacheBreakpoint struct {
+ // This field is from variant [ResponseInputTextContentPromptCacheBreakpoint].
+ Mode constant.Explicit `json:"mode"`
+ JSON struct {
+ Mode respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *ResponseFunctionCallOutputItemUnionPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// ToParam converts this ResponseFunctionCallOutputItemUnion to a
// ResponseFunctionCallOutputItemUnionParam.
//
@@ -7479,6 +8658,50 @@ func (u ResponseFunctionCallOutputItemUnionParam) GetFileID() *string {
return nil
}
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u ResponseFunctionCallOutputItemUnionParam) GetPromptCacheBreakpoint() (res responseFunctionCallOutputItemUnionParamPromptCacheBreakpoint) {
+ if vt := u.OfInputText; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ } else if vt := u.OfInputImage; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ } else if vt := u.OfInputFile; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ }
+ return
+}
+
+// Can have the runtime types
+// [*ResponseInputTextContentPromptCacheBreakpointParam],
+// [*ResponseInputImageContentPromptCacheBreakpointParam],
+// [*ResponseInputFileContentPromptCacheBreakpointParam]
+type responseFunctionCallOutputItemUnionParamPromptCacheBreakpoint struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *responses.ResponseInputTextContentPromptCacheBreakpointParam:
+// case *responses.ResponseInputImageContentPromptCacheBreakpointParam:
+// case *responses.ResponseInputFileContentPromptCacheBreakpointParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u responseFunctionCallOutputItemUnionParamPromptCacheBreakpoint) AsAny() any { return u.any }
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u responseFunctionCallOutputItemUnionParamPromptCacheBreakpoint) GetMode() *string {
+ switch vt := u.any.(type) {
+ case *ResponseInputTextContentPromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ case *ResponseInputImageContentPromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ case *ResponseInputFileContentPromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ }
+ return nil
+}
+
func init() {
apijson.RegisterUnion[ResponseFunctionCallOutputItemUnionParam](
"type",
@@ -7768,6 +8991,8 @@ type ResponseFunctionShellToolCall struct {
Status ResponseFunctionShellToolCallStatus `json:"status" api:"required"`
// The type of the item. Always `shell_call`.
Type constant.ShellCall `json:"type" default:"shell_call"`
+ // The execution context that produced this tool call.
+ Caller ResponseFunctionShellToolCallCallerUnion `json:"caller" api:"nullable"`
// The ID of the entity that created this tool call.
CreatedBy string `json:"created_by"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
@@ -7778,6 +9003,7 @@ type ResponseFunctionShellToolCall struct {
Environment respjson.Field
Status respjson.Field
Type respjson.Field
+ Caller respjson.Field
CreatedBy respjson.Field
ExtraFields map[string]respjson.Field
raw string
@@ -7889,64 +9115,167 @@ const (
ResponseFunctionShellToolCallStatusIncomplete ResponseFunctionShellToolCallStatus = "incomplete"
)
-// The output of a shell tool call that was emitted.
-type ResponseFunctionShellToolCallOutput struct {
- // The unique ID of the shell call output. Populated when this item is returned via
- // API.
- ID string `json:"id" api:"required"`
- // The unique ID of the shell tool call generated by the model.
- CallID string `json:"call_id" api:"required"`
- // The maximum length of the shell command output. This is generated by the model
- // and should be passed back with the raw output.
- MaxOutputLength int64 `json:"max_output_length" api:"required"`
- // An array of shell call output contents
- Output []ResponseFunctionShellToolCallOutputOutput `json:"output" api:"required"`
- // The status of the shell call output. One of `in_progress`, `completed`, or
- // `incomplete`.
- //
- // Any of "in_progress", "completed", "incomplete".
- Status ResponseFunctionShellToolCallOutputStatus `json:"status" api:"required"`
- // The type of the shell call output. Always `shell_call_output`.
- Type constant.ShellCallOutput `json:"type" default:"shell_call_output"`
- // The identifier of the actor that created the item.
- CreatedBy string `json:"created_by"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ID respjson.Field
- CallID respjson.Field
- MaxOutputLength respjson.Field
- Output respjson.Field
- Status respjson.Field
- Type respjson.Field
- CreatedBy respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+// ResponseFunctionShellToolCallCallerUnion contains all possible properties and
+// values from [ResponseFunctionShellToolCallCallerDirect],
+// [ResponseFunctionShellToolCallCallerProgram].
+//
+// Use the [ResponseFunctionShellToolCallCallerUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseFunctionShellToolCallCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [ResponseFunctionShellToolCallCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
} `json:"-"`
}
-// Returns the unmodified JSON received from the API
-func (r ResponseFunctionShellToolCallOutput) RawJSON() string { return r.JSON.raw }
-func (r *ResponseFunctionShellToolCallOutput) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
+// anyResponseFunctionShellToolCallCaller is implemented by each variant of
+// [ResponseFunctionShellToolCallCallerUnion] to add type safety for the return
+// type of [ResponseFunctionShellToolCallCallerUnion.AsAny]
+type anyResponseFunctionShellToolCallCaller interface {
+ implResponseFunctionShellToolCallCallerUnion()
}
-func (ResponseFunctionShellToolCallOutput) ImplConversationItemUnion() {}
+func (ResponseFunctionShellToolCallCallerDirect) implResponseFunctionShellToolCallCallerUnion() {}
+func (ResponseFunctionShellToolCallCallerProgram) implResponseFunctionShellToolCallCallerUnion() {}
-// The content of a shell tool call output that was emitted.
-type ResponseFunctionShellToolCallOutputOutput struct {
- // Represents either an exit outcome (with an exit code) or a timeout outcome for a
- // shell call output chunk.
- Outcome ResponseFunctionShellToolCallOutputOutputOutcomeUnion `json:"outcome" api:"required"`
- // The standard error output that was captured.
- Stderr string `json:"stderr" api:"required"`
- // The standard output that was captured.
- Stdout string `json:"stdout" api:"required"`
- // The identifier of the actor that created the item.
- CreatedBy string `json:"created_by"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Outcome respjson.Field
- Stderr respjson.Field
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseFunctionShellToolCallCallerUnion.AsAny().(type) {
+// case responses.ResponseFunctionShellToolCallCallerDirect:
+// case responses.ResponseFunctionShellToolCallCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseFunctionShellToolCallCallerUnion) AsAny() anyResponseFunctionShellToolCallCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u ResponseFunctionShellToolCallCallerUnion) AsDirect() (v ResponseFunctionShellToolCallCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseFunctionShellToolCallCallerUnion) AsProgram() (v ResponseFunctionShellToolCallCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseFunctionShellToolCallCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseFunctionShellToolCallCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseFunctionShellToolCallCallerDirect struct {
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseFunctionShellToolCallCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *ResponseFunctionShellToolCallCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseFunctionShellToolCallCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseFunctionShellToolCallCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *ResponseFunctionShellToolCallCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The output of a shell tool call that was emitted.
+type ResponseFunctionShellToolCallOutput struct {
+ // The unique ID of the shell call output. Populated when this item is returned via
+ // API.
+ ID string `json:"id" api:"required"`
+ // The unique ID of the shell tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // The maximum length of the shell command output. This is generated by the model
+ // and should be passed back with the raw output.
+ MaxOutputLength int64 `json:"max_output_length" api:"required"`
+ // An array of shell call output contents
+ Output []ResponseFunctionShellToolCallOutputOutput `json:"output" api:"required"`
+ // The status of the shell call output. One of `in_progress`, `completed`, or
+ // `incomplete`.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status ResponseFunctionShellToolCallOutputStatus `json:"status" api:"required"`
+ // The type of the shell call output. Always `shell_call_output`.
+ Type constant.ShellCallOutput `json:"type" default:"shell_call_output"`
+ // The execution context that produced this tool call.
+ Caller ResponseFunctionShellToolCallOutputCallerUnion `json:"caller" api:"nullable"`
+ // The identifier of the actor that created the item.
+ CreatedBy string `json:"created_by"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ MaxOutputLength respjson.Field
+ Output respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Caller respjson.Field
+ CreatedBy respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseFunctionShellToolCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *ResponseFunctionShellToolCallOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (ResponseFunctionShellToolCallOutput) ImplConversationItemUnion() {}
+
+// The content of a shell tool call output that was emitted.
+type ResponseFunctionShellToolCallOutputOutput struct {
+ // Represents either an exit outcome (with an exit code) or a timeout outcome for a
+ // shell call output chunk.
+ Outcome ResponseFunctionShellToolCallOutputOutputOutcomeUnion `json:"outcome" api:"required"`
+ // The standard error output that was captured.
+ Stderr string `json:"stderr" api:"required"`
+ // The standard output that was captured.
+ Stdout string `json:"stdout" api:"required"`
+ // The identifier of the actor that created the item.
+ CreatedBy string `json:"created_by"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Outcome respjson.Field
+ Stderr respjson.Field
Stdout respjson.Field
CreatedBy respjson.Field
ExtraFields map[string]respjson.Field
@@ -8079,6 +9408,108 @@ const (
ResponseFunctionShellToolCallOutputStatusIncomplete ResponseFunctionShellToolCallOutputStatus = "incomplete"
)
+// ResponseFunctionShellToolCallOutputCallerUnion contains all possible properties
+// and values from [ResponseFunctionShellToolCallOutputCallerDirect],
+// [ResponseFunctionShellToolCallOutputCallerProgram].
+//
+// Use the [ResponseFunctionShellToolCallOutputCallerUnion.AsAny] method to switch
+// on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseFunctionShellToolCallOutputCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [ResponseFunctionShellToolCallOutputCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyResponseFunctionShellToolCallOutputCaller is implemented by each variant of
+// [ResponseFunctionShellToolCallOutputCallerUnion] to add type safety for the
+// return type of [ResponseFunctionShellToolCallOutputCallerUnion.AsAny]
+type anyResponseFunctionShellToolCallOutputCaller interface {
+ implResponseFunctionShellToolCallOutputCallerUnion()
+}
+
+func (ResponseFunctionShellToolCallOutputCallerDirect) implResponseFunctionShellToolCallOutputCallerUnion() {
+}
+func (ResponseFunctionShellToolCallOutputCallerProgram) implResponseFunctionShellToolCallOutputCallerUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseFunctionShellToolCallOutputCallerUnion.AsAny().(type) {
+// case responses.ResponseFunctionShellToolCallOutputCallerDirect:
+// case responses.ResponseFunctionShellToolCallOutputCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseFunctionShellToolCallOutputCallerUnion) AsAny() anyResponseFunctionShellToolCallOutputCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u ResponseFunctionShellToolCallOutputCallerUnion) AsDirect() (v ResponseFunctionShellToolCallOutputCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseFunctionShellToolCallOutputCallerUnion) AsProgram() (v ResponseFunctionShellToolCallOutputCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseFunctionShellToolCallOutputCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseFunctionShellToolCallOutputCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseFunctionShellToolCallOutputCallerDirect struct {
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseFunctionShellToolCallOutputCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *ResponseFunctionShellToolCallOutputCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseFunctionShellToolCallOutputCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseFunctionShellToolCallOutputCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *ResponseFunctionShellToolCallOutputCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A tool call to run a function. See the
// [function calling guide](https://platform.openai.com/docs/guides/function-calling)
// for more information.
@@ -8093,6 +9524,8 @@ type ResponseFunctionToolCall struct {
Type constant.FunctionCall `json:"type" default:"function_call"`
// The unique ID of the function tool call.
ID string `json:"id"`
+ // The execution context that produced this tool call.
+ Caller ResponseFunctionToolCallCallerUnion `json:"caller" api:"nullable"`
// The namespace of the function to run.
Namespace string `json:"namespace"`
// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
@@ -8107,6 +9540,7 @@ type ResponseFunctionToolCall struct {
Name respjson.Field
Type respjson.Field
ID respjson.Field
+ Caller respjson.Field
Namespace respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
@@ -8130,6 +9564,106 @@ func (r ResponseFunctionToolCall) ToParam() ResponseFunctionToolCallParam {
return param.Override[ResponseFunctionToolCallParam](json.RawMessage(r.RawJSON()))
}
+// ResponseFunctionToolCallCallerUnion contains all possible properties and values
+// from [ResponseFunctionToolCallCallerDirect],
+// [ResponseFunctionToolCallCallerProgram].
+//
+// Use the [ResponseFunctionToolCallCallerUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseFunctionToolCallCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [ResponseFunctionToolCallCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyResponseFunctionToolCallCaller is implemented by each variant of
+// [ResponseFunctionToolCallCallerUnion] to add type safety for the return type of
+// [ResponseFunctionToolCallCallerUnion.AsAny]
+type anyResponseFunctionToolCallCaller interface {
+ implResponseFunctionToolCallCallerUnion()
+}
+
+func (ResponseFunctionToolCallCallerDirect) implResponseFunctionToolCallCallerUnion() {}
+func (ResponseFunctionToolCallCallerProgram) implResponseFunctionToolCallCallerUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseFunctionToolCallCallerUnion.AsAny().(type) {
+// case responses.ResponseFunctionToolCallCallerDirect:
+// case responses.ResponseFunctionToolCallCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseFunctionToolCallCallerUnion) AsAny() anyResponseFunctionToolCallCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u ResponseFunctionToolCallCallerUnion) AsDirect() (v ResponseFunctionToolCallCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseFunctionToolCallCallerUnion) AsProgram() (v ResponseFunctionToolCallCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseFunctionToolCallCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseFunctionToolCallCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseFunctionToolCallCallerDirect struct {
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseFunctionToolCallCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *ResponseFunctionToolCallCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseFunctionToolCallCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseFunctionToolCallCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *ResponseFunctionToolCallCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
// Populated when items are returned via API.
type ResponseFunctionToolCallStatus string
@@ -8156,6 +9690,8 @@ type ResponseFunctionToolCallParam struct {
ID param.Opt[string] `json:"id,omitzero"`
// The namespace of the function to run.
Namespace param.Opt[string] `json:"namespace,omitzero"`
+ // The execution context that produced this tool call.
+ Caller ResponseFunctionToolCallCallerUnionParam `json:"caller,omitzero"`
// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
// Populated when items are returned via API.
//
@@ -8176,6 +9712,95 @@ func (r *ResponseFunctionToolCallParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseFunctionToolCallCallerUnionParam struct {
+ OfDirect *ResponseFunctionToolCallCallerDirectParam `json:",omitzero,inline"`
+ OfProgram *ResponseFunctionToolCallCallerProgramParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ResponseFunctionToolCallCallerUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfDirect, u.OfProgram)
+}
+func (u *ResponseFunctionToolCallCallerUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ResponseFunctionToolCallCallerUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfDirect) {
+ return u.OfDirect
+ } else if !param.IsOmitted(u.OfProgram) {
+ return u.OfProgram
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseFunctionToolCallCallerUnionParam) GetCallerID() *string {
+ if vt := u.OfProgram; vt != nil {
+ return &vt.CallerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseFunctionToolCallCallerUnionParam) GetType() *string {
+ if vt := u.OfDirect; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[ResponseFunctionToolCallCallerUnionParam](
+ "type",
+ apijson.Discriminator[ResponseFunctionToolCallCallerDirectParam]("direct"),
+ apijson.Discriminator[ResponseFunctionToolCallCallerProgramParam]("program"),
+ )
+}
+
+func NewResponseFunctionToolCallCallerDirectParam() ResponseFunctionToolCallCallerDirectParam {
+ return ResponseFunctionToolCallCallerDirectParam{
+ Type: "direct",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewResponseFunctionToolCallCallerDirectParam].
+type ResponseFunctionToolCallCallerDirectParam struct {
+ Type constant.Direct `json:"type" default:"direct"`
+ paramObj
+}
+
+func (r ResponseFunctionToolCallCallerDirectParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseFunctionToolCallCallerDirectParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseFunctionToolCallCallerDirectParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties CallerID, Type are required.
+type ResponseFunctionToolCallCallerProgramParam struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // This field can be elided, and will marshal its zero value as "program".
+ Type constant.Program `json:"type" default:"program"`
+ paramObj
+}
+
+func (r ResponseFunctionToolCallCallerProgramParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseFunctionToolCallCallerProgramParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseFunctionToolCallCallerProgramParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A tool call to run a function. See the
// [function calling guide](https://platform.openai.com/docs/guides/function-calling)
// for more information.
@@ -8223,6 +9848,8 @@ type ResponseFunctionToolCallOutputItem struct {
Status ResponseFunctionToolCallOutputItemStatus `json:"status" api:"required"`
// The type of the function tool call output. Always `function_call_output`.
Type constant.FunctionCallOutput `json:"type" default:"function_call_output"`
+ // The execution context that produced this tool call.
+ Caller ResponseFunctionToolCallOutputItemCallerUnion `json:"caller" api:"nullable"`
// The identifier of the actor that created the item.
CreatedBy string `json:"created_by"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
@@ -8232,6 +9859,7 @@ type ResponseFunctionToolCallOutputItem struct {
Output respjson.Field
Status respjson.Field
Type respjson.Field
+ Caller respjson.Field
CreatedBy respjson.Field
ExtraFields map[string]respjson.Field
raw string
@@ -8298,9 +9926,13 @@ type ResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion struct {
// This field is from variant [ResponseInputText].
Text string `json:"text"`
// Any of "input_text", "input_image", "input_file".
- Type string `json:"type"`
- Detail string `json:"detail"`
- FileID string `json:"file_id"`
+ Type string `json:"type"`
+ // This field is a union of [ResponseInputTextPromptCacheBreakpoint],
+ // [ResponseInputImagePromptCacheBreakpoint],
+ // [ResponseInputFilePromptCacheBreakpoint]
+ PromptCacheBreakpoint ResponseFunctionToolCallOutputItemOutputOutputContentListItemUnionPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
+ Detail string `json:"detail"`
+ FileID string `json:"file_id"`
// This field is from variant [ResponseInputImage].
ImageURL string `json:"image_url"`
// This field is from variant [ResponseInputFile].
@@ -8310,15 +9942,16 @@ type ResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion struct {
// This field is from variant [ResponseInputFile].
Filename string `json:"filename"`
JSON struct {
- Text respjson.Field
- Type respjson.Field
- Detail respjson.Field
- FileID respjson.Field
- ImageURL respjson.Field
- FileData respjson.Field
- FileURL respjson.Field
- Filename respjson.Field
- raw string
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ Detail respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ FileData respjson.Field
+ FileURL respjson.Field
+ Filename respjson.Field
+ raw string
} `json:"-"`
}
@@ -8380,6 +10013,27 @@ func (r *ResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion) Unm
return apijson.UnmarshalRoot(data, r)
}
+// ResponseFunctionToolCallOutputItemOutputOutputContentListItemUnionPromptCacheBreakpoint
+// is an implicit subunion of
+// [ResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion].
+// ResponseFunctionToolCallOutputItemOutputOutputContentListItemUnionPromptCacheBreakpoint
+// provides convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [ResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion].
+type ResponseFunctionToolCallOutputItemOutputOutputContentListItemUnionPromptCacheBreakpoint struct {
+ // This field is from variant [ResponseInputTextPromptCacheBreakpoint].
+ Mode constant.Explicit `json:"mode"`
+ JSON struct {
+ Mode respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *ResponseFunctionToolCallOutputItemOutputOutputContentListItemUnionPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
// Populated when items are returned via API.
type ResponseFunctionToolCallOutputItemStatus string
@@ -8390,6 +10044,110 @@ const (
ResponseFunctionToolCallOutputItemStatusIncomplete ResponseFunctionToolCallOutputItemStatus = "incomplete"
)
+// ResponseFunctionToolCallOutputItemCallerUnion contains all possible properties
+// and values from [ResponseFunctionToolCallOutputItemCallerDirect],
+// [ResponseFunctionToolCallOutputItemCallerProgram].
+//
+// Use the [ResponseFunctionToolCallOutputItemCallerUnion.AsAny] method to switch
+// on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseFunctionToolCallOutputItemCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [ResponseFunctionToolCallOutputItemCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyResponseFunctionToolCallOutputItemCaller is implemented by each variant of
+// [ResponseFunctionToolCallOutputItemCallerUnion] to add type safety for the
+// return type of [ResponseFunctionToolCallOutputItemCallerUnion.AsAny]
+type anyResponseFunctionToolCallOutputItemCaller interface {
+ implResponseFunctionToolCallOutputItemCallerUnion()
+}
+
+func (ResponseFunctionToolCallOutputItemCallerDirect) implResponseFunctionToolCallOutputItemCallerUnion() {
+}
+func (ResponseFunctionToolCallOutputItemCallerProgram) implResponseFunctionToolCallOutputItemCallerUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseFunctionToolCallOutputItemCallerUnion.AsAny().(type) {
+// case responses.ResponseFunctionToolCallOutputItemCallerDirect:
+// case responses.ResponseFunctionToolCallOutputItemCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseFunctionToolCallOutputItemCallerUnion) AsAny() anyResponseFunctionToolCallOutputItemCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u ResponseFunctionToolCallOutputItemCallerUnion) AsDirect() (v ResponseFunctionToolCallOutputItemCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseFunctionToolCallOutputItemCallerUnion) AsProgram() (v ResponseFunctionToolCallOutputItemCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseFunctionToolCallOutputItemCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseFunctionToolCallOutputItemCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseFunctionToolCallOutputItemCallerDirect struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseFunctionToolCallOutputItemCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *ResponseFunctionToolCallOutputItemCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseFunctionToolCallOutputItemCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseFunctionToolCallOutputItemCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *ResponseFunctionToolCallOutputItemCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// The results of a web search tool call. See the
// [web search guide](https://platform.openai.com/docs/guides/tools-web-search) for
// more information.
@@ -8444,21 +10202,21 @@ func (r ResponseFunctionWebSearch) ToParam() ResponseFunctionWebSearchParam {
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
type ResponseFunctionWebSearchActionUnion struct {
- // This field is from variant [ResponseFunctionWebSearchActionSearch].
- Query string `json:"query"`
// Any of "search", "open_page", "find_in_page".
Type string `json:"type"`
// This field is from variant [ResponseFunctionWebSearchActionSearch].
Queries []string `json:"queries"`
// This field is from variant [ResponseFunctionWebSearchActionSearch].
+ Query string `json:"query"`
+ // This field is from variant [ResponseFunctionWebSearchActionSearch].
Sources []ResponseFunctionWebSearchActionSearchSource `json:"sources"`
URL string `json:"url"`
// This field is from variant [ResponseFunctionWebSearchActionFind].
Pattern string `json:"pattern"`
JSON struct {
- Query respjson.Field
Type respjson.Field
Queries respjson.Field
+ Query respjson.Field
Sources respjson.Field
URL respjson.Field
Pattern respjson.Field
@@ -8522,19 +10280,21 @@ func (r *ResponseFunctionWebSearchActionUnion) UnmarshalJSON(data []byte) error
// Action type "search" - Performs a web search query.
type ResponseFunctionWebSearchActionSearch struct {
- // [DEPRECATED] The search query.
- Query string `json:"query" api:"required"`
// The action type.
Type constant.Search `json:"type" default:"search"`
// The search queries.
Queries []string `json:"queries"`
+ // The search query.
+ //
+ // Deprecated: deprecated
+ Query string `json:"query"`
// The sources used in the search.
Sources []ResponseFunctionWebSearchActionSearchSource `json:"sources"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Query respjson.Field
Type respjson.Field
Queries respjson.Field
+ Query respjson.Field
Sources respjson.Field
ExtraFields map[string]respjson.Field
raw string
@@ -8552,7 +10312,7 @@ type ResponseFunctionWebSearchActionSearchSource struct {
// The type of source. Always `url`.
Type constant.URL `json:"type" default:"url"`
// The URL of the source.
- URL string `json:"url" api:"required"`
+ URL string `json:"url" api:"required" format:"uri"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
@@ -8682,17 +10442,17 @@ func (u *ResponseFunctionWebSearchActionUnionParam) asAny() any {
}
// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseFunctionWebSearchActionUnionParam) GetQuery() *string {
+func (u ResponseFunctionWebSearchActionUnionParam) GetQueries() []string {
if vt := u.OfSearch; vt != nil {
- return &vt.Query
+ return vt.Queries
}
return nil
}
// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseFunctionWebSearchActionUnionParam) GetQueries() []string {
- if vt := u.OfSearch; vt != nil {
- return vt.Queries
+func (u ResponseFunctionWebSearchActionUnionParam) GetQuery() *string {
+ if vt := u.OfSearch; vt != nil && vt.Query.Valid() {
+ return &vt.Query.Value
}
return nil
}
@@ -8746,10 +10506,12 @@ func init() {
// Action type "search" - Performs a web search query.
//
-// The properties Query, Type are required.
+// The property Type is required.
type ResponseFunctionWebSearchActionSearchParam struct {
- // [DEPRECATED] The search query.
- Query string `json:"query" api:"required"`
+ // The search query.
+ //
+ // Deprecated: deprecated
+ Query param.Opt[string] `json:"query,omitzero"`
// The search queries.
Queries []string `json:"queries,omitzero"`
// The sources used in the search.
@@ -8774,7 +10536,7 @@ func (r *ResponseFunctionWebSearchActionSearchParam) UnmarshalJSON(data []byte)
// The properties Type, URL are required.
type ResponseFunctionWebSearchActionSearchSourceParam struct {
// The URL of the source.
- URL string `json:"url" api:"required"`
+ URL string `json:"url" api:"required" format:"uri"`
// The type of source. Always `url`.
//
// This field can be elided, and will marshal its zero value as "url".
@@ -8978,6 +10740,8 @@ func (r *ResponseInProgressEvent) UnmarshalJSON(data []byte) error {
// Specify additional output data to include in the model response. Currently
// supported values are:
//
+// - `web_search_call.results`: Include the search results of the web search tool
+// call.
// - `web_search_call.action.sources`: Include the sources of the web search tool
// call.
// - `code_interpreter_call.outputs`: Includes the outputs of python code execution
@@ -9138,9 +10902,13 @@ type ResponseInputContentUnion struct {
// This field is from variant [ResponseInputText].
Text string `json:"text"`
// Any of "input_text", "input_image", "input_file".
- Type string `json:"type"`
- Detail string `json:"detail"`
- FileID string `json:"file_id"`
+ Type string `json:"type"`
+ // This field is a union of [ResponseInputTextPromptCacheBreakpoint],
+ // [ResponseInputImagePromptCacheBreakpoint],
+ // [ResponseInputFilePromptCacheBreakpoint]
+ PromptCacheBreakpoint ResponseInputContentUnionPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
+ Detail string `json:"detail"`
+ FileID string `json:"file_id"`
// This field is from variant [ResponseInputImage].
ImageURL string `json:"image_url"`
// This field is from variant [ResponseInputFile].
@@ -9150,15 +10918,16 @@ type ResponseInputContentUnion struct {
// This field is from variant [ResponseInputFile].
Filename string `json:"filename"`
JSON struct {
- Text respjson.Field
- Type respjson.Field
- Detail respjson.Field
- FileID respjson.Field
- ImageURL respjson.Field
- FileData respjson.Field
- FileURL respjson.Field
- Filename respjson.Field
- raw string
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ Detail respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ FileData respjson.Field
+ FileURL respjson.Field
+ Filename respjson.Field
+ raw string
} `json:"-"`
}
@@ -9216,6 +10985,25 @@ func (r *ResponseInputContentUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// ResponseInputContentUnionPromptCacheBreakpoint is an implicit subunion of
+// [ResponseInputContentUnion]. ResponseInputContentUnionPromptCacheBreakpoint
+// provides convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [ResponseInputContentUnion].
+type ResponseInputContentUnionPromptCacheBreakpoint struct {
+ // This field is from variant [ResponseInputTextPromptCacheBreakpoint].
+ Mode constant.Explicit `json:"mode"`
+ JSON struct {
+ Mode respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *ResponseInputContentUnionPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// ToParam converts this ResponseInputContentUnion to a
// ResponseInputContentUnionParam.
//
@@ -9338,6 +11126,49 @@ func (u ResponseInputContentUnionParam) GetFileID() *string {
return nil
}
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u ResponseInputContentUnionParam) GetPromptCacheBreakpoint() (res responseInputContentUnionParamPromptCacheBreakpoint) {
+ if vt := u.OfInputText; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ } else if vt := u.OfInputImage; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ } else if vt := u.OfInputFile; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ }
+ return
+}
+
+// Can have the runtime types [*ResponseInputTextPromptCacheBreakpointParam],
+// [*ResponseInputImagePromptCacheBreakpointParam],
+// [*ResponseInputFilePromptCacheBreakpointParam]
+type responseInputContentUnionParamPromptCacheBreakpoint struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *responses.ResponseInputTextPromptCacheBreakpointParam:
+// case *responses.ResponseInputImagePromptCacheBreakpointParam:
+// case *responses.ResponseInputFilePromptCacheBreakpointParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u responseInputContentUnionParamPromptCacheBreakpoint) AsAny() any { return u.any }
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u responseInputContentUnionParamPromptCacheBreakpoint) GetMode() *string {
+ switch vt := u.any.(type) {
+ case *ResponseInputTextPromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ case *ResponseInputImagePromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ case *ResponseInputFilePromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ }
+ return nil
+}
+
func init() {
apijson.RegisterUnion[ResponseInputContentUnionParam](
"type",
@@ -9351,30 +11182,37 @@ func init() {
type ResponseInputFile struct {
// The type of the input item. Always `input_file`.
Type constant.InputFile `json:"type" default:"input_file"`
- // The detail level of the file to be sent to the model. Use `low` for the default
- // rendering behavior, or `high` to render the file at higher quality. Defaults to
- // `low`.
+ // The detail level of the file to be sent to the model. Use `auto` to let the
+ // system select the detail level; for GPT-5.6 and later models, `auto` uses
+ // high-quality rendering, which may increase input token usage. Use `low` for
+ // lower-cost rendering, or `high` to render the file at higher quality. Defaults
+ // to `auto`.
//
- // Any of "low", "high".
+ // Any of "auto", "low", "high".
Detail ResponseInputFileDetail `json:"detail"`
// The content of the file to be sent to the model.
FileData string `json:"file_data"`
// The ID of the file to be sent to the model.
FileID string `json:"file_id" api:"nullable"`
// The URL of the file to be sent to the model.
- FileURL string `json:"file_url"`
+ FileURL string `json:"file_url" format:"uri"`
// The name of the file to be sent to the model.
Filename string `json:"filename"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint ResponseInputFilePromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Type respjson.Field
- Detail respjson.Field
- FileData respjson.Field
- FileID respjson.Field
- FileURL respjson.Field
- Filename respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Type respjson.Field
+ Detail respjson.Field
+ FileData respjson.Field
+ FileID respjson.Field
+ FileURL respjson.Field
+ Filename respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -9395,16 +11233,39 @@ func (r ResponseInputFile) ToParam() ResponseInputFileParam {
return param.Override[ResponseInputFileParam](json.RawMessage(r.RawJSON()))
}
-// The detail level of the file to be sent to the model. Use `low` for the default
-// rendering behavior, or `high` to render the file at higher quality. Defaults to
-// `low`.
+// The detail level of the file to be sent to the model. Use `auto` to let the
+// system select the detail level; for GPT-5.6 and later models, `auto` uses
+// high-quality rendering, which may increase input token usage. Use `low` for
+// lower-cost rendering, or `high` to render the file at higher quality. Defaults
+// to `auto`.
type ResponseInputFileDetail string
const (
+ ResponseInputFileDetailAuto ResponseInputFileDetail = "auto"
ResponseInputFileDetailLow ResponseInputFileDetail = "low"
ResponseInputFileDetailHigh ResponseInputFileDetail = "high"
)
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+type ResponseInputFilePromptCacheBreakpoint struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Mode respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputFilePromptCacheBreakpoint) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputFilePromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A file input to the model.
//
// The property Type is required.
@@ -9414,15 +11275,21 @@ type ResponseInputFileParam struct {
// The content of the file to be sent to the model.
FileData param.Opt[string] `json:"file_data,omitzero"`
// The URL of the file to be sent to the model.
- FileURL param.Opt[string] `json:"file_url,omitzero"`
+ FileURL param.Opt[string] `json:"file_url,omitzero" format:"uri"`
// The name of the file to be sent to the model.
Filename param.Opt[string] `json:"filename,omitzero"`
- // The detail level of the file to be sent to the model. Use `low` for the default
- // rendering behavior, or `high` to render the file at higher quality. Defaults to
- // `low`.
+ // The detail level of the file to be sent to the model. Use `auto` to let the
+ // system select the detail level; for GPT-5.6 and later models, `auto` uses
+ // high-quality rendering, which may increase input token usage. Use `low` for
+ // lower-cost rendering, or `high` to render the file at higher quality. Defaults
+ // to `auto`.
//
- // Any of "low", "high".
+ // Any of "auto", "low", "high".
Detail ResponseInputFileDetail `json:"detail,omitzero"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint ResponseInputFilePromptCacheBreakpointParam `json:"prompt_cache_breakpoint,omitzero"`
// The type of the input item. Always `input_file`.
//
// This field can be elided, and will marshal its zero value as "input_file".
@@ -9438,34 +11305,67 @@ func (r *ResponseInputFileParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+func NewResponseInputFilePromptCacheBreakpointParam() ResponseInputFilePromptCacheBreakpointParam {
+ return ResponseInputFilePromptCacheBreakpointParam{
+ Mode: "explicit",
+ }
+}
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+//
+// This struct has a constant value, construct it with
+// [NewResponseInputFilePromptCacheBreakpointParam].
+type ResponseInputFilePromptCacheBreakpointParam struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ paramObj
+}
+
+func (r ResponseInputFilePromptCacheBreakpointParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputFilePromptCacheBreakpointParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputFilePromptCacheBreakpointParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A file input to the model.
type ResponseInputFileContent struct {
// The type of the input item. Always `input_file`.
Type constant.InputFile `json:"type" default:"input_file"`
- // The detail level of the file to be sent to the model. Use `low` for the default
- // rendering behavior, or `high` to render the file at higher quality. Defaults to
- // `low`.
+ // The detail level of the file to be sent to the model. Use `auto` to let the
+ // system select the detail level; for GPT-5.6 and later models, `auto` uses
+ // high-quality rendering, which may increase input token usage. Use `low` for
+ // lower-cost rendering, or `high` to render the file at higher quality. Defaults
+ // to `auto`.
//
- // Any of "low", "high".
+ // Any of "auto", "low", "high".
Detail ResponseInputFileContentDetail `json:"detail"`
// The base64-encoded data of the file to be sent to the model.
FileData string `json:"file_data" api:"nullable"`
// The ID of the file to be sent to the model.
FileID string `json:"file_id" api:"nullable"`
// The URL of the file to be sent to the model.
- FileURL string `json:"file_url" api:"nullable"`
+ FileURL string `json:"file_url" api:"nullable" format:"uri"`
// The name of the file to be sent to the model.
Filename string `json:"filename" api:"nullable"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint ResponseInputFileContentPromptCacheBreakpoint `json:"prompt_cache_breakpoint" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Type respjson.Field
- Detail respjson.Field
- FileData respjson.Field
- FileID respjson.Field
- FileURL respjson.Field
- Filename respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Type respjson.Field
+ Detail respjson.Field
+ FileData respjson.Field
+ FileID respjson.Field
+ FileURL respjson.Field
+ Filename respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -9485,16 +11385,39 @@ func (r ResponseInputFileContent) ToParam() ResponseInputFileContentParam {
return param.Override[ResponseInputFileContentParam](json.RawMessage(r.RawJSON()))
}
-// The detail level of the file to be sent to the model. Use `low` for the default
-// rendering behavior, or `high` to render the file at higher quality. Defaults to
-// `low`.
+// The detail level of the file to be sent to the model. Use `auto` to let the
+// system select the detail level; for GPT-5.6 and later models, `auto` uses
+// high-quality rendering, which may increase input token usage. Use `low` for
+// lower-cost rendering, or `high` to render the file at higher quality. Defaults
+// to `auto`.
type ResponseInputFileContentDetail string
const (
+ ResponseInputFileContentDetailAuto ResponseInputFileContentDetail = "auto"
ResponseInputFileContentDetailLow ResponseInputFileContentDetail = "low"
ResponseInputFileContentDetailHigh ResponseInputFileContentDetail = "high"
)
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+type ResponseInputFileContentPromptCacheBreakpoint struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Mode respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputFileContentPromptCacheBreakpoint) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputFileContentPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A file input to the model.
//
// The property Type is required.
@@ -9504,14 +11427,20 @@ type ResponseInputFileContentParam struct {
// The ID of the file to be sent to the model.
FileID param.Opt[string] `json:"file_id,omitzero"`
// The URL of the file to be sent to the model.
- FileURL param.Opt[string] `json:"file_url,omitzero"`
+ FileURL param.Opt[string] `json:"file_url,omitzero" format:"uri"`
// The name of the file to be sent to the model.
Filename param.Opt[string] `json:"filename,omitzero"`
- // The detail level of the file to be sent to the model. Use `low` for the default
- // rendering behavior, or `high` to render the file at higher quality. Defaults to
- // `low`.
- //
- // Any of "low", "high".
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint ResponseInputFileContentPromptCacheBreakpointParam `json:"prompt_cache_breakpoint,omitzero"`
+ // The detail level of the file to be sent to the model. Use `auto` to let the
+ // system select the detail level; for GPT-5.6 and later models, `auto` uses
+ // high-quality rendering, which may increase input token usage. Use `low` for
+ // lower-cost rendering, or `high` to render the file at higher quality. Defaults
+ // to `auto`.
+ //
+ // Any of "auto", "low", "high".
Detail ResponseInputFileContentDetail `json:"detail,omitzero"`
// The type of the input item. Always `input_file`.
//
@@ -9528,6 +11457,32 @@ func (r *ResponseInputFileContentParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+func NewResponseInputFileContentPromptCacheBreakpointParam() ResponseInputFileContentPromptCacheBreakpointParam {
+ return ResponseInputFileContentPromptCacheBreakpointParam{
+ Mode: "explicit",
+ }
+}
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+//
+// This struct has a constant value, construct it with
+// [NewResponseInputFileContentPromptCacheBreakpointParam].
+type ResponseInputFileContentPromptCacheBreakpointParam struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ paramObj
+}
+
+func (r ResponseInputFileContentPromptCacheBreakpointParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputFileContentPromptCacheBreakpointParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputFileContentPromptCacheBreakpointParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// An image input to the model. Learn about
// [image inputs](https://platform.openai.com/docs/guides/vision).
type ResponseInputImage struct {
@@ -9540,17 +11495,22 @@ type ResponseInputImage struct {
Type constant.InputImage `json:"type" default:"input_image"`
// The ID of the file to be sent to the model.
FileID string `json:"file_id" api:"nullable"`
- // The URL of the image to be sent to the model. A fully qualified URL or base64
- // encoded image in a data URL.
- ImageURL string `json:"image_url" api:"nullable"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Detail respjson.Field
- Type respjson.Field
- FileID respjson.Field
- ImageURL respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ // The URL of the image to be sent to the model. A fully qualified URL or base64
+ // encoded image in a data URL.
+ ImageURL string `json:"image_url" api:"nullable" format:"uri"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint ResponseInputImagePromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Detail respjson.Field
+ Type respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -9582,6 +11542,26 @@ const (
ResponseInputImageDetailOriginal ResponseInputImageDetail = "original"
)
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+type ResponseInputImagePromptCacheBreakpoint struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Mode respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputImagePromptCacheBreakpoint) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputImagePromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// An image input to the model. Learn about
// [image inputs](https://platform.openai.com/docs/guides/vision).
//
@@ -9596,7 +11576,11 @@ type ResponseInputImageParam struct {
FileID param.Opt[string] `json:"file_id,omitzero"`
// The URL of the image to be sent to the model. A fully qualified URL or base64
// encoded image in a data URL.
- ImageURL param.Opt[string] `json:"image_url,omitzero"`
+ ImageURL param.Opt[string] `json:"image_url,omitzero" format:"uri"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint ResponseInputImagePromptCacheBreakpointParam `json:"prompt_cache_breakpoint,omitzero"`
// The type of the input item. Always `input_image`.
//
// This field can be elided, and will marshal its zero value as "input_image".
@@ -9612,6 +11596,32 @@ func (r *ResponseInputImageParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+func NewResponseInputImagePromptCacheBreakpointParam() ResponseInputImagePromptCacheBreakpointParam {
+ return ResponseInputImagePromptCacheBreakpointParam{
+ Mode: "explicit",
+ }
+}
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+//
+// This struct has a constant value, construct it with
+// [NewResponseInputImagePromptCacheBreakpointParam].
+type ResponseInputImagePromptCacheBreakpointParam struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ paramObj
+}
+
+func (r ResponseInputImagePromptCacheBreakpointParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputImagePromptCacheBreakpointParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputImagePromptCacheBreakpointParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// An image input to the model. Learn about
// [image inputs](https://platform.openai.com/docs/guides/vision)
type ResponseInputImageContent struct {
@@ -9626,15 +11636,20 @@ type ResponseInputImageContent struct {
FileID string `json:"file_id" api:"nullable"`
// The URL of the image to be sent to the model. A fully qualified URL or base64
// encoded image in a data URL.
- ImageURL string `json:"image_url" api:"nullable"`
+ ImageURL string `json:"image_url" api:"nullable" format:"uri"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint ResponseInputImageContentPromptCacheBreakpoint `json:"prompt_cache_breakpoint" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Type respjson.Field
- Detail respjson.Field
- FileID respjson.Field
- ImageURL respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Type respjson.Field
+ Detail respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -9665,6 +11680,26 @@ const (
ResponseInputImageContentDetailOriginal ResponseInputImageContentDetail = "original"
)
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+type ResponseInputImageContentPromptCacheBreakpoint struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Mode respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputImageContentPromptCacheBreakpoint) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputImageContentPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// An image input to the model. Learn about
// [image inputs](https://platform.openai.com/docs/guides/vision)
//
@@ -9674,12 +11709,16 @@ type ResponseInputImageContentParam struct {
FileID param.Opt[string] `json:"file_id,omitzero"`
// The URL of the image to be sent to the model. A fully qualified URL or base64
// encoded image in a data URL.
- ImageURL param.Opt[string] `json:"image_url,omitzero"`
+ ImageURL param.Opt[string] `json:"image_url,omitzero" format:"uri"`
// The detail level of the image to be sent to the model. One of `high`, `low`,
// `auto`, or `original`. Defaults to `auto`.
//
// Any of "low", "high", "auto", "original".
Detail ResponseInputImageContentDetail `json:"detail,omitzero"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint ResponseInputImageContentPromptCacheBreakpointParam `json:"prompt_cache_breakpoint,omitzero"`
// The type of the input item. Always `input_image`.
//
// This field can be elided, and will marshal its zero value as "input_image".
@@ -9695,21 +11734,49 @@ func (r *ResponseInputImageContentParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+func NewResponseInputImageContentPromptCacheBreakpointParam() ResponseInputImageContentPromptCacheBreakpointParam {
+ return ResponseInputImageContentPromptCacheBreakpointParam{
+ Mode: "explicit",
+ }
+}
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+//
+// This struct has a constant value, construct it with
+// [NewResponseInputImageContentPromptCacheBreakpointParam].
+type ResponseInputImageContentPromptCacheBreakpointParam struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ paramObj
+}
+
+func (r ResponseInputImageContentPromptCacheBreakpointParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputImageContentPromptCacheBreakpointParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputImageContentPromptCacheBreakpointParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// ResponseInputItemUnion contains all possible properties and values from
// [EasyInputMessage], [ResponseInputItemMessage], [ResponseOutputMessage],
// [ResponseFileSearchToolCall], [ResponseComputerToolCall],
// [ResponseInputItemComputerCallOutput], [ResponseFunctionWebSearch],
// [ResponseFunctionToolCall], [ResponseInputItemFunctionCallOutput],
// [ResponseInputItemToolSearchCall], [ResponseToolSearchOutputItemParamResp],
-// [ResponseReasoningItem], [ResponseCompactionItemParamResp],
-// [ResponseInputItemImageGenerationCall], [ResponseCodeInterpreterToolCall],
-// [ResponseInputItemLocalShellCall], [ResponseInputItemLocalShellCallOutput],
-// [ResponseInputItemShellCall], [ResponseInputItemShellCallOutput],
-// [ResponseInputItemApplyPatchCall], [ResponseInputItemApplyPatchCallOutput],
-// [ResponseInputItemMcpListTools], [ResponseInputItemMcpApprovalRequest],
-// [ResponseInputItemMcpApprovalResponse], [ResponseInputItemMcpCall],
-// [ResponseCustomToolCallOutput], [ResponseCustomToolCall],
-// [ResponseInputItemItemReference].
+// [ResponseInputItemAdditionalTools], [ResponseReasoningItem],
+// [ResponseCompactionItemParamResp], [ResponseInputItemImageGenerationCall],
+// [ResponseCodeInterpreterToolCall], [ResponseInputItemLocalShellCall],
+// [ResponseInputItemLocalShellCallOutput], [ResponseInputItemShellCall],
+// [ResponseInputItemShellCallOutput], [ResponseInputItemApplyPatchCall],
+// [ResponseInputItemApplyPatchCallOutput], [ResponseInputItemMcpListTools],
+// [ResponseInputItemMcpApprovalRequest], [ResponseInputItemMcpApprovalResponse],
+// [ResponseInputItemMcpCall], [ResponseCustomToolCallOutput],
+// [ResponseCustomToolCall], [ResponseInputItemCompactionTrigger],
+// [ResponseInputItemItemReference], [ResponseInputItemProgram],
+// [ResponseInputItemProgramOutput].
//
// Use the [ResponseInputItemUnion.AsAny] method to switch on the variant.
//
@@ -9723,12 +11790,14 @@ type ResponseInputItemUnion struct {
Phase string `json:"phase"`
// Any of "message", "message", "message", "file_search_call", "computer_call",
// "computer_call_output", "web_search_call", "function_call",
- // "function_call_output", "tool_search_call", "tool_search_output", "reasoning",
- // "compaction", "image_generation_call", "code_interpreter_call",
- // "local_shell_call", "local_shell_call_output", "shell_call",
- // "shell_call_output", "apply_patch_call", "apply_patch_call_output",
- // "mcp_list_tools", "mcp_approval_request", "mcp_approval_response", "mcp_call",
- // "custom_tool_call_output", "custom_tool_call", "item_reference".
+ // "function_call_output", "tool_search_call", "tool_search_output",
+ // "additional_tools", "reasoning", "compaction", "image_generation_call",
+ // "code_interpreter_call", "local_shell_call", "local_shell_call_output",
+ // "shell_call", "shell_call_output", "apply_patch_call",
+ // "apply_patch_call_output", "mcp_list_tools", "mcp_approval_request",
+ // "mcp_approval_response", "mcp_call", "custom_tool_call_output",
+ // "custom_tool_call", "compaction_trigger", "item_reference", "program",
+ // "program_output".
Type string `json:"type"`
Status string `json:"status"`
ID string `json:"id"`
@@ -9755,17 +11824,24 @@ type ResponseInputItemUnion struct {
// This field is a union of [string], [any], [string], [string]
Arguments ResponseInputItemUnionArguments `json:"arguments"`
Name string `json:"name"`
- Namespace string `json:"namespace"`
- Execution string `json:"execution"`
- // This field is a union of [[]ToolUnion], [[]ResponseInputItemMcpListToolsTool]
+ // This field is a union of [ResponseFunctionToolCallCallerUnion],
+ // [ResponseInputItemFunctionCallOutputCallerUnion],
+ // [ResponseInputItemShellCallCallerUnion],
+ // [ResponseInputItemShellCallOutputCallerUnion],
+ // [ResponseInputItemApplyPatchCallCallerUnion],
+ // [ResponseInputItemApplyPatchCallOutputCallerUnion],
+ // [ResponseCustomToolCallOutputCallerUnion], [ResponseCustomToolCallCallerUnion]
+ Caller ResponseInputItemUnionCaller `json:"caller"`
+ Namespace string `json:"namespace"`
+ Execution string `json:"execution"`
+ // This field is a union of [[]ToolUnion], [[]ToolUnion],
+ // [[]ResponseInputItemMcpListToolsTool]
Tools ResponseInputItemUnionTools `json:"tools"`
// This field is from variant [ResponseReasoningItem].
Summary []ResponseReasoningItemSummary `json:"summary"`
EncryptedContent string `json:"encrypted_content"`
- // This field is from variant [ResponseInputItemImageGenerationCall].
- Result string `json:"result"`
- // This field is from variant [ResponseCodeInterpreterToolCall].
- Code string `json:"code"`
+ Result string `json:"result"`
+ Code string `json:"code"`
// This field is from variant [ResponseCodeInterpreterToolCall].
ContainerID string `json:"container_id"`
// This field is from variant [ResponseCodeInterpreterToolCall].
@@ -9785,7 +11861,9 @@ type ResponseInputItemUnion struct {
Reason string `json:"reason"`
// This field is from variant [ResponseCustomToolCall].
Input string `json:"input"`
- JSON struct {
+ // This field is from variant [ResponseInputItemProgram].
+ Fingerprint string `json:"fingerprint"`
+ JSON struct {
Content respjson.Field
Role respjson.Field
Phase respjson.Field
@@ -9802,6 +11880,7 @@ type ResponseInputItemUnion struct {
AcknowledgedSafetyChecks respjson.Field
Arguments respjson.Field
Name respjson.Field
+ Caller respjson.Field
Namespace respjson.Field
Execution respjson.Field
Tools respjson.Field
@@ -9820,6 +11899,7 @@ type ResponseInputItemUnion struct {
Approve respjson.Field
Reason respjson.Field
Input respjson.Field
+ Fingerprint respjson.Field
raw string
} `json:"-"`
}
@@ -9841,6 +11921,7 @@ func (ResponseFunctionToolCall) implResponseInputItemUnion() {}
func (ResponseInputItemFunctionCallOutput) implResponseInputItemUnion() {}
func (ResponseInputItemToolSearchCall) implResponseInputItemUnion() {}
func (ResponseToolSearchOutputItemParamResp) implResponseInputItemUnion() {}
+func (ResponseInputItemAdditionalTools) implResponseInputItemUnion() {}
func (ResponseReasoningItem) implResponseInputItemUnion() {}
func (ResponseCompactionItemParamResp) implResponseInputItemUnion() {}
func (ResponseInputItemImageGenerationCall) implResponseInputItemUnion() {}
@@ -9857,7 +11938,10 @@ func (ResponseInputItemMcpApprovalResponse) implResponseInputItemUnion() {}
func (ResponseInputItemMcpCall) implResponseInputItemUnion() {}
func (ResponseCustomToolCallOutput) implResponseInputItemUnion() {}
func (ResponseCustomToolCall) implResponseInputItemUnion() {}
+func (ResponseInputItemCompactionTrigger) implResponseInputItemUnion() {}
func (ResponseInputItemItemReference) implResponseInputItemUnion() {}
+func (ResponseInputItemProgram) implResponseInputItemUnion() {}
+func (ResponseInputItemProgramOutput) implResponseInputItemUnion() {}
// Use the following switch statement to find the correct variant
//
@@ -9873,6 +11957,7 @@ func (ResponseInputItemItemReference) implResponseInputItemUnion() {}
// case responses.ResponseInputItemFunctionCallOutput:
// case responses.ResponseInputItemToolSearchCall:
// case responses.ResponseToolSearchOutputItemParamResp:
+// case responses.ResponseInputItemAdditionalTools:
// case responses.ResponseReasoningItem:
// case responses.ResponseCompactionItemParamResp:
// case responses.ResponseInputItemImageGenerationCall:
@@ -9889,7 +11974,10 @@ func (ResponseInputItemItemReference) implResponseInputItemUnion() {}
// case responses.ResponseInputItemMcpCall:
// case responses.ResponseCustomToolCallOutput:
// case responses.ResponseCustomToolCall:
+// case responses.ResponseInputItemCompactionTrigger:
// case responses.ResponseInputItemItemReference:
+// case responses.ResponseInputItemProgram:
+// case responses.ResponseInputItemProgramOutput:
// default:
// fmt.Errorf("no variant present")
// }
@@ -9913,6 +12001,8 @@ func (u ResponseInputItemUnion) AsAny() anyResponseInputItem {
return u.AsToolSearchCall()
case "tool_search_output":
return u.AsToolSearchOutput()
+ case "additional_tools":
+ return u.AsAdditionalTools()
case "reasoning":
return u.AsReasoning()
case "compaction":
@@ -9945,8 +12035,14 @@ func (u ResponseInputItemUnion) AsAny() anyResponseInputItem {
return u.AsCustomToolCallOutput()
case "custom_tool_call":
return u.AsCustomToolCall()
+ case "compaction_trigger":
+ return u.AsCompactionTrigger()
case "item_reference":
return u.AsItemReference()
+ case "program":
+ return u.AsProgram()
+ case "program_output":
+ return u.AsProgramOutput()
}
return nil
}
@@ -10006,6 +12102,11 @@ func (u ResponseInputItemUnion) AsToolSearchOutput() (v ResponseToolSearchOutput
return
}
+func (u ResponseInputItemUnion) AsAdditionalTools() (v ResponseInputItemAdditionalTools) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
func (u ResponseInputItemUnion) AsReasoning() (v ResponseReasoningItem) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
@@ -10086,11 +12187,26 @@ func (u ResponseInputItemUnion) AsCustomToolCall() (v ResponseCustomToolCall) {
return
}
+func (u ResponseInputItemUnion) AsCompactionTrigger() (v ResponseInputItemCompactionTrigger) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
func (u ResponseInputItemUnion) AsItemReference() (v ResponseInputItemItemReference) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
+func (u ResponseInputItemUnion) AsProgram() (v ResponseInputItemProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseInputItemUnion) AsProgramOutput() (v ResponseInputItemProgramOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
// Returns the unmodified JSON received from the API
func (u ResponseInputItemUnion) RawJSON() string { return u.JSON.raw }
@@ -10155,10 +12271,10 @@ type ResponseInputItemUnionAction struct {
// This field is from variant [ResponseComputerToolCallActionUnion].
Text string `json:"text"`
// This field is from variant [ResponseFunctionWebSearchActionUnion].
- Query string `json:"query"`
- // This field is from variant [ResponseFunctionWebSearchActionUnion].
Queries []string `json:"queries"`
// This field is from variant [ResponseFunctionWebSearchActionUnion].
+ Query string `json:"query"`
+ // This field is from variant [ResponseFunctionWebSearchActionUnion].
Sources []ResponseFunctionWebSearchActionSearchSource `json:"sources"`
URL string `json:"url"`
// This field is from variant [ResponseFunctionWebSearchActionUnion].
@@ -10186,8 +12302,8 @@ type ResponseInputItemUnionAction struct {
ScrollX respjson.Field
ScrollY respjson.Field
Text respjson.Field
- Query respjson.Field
Queries respjson.Field
+ Query respjson.Field
Sources respjson.Field
URL respjson.Field
Pattern respjson.Field
@@ -10276,6 +12392,26 @@ func (r *ResponseInputItemUnionArguments) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// ResponseInputItemUnionCaller is an implicit subunion of
+// [ResponseInputItemUnion]. ResponseInputItemUnionCaller provides convenient
+// access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [ResponseInputItemUnion].
+type ResponseInputItemUnionCaller struct {
+ Type string `json:"type"`
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *ResponseInputItemUnionCaller) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// ResponseInputItemUnionTools is an implicit subunion of [ResponseInputItemUnion].
// ResponseInputItemUnionTools provides convenient access to the sub-properties of
// the union.
@@ -10422,6 +12558,8 @@ type ResponseInputItemFunctionCallOutput struct {
// The unique ID of the function tool call output. Populated when this item is
// returned via API.
ID string `json:"id" api:"nullable"`
+ // The execution context that produced this tool call.
+ Caller ResponseInputItemFunctionCallOutputCallerUnion `json:"caller" api:"nullable"`
// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
// Populated when items are returned via API.
//
@@ -10433,6 +12571,7 @@ type ResponseInputItemFunctionCallOutput struct {
Output respjson.Field
Type respjson.Field
ID respjson.Field
+ Caller respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
raw string
@@ -10482,6 +12621,110 @@ func (r *ResponseInputItemFunctionCallOutputOutputUnion) UnmarshalJSON(data []by
return apijson.UnmarshalRoot(data, r)
}
+// ResponseInputItemFunctionCallOutputCallerUnion contains all possible properties
+// and values from [ResponseInputItemFunctionCallOutputCallerDirect],
+// [ResponseInputItemFunctionCallOutputCallerProgram].
+//
+// Use the [ResponseInputItemFunctionCallOutputCallerUnion.AsAny] method to switch
+// on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseInputItemFunctionCallOutputCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [ResponseInputItemFunctionCallOutputCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyResponseInputItemFunctionCallOutputCaller is implemented by each variant of
+// [ResponseInputItemFunctionCallOutputCallerUnion] to add type safety for the
+// return type of [ResponseInputItemFunctionCallOutputCallerUnion.AsAny]
+type anyResponseInputItemFunctionCallOutputCaller interface {
+ implResponseInputItemFunctionCallOutputCallerUnion()
+}
+
+func (ResponseInputItemFunctionCallOutputCallerDirect) implResponseInputItemFunctionCallOutputCallerUnion() {
+}
+func (ResponseInputItemFunctionCallOutputCallerProgram) implResponseInputItemFunctionCallOutputCallerUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseInputItemFunctionCallOutputCallerUnion.AsAny().(type) {
+// case responses.ResponseInputItemFunctionCallOutputCallerDirect:
+// case responses.ResponseInputItemFunctionCallOutputCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseInputItemFunctionCallOutputCallerUnion) AsAny() anyResponseInputItemFunctionCallOutputCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u ResponseInputItemFunctionCallOutputCallerUnion) AsDirect() (v ResponseInputItemFunctionCallOutputCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseInputItemFunctionCallOutputCallerUnion) AsProgram() (v ResponseInputItemFunctionCallOutputCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseInputItemFunctionCallOutputCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseInputItemFunctionCallOutputCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseInputItemFunctionCallOutputCallerDirect struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemFunctionCallOutputCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemFunctionCallOutputCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseInputItemFunctionCallOutputCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemFunctionCallOutputCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemFunctionCallOutputCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
type ResponseInputItemToolSearchCall struct {
// The arguments supplied to the tool search call.
Arguments any `json:"arguments" api:"required"`
@@ -10518,6 +12761,32 @@ func (r *ResponseInputItemToolSearchCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+type ResponseInputItemAdditionalTools struct {
+ // The role that provided the additional tools. Only `developer` is supported.
+ Role constant.Developer `json:"role" default:"developer"`
+ // A list of additional tools made available at this item.
+ Tools []ToolUnion `json:"tools" api:"required"`
+ // The item type. Always `additional_tools`.
+ Type constant.AdditionalTools `json:"type" default:"additional_tools"`
+ // The unique ID of this additional tools item.
+ ID string `json:"id" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Role respjson.Field
+ Tools respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemAdditionalTools) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemAdditionalTools) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// An image generation request made by the model.
type ResponseInputItemImageGenerationCall struct {
// The unique ID of the image generation call.
@@ -10652,6 +12921,8 @@ type ResponseInputItemShellCall struct {
// The unique ID of the shell tool call. Populated when this item is returned via
// API.
ID string `json:"id" api:"nullable"`
+ // The execution context that produced this tool call.
+ Caller ResponseInputItemShellCallCallerUnion `json:"caller" api:"nullable"`
// The environment to execute the shell commands in.
Environment ResponseInputItemShellCallEnvironmentUnion `json:"environment" api:"nullable"`
// The status of the shell call. One of `in_progress`, `completed`, or
@@ -10661,45 +12932,148 @@ type ResponseInputItemShellCall struct {
Status string `json:"status" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Action respjson.Field
- CallID respjson.Field
+ Action respjson.Field
+ CallID respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Caller respjson.Field
+ Environment respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemShellCall) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemShellCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The shell commands and limits that describe how to run the tool call.
+type ResponseInputItemShellCallAction struct {
+ // Ordered shell commands for the execution environment to run.
+ Commands []string `json:"commands" api:"required"`
+ // Maximum number of UTF-8 characters to capture from combined stdout and stderr
+ // output.
+ MaxOutputLength int64 `json:"max_output_length" api:"nullable"`
+ // Maximum wall-clock time in milliseconds to allow the shell commands to run.
+ TimeoutMs int64 `json:"timeout_ms" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Commands respjson.Field
+ MaxOutputLength respjson.Field
+ TimeoutMs respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemShellCallAction) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemShellCallAction) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ResponseInputItemShellCallCallerUnion contains all possible properties and
+// values from [ResponseInputItemShellCallCallerDirect],
+// [ResponseInputItemShellCallCallerProgram].
+//
+// Use the [ResponseInputItemShellCallCallerUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseInputItemShellCallCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [ResponseInputItemShellCallCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyResponseInputItemShellCallCaller is implemented by each variant of
+// [ResponseInputItemShellCallCallerUnion] to add type safety for the return type
+// of [ResponseInputItemShellCallCallerUnion.AsAny]
+type anyResponseInputItemShellCallCaller interface {
+ implResponseInputItemShellCallCallerUnion()
+}
+
+func (ResponseInputItemShellCallCallerDirect) implResponseInputItemShellCallCallerUnion() {}
+func (ResponseInputItemShellCallCallerProgram) implResponseInputItemShellCallCallerUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseInputItemShellCallCallerUnion.AsAny().(type) {
+// case responses.ResponseInputItemShellCallCallerDirect:
+// case responses.ResponseInputItemShellCallCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseInputItemShellCallCallerUnion) AsAny() anyResponseInputItemShellCallCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u ResponseInputItemShellCallCallerUnion) AsDirect() (v ResponseInputItemShellCallCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseInputItemShellCallCallerUnion) AsProgram() (v ResponseInputItemShellCallCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseInputItemShellCallCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseInputItemShellCallCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseInputItemShellCallCallerDirect struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
Type respjson.Field
- ID respjson.Field
- Environment respjson.Field
- Status respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
-func (r ResponseInputItemShellCall) RawJSON() string { return r.JSON.raw }
-func (r *ResponseInputItemShellCall) UnmarshalJSON(data []byte) error {
+func (r ResponseInputItemShellCallCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemShellCallCallerDirect) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// The shell commands and limits that describe how to run the tool call.
-type ResponseInputItemShellCallAction struct {
- // Ordered shell commands for the execution environment to run.
- Commands []string `json:"commands" api:"required"`
- // Maximum number of UTF-8 characters to capture from combined stdout and stderr
- // output.
- MaxOutputLength int64 `json:"max_output_length" api:"nullable"`
- // Maximum wall-clock time in milliseconds to allow the shell commands to run.
- TimeoutMs int64 `json:"timeout_ms" api:"nullable"`
+type ResponseInputItemShellCallCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Commands respjson.Field
- MaxOutputLength respjson.Field
- TimeoutMs respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
-func (r ResponseInputItemShellCallAction) RawJSON() string { return r.JSON.raw }
-func (r *ResponseInputItemShellCallAction) UnmarshalJSON(data []byte) error {
+func (r ResponseInputItemShellCallCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemShellCallCallerProgram) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
@@ -10782,6 +13156,8 @@ type ResponseInputItemShellCallOutput struct {
// The unique ID of the shell tool call output. Populated when this item is
// returned via API.
ID string `json:"id" api:"nullable"`
+ // The execution context that produced this tool call.
+ Caller ResponseInputItemShellCallOutputCallerUnion `json:"caller" api:"nullable"`
// The maximum number of UTF-8 characters captured for this shell call's combined
// output.
MaxOutputLength int64 `json:"max_output_length" api:"nullable"`
@@ -10795,6 +13171,7 @@ type ResponseInputItemShellCallOutput struct {
Output respjson.Field
Type respjson.Field
ID respjson.Field
+ Caller respjson.Field
MaxOutputLength respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
@@ -10808,6 +13185,110 @@ func (r *ResponseInputItemShellCallOutput) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// ResponseInputItemShellCallOutputCallerUnion contains all possible properties and
+// values from [ResponseInputItemShellCallOutputCallerDirect],
+// [ResponseInputItemShellCallOutputCallerProgram].
+//
+// Use the [ResponseInputItemShellCallOutputCallerUnion.AsAny] method to switch on
+// the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseInputItemShellCallOutputCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [ResponseInputItemShellCallOutputCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyResponseInputItemShellCallOutputCaller is implemented by each variant of
+// [ResponseInputItemShellCallOutputCallerUnion] to add type safety for the return
+// type of [ResponseInputItemShellCallOutputCallerUnion.AsAny]
+type anyResponseInputItemShellCallOutputCaller interface {
+ implResponseInputItemShellCallOutputCallerUnion()
+}
+
+func (ResponseInputItemShellCallOutputCallerDirect) implResponseInputItemShellCallOutputCallerUnion() {
+}
+func (ResponseInputItemShellCallOutputCallerProgram) implResponseInputItemShellCallOutputCallerUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseInputItemShellCallOutputCallerUnion.AsAny().(type) {
+// case responses.ResponseInputItemShellCallOutputCallerDirect:
+// case responses.ResponseInputItemShellCallOutputCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseInputItemShellCallOutputCallerUnion) AsAny() anyResponseInputItemShellCallOutputCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u ResponseInputItemShellCallOutputCallerUnion) AsDirect() (v ResponseInputItemShellCallOutputCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseInputItemShellCallOutputCallerUnion) AsProgram() (v ResponseInputItemShellCallOutputCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseInputItemShellCallOutputCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseInputItemShellCallOutputCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseInputItemShellCallOutputCallerDirect struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemShellCallOutputCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemShellCallOutputCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseInputItemShellCallOutputCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemShellCallOutputCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemShellCallOutputCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A tool call representing a request to create, delete, or update files using diff
// patches.
type ResponseInputItemApplyPatchCall struct {
@@ -10825,6 +13306,8 @@ type ResponseInputItemApplyPatchCall struct {
// The unique ID of the apply patch tool call. Populated when this item is returned
// via API.
ID string `json:"id" api:"nullable"`
+ // The execution context that produced this tool call.
+ Caller ResponseInputItemApplyPatchCallCallerUnion `json:"caller" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CallID respjson.Field
@@ -10832,6 +13315,7 @@ type ResponseInputItemApplyPatchCall struct {
Status respjson.Field
Type respjson.Field
ID respjson.Field
+ Caller respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
@@ -10962,23 +13446,247 @@ type ResponseInputItemApplyPatchCallOperationDeleteFile struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseInputItemApplyPatchCallOperationDeleteFile) RawJSON() string { return r.JSON.raw }
-func (r *ResponseInputItemApplyPatchCallOperationDeleteFile) UnmarshalJSON(data []byte) error {
+func (r ResponseInputItemApplyPatchCallOperationDeleteFile) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemApplyPatchCallOperationDeleteFile) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Instruction for updating an existing file via the apply_patch tool.
+type ResponseInputItemApplyPatchCallOperationUpdateFile struct {
+ // Unified diff content to apply to the existing file.
+ Diff string `json:"diff" api:"required"`
+ // Path of the file to update relative to the workspace root.
+ Path string `json:"path" api:"required"`
+ // The operation type. Always `update_file`.
+ Type constant.UpdateFile `json:"type" default:"update_file"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Diff respjson.Field
+ Path respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemApplyPatchCallOperationUpdateFile) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemApplyPatchCallOperationUpdateFile) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ResponseInputItemApplyPatchCallCallerUnion contains all possible properties and
+// values from [ResponseInputItemApplyPatchCallCallerDirect],
+// [ResponseInputItemApplyPatchCallCallerProgram].
+//
+// Use the [ResponseInputItemApplyPatchCallCallerUnion.AsAny] method to switch on
+// the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseInputItemApplyPatchCallCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [ResponseInputItemApplyPatchCallCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyResponseInputItemApplyPatchCallCaller is implemented by each variant of
+// [ResponseInputItemApplyPatchCallCallerUnion] to add type safety for the return
+// type of [ResponseInputItemApplyPatchCallCallerUnion.AsAny]
+type anyResponseInputItemApplyPatchCallCaller interface {
+ implResponseInputItemApplyPatchCallCallerUnion()
+}
+
+func (ResponseInputItemApplyPatchCallCallerDirect) implResponseInputItemApplyPatchCallCallerUnion() {}
+func (ResponseInputItemApplyPatchCallCallerProgram) implResponseInputItemApplyPatchCallCallerUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseInputItemApplyPatchCallCallerUnion.AsAny().(type) {
+// case responses.ResponseInputItemApplyPatchCallCallerDirect:
+// case responses.ResponseInputItemApplyPatchCallCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseInputItemApplyPatchCallCallerUnion) AsAny() anyResponseInputItemApplyPatchCallCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u ResponseInputItemApplyPatchCallCallerUnion) AsDirect() (v ResponseInputItemApplyPatchCallCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseInputItemApplyPatchCallCallerUnion) AsProgram() (v ResponseInputItemApplyPatchCallCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseInputItemApplyPatchCallCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseInputItemApplyPatchCallCallerUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseInputItemApplyPatchCallCallerDirect struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemApplyPatchCallCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemApplyPatchCallCallerDirect) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseInputItemApplyPatchCallCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallerID respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemApplyPatchCallCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemApplyPatchCallCallerProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The streamed output emitted by an apply patch tool call.
+type ResponseInputItemApplyPatchCallOutput struct {
+ // The unique ID of the apply patch tool call generated by the model.
+ CallID string `json:"call_id" api:"required"`
+ // The status of the apply patch tool call output. One of `completed` or `failed`.
+ //
+ // Any of "completed", "failed".
+ Status string `json:"status" api:"required"`
+ // The type of the item. Always `apply_patch_call_output`.
+ Type constant.ApplyPatchCallOutput `json:"type" default:"apply_patch_call_output"`
+ // The unique ID of the apply patch tool call output. Populated when this item is
+ // returned via API.
+ ID string `json:"id" api:"nullable"`
+ // The execution context that produced this tool call.
+ Caller ResponseInputItemApplyPatchCallOutputCallerUnion `json:"caller" api:"nullable"`
+ // Optional human-readable log text from the apply patch tool (e.g., patch results
+ // or errors).
+ Output string `json:"output" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallID respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Caller respjson.Field
+ Output respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemApplyPatchCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemApplyPatchCallOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ResponseInputItemApplyPatchCallOutputCallerUnion contains all possible
+// properties and values from [ResponseInputItemApplyPatchCallOutputCallerDirect],
+// [ResponseInputItemApplyPatchCallOutputCallerProgram].
+//
+// Use the [ResponseInputItemApplyPatchCallOutputCallerUnion.AsAny] method to
+// switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseInputItemApplyPatchCallOutputCallerUnion struct {
+ // Any of "direct", "program".
+ Type string `json:"type"`
+ // This field is from variant [ResponseInputItemApplyPatchCallOutputCallerProgram].
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyResponseInputItemApplyPatchCallOutputCaller is implemented by each variant of
+// [ResponseInputItemApplyPatchCallOutputCallerUnion] to add type safety for the
+// return type of [ResponseInputItemApplyPatchCallOutputCallerUnion.AsAny]
+type anyResponseInputItemApplyPatchCallOutputCaller interface {
+ implResponseInputItemApplyPatchCallOutputCallerUnion()
+}
+
+func (ResponseInputItemApplyPatchCallOutputCallerDirect) implResponseInputItemApplyPatchCallOutputCallerUnion() {
+}
+func (ResponseInputItemApplyPatchCallOutputCallerProgram) implResponseInputItemApplyPatchCallOutputCallerUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseInputItemApplyPatchCallOutputCallerUnion.AsAny().(type) {
+// case responses.ResponseInputItemApplyPatchCallOutputCallerDirect:
+// case responses.ResponseInputItemApplyPatchCallOutputCallerProgram:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseInputItemApplyPatchCallOutputCallerUnion) AsAny() anyResponseInputItemApplyPatchCallOutputCaller {
+ switch u.Type {
+ case "direct":
+ return u.AsDirect()
+ case "program":
+ return u.AsProgram()
+ }
+ return nil
+}
+
+func (u ResponseInputItemApplyPatchCallOutputCallerUnion) AsDirect() (v ResponseInputItemApplyPatchCallOutputCallerDirect) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseInputItemApplyPatchCallOutputCallerUnion) AsProgram() (v ResponseInputItemApplyPatchCallOutputCallerProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseInputItemApplyPatchCallOutputCallerUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseInputItemApplyPatchCallOutputCallerUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Instruction for updating an existing file via the apply_patch tool.
-type ResponseInputItemApplyPatchCallOperationUpdateFile struct {
- // Unified diff content to apply to the existing file.
- Diff string `json:"diff" api:"required"`
- // Path of the file to update relative to the workspace root.
- Path string `json:"path" api:"required"`
- // The operation type. Always `update_file`.
- Type constant.UpdateFile `json:"type" default:"update_file"`
+type ResponseInputItemApplyPatchCallOutputCallerDirect struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Diff respjson.Field
- Path respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
raw string
@@ -10986,42 +13694,28 @@ type ResponseInputItemApplyPatchCallOperationUpdateFile struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseInputItemApplyPatchCallOperationUpdateFile) RawJSON() string { return r.JSON.raw }
-func (r *ResponseInputItemApplyPatchCallOperationUpdateFile) UnmarshalJSON(data []byte) error {
+func (r ResponseInputItemApplyPatchCallOutputCallerDirect) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemApplyPatchCallOutputCallerDirect) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// The streamed output emitted by an apply patch tool call.
-type ResponseInputItemApplyPatchCallOutput struct {
- // The unique ID of the apply patch tool call generated by the model.
- CallID string `json:"call_id" api:"required"`
- // The status of the apply patch tool call output. One of `completed` or `failed`.
- //
- // Any of "completed", "failed".
- Status string `json:"status" api:"required"`
- // The type of the item. Always `apply_patch_call_output`.
- Type constant.ApplyPatchCallOutput `json:"type" default:"apply_patch_call_output"`
- // The unique ID of the apply patch tool call output. Populated when this item is
- // returned via API.
- ID string `json:"id" api:"nullable"`
- // Optional human-readable log text from the apply patch tool (e.g., patch results
- // or errors).
- Output string `json:"output" api:"nullable"`
+type ResponseInputItemApplyPatchCallOutputCallerProgram struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- CallID respjson.Field
- Status respjson.Field
+ CallerID respjson.Field
Type respjson.Field
- ID respjson.Field
- Output respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
-func (r ResponseInputItemApplyPatchCallOutput) RawJSON() string { return r.JSON.raw }
-func (r *ResponseInputItemApplyPatchCallOutput) UnmarshalJSON(data []byte) error {
+func (r ResponseInputItemApplyPatchCallOutputCallerProgram) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemApplyPatchCallOutputCallerProgram) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
@@ -11189,6 +13883,24 @@ func (r *ResponseInputItemMcpCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// Compacts the current context. Must be the final input item.
+type ResponseInputItemCompactionTrigger struct {
+ // The type of the item. Always `compaction_trigger`.
+ Type constant.CompactionTrigger `json:"type" default:"compaction_trigger"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemCompactionTrigger) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemCompactionTrigger) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// An internal identifier for an item to reference.
type ResponseInputItemItemReference struct {
// The ID of the item to reference.
@@ -11212,6 +13924,66 @@ func (r *ResponseInputItemItemReference) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+type ResponseInputItemProgram struct {
+ // The unique ID of this program item.
+ ID string `json:"id" api:"required"`
+ // The stable call ID of the program item.
+ CallID string `json:"call_id" api:"required"`
+ // The JavaScript source executed by programmatic tool calling.
+ Code string `json:"code" api:"required"`
+ // Opaque program replay fingerprint that must be round-tripped.
+ Fingerprint string `json:"fingerprint" api:"required"`
+ // The item type. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Code respjson.Field
+ Fingerprint respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemProgram) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseInputItemProgramOutput struct {
+ // The unique ID of this program output item.
+ ID string `json:"id" api:"required"`
+ // The call ID of the program item.
+ CallID string `json:"call_id" api:"required"`
+ // The result produced by the program item.
+ Result string `json:"result" api:"required"`
+ // The terminal status of the program output.
+ //
+ // Any of "completed", "incomplete".
+ Status string `json:"status" api:"required"`
+ // The item type. Always `program_output`.
+ Type constant.ProgramOutput `json:"type" default:"program_output"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Result respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemProgramOutput) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemProgramOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
func ResponseInputItemParamOfMessage[T string | ResponseInputMessageContentListParam](content T, role EasyInputMessageRole) ResponseInputItemUnionParam {
var message EasyInputMessageParam
switch v := any(content).(type) {
@@ -11303,6 +14075,12 @@ func ResponseInputItemParamOfToolSearchOutput(tools []ToolUnionParam) ResponseIn
return ResponseInputItemUnionParam{OfToolSearchOutput: &toolSearchOutput}
}
+func ResponseInputItemParamOfAdditionalTools(tools []ToolUnionParam) ResponseInputItemUnionParam {
+ var additionalTools ResponseInputItemAdditionalToolsParam
+ additionalTools.Tools = tools
+ return ResponseInputItemUnionParam{OfAdditionalTools: &additionalTools}
+}
+
func ResponseInputItemParamOfReasoning(id string, summary []ResponseReasoningItemSummaryParam) ResponseInputItemUnionParam {
var reasoning ResponseReasoningItemParam
reasoning.ID = id
@@ -11427,6 +14205,7 @@ type ResponseInputItemUnionParam struct {
OfFunctionCallOutput *ResponseInputItemFunctionCallOutputParam `json:",omitzero,inline"`
OfToolSearchCall *ResponseInputItemToolSearchCallParam `json:",omitzero,inline"`
OfToolSearchOutput *ResponseToolSearchOutputItemParam `json:",omitzero,inline"`
+ OfAdditionalTools *ResponseInputItemAdditionalToolsParam `json:",omitzero,inline"`
OfReasoning *ResponseReasoningItemParam `json:",omitzero,inline"`
OfCompaction *ResponseCompactionItemParam `json:",omitzero,inline"`
OfImageGenerationCall *ResponseInputItemImageGenerationCallParam `json:",omitzero,inline"`
@@ -11443,7 +14222,10 @@ type ResponseInputItemUnionParam struct {
OfMcpCall *ResponseInputItemMcpCallParam `json:",omitzero,inline"`
OfCustomToolCallOutput *ResponseCustomToolCallOutputParam `json:",omitzero,inline"`
OfCustomToolCall *ResponseCustomToolCallParam `json:",omitzero,inline"`
+ OfCompactionTrigger *ResponseInputItemCompactionTriggerParam `json:",omitzero,inline"`
OfItemReference *ResponseInputItemItemReferenceParam `json:",omitzero,inline"`
+ OfProgram *ResponseInputItemProgramParam `json:",omitzero,inline"`
+ OfProgramOutput *ResponseInputItemProgramOutputParam `json:",omitzero,inline"`
paramUnion
}
@@ -11459,6 +14241,7 @@ func (u ResponseInputItemUnionParam) MarshalJSON() ([]byte, error) {
u.OfFunctionCallOutput,
u.OfToolSearchCall,
u.OfToolSearchOutput,
+ u.OfAdditionalTools,
u.OfReasoning,
u.OfCompaction,
u.OfImageGenerationCall,
@@ -11475,7 +14258,10 @@ func (u ResponseInputItemUnionParam) MarshalJSON() ([]byte, error) {
u.OfMcpCall,
u.OfCustomToolCallOutput,
u.OfCustomToolCall,
- u.OfItemReference)
+ u.OfCompactionTrigger,
+ u.OfItemReference,
+ u.OfProgram,
+ u.OfProgramOutput)
}
func (u *ResponseInputItemUnionParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
@@ -11504,6 +14290,8 @@ func (u *ResponseInputItemUnionParam) asAny() any {
return u.OfToolSearchCall
} else if !param.IsOmitted(u.OfToolSearchOutput) {
return u.OfToolSearchOutput
+ } else if !param.IsOmitted(u.OfAdditionalTools) {
+ return u.OfAdditionalTools
} else if !param.IsOmitted(u.OfReasoning) {
return u.OfReasoning
} else if !param.IsOmitted(u.OfCompaction) {
@@ -11536,8 +14324,14 @@ func (u *ResponseInputItemUnionParam) asAny() any {
return u.OfCustomToolCallOutput
} else if !param.IsOmitted(u.OfCustomToolCall) {
return u.OfCustomToolCall
+ } else if !param.IsOmitted(u.OfCompactionTrigger) {
+ return u.OfCompactionTrigger
} else if !param.IsOmitted(u.OfItemReference) {
return u.OfItemReference
+ } else if !param.IsOmitted(u.OfProgram) {
+ return u.OfProgram
+ } else if !param.IsOmitted(u.OfProgramOutput) {
+ return u.OfProgramOutput
}
return nil
}
@@ -11590,22 +14384,6 @@ func (u ResponseInputItemUnionParam) GetSummary() []ResponseReasoningItemSummary
return nil
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseInputItemUnionParam) GetResult() *string {
- if vt := u.OfImageGenerationCall; vt != nil && vt.Result.Valid() {
- return &vt.Result.Value
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseInputItemUnionParam) GetCode() *string {
- if vt := u.OfCodeInterpreterCall; vt != nil && vt.Code.Valid() {
- return &vt.Code.Value
- }
- return nil
-}
-
// Returns a pointer to the underlying variant's property, if present.
func (u ResponseInputItemUnionParam) GetContainerID() *string {
if vt := u.OfCodeInterpreterCall; vt != nil {
@@ -11670,6 +14448,14 @@ func (u ResponseInputItemUnionParam) GetInput() *string {
return nil
}
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseInputItemUnionParam) GetFingerprint() *string {
+ if vt := u.OfProgram; vt != nil {
+ return &vt.Fingerprint
+ }
+ return nil
+}
+
// Returns a pointer to the underlying variant's property, if present.
func (u ResponseInputItemUnionParam) GetRole() *string {
if vt := u.OfMessage; vt != nil {
@@ -11678,6 +14464,8 @@ func (u ResponseInputItemUnionParam) GetRole() *string {
return (*string)(&vt.Role)
} else if vt := u.OfOutputMessage; vt != nil {
return (*string)(&vt.Role)
+ } else if vt := u.OfAdditionalTools; vt != nil {
+ return (*string)(&vt.Role)
}
return nil
}
@@ -11716,6 +14504,8 @@ func (u ResponseInputItemUnionParam) GetType() *string {
return (*string)(&vt.Type)
} else if vt := u.OfToolSearchOutput; vt != nil {
return (*string)(&vt.Type)
+ } else if vt := u.OfAdditionalTools; vt != nil {
+ return (*string)(&vt.Type)
} else if vt := u.OfReasoning; vt != nil {
return (*string)(&vt.Type)
} else if vt := u.OfCompaction; vt != nil {
@@ -11748,8 +14538,14 @@ func (u ResponseInputItemUnionParam) GetType() *string {
return (*string)(&vt.Type)
} else if vt := u.OfCustomToolCall; vt != nil {
return (*string)(&vt.Type)
+ } else if vt := u.OfCompactionTrigger; vt != nil {
+ return (*string)(&vt.Type)
} else if vt := u.OfItemReference; vt != nil {
return (*string)(&vt.Type)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfProgramOutput; vt != nil {
+ return (*string)(&vt.Type)
}
return nil
}
@@ -11796,6 +14592,8 @@ func (u ResponseInputItemUnionParam) GetStatus() *string {
return (*string)(&vt.Status)
} else if vt := u.OfMcpCall; vt != nil {
return (*string)(&vt.Status)
+ } else if vt := u.OfProgramOutput; vt != nil {
+ return (*string)(&vt.Status)
}
return nil
}
@@ -11820,6 +14618,8 @@ func (u ResponseInputItemUnionParam) GetID() *string {
return &vt.ID.Value
} else if vt := u.OfToolSearchOutput; vt != nil && vt.ID.Valid() {
return &vt.ID.Value
+ } else if vt := u.OfAdditionalTools; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
} else if vt := u.OfReasoning; vt != nil {
return (*string)(&vt.ID)
} else if vt := u.OfCompaction; vt != nil && vt.ID.Valid() {
@@ -11854,6 +14654,10 @@ func (u ResponseInputItemUnionParam) GetID() *string {
return &vt.ID.Value
} else if vt := u.OfItemReference; vt != nil {
return (*string)(&vt.ID)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.ID)
+ } else if vt := u.OfProgramOutput; vt != nil {
+ return (*string)(&vt.ID)
}
return nil
}
@@ -11886,6 +14690,10 @@ func (u ResponseInputItemUnionParam) GetCallID() *string {
return (*string)(&vt.CallID)
} else if vt := u.OfCustomToolCall; vt != nil {
return (*string)(&vt.CallID)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.CallID)
+ } else if vt := u.OfProgramOutput; vt != nil {
+ return (*string)(&vt.CallID)
}
return nil
}
@@ -11934,6 +14742,26 @@ func (u ResponseInputItemUnionParam) GetEncryptedContent() *string {
return nil
}
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseInputItemUnionParam) GetResult() *string {
+ if vt := u.OfImageGenerationCall; vt != nil && vt.Result.Valid() {
+ return &vt.Result.Value
+ } else if vt := u.OfProgramOutput; vt != nil {
+ return (*string)(&vt.Result)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseInputItemUnionParam) GetCode() *string {
+ if vt := u.OfCodeInterpreterCall; vt != nil && vt.Code.Valid() {
+ return &vt.Code.Value
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.Code)
+ }
+ return nil
+}
+
// Returns a pointer to the underlying variant's property, if present.
func (u ResponseInputItemUnionParam) GetServerLabel() *string {
if vt := u.OfMcpListTools; vt != nil {
@@ -12099,19 +14927,19 @@ func (u responseInputItemUnionParamAction) GetText() *string {
}
// Returns a pointer to the underlying variant's property, if present.
-func (u responseInputItemUnionParamAction) GetQuery() *string {
+func (u responseInputItemUnionParamAction) GetQueries() []string {
switch vt := u.any.(type) {
case *ResponseFunctionWebSearchActionUnionParam:
- return vt.GetQuery()
+ return vt.GetQueries()
}
return nil
}
// Returns a pointer to the underlying variant's property, if present.
-func (u responseInputItemUnionParamAction) GetQueries() []string {
+func (u responseInputItemUnionParamAction) GetQuery() *string {
switch vt := u.any.(type) {
case *ResponseFunctionWebSearchActionUnionParam:
- return vt.GetQueries()
+ return vt.GetQuery()
}
return nil
}
@@ -12318,12 +15146,126 @@ type responseInputItemUnionParamArguments struct{ any }
// }
func (u responseInputItemUnionParamArguments) AsAny() any { return u.any }
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u ResponseInputItemUnionParam) GetCaller() (res responseInputItemUnionParamCaller) {
+ if vt := u.OfFunctionCall; vt != nil {
+ res.any = vt.Caller.asAny()
+ } else if vt := u.OfFunctionCallOutput; vt != nil {
+ res.any = vt.Caller.asAny()
+ } else if vt := u.OfShellCall; vt != nil {
+ res.any = vt.Caller.asAny()
+ } else if vt := u.OfShellCallOutput; vt != nil {
+ res.any = vt.Caller.asAny()
+ } else if vt := u.OfApplyPatchCall; vt != nil {
+ res.any = vt.Caller.asAny()
+ } else if vt := u.OfApplyPatchCallOutput; vt != nil {
+ res.any = vt.Caller.asAny()
+ } else if vt := u.OfCustomToolCallOutput; vt != nil {
+ res.any = vt.Caller.asAny()
+ } else if vt := u.OfCustomToolCall; vt != nil {
+ res.any = vt.Caller.asAny()
+ }
+ return
+}
+
+// Can have the runtime types [*ResponseFunctionToolCallCallerDirectParam],
+// [*ResponseFunctionToolCallCallerProgramParam],
+// [*ResponseInputItemFunctionCallOutputCallerDirectParam],
+// [*ResponseInputItemFunctionCallOutputCallerProgramParam],
+// [*ResponseInputItemShellCallCallerDirectParam],
+// [*ResponseInputItemShellCallCallerProgramParam],
+// [*ResponseInputItemShellCallOutputCallerDirectParam],
+// [*ResponseInputItemShellCallOutputCallerProgramParam],
+// [*ResponseInputItemApplyPatchCallCallerDirectParam],
+// [*ResponseInputItemApplyPatchCallCallerProgramParam],
+// [*ResponseInputItemApplyPatchCallOutputCallerDirectParam],
+// [*ResponseInputItemApplyPatchCallOutputCallerProgramParam],
+// [*ResponseCustomToolCallOutputCallerDirectParam],
+// [*ResponseCustomToolCallOutputCallerProgramParam],
+// [*ResponseCustomToolCallCallerDirectParam],
+// [*ResponseCustomToolCallCallerProgramParam]
+type responseInputItemUnionParamCaller struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *responses.ResponseFunctionToolCallCallerDirectParam:
+// case *responses.ResponseFunctionToolCallCallerProgramParam:
+// case *responses.ResponseInputItemFunctionCallOutputCallerDirectParam:
+// case *responses.ResponseInputItemFunctionCallOutputCallerProgramParam:
+// case *responses.ResponseInputItemShellCallCallerDirectParam:
+// case *responses.ResponseInputItemShellCallCallerProgramParam:
+// case *responses.ResponseInputItemShellCallOutputCallerDirectParam:
+// case *responses.ResponseInputItemShellCallOutputCallerProgramParam:
+// case *responses.ResponseInputItemApplyPatchCallCallerDirectParam:
+// case *responses.ResponseInputItemApplyPatchCallCallerProgramParam:
+// case *responses.ResponseInputItemApplyPatchCallOutputCallerDirectParam:
+// case *responses.ResponseInputItemApplyPatchCallOutputCallerProgramParam:
+// case *responses.ResponseCustomToolCallOutputCallerDirectParam:
+// case *responses.ResponseCustomToolCallOutputCallerProgramParam:
+// case *responses.ResponseCustomToolCallCallerDirectParam:
+// case *responses.ResponseCustomToolCallCallerProgramParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u responseInputItemUnionParamCaller) AsAny() any { return u.any }
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u responseInputItemUnionParamCaller) GetType() *string {
+ switch vt := u.any.(type) {
+ case *ResponseFunctionToolCallCallerUnionParam:
+ return vt.GetType()
+ case *ResponseInputItemFunctionCallOutputCallerUnionParam:
+ return vt.GetType()
+ case *ResponseInputItemShellCallCallerUnionParam:
+ return vt.GetType()
+ case *ResponseInputItemShellCallOutputCallerUnionParam:
+ return vt.GetType()
+ case *ResponseInputItemApplyPatchCallCallerUnionParam:
+ return vt.GetType()
+ case *ResponseInputItemApplyPatchCallOutputCallerUnionParam:
+ return vt.GetType()
+ case *ResponseCustomToolCallOutputCallerUnionParam:
+ return vt.GetType()
+ case *ResponseCustomToolCallCallerUnionParam:
+ return vt.GetType()
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u responseInputItemUnionParamCaller) GetCallerID() *string {
+ switch vt := u.any.(type) {
+ case *ResponseFunctionToolCallCallerUnionParam:
+ return vt.GetCallerID()
+ case *ResponseInputItemFunctionCallOutputCallerUnionParam:
+ return vt.GetCallerID()
+ case *ResponseInputItemShellCallCallerUnionParam:
+ return vt.GetCallerID()
+ case *ResponseInputItemShellCallOutputCallerUnionParam:
+ return vt.GetCallerID()
+ case *ResponseInputItemApplyPatchCallCallerUnionParam:
+ return vt.GetCallerID()
+ case *ResponseInputItemApplyPatchCallOutputCallerUnionParam:
+ return vt.GetCallerID()
+ case *ResponseCustomToolCallOutputCallerUnionParam:
+ return vt.GetCallerID()
+ case *ResponseCustomToolCallCallerUnionParam:
+ return vt.GetCallerID()
+ }
+ return nil
+}
+
// Returns a subunion which exports methods to access subproperties
//
// Or use AsAny() to get the underlying value
func (u ResponseInputItemUnionParam) GetTools() (res responseInputItemUnionParamTools) {
if vt := u.OfToolSearchOutput; vt != nil {
res.any = &vt.Tools
+ } else if vt := u.OfAdditionalTools; vt != nil {
+ res.any = &vt.Tools
} else if vt := u.OfMcpListTools; vt != nil {
res.any = &vt.Tools
}
@@ -12358,6 +15300,7 @@ func init() {
apijson.Discriminator[ResponseInputItemFunctionCallOutputParam]("function_call_output"),
apijson.Discriminator[ResponseInputItemToolSearchCallParam]("tool_search_call"),
apijson.Discriminator[ResponseToolSearchOutputItemParam]("tool_search_output"),
+ apijson.Discriminator[ResponseInputItemAdditionalToolsParam]("additional_tools"),
apijson.Discriminator[ResponseReasoningItemParam]("reasoning"),
apijson.Discriminator[ResponseCompactionItemParam]("compaction"),
apijson.Discriminator[ResponseInputItemImageGenerationCallParam]("image_generation_call"),
@@ -12374,7 +15317,10 @@ func init() {
apijson.Discriminator[ResponseInputItemMcpCallParam]("mcp_call"),
apijson.Discriminator[ResponseCustomToolCallOutputParam]("custom_tool_call_output"),
apijson.Discriminator[ResponseCustomToolCallParam]("custom_tool_call"),
+ apijson.Discriminator[ResponseInputItemCompactionTriggerParam]("compaction_trigger"),
apijson.Discriminator[ResponseInputItemItemReferenceParam]("item_reference"),
+ apijson.Discriminator[ResponseInputItemProgramParam]("program"),
+ apijson.Discriminator[ResponseInputItemProgramOutputParam]("program_output"),
)
}
@@ -12495,6 +15441,8 @@ type ResponseInputItemFunctionCallOutputParam struct {
// The unique ID of the function tool call output. Populated when this item is
// returned via API.
ID param.Opt[string] `json:"id,omitzero"`
+ // The execution context that produced this tool call.
+ Caller ResponseInputItemFunctionCallOutputCallerUnionParam `json:"caller,omitzero"`
// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
// Populated when items are returned via API.
//
@@ -12547,6 +15495,98 @@ func (u *ResponseInputItemFunctionCallOutputOutputUnionParam) asAny() any {
return nil
}
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseInputItemFunctionCallOutputCallerUnionParam struct {
+ OfDirect *ResponseInputItemFunctionCallOutputCallerDirectParam `json:",omitzero,inline"`
+ OfProgram *ResponseInputItemFunctionCallOutputCallerProgramParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ResponseInputItemFunctionCallOutputCallerUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfDirect, u.OfProgram)
+}
+func (u *ResponseInputItemFunctionCallOutputCallerUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ResponseInputItemFunctionCallOutputCallerUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfDirect) {
+ return u.OfDirect
+ } else if !param.IsOmitted(u.OfProgram) {
+ return u.OfProgram
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseInputItemFunctionCallOutputCallerUnionParam) GetCallerID() *string {
+ if vt := u.OfProgram; vt != nil {
+ return &vt.CallerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseInputItemFunctionCallOutputCallerUnionParam) GetType() *string {
+ if vt := u.OfDirect; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[ResponseInputItemFunctionCallOutputCallerUnionParam](
+ "type",
+ apijson.Discriminator[ResponseInputItemFunctionCallOutputCallerDirectParam]("direct"),
+ apijson.Discriminator[ResponseInputItemFunctionCallOutputCallerProgramParam]("program"),
+ )
+}
+
+func NewResponseInputItemFunctionCallOutputCallerDirectParam() ResponseInputItemFunctionCallOutputCallerDirectParam {
+ return ResponseInputItemFunctionCallOutputCallerDirectParam{
+ Type: "direct",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewResponseInputItemFunctionCallOutputCallerDirectParam].
+type ResponseInputItemFunctionCallOutputCallerDirectParam struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ paramObj
+}
+
+func (r ResponseInputItemFunctionCallOutputCallerDirectParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemFunctionCallOutputCallerDirectParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemFunctionCallOutputCallerDirectParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties CallerID, Type are required.
+type ResponseInputItemFunctionCallOutputCallerProgramParam struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ //
+ // This field can be elided, and will marshal its zero value as "program".
+ Type constant.Program `json:"type" default:"program"`
+ paramObj
+}
+
+func (r ResponseInputItemFunctionCallOutputCallerProgramParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemFunctionCallOutputCallerProgramParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemFunctionCallOutputCallerProgramParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// The properties Arguments, Type are required.
type ResponseInputItemToolSearchCallParam struct {
// The arguments supplied to the tool search call.
@@ -12587,6 +15627,31 @@ func init() {
)
}
+// The properties Role, Tools, Type are required.
+type ResponseInputItemAdditionalToolsParam struct {
+ // A list of additional tools made available at this item.
+ Tools []ToolUnionParam `json:"tools,omitzero" api:"required"`
+ // The unique ID of this additional tools item.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // The role that provided the additional tools. Only `developer` is supported.
+ //
+ // This field can be elided, and will marshal its zero value as "developer".
+ Role constant.Developer `json:"role" default:"developer"`
+ // The item type. Always `additional_tools`.
+ //
+ // This field can be elided, and will marshal its zero value as "additional_tools".
+ Type constant.AdditionalTools `json:"type" default:"additional_tools"`
+ paramObj
+}
+
+func (r ResponseInputItemAdditionalToolsParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemAdditionalToolsParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemAdditionalToolsParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// An image generation request made by the model.
//
// The properties ID, Result, Status, Type are required.
@@ -12730,6 +15795,8 @@ type ResponseInputItemShellCallParam struct {
// The unique ID of the shell tool call. Populated when this item is returned via
// API.
ID param.Opt[string] `json:"id,omitzero"`
+ // The execution context that produced this tool call.
+ Caller ResponseInputItemShellCallCallerUnionParam `json:"caller,omitzero"`
// The environment to execute the shell commands in.
Environment ResponseInputItemShellCallEnvironmentUnionParam `json:"environment,omitzero"`
// The status of the shell call. One of `in_progress`, `completed`, or
@@ -12780,6 +15847,98 @@ func (r *ResponseInputItemShellCallActionParam) UnmarshalJSON(data []byte) error
return apijson.UnmarshalRoot(data, r)
}
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseInputItemShellCallCallerUnionParam struct {
+ OfDirect *ResponseInputItemShellCallCallerDirectParam `json:",omitzero,inline"`
+ OfProgram *ResponseInputItemShellCallCallerProgramParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ResponseInputItemShellCallCallerUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfDirect, u.OfProgram)
+}
+func (u *ResponseInputItemShellCallCallerUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ResponseInputItemShellCallCallerUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfDirect) {
+ return u.OfDirect
+ } else if !param.IsOmitted(u.OfProgram) {
+ return u.OfProgram
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseInputItemShellCallCallerUnionParam) GetCallerID() *string {
+ if vt := u.OfProgram; vt != nil {
+ return &vt.CallerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseInputItemShellCallCallerUnionParam) GetType() *string {
+ if vt := u.OfDirect; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[ResponseInputItemShellCallCallerUnionParam](
+ "type",
+ apijson.Discriminator[ResponseInputItemShellCallCallerDirectParam]("direct"),
+ apijson.Discriminator[ResponseInputItemShellCallCallerProgramParam]("program"),
+ )
+}
+
+func NewResponseInputItemShellCallCallerDirectParam() ResponseInputItemShellCallCallerDirectParam {
+ return ResponseInputItemShellCallCallerDirectParam{
+ Type: "direct",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewResponseInputItemShellCallCallerDirectParam].
+type ResponseInputItemShellCallCallerDirectParam struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ paramObj
+}
+
+func (r ResponseInputItemShellCallCallerDirectParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemShellCallCallerDirectParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemShellCallCallerDirectParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties CallerID, Type are required.
+type ResponseInputItemShellCallCallerProgramParam struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ //
+ // This field can be elided, and will marshal its zero value as "program".
+ Type constant.Program `json:"type" default:"program"`
+ paramObj
+}
+
+func (r ResponseInputItemShellCallCallerProgramParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemShellCallCallerProgramParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemShellCallCallerProgramParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
@@ -12854,6 +16013,8 @@ type ResponseInputItemShellCallOutputParam struct {
// The maximum number of UTF-8 characters captured for this shell call's combined
// output.
MaxOutputLength param.Opt[int64] `json:"max_output_length,omitzero"`
+ // The execution context that produced this tool call.
+ Caller ResponseInputItemShellCallOutputCallerUnionParam `json:"caller,omitzero"`
// The status of the shell call output.
//
// Any of "in_progress", "completed", "incomplete".
@@ -12880,6 +16041,98 @@ func init() {
)
}
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseInputItemShellCallOutputCallerUnionParam struct {
+ OfDirect *ResponseInputItemShellCallOutputCallerDirectParam `json:",omitzero,inline"`
+ OfProgram *ResponseInputItemShellCallOutputCallerProgramParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ResponseInputItemShellCallOutputCallerUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfDirect, u.OfProgram)
+}
+func (u *ResponseInputItemShellCallOutputCallerUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ResponseInputItemShellCallOutputCallerUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfDirect) {
+ return u.OfDirect
+ } else if !param.IsOmitted(u.OfProgram) {
+ return u.OfProgram
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseInputItemShellCallOutputCallerUnionParam) GetCallerID() *string {
+ if vt := u.OfProgram; vt != nil {
+ return &vt.CallerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseInputItemShellCallOutputCallerUnionParam) GetType() *string {
+ if vt := u.OfDirect; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[ResponseInputItemShellCallOutputCallerUnionParam](
+ "type",
+ apijson.Discriminator[ResponseInputItemShellCallOutputCallerDirectParam]("direct"),
+ apijson.Discriminator[ResponseInputItemShellCallOutputCallerProgramParam]("program"),
+ )
+}
+
+func NewResponseInputItemShellCallOutputCallerDirectParam() ResponseInputItemShellCallOutputCallerDirectParam {
+ return ResponseInputItemShellCallOutputCallerDirectParam{
+ Type: "direct",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewResponseInputItemShellCallOutputCallerDirectParam].
+type ResponseInputItemShellCallOutputCallerDirectParam struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ paramObj
+}
+
+func (r ResponseInputItemShellCallOutputCallerDirectParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemShellCallOutputCallerDirectParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemShellCallOutputCallerDirectParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties CallerID, Type are required.
+type ResponseInputItemShellCallOutputCallerProgramParam struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ //
+ // This field can be elided, and will marshal its zero value as "program".
+ Type constant.Program `json:"type" default:"program"`
+ paramObj
+}
+
+func (r ResponseInputItemShellCallOutputCallerProgramParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemShellCallOutputCallerProgramParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemShellCallOutputCallerProgramParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A tool call representing a request to create, delete, or update files using diff
// patches.
//
@@ -12897,6 +16150,8 @@ type ResponseInputItemApplyPatchCallParam struct {
// The unique ID of the apply patch tool call. Populated when this item is returned
// via API.
ID param.Opt[string] `json:"id,omitzero"`
+ // The execution context that produced this tool call.
+ Caller ResponseInputItemApplyPatchCallCallerUnionParam `json:"caller,omitzero"`
// The type of the item. Always `apply_patch_call`.
//
// This field can be elided, and will marshal its zero value as "apply_patch_call".
@@ -13056,6 +16311,98 @@ func (r *ResponseInputItemApplyPatchCallOperationUpdateFileParam) UnmarshalJSON(
return apijson.UnmarshalRoot(data, r)
}
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseInputItemApplyPatchCallCallerUnionParam struct {
+ OfDirect *ResponseInputItemApplyPatchCallCallerDirectParam `json:",omitzero,inline"`
+ OfProgram *ResponseInputItemApplyPatchCallCallerProgramParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ResponseInputItemApplyPatchCallCallerUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfDirect, u.OfProgram)
+}
+func (u *ResponseInputItemApplyPatchCallCallerUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ResponseInputItemApplyPatchCallCallerUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfDirect) {
+ return u.OfDirect
+ } else if !param.IsOmitted(u.OfProgram) {
+ return u.OfProgram
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseInputItemApplyPatchCallCallerUnionParam) GetCallerID() *string {
+ if vt := u.OfProgram; vt != nil {
+ return &vt.CallerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseInputItemApplyPatchCallCallerUnionParam) GetType() *string {
+ if vt := u.OfDirect; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[ResponseInputItemApplyPatchCallCallerUnionParam](
+ "type",
+ apijson.Discriminator[ResponseInputItemApplyPatchCallCallerDirectParam]("direct"),
+ apijson.Discriminator[ResponseInputItemApplyPatchCallCallerProgramParam]("program"),
+ )
+}
+
+func NewResponseInputItemApplyPatchCallCallerDirectParam() ResponseInputItemApplyPatchCallCallerDirectParam {
+ return ResponseInputItemApplyPatchCallCallerDirectParam{
+ Type: "direct",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewResponseInputItemApplyPatchCallCallerDirectParam].
+type ResponseInputItemApplyPatchCallCallerDirectParam struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ paramObj
+}
+
+func (r ResponseInputItemApplyPatchCallCallerDirectParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemApplyPatchCallCallerDirectParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemApplyPatchCallCallerDirectParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties CallerID, Type are required.
+type ResponseInputItemApplyPatchCallCallerProgramParam struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ //
+ // This field can be elided, and will marshal its zero value as "program".
+ Type constant.Program `json:"type" default:"program"`
+ paramObj
+}
+
+func (r ResponseInputItemApplyPatchCallCallerProgramParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemApplyPatchCallCallerProgramParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemApplyPatchCallCallerProgramParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// The streamed output emitted by an apply patch tool call.
//
// The properties CallID, Status, Type are required.
@@ -13072,6 +16419,8 @@ type ResponseInputItemApplyPatchCallOutputParam struct {
// Optional human-readable log text from the apply patch tool (e.g., patch results
// or errors).
Output param.Opt[string] `json:"output,omitzero"`
+ // The execution context that produced this tool call.
+ Caller ResponseInputItemApplyPatchCallOutputCallerUnionParam `json:"caller,omitzero"`
// The type of the item. Always `apply_patch_call_output`.
//
// This field can be elided, and will marshal its zero value as
@@ -13094,6 +16443,98 @@ func init() {
)
}
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseInputItemApplyPatchCallOutputCallerUnionParam struct {
+ OfDirect *ResponseInputItemApplyPatchCallOutputCallerDirectParam `json:",omitzero,inline"`
+ OfProgram *ResponseInputItemApplyPatchCallOutputCallerProgramParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ResponseInputItemApplyPatchCallOutputCallerUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfDirect, u.OfProgram)
+}
+func (u *ResponseInputItemApplyPatchCallOutputCallerUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ResponseInputItemApplyPatchCallOutputCallerUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfDirect) {
+ return u.OfDirect
+ } else if !param.IsOmitted(u.OfProgram) {
+ return u.OfProgram
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseInputItemApplyPatchCallOutputCallerUnionParam) GetCallerID() *string {
+ if vt := u.OfProgram; vt != nil {
+ return &vt.CallerID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseInputItemApplyPatchCallOutputCallerUnionParam) GetType() *string {
+ if vt := u.OfDirect; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfProgram; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[ResponseInputItemApplyPatchCallOutputCallerUnionParam](
+ "type",
+ apijson.Discriminator[ResponseInputItemApplyPatchCallOutputCallerDirectParam]("direct"),
+ apijson.Discriminator[ResponseInputItemApplyPatchCallOutputCallerProgramParam]("program"),
+ )
+}
+
+func NewResponseInputItemApplyPatchCallOutputCallerDirectParam() ResponseInputItemApplyPatchCallOutputCallerDirectParam {
+ return ResponseInputItemApplyPatchCallOutputCallerDirectParam{
+ Type: "direct",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewResponseInputItemApplyPatchCallOutputCallerDirectParam].
+type ResponseInputItemApplyPatchCallOutputCallerDirectParam struct {
+ // The caller type. Always `direct`.
+ Type constant.Direct `json:"type" default:"direct"`
+ paramObj
+}
+
+func (r ResponseInputItemApplyPatchCallOutputCallerDirectParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemApplyPatchCallOutputCallerDirectParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemApplyPatchCallOutputCallerDirectParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties CallerID, Type are required.
+type ResponseInputItemApplyPatchCallOutputCallerProgramParam struct {
+ // The call ID of the program item that produced this tool call.
+ CallerID string `json:"caller_id" api:"required"`
+ // The caller type. Always `program`.
+ //
+ // This field can be elided, and will marshal its zero value as "program".
+ Type constant.Program `json:"type" default:"program"`
+ paramObj
+}
+
+func (r ResponseInputItemApplyPatchCallOutputCallerProgramParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemApplyPatchCallOutputCallerProgramParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemApplyPatchCallOutputCallerProgramParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A list of tools available on an MCP server.
//
// The properties ID, ServerLabel, Tools, Type are required.
@@ -13246,30 +16687,112 @@ func init() {
)
}
+func NewResponseInputItemCompactionTriggerParam() ResponseInputItemCompactionTriggerParam {
+ return ResponseInputItemCompactionTriggerParam{
+ Type: "compaction_trigger",
+ }
+}
+
+// Compacts the current context. Must be the final input item.
+//
+// This struct has a constant value, construct it with
+// [NewResponseInputItemCompactionTriggerParam].
+type ResponseInputItemCompactionTriggerParam struct {
+ // The type of the item. Always `compaction_trigger`.
+ Type constant.CompactionTrigger `json:"type" default:"compaction_trigger"`
+ paramObj
+}
+
+func (r ResponseInputItemCompactionTriggerParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemCompactionTriggerParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemCompactionTriggerParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// An internal identifier for an item to reference.
//
// The property ID is required.
type ResponseInputItemItemReferenceParam struct {
// The ID of the item to reference.
ID string `json:"id" api:"required"`
- // The type of item to reference. Always `item_reference`.
+ // The type of item to reference. Always `item_reference`.
+ //
+ // Any of "item_reference".
+ Type string `json:"type,omitzero"`
+ paramObj
+}
+
+func (r ResponseInputItemItemReferenceParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemItemReferenceParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemItemReferenceParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[ResponseInputItemItemReferenceParam](
+ "type", "item_reference",
+ )
+}
+
+// The properties ID, CallID, Code, Fingerprint, Type are required.
+type ResponseInputItemProgramParam struct {
+ // The unique ID of this program item.
+ ID string `json:"id" api:"required"`
+ // The stable call ID of the program item.
+ CallID string `json:"call_id" api:"required"`
+ // The JavaScript source executed by programmatic tool calling.
+ Code string `json:"code" api:"required"`
+ // Opaque program replay fingerprint that must be round-tripped.
+ Fingerprint string `json:"fingerprint" api:"required"`
+ // The item type. Always `program`.
+ //
+ // This field can be elided, and will marshal its zero value as "program".
+ Type constant.Program `json:"type" default:"program"`
+ paramObj
+}
+
+func (r ResponseInputItemProgramParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemProgramParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemProgramParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The properties ID, CallID, Result, Status, Type are required.
+type ResponseInputItemProgramOutputParam struct {
+ // The unique ID of this program output item.
+ ID string `json:"id" api:"required"`
+ // The call ID of the program item.
+ CallID string `json:"call_id" api:"required"`
+ // The result produced by the program item.
+ Result string `json:"result" api:"required"`
+ // The terminal status of the program output.
//
- // Any of "item_reference".
- Type string `json:"type,omitzero"`
+ // Any of "completed", "incomplete".
+ Status string `json:"status,omitzero" api:"required"`
+ // The item type. Always `program_output`.
+ //
+ // This field can be elided, and will marshal its zero value as "program_output".
+ Type constant.ProgramOutput `json:"type" default:"program_output"`
paramObj
}
-func (r ResponseInputItemItemReferenceParam) MarshalJSON() (data []byte, err error) {
- type shadow ResponseInputItemItemReferenceParam
+func (r ResponseInputItemProgramOutputParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemProgramOutputParam
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseInputItemItemReferenceParam) UnmarshalJSON(data []byte) error {
+func (r *ResponseInputItemProgramOutputParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
func init() {
- apijson.RegisterFieldValidator[ResponseInputItemItemReferenceParam](
- "type", "item_reference",
+ apijson.RegisterFieldValidator[ResponseInputItemProgramOutputParam](
+ "status", "completed", "incomplete",
)
}
@@ -13337,12 +16860,17 @@ type ResponseInputText struct {
Text string `json:"text" api:"required"`
// The type of the input item. Always `input_text`.
Type constant.InputText `json:"type" default:"input_text"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint ResponseInputTextPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Text respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -13363,12 +16891,36 @@ func (r ResponseInputText) ToParam() ResponseInputTextParam {
return param.Override[ResponseInputTextParam](json.RawMessage(r.RawJSON()))
}
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+type ResponseInputTextPromptCacheBreakpoint struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Mode respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputTextPromptCacheBreakpoint) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputTextPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A text input to the model.
//
// The properties Text, Type are required.
type ResponseInputTextParam struct {
// The text input to the model.
Text string `json:"text" api:"required"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint ResponseInputTextPromptCacheBreakpointParam `json:"prompt_cache_breakpoint,omitzero"`
// The type of the input item. Always `input_text`.
//
// This field can be elided, and will marshal its zero value as "input_text".
@@ -13384,18 +16936,49 @@ func (r *ResponseInputTextParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+func NewResponseInputTextPromptCacheBreakpointParam() ResponseInputTextPromptCacheBreakpointParam {
+ return ResponseInputTextPromptCacheBreakpointParam{
+ Mode: "explicit",
+ }
+}
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+//
+// This struct has a constant value, construct it with
+// [NewResponseInputTextPromptCacheBreakpointParam].
+type ResponseInputTextPromptCacheBreakpointParam struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ paramObj
+}
+
+func (r ResponseInputTextPromptCacheBreakpointParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputTextPromptCacheBreakpointParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputTextPromptCacheBreakpointParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A text input to the model.
type ResponseInputTextContent struct {
// The text input to the model.
Text string `json:"text" api:"required"`
// The type of the input item. Always `input_text`.
Type constant.InputText `json:"type" default:"input_text"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint ResponseInputTextContentPromptCacheBreakpoint `json:"prompt_cache_breakpoint" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Text respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -13415,12 +16998,36 @@ func (r ResponseInputTextContent) ToParam() ResponseInputTextContentParam {
return param.Override[ResponseInputTextContentParam](json.RawMessage(r.RawJSON()))
}
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+type ResponseInputTextContentPromptCacheBreakpoint struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Mode respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputTextContentPromptCacheBreakpoint) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputTextContentPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A text input to the model.
//
// The properties Text, Type are required.
type ResponseInputTextContentParam struct {
// The text input to the model.
Text string `json:"text" api:"required"`
+ // Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+ // from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+ // token block.
+ PromptCacheBreakpoint ResponseInputTextContentPromptCacheBreakpointParam `json:"prompt_cache_breakpoint,omitzero"`
// The type of the input item. Always `input_text`.
//
// This field can be elided, and will marshal its zero value as "input_text".
@@ -13436,13 +17043,40 @@ func (r *ResponseInputTextContentParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+func NewResponseInputTextContentPromptCacheBreakpointParam() ResponseInputTextContentPromptCacheBreakpointParam {
+ return ResponseInputTextContentPromptCacheBreakpointParam{
+ Mode: "explicit",
+ }
+}
+
+// Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
+// from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
+// token block.
+//
+// This struct has a constant value, construct it with
+// [NewResponseInputTextContentPromptCacheBreakpointParam].
+type ResponseInputTextContentPromptCacheBreakpointParam struct {
+ // The breakpoint mode. Always `explicit`.
+ Mode constant.Explicit `json:"mode" default:"explicit"`
+ paramObj
+}
+
+func (r ResponseInputTextContentPromptCacheBreakpointParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputTextContentPromptCacheBreakpointParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputTextContentPromptCacheBreakpointParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// ResponseItemUnion contains all possible properties and values from
// [ResponseInputMessageItem], [ResponseOutputMessage],
// [ResponseFileSearchToolCall], [ResponseComputerToolCall],
// [ResponseComputerToolCallOutputItem], [ResponseFunctionWebSearch],
// [ResponseFunctionToolCallItem], [ResponseFunctionToolCallOutputItem],
// [ResponseToolSearchCall], [ResponseToolSearchOutputItem],
-// [ResponseReasoningItem], [ResponseCompactionItem],
+// [ResponseItemAdditionalTools], [ResponseReasoningItem], [ResponseItemProgram],
+// [ResponseItemProgramOutput], [ResponseCompactionItem],
// [ResponseItemImageGenerationCall], [ResponseCodeInterpreterToolCall],
// [ResponseItemLocalShellCall], [ResponseItemLocalShellCallOutput],
// [ResponseFunctionShellToolCall], [ResponseFunctionShellToolCallOutput],
@@ -13462,12 +17096,13 @@ type ResponseItemUnion struct {
Role string `json:"role"`
// Any of "message", "message", "file_search_call", "computer_call",
// "computer_call_output", "web_search_call", "function_call",
- // "function_call_output", "tool_search_call", "tool_search_output", "reasoning",
- // "compaction", "image_generation_call", "code_interpreter_call",
- // "local_shell_call", "local_shell_call_output", "shell_call",
- // "shell_call_output", "apply_patch_call", "apply_patch_call_output",
- // "mcp_list_tools", "mcp_approval_request", "mcp_approval_response", "mcp_call",
- // "custom_tool_call", "custom_tool_call_output".
+ // "function_call_output", "tool_search_call", "tool_search_output",
+ // "additional_tools", "reasoning", "program", "program_output", "compaction",
+ // "image_generation_call", "code_interpreter_call", "local_shell_call",
+ // "local_shell_call_output", "shell_call", "shell_call_output",
+ // "apply_patch_call", "apply_patch_call_output", "mcp_list_tools",
+ // "mcp_approval_request", "mcp_approval_response", "mcp_call", "custom_tool_call",
+ // "custom_tool_call_output".
Type string `json:"type"`
Status string `json:"status"`
// This field is from variant [ResponseOutputMessage].
@@ -13496,17 +17131,26 @@ type ResponseItemUnion struct {
// This field is a union of [string], [any], [string], [string]
Arguments ResponseItemUnionArguments `json:"arguments"`
Name string `json:"name"`
- Namespace string `json:"namespace"`
- Execution string `json:"execution"`
- // This field is a union of [[]ToolUnion], [[]ResponseItemMcpListToolsTool]
+ // This field is a union of [ResponseFunctionToolCallCallerUnion],
+ // [ResponseFunctionToolCallOutputItemCallerUnion],
+ // [ResponseFunctionShellToolCallCallerUnion],
+ // [ResponseFunctionShellToolCallOutputCallerUnion],
+ // [ResponseApplyPatchToolCallCallerUnion],
+ // [ResponseApplyPatchToolCallOutputCallerUnion],
+ // [ResponseCustomToolCallCallerUnion], [ResponseCustomToolCallOutputCallerUnion]
+ Caller ResponseItemUnionCaller `json:"caller"`
+ Namespace string `json:"namespace"`
+ Execution string `json:"execution"`
+ // This field is a union of [[]ToolUnion], [[]ToolUnion],
+ // [[]ResponseItemMcpListToolsTool]
Tools ResponseItemUnionTools `json:"tools"`
// This field is from variant [ResponseReasoningItem].
Summary []ResponseReasoningItemSummary `json:"summary"`
EncryptedContent string `json:"encrypted_content"`
- // This field is from variant [ResponseItemImageGenerationCall].
- Result string `json:"result"`
- // This field is from variant [ResponseCodeInterpreterToolCall].
- Code string `json:"code"`
+ Code string `json:"code"`
+ // This field is from variant [ResponseItemProgram].
+ Fingerprint string `json:"fingerprint"`
+ Result string `json:"result"`
// This field is from variant [ResponseCodeInterpreterToolCall].
ContainerID string `json:"container_id"`
// This field is from variant [ResponseCodeInterpreterToolCall].
@@ -13544,13 +17188,15 @@ type ResponseItemUnion struct {
CreatedBy respjson.Field
Arguments respjson.Field
Name respjson.Field
+ Caller respjson.Field
Namespace respjson.Field
Execution respjson.Field
Tools respjson.Field
Summary respjson.Field
EncryptedContent respjson.Field
- Result respjson.Field
Code respjson.Field
+ Fingerprint respjson.Field
+ Result respjson.Field
ContainerID respjson.Field
Outputs respjson.Field
Environment respjson.Field
@@ -13582,7 +17228,10 @@ func (ResponseFunctionToolCallItem) implResponseItemUnion() {}
func (ResponseFunctionToolCallOutputItem) implResponseItemUnion() {}
func (ResponseToolSearchCall) implResponseItemUnion() {}
func (ResponseToolSearchOutputItem) implResponseItemUnion() {}
+func (ResponseItemAdditionalTools) implResponseItemUnion() {}
func (ResponseReasoningItem) implResponseItemUnion() {}
+func (ResponseItemProgram) implResponseItemUnion() {}
+func (ResponseItemProgramOutput) implResponseItemUnion() {}
func (ResponseCompactionItem) implResponseItemUnion() {}
func (ResponseItemImageGenerationCall) implResponseItemUnion() {}
func (ResponseCodeInterpreterToolCall) implResponseItemUnion() {}
@@ -13612,7 +17261,10 @@ func (ResponseCustomToolCallOutputItem) implResponseItemUnion() {}
// case responses.ResponseFunctionToolCallOutputItem:
// case responses.ResponseToolSearchCall:
// case responses.ResponseToolSearchOutputItem:
+// case responses.ResponseItemAdditionalTools:
// case responses.ResponseReasoningItem:
+// case responses.ResponseItemProgram:
+// case responses.ResponseItemProgramOutput:
// case responses.ResponseCompactionItem:
// case responses.ResponseItemImageGenerationCall:
// case responses.ResponseCodeInterpreterToolCall:
@@ -13651,8 +17303,14 @@ func (u ResponseItemUnion) AsAny() anyResponseItem {
return u.AsToolSearchCall()
case "tool_search_output":
return u.AsToolSearchOutput()
+ case "additional_tools":
+ return u.AsAdditionalTools()
case "reasoning":
return u.AsReasoning()
+ case "program":
+ return u.AsProgram()
+ case "program_output":
+ return u.AsProgramOutput()
case "compaction":
return u.AsCompaction()
case "image_generation_call":
@@ -13737,11 +17395,26 @@ func (u ResponseItemUnion) AsToolSearchOutput() (v ResponseToolSearchOutputItem)
return
}
+func (u ResponseItemUnion) AsAdditionalTools() (v ResponseItemAdditionalTools) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
func (u ResponseItemUnion) AsReasoning() (v ResponseReasoningItem) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
+func (u ResponseItemUnion) AsProgram() (v ResponseItemProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseItemUnion) AsProgramOutput() (v ResponseItemProgramOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
func (u ResponseItemUnion) AsCompaction() (v ResponseCompactionItem) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
@@ -13878,10 +17551,10 @@ type ResponseItemUnionAction struct {
// This field is from variant [ResponseComputerToolCallActionUnion].
Text string `json:"text"`
// This field is from variant [ResponseFunctionWebSearchActionUnion].
- Query string `json:"query"`
- // This field is from variant [ResponseFunctionWebSearchActionUnion].
Queries []string `json:"queries"`
// This field is from variant [ResponseFunctionWebSearchActionUnion].
+ Query string `json:"query"`
+ // This field is from variant [ResponseFunctionWebSearchActionUnion].
Sources []ResponseFunctionWebSearchActionSearchSource `json:"sources"`
URL string `json:"url"`
// This field is from variant [ResponseFunctionWebSearchActionUnion].
@@ -13909,8 +17582,8 @@ type ResponseItemUnionAction struct {
ScrollX respjson.Field
ScrollY respjson.Field
Text respjson.Field
- Query respjson.Field
Queries respjson.Field
+ Query respjson.Field
Sources respjson.Field
URL respjson.Field
Pattern respjson.Field
@@ -13995,6 +17668,26 @@ func (r *ResponseItemUnionArguments) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// ResponseItemUnionCaller is an implicit subunion of [ResponseItemUnion].
+// ResponseItemUnionCaller provides convenient access to the sub-properties of the
+// union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [ResponseItemUnion].
+type ResponseItemUnionCaller struct {
+ Type string `json:"type"`
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *ResponseItemUnionCaller) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// ResponseItemUnionTools is an implicit subunion of [ResponseItemUnion].
// ResponseItemUnionTools provides convenient access to the sub-properties of the
// union.
@@ -14021,6 +17714,95 @@ func (r *ResponseItemUnionTools) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+type ResponseItemAdditionalTools struct {
+ // The unique ID of the additional tools item.
+ ID string `json:"id" api:"required"`
+ // The role that provided the additional tools.
+ //
+ // Any of "unknown", "user", "assistant", "system", "critic", "discriminator",
+ // "developer", "tool".
+ Role string `json:"role" api:"required"`
+ // The additional tool definitions made available at this item.
+ Tools []ToolUnion `json:"tools" api:"required"`
+ // The type of the item. Always `additional_tools`.
+ Type constant.AdditionalTools `json:"type" default:"additional_tools"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Role respjson.Field
+ Tools respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseItemAdditionalTools) RawJSON() string { return r.JSON.raw }
+func (r *ResponseItemAdditionalTools) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseItemProgram struct {
+ // The unique ID of the program item.
+ ID string `json:"id" api:"required"`
+ // The stable call ID of the program item.
+ CallID string `json:"call_id" api:"required"`
+ // The JavaScript source executed by programmatic tool calling.
+ Code string `json:"code" api:"required"`
+ // Opaque program replay fingerprint that must be round-tripped.
+ Fingerprint string `json:"fingerprint" api:"required"`
+ // The type of the item. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Code respjson.Field
+ Fingerprint respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseItemProgram) RawJSON() string { return r.JSON.raw }
+func (r *ResponseItemProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseItemProgramOutput struct {
+ // The unique ID of the program output item.
+ ID string `json:"id" api:"required"`
+ // The call ID of the program item.
+ CallID string `json:"call_id" api:"required"`
+ // The result produced by the program item.
+ Result string `json:"result" api:"required"`
+ // The terminal status of the program output item.
+ //
+ // Any of "completed", "incomplete".
+ Status string `json:"status" api:"required"`
+ // The type of the item. Always `program_output`.
+ Type constant.ProgramOutput `json:"type" default:"program_output"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Result respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseItemProgramOutput) RawJSON() string { return r.JSON.raw }
+func (r *ResponseItemProgramOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// An image generation request made by the model.
type ResponseItemImageGenerationCall struct {
// The unique ID of the image generation call.
@@ -14556,15 +18338,16 @@ func (r *ResponseMcpListToolsInProgressEvent) UnmarshalJSON(data []byte) error {
// [ResponseFunctionToolCall], [ResponseFunctionToolCallOutputItem],
// [ResponseFunctionWebSearch], [ResponseComputerToolCall],
// [ResponseComputerToolCallOutputItem], [ResponseReasoningItem],
+// [ResponseOutputItemProgram], [ResponseOutputItemProgramOutput],
// [ResponseToolSearchCall], [ResponseToolSearchOutputItem],
-// [ResponseCompactionItem], [ResponseOutputItemImageGenerationCall],
-// [ResponseCodeInterpreterToolCall], [ResponseOutputItemLocalShellCall],
-// [ResponseOutputItemLocalShellCallOutput], [ResponseFunctionShellToolCall],
-// [ResponseFunctionShellToolCallOutput], [ResponseApplyPatchToolCall],
-// [ResponseApplyPatchToolCallOutput], [ResponseOutputItemMcpCall],
-// [ResponseOutputItemMcpListTools], [ResponseOutputItemMcpApprovalRequest],
-// [ResponseOutputItemMcpApprovalResponse], [ResponseCustomToolCall],
-// [ResponseCustomToolCallOutputItem].
+// [ResponseOutputItemAdditionalTools], [ResponseCompactionItem],
+// [ResponseOutputItemImageGenerationCall], [ResponseCodeInterpreterToolCall],
+// [ResponseOutputItemLocalShellCall], [ResponseOutputItemLocalShellCallOutput],
+// [ResponseFunctionShellToolCall], [ResponseFunctionShellToolCallOutput],
+// [ResponseApplyPatchToolCall], [ResponseApplyPatchToolCallOutput],
+// [ResponseOutputItemMcpCall], [ResponseOutputItemMcpListTools],
+// [ResponseOutputItemMcpApprovalRequest], [ResponseOutputItemMcpApprovalResponse],
+// [ResponseCustomToolCall], [ResponseCustomToolCallOutputItem].
//
// Use the [ResponseOutputItemUnion.AsAny] method to switch on the variant.
//
@@ -14572,12 +18355,12 @@ func (r *ResponseMcpListToolsInProgressEvent) UnmarshalJSON(data []byte) error {
type ResponseOutputItemUnion struct {
ID string `json:"id"`
Content []ResponseOutputMessageContentUnion `json:"content"`
- // This field is from variant [ResponseOutputMessage].
- Role constant.Assistant `json:"role"`
- Status string `json:"status"`
+ Role string `json:"role"`
+ Status string `json:"status"`
// Any of "message", "file_search_call", "function_call", "function_call_output",
// "web_search_call", "computer_call", "computer_call_output", "reasoning",
- // "tool_search_call", "tool_search_output", "compaction", "image_generation_call",
+ // "program", "program_output", "tool_search_call", "tool_search_output",
+ // "additional_tools", "compaction", "image_generation_call",
// "code_interpreter_call", "local_shell_call", "local_shell_call_output",
// "shell_call", "shell_call_output", "apply_patch_call",
// "apply_patch_call_output", "mcp_call", "mcp_list_tools", "mcp_approval_request",
@@ -14593,7 +18376,15 @@ type ResponseOutputItemUnion struct {
Arguments ResponseOutputItemUnionArguments `json:"arguments"`
CallID string `json:"call_id"`
Name string `json:"name"`
- Namespace string `json:"namespace"`
+ // This field is a union of [ResponseFunctionToolCallCallerUnion],
+ // [ResponseFunctionToolCallOutputItemCallerUnion],
+ // [ResponseFunctionShellToolCallCallerUnion],
+ // [ResponseFunctionShellToolCallOutputCallerUnion],
+ // [ResponseApplyPatchToolCallCallerUnion],
+ // [ResponseApplyPatchToolCallOutputCallerUnion],
+ // [ResponseCustomToolCallCallerUnion], [ResponseCustomToolCallOutputCallerUnion]
+ Caller ResponseOutputItemUnionCaller `json:"caller"`
+ Namespace string `json:"namespace"`
// This field is a union of [ResponseFunctionToolCallOutputItemOutputUnion],
// [ResponseComputerToolCallOutputScreenshot], [string],
// [[]ResponseFunctionShellToolCallOutputOutput], [string], [string],
@@ -14613,13 +18404,14 @@ type ResponseOutputItemUnion struct {
// This field is from variant [ResponseReasoningItem].
Summary []ResponseReasoningItemSummary `json:"summary"`
EncryptedContent string `json:"encrypted_content"`
- Execution string `json:"execution"`
- // This field is a union of [[]ToolUnion], [[]ResponseOutputItemMcpListToolsTool]
+ Code string `json:"code"`
+ // This field is from variant [ResponseOutputItemProgram].
+ Fingerprint string `json:"fingerprint"`
+ Result string `json:"result"`
+ Execution string `json:"execution"`
+ // This field is a union of [[]ToolUnion], [[]ToolUnion],
+ // [[]ResponseOutputItemMcpListToolsTool]
Tools ResponseOutputItemUnionTools `json:"tools"`
- // This field is from variant [ResponseOutputItemImageGenerationCall].
- Result string `json:"result"`
- // This field is from variant [ResponseCodeInterpreterToolCall].
- Code string `json:"code"`
// This field is from variant [ResponseCodeInterpreterToolCall].
ContainerID string `json:"container_id"`
// This field is from variant [ResponseCodeInterpreterToolCall].
@@ -14651,6 +18443,7 @@ type ResponseOutputItemUnion struct {
Arguments respjson.Field
CallID respjson.Field
Name respjson.Field
+ Caller respjson.Field
Namespace respjson.Field
Output respjson.Field
CreatedBy respjson.Field
@@ -14660,10 +18453,11 @@ type ResponseOutputItemUnion struct {
AcknowledgedSafetyChecks respjson.Field
Summary respjson.Field
EncryptedContent respjson.Field
+ Code respjson.Field
+ Fingerprint respjson.Field
+ Result respjson.Field
Execution respjson.Field
Tools respjson.Field
- Result respjson.Field
- Code respjson.Field
ContainerID respjson.Field
Outputs respjson.Field
Environment respjson.Field
@@ -14694,8 +18488,11 @@ func (ResponseFunctionWebSearch) implResponseOutputItemUnion() {}
func (ResponseComputerToolCall) implResponseOutputItemUnion() {}
func (ResponseComputerToolCallOutputItem) implResponseOutputItemUnion() {}
func (ResponseReasoningItem) implResponseOutputItemUnion() {}
+func (ResponseOutputItemProgram) implResponseOutputItemUnion() {}
+func (ResponseOutputItemProgramOutput) implResponseOutputItemUnion() {}
func (ResponseToolSearchCall) implResponseOutputItemUnion() {}
func (ResponseToolSearchOutputItem) implResponseOutputItemUnion() {}
+func (ResponseOutputItemAdditionalTools) implResponseOutputItemUnion() {}
func (ResponseCompactionItem) implResponseOutputItemUnion() {}
func (ResponseOutputItemImageGenerationCall) implResponseOutputItemUnion() {}
func (ResponseCodeInterpreterToolCall) implResponseOutputItemUnion() {}
@@ -14723,8 +18520,11 @@ func (ResponseCustomToolCallOutputItem) implResponseOutputItemUnion() {}
// case responses.ResponseComputerToolCall:
// case responses.ResponseComputerToolCallOutputItem:
// case responses.ResponseReasoningItem:
+// case responses.ResponseOutputItemProgram:
+// case responses.ResponseOutputItemProgramOutput:
// case responses.ResponseToolSearchCall:
// case responses.ResponseToolSearchOutputItem:
+// case responses.ResponseOutputItemAdditionalTools:
// case responses.ResponseCompactionItem:
// case responses.ResponseOutputItemImageGenerationCall:
// case responses.ResponseCodeInterpreterToolCall:
@@ -14761,10 +18561,16 @@ func (u ResponseOutputItemUnion) AsAny() anyResponseOutputItem {
return u.AsComputerCallOutput()
case "reasoning":
return u.AsReasoning()
+ case "program":
+ return u.AsProgram()
+ case "program_output":
+ return u.AsProgramOutput()
case "tool_search_call":
return u.AsToolSearchCall()
case "tool_search_output":
return u.AsToolSearchOutput()
+ case "additional_tools":
+ return u.AsAdditionalTools()
case "compaction":
return u.AsCompaction()
case "image_generation_call":
@@ -14839,6 +18645,16 @@ func (u ResponseOutputItemUnion) AsReasoning() (v ResponseReasoningItem) {
return
}
+func (u ResponseOutputItemUnion) AsProgram() (v ResponseOutputItemProgram) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseOutputItemUnion) AsProgramOutput() (v ResponseOutputItemProgramOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
func (u ResponseOutputItemUnion) AsToolSearchCall() (v ResponseToolSearchCall) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
@@ -14849,6 +18665,11 @@ func (u ResponseOutputItemUnion) AsToolSearchOutput() (v ResponseToolSearchOutpu
return
}
+func (u ResponseOutputItemUnion) AsAdditionalTools() (v ResponseOutputItemAdditionalTools) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
func (u ResponseOutputItemUnion) AsCompaction() (v ResponseCompactionItem) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
@@ -14956,6 +18777,26 @@ func (r *ResponseOutputItemUnionArguments) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// ResponseOutputItemUnionCaller is an implicit subunion of
+// [ResponseOutputItemUnion]. ResponseOutputItemUnionCaller provides convenient
+// access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [ResponseOutputItemUnion].
+type ResponseOutputItemUnionCaller struct {
+ Type string `json:"type"`
+ CallerID string `json:"caller_id"`
+ JSON struct {
+ Type respjson.Field
+ CallerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *ResponseOutputItemUnionCaller) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// ResponseOutputItemUnionOutput is an implicit subunion of
// [ResponseOutputItemUnion]. ResponseOutputItemUnionOutput provides convenient
// access to the sub-properties of the union.
@@ -15004,12 +18845,12 @@ func (r *ResponseOutputItemUnionOutput) UnmarshalJSON(data []byte) error {
// For type safety it is recommended to directly use a variant of the
// [ResponseOutputItemUnion].
type ResponseOutputItemUnionAction struct {
- // This field is from variant [ResponseFunctionWebSearchActionUnion].
- Query string `json:"query"`
- Type string `json:"type"`
+ Type string `json:"type"`
// This field is from variant [ResponseFunctionWebSearchActionUnion].
Queries []string `json:"queries"`
// This field is from variant [ResponseFunctionWebSearchActionUnion].
+ Query string `json:"query"`
+ // This field is from variant [ResponseFunctionWebSearchActionUnion].
Sources []ResponseFunctionWebSearchActionSearchSource `json:"sources"`
URL string `json:"url"`
// This field is from variant [ResponseFunctionWebSearchActionUnion].
@@ -15041,9 +18882,9 @@ type ResponseOutputItemUnionAction struct {
// This field is from variant [ResponseFunctionShellToolCallAction].
MaxOutputLength int64 `json:"max_output_length"`
JSON struct {
- Query respjson.Field
Type respjson.Field
Queries respjson.Field
+ Query respjson.Field
Sources respjson.Field
URL respjson.Field
Pattern respjson.Field
@@ -15092,7 +18933,96 @@ type ResponseOutputItemUnionTools struct {
} `json:"-"`
}
-func (r *ResponseOutputItemUnionTools) UnmarshalJSON(data []byte) error {
+func (r *ResponseOutputItemUnionTools) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseOutputItemProgram struct {
+ // The unique ID of the program item.
+ ID string `json:"id" api:"required"`
+ // The stable call ID of the program item.
+ CallID string `json:"call_id" api:"required"`
+ // The JavaScript source executed by programmatic tool calling.
+ Code string `json:"code" api:"required"`
+ // Opaque program replay fingerprint that must be round-tripped.
+ Fingerprint string `json:"fingerprint" api:"required"`
+ // The type of the item. Always `program`.
+ Type constant.Program `json:"type" default:"program"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Code respjson.Field
+ Fingerprint respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseOutputItemProgram) RawJSON() string { return r.JSON.raw }
+func (r *ResponseOutputItemProgram) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseOutputItemProgramOutput struct {
+ // The unique ID of the program output item.
+ ID string `json:"id" api:"required"`
+ // The call ID of the program item.
+ CallID string `json:"call_id" api:"required"`
+ // The result produced by the program item.
+ Result string `json:"result" api:"required"`
+ // The terminal status of the program output item.
+ //
+ // Any of "completed", "incomplete".
+ Status string `json:"status" api:"required"`
+ // The type of the item. Always `program_output`.
+ Type constant.ProgramOutput `json:"type" default:"program_output"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Result respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseOutputItemProgramOutput) RawJSON() string { return r.JSON.raw }
+func (r *ResponseOutputItemProgramOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseOutputItemAdditionalTools struct {
+ // The unique ID of the additional tools item.
+ ID string `json:"id" api:"required"`
+ // The role that provided the additional tools.
+ //
+ // Any of "unknown", "user", "assistant", "system", "critic", "discriminator",
+ // "developer", "tool".
+ Role string `json:"role" api:"required"`
+ // The additional tool definitions made available at this item.
+ Tools []ToolUnion `json:"tools" api:"required"`
+ // The type of the item. Always `additional_tools`.
+ Type constant.AdditionalTools `json:"type" default:"additional_tools"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Role respjson.Field
+ Tools respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseOutputItemAdditionalTools) RawJSON() string { return r.JSON.raw }
+func (r *ResponseOutputItemAdditionalTools) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
@@ -15924,7 +19854,7 @@ type ResponseOutputTextAnnotationURLCitation struct {
// The type of the URL citation. Always `url_citation`.
Type constant.URLCitation `json:"type" default:"url_citation"`
// The URL of the web resource.
- URL string `json:"url" api:"required"`
+ URL string `json:"url" api:"required" format:"uri"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
EndIndex respjson.Field
@@ -16235,7 +20165,7 @@ type ResponseOutputTextAnnotationURLCitationParam struct {
// The title of the web resource.
Title string `json:"title" api:"required"`
// The URL of the web resource.
- URL string `json:"url" api:"required"`
+ URL string `json:"url" api:"required" format:"uri"`
// The type of the URL citation. Always `url_citation`.
//
// This field can be elided, and will marshal its zero value as "url_citation".
@@ -16425,10 +20355,14 @@ type ResponsePromptVariableUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field is from variant [ResponseInputText].
- Text string `json:"text"`
- Type string `json:"type"`
- Detail string `json:"detail"`
- FileID string `json:"file_id"`
+ Text string `json:"text"`
+ Type string `json:"type"`
+ // This field is a union of [ResponseInputTextPromptCacheBreakpoint],
+ // [ResponseInputImagePromptCacheBreakpoint],
+ // [ResponseInputFilePromptCacheBreakpoint]
+ PromptCacheBreakpoint ResponsePromptVariableUnionPromptCacheBreakpoint `json:"prompt_cache_breakpoint"`
+ Detail string `json:"detail"`
+ FileID string `json:"file_id"`
// This field is from variant [ResponseInputImage].
ImageURL string `json:"image_url"`
// This field is from variant [ResponseInputFile].
@@ -16438,16 +20372,17 @@ type ResponsePromptVariableUnion struct {
// This field is from variant [ResponseInputFile].
Filename string `json:"filename"`
JSON struct {
- OfString respjson.Field
- Text respjson.Field
- Type respjson.Field
- Detail respjson.Field
- FileID respjson.Field
- ImageURL respjson.Field
- FileData respjson.Field
- FileURL respjson.Field
- Filename respjson.Field
- raw string
+ OfString respjson.Field
+ Text respjson.Field
+ Type respjson.Field
+ PromptCacheBreakpoint respjson.Field
+ Detail respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ FileData respjson.Field
+ FileURL respjson.Field
+ Filename respjson.Field
+ raw string
} `json:"-"`
}
@@ -16478,6 +20413,25 @@ func (r *ResponsePromptVariableUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// ResponsePromptVariableUnionPromptCacheBreakpoint is an implicit subunion of
+// [ResponsePromptVariableUnion]. ResponsePromptVariableUnionPromptCacheBreakpoint
+// provides convenient access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [ResponsePromptVariableUnion].
+type ResponsePromptVariableUnionPromptCacheBreakpoint struct {
+ // This field is from variant [ResponseInputTextPromptCacheBreakpoint].
+ Mode constant.Explicit `json:"mode"`
+ JSON struct {
+ Mode respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *ResponsePromptVariableUnionPromptCacheBreakpoint) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// Reference to a prompt template and its variables.
// [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
//
@@ -16605,6 +20559,49 @@ func (u ResponsePromptVariableUnionParam) GetFileID() *string {
return nil
}
+// Returns a subunion which exports methods to access subproperties
+//
+// Or use AsAny() to get the underlying value
+func (u ResponsePromptVariableUnionParam) GetPromptCacheBreakpoint() (res responsePromptVariableUnionParamPromptCacheBreakpoint) {
+ if vt := u.OfInputText; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ } else if vt := u.OfInputImage; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ } else if vt := u.OfInputFile; vt != nil {
+ res.any = &vt.PromptCacheBreakpoint
+ }
+ return
+}
+
+// Can have the runtime types [*ResponseInputTextPromptCacheBreakpointParam],
+// [*ResponseInputImagePromptCacheBreakpointParam],
+// [*ResponseInputFilePromptCacheBreakpointParam]
+type responsePromptVariableUnionParamPromptCacheBreakpoint struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *responses.ResponseInputTextPromptCacheBreakpointParam:
+// case *responses.ResponseInputImagePromptCacheBreakpointParam:
+// case *responses.ResponseInputFilePromptCacheBreakpointParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u responsePromptVariableUnionParamPromptCacheBreakpoint) AsAny() any { return u.any }
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u responsePromptVariableUnionParamPromptCacheBreakpoint) GetMode() *string {
+ switch vt := u.any.(type) {
+ case *ResponseInputTextPromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ case *ResponseInputImagePromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ case *ResponseInputFilePromptCacheBreakpointParam:
+ return (*string)(&vt.Mode)
+ }
+ return nil
+}
+
// Emitted when a response is queued and waiting to be processed.
type ResponseQueuedEvent struct {
// The full response object that is queued.
@@ -16642,8 +20639,9 @@ type ResponseReasoningItem struct {
Type constant.Reasoning `json:"type" default:"reasoning"`
// Reasoning text content.
Content []ResponseReasoningItemContent `json:"content"`
- // The encrypted content of the reasoning item - populated when a response is
- // generated with `reasoning.encrypted_content` in the `include` parameter.
+ // The encrypted content of the reasoning item. This is populated by default for
+ // reasoning items returned by `POST /v1/responses` and WebSocket `response.create`
+ // requests.
EncryptedContent string `json:"encrypted_content" api:"nullable"`
// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
// Populated when items are returned via API.
@@ -16743,8 +20741,9 @@ type ResponseReasoningItemParam struct {
ID string `json:"id" api:"required"`
// Reasoning summary content.
Summary []ResponseReasoningItemSummaryParam `json:"summary,omitzero" api:"required"`
- // The encrypted content of the reasoning item - populated when a response is
- // generated with `reasoning.encrypted_content` in the `include` parameter.
+ // The encrypted content of the reasoning item. This is populated by default for
+ // reasoning items returned by `POST /v1/responses` and WebSocket `response.create`
+ // requests.
EncryptedContent param.Opt[string] `json:"encrypted_content,omitzero"`
// Reasoning text content.
Content []ResponseReasoningItemContentParam `json:"content,omitzero"`
@@ -16878,6 +20877,11 @@ type ResponseReasoningSummaryPartDoneEvent struct {
SummaryIndex int64 `json:"summary_index" api:"required"`
// The type of the event. Always `response.reasoning_summary_part.done`.
Type constant.ResponseReasoningSummaryPartDone `json:"type" default:"response.reasoning_summary_part.done"`
+ // The completion status of the summary part. Omitted when the part completed
+ // normally and set to `incomplete` when generation was interrupted.
+ //
+ // Any of "incomplete".
+ Status ResponseReasoningSummaryPartDoneEventStatus `json:"status"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ItemID respjson.Field
@@ -16886,6 +20890,7 @@ type ResponseReasoningSummaryPartDoneEvent struct {
SequenceNumber respjson.Field
SummaryIndex respjson.Field
Type respjson.Field
+ Status respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
@@ -16918,6 +20923,14 @@ func (r *ResponseReasoningSummaryPartDoneEventPart) UnmarshalJSON(data []byte) e
return apijson.UnmarshalRoot(data, r)
}
+// The completion status of the summary part. Omitted when the part completed
+// normally and set to `incomplete` when generation was interrupted.
+type ResponseReasoningSummaryPartDoneEventStatus string
+
+const (
+ ResponseReasoningSummaryPartDoneEventStatusIncomplete ResponseReasoningSummaryPartDoneEventStatus = "incomplete"
+)
+
// Emitted when a delta is added to a reasoning summary text.
type ResponseReasoningSummaryTextDeltaEvent struct {
// The text delta that was added to the summary.
@@ -17220,7 +21233,9 @@ type ResponseStreamEventUnion struct {
// This field is from variant [ResponseOutputItemAddedEvent].
Item ResponseOutputItemUnion `json:"item"`
SummaryIndex int64 `json:"summary_index"`
- Text string `json:"text"`
+ // This field is from variant [ResponseReasoningSummaryPartDoneEvent].
+ Status ResponseReasoningSummaryPartDoneEventStatus `json:"status"`
+ Text string `json:"text"`
// This field is from variant [ResponseRefusalDoneEvent].
Refusal string `json:"refusal"`
// This field is a union of [[]ResponseTextDeltaEventLogprob],
@@ -17252,6 +21267,7 @@ type ResponseStreamEventUnion struct {
Name respjson.Field
Item respjson.Field
SummaryIndex respjson.Field
+ Status respjson.Field
Text respjson.Field
Refusal respjson.Field
Logprobs respjson.Field
@@ -17849,7 +21865,8 @@ type ResponseTextConfig struct {
Format ResponseFormatTextConfigUnion `json:"format"`
// Constrains the verbosity of the model's response. Lower values will result in
// more concise responses, while higher values will result in more verbose
- // responses. Currently supported values are `low`, `medium`, and `high`.
+ // responses. Currently supported values are `low`, `medium`, and `high`. The
+ // default is `medium`.
//
// Any of "low", "medium", "high".
Verbosity ResponseTextConfigVerbosity `json:"verbosity" api:"nullable"`
@@ -17879,7 +21896,8 @@ func (r ResponseTextConfig) ToParam() ResponseTextConfigParam {
// Constrains the verbosity of the model's response. Lower values will result in
// more concise responses, while higher values will result in more verbose
-// responses. Currently supported values are `low`, `medium`, and `high`.
+// responses. Currently supported values are `low`, `medium`, and `high`. The
+// default is `medium`.
type ResponseTextConfigVerbosity string
const (
@@ -17896,7 +21914,8 @@ const (
type ResponseTextConfigParam struct {
// Constrains the verbosity of the model's response. Lower values will result in
// more concise responses, while higher values will result in more verbose
- // responses. Currently supported values are `low`, `medium`, and `high`.
+ // responses. Currently supported values are `low`, `medium`, and `high`. The
+ // default is `medium`.
//
// Any of "low", "medium", "high".
Verbosity ResponseTextConfigVerbosity `json:"verbosity,omitzero"`
@@ -17969,7 +21988,7 @@ type ResponseTextDeltaEventLogprob struct {
Token string `json:"token" api:"required"`
// The log probability of this token.
Logprob float64 `json:"logprob" api:"required"`
- // The log probability of the top 20 most likely tokens.
+ // The log probabilities of up to 20 of the most likely tokens.
TopLogprobs []ResponseTextDeltaEventLogprobTopLogprob `json:"top_logprobs"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
@@ -18051,7 +22070,7 @@ type ResponseTextDoneEventLogprob struct {
Token string `json:"token" api:"required"`
// The log probability of this token.
Logprob float64 `json:"logprob" api:"required"`
- // The log probability of the top 20 most likely tokens.
+ // The log probabilities of up to 20 of the most likely tokens.
TopLogprobs []ResponseTextDoneEventLogprobTopLogprob `json:"top_logprobs"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
@@ -18333,14 +22352,17 @@ func (r *ResponseUsage) UnmarshalJSON(data []byte) error {
// A detailed breakdown of the input tokens.
type ResponseUsageInputTokensDetails struct {
+ // The number of input tokens that were written to the cache.
+ CacheWriteTokens int64 `json:"cache_write_tokens" api:"required"`
// The number of tokens that were retrieved from the cache.
// [More on prompt caching](https://platform.openai.com/docs/guides/prompt-caching).
CachedTokens int64 `json:"cached_tokens" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- CachedTokens respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ CacheWriteTokens respjson.Field
+ CachedTokens respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -18504,9 +22526,9 @@ func (r *SkillReferenceParam) UnmarshalJSON(data []byte) error {
// ToolUnion contains all possible properties and values from [FunctionTool],
// [FileSearchTool], [ComputerTool], [ComputerUsePreviewTool], [WebSearchTool],
-// [ToolMcp], [ToolCodeInterpreter], [ToolImageGeneration], [ToolLocalShell],
-// [FunctionShellTool], [CustomTool], [NamespaceTool], [ToolSearchTool],
-// [WebSearchPreviewTool], [ApplyPatchTool].
+// [ToolMcp], [ToolCodeInterpreter], [ToolProgrammaticToolCalling],
+// [ToolImageGeneration], [ToolLocalShell], [FunctionShellTool], [CustomTool],
+// [NamespaceTool], [ToolSearchTool], [WebSearchPreviewTool], [ApplyPatchTool].
//
// Use the [ToolUnion.AsAny] method to switch on the variant.
//
@@ -18517,11 +22539,15 @@ type ToolUnion struct {
// This field is from variant [FunctionTool].
Strict bool `json:"strict"`
// Any of "function", "file_search", "computer", "computer_use_preview", nil,
- // "mcp", "code_interpreter", "image_generation", "local_shell", "shell", "custom",
- // "namespace", "tool_search", nil, "apply_patch".
- Type string `json:"type"`
- DeferLoading bool `json:"defer_loading"`
- Description string `json:"description"`
+ // "mcp", "code_interpreter", "programmatic_tool_calling", "image_generation",
+ // "local_shell", "shell", "custom", "namespace", "tool_search", nil,
+ // "apply_patch".
+ Type string `json:"type"`
+ AllowedCallers []string `json:"allowed_callers"`
+ DeferLoading bool `json:"defer_loading"`
+ Description string `json:"description"`
+ // This field is from variant [FunctionTool].
+ OutputSchema map[string]any `json:"output_schema"`
// This field is from variant [FileSearchTool].
VectorStoreIDs []string `json:"vector_store_ids"`
// This field is a union of [FileSearchToolFiltersUnion], [WebSearchToolFilters]
@@ -18557,6 +22583,8 @@ type ToolUnion struct {
ServerDescription string `json:"server_description"`
// This field is from variant [ToolMcp].
ServerURL string `json:"server_url"`
+ // This field is from variant [ToolMcp].
+ TunnelID string `json:"tunnel_id"`
// This field is from variant [ToolCodeInterpreter].
Container ToolCodeInterpreterContainerUnion `json:"container"`
// This field is from variant [ToolImageGeneration].
@@ -18594,8 +22622,10 @@ type ToolUnion struct {
Parameters respjson.Field
Strict respjson.Field
Type respjson.Field
+ AllowedCallers respjson.Field
DeferLoading respjson.Field
Description respjson.Field
+ OutputSchema respjson.Field
VectorStoreIDs respjson.Field
Filters respjson.Field
MaxNumResults respjson.Field
@@ -18613,6 +22643,7 @@ type ToolUnion struct {
RequireApproval respjson.Field
ServerDescription respjson.Field
ServerURL respjson.Field
+ TunnelID respjson.Field
Container respjson.Field
Action respjson.Field
Background respjson.Field
@@ -18668,6 +22699,11 @@ func (u ToolUnion) AsCodeInterpreter() (v ToolCodeInterpreter) {
return
}
+func (u ToolUnion) AsProgrammaticToolCalling() (v ToolProgrammaticToolCalling) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
func (u ToolUnion) AsImageGeneration() (v ToolImageGeneration) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
@@ -18850,6 +22886,10 @@ type ToolMcp struct {
ServerLabel string `json:"server_label" api:"required"`
// The type of the MCP tool. Always `mcp`.
Type constant.Mcp `json:"type" default:"mcp"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers" api:"nullable"`
// List of allowed tool names or a filter object.
AllowedTools ToolMcpAllowedToolsUnion `json:"allowed_tools" api:"nullable"`
// An OAuth access token that can be used with a remote MCP server, either with a
@@ -18857,8 +22897,8 @@ type ToolMcp struct {
// OAuth authorization flow and provide the token here.
Authorization string `json:"authorization"`
// Identifier for service connectors, like those available in ChatGPT. One of
- // `server_url` or `connector_id` must be provided. Learn more about service
- // connectors
+ // `server_url`, `connector_id`, or `tunnel_id` must be provided. Learn more about
+ // service connectors
// [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
//
// Currently supported `connector_id` values are:
@@ -18885,13 +22925,17 @@ type ToolMcp struct {
RequireApproval ToolMcpRequireApprovalUnion `json:"require_approval" api:"nullable"`
// Optional description of the MCP server, used to provide more context.
ServerDescription string `json:"server_description"`
- // The URL for the MCP server. One of `server_url` or `connector_id` must be
- // provided.
- ServerURL string `json:"server_url"`
+ // The URL for the MCP server. One of `server_url`, `connector_id`, or `tunnel_id`
+ // must be provided.
+ ServerURL string `json:"server_url" format:"uri"`
+ // The Secure MCP Tunnel ID to use instead of a direct server URL. One of
+ // `server_url`, `connector_id`, or `tunnel_id` must be provided.
+ TunnelID string `json:"tunnel_id"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ServerLabel respjson.Field
Type respjson.Field
+ AllowedCallers respjson.Field
AllowedTools respjson.Field
Authorization respjson.Field
ConnectorID respjson.Field
@@ -18900,6 +22944,7 @@ type ToolMcp struct {
RequireApproval respjson.Field
ServerDescription respjson.Field
ServerURL respjson.Field
+ TunnelID respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
@@ -19101,12 +23146,17 @@ type ToolCodeInterpreter struct {
Container ToolCodeInterpreterContainerUnion `json:"container" api:"required"`
// The type of the code interpreter tool. Always `code_interpreter`.
Type constant.CodeInterpreter `json:"type" default:"code_interpreter"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Container respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Container respjson.Field
+ Type respjson.Field
+ AllowedCallers respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -19270,6 +23320,23 @@ func (r *ToolCodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicyUnion)
return apijson.UnmarshalRoot(data, r)
}
+type ToolProgrammaticToolCalling struct {
+ // The type of the tool. Always `programmatic_tool_calling`.
+ Type constant.ProgrammaticToolCalling `json:"type" default:"programmatic_tool_calling"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ToolProgrammaticToolCalling) RawJSON() string { return r.JSON.raw }
+func (r *ToolProgrammaticToolCalling) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A tool that generates images using the GPT image models.
type ToolImageGeneration struct {
// The type of the image generation tool. Always `image_generation`.
@@ -19278,8 +23345,18 @@ type ToolImageGeneration struct {
//
// Any of "generate", "edit", "auto".
Action string `json:"action"`
- // Background type for the generated image. One of `transparent`, `opaque`, or
- // `auto`. Default: `auto`.
+ // Allows to set transparency for the background of the generated image(s). This
+ // parameter is only supported for GPT image models that support transparent
+ // backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value).
+ // When `auto` is used, the model will automatically determine the best background
+ // for the image.
+ //
+ // `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent
+ // backgrounds. Requests with `background` set to `transparent` will return an
+ // error for these models; use `opaque` or `auto` instead.
+ //
+ // If `transparent`, the output format needs to support transparency, so it should
+ // be set to either `png` (default value) or `webp`.
//
// Any of "transparent", "opaque", "auto".
Background string `json:"background"`
@@ -19314,10 +23391,17 @@ type ToolImageGeneration struct {
//
// Any of "low", "medium", "high", "auto".
Quality string `json:"quality"`
- // The size of the generated image. One of `1024x1024`, `1024x1536`, `1536x1024`,
- // or `auto`. Default: `auto`.
- //
- // Any of "1024x1024", "1024x1536", "1536x1024", "auto".
+ // The size of the generated images. For `gpt-image-2` and
+ // `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT`
+ // strings, for example `1536x864`. Width and height must both be divisible by 16
+ // and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above
+ // `2560x1440` are experimental, and the maximum supported resolution is
+ // `3840x2160`. The requested size must also satisfy the model's current pixel and
+ // edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are
+ // supported by the GPT image models; `auto` is supported for models that allow
+ // automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or
+ // `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or
+ // `1024x1792`.
Size string `json:"size"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
@@ -19455,21 +23539,22 @@ func ToolParamOfWebSearchPreview(type_ WebSearchPreviewToolType) ToolUnionParam
//
// Use [param.IsOmitted] to confirm if a field is set.
type ToolUnionParam struct {
- OfFunction *FunctionToolParam `json:",omitzero,inline"`
- OfFileSearch *FileSearchToolParam `json:",omitzero,inline"`
- OfComputer *ComputerToolParam `json:",omitzero,inline"`
- OfComputerUsePreview *ComputerUsePreviewToolParam `json:",omitzero,inline"`
- OfWebSearch *WebSearchToolParam `json:",omitzero,inline"`
- OfMcp *ToolMcpParam `json:",omitzero,inline"`
- OfCodeInterpreter *ToolCodeInterpreterParam `json:",omitzero,inline"`
- OfImageGeneration *ToolImageGenerationParam `json:",omitzero,inline"`
- OfLocalShell *ToolLocalShellParam `json:",omitzero,inline"`
- OfShell *FunctionShellToolParam `json:",omitzero,inline"`
- OfCustom *CustomToolParam `json:",omitzero,inline"`
- OfNamespace *NamespaceToolParam `json:",omitzero,inline"`
- OfToolSearch *ToolSearchToolParam `json:",omitzero,inline"`
- OfWebSearchPreview *WebSearchPreviewToolParam `json:",omitzero,inline"`
- OfApplyPatch *ApplyPatchToolParam `json:",omitzero,inline"`
+ OfFunction *FunctionToolParam `json:",omitzero,inline"`
+ OfFileSearch *FileSearchToolParam `json:",omitzero,inline"`
+ OfComputer *ComputerToolParam `json:",omitzero,inline"`
+ OfComputerUsePreview *ComputerUsePreviewToolParam `json:",omitzero,inline"`
+ OfWebSearch *WebSearchToolParam `json:",omitzero,inline"`
+ OfMcp *ToolMcpParam `json:",omitzero,inline"`
+ OfCodeInterpreter *ToolCodeInterpreterParam `json:",omitzero,inline"`
+ OfProgrammaticToolCalling *ToolProgrammaticToolCallingParam `json:",omitzero,inline"`
+ OfImageGeneration *ToolImageGenerationParam `json:",omitzero,inline"`
+ OfLocalShell *ToolLocalShellParam `json:",omitzero,inline"`
+ OfShell *FunctionShellToolParam `json:",omitzero,inline"`
+ OfCustom *CustomToolParam `json:",omitzero,inline"`
+ OfNamespace *NamespaceToolParam `json:",omitzero,inline"`
+ OfToolSearch *ToolSearchToolParam `json:",omitzero,inline"`
+ OfWebSearchPreview *WebSearchPreviewToolParam `json:",omitzero,inline"`
+ OfApplyPatch *ApplyPatchToolParam `json:",omitzero,inline"`
paramUnion
}
@@ -19481,6 +23566,7 @@ func (u ToolUnionParam) MarshalJSON() ([]byte, error) {
u.OfWebSearch,
u.OfMcp,
u.OfCodeInterpreter,
+ u.OfProgrammaticToolCalling,
u.OfImageGeneration,
u.OfLocalShell,
u.OfShell,
@@ -19509,6 +23595,8 @@ func (u *ToolUnionParam) asAny() any {
return u.OfMcp
} else if !param.IsOmitted(u.OfCodeInterpreter) {
return u.OfCodeInterpreter
+ } else if !param.IsOmitted(u.OfProgrammaticToolCalling) {
+ return u.OfProgrammaticToolCalling
} else if !param.IsOmitted(u.OfImageGeneration) {
return u.OfImageGeneration
} else if !param.IsOmitted(u.OfLocalShell) {
@@ -19537,6 +23625,14 @@ func (u ToolUnionParam) GetStrict() *bool {
return nil
}
+// Returns a pointer to the underlying variant's property, if present.
+func (u ToolUnionParam) GetOutputSchema() map[string]any {
+ if vt := u.OfFunction; vt != nil {
+ return vt.OutputSchema
+ }
+ return nil
+}
+
// Returns a pointer to the underlying variant's property, if present.
func (u ToolUnionParam) GetVectorStoreIDs() []string {
if vt := u.OfFileSearch; vt != nil {
@@ -19641,6 +23737,14 @@ func (u ToolUnionParam) GetServerURL() *string {
return nil
}
+// Returns a pointer to the underlying variant's property, if present.
+func (u ToolUnionParam) GetTunnelID() *string {
+ if vt := u.OfMcp; vt != nil && vt.TunnelID.Valid() {
+ return &vt.TunnelID.Value
+ }
+ return nil
+}
+
// Returns a pointer to the underlying variant's property, if present.
func (u ToolUnionParam) GetContainer() *ToolCodeInterpreterContainerUnionParam {
if vt := u.OfCodeInterpreter; vt != nil {
@@ -19797,6 +23901,8 @@ func (u ToolUnionParam) GetType() *string {
return (*string)(&vt.Type)
} else if vt := u.OfCodeInterpreter; vt != nil {
return (*string)(&vt.Type)
+ } else if vt := u.OfProgrammaticToolCalling; vt != nil {
+ return (*string)(&vt.Type)
} else if vt := u.OfImageGeneration; vt != nil {
return (*string)(&vt.Type)
} else if vt := u.OfLocalShell; vt != nil {
@@ -19878,6 +23984,25 @@ type toolUnionParamParameters struct{ any }
// }
func (u toolUnionParamParameters) AsAny() any { return u.any }
+// Returns a pointer to the underlying variant's AllowedCallers property, if
+// present.
+func (u ToolUnionParam) GetAllowedCallers() []string {
+ if vt := u.OfFunction; vt != nil {
+ return vt.AllowedCallers
+ } else if vt := u.OfMcp; vt != nil {
+ return vt.AllowedCallers
+ } else if vt := u.OfCodeInterpreter; vt != nil {
+ return vt.AllowedCallers
+ } else if vt := u.OfShell; vt != nil {
+ return vt.AllowedCallers
+ } else if vt := u.OfCustom; vt != nil {
+ return vt.AllowedCallers
+ } else if vt := u.OfApplyPatch; vt != nil {
+ return vt.AllowedCallers
+ }
+ return nil
+}
+
// Returns a subunion which exports methods to access subproperties
//
// Or use AsAny() to get the underlying value
@@ -20140,6 +24265,7 @@ func init() {
apijson.Discriminator[WebSearchToolParam]("web_search_2025_08_26"),
apijson.Discriminator[ToolMcpParam]("mcp"),
apijson.Discriminator[ToolCodeInterpreterParam]("code_interpreter"),
+ apijson.Discriminator[ToolProgrammaticToolCallingParam]("programmatic_tool_calling"),
apijson.Discriminator[ToolImageGenerationParam]("image_generation"),
apijson.Discriminator[ToolLocalShellParam]("local_shell"),
apijson.Discriminator[FunctionShellToolParam]("shell"),
@@ -20168,9 +24294,16 @@ type ToolMcpParam struct {
DeferLoading param.Opt[bool] `json:"defer_loading,omitzero"`
// Optional description of the MCP server, used to provide more context.
ServerDescription param.Opt[string] `json:"server_description,omitzero"`
- // The URL for the MCP server. One of `server_url` or `connector_id` must be
- // provided.
- ServerURL param.Opt[string] `json:"server_url,omitzero"`
+ // The URL for the MCP server. One of `server_url`, `connector_id`, or `tunnel_id`
+ // must be provided.
+ ServerURL param.Opt[string] `json:"server_url,omitzero" format:"uri"`
+ // The Secure MCP Tunnel ID to use instead of a direct server URL. One of
+ // `server_url`, `connector_id`, or `tunnel_id` must be provided.
+ TunnelID param.Opt[string] `json:"tunnel_id,omitzero"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers,omitzero"`
// List of allowed tool names or a filter object.
AllowedTools ToolMcpAllowedToolsUnionParam `json:"allowed_tools,omitzero"`
// Optional HTTP headers to send to the MCP server. Use for authentication or other
@@ -20179,8 +24312,8 @@ type ToolMcpParam struct {
// Specify which of the MCP server's tools require approval.
RequireApproval ToolMcpRequireApprovalUnionParam `json:"require_approval,omitzero"`
// Identifier for service connectors, like those available in ChatGPT. One of
- // `server_url` or `connector_id` must be provided. Learn more about service
- // connectors
+ // `server_url`, `connector_id`, or `tunnel_id` must be provided. Learn more about
+ // service connectors
// [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
//
// Currently supported `connector_id` values are:
@@ -20357,6 +24490,10 @@ type ToolCodeInterpreterParam struct {
// specifies uploaded file IDs to make available to your code, along with an
// optional `memory_limit` setting.
Container ToolCodeInterpreterContainerUnionParam `json:"container,omitzero" api:"required"`
+ // The tool invocation context(s).
+ //
+ // Any of "direct", "programmatic".
+ AllowedCallers []string `json:"allowed_callers,omitzero"`
// The type of the code interpreter tool. Always `code_interpreter`.
//
// This field can be elided, and will marshal its zero value as "code_interpreter".
@@ -20490,6 +24627,28 @@ func init() {
)
}
+func NewToolProgrammaticToolCallingParam() ToolProgrammaticToolCallingParam {
+ return ToolProgrammaticToolCallingParam{
+ Type: "programmatic_tool_calling",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewToolProgrammaticToolCallingParam].
+type ToolProgrammaticToolCallingParam struct {
+ // The type of the tool. Always `programmatic_tool_calling`.
+ Type constant.ProgrammaticToolCalling `json:"type" default:"programmatic_tool_calling"`
+ paramObj
+}
+
+func (r ToolProgrammaticToolCallingParam) MarshalJSON() (data []byte, err error) {
+ type shadow ToolProgrammaticToolCallingParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ToolProgrammaticToolCallingParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A tool that generates images using the GPT image models.
//
// The property Type is required.
@@ -20510,8 +24669,18 @@ type ToolImageGenerationParam struct {
//
// Any of "generate", "edit", "auto".
Action string `json:"action,omitzero"`
- // Background type for the generated image. One of `transparent`, `opaque`, or
- // `auto`. Default: `auto`.
+ // Allows to set transparency for the background of the generated image(s). This
+ // parameter is only supported for GPT image models that support transparent
+ // backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value).
+ // When `auto` is used, the model will automatically determine the best background
+ // for the image.
+ //
+ // `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent
+ // backgrounds. Requests with `background` set to `transparent` will return an
+ // error for these models; use `opaque` or `auto` instead.
+ //
+ // If `transparent`, the output format needs to support transparency, so it should
+ // be set to either `png` (default value) or `webp`.
//
// Any of "transparent", "opaque", "auto".
Background string `json:"background,omitzero"`
@@ -20534,10 +24703,17 @@ type ToolImageGenerationParam struct {
//
// Any of "low", "medium", "high", "auto".
Quality string `json:"quality,omitzero"`
- // The size of the generated image. One of `1024x1024`, `1024x1536`, `1536x1024`,
- // or `auto`. Default: `auto`.
- //
- // Any of "1024x1024", "1024x1536", "1536x1024", "auto".
+ // The size of the generated images. For `gpt-image-2` and
+ // `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT`
+ // strings, for example `1536x864`. Width and height must both be divisible by 16
+ // and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above
+ // `2560x1440` are experimental, and the maximum supported resolution is
+ // `3840x2160`. The requested size must also satisfy the model's current pixel and
+ // edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are
+ // supported by the GPT image models; `auto` is supported for models that allow
+ // automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or
+ // `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or
+ // `1024x1792`.
Size string `json:"size,omitzero"`
// The type of the image generation tool. Always `image_generation`.
//
@@ -20573,9 +24749,6 @@ func init() {
apijson.RegisterFieldValidator[ToolImageGenerationParam](
"quality", "low", "medium", "high", "auto",
)
- apijson.RegisterFieldValidator[ToolImageGenerationParam](
- "size", "1024x1024", "1024x1536", "1536x1024", "auto",
- )
}
// Optional mask for inpainting. Contains `image_url` (string, optional) and
@@ -21553,6 +25726,17 @@ type ResponseNewParams struct {
// [conversation state](https://platform.openai.com/docs/guides/conversation-state).
// Cannot be used in conjunction with `conversation`.
PreviousResponseID param.Opt[string] `json:"previous_response_id,omitzero"`
+ // Used by OpenAI to cache responses for similar requests to optimize your cache
+ // hit rates. Replaces the `user` field.
+ // [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
+ PromptCacheKey param.Opt[string] `json:"prompt_cache_key,omitzero"`
+ // A stable identifier used to help detect users of your application that may be
+ // violating OpenAI's usage policies. The IDs should be a string that uniquely
+ // identifies each user, with a maximum length of 64 characters. We recommend
+ // hashing their username or email address, in order to avoid sending us any
+ // identifying information.
+ // [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
+ SafetyIdentifier param.Opt[string] `json:"safety_identifier,omitzero"`
// Whether to store the generated model response for later retrieval via API.
Store param.Opt[bool] `json:"store,omitzero"`
// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
@@ -21560,8 +25744,9 @@ type ResponseNewParams struct {
// focused and deterministic. We generally recommend altering this or `top_p` but
// not both.
Temperature param.Opt[float64] `json:"temperature,omitzero"`
- // An integer between 0 and 20 specifying the number of most likely tokens to
- // return at each token position, each with an associated log probability.
+ // An integer between 0 and 20 specifying the maximum number of most likely tokens
+ // to return at each token position, each with an associated log probability. In
+ // some cases, the number of returned tokens may be fewer than requested.
TopLogprobs param.Opt[int64] `json:"top_logprobs,omitzero"`
// An alternative to sampling with temperature, called nucleus sampling, where the
// model considers the results of the tokens with top_p probability mass. So 0.1
@@ -21569,17 +25754,6 @@ type ResponseNewParams struct {
//
// We generally recommend altering this or `temperature` but not both.
TopP param.Opt[float64] `json:"top_p,omitzero"`
- // Used by OpenAI to cache responses for similar requests to optimize your cache
- // hit rates. Replaces the `user` field.
- // [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
- PromptCacheKey param.Opt[string] `json:"prompt_cache_key,omitzero"`
- // A stable identifier used to help detect users of your application that may be
- // violating OpenAI's usage policies. The IDs should be a string that uniquely
- // identifies each user, with a maximum length of 64 characters. We recommend
- // hashing their username or email address, in order to avoid sending us any
- // identifying information.
- // [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
- SafetyIdentifier param.Opt[string] `json:"safety_identifier,omitzero"`
// This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use
// `prompt_cache_key` instead to maintain caching optimizations. A stable
// identifier for your end-users. Used to boost cache hit rates by better bucketing
@@ -21619,15 +25793,30 @@ type ResponseNewParams struct {
// Keys are strings with a maximum length of 64 characters. Values are strings with
// a maximum length of 512 characters.
Metadata shared.Metadata `json:"metadata,omitzero"`
+ // Configuration for running moderation on the input and output of this response.
+ Moderation ResponseNewParamsModeration `json:"moderation,omitzero"`
// Reference to a prompt template and its variables.
// [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
Prompt ResponsePromptParam `json:"prompt,omitzero"`
+ // Deprecated. Use `prompt_cache_options.ttl` instead.
+ //
// The retention policy for the prompt cache. Set to `24h` to enable extended
// prompt caching, which keeps cached prefixes active for longer, up to a maximum
// of 24 hours.
// [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
+ // This field expresses a maximum retention policy, while
+ // `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
+ // are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
+ // models, only `24h` is supported.
+ //
+ // For older models that support both `in_memory` and `24h`, the default depends on
+ // your organization's data retention policy:
//
- // Any of "in-memory", "24h".
+ // - Organizations without ZDR enabled default to `24h`.
+ // - Organizations with ZDR enabled default to `in_memory` when
+ // `prompt_cache_retention` is not specified.
+ //
+ // Any of "in_memory", "24h".
PromptCacheRetention ResponseNewParamsPromptCacheRetention `json:"prompt_cache_retention,omitzero"`
// Specifies the processing type used for serving the request.
//
@@ -21676,6 +25865,16 @@ type ResponseNewParams struct {
// [model guide](https://platform.openai.com/docs/models) to browse and compare
// available models.
Model shared.ResponsesModel `json:"model,omitzero"`
+ // Options for prompt caching. Supported for `gpt-5.6` and later models. By
+ // default, OpenAI automatically chooses one implicit cache breakpoint. You can add
+ // explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
+ // request can write up to four breakpoints. For cache matching, OpenAI considers
+ // up to the latest 80 breakpoints in the conversation, without a content-block
+ // lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
+ // `ttl` defaults to `30m`, which is currently the only supported value. See the
+ // [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
+ // for current details.
+ PromptCacheOptions ResponseNewParamsPromptCacheOptions `json:"prompt_cache_options,omitzero"`
// **gpt-5 and o-series models only**
//
// Configuration options for
@@ -21789,14 +25988,155 @@ func (u *ResponseNewParamsInputUnion) asAny() any {
return nil
}
+// Configuration for running moderation on the input and output of this response.
+//
+// The property Model is required.
+type ResponseNewParamsModeration struct {
+ // The moderation model to use for moderated completions, e.g.
+ // 'omni-moderation-latest'.
+ Model string `json:"model" api:"required"`
+ // The policy to apply to moderated response input and output.
+ Policy ResponseNewParamsModerationPolicy `json:"policy,omitzero"`
+ paramObj
+}
+
+func (r ResponseNewParamsModeration) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsModeration
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseNewParamsModeration) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The policy to apply to moderated response input and output.
+type ResponseNewParamsModerationPolicy struct {
+ // The moderation policy for the response input.
+ Input ResponseNewParamsModerationPolicyInput `json:"input,omitzero"`
+ // The moderation policy for the response output.
+ Output ResponseNewParamsModerationPolicyOutput `json:"output,omitzero"`
+ paramObj
+}
+
+func (r ResponseNewParamsModerationPolicy) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsModerationPolicy
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseNewParamsModerationPolicy) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The moderation policy for the response input.
+//
+// The property Mode is required.
+type ResponseNewParamsModerationPolicyInput struct {
+ // Any of "score", "block".
+ Mode string `json:"mode,omitzero" api:"required"`
+ paramObj
+}
+
+func (r ResponseNewParamsModerationPolicyInput) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsModerationPolicyInput
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseNewParamsModerationPolicyInput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[ResponseNewParamsModerationPolicyInput](
+ "mode", "score", "block",
+ )
+}
+
+// The moderation policy for the response output.
+//
+// The property Mode is required.
+type ResponseNewParamsModerationPolicyOutput struct {
+ // Any of "score", "block".
+ Mode string `json:"mode,omitzero" api:"required"`
+ paramObj
+}
+
+func (r ResponseNewParamsModerationPolicyOutput) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsModerationPolicyOutput
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseNewParamsModerationPolicyOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[ResponseNewParamsModerationPolicyOutput](
+ "mode", "score", "block",
+ )
+}
+
+// Options for prompt caching. Supported for `gpt-5.6` and later models. By
+// default, OpenAI automatically chooses one implicit cache breakpoint. You can add
+// explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
+// request can write up to four breakpoints. For cache matching, OpenAI considers
+// up to the latest 80 breakpoints in the conversation, without a content-block
+// lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
+// `ttl` defaults to `30m`, which is currently the only supported value. See the
+// [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
+// for current details.
+type ResponseNewParamsPromptCacheOptions struct {
+ // Controls whether OpenAI automatically creates an implicit cache breakpoint.
+ // Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
+ // and writes up to the latest three explicit breakpoints in the request. With
+ // `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
+ // latest four explicit breakpoints. If there are no explicit breakpoints, the
+ // request does not use prompt caching.
+ //
+ // Any of "implicit", "explicit".
+ Mode string `json:"mode,omitzero"`
+ // The minimum lifetime applied to every implicit and explicit cache breakpoint
+ // written by the request. Defaults to `30m`, which is currently the only supported
+ // value. The backend may retain cache entries for longer.
+ //
+ // Any of "30m".
+ Ttl string `json:"ttl,omitzero"`
+ paramObj
+}
+
+func (r ResponseNewParamsPromptCacheOptions) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsPromptCacheOptions
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseNewParamsPromptCacheOptions) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[ResponseNewParamsPromptCacheOptions](
+ "mode", "implicit", "explicit",
+ )
+ apijson.RegisterFieldValidator[ResponseNewParamsPromptCacheOptions](
+ "ttl", "30m",
+ )
+}
+
+// Deprecated. Use `prompt_cache_options.ttl` instead.
+//
// The retention policy for the prompt cache. Set to `24h` to enable extended
// prompt caching, which keeps cached prefixes active for longer, up to a maximum
// of 24 hours.
// [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
+// This field expresses a maximum retention policy, while
+// `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two fields
+// are independent and do not interact. For `gpt-5.5`, `gpt-5.5-pro`, and future
+// models, only `24h` is supported.
+//
+// For older models that support both `in_memory` and `24h`, the default depends on
+// your organization's data retention policy:
+//
+// - Organizations without ZDR enabled default to `24h`.
+// - Organizations with ZDR enabled default to `in_memory` when
+// `prompt_cache_retention` is not specified.
type ResponseNewParamsPromptCacheRetention string
const (
- ResponseNewParamsPromptCacheRetentionInMemory ResponseNewParamsPromptCacheRetention = "in-memory"
+ ResponseNewParamsPromptCacheRetentionInMemory ResponseNewParamsPromptCacheRetention = "in_memory"
ResponseNewParamsPromptCacheRetention24h ResponseNewParamsPromptCacheRetention = "24h"
)
@@ -21851,14 +26191,15 @@ func (r *ResponseNewParamsStreamOptions) UnmarshalJSON(data []byte) error {
// Use [param.IsOmitted] to confirm if a field is set.
type ResponseNewParamsToolChoiceUnion struct {
// Check if union is this variant with !param.IsOmitted(union.OfToolChoiceMode)
- OfToolChoiceMode param.Opt[ToolChoiceOptions] `json:",omitzero,inline"`
- OfAllowedTools *ToolChoiceAllowedParam `json:",omitzero,inline"`
- OfHostedTool *ToolChoiceTypesParam `json:",omitzero,inline"`
- OfFunctionTool *ToolChoiceFunctionParam `json:",omitzero,inline"`
- OfMcpTool *ToolChoiceMcpParam `json:",omitzero,inline"`
- OfCustomTool *ToolChoiceCustomParam `json:",omitzero,inline"`
- OfSpecificApplyPatchToolChoice *ToolChoiceApplyPatchParam `json:",omitzero,inline"`
- OfSpecificShellToolChoice *ToolChoiceShellParam `json:",omitzero,inline"`
+ OfToolChoiceMode param.Opt[ToolChoiceOptions] `json:",omitzero,inline"`
+ OfAllowedTools *ToolChoiceAllowedParam `json:",omitzero,inline"`
+ OfHostedTool *ToolChoiceTypesParam `json:",omitzero,inline"`
+ OfFunctionTool *ToolChoiceFunctionParam `json:",omitzero,inline"`
+ OfMcpTool *ToolChoiceMcpParam `json:",omitzero,inline"`
+ OfCustomTool *ToolChoiceCustomParam `json:",omitzero,inline"`
+ OfResponseNewsToolChoiceSpecificProgrammaticToolCallingParam *ResponseNewParamsToolChoiceSpecificProgrammaticToolCallingParam `json:",omitzero,inline"`
+ OfSpecificApplyPatchToolChoice *ToolChoiceApplyPatchParam `json:",omitzero,inline"`
+ OfSpecificShellToolChoice *ToolChoiceShellParam `json:",omitzero,inline"`
paramUnion
}
@@ -21869,6 +26210,7 @@ func (u ResponseNewParamsToolChoiceUnion) MarshalJSON() ([]byte, error) {
u.OfFunctionTool,
u.OfMcpTool,
u.OfCustomTool,
+ u.OfResponseNewsToolChoiceSpecificProgrammaticToolCallingParam,
u.OfSpecificApplyPatchToolChoice,
u.OfSpecificShellToolChoice)
}
@@ -21889,6 +26231,8 @@ func (u *ResponseNewParamsToolChoiceUnion) asAny() any {
return u.OfMcpTool
} else if !param.IsOmitted(u.OfCustomTool) {
return u.OfCustomTool
+ } else if !param.IsOmitted(u.OfResponseNewsToolChoiceSpecificProgrammaticToolCallingParam) {
+ return u.OfResponseNewsToolChoiceSpecificProgrammaticToolCallingParam
} else if !param.IsOmitted(u.OfSpecificApplyPatchToolChoice) {
return u.OfSpecificApplyPatchToolChoice
} else if !param.IsOmitted(u.OfSpecificShellToolChoice) {
@@ -21933,6 +26277,8 @@ func (u ResponseNewParamsToolChoiceUnion) GetType() *string {
return (*string)(&vt.Type)
} else if vt := u.OfCustomTool; vt != nil {
return (*string)(&vt.Type)
+ } else if vt := u.OfResponseNewsToolChoiceSpecificProgrammaticToolCallingParam; vt != nil {
+ return (*string)(&vt.Type)
} else if vt := u.OfSpecificApplyPatchToolChoice; vt != nil {
return (*string)(&vt.Type)
} else if vt := u.OfSpecificShellToolChoice; vt != nil {
@@ -21953,6 +26299,28 @@ func (u ResponseNewParamsToolChoiceUnion) GetName() *string {
return nil
}
+func NewResponseNewParamsToolChoiceSpecificProgrammaticToolCallingParam() ResponseNewParamsToolChoiceSpecificProgrammaticToolCallingParam {
+ return ResponseNewParamsToolChoiceSpecificProgrammaticToolCallingParam{
+ Type: "programmatic_tool_calling",
+ }
+}
+
+// This struct has a constant value, construct it with
+// [NewResponseNewParamsToolChoiceSpecificProgrammaticToolCallingParam].
+type ResponseNewParamsToolChoiceSpecificProgrammaticToolCallingParam struct {
+ // The tool to call. Always `programmatic_tool_calling`.
+ Type constant.ProgrammaticToolCalling `json:"type" default:"programmatic_tool_calling"`
+ paramObj
+}
+
+func (r ResponseNewParamsToolChoiceSpecificProgrammaticToolCallingParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsToolChoiceSpecificProgrammaticToolCallingParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseNewParamsToolChoiceSpecificProgrammaticToolCallingParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// The truncation strategy to use for the model response.
//
// - `auto`: If the input to this Response exceeds the model's context window size,
@@ -22012,10 +26380,24 @@ type ResponseCompactParams struct {
PromptCacheKey param.Opt[string] `json:"prompt_cache_key,omitzero"`
// Text, image, or file inputs to the model, used to generate a response
Input ResponseCompactParamsInputUnion `json:"input,omitzero"`
+ // Options for prompt caching. Supported for `gpt-5.6` and later models. By
+ // default, OpenAI automatically chooses one implicit cache breakpoint. You can add
+ // explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
+ // request can write up to four breakpoints. For cache matching, OpenAI considers
+ // up to the latest 80 breakpoints in the conversation, without a content-block
+ // lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
+ // `ttl` defaults to `30m`, which is currently the only supported value. See the
+ // [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
+ // for current details.
+ PromptCacheOptions ResponseCompactParamsPromptCacheOptions `json:"prompt_cache_options,omitzero"`
// How long to retain a prompt cache entry created by this request.
//
// Any of "in_memory", "24h".
PromptCacheRetention ResponseCompactParamsPromptCacheRetention `json:"prompt_cache_retention,omitzero"`
+ // The service tier to use for this request.
+ //
+ // Any of "auto", "default", "flex", "priority".
+ ServiceTier ResponseCompactParamsServiceTier `json:"service_tier,omitzero"`
paramObj
}
@@ -22035,6 +26417,9 @@ func (r *ResponseCompactParams) UnmarshalJSON(data []byte) error {
type ResponseCompactParamsModel string
const (
+ ResponseCompactParamsModelGPT5_6Sol ResponseCompactParamsModel = "gpt-5.6-sol"
+ ResponseCompactParamsModelGPT5_6Terra ResponseCompactParamsModel = "gpt-5.6-terra"
+ ResponseCompactParamsModelGPT5_6Luna ResponseCompactParamsModel = "gpt-5.6-luna"
ResponseCompactParamsModelGPT5_4 ResponseCompactParamsModel = "gpt-5.4"
ResponseCompactParamsModelGPT5_4Mini ResponseCompactParamsModel = "gpt-5.4-mini"
ResponseCompactParamsModelGPT5_4Nano ResponseCompactParamsModel = "gpt-5.4-nano"
@@ -22154,6 +26539,51 @@ func (u *ResponseCompactParamsInputUnion) asAny() any {
return nil
}
+// Options for prompt caching. Supported for `gpt-5.6` and later models. By
+// default, OpenAI automatically chooses one implicit cache breakpoint. You can add
+// explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
+// request can write up to four breakpoints. For cache matching, OpenAI considers
+// up to the latest 80 breakpoints in the conversation, without a content-block
+// lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
+// `ttl` defaults to `30m`, which is currently the only supported value. See the
+// [prompt caching guide](https://platform.openai.com/docs/guides/prompt-caching)
+// for current details.
+type ResponseCompactParamsPromptCacheOptions struct {
+ // Controls whether OpenAI automatically creates an implicit cache breakpoint.
+ // Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
+ // and writes up to the latest three explicit breakpoints in the request. With
+ // `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
+ // latest four explicit breakpoints. If there are no explicit breakpoints, the
+ // request does not use prompt caching.
+ //
+ // Any of "implicit", "explicit".
+ Mode string `json:"mode,omitzero"`
+ // The minimum lifetime applied to every implicit and explicit cache breakpoint
+ // written by the request. Defaults to `30m`, which is currently the only supported
+ // value. The backend may retain cache entries for longer.
+ //
+ // Any of "30m".
+ Ttl string `json:"ttl,omitzero"`
+ paramObj
+}
+
+func (r ResponseCompactParamsPromptCacheOptions) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseCompactParamsPromptCacheOptions
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseCompactParamsPromptCacheOptions) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[ResponseCompactParamsPromptCacheOptions](
+ "mode", "implicit", "explicit",
+ )
+ apijson.RegisterFieldValidator[ResponseCompactParamsPromptCacheOptions](
+ "ttl", "30m",
+ )
+}
+
// How long to retain a prompt cache entry created by this request.
type ResponseCompactParamsPromptCacheRetention string
@@ -22161,3 +26591,13 @@ const (
ResponseCompactParamsPromptCacheRetentionInMemory ResponseCompactParamsPromptCacheRetention = "in_memory"
ResponseCompactParamsPromptCacheRetention24h ResponseCompactParamsPromptCacheRetention = "24h"
)
+
+// The service tier to use for this request.
+type ResponseCompactParamsServiceTier string
+
+const (
+ ResponseCompactParamsServiceTierAuto ResponseCompactParamsServiceTier = "auto"
+ ResponseCompactParamsServiceTierDefault ResponseCompactParamsServiceTier = "default"
+ ResponseCompactParamsServiceTierFlex ResponseCompactParamsServiceTier = "flex"
+ ResponseCompactParamsServiceTierPriority ResponseCompactParamsServiceTier = "priority"
+)
diff --git a/vendor/github.com/openai/openai-go/v3/shared/constant/constants.go b/vendor/github.com/openai/openai-go/v3/shared/constant/constants.go
index 7ab9b729b..d8e76b205 100644
--- a/vendor/github.com/openai/openai-go/v3/shared/constant/constants.go
+++ b/vendor/github.com/openai/openai-go/v3/shared/constant/constants.go
@@ -19,6 +19,8 @@ func ValueOf[T Constant[T]]() T {
}
type Active string // Always "active"
+type AdditionalTools string // Always "additional_tools"
+type AgentMessage string // Always "agent_message"
type AllowedTools string // Always "allowed_tools"
type Allowlist string // Always "allowlist"
type ApplicationZip string // Always "application/zip"
@@ -35,6 +37,8 @@ type BatchCancelled string // Always "batch.ca
type BatchCompleted string // Always "batch.completed"
type BatchExpired string // Always "batch.expired"
type BatchFailed string // Always "batch.failed"
+type Bucket string // Always "bucket"
+type CertificateDeleted string // Always "certificate.deleted"
type ChatCompletion string // Always "chat.completion"
type ChatCompletionChunk string // Always "chat.completion.chunk"
type ChatCompletionDeleted string // Always "chat.completion.deleted"
@@ -54,6 +58,7 @@ type Closed string // Always "closed"
type CodeInterpreter string // Always "code_interpreter"
type CodeInterpreterCall string // Always "code_interpreter_call"
type Compaction string // Always "compaction"
+type CompactionTrigger string // Always "compaction_trigger"
type Computer string // Always "computer"
type ComputerCallOutput string // Always "computer_call_output"
type ComputerScreenshot string // Always "computer_screenshot"
@@ -87,17 +92,21 @@ type CustomToolCall string // Always "custom_t
type CustomToolCallOutput string // Always "custom_tool_call_output"
type DeleteFile string // Always "delete_file"
type Developer string // Always "developer"
+type Direct string // Always "direct"
type Disabled string // Always "disabled"
type DoubleClick string // Always "double_click"
type Drag string // Always "drag"
type Duration string // Always "duration"
+type Email string // Always "email"
type Embedding string // Always "embedding"
+type EncryptedContent string // Always "encrypted_content"
type Error string // Always "error"
type EvalRunCanceled string // Always "eval.run.canceled"
type EvalRunFailed string // Always "eval.run.failed"
type EvalRunSucceeded string // Always "eval.run.succeeded"
type Exec string // Always "exec"
type Exit string // Always "exit"
+type Explicit string // Always "explicit"
type File string // Always "file"
type FileCitation string // Always "file_citation"
type FilePath string // Always "file_path"
@@ -114,6 +123,11 @@ type Function string // Always "function
type FunctionCall string // Always "function_call"
type FunctionCallOutput string // Always "function_call_output"
type Grammar string // Always "grammar"
+type Group string // Always "group"
+type GroupDeleted string // Always "group.deleted"
+type GroupRole string // Always "group.role"
+type GroupUser string // Always "group.user"
+type GroupUserDeleted string // Always "group.user.deleted"
type HTTPError string // Always "http_error"
type Image string // Always "image"
type ImageEditCompleted string // Always "image_edit.completed"
@@ -162,10 +176,48 @@ type McpListToolsInProgress string // Always "mcp_list
type Message string // Always "message"
type MessageCreation string // Always "message_creation"
type Model string // Always "model"
+type ModerationResult string // Always "moderation_result"
+type ModerationResults string // Always "moderation_results"
type Move string // Always "move"
type Multi string // Always "multi"
+type MultiAgentCall string // Always "multi_agent_call"
+type MultiAgentCallOutput string // Always "multi_agent_call_output"
type Namespace string // Always "namespace"
type OpenPage string // Always "open_page"
+type OrganizationAdminAPIKey string // Always "organization.admin_api_key"
+type OrganizationAdminAPIKeyDeleted string // Always "organization.admin_api_key.deleted"
+type OrganizationCertificate string // Always "organization.certificate"
+type OrganizationCertificateActivation string // Always "organization.certificate.activation"
+type OrganizationCertificateDeactivation string // Always "organization.certificate.deactivation"
+type OrganizationCostsResult string // Always "organization.costs.result"
+type OrganizationDataRetention string // Always "organization.data_retention"
+type OrganizationInvite string // Always "organization.invite"
+type OrganizationInviteDeleted string // Always "organization.invite.deleted"
+type OrganizationProject string // Always "organization.project"
+type OrganizationProjectAPIKey string // Always "organization.project.api_key"
+type OrganizationProjectAPIKeyDeleted string // Always "organization.project.api_key.deleted"
+type OrganizationProjectCertificate string // Always "organization.project.certificate"
+type OrganizationProjectCertificateActivation string // Always "organization.project.certificate.activation"
+type OrganizationProjectCertificateDeactivation string // Always "organization.project.certificate.deactivation"
+type OrganizationProjectServiceAccount string // Always "organization.project.service_account"
+type OrganizationProjectServiceAccountAPIKey string // Always "organization.project.service_account.api_key"
+type OrganizationProjectServiceAccountDeleted string // Always "organization.project.service_account.deleted"
+type OrganizationProjectUser string // Always "organization.project.user"
+type OrganizationProjectUserDeleted string // Always "organization.project.user.deleted"
+type OrganizationSpendAlert string // Always "organization.spend_alert"
+type OrganizationSpendAlertDeleted string // Always "organization.spend_alert.deleted"
+type OrganizationUsageAudioSpeechesResult string // Always "organization.usage.audio_speeches.result"
+type OrganizationUsageAudioTranscriptionsResult string // Always "organization.usage.audio_transcriptions.result"
+type OrganizationUsageCodeInterpreterSessionsResult string // Always "organization.usage.code_interpreter_sessions.result"
+type OrganizationUsageCompletionsResult string // Always "organization.usage.completions.result"
+type OrganizationUsageEmbeddingsResult string // Always "organization.usage.embeddings.result"
+type OrganizationUsageFileSearchesResult string // Always "organization.usage.file_searches.result"
+type OrganizationUsageImagesResult string // Always "organization.usage.images.result"
+type OrganizationUsageModerationsResult string // Always "organization.usage.moderations.result"
+type OrganizationUsageVectorStoresResult string // Always "organization.usage.vector_stores.result"
+type OrganizationUsageWebSearchesResult string // Always "organization.usage.web_searches.result"
+type OrganizationUser string // Always "organization.user"
+type OrganizationUserDeleted string // Always "organization.user.deleted"
type Other string // Always "other"
type OutputAudio string // Always "output_audio"
type OutputAudioBufferClear string // Always "output_audio_buffer.clear"
@@ -173,12 +225,25 @@ type OutputAudioBufferCleared string // Always "output_a
type OutputAudioBufferStarted string // Always "output_audio_buffer.started"
type OutputAudioBufferStopped string // Always "output_audio_buffer.stopped"
type OutputText string // Always "output_text"
+type Page string // Always "page"
+type Program string // Always "program"
+type ProgramOutput string // Always "program_output"
+type ProgrammaticToolCalling string // Always "programmatic_tool_calling"
+type ProjectDataRetention string // Always "project.data_retention"
+type ProjectGroup string // Always "project.group"
+type ProjectGroupDeleted string // Always "project.group.deleted"
+type ProjectModelPermissions string // Always "project.model_permissions"
+type ProjectModelPermissionsDeleted string // Always "project.model_permissions.deleted"
+type ProjectRateLimit string // Always "project.rate_limit"
+type ProjectSpendAlert string // Always "project.spend_alert"
+type ProjectSpendAlertDeleted string // Always "project.spend_alert.deleted"
type ProtocolError string // Always "protocol_error"
type Python string // Always "python"
type QuotedText string // Always "quoted_text"
type RateLimitsUpdated string // Always "rate_limits.updated"
type Realtime string // Always "realtime"
type RealtimeCallIncoming string // Always "realtime.call.incoming"
+type RealtimeSession string // Always "realtime.session"
type Reasoning string // Always "reasoning"
type ReasoningText string // Always "reasoning_text"
type Refusal string // Always "refusal"
@@ -215,6 +280,9 @@ type ResponseImageGenerationCallInProgress string // Always "response
type ResponseImageGenerationCallPartialImage string // Always "response.image_generation_call.partial_image"
type ResponseInProgress string // Always "response.in_progress"
type ResponseIncomplete string // Always "response.incomplete"
+type ResponseInject string // Always "response.inject"
+type ResponseInjectCreated string // Always "response.inject.created"
+type ResponseInjectFailed string // Always "response.inject.failed"
type ResponseInputTokens string // Always "response.input_tokens"
type ResponseMcpCallArgumentsDelta string // Always "response.mcp_call_arguments.delta"
type ResponseMcpCallArgumentsDone string // Always "response.mcp_call_arguments.done"
@@ -246,13 +314,21 @@ type ResponseWebSearchCallCompleted string // Always "response
type ResponseWebSearchCallInProgress string // Always "response.web_search_call.in_progress"
type ResponseWebSearchCallSearching string // Always "response.web_search_call.searching"
type RetentionRatio string // Always "retention_ratio"
+type Role string // Always "role"
+type RoleDeleted string // Always "role.deleted"
type ScoreModel string // Always "score_model"
type Screenshot string // Always "screenshot"
type Scroll string // Always "scroll"
type Search string // Always "search"
type SemanticVad string // Always "semantic_vad"
type ServerVad string // Always "server_vad"
+type SessionClose string // Always "session.close"
+type SessionClosed string // Always "session.closed"
type SessionCreated string // Always "session.created"
+type SessionInputAudioBufferAppend string // Always "session.input_audio_buffer.append"
+type SessionInputTranscriptDelta string // Always "session.input_transcript.delta"
+type SessionOutputAudioDelta string // Always "session.output_audio.delta"
+type SessionOutputTranscriptDelta string // Always "session.output_transcript.delta"
type SessionUpdate string // Always "session.update"
type SessionUpdated string // Always "session.updated"
type Shell string // Always "shell"
@@ -315,6 +391,7 @@ type TranscriptTextSegment string // Always "transcri
type Transcription string // Always "transcription"
type TranscriptionSessionUpdate string // Always "transcription_session.update"
type TranscriptionSessionUpdated string // Always "transcription_session.updated"
+type Translation string // Always "translation"
type Type string // Always "type"
type UpdateFile string // Always "update_file"
type Upload string // Always "upload"
@@ -322,6 +399,7 @@ type UploadPart string // Always "upload.p
type URL string // Always "url"
type URLCitation string // Always "url_citation"
type User string // Always "user"
+type UserRole string // Always "user.role"
type VectorStore string // Always "vector_store"
type VectorStoreDeleted string // Always "vector_store.deleted"
type VectorStoreFile string // Always "vector_store.file"
@@ -336,6 +414,8 @@ type Wandb string // Always "wandb"
type WebSearchCall string // Always "web_search_call"
func (c Active) Default() Active { return "active" }
+func (c AdditionalTools) Default() AdditionalTools { return "additional_tools" }
+func (c AgentMessage) Default() AgentMessage { return "agent_message" }
func (c AllowedTools) Default() AllowedTools { return "allowed_tools" }
func (c Allowlist) Default() Allowlist { return "allowlist" }
func (c ApplicationZip) Default() ApplicationZip { return "application/zip" }
@@ -352,6 +432,8 @@ func (c BatchCancelled) Default() BatchCancelled { return "batch.c
func (c BatchCompleted) Default() BatchCompleted { return "batch.completed" }
func (c BatchExpired) Default() BatchExpired { return "batch.expired" }
func (c BatchFailed) Default() BatchFailed { return "batch.failed" }
+func (c Bucket) Default() Bucket { return "bucket" }
+func (c CertificateDeleted) Default() CertificateDeleted { return "certificate.deleted" }
func (c ChatCompletion) Default() ChatCompletion { return "chat.completion" }
func (c ChatCompletionChunk) Default() ChatCompletionChunk { return "chat.completion.chunk" }
func (c ChatCompletionDeleted) Default() ChatCompletionDeleted { return "chat.completion.deleted" }
@@ -373,6 +455,7 @@ func (c Closed) Default() Closed { return "close
func (c CodeInterpreter) Default() CodeInterpreter { return "code_interpreter" }
func (c CodeInterpreterCall) Default() CodeInterpreterCall { return "code_interpreter_call" }
func (c Compaction) Default() Compaction { return "compaction" }
+func (c CompactionTrigger) Default() CompactionTrigger { return "compaction_trigger" }
func (c Computer) Default() Computer { return "computer" }
func (c ComputerCallOutput) Default() ComputerCallOutput { return "computer_call_output" }
func (c ComputerScreenshot) Default() ComputerScreenshot { return "computer_screenshot" }
@@ -426,17 +509,21 @@ func (c CustomToolCall) Default() CustomToolCall { return "custo
func (c CustomToolCallOutput) Default() CustomToolCallOutput { return "custom_tool_call_output" }
func (c DeleteFile) Default() DeleteFile { return "delete_file" }
func (c Developer) Default() Developer { return "developer" }
+func (c Direct) Default() Direct { return "direct" }
func (c Disabled) Default() Disabled { return "disabled" }
func (c DoubleClick) Default() DoubleClick { return "double_click" }
func (c Drag) Default() Drag { return "drag" }
func (c Duration) Default() Duration { return "duration" }
+func (c Email) Default() Email { return "email" }
func (c Embedding) Default() Embedding { return "embedding" }
+func (c EncryptedContent) Default() EncryptedContent { return "encrypted_content" }
func (c Error) Default() Error { return "error" }
func (c EvalRunCanceled) Default() EvalRunCanceled { return "eval.run.canceled" }
func (c EvalRunFailed) Default() EvalRunFailed { return "eval.run.failed" }
func (c EvalRunSucceeded) Default() EvalRunSucceeded { return "eval.run.succeeded" }
func (c Exec) Default() Exec { return "exec" }
func (c Exit) Default() Exit { return "exit" }
+func (c Explicit) Default() Explicit { return "explicit" }
func (c File) Default() File { return "file" }
func (c FileCitation) Default() FileCitation { return "file_citation" }
func (c FilePath) Default() FilePath { return "file_path" }
@@ -455,6 +542,11 @@ func (c Function) Default() Function { return "funct
func (c FunctionCall) Default() FunctionCall { return "function_call" }
func (c FunctionCallOutput) Default() FunctionCallOutput { return "function_call_output" }
func (c Grammar) Default() Grammar { return "grammar" }
+func (c Group) Default() Group { return "group" }
+func (c GroupDeleted) Default() GroupDeleted { return "group.deleted" }
+func (c GroupRole) Default() GroupRole { return "group.role" }
+func (c GroupUser) Default() GroupUser { return "group.user" }
+func (c GroupUserDeleted) Default() GroupUserDeleted { return "group.user.deleted" }
func (c HTTPError) Default() HTTPError { return "http_error" }
func (c Image) Default() Image { return "image" }
func (c ImageEditCompleted) Default() ImageEditCompleted { return "image_edit.completed" }
@@ -519,10 +611,106 @@ func (c McpListToolsInProgress) Default() McpListToolsInProgress { return "mcp_l
func (c Message) Default() Message { return "message" }
func (c MessageCreation) Default() MessageCreation { return "message_creation" }
func (c Model) Default() Model { return "model" }
+func (c ModerationResult) Default() ModerationResult { return "moderation_result" }
+func (c ModerationResults) Default() ModerationResults { return "moderation_results" }
func (c Move) Default() Move { return "move" }
func (c Multi) Default() Multi { return "multi" }
+func (c MultiAgentCall) Default() MultiAgentCall { return "multi_agent_call" }
+func (c MultiAgentCallOutput) Default() MultiAgentCallOutput { return "multi_agent_call_output" }
func (c Namespace) Default() Namespace { return "namespace" }
func (c OpenPage) Default() OpenPage { return "open_page" }
+func (c OrganizationAdminAPIKey) Default() OrganizationAdminAPIKey {
+ return "organization.admin_api_key"
+}
+func (c OrganizationAdminAPIKeyDeleted) Default() OrganizationAdminAPIKeyDeleted {
+ return "organization.admin_api_key.deleted"
+}
+func (c OrganizationCertificate) Default() OrganizationCertificate { return "organization.certificate" }
+func (c OrganizationCertificateActivation) Default() OrganizationCertificateActivation {
+ return "organization.certificate.activation"
+}
+func (c OrganizationCertificateDeactivation) Default() OrganizationCertificateDeactivation {
+ return "organization.certificate.deactivation"
+}
+func (c OrganizationCostsResult) Default() OrganizationCostsResult {
+ return "organization.costs.result"
+}
+func (c OrganizationDataRetention) Default() OrganizationDataRetention {
+ return "organization.data_retention"
+}
+func (c OrganizationInvite) Default() OrganizationInvite { return "organization.invite" }
+func (c OrganizationInviteDeleted) Default() OrganizationInviteDeleted {
+ return "organization.invite.deleted"
+}
+func (c OrganizationProject) Default() OrganizationProject { return "organization.project" }
+func (c OrganizationProjectAPIKey) Default() OrganizationProjectAPIKey {
+ return "organization.project.api_key"
+}
+func (c OrganizationProjectAPIKeyDeleted) Default() OrganizationProjectAPIKeyDeleted {
+ return "organization.project.api_key.deleted"
+}
+func (c OrganizationProjectCertificate) Default() OrganizationProjectCertificate {
+ return "organization.project.certificate"
+}
+func (c OrganizationProjectCertificateActivation) Default() OrganizationProjectCertificateActivation {
+ return "organization.project.certificate.activation"
+}
+func (c OrganizationProjectCertificateDeactivation) Default() OrganizationProjectCertificateDeactivation {
+ return "organization.project.certificate.deactivation"
+}
+func (c OrganizationProjectServiceAccount) Default() OrganizationProjectServiceAccount {
+ return "organization.project.service_account"
+}
+func (c OrganizationProjectServiceAccountAPIKey) Default() OrganizationProjectServiceAccountAPIKey {
+ return "organization.project.service_account.api_key"
+}
+func (c OrganizationProjectServiceAccountDeleted) Default() OrganizationProjectServiceAccountDeleted {
+ return "organization.project.service_account.deleted"
+}
+func (c OrganizationProjectUser) Default() OrganizationProjectUser {
+ return "organization.project.user"
+}
+func (c OrganizationProjectUserDeleted) Default() OrganizationProjectUserDeleted {
+ return "organization.project.user.deleted"
+}
+func (c OrganizationSpendAlert) Default() OrganizationSpendAlert { return "organization.spend_alert" }
+func (c OrganizationSpendAlertDeleted) Default() OrganizationSpendAlertDeleted {
+ return "organization.spend_alert.deleted"
+}
+func (c OrganizationUsageAudioSpeechesResult) Default() OrganizationUsageAudioSpeechesResult {
+ return "organization.usage.audio_speeches.result"
+}
+func (c OrganizationUsageAudioTranscriptionsResult) Default() OrganizationUsageAudioTranscriptionsResult {
+ return "organization.usage.audio_transcriptions.result"
+}
+func (c OrganizationUsageCodeInterpreterSessionsResult) Default() OrganizationUsageCodeInterpreterSessionsResult {
+ return "organization.usage.code_interpreter_sessions.result"
+}
+func (c OrganizationUsageCompletionsResult) Default() OrganizationUsageCompletionsResult {
+ return "organization.usage.completions.result"
+}
+func (c OrganizationUsageEmbeddingsResult) Default() OrganizationUsageEmbeddingsResult {
+ return "organization.usage.embeddings.result"
+}
+func (c OrganizationUsageFileSearchesResult) Default() OrganizationUsageFileSearchesResult {
+ return "organization.usage.file_searches.result"
+}
+func (c OrganizationUsageImagesResult) Default() OrganizationUsageImagesResult {
+ return "organization.usage.images.result"
+}
+func (c OrganizationUsageModerationsResult) Default() OrganizationUsageModerationsResult {
+ return "organization.usage.moderations.result"
+}
+func (c OrganizationUsageVectorStoresResult) Default() OrganizationUsageVectorStoresResult {
+ return "organization.usage.vector_stores.result"
+}
+func (c OrganizationUsageWebSearchesResult) Default() OrganizationUsageWebSearchesResult {
+ return "organization.usage.web_searches.result"
+}
+func (c OrganizationUser) Default() OrganizationUser { return "organization.user" }
+func (c OrganizationUserDeleted) Default() OrganizationUserDeleted {
+ return "organization.user.deleted"
+}
func (c Other) Default() Other { return "other" }
func (c OutputAudio) Default() OutputAudio { return "output_audio" }
func (c OutputAudioBufferClear) Default() OutputAudioBufferClear { return "output_audio_buffer.clear" }
@@ -535,13 +723,34 @@ func (c OutputAudioBufferStarted) Default() OutputAudioBufferStarted {
func (c OutputAudioBufferStopped) Default() OutputAudioBufferStopped {
return "output_audio_buffer.stopped"
}
-func (c OutputText) Default() OutputText { return "output_text" }
+func (c OutputText) Default() OutputText { return "output_text" }
+func (c Page) Default() Page { return "page" }
+func (c Program) Default() Program { return "program" }
+func (c ProgramOutput) Default() ProgramOutput { return "program_output" }
+func (c ProgrammaticToolCalling) Default() ProgrammaticToolCalling {
+ return "programmatic_tool_calling"
+}
+func (c ProjectDataRetention) Default() ProjectDataRetention { return "project.data_retention" }
+func (c ProjectGroup) Default() ProjectGroup { return "project.group" }
+func (c ProjectGroupDeleted) Default() ProjectGroupDeleted { return "project.group.deleted" }
+func (c ProjectModelPermissions) Default() ProjectModelPermissions {
+ return "project.model_permissions"
+}
+func (c ProjectModelPermissionsDeleted) Default() ProjectModelPermissionsDeleted {
+ return "project.model_permissions.deleted"
+}
+func (c ProjectRateLimit) Default() ProjectRateLimit { return "project.rate_limit" }
+func (c ProjectSpendAlert) Default() ProjectSpendAlert { return "project.spend_alert" }
+func (c ProjectSpendAlertDeleted) Default() ProjectSpendAlertDeleted {
+ return "project.spend_alert.deleted"
+}
func (c ProtocolError) Default() ProtocolError { return "protocol_error" }
func (c Python) Default() Python { return "python" }
func (c QuotedText) Default() QuotedText { return "quoted_text" }
func (c RateLimitsUpdated) Default() RateLimitsUpdated { return "rate_limits.updated" }
func (c Realtime) Default() Realtime { return "realtime" }
func (c RealtimeCallIncoming) Default() RealtimeCallIncoming { return "realtime.call.incoming" }
+func (c RealtimeSession) Default() RealtimeSession { return "realtime.session" }
func (c Reasoning) Default() Reasoning { return "reasoning" }
func (c ReasoningText) Default() ReasoningText { return "reasoning_text" }
func (c Refusal) Default() Refusal { return "refusal" }
@@ -616,9 +825,12 @@ func (c ResponseImageGenerationCallInProgress) Default() ResponseImageGeneration
func (c ResponseImageGenerationCallPartialImage) Default() ResponseImageGenerationCallPartialImage {
return "response.image_generation_call.partial_image"
}
-func (c ResponseInProgress) Default() ResponseInProgress { return "response.in_progress" }
-func (c ResponseIncomplete) Default() ResponseIncomplete { return "response.incomplete" }
-func (c ResponseInputTokens) Default() ResponseInputTokens { return "response.input_tokens" }
+func (c ResponseInProgress) Default() ResponseInProgress { return "response.in_progress" }
+func (c ResponseIncomplete) Default() ResponseIncomplete { return "response.incomplete" }
+func (c ResponseInject) Default() ResponseInject { return "response.inject" }
+func (c ResponseInjectCreated) Default() ResponseInjectCreated { return "response.inject.created" }
+func (c ResponseInjectFailed) Default() ResponseInjectFailed { return "response.inject.failed" }
+func (c ResponseInputTokens) Default() ResponseInputTokens { return "response.input_tokens" }
func (c ResponseMcpCallArgumentsDelta) Default() ResponseMcpCallArgumentsDelta {
return "response.mcp_call_arguments.delta"
}
@@ -694,14 +906,30 @@ func (c ResponseWebSearchCallInProgress) Default() ResponseWebSearchCallInProgre
func (c ResponseWebSearchCallSearching) Default() ResponseWebSearchCallSearching {
return "response.web_search_call.searching"
}
-func (c RetentionRatio) Default() RetentionRatio { return "retention_ratio" }
-func (c ScoreModel) Default() ScoreModel { return "score_model" }
-func (c Screenshot) Default() Screenshot { return "screenshot" }
-func (c Scroll) Default() Scroll { return "scroll" }
-func (c Search) Default() Search { return "search" }
-func (c SemanticVad) Default() SemanticVad { return "semantic_vad" }
-func (c ServerVad) Default() ServerVad { return "server_vad" }
-func (c SessionCreated) Default() SessionCreated { return "session.created" }
+func (c RetentionRatio) Default() RetentionRatio { return "retention_ratio" }
+func (c Role) Default() Role { return "role" }
+func (c RoleDeleted) Default() RoleDeleted { return "role.deleted" }
+func (c ScoreModel) Default() ScoreModel { return "score_model" }
+func (c Screenshot) Default() Screenshot { return "screenshot" }
+func (c Scroll) Default() Scroll { return "scroll" }
+func (c Search) Default() Search { return "search" }
+func (c SemanticVad) Default() SemanticVad { return "semantic_vad" }
+func (c ServerVad) Default() ServerVad { return "server_vad" }
+func (c SessionClose) Default() SessionClose { return "session.close" }
+func (c SessionClosed) Default() SessionClosed { return "session.closed" }
+func (c SessionCreated) Default() SessionCreated { return "session.created" }
+func (c SessionInputAudioBufferAppend) Default() SessionInputAudioBufferAppend {
+ return "session.input_audio_buffer.append"
+}
+func (c SessionInputTranscriptDelta) Default() SessionInputTranscriptDelta {
+ return "session.input_transcript.delta"
+}
+func (c SessionOutputAudioDelta) Default() SessionOutputAudioDelta {
+ return "session.output_audio.delta"
+}
+func (c SessionOutputTranscriptDelta) Default() SessionOutputTranscriptDelta {
+ return "session.output_transcript.delta"
+}
func (c SessionUpdate) Default() SessionUpdate { return "session.update" }
func (c SessionUpdated) Default() SessionUpdated { return "session.updated" }
func (c Shell) Default() Shell { return "shell" }
@@ -776,6 +1004,7 @@ func (c TranscriptionSessionUpdate) Default() TranscriptionSessionUpdate {
func (c TranscriptionSessionUpdated) Default() TranscriptionSessionUpdated {
return "transcription_session.updated"
}
+func (c Translation) Default() Translation { return "translation" }
func (c Type) Default() Type { return "type" }
func (c UpdateFile) Default() UpdateFile { return "update_file" }
func (c Upload) Default() Upload { return "upload" }
@@ -783,6 +1012,7 @@ func (c UploadPart) Default() UploadPart { return "upload.part"
func (c URL) Default() URL { return "url" }
func (c URLCitation) Default() URLCitation { return "url_citation" }
func (c User) Default() User { return "user" }
+func (c UserRole) Default() UserRole { return "user.role" }
func (c VectorStore) Default() VectorStore { return "vector_store" }
func (c VectorStoreDeleted) Default() VectorStoreDeleted { return "vector_store.deleted" }
func (c VectorStoreFile) Default() VectorStoreFile { return "vector_store.file" }
@@ -801,6 +1031,8 @@ func (c Wandb) Default() Wandb { return "wandb" }
func (c WebSearchCall) Default() WebSearchCall { return "web_search_call" }
func (c Active) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c AdditionalTools) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c AgentMessage) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c AllowedTools) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Allowlist) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ApplicationZip) MarshalJSON() ([]byte, error) { return marshalString(c) }
@@ -817,6 +1049,8 @@ func (c BatchCancelled) MarshalJSON() ([]byte, error) { return marshalS
func (c BatchCompleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c BatchExpired) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c BatchFailed) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Bucket) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c CertificateDeleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ChatCompletion) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ChatCompletionChunk) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ChatCompletionDeleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
@@ -836,6 +1070,7 @@ func (c Closed) MarshalJSON() ([]byte, error) { return marshalS
func (c CodeInterpreter) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c CodeInterpreterCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Compaction) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c CompactionTrigger) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Computer) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ComputerCallOutput) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ComputerScreenshot) MarshalJSON() ([]byte, error) { return marshalString(c) }
@@ -866,96 +1101,155 @@ func (c ConversationItemInputAudioTranscriptionFailed) MarshalJSON() ([]byte, er
func (c ConversationItemInputAudioTranscriptionSegment) MarshalJSON() ([]byte, error) {
return marshalString(c)
}
-func (c ConversationItemRetrieve) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c ConversationItemRetrieved) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c ConversationItemTruncate) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c ConversationItemTruncated) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c CreateFile) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c CreatedAt) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Custom) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c CustomToolCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c CustomToolCallOutput) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c DeleteFile) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Developer) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Disabled) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c DoubleClick) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Drag) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Duration) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Embedding) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Error) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c EvalRunCanceled) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c EvalRunFailed) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c EvalRunSucceeded) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Exec) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Exit) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c File) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c FileCitation) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c FilePath) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c FileSearch) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c FileSearchCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c FindInPage) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c FineTuningJob) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c FineTuningJobCancelled) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c FineTuningJobCheckpoint) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c FineTuningJobEvent) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c FineTuningJobFailed) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c FineTuningJobSucceeded) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Function) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c FunctionCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c FunctionCallOutput) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Grammar) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c HTTPError) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Image) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c ImageEditCompleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c ImageEditPartialImage) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c ImageFile) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c ImageGeneration) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c ImageGenerationCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c ImageGenerationCompleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c ImageGenerationPartialImage) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c ImageURL) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Inf) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Inline) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c InputAudio) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c InputAudioBufferAppend) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c InputAudioBufferClear) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c InputAudioBufferCleared) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c InputAudioBufferCommit) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c InputAudioBufferCommitted) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c InputAudioBufferDtmfEventReceived) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c InputAudioBufferSpeechStarted) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c InputAudioBufferSpeechStopped) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c InputAudioBufferTimeoutTriggered) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c InputFile) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c InputImage) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c InputText) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c JSONObject) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c JSONSchema) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Keypress) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c LabelModel) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c LastActiveAt) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c List) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Local) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c LocalShell) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c LocalShellCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c LocalShellCallOutput) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Locked) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Logs) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Mcp) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c McpApprovalRequest) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c McpApprovalResponse) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c McpCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c McpListTools) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c McpListToolsCompleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c McpListToolsFailed) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c McpListToolsInProgress) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Message) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c MessageCreation) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Model) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Move) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Multi) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Namespace) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c OpenPage) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ConversationItemRetrieve) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ConversationItemRetrieved) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ConversationItemTruncate) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ConversationItemTruncated) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c CreateFile) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c CreatedAt) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Custom) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c CustomToolCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c CustomToolCallOutput) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c DeleteFile) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Developer) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Direct) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Disabled) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c DoubleClick) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Drag) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Duration) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Email) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Embedding) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c EncryptedContent) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Error) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c EvalRunCanceled) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c EvalRunFailed) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c EvalRunSucceeded) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Exec) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Exit) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Explicit) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c File) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c FileCitation) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c FilePath) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c FileSearch) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c FileSearchCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c FindInPage) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c FineTuningJob) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c FineTuningJobCancelled) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c FineTuningJobCheckpoint) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c FineTuningJobEvent) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c FineTuningJobFailed) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c FineTuningJobSucceeded) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Function) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c FunctionCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c FunctionCallOutput) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Grammar) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Group) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c GroupDeleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c GroupRole) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c GroupUser) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c GroupUserDeleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c HTTPError) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Image) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ImageEditCompleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ImageEditPartialImage) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ImageFile) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ImageGeneration) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ImageGenerationCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ImageGenerationCompleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ImageGenerationPartialImage) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ImageURL) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Inf) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Inline) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c InputAudio) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c InputAudioBufferAppend) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c InputAudioBufferClear) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c InputAudioBufferCleared) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c InputAudioBufferCommit) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c InputAudioBufferCommitted) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c InputAudioBufferDtmfEventReceived) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c InputAudioBufferSpeechStarted) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c InputAudioBufferSpeechStopped) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c InputAudioBufferTimeoutTriggered) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c InputFile) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c InputImage) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c InputText) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c JSONObject) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c JSONSchema) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Keypress) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c LabelModel) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c LastActiveAt) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c List) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Local) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c LocalShell) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c LocalShellCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c LocalShellCallOutput) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Locked) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Logs) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Mcp) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c McpApprovalRequest) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c McpApprovalResponse) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c McpCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c McpListTools) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c McpListToolsCompleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c McpListToolsFailed) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c McpListToolsInProgress) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Message) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c MessageCreation) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Model) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ModerationResult) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ModerationResults) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Move) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Multi) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c MultiAgentCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c MultiAgentCallOutput) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Namespace) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OpenPage) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationAdminAPIKey) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationAdminAPIKeyDeleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationCertificate) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationCertificateActivation) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationCertificateDeactivation) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationCostsResult) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationDataRetention) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationInvite) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationInviteDeleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationProject) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationProjectAPIKey) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationProjectAPIKeyDeleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationProjectCertificate) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationProjectCertificateActivation) MarshalJSON() ([]byte, error) {
+ return marshalString(c)
+}
+func (c OrganizationProjectCertificateDeactivation) MarshalJSON() ([]byte, error) {
+ return marshalString(c)
+}
+func (c OrganizationProjectServiceAccount) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationProjectServiceAccountAPIKey) MarshalJSON() ([]byte, error) {
+ return marshalString(c)
+}
+func (c OrganizationProjectServiceAccountDeleted) MarshalJSON() ([]byte, error) {
+ return marshalString(c)
+}
+func (c OrganizationProjectUser) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationProjectUserDeleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationSpendAlert) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationSpendAlertDeleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationUsageAudioSpeechesResult) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationUsageAudioTranscriptionsResult) MarshalJSON() ([]byte, error) {
+ return marshalString(c)
+}
+func (c OrganizationUsageCodeInterpreterSessionsResult) MarshalJSON() ([]byte, error) {
+ return marshalString(c)
+}
+func (c OrganizationUsageCompletionsResult) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationUsageEmbeddingsResult) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationUsageFileSearchesResult) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationUsageImagesResult) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationUsageModerationsResult) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationUsageVectorStoresResult) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationUsageWebSearchesResult) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationUser) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c OrganizationUserDeleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Other) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c OutputAudio) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c OutputAudioBufferClear) MarshalJSON() ([]byte, error) { return marshalString(c) }
@@ -963,12 +1257,25 @@ func (c OutputAudioBufferCleared) MarshalJSON() ([]byte, error) { r
func (c OutputAudioBufferStarted) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c OutputAudioBufferStopped) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c OutputText) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Page) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Program) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ProgramOutput) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ProgrammaticToolCalling) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ProjectDataRetention) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ProjectGroup) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ProjectGroupDeleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ProjectModelPermissions) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ProjectModelPermissionsDeleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ProjectRateLimit) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ProjectSpendAlert) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ProjectSpendAlertDeleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ProtocolError) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Python) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c QuotedText) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c RateLimitsUpdated) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Realtime) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c RealtimeCallIncoming) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c RealtimeSession) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Reasoning) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ReasoningText) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Refusal) MarshalJSON() ([]byte, error) { return marshalString(c) }
@@ -1009,6 +1316,9 @@ func (c ResponseImageGenerationCallPartialImage) MarshalJSON() ([]byte, error) {
}
func (c ResponseInProgress) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ResponseIncomplete) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ResponseInject) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ResponseInjectCreated) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ResponseInjectFailed) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ResponseInputTokens) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ResponseMcpCallArgumentsDelta) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ResponseMcpCallArgumentsDone) MarshalJSON() ([]byte, error) { return marshalString(c) }
@@ -1040,13 +1350,21 @@ func (c ResponseWebSearchCallCompleted) MarshalJSON() ([]byte, error) { retu
func (c ResponseWebSearchCallInProgress) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ResponseWebSearchCallSearching) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c RetentionRatio) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Role) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c RoleDeleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ScoreModel) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Screenshot) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Scroll) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Search) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c SemanticVad) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ServerVad) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c SessionClose) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c SessionClosed) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c SessionCreated) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c SessionInputAudioBufferAppend) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c SessionInputTranscriptDelta) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c SessionOutputAudioDelta) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c SessionOutputTranscriptDelta) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c SessionUpdate) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c SessionUpdated) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Shell) MarshalJSON() ([]byte, error) { return marshalString(c) }
@@ -1109,6 +1427,7 @@ func (c TranscriptTextSegment) MarshalJSON() ([]byte, error) { retu
func (c Transcription) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c TranscriptionSessionUpdate) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c TranscriptionSessionUpdated) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Translation) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Type) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c UpdateFile) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Upload) MarshalJSON() ([]byte, error) { return marshalString(c) }
@@ -1116,6 +1435,7 @@ func (c UploadPart) MarshalJSON() ([]byte, error) { retu
func (c URL) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c URLCitation) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c User) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c UserRole) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c VectorStore) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c VectorStoreDeleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c VectorStoreFile) MarshalJSON() ([]byte, error) { return marshalString(c) }
diff --git a/vendor/github.com/openai/openai-go/v3/shared/shared.go b/vendor/github.com/openai/openai-go/v3/shared/shared.go
index a45ce9146..4f457cffb 100644
--- a/vendor/github.com/openai/openai-go/v3/shared/shared.go
+++ b/vendor/github.com/openai/openai-go/v3/shared/shared.go
@@ -42,6 +42,9 @@ type ResponsesModel = string
// aliased to make [param.APIObject] private when embedding
const (
+ ChatModelGPT5_6Sol ChatModel = "gpt-5.6-sol"
+ ChatModelGPT5_6Terra ChatModel = "gpt-5.6-terra"
+ ChatModelGPT5_6Luna ChatModel = "gpt-5.6-luna"
ChatModelGPT5_4 ChatModel = "gpt-5.4"
ChatModelGPT5_4Mini ChatModel = "gpt-5.4-mini"
ChatModelGPT5_4Nano ChatModel = "gpt-5.4-nano"
@@ -796,21 +799,23 @@ const (
// Configuration options for
// [reasoning models](https://platform.openai.com/docs/guides/reasoning).
type Reasoning struct {
- // Constrains effort on reasoning for
- // [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
- // supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`.
- // Reducing reasoning effort can result in faster responses and fewer tokens used
- // on reasoning in a response.
+ // Controls which reasoning items are rendered back to the model on later turns. If
+ // omitted or set to `auto`, the model determines the context mode. The `gpt-5.6`
+ // model family defaults to `all_turns`; earlier models default to `current_turn`.
//
- // - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported
- // reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool
- // calls are supported for all reasoning values in gpt-5.1.
- // - All models before `gpt-5.1` default to `medium` reasoning effort, and do not
- // support `none`.
- // - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
- // - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
+ // When returned on a response, this is the effective reasoning context mode used
+ // for the response.
//
- // Any of "none", "minimal", "low", "medium", "high", "xhigh".
+ // Any of "auto", "current_turn", "all_turns".
+ Context ReasoningContext `json:"context" api:"nullable"`
+ // Constrains effort on reasoning for reasoning models. Currently supported values
+ // are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. Reducing
+ // reasoning effort can result in faster responses and fewer tokens used on
+ // reasoning in a response. Not all reasoning models support every value. See the
+ // [reasoning guide](https://platform.openai.com/docs/guides/reasoning) for
+ // model-specific support.
+ //
+ // Any of "none", "minimal", "low", "medium", "high", "xhigh", "max".
Effort ReasoningEffort `json:"effort" api:"nullable"`
// **Deprecated:** use `summary` instead.
//
@@ -822,6 +827,10 @@ type Reasoning struct {
//
// Deprecated: deprecated
GenerateSummary ReasoningGenerateSummary `json:"generate_summary" api:"nullable"`
+ // Controls the reasoning execution mode for the request.
+ //
+ // When returned on a response, this is the effective execution mode.
+ Mode ReasoningMode `json:"mode"`
// A summary of the reasoning performed by the model. This can be useful for
// debugging and understanding the model's reasoning process. One of `auto`,
// `concise`, or `detailed`.
@@ -833,8 +842,10 @@ type Reasoning struct {
Summary ReasoningSummary `json:"summary" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
+ Context respjson.Field
Effort respjson.Field
GenerateSummary respjson.Field
+ Mode respjson.Field
Summary respjson.Field
ExtraFields map[string]respjson.Field
raw string
@@ -856,6 +867,20 @@ func (r Reasoning) ToParam() ReasoningParam {
return param.Override[ReasoningParam](json.RawMessage(r.RawJSON()))
}
+// Controls which reasoning items are rendered back to the model on later turns. If
+// omitted or set to `auto`, the model determines the context mode. The `gpt-5.6`
+// model family defaults to `all_turns`; earlier models default to `current_turn`.
+//
+// When returned on a response, this is the effective reasoning context mode used
+// for the response.
+type ReasoningContext string
+
+const (
+ ReasoningContextAuto ReasoningContext = "auto"
+ ReasoningContextCurrentTurn ReasoningContext = "current_turn"
+ ReasoningContextAllTurns ReasoningContext = "all_turns"
+)
+
// **Deprecated:** use `summary` instead.
//
// A summary of the reasoning performed by the model. This can be useful for
@@ -869,6 +894,16 @@ const (
ReasoningGenerateSummaryDetailed ReasoningGenerateSummary = "detailed"
)
+// Controls the reasoning execution mode for the request.
+//
+// When returned on a response, this is the effective execution mode.
+type ReasoningMode string
+
+const (
+ ReasoningModeStandard ReasoningMode = "standard"
+ ReasoningModePro ReasoningMode = "pro"
+)
+
// A summary of the reasoning performed by the model. This can be useful for
// debugging and understanding the model's reasoning process. One of `auto`,
// `concise`, or `detailed`.
@@ -888,21 +923,23 @@ const (
// Configuration options for
// [reasoning models](https://platform.openai.com/docs/guides/reasoning).
type ReasoningParam struct {
- // Constrains effort on reasoning for
- // [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
- // supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`.
- // Reducing reasoning effort can result in faster responses and fewer tokens used
- // on reasoning in a response.
+ // Controls which reasoning items are rendered back to the model on later turns. If
+ // omitted or set to `auto`, the model determines the context mode. The `gpt-5.6`
+ // model family defaults to `all_turns`; earlier models default to `current_turn`.
//
- // - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported
- // reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool
- // calls are supported for all reasoning values in gpt-5.1.
- // - All models before `gpt-5.1` default to `medium` reasoning effort, and do not
- // support `none`.
- // - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
- // - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
+ // When returned on a response, this is the effective reasoning context mode used
+ // for the response.
//
- // Any of "none", "minimal", "low", "medium", "high", "xhigh".
+ // Any of "auto", "current_turn", "all_turns".
+ Context ReasoningContext `json:"context,omitzero"`
+ // Constrains effort on reasoning for reasoning models. Currently supported values
+ // are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. Reducing
+ // reasoning effort can result in faster responses and fewer tokens used on
+ // reasoning in a response. Not all reasoning models support every value. See the
+ // [reasoning guide](https://platform.openai.com/docs/guides/reasoning) for
+ // model-specific support.
+ //
+ // Any of "none", "minimal", "low", "medium", "high", "xhigh", "max".
Effort ReasoningEffort `json:"effort,omitzero"`
// **Deprecated:** use `summary` instead.
//
@@ -923,6 +960,10 @@ type ReasoningParam struct {
//
// Any of "auto", "concise", "detailed".
Summary ReasoningSummary `json:"summary,omitzero"`
+ // Controls the reasoning execution mode for the request.
+ //
+ // When returned on a response, this is the effective execution mode.
+ Mode ReasoningMode `json:"mode,omitzero"`
paramObj
}
@@ -934,19 +975,12 @@ func (r *ReasoningParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Constrains effort on reasoning for
-// [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
-// supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`.
-// Reducing reasoning effort can result in faster responses and fewer tokens used
-// on reasoning in a response.
-//
-// - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported
-// reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool
-// calls are supported for all reasoning values in gpt-5.1.
-// - All models before `gpt-5.1` default to `medium` reasoning effort, and do not
-// support `none`.
-// - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
-// - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
+// Constrains effort on reasoning for reasoning models. Currently supported values
+// are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. Reducing
+// reasoning effort can result in faster responses and fewer tokens used on
+// reasoning in a response. Not all reasoning models support every value. See the
+// [reasoning guide](https://platform.openai.com/docs/guides/reasoning) for
+// model-specific support.
type ReasoningEffort string
const (
@@ -956,6 +990,7 @@ const (
ReasoningEffortMedium ReasoningEffort = "medium"
ReasoningEffortHigh ReasoningEffort = "high"
ReasoningEffortXhigh ReasoningEffort = "xhigh"
+ ReasoningEffortMax ReasoningEffort = "max"
)
// JSON object response format. An older method of generating JSON responses. Using
diff --git a/vendor/github.com/openai/openai-go/v3/skill.go b/vendor/github.com/openai/openai-go/v3/skill.go
index bdae55ba2..baf89b42a 100644
--- a/vendor/github.com/openai/openai-go/v3/skill.go
+++ b/vendor/github.com/openai/openai-go/v3/skill.go
@@ -6,7 +6,6 @@ import (
"bytes"
"context"
"errors"
- "fmt"
"io"
"mime/multipart"
"net/http"
@@ -49,7 +48,8 @@ func NewSkillService(opts ...option.RequestOption) (r SkillService) {
// Create a new skill.
func (r *SkillService) New(ctx context.Context, body SkillNewParams, opts ...option.RequestOption) (res *Skill, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "skills"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -57,24 +57,26 @@ func (r *SkillService) New(ctx context.Context, body SkillNewParams, opts ...opt
// Get a skill by its ID.
func (r *SkillService) Get(ctx context.Context, skillID string, opts ...option.RequestOption) (res *Skill, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if skillID == "" {
err = errors.New("missing required skill_id parameter")
return nil, err
}
- path := fmt.Sprintf("skills/%s", skillID)
+ path := requestconfig.FormatPath("skills/%s", skillID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
// Update the default version pointer for a skill.
func (r *SkillService) Update(ctx context.Context, skillID string, body SkillUpdateParams, opts ...option.RequestOption) (res *Skill, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if skillID == "" {
err = errors.New("missing required skill_id parameter")
return nil, err
}
- path := fmt.Sprintf("skills/%s", skillID)
+ path := requestconfig.FormatPath("skills/%s", skillID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
@@ -82,7 +84,8 @@ func (r *SkillService) Update(ctx context.Context, skillID string, body SkillUpd
// List all skills for the current project.
func (r *SkillService) List(ctx context.Context, query SkillListParams, opts ...option.RequestOption) (res *pagination.CursorPage[Skill], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "skills"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
@@ -104,12 +107,13 @@ func (r *SkillService) ListAutoPaging(ctx context.Context, query SkillListParams
// Delete a skill by its ID.
func (r *SkillService) Delete(ctx context.Context, skillID string, opts ...option.RequestOption) (res *DeletedSkill, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if skillID == "" {
err = errors.New("missing required skill_id parameter")
return nil, err
}
- path := fmt.Sprintf("skills/%s", skillID)
+ path := requestconfig.FormatPath("skills/%s", skillID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
return res, err
}
@@ -138,7 +142,7 @@ type Skill struct {
// Unique identifier for the skill.
ID string `json:"id" api:"required"`
// Unix timestamp (seconds) for when the skill was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Default version for the skill.
DefaultVersion string `json:"default_version" api:"required"`
// Description of the skill.
diff --git a/vendor/github.com/openai/openai-go/v3/skillcontent.go b/vendor/github.com/openai/openai-go/v3/skillcontent.go
index 16ec3339c..1bdbd2ef0 100644
--- a/vendor/github.com/openai/openai-go/v3/skillcontent.go
+++ b/vendor/github.com/openai/openai-go/v3/skillcontent.go
@@ -5,7 +5,6 @@ package openai
import (
"context"
"errors"
- "fmt"
"net/http"
"slices"
@@ -34,13 +33,14 @@ func NewSkillContentService(opts ...option.RequestOption) (r SkillContentService
// Download a skill zip bundle by its ID.
func (r *SkillContentService) Get(ctx context.Context, skillID string, opts ...option.RequestOption) (res *http.Response, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "application/binary")}, opts...)
if skillID == "" {
err = errors.New("missing required skill_id parameter")
return nil, err
}
- path := fmt.Sprintf("skills/%s/content", skillID)
+ path := requestconfig.FormatPath("skills/%s/content", skillID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
diff --git a/vendor/github.com/openai/openai-go/v3/skillversion.go b/vendor/github.com/openai/openai-go/v3/skillversion.go
index c1ab5fb16..5c4ea6860 100644
--- a/vendor/github.com/openai/openai-go/v3/skillversion.go
+++ b/vendor/github.com/openai/openai-go/v3/skillversion.go
@@ -6,7 +6,6 @@ import (
"bytes"
"context"
"errors"
- "fmt"
"io"
"mime/multipart"
"net/http"
@@ -47,19 +46,21 @@ func NewSkillVersionService(opts ...option.RequestOption) (r SkillVersionService
// Create a new immutable skill version.
func (r *SkillVersionService) New(ctx context.Context, skillID string, body SkillVersionNewParams, opts ...option.RequestOption) (res *SkillVersion, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if skillID == "" {
err = errors.New("missing required skill_id parameter")
return nil, err
}
- path := fmt.Sprintf("skills/%s/versions", skillID)
+ path := requestconfig.FormatPath("skills/%s/versions", skillID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
// Get a specific skill version.
func (r *SkillVersionService) Get(ctx context.Context, skillID string, version string, opts ...option.RequestOption) (res *SkillVersion, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if skillID == "" {
err = errors.New("missing required skill_id parameter")
return nil, err
@@ -68,7 +69,7 @@ func (r *SkillVersionService) Get(ctx context.Context, skillID string, version s
err = errors.New("missing required version parameter")
return nil, err
}
- path := fmt.Sprintf("skills/%s/versions/%s", skillID, version)
+ path := requestconfig.FormatPath("skills/%s/versions/%s", skillID, version)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
@@ -76,13 +77,14 @@ func (r *SkillVersionService) Get(ctx context.Context, skillID string, version s
// List skill versions for a skill.
func (r *SkillVersionService) List(ctx context.Context, skillID string, query SkillVersionListParams, opts ...option.RequestOption) (res *pagination.CursorPage[SkillVersion], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
if skillID == "" {
err = errors.New("missing required skill_id parameter")
return nil, err
}
- path := fmt.Sprintf("skills/%s/versions", skillID)
+ path := requestconfig.FormatPath("skills/%s/versions", skillID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
@@ -102,7 +104,8 @@ func (r *SkillVersionService) ListAutoPaging(ctx context.Context, skillID string
// Delete a skill version.
func (r *SkillVersionService) Delete(ctx context.Context, skillID string, version string, opts ...option.RequestOption) (res *DeletedSkillVersion, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if skillID == "" {
err = errors.New("missing required skill_id parameter")
return nil, err
@@ -111,7 +114,7 @@ func (r *SkillVersionService) Delete(ctx context.Context, skillID string, versio
err = errors.New("missing required version parameter")
return nil, err
}
- path := fmt.Sprintf("skills/%s/versions/%s", skillID, version)
+ path := requestconfig.FormatPath("skills/%s/versions/%s", skillID, version)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
return res, err
}
@@ -143,7 +146,7 @@ type SkillVersion struct {
// Unique identifier for the skill version.
ID string `json:"id" api:"required"`
// Unix timestamp (seconds) for when the version was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Description of the skill version.
Description string `json:"description" api:"required"`
// Name of the skill version.
diff --git a/vendor/github.com/openai/openai-go/v3/skillversioncontent.go b/vendor/github.com/openai/openai-go/v3/skillversioncontent.go
index 56d1be7a1..e6a399c04 100644
--- a/vendor/github.com/openai/openai-go/v3/skillversioncontent.go
+++ b/vendor/github.com/openai/openai-go/v3/skillversioncontent.go
@@ -5,7 +5,6 @@ package openai
import (
"context"
"errors"
- "fmt"
"net/http"
"slices"
@@ -34,7 +33,8 @@ func NewSkillVersionContentService(opts ...option.RequestOption) (r SkillVersion
// Download a skill version zip bundle.
func (r *SkillVersionContentService) Get(ctx context.Context, skillID string, version string, opts ...option.RequestOption) (res *http.Response, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "application/binary")}, opts...)
if skillID == "" {
err = errors.New("missing required skill_id parameter")
@@ -44,7 +44,7 @@ func (r *SkillVersionContentService) Get(ctx context.Context, skillID string, ve
err = errors.New("missing required version parameter")
return nil, err
}
- path := fmt.Sprintf("skills/%s/versions/%s/content", skillID, version)
+ path := requestconfig.FormatPath("skills/%s/versions/%s/content", skillID, version)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
diff --git a/vendor/github.com/openai/openai-go/v3/upload.go b/vendor/github.com/openai/openai-go/v3/upload.go
index dcb7a6606..6120d3912 100644
--- a/vendor/github.com/openai/openai-go/v3/upload.go
+++ b/vendor/github.com/openai/openai-go/v3/upload.go
@@ -5,7 +5,6 @@ package openai
import (
"context"
"errors"
- "fmt"
"net/http"
"slices"
@@ -63,7 +62,8 @@ func NewUploadService(opts ...option.RequestOption) (r UploadService) {
//
// Returns the Upload object with status `pending`.
func (r *UploadService) New(ctx context.Context, body UploadNewParams, opts ...option.RequestOption) (res *Upload, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "uploads"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -73,12 +73,13 @@ func (r *UploadService) New(ctx context.Context, body UploadNewParams, opts ...o
//
// Returns the Upload object with status `cancelled`.
func (r *UploadService) Cancel(ctx context.Context, uploadID string, opts ...option.RequestOption) (res *Upload, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if uploadID == "" {
err = errors.New("missing required upload_id parameter")
return nil, err
}
- path := fmt.Sprintf("uploads/%s/cancel", uploadID)
+ path := requestconfig.FormatPath("uploads/%s/cancel", uploadID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
return res, err
}
@@ -99,12 +100,13 @@ func (r *UploadService) Cancel(ctx context.Context, uploadID string, opts ...opt
// including an additional `file` property containing the created usable File
// object.
func (r *UploadService) Complete(ctx context.Context, uploadID string, body UploadCompleteParams, opts ...option.RequestOption) (res *Upload, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if uploadID == "" {
err = errors.New("missing required upload_id parameter")
return nil, err
}
- path := fmt.Sprintf("uploads/%s/complete", uploadID)
+ path := requestconfig.FormatPath("uploads/%s/complete", uploadID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
@@ -116,9 +118,9 @@ type Upload struct {
// The intended number of bytes to be uploaded.
Bytes int64 `json:"bytes" api:"required"`
// The Unix timestamp (in seconds) for when the Upload was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The Unix timestamp (in seconds) for when the Upload will expire.
- ExpiresAt int64 `json:"expires_at" api:"required"`
+ ExpiresAt int64 `json:"expires_at" api:"required" format:"unixtime"`
// The name of the file to be uploaded.
Filename string `json:"filename" api:"required"`
// The object type, which is always "upload".
diff --git a/vendor/github.com/openai/openai-go/v3/uploadpart.go b/vendor/github.com/openai/openai-go/v3/uploadpart.go
index 86a3eca41..4c1369762 100644
--- a/vendor/github.com/openai/openai-go/v3/uploadpart.go
+++ b/vendor/github.com/openai/openai-go/v3/uploadpart.go
@@ -6,7 +6,6 @@ import (
"bytes"
"context"
"errors"
- "fmt"
"io"
"mime/multipart"
"net/http"
@@ -53,12 +52,13 @@ func NewUploadPartService(opts ...option.RequestOption) (r UploadPartService) {
// order of the Parts when you
// [complete the Upload](https://platform.openai.com/docs/api-reference/uploads/complete).
func (r *UploadPartService) New(ctx context.Context, uploadID string, body UploadPartNewParams, opts ...option.RequestOption) (res *UploadPart, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if uploadID == "" {
err = errors.New("missing required upload_id parameter")
return nil, err
}
- path := fmt.Sprintf("uploads/%s/parts", uploadID)
+ path := requestconfig.FormatPath("uploads/%s/parts", uploadID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
@@ -68,7 +68,7 @@ type UploadPart struct {
// The upload Part unique identifier, which can be referenced in API endpoints.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) for when the Part was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The object type, which is always `upload.part`.
Object constant.UploadPart `json:"object" default:"upload.part"`
// The ID of the Upload object that this Part was added to.
diff --git a/vendor/github.com/openai/openai-go/v3/vectorstore.go b/vendor/github.com/openai/openai-go/v3/vectorstore.go
index 78646c12a..6c356b2b3 100644
--- a/vendor/github.com/openai/openai-go/v3/vectorstore.go
+++ b/vendor/github.com/openai/openai-go/v3/vectorstore.go
@@ -6,7 +6,6 @@ import (
"context"
"encoding/json"
"errors"
- "fmt"
"net/http"
"net/url"
"slices"
@@ -47,7 +46,8 @@ func NewVectorStoreService(opts ...option.RequestOption) (r VectorStoreService)
// Create a vector store.
func (r *VectorStoreService) New(ctx context.Context, body VectorStoreNewParams, opts ...option.RequestOption) (res *VectorStore, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
path := "vector_stores"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
@@ -56,26 +56,28 @@ func (r *VectorStoreService) New(ctx context.Context, body VectorStoreNewParams,
// Retrieves a vector store.
func (r *VectorStoreService) Get(ctx context.Context, vectorStoreID string, opts ...option.RequestOption) (res *VectorStore, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if vectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
return nil, err
}
- path := fmt.Sprintf("vector_stores/%s", vectorStoreID)
+ path := requestconfig.FormatPath("vector_stores/%s", vectorStoreID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
// Modifies a vector store.
func (r *VectorStoreService) Update(ctx context.Context, vectorStoreID string, body VectorStoreUpdateParams, opts ...option.RequestOption) (res *VectorStore, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if vectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
return nil, err
}
- path := fmt.Sprintf("vector_stores/%s", vectorStoreID)
+ path := requestconfig.FormatPath("vector_stores/%s", vectorStoreID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
@@ -83,7 +85,8 @@ func (r *VectorStoreService) Update(ctx context.Context, vectorStoreID string, b
// Returns a list of vector stores.
func (r *VectorStoreService) List(ctx context.Context, query VectorStoreListParams, opts ...option.RequestOption) (res *pagination.CursorPage[VectorStore], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2"), option.WithResponseInto(&raw)}, opts...)
path := "vector_stores"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
@@ -105,13 +108,14 @@ func (r *VectorStoreService) ListAutoPaging(ctx context.Context, query VectorSto
// Delete a vector store.
func (r *VectorStoreService) Delete(ctx context.Context, vectorStoreID string, opts ...option.RequestOption) (res *VectorStoreDeleted, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if vectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
return nil, err
}
- path := fmt.Sprintf("vector_stores/%s", vectorStoreID)
+ path := requestconfig.FormatPath("vector_stores/%s", vectorStoreID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
return res, err
}
@@ -120,13 +124,14 @@ func (r *VectorStoreService) Delete(ctx context.Context, vectorStoreID string, o
// filter.
func (r *VectorStoreService) Search(ctx context.Context, vectorStoreID string, body VectorStoreSearchParams, opts ...option.RequestOption) (res *pagination.Page[VectorStoreSearchResponse], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2"), option.WithResponseInto(&raw)}, opts...)
if vectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
return nil, err
}
- path := fmt.Sprintf("vector_stores/%s/search", vectorStoreID)
+ path := requestconfig.FormatPath("vector_stores/%s/search", vectorStoreID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, body, &res, opts...)
if err != nil {
return nil, err
@@ -408,10 +413,10 @@ type VectorStore struct {
// The identifier, which can be referenced in API endpoints.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) for when the vector store was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
FileCounts VectorStoreFileCounts `json:"file_counts" api:"required"`
// The Unix timestamp (in seconds) for when the vector store was last active.
- LastActiveAt int64 `json:"last_active_at" api:"required"`
+ LastActiveAt int64 `json:"last_active_at" api:"required" format:"unixtime"`
// Set of 16 key-value pairs that can be attached to an object. This can be useful
// for storing additional information about the object in a structured format, and
// querying for objects via API or the dashboard.
@@ -434,7 +439,7 @@ type VectorStore struct {
// The expiration policy for a vector store.
ExpiresAfter VectorStoreExpiresAfter `json:"expires_after"`
// The Unix timestamp (in seconds) for when the vector store will expire.
- ExpiresAt int64 `json:"expires_at" api:"nullable"`
+ ExpiresAt int64 `json:"expires_at" api:"nullable" format:"unixtime"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
diff --git a/vendor/github.com/openai/openai-go/v3/vectorstorefile.go b/vendor/github.com/openai/openai-go/v3/vectorstorefile.go
index 1c7389090..17d002452 100644
--- a/vendor/github.com/openai/openai-go/v3/vectorstorefile.go
+++ b/vendor/github.com/openai/openai-go/v3/vectorstorefile.go
@@ -6,7 +6,6 @@ import (
"context"
"encoding/json"
"errors"
- "fmt"
"net/http"
"net/url"
"slices"
@@ -44,13 +43,14 @@ func NewVectorStoreFileService(opts ...option.RequestOption) (r VectorStoreFileS
// [File](https://platform.openai.com/docs/api-reference/files) to a
// [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object).
func (r *VectorStoreFileService) New(ctx context.Context, vectorStoreID string, body VectorStoreFileNewParams, opts ...option.RequestOption) (res *VectorStoreFile, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if vectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
return nil, err
}
- path := fmt.Sprintf("vector_stores/%s/files", vectorStoreID)
+ path := requestconfig.FormatPath("vector_stores/%s/files", vectorStoreID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
@@ -96,7 +96,8 @@ func (r *VectorStoreFileService) UploadAndPoll(ctx context.Context, vectorStoreI
// Retrieves a vector store file.
func (r *VectorStoreFileService) Get(ctx context.Context, vectorStoreID string, fileID string, opts ...option.RequestOption) (res *VectorStoreFile, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if vectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
@@ -106,14 +107,15 @@ func (r *VectorStoreFileService) Get(ctx context.Context, vectorStoreID string,
err = errors.New("missing required file_id parameter")
return nil, err
}
- path := fmt.Sprintf("vector_stores/%s/files/%s", vectorStoreID, fileID)
+ path := requestconfig.FormatPath("vector_stores/%s/files/%s", vectorStoreID, fileID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
// Update attributes on a vector store file.
func (r *VectorStoreFileService) Update(ctx context.Context, vectorStoreID string, fileID string, body VectorStoreFileUpdateParams, opts ...option.RequestOption) (res *VectorStoreFile, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if vectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
@@ -123,7 +125,7 @@ func (r *VectorStoreFileService) Update(ctx context.Context, vectorStoreID strin
err = errors.New("missing required file_id parameter")
return nil, err
}
- path := fmt.Sprintf("vector_stores/%s/files/%s", vectorStoreID, fileID)
+ path := requestconfig.FormatPath("vector_stores/%s/files/%s", vectorStoreID, fileID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
@@ -131,13 +133,14 @@ func (r *VectorStoreFileService) Update(ctx context.Context, vectorStoreID strin
// Returns a list of vector store files.
func (r *VectorStoreFileService) List(ctx context.Context, vectorStoreID string, query VectorStoreFileListParams, opts ...option.RequestOption) (res *pagination.CursorPage[VectorStoreFile], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2"), option.WithResponseInto(&raw)}, opts...)
if vectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
return nil, err
}
- path := fmt.Sprintf("vector_stores/%s/files", vectorStoreID)
+ path := requestconfig.FormatPath("vector_stores/%s/files", vectorStoreID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
@@ -160,7 +163,8 @@ func (r *VectorStoreFileService) ListAutoPaging(ctx context.Context, vectorStore
// [delete file](https://platform.openai.com/docs/api-reference/files/delete)
// endpoint.
func (r *VectorStoreFileService) Delete(ctx context.Context, vectorStoreID string, fileID string, opts ...option.RequestOption) (res *VectorStoreFileDeleted, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if vectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
@@ -170,7 +174,7 @@ func (r *VectorStoreFileService) Delete(ctx context.Context, vectorStoreID strin
err = errors.New("missing required file_id parameter")
return nil, err
}
- path := fmt.Sprintf("vector_stores/%s/files/%s", vectorStoreID, fileID)
+ path := requestconfig.FormatPath("vector_stores/%s/files/%s", vectorStoreID, fileID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
return res, err
}
@@ -178,7 +182,8 @@ func (r *VectorStoreFileService) Delete(ctx context.Context, vectorStoreID strin
// Retrieve the parsed contents of a vector store file.
func (r *VectorStoreFileService) Content(ctx context.Context, vectorStoreID string, fileID string, opts ...option.RequestOption) (res *pagination.Page[VectorStoreFileContentResponse], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2"), option.WithResponseInto(&raw)}, opts...)
if vectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
@@ -188,7 +193,7 @@ func (r *VectorStoreFileService) Content(ctx context.Context, vectorStoreID stri
err = errors.New("missing required file_id parameter")
return nil, err
}
- path := fmt.Sprintf("vector_stores/%s/files/%s/content", vectorStoreID, fileID)
+ path := requestconfig.FormatPath("vector_stores/%s/files/%s/content", vectorStoreID, fileID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...)
if err != nil {
return nil, err
@@ -211,7 +216,7 @@ type VectorStoreFile struct {
// The identifier, which can be referenced in API endpoints.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) for when the vector store file was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// The last error associated with this vector store file. Will be `null` if there
// are no errors.
LastError VectorStoreFileLastError `json:"last_error" api:"required"`
diff --git a/vendor/github.com/openai/openai-go/v3/vectorstorefilebatch.go b/vendor/github.com/openai/openai-go/v3/vectorstorefilebatch.go
index 6828de9ae..874d669d6 100644
--- a/vendor/github.com/openai/openai-go/v3/vectorstorefilebatch.go
+++ b/vendor/github.com/openai/openai-go/v3/vectorstorefilebatch.go
@@ -5,7 +5,6 @@ package openai
import (
"context"
"errors"
- "fmt"
"net/http"
"net/url"
"slices"
@@ -42,13 +41,14 @@ func NewVectorStoreFileBatchService(opts ...option.RequestOption) (r VectorStore
// Create a vector store file batch.
func (r *VectorStoreFileBatchService) New(ctx context.Context, vectorStoreID string, body VectorStoreFileBatchNewParams, opts ...option.RequestOption) (res *VectorStoreFileBatch, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if vectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
return nil, err
}
- path := fmt.Sprintf("vector_stores/%s/file_batches", vectorStoreID)
+ path := requestconfig.FormatPath("vector_stores/%s/file_batches", vectorStoreID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
@@ -114,7 +114,8 @@ func (r *VectorStoreFileBatchService) UploadAndPoll(ctx context.Context, vectorS
// Retrieves a vector store file batch.
func (r *VectorStoreFileBatchService) Get(ctx context.Context, vectorStoreID string, batchID string, opts ...option.RequestOption) (res *VectorStoreFileBatch, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if vectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
@@ -124,7 +125,7 @@ func (r *VectorStoreFileBatchService) Get(ctx context.Context, vectorStoreID str
err = errors.New("missing required batch_id parameter")
return nil, err
}
- path := fmt.Sprintf("vector_stores/%s/file_batches/%s", vectorStoreID, batchID)
+ path := requestconfig.FormatPath("vector_stores/%s/file_batches/%s", vectorStoreID, batchID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
@@ -132,7 +133,8 @@ func (r *VectorStoreFileBatchService) Get(ctx context.Context, vectorStoreID str
// Cancel a vector store file batch. This attempts to cancel the processing of
// files in this batch as soon as possible.
func (r *VectorStoreFileBatchService) Cancel(ctx context.Context, vectorStoreID string, batchID string, opts ...option.RequestOption) (res *VectorStoreFileBatch, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...)
if vectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
@@ -142,7 +144,7 @@ func (r *VectorStoreFileBatchService) Cancel(ctx context.Context, vectorStoreID
err = errors.New("missing required batch_id parameter")
return nil, err
}
- path := fmt.Sprintf("vector_stores/%s/file_batches/%s/cancel", vectorStoreID, batchID)
+ path := requestconfig.FormatPath("vector_stores/%s/file_batches/%s/cancel", vectorStoreID, batchID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
return res, err
}
@@ -150,7 +152,8 @@ func (r *VectorStoreFileBatchService) Cancel(ctx context.Context, vectorStoreID
// Returns a list of vector store files in a batch.
func (r *VectorStoreFileBatchService) ListFiles(ctx context.Context, vectorStoreID string, batchID string, query VectorStoreFileBatchListFilesParams, opts ...option.RequestOption) (res *pagination.CursorPage[VectorStoreFile], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2"), option.WithResponseInto(&raw)}, opts...)
if vectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
@@ -160,7 +163,7 @@ func (r *VectorStoreFileBatchService) ListFiles(ctx context.Context, vectorStore
err = errors.New("missing required batch_id parameter")
return nil, err
}
- path := fmt.Sprintf("vector_stores/%s/file_batches/%s/files", vectorStoreID, batchID)
+ path := requestconfig.FormatPath("vector_stores/%s/file_batches/%s/files", vectorStoreID, batchID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
@@ -184,7 +187,7 @@ type VectorStoreFileBatch struct {
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) for when the vector store files batch was
// created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
FileCounts VectorStoreFileBatchFileCounts `json:"file_counts" api:"required"`
// The object type, which is always `vector_store.file_batch`.
Object constant.VectorStoreFilesBatch `json:"object" default:"vector_store.files_batch"`
diff --git a/vendor/github.com/openai/openai-go/v3/video.go b/vendor/github.com/openai/openai-go/v3/video.go
index a1b4345b7..7a0df6000 100644
--- a/vendor/github.com/openai/openai-go/v3/video.go
+++ b/vendor/github.com/openai/openai-go/v3/video.go
@@ -6,7 +6,6 @@ import (
"bytes"
"context"
"errors"
- "fmt"
"io"
"mime/multipart"
"net/http"
@@ -45,7 +44,8 @@ func NewVideoService(opts ...option.RequestOption) (r VideoService) {
// Create a new video generation job from a prompt and optional reference assets.
func (r *VideoService) New(ctx context.Context, body VideoNewParams, opts ...option.RequestOption) (res *Video, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "videos"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -65,12 +65,13 @@ func (r *VideoService) NewAndPoll(ctx context.Context, body VideoNewParams, poll
// Fetch the latest metadata for a generated video.
func (r *VideoService) Get(ctx context.Context, videoID string, opts ...option.RequestOption) (res *Video, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if videoID == "" {
err = errors.New("missing required video_id parameter")
return nil, err
}
- path := fmt.Sprintf("videos/%s", videoID)
+ path := requestconfig.FormatPath("videos/%s", videoID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
@@ -78,7 +79,8 @@ func (r *VideoService) Get(ctx context.Context, videoID string, opts ...option.R
// List recently generated videos for the current project.
func (r *VideoService) List(ctx context.Context, query VideoListParams, opts ...option.RequestOption) (res *pagination.ConversationCursorPage[Video], err error) {
var raw *http.Response
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "videos"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
@@ -100,19 +102,21 @@ func (r *VideoService) ListAutoPaging(ctx context.Context, query VideoListParams
// Permanently delete a completed or failed video and its stored assets.
func (r *VideoService) Delete(ctx context.Context, videoID string, opts ...option.RequestOption) (res *VideoDeleteResponse, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if videoID == "" {
err = errors.New("missing required video_id parameter")
return nil, err
}
- path := fmt.Sprintf("videos/%s", videoID)
+ path := requestconfig.FormatPath("videos/%s", videoID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
return res, err
}
// Create a character from an uploaded video.
func (r *VideoService) NewCharacter(ctx context.Context, body VideoNewCharacterParams, opts ...option.RequestOption) (res *VideoNewCharacterResponse, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "videos/characters"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -122,13 +126,14 @@ func (r *VideoService) NewCharacter(ctx context.Context, body VideoNewCharacterP
//
// Streams the rendered video content for the specified video job.
func (r *VideoService) DownloadContent(ctx context.Context, videoID string, query VideoDownloadContentParams, opts ...option.RequestOption) (res *http.Response, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "application/binary")}, opts...)
if videoID == "" {
err = errors.New("missing required video_id parameter")
return nil, err
}
- path := fmt.Sprintf("videos/%s/content", videoID)
+ path := requestconfig.FormatPath("videos/%s/content", videoID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
return res, err
}
@@ -136,7 +141,8 @@ func (r *VideoService) DownloadContent(ctx context.Context, videoID string, quer
// Create a new video generation job by editing a source video or existing
// generated video.
func (r *VideoService) Edit(ctx context.Context, body VideoEditParams, opts ...option.RequestOption) (res *Video, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "videos/edits"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -144,7 +150,8 @@ func (r *VideoService) Edit(ctx context.Context, body VideoEditParams, opts ...o
// Create an extension of a completed video.
func (r *VideoService) Extend(ctx context.Context, body VideoExtendParams, opts ...option.RequestOption) (res *Video, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
path := "videos/extensions"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
@@ -152,24 +159,26 @@ func (r *VideoService) Extend(ctx context.Context, body VideoExtendParams, opts
// Fetch a character.
func (r *VideoService) GetCharacter(ctx context.Context, characterID string, opts ...option.RequestOption) (res *VideoGetCharacterResponse, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if characterID == "" {
err = errors.New("missing required character_id parameter")
return nil, err
}
- path := fmt.Sprintf("videos/characters/%s", characterID)
+ path := requestconfig.FormatPath("videos/characters/%s", characterID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
// Create a remix of a completed video using a refreshed prompt.
func (r *VideoService) Remix(ctx context.Context, videoID string, body VideoRemixParams, opts ...option.RequestOption) (res *Video, err error) {
- opts = slices.Concat(r.Options, opts)
+ var preClientOpts = []option.RequestOption{requestconfig.WithBearerAuthSecurity()}
+ opts = slices.Concat(preClientOpts, r.Options, opts)
if videoID == "" {
err = errors.New("missing required video_id parameter")
return nil, err
}
- path := fmt.Sprintf("videos/%s/remix", videoID)
+ path := requestconfig.FormatPath("videos/%s/remix", videoID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
@@ -177,7 +186,7 @@ func (r *VideoService) Remix(ctx context.Context, videoID string, body VideoRemi
type ImageInputReferenceParam struct {
FileID param.Opt[string] `json:"file_id,omitzero"`
// A fully qualified URL or base64-encoded data URL.
- ImageURL param.Opt[string] `json:"image_url,omitzero"`
+ ImageURL param.Opt[string] `json:"image_url,omitzero" format:"uri"`
paramObj
}
@@ -194,13 +203,13 @@ type Video struct {
// Unique identifier for the video job.
ID string `json:"id" api:"required"`
// Unix timestamp (seconds) for when the job completed, if finished.
- CompletedAt int64 `json:"completed_at" api:"required"`
+ CompletedAt int64 `json:"completed_at" api:"required" format:"unixtime"`
// Unix timestamp (seconds) for when the job was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Error payload that explains why generation failed, if applicable.
Error VideoCreateError `json:"error" api:"required"`
// Unix timestamp (seconds) for when the downloadable assets expire, if set.
- ExpiresAt int64 `json:"expires_at" api:"required"`
+ ExpiresAt int64 `json:"expires_at" api:"required" format:"unixtime"`
// The video generation model that produced the job.
Model VideoModel `json:"model" api:"required"`
// The object type, which is always `video`.
@@ -334,7 +343,7 @@ type VideoNewCharacterResponse struct {
// Identifier for the character creation cameo.
ID string `json:"id" api:"required"`
// Unix timestamp (in seconds) when the character was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Display name for the character.
Name string `json:"name" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
@@ -357,7 +366,7 @@ type VideoGetCharacterResponse struct {
// Identifier for the character creation cameo.
ID string `json:"id" api:"required"`
// Unix timestamp (in seconds) when the character was created.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Display name for the character.
Name string `json:"name" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
@@ -572,7 +581,7 @@ func (u *VideoEditParamsVideoUnion) asAny() any {
return nil
}
-// Reference to the completed video.
+// Reference to the completed video to edit.
//
// The property ID is required.
type VideoEditParamsVideoVideoReferenceInputParam struct {
diff --git a/vendor/github.com/openai/openai-go/v3/webhooks/aliases.go b/vendor/github.com/openai/openai-go/v3/webhooks/aliases.go
index 037b8545c..5bf4ccba6 100644
--- a/vendor/github.com/openai/openai-go/v3/webhooks/aliases.go
+++ b/vendor/github.com/openai/openai-go/v3/webhooks/aliases.go
@@ -64,6 +64,15 @@ const AllModelsGPT5_1CodexMax = shared.AllModelsGPT5_1CodexMax
// This is an alias to an internal type.
type ChatModel = shared.ChatModel
+// Equals "gpt-5.6-sol"
+const ChatModelGPT5_6Sol = shared.ChatModelGPT5_6Sol
+
+// Equals "gpt-5.6-terra"
+const ChatModelGPT5_6Terra = shared.ChatModelGPT5_6Terra
+
+// Equals "gpt-5.6-luna"
+const ChatModelGPT5_6Luna = shared.ChatModelGPT5_6Luna
+
// Equals "gpt-5.4"
const ChatModelGPT5_4 = shared.ChatModelGPT5_4
@@ -465,6 +474,25 @@ const OAuthErrorCodeInvalidSubjectToken = shared.OAuthErrorCodeInvalidSubjectTok
// This is an alias to an internal type.
type Reasoning = shared.Reasoning
+// Controls which reasoning items are rendered back to the model on later turns. If
+// omitted or set to `auto`, the model determines the context mode. The `gpt-5.6`
+// model family defaults to `all_turns`; earlier models default to `current_turn`.
+//
+// When returned on a response, this is the effective reasoning context mode used
+// for the response.
+//
+// This is an alias to an internal type.
+type ReasoningContext = shared.ReasoningContext
+
+// Equals "auto"
+const ReasoningContextAuto = shared.ReasoningContextAuto
+
+// Equals "current_turn"
+const ReasoningContextCurrentTurn = shared.ReasoningContextCurrentTurn
+
+// Equals "all_turns"
+const ReasoningContextAllTurns = shared.ReasoningContextAllTurns
+
// **Deprecated:** use `summary` instead.
//
// A summary of the reasoning performed by the model. This can be useful for
@@ -483,6 +511,19 @@ const ReasoningGenerateSummaryConcise = shared.ReasoningGenerateSummaryConcise
// Equals "detailed"
const ReasoningGenerateSummaryDetailed = shared.ReasoningGenerateSummaryDetailed
+// Controls the reasoning execution mode for the request.
+//
+// When returned on a response, this is the effective execution mode.
+//
+// This is an alias to an internal type.
+type ReasoningMode = shared.ReasoningMode
+
+// Equals "standard"
+const ReasoningModeStandard = shared.ReasoningModeStandard
+
+// Equals "pro"
+const ReasoningModePro = shared.ReasoningModePro
+
// A summary of the reasoning performed by the model. This can be useful for
// debugging and understanding the model's reasoning process. One of `auto`,
// `concise`, or `detailed`.
@@ -510,19 +551,12 @@ const ReasoningSummaryDetailed = shared.ReasoningSummaryDetailed
// This is an alias to an internal type.
type ReasoningParam = shared.ReasoningParam
-// Constrains effort on reasoning for
-// [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
-// supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`.
-// Reducing reasoning effort can result in faster responses and fewer tokens used
-// on reasoning in a response.
-//
-// - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported
-// reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool
-// calls are supported for all reasoning values in gpt-5.1.
-// - All models before `gpt-5.1` default to `medium` reasoning effort, and do not
-// support `none`.
-// - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
-// - `xhigh` is supported for all models after `gpt-5.1-codex-max`.
+// Constrains effort on reasoning for reasoning models. Currently supported values
+// are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. Reducing
+// reasoning effort can result in faster responses and fewer tokens used on
+// reasoning in a response. Not all reasoning models support every value. See the
+// [reasoning guide](https://platform.openai.com/docs/guides/reasoning) for
+// model-specific support.
//
// This is an alias to an internal type.
type ReasoningEffort = shared.ReasoningEffort
@@ -545,6 +579,9 @@ const ReasoningEffortHigh = shared.ReasoningEffortHigh
// Equals "xhigh"
const ReasoningEffortXhigh = shared.ReasoningEffortXhigh
+// Equals "max"
+const ReasoningEffortMax = shared.ReasoningEffortMax
+
// JSON object response format. An older method of generating JSON responses. Using
// `json_schema` is recommended for models that support it. Note that the model
// will not generate JSON without a system or user message instructing it to do so.
diff --git a/vendor/github.com/openai/openai-go/v3/webhooks/webhook.go b/vendor/github.com/openai/openai-go/v3/webhooks/webhook.go
index 7bde9cbcb..0a0c48764 100644
--- a/vendor/github.com/openai/openai-go/v3/webhooks/webhook.go
+++ b/vendor/github.com/openai/openai-go/v3/webhooks/webhook.go
@@ -202,7 +202,7 @@ type BatchCancelledWebhookEvent struct {
// The unique ID of the event.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) of when the batch API request was cancelled.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Event data payload.
Data BatchCancelledWebhookEventData `json:"data" api:"required"`
// The type of the event. Always `batch.cancelled`.
@@ -259,7 +259,7 @@ type BatchCompletedWebhookEvent struct {
// The unique ID of the event.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) of when the batch API request was completed.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Event data payload.
Data BatchCompletedWebhookEventData `json:"data" api:"required"`
// The type of the event. Always `batch.completed`.
@@ -316,7 +316,7 @@ type BatchExpiredWebhookEvent struct {
// The unique ID of the event.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) of when the batch API request expired.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Event data payload.
Data BatchExpiredWebhookEventData `json:"data" api:"required"`
// The type of the event. Always `batch.expired`.
@@ -373,7 +373,7 @@ type BatchFailedWebhookEvent struct {
// The unique ID of the event.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) of when the batch API request failed.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Event data payload.
Data BatchFailedWebhookEventData `json:"data" api:"required"`
// The type of the event. Always `batch.failed`.
@@ -430,7 +430,7 @@ type EvalRunCanceledWebhookEvent struct {
// The unique ID of the event.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) of when the eval run was canceled.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Event data payload.
Data EvalRunCanceledWebhookEventData `json:"data" api:"required"`
// The type of the event. Always `eval.run.canceled`.
@@ -487,7 +487,7 @@ type EvalRunFailedWebhookEvent struct {
// The unique ID of the event.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) of when the eval run failed.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Event data payload.
Data EvalRunFailedWebhookEventData `json:"data" api:"required"`
// The type of the event. Always `eval.run.failed`.
@@ -544,7 +544,7 @@ type EvalRunSucceededWebhookEvent struct {
// The unique ID of the event.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) of when the eval run succeeded.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Event data payload.
Data EvalRunSucceededWebhookEventData `json:"data" api:"required"`
// The type of the event. Always `eval.run.succeeded`.
@@ -601,7 +601,7 @@ type FineTuningJobCancelledWebhookEvent struct {
// The unique ID of the event.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) of when the fine-tuning job was cancelled.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Event data payload.
Data FineTuningJobCancelledWebhookEventData `json:"data" api:"required"`
// The type of the event. Always `fine_tuning.job.cancelled`.
@@ -658,7 +658,7 @@ type FineTuningJobFailedWebhookEvent struct {
// The unique ID of the event.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) of when the fine-tuning job failed.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Event data payload.
Data FineTuningJobFailedWebhookEventData `json:"data" api:"required"`
// The type of the event. Always `fine_tuning.job.failed`.
@@ -715,7 +715,7 @@ type FineTuningJobSucceededWebhookEvent struct {
// The unique ID of the event.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) of when the fine-tuning job succeeded.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Event data payload.
Data FineTuningJobSucceededWebhookEventData `json:"data" api:"required"`
// The type of the event. Always `fine_tuning.job.succeeded`.
@@ -772,7 +772,7 @@ type RealtimeCallIncomingWebhookEvent struct {
// The unique ID of the event.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) of when the model response was completed.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Event data payload.
Data RealtimeCallIncomingWebhookEventData `json:"data" api:"required"`
// The type of the event. Always `realtime.call.incoming`.
@@ -853,7 +853,7 @@ type ResponseCancelledWebhookEvent struct {
// The unique ID of the event.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) of when the model response was cancelled.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Event data payload.
Data ResponseCancelledWebhookEventData `json:"data" api:"required"`
// The type of the event. Always `response.cancelled`.
@@ -910,7 +910,7 @@ type ResponseCompletedWebhookEvent struct {
// The unique ID of the event.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) of when the model response was completed.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Event data payload.
Data ResponseCompletedWebhookEventData `json:"data" api:"required"`
// The type of the event. Always `response.completed`.
@@ -967,7 +967,7 @@ type ResponseFailedWebhookEvent struct {
// The unique ID of the event.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) of when the model response failed.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Event data payload.
Data ResponseFailedWebhookEventData `json:"data" api:"required"`
// The type of the event. Always `response.failed`.
@@ -1024,7 +1024,7 @@ type ResponseIncompleteWebhookEvent struct {
// The unique ID of the event.
ID string `json:"id" api:"required"`
// The Unix timestamp (in seconds) of when the model response was interrupted.
- CreatedAt int64 `json:"created_at" api:"required"`
+ CreatedAt int64 `json:"created_at" api:"required" format:"unixtime"`
// Event data payload.
Data ResponseIncompleteWebhookEventData `json:"data" api:"required"`
// The type of the event. Always `response.incomplete`.
diff --git a/vendor/github.com/tidwall/gjson/README.md b/vendor/github.com/tidwall/gjson/README.md
index 387766d50..f87b87377 100644
--- a/vendor/github.com/tidwall/gjson/README.md
+++ b/vendor/github.com/tidwall/gjson/README.md
@@ -56,7 +56,7 @@ This will print:
```
Prichard
```
-*There's also the [GetMany](#get-multiple-values-at-once) function to get multiple values at once, and [GetBytes](#working-with-bytes) for working with JSON byte slices.*
+*There's also [GetBytes](#working-with-bytes) for working with JSON byte slices.*
## Path Syntax
diff --git a/vendor/github.com/tidwall/gjson/gjson.go b/vendor/github.com/tidwall/gjson/gjson.go
index 5aa2a4ffa..97d6516ae 100644
--- a/vendor/github.com/tidwall/gjson/gjson.go
+++ b/vendor/github.com/tidwall/gjson/gjson.go
@@ -1,7 +1,14 @@
+// Copyright 2024 Joshua J Baker. All rights reserved.
+// Use of this source code is governed by an MIT-style
+// license that can be found in the LICENSE file.
+//
+// https://github.com/tidwall/gjson
+
// Package gjson provides searching for json strings.
package gjson
import (
+ "iter"
"strconv"
"strings"
"time"
@@ -3601,3 +3608,43 @@ func modDig(json, arg string) string {
out = append(out, ']')
return string(out)
}
+
+// All iterates over a json result.
+// This works identically to ForEach, but allows modern Go loops:
+//
+// for key, value := range res.All() {
+// fmt.Printf("%s %s\n", key, value)
+// }
+func (t Result) All() iter.Seq2[Result, Result] {
+ return func(yield func(Result, Result) bool) {
+ t.ForEach(yield)
+ }
+}
+
+// Keys iterates over a json result.
+// This works identically to ForEach, but allows modern Go loops:
+//
+// for key := range res.Keys() {
+// fmt.Printf("%s\n", key)
+// }
+func (t Result) Keys() iter.Seq[Result] {
+ return func(yield func(Result) bool) {
+ t.ForEach(func(key, _ Result) bool {
+ return yield(key)
+ })
+ }
+}
+
+// Values iterates over a json result.
+// This works identically to ForEach, but allows modern Go loops:
+//
+// for value := range res.Values() {
+// fmt.Printf("%s\n", value)
+// }
+func (t Result) Values() iter.Seq[Result] {
+ return func(yield func(Result) bool) {
+ t.ForEach(func(_, value Result) bool {
+ return yield(value)
+ })
+ }
+}
diff --git a/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.go b/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.go
index b850e772e..bfe546b60 100644
--- a/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.go
+++ b/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.go
@@ -20,7 +20,7 @@ func chacha20Poly1305Open(dst []byte, key []uint32, src, ad []byte) bool
func chacha20Poly1305Seal(dst []byte, key []uint32, src, ad []byte)
var (
- useAVX2 = cpu.X86.HasAVX2 && cpu.X86.HasBMI2
+ useAVX2 = cpu.X86.HasSSSE3 && cpu.X86.HasAVX2 && cpu.X86.HasBMI2
)
// setupState writes a ChaCha20 input matrix to state. See
@@ -47,7 +47,7 @@ func setupState(state *[16]uint32, key *[32]byte, nonce []byte) {
}
func (c *chacha20poly1305) seal(dst, nonce, plaintext, additionalData []byte) []byte {
- if !cpu.X86.HasSSSE3 {
+ if !useAVX2 {
return c.sealGeneric(dst, nonce, plaintext, additionalData)
}
@@ -66,7 +66,7 @@ func (c *chacha20poly1305) seal(dst, nonce, plaintext, additionalData []byte) []
}
func (c *chacha20poly1305) open(dst, nonce, ciphertext, additionalData []byte) ([]byte, error) {
- if !cpu.X86.HasSSSE3 {
+ if !useAVX2 {
return c.openGeneric(dst, nonce, ciphertext, additionalData)
}
diff --git a/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s b/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s
index fd5ee845f..c703c1347 100644
--- a/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s
+++ b/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s
@@ -6,27 +6,6 @@
// func polyHashADInternal<>()
TEXT polyHashADInternal<>(SB), NOSPLIT, $0
- // Hack: Must declare #define macros inside of a function due to Avo constraints
- // ROL rotates the uint32s in register R left by N bits, using temporary T.
- #define ROL(N, R, T) \
- MOVO R, T; \
- PSLLL $(N), T; \
- PSRLL $(32-(N)), R; \
- PXOR T, R
-
- // ROL8 rotates the uint32s in register R left by 8, using temporary T if needed.
- #ifdef GOAMD64_v2
- #define ROL8(R, T) PSHUFB ·rol8<>(SB), R
- #else
- #define ROL8(R, T) ROL(8, R, T)
- #endif
-
- // ROL16 rotates the uint32s in register R left by 16, using temporary T if needed.
- #ifdef GOAMD64_v2
- #define ROL16(R, T) PSHUFB ·rol16<>(SB), R
- #else
- #define ROL16(R, T) ROL(16, R, T)
- #endif
XORQ R10, R10
XORQ R11, R11
XORQ R12, R12
@@ -192,676 +171,112 @@ hashADDone:
// Requires: AVX, AVX2, BMI2, CMOV, SSE2
TEXT ·chacha20Poly1305Open(SB), $288-97
// For aligned stack access
- MOVQ SP, BP
- ADDQ $0x20, BP
- ANDQ $-32, BP
- MOVQ dst_base+0(FP), DI
- MOVQ key_base+24(FP), R8
- MOVQ src_base+48(FP), SI
- MOVQ src_len+56(FP), BX
- MOVQ ad_base+72(FP), CX
-
- // Check for AVX2 support
- CMPB ·useAVX2+0(SB), $0x01
- JE chacha20Poly1305Open_AVX2
+ MOVQ SP, BP
+ ADDQ $0x20, BP
+ ANDQ $-32, BP
+ MOVQ dst_base+0(FP), DI
+ MOVQ key_base+24(FP), R8
+ MOVQ src_base+48(FP), SI
+ MOVQ src_len+56(FP), BX
+ MOVQ ad_base+72(FP), CX
+ VZEROUPPER
+ VMOVDQU ·chacha20Constants<>+0(SB), Y0
+ VBROADCASTI128 16(R8), Y14
+ VBROADCASTI128 32(R8), Y12
+ VBROADCASTI128 48(R8), Y4
+ VPADDD ·avx2InitMask<>+0(SB), Y4, Y4
// Special optimization, for very short buffers
- CMPQ BX, $0x80
- JBE openSSE128
-
- // For long buffers, prepare the poly key first
- MOVOU ·chacha20Constants<>+0(SB), X0
- MOVOU 16(R8), X3
- MOVOU 32(R8), X6
- MOVOU 48(R8), X9
- MOVO X9, X13
-
- // Store state on stack for future use
- MOVO X3, 32(BP)
- MOVO X6, 48(BP)
- MOVO X9, 128(BP)
- MOVQ $0x0000000a, R9
-
-openSSEPreparePolyKey:
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X3
- PXOR X12, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X3
- PXOR X12, X3
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x0c
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X3
- PXOR X12, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X3
- PXOR X12, X3
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x04
- DECQ R9
- JNE openSSEPreparePolyKey
+ CMPQ BX, $0xc0
+ JBE openAVX2192
+ CMPQ BX, $0x00000140
+ JBE openAVX2320
+
+ // For the general key prepare the key first - as a byproduct we have 64 bytes of cipher stream
+ VMOVDQA Y14, 32(BP)
+ VMOVDQA Y12, 64(BP)
+ VMOVDQA Y4, 192(BP)
+ MOVQ $0x0000000a, R9
+
+openAVX2PreparePolyKey:
+ VPADDD Y14, Y0, Y0
+ VPXOR Y0, Y4, Y4
+ VPSHUFB ·rol16<>+0(SB), Y4, Y4
+ VPADDD Y4, Y12, Y12
+ VPXOR Y12, Y14, Y14
+ VPSLLD $0x0c, Y14, Y3
+ VPSRLD $0x14, Y14, Y14
+ VPXOR Y3, Y14, Y14
+ VPADDD Y14, Y0, Y0
+ VPXOR Y0, Y4, Y4
+ VPSHUFB ·rol8<>+0(SB), Y4, Y4
+ VPADDD Y4, Y12, Y12
+ VPXOR Y12, Y14, Y14
+ VPSLLD $0x07, Y14, Y3
+ VPSRLD $0x19, Y14, Y14
+ VPXOR Y3, Y14, Y14
+ VPALIGNR $0x04, Y14, Y14, Y14
+ VPALIGNR $0x08, Y12, Y12, Y12
+ VPALIGNR $0x0c, Y4, Y4, Y4
+ VPADDD Y14, Y0, Y0
+ VPXOR Y0, Y4, Y4
+ VPSHUFB ·rol16<>+0(SB), Y4, Y4
+ VPADDD Y4, Y12, Y12
+ VPXOR Y12, Y14, Y14
+ VPSLLD $0x0c, Y14, Y3
+ VPSRLD $0x14, Y14, Y14
+ VPXOR Y3, Y14, Y14
+ VPADDD Y14, Y0, Y0
+ VPXOR Y0, Y4, Y4
+ VPSHUFB ·rol8<>+0(SB), Y4, Y4
+ VPADDD Y4, Y12, Y12
+ VPXOR Y12, Y14, Y14
+ VPSLLD $0x07, Y14, Y3
+ VPSRLD $0x19, Y14, Y14
+ VPXOR Y3, Y14, Y14
+ VPALIGNR $0x0c, Y14, Y14, Y14
+ VPALIGNR $0x08, Y12, Y12, Y12
+ VPALIGNR $0x04, Y4, Y4, Y4
+ DECQ R9
+ JNE openAVX2PreparePolyKey
+ VPADDD ·chacha20Constants<>+0(SB), Y0, Y0
+ VPADDD 32(BP), Y14, Y14
+ VPADDD 64(BP), Y12, Y12
+ VPADDD 192(BP), Y4, Y4
+ VPERM2I128 $0x02, Y0, Y14, Y3
- // A0|B0 hold the Poly1305 32-byte key, C0,D0 can be discarded
- PADDL ·chacha20Constants<>+0(SB), X0
- PADDL 32(BP), X3
+ // Clamp and store poly key
+ VPAND ·polyClampMask<>+0(SB), Y3, Y3
+ VMOVDQA Y3, (BP)
- // Clamp and store the key
- PAND ·polyClampMask<>+0(SB), X0
- MOVO X0, (BP)
- MOVO X3, 16(BP)
+ // Stream for the first 64 bytes
+ VPERM2I128 $0x13, Y0, Y14, Y0
+ VPERM2I128 $0x13, Y12, Y4, Y14
- // Hash AAD
+ // Hash AD + first 64 bytes
MOVQ ad_len+80(FP), R9
CALL polyHashADInternal<>(SB)
+ XORQ CX, CX
-openSSEMainLoop:
- CMPQ BX, $0x00000100
- JB openSSEMainLoopDone
-
- // Load state, increment counter blocks
- MOVO ·chacha20Constants<>+0(SB), X0
- MOVO 32(BP), X3
- MOVO 48(BP), X6
- MOVO 128(BP), X9
- PADDL ·sseIncMask<>+0(SB), X9
- MOVO X0, X1
- MOVO X3, X4
- MOVO X6, X7
- MOVO X9, X10
- PADDL ·sseIncMask<>+0(SB), X10
- MOVO X1, X2
- MOVO X4, X5
- MOVO X7, X8
- MOVO X10, X11
- PADDL ·sseIncMask<>+0(SB), X11
- MOVO X2, X12
- MOVO X5, X13
- MOVO X8, X14
- MOVO X11, X15
- PADDL ·sseIncMask<>+0(SB), X15
-
- // Store counters
- MOVO X9, 80(BP)
- MOVO X10, 96(BP)
- MOVO X11, 112(BP)
- MOVO X15, 128(BP)
-
- // There are 10 ChaCha20 iterations of 2QR each, so for 6 iterations we hash
- // 2 blocks, and for the remaining 4 only 1 block - for a total of 16
- MOVQ $0x00000004, CX
- MOVQ SI, R9
-
-openSSEInternalLoop:
- MOVO X14, 64(BP)
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X14)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X3
- PXOR X14, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X14)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X3
- PXOR X14, X3
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X14)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X4
- PXOR X14, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X14)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X4
- PXOR X14, X4
- PADDD X5, X2
- PXOR X2, X11
- ROL16(X11, X14)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X5
- PXOR X14, X5
- PADDD X5, X2
- PXOR X2, X11
- ROL8(X11, X14)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X5
- PXOR X14, X5
- MOVO 64(BP), X14
- MOVO X7, 64(BP)
- PADDD X13, X12
- PXOR X12, X15
- ROL16(X15, X7)
- PADDD X15, X14
- PXOR X14, X13
- MOVO X13, X7
- PSLLL $0x0c, X7
- PSRLL $0x14, X13
- PXOR X7, X13
- PADDD X13, X12
- PXOR X12, X15
- ROL8(X15, X7)
- PADDD X15, X14
- PXOR X14, X13
- MOVO X13, X7
- PSLLL $0x07, X7
- PSRLL $0x19, X13
- PXOR X7, X13
- MOVO 64(BP), X7
- ADDQ (R9), R10
- ADCQ 8(R9), R11
- ADCQ $0x01, R12
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc0
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x0c
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
- IMULQ R12, R15
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
- ADDQ AX, R15
- ADCQ $0x00, DX
- LEAQ 16(R9), R9
- MOVO X14, 64(BP)
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X14)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X3
- PXOR X14, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X14)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X3
- PXOR X14, X3
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X14)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X4
- PXOR X14, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X14)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X4
- PXOR X14, X4
- PADDD X5, X2
- PXOR X2, X11
- ROL16(X11, X14)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X5
- PXOR X14, X5
- PADDD X5, X2
- PXOR X2, X11
- ROL8(X11, X14)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X5
- PXOR X14, X5
- MOVO 64(BP), X14
- MOVO X7, 64(BP)
- IMULQ R12, R8
- ADDQ R10, R15
- ADCQ DX, R8
- PADDD X13, X12
- PXOR X12, X15
- ROL16(X15, X7)
- PADDD X15, X14
- PXOR X14, X13
- MOVO X13, X7
- PSLLL $0x0c, X7
- PSRLL $0x14, X13
- PXOR X7, X13
- PADDD X13, X12
- PXOR X12, X15
- ROL8(X15, X7)
- PADDD X15, X14
- PXOR X14, X13
- MOVO X13, X7
- PSLLL $0x07, X7
- PSRLL $0x19, X13
- PXOR X7, X13
- MOVO 64(BP), X7
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc0
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x04
- DECQ CX
- JGE openSSEInternalLoop
- ADDQ (R9), R10
- ADCQ 8(R9), R11
- ADCQ $0x01, R12
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
- IMULQ R12, R15
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
- ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- LEAQ 16(R9), R9
- CMPQ CX, $-6
- JG openSSEInternalLoop
-
- // Add in the state
- PADDD ·chacha20Constants<>+0(SB), X0
- PADDD ·chacha20Constants<>+0(SB), X1
- PADDD ·chacha20Constants<>+0(SB), X2
- PADDD ·chacha20Constants<>+0(SB), X12
- PADDD 32(BP), X3
- PADDD 32(BP), X4
- PADDD 32(BP), X5
- PADDD 32(BP), X13
- PADDD 48(BP), X6
- PADDD 48(BP), X7
- PADDD 48(BP), X8
- PADDD 48(BP), X14
- PADDD 80(BP), X9
- PADDD 96(BP), X10
- PADDD 112(BP), X11
- PADDD 128(BP), X15
-
- // Load - xor - store
- MOVO X15, 64(BP)
- MOVOU (SI), X15
- PXOR X15, X0
- MOVOU X0, (DI)
- MOVOU 16(SI), X15
- PXOR X15, X3
- MOVOU X3, 16(DI)
- MOVOU 32(SI), X15
- PXOR X15, X6
- MOVOU X6, 32(DI)
- MOVOU 48(SI), X15
- PXOR X15, X9
- MOVOU X9, 48(DI)
- MOVOU 64(SI), X9
- PXOR X9, X1
- MOVOU X1, 64(DI)
- MOVOU 80(SI), X9
- PXOR X9, X4
- MOVOU X4, 80(DI)
- MOVOU 96(SI), X9
- PXOR X9, X7
- MOVOU X7, 96(DI)
- MOVOU 112(SI), X9
- PXOR X9, X10
- MOVOU X10, 112(DI)
- MOVOU 128(SI), X9
- PXOR X9, X2
- MOVOU X2, 128(DI)
- MOVOU 144(SI), X9
- PXOR X9, X5
- MOVOU X5, 144(DI)
- MOVOU 160(SI), X9
- PXOR X9, X8
- MOVOU X8, 160(DI)
- MOVOU 176(SI), X9
- PXOR X9, X11
- MOVOU X11, 176(DI)
- MOVOU 192(SI), X9
- PXOR X9, X12
- MOVOU X12, 192(DI)
- MOVOU 208(SI), X9
- PXOR X9, X13
- MOVOU X13, 208(DI)
- MOVOU 224(SI), X9
- PXOR X9, X14
- MOVOU X14, 224(DI)
- MOVOU 240(SI), X9
- PXOR 64(BP), X9
- MOVOU X9, 240(DI)
- LEAQ 256(SI), SI
- LEAQ 256(DI), DI
- SUBQ $0x00000100, BX
- JMP openSSEMainLoop
-
-openSSEMainLoopDone:
- // Handle the various tail sizes efficiently
- TESTQ BX, BX
- JE openSSEFinalize
- CMPQ BX, $0x40
- JBE openSSETail64
- CMPQ BX, $0x80
- JBE openSSETail128
- CMPQ BX, $0xc0
- JBE openSSETail192
- JMP openSSETail256
-
-openSSEFinalize:
- // Hash in the PT, AAD lengths
- ADDQ ad_len+80(FP), R10
- ADCQ src_len+56(FP), R11
+openAVX2InitialHash64:
+ ADDQ (SI)(CX*1), R10
+ ADCQ 8(SI)(CX*1), R11
ADCQ $0x01, R12
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
+ MOVQ (BP), DX
+ MOVQ DX, R15
+ MULXQ R10, R13, R14
IMULQ R12, R15
+ MULXQ R11, AX, DX
ADDQ AX, R14
ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
+ MOVQ 8(BP), DX
+ MULXQ R10, R10, AX
+ ADDQ R10, R14
+ MULXQ R11, R11, R8
+ ADCQ R11, R15
+ ADCQ $0x00, R8
+ IMULQ R12, DX
ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
ADCQ DX, R8
MOVQ R13, R10
MOVQ R14, R11
@@ -878,3187 +293,494 @@ openSSEFinalize:
ADDQ R15, R10
ADCQ R8, R11
ADCQ $0x00, R12
+ ADDQ $0x10, CX
+ CMPQ CX, $0x40
+ JNE openAVX2InitialHash64
- // Final reduce
- MOVQ R10, R13
- MOVQ R11, R14
- MOVQ R12, R15
- SUBQ $-5, R10
- SBBQ $-1, R11
- SBBQ $0x03, R12
- CMOVQCS R13, R10
- CMOVQCS R14, R11
- CMOVQCS R15, R12
-
- // Add in the "s" part of the key
- ADDQ 16(BP), R10
- ADCQ 24(BP), R11
-
- // Finally, constant time compare to the tag at the end of the message
- XORQ AX, AX
- MOVQ $0x00000001, DX
- XORQ (SI), R10
- XORQ 8(SI), R11
- ORQ R11, R10
- CMOVQEQ DX, AX
+ // Decrypt the first 64 bytes
+ VPXOR (SI), Y0, Y0
+ VPXOR 32(SI), Y14, Y14
+ VMOVDQU Y0, (DI)
+ VMOVDQU Y14, 32(DI)
+ LEAQ 64(SI), SI
+ LEAQ 64(DI), DI
+ SUBQ $0x40, BX
- // Return true iff tags are equal
- MOVB AX, ret+96(FP)
- RET
+openAVX2MainLoop:
+ CMPQ BX, $0x00000200
+ JB openAVX2MainLoopDone
-openSSE128:
- MOVOU ·chacha20Constants<>+0(SB), X0
- MOVOU 16(R8), X3
- MOVOU 32(R8), X6
- MOVOU 48(R8), X9
- MOVO X0, X1
- MOVO X3, X4
- MOVO X6, X7
- MOVO X9, X10
- PADDL ·sseIncMask<>+0(SB), X10
- MOVO X1, X2
- MOVO X4, X5
- MOVO X7, X8
- MOVO X10, X11
- PADDL ·sseIncMask<>+0(SB), X11
- MOVO X3, X13
- MOVO X6, X14
- MOVO X10, X15
- MOVQ $0x0000000a, R9
-
-openSSE128InnerCipherLoop:
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X3
- PXOR X12, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X3
- PXOR X12, X3
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X4
- PXOR X12, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X4
- PXOR X12, X4
- PADDD X5, X2
- PXOR X2, X11
- ROL16(X11, X12)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X5
- PXOR X12, X5
- PADDD X5, X2
- PXOR X2, X11
- ROL8(X11, X12)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X5
- PXOR X12, X5
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc0
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x0c
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X3
- PXOR X12, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X3
- PXOR X12, X3
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X4
- PXOR X12, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X4
- PXOR X12, X4
- PADDD X5, X2
- PXOR X2, X11
- ROL16(X11, X12)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X5
- PXOR X12, X5
- PADDD X5, X2
- PXOR X2, X11
- ROL8(X11, X12)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X5
- PXOR X12, X5
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc0
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x04
- DECQ R9
- JNE openSSE128InnerCipherLoop
-
- // A0|B0 hold the Poly1305 32-byte key, C0,D0 can be discarded
- PADDL ·chacha20Constants<>+0(SB), X0
- PADDL ·chacha20Constants<>+0(SB), X1
- PADDL ·chacha20Constants<>+0(SB), X2
- PADDL X13, X3
- PADDL X13, X4
- PADDL X13, X5
- PADDL X14, X7
- PADDL X14, X8
- PADDL X15, X10
- PADDL ·sseIncMask<>+0(SB), X15
- PADDL X15, X11
-
- // Clamp and store the key
- PAND ·polyClampMask<>+0(SB), X0
- MOVOU X0, (BP)
- MOVOU X3, 16(BP)
+ // Load state, increment counter blocks, store the incremented counters
+ VMOVDQU ·chacha20Constants<>+0(SB), Y0
+ VMOVDQA Y0, Y5
+ VMOVDQA Y0, Y6
+ VMOVDQA Y0, Y7
+ VMOVDQA 32(BP), Y14
+ VMOVDQA Y14, Y9
+ VMOVDQA Y14, Y10
+ VMOVDQA Y14, Y11
+ VMOVDQA 64(BP), Y12
+ VMOVDQA Y12, Y13
+ VMOVDQA Y12, Y8
+ VMOVDQA Y12, Y15
+ VMOVDQA 192(BP), Y4
+ VPADDD ·avx2IncMask<>+0(SB), Y4, Y4
+ VPADDD ·avx2IncMask<>+0(SB), Y4, Y1
+ VPADDD ·avx2IncMask<>+0(SB), Y1, Y2
+ VPADDD ·avx2IncMask<>+0(SB), Y2, Y3
+ VMOVDQA Y4, 96(BP)
+ VMOVDQA Y1, 128(BP)
+ VMOVDQA Y2, 160(BP)
+ VMOVDQA Y3, 192(BP)
+ XORQ CX, CX
- // Hash
- MOVQ ad_len+80(FP), R9
- CALL polyHashADInternal<>(SB)
-
-openSSE128Open:
- CMPQ BX, $0x10
- JB openSSETail16
- SUBQ $0x10, BX
-
- // Load for hashing
- ADDQ (SI), R10
- ADCQ 8(SI), R11
- ADCQ $0x01, R12
-
- // Load for decryption
- MOVOU (SI), X12
- PXOR X12, X1
- MOVOU X1, (DI)
- LEAQ 16(SI), SI
- LEAQ 16(DI), DI
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
- IMULQ R12, R15
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
- ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
-
- // Shift the stream "left"
- MOVO X4, X1
- MOVO X7, X4
- MOVO X10, X7
- MOVO X2, X10
- MOVO X5, X2
- MOVO X8, X5
- MOVO X11, X8
- JMP openSSE128Open
-
-openSSETail16:
- TESTQ BX, BX
- JE openSSEFinalize
-
- // We can safely load the CT from the end, because it is padded with the MAC
- MOVQ BX, R9
- SHLQ $0x04, R9
- LEAQ ·andMask<>+0(SB), R13
- MOVOU (SI), X12
- ADDQ BX, SI
- PAND -16(R13)(R9*1), X12
- MOVO X12, 64(BP)
- MOVQ X12, R13
- MOVQ 72(BP), R14
- PXOR X1, X12
-
- // We can only store one byte at a time, since plaintext can be shorter than 16 bytes
-openSSETail16Store:
- MOVQ X12, R8
- MOVB R8, (DI)
- PSRLDQ $0x01, X12
- INCQ DI
- DECQ BX
- JNE openSSETail16Store
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x01, R12
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
- IMULQ R12, R15
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
- ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- JMP openSSEFinalize
-
-openSSETail64:
- MOVO ·chacha20Constants<>+0(SB), X0
- MOVO 32(BP), X3
- MOVO 48(BP), X6
- MOVO 128(BP), X9
- PADDL ·sseIncMask<>+0(SB), X9
- MOVO X9, 80(BP)
- XORQ R9, R9
- MOVQ BX, CX
- CMPQ CX, $0x10
- JB openSSETail64LoopB
-
-openSSETail64LoopA:
- ADDQ (SI)(R9*1), R10
- ADCQ 8(SI)(R9*1), R11
- ADCQ $0x01, R12
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
- IMULQ R12, R15
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
- ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- SUBQ $0x10, CX
-
-openSSETail64LoopB:
- ADDQ $0x10, R9
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X3
- PXOR X12, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X3
- PXOR X12, X3
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x0c
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X3
- PXOR X12, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X3
- PXOR X12, X3
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x04
- CMPQ CX, $0x10
- JAE openSSETail64LoopA
- CMPQ R9, $0xa0
- JNE openSSETail64LoopB
- PADDL ·chacha20Constants<>+0(SB), X0
- PADDL 32(BP), X3
- PADDL 48(BP), X6
- PADDL 80(BP), X9
-
-openSSETail64DecLoop:
- CMPQ BX, $0x10
- JB openSSETail64DecLoopDone
- SUBQ $0x10, BX
- MOVOU (SI), X12
- PXOR X12, X0
- MOVOU X0, (DI)
- LEAQ 16(SI), SI
- LEAQ 16(DI), DI
- MOVO X3, X0
- MOVO X6, X3
- MOVO X9, X6
- JMP openSSETail64DecLoop
-
-openSSETail64DecLoopDone:
- MOVO X0, X1
- JMP openSSETail16
-
-openSSETail128:
- MOVO ·chacha20Constants<>+0(SB), X1
- MOVO 32(BP), X4
- MOVO 48(BP), X7
- MOVO 128(BP), X10
- PADDL ·sseIncMask<>+0(SB), X10
- MOVO X10, 80(BP)
- MOVO X1, X0
- MOVO X4, X3
- MOVO X7, X6
- MOVO X10, X9
- PADDL ·sseIncMask<>+0(SB), X9
- MOVO X9, 96(BP)
- XORQ R9, R9
- MOVQ BX, CX
- ANDQ $-16, CX
-
-openSSETail128LoopA:
- ADDQ (SI)(R9*1), R10
- ADCQ 8(SI)(R9*1), R11
- ADCQ $0x01, R12
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
- IMULQ R12, R15
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
- ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
-
-openSSETail128LoopB:
- ADDQ $0x10, R9
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X3
- PXOR X12, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X3
- PXOR X12, X3
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X4
- PXOR X12, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X4
- PXOR X12, X4
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x0c
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X3
- PXOR X12, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X3
- PXOR X12, X3
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X4
- PXOR X12, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X4
- PXOR X12, X4
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x04
- CMPQ R9, CX
- JB openSSETail128LoopA
- CMPQ R9, $0xa0
- JNE openSSETail128LoopB
- PADDL ·chacha20Constants<>+0(SB), X0
- PADDL ·chacha20Constants<>+0(SB), X1
- PADDL 32(BP), X3
- PADDL 32(BP), X4
- PADDL 48(BP), X6
- PADDL 48(BP), X7
- PADDL 96(BP), X9
- PADDL 80(BP), X10
- MOVOU (SI), X12
- MOVOU 16(SI), X13
- MOVOU 32(SI), X14
- MOVOU 48(SI), X15
- PXOR X12, X1
- PXOR X13, X4
- PXOR X14, X7
- PXOR X15, X10
- MOVOU X1, (DI)
- MOVOU X4, 16(DI)
- MOVOU X7, 32(DI)
- MOVOU X10, 48(DI)
- SUBQ $0x40, BX
- LEAQ 64(SI), SI
- LEAQ 64(DI), DI
- JMP openSSETail64DecLoop
-
-openSSETail192:
- MOVO ·chacha20Constants<>+0(SB), X2
- MOVO 32(BP), X5
- MOVO 48(BP), X8
- MOVO 128(BP), X11
- PADDL ·sseIncMask<>+0(SB), X11
- MOVO X11, 80(BP)
- MOVO X2, X1
- MOVO X5, X4
- MOVO X8, X7
- MOVO X11, X10
- PADDL ·sseIncMask<>+0(SB), X10
- MOVO X10, 96(BP)
- MOVO X1, X0
- MOVO X4, X3
- MOVO X7, X6
- MOVO X10, X9
- PADDL ·sseIncMask<>+0(SB), X9
- MOVO X9, 112(BP)
- MOVQ BX, CX
- MOVQ $0x000000a0, R9
- CMPQ CX, $0xa0
- CMOVQGT R9, CX
- ANDQ $-16, CX
- XORQ R9, R9
-
-openSSLTail192LoopA:
- ADDQ (SI)(R9*1), R10
- ADCQ 8(SI)(R9*1), R11
- ADCQ $0x01, R12
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
- IMULQ R12, R15
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
- ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
-
-openSSLTail192LoopB:
- ADDQ $0x10, R9
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X3
- PXOR X12, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X3
- PXOR X12, X3
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X4
- PXOR X12, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X4
- PXOR X12, X4
- PADDD X5, X2
- PXOR X2, X11
- ROL16(X11, X12)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X5
- PXOR X12, X5
- PADDD X5, X2
- PXOR X2, X11
- ROL8(X11, X12)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X5
- PXOR X12, X5
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc0
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x0c
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X3
- PXOR X12, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X3
- PXOR X12, X3
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X4
- PXOR X12, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X4
- PXOR X12, X4
- PADDD X5, X2
- PXOR X2, X11
- ROL16(X11, X12)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X5
- PXOR X12, X5
- PADDD X5, X2
- PXOR X2, X11
- ROL8(X11, X12)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X5
- PXOR X12, X5
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc0
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x04
- CMPQ R9, CX
- JB openSSLTail192LoopA
- CMPQ R9, $0xa0
- JNE openSSLTail192LoopB
- CMPQ BX, $0xb0
- JB openSSLTail192Store
- ADDQ 160(SI), R10
- ADCQ 168(SI), R11
- ADCQ $0x01, R12
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
- IMULQ R12, R15
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
- ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- CMPQ BX, $0xc0
- JB openSSLTail192Store
- ADDQ 176(SI), R10
- ADCQ 184(SI), R11
- ADCQ $0x01, R12
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
- IMULQ R12, R15
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
- ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
-
-openSSLTail192Store:
- PADDL ·chacha20Constants<>+0(SB), X0
- PADDL ·chacha20Constants<>+0(SB), X1
- PADDL ·chacha20Constants<>+0(SB), X2
- PADDL 32(BP), X3
- PADDL 32(BP), X4
- PADDL 32(BP), X5
- PADDL 48(BP), X6
- PADDL 48(BP), X7
- PADDL 48(BP), X8
- PADDL 112(BP), X9
- PADDL 96(BP), X10
- PADDL 80(BP), X11
- MOVOU (SI), X12
- MOVOU 16(SI), X13
- MOVOU 32(SI), X14
- MOVOU 48(SI), X15
- PXOR X12, X2
- PXOR X13, X5
- PXOR X14, X8
- PXOR X15, X11
- MOVOU X2, (DI)
- MOVOU X5, 16(DI)
- MOVOU X8, 32(DI)
- MOVOU X11, 48(DI)
- MOVOU 64(SI), X12
- MOVOU 80(SI), X13
- MOVOU 96(SI), X14
- MOVOU 112(SI), X15
- PXOR X12, X1
- PXOR X13, X4
- PXOR X14, X7
- PXOR X15, X10
- MOVOU X1, 64(DI)
- MOVOU X4, 80(DI)
- MOVOU X7, 96(DI)
- MOVOU X10, 112(DI)
- SUBQ $0x80, BX
- LEAQ 128(SI), SI
- LEAQ 128(DI), DI
- JMP openSSETail64DecLoop
-
-openSSETail256:
- MOVO ·chacha20Constants<>+0(SB), X0
- MOVO 32(BP), X3
- MOVO 48(BP), X6
- MOVO 128(BP), X9
- PADDL ·sseIncMask<>+0(SB), X9
- MOVO X0, X1
- MOVO X3, X4
- MOVO X6, X7
- MOVO X9, X10
- PADDL ·sseIncMask<>+0(SB), X10
- MOVO X1, X2
- MOVO X4, X5
- MOVO X7, X8
- MOVO X10, X11
- PADDL ·sseIncMask<>+0(SB), X11
- MOVO X2, X12
- MOVO X5, X13
- MOVO X8, X14
- MOVO X11, X15
- PADDL ·sseIncMask<>+0(SB), X15
-
- // Store counters
- MOVO X9, 80(BP)
- MOVO X10, 96(BP)
- MOVO X11, 112(BP)
- MOVO X15, 128(BP)
- XORQ R9, R9
-
-openSSETail256Loop:
- ADDQ (SI)(R9*1), R10
- ADCQ 8(SI)(R9*1), R11
- ADCQ $0x01, R12
- MOVO X14, 64(BP)
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X14)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X3
- PXOR X14, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X14)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X3
- PXOR X14, X3
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X14)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X4
- PXOR X14, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X14)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X4
- PXOR X14, X4
- PADDD X5, X2
- PXOR X2, X11
- ROL16(X11, X14)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X5
- PXOR X14, X5
- PADDD X5, X2
- PXOR X2, X11
- ROL8(X11, X14)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X5
- PXOR X14, X5
- MOVO 64(BP), X14
- MOVO X7, 64(BP)
- PADDD X13, X12
- PXOR X12, X15
- ROL16(X15, X7)
- PADDD X15, X14
- PXOR X14, X13
- MOVO X13, X7
- PSLLL $0x0c, X7
- PSRLL $0x14, X13
- PXOR X7, X13
- PADDD X13, X12
- PXOR X12, X15
- ROL8(X15, X7)
- PADDD X15, X14
- PXOR X14, X13
- MOVO X13, X7
- PSLLL $0x07, X7
- PSRLL $0x19, X13
- PXOR X7, X13
- MOVO 64(BP), X7
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc0
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x0c
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
- IMULQ R12, R15
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
- ADDQ AX, R15
- ADCQ $0x00, DX
- MOVO X14, 64(BP)
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X14)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X3
- PXOR X14, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X14)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X3
- PXOR X14, X3
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X14)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X4
- PXOR X14, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X14)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X4
- PXOR X14, X4
- PADDD X5, X2
- PXOR X2, X11
- ROL16(X11, X14)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X5
- PXOR X14, X5
- PADDD X5, X2
- PXOR X2, X11
- ROL8(X11, X14)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X5
- PXOR X14, X5
- MOVO 64(BP), X14
- MOVO X7, 64(BP)
- PADDD X13, X12
- PXOR X12, X15
- ROL16(X15, X7)
- PADDD X15, X14
- PXOR X14, X13
- MOVO X13, X7
- PSLLL $0x0c, X7
- PSRLL $0x14, X13
- PXOR X7, X13
- PADDD X13, X12
- PXOR X12, X15
- ROL8(X15, X7)
- PADDD X15, X14
- PXOR X14, X13
- MOVO X13, X7
- PSLLL $0x07, X7
- PSRLL $0x19, X13
- PXOR X7, X13
- MOVO 64(BP), X7
- IMULQ R12, R8
- ADDQ R10, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc0
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x04
- ADDQ $0x10, R9
- CMPQ R9, $0xa0
- JB openSSETail256Loop
- MOVQ BX, CX
- ANDQ $-16, CX
-
-openSSETail256HashLoop:
- ADDQ (SI)(R9*1), R10
- ADCQ 8(SI)(R9*1), R11
- ADCQ $0x01, R12
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
- IMULQ R12, R15
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
- ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- ADDQ $0x10, R9
- CMPQ R9, CX
- JB openSSETail256HashLoop
-
- // Add in the state
- PADDD ·chacha20Constants<>+0(SB), X0
- PADDD ·chacha20Constants<>+0(SB), X1
- PADDD ·chacha20Constants<>+0(SB), X2
- PADDD ·chacha20Constants<>+0(SB), X12
- PADDD 32(BP), X3
- PADDD 32(BP), X4
- PADDD 32(BP), X5
- PADDD 32(BP), X13
- PADDD 48(BP), X6
- PADDD 48(BP), X7
- PADDD 48(BP), X8
- PADDD 48(BP), X14
- PADDD 80(BP), X9
- PADDD 96(BP), X10
- PADDD 112(BP), X11
- PADDD 128(BP), X15
- MOVO X15, 64(BP)
-
- // Load - xor - store
- MOVOU (SI), X15
- PXOR X15, X0
- MOVOU 16(SI), X15
- PXOR X15, X3
- MOVOU 32(SI), X15
- PXOR X15, X6
- MOVOU 48(SI), X15
- PXOR X15, X9
- MOVOU X0, (DI)
- MOVOU X3, 16(DI)
- MOVOU X6, 32(DI)
- MOVOU X9, 48(DI)
- MOVOU 64(SI), X0
- MOVOU 80(SI), X3
- MOVOU 96(SI), X6
- MOVOU 112(SI), X9
- PXOR X0, X1
- PXOR X3, X4
- PXOR X6, X7
- PXOR X9, X10
- MOVOU X1, 64(DI)
- MOVOU X4, 80(DI)
- MOVOU X7, 96(DI)
- MOVOU X10, 112(DI)
- MOVOU 128(SI), X0
- MOVOU 144(SI), X3
- MOVOU 160(SI), X6
- MOVOU 176(SI), X9
- PXOR X0, X2
- PXOR X3, X5
- PXOR X6, X8
- PXOR X9, X11
- MOVOU X2, 128(DI)
- MOVOU X5, 144(DI)
- MOVOU X8, 160(DI)
- MOVOU X11, 176(DI)
- LEAQ 192(SI), SI
- LEAQ 192(DI), DI
- SUBQ $0xc0, BX
- MOVO X12, X0
- MOVO X13, X3
- MOVO X14, X6
- MOVO 64(BP), X9
- JMP openSSETail64DecLoop
-
-chacha20Poly1305Open_AVX2:
- VZEROUPPER
- VMOVDQU ·chacha20Constants<>+0(SB), Y0
- BYTE $0xc4
- BYTE $0x42
- BYTE $0x7d
- BYTE $0x5a
- BYTE $0x70
- BYTE $0x10
- BYTE $0xc4
- BYTE $0x42
- BYTE $0x7d
- BYTE $0x5a
- BYTE $0x60
- BYTE $0x20
- BYTE $0xc4
- BYTE $0xc2
- BYTE $0x7d
- BYTE $0x5a
- BYTE $0x60
- BYTE $0x30
- VPADDD ·avx2InitMask<>+0(SB), Y4, Y4
-
- // Special optimization, for very short buffers
- CMPQ BX, $0xc0
- JBE openAVX2192
- CMPQ BX, $0x00000140
- JBE openAVX2320
-
- // For the general key prepare the key first - as a byproduct we have 64 bytes of cipher stream
- VMOVDQA Y14, 32(BP)
- VMOVDQA Y12, 64(BP)
- VMOVDQA Y4, 192(BP)
- MOVQ $0x0000000a, R9
-
-openAVX2PreparePolyKey:
- VPADDD Y14, Y0, Y0
- VPXOR Y0, Y4, Y4
- VPSHUFB ·rol16<>+0(SB), Y4, Y4
- VPADDD Y4, Y12, Y12
- VPXOR Y12, Y14, Y14
- VPSLLD $0x0c, Y14, Y3
- VPSRLD $0x14, Y14, Y14
- VPXOR Y3, Y14, Y14
- VPADDD Y14, Y0, Y0
- VPXOR Y0, Y4, Y4
- VPSHUFB ·rol8<>+0(SB), Y4, Y4
- VPADDD Y4, Y12, Y12
- VPXOR Y12, Y14, Y14
- VPSLLD $0x07, Y14, Y3
- VPSRLD $0x19, Y14, Y14
- VPXOR Y3, Y14, Y14
- VPALIGNR $0x04, Y14, Y14, Y14
- VPALIGNR $0x08, Y12, Y12, Y12
- VPALIGNR $0x0c, Y4, Y4, Y4
- VPADDD Y14, Y0, Y0
- VPXOR Y0, Y4, Y4
- VPSHUFB ·rol16<>+0(SB), Y4, Y4
- VPADDD Y4, Y12, Y12
- VPXOR Y12, Y14, Y14
- VPSLLD $0x0c, Y14, Y3
- VPSRLD $0x14, Y14, Y14
- VPXOR Y3, Y14, Y14
- VPADDD Y14, Y0, Y0
- VPXOR Y0, Y4, Y4
- VPSHUFB ·rol8<>+0(SB), Y4, Y4
- VPADDD Y4, Y12, Y12
- VPXOR Y12, Y14, Y14
- VPSLLD $0x07, Y14, Y3
- VPSRLD $0x19, Y14, Y14
- VPXOR Y3, Y14, Y14
- VPALIGNR $0x0c, Y14, Y14, Y14
- VPALIGNR $0x08, Y12, Y12, Y12
- VPALIGNR $0x04, Y4, Y4, Y4
- DECQ R9
- JNE openAVX2PreparePolyKey
- VPADDD ·chacha20Constants<>+0(SB), Y0, Y0
- VPADDD 32(BP), Y14, Y14
- VPADDD 64(BP), Y12, Y12
- VPADDD 192(BP), Y4, Y4
- VPERM2I128 $0x02, Y0, Y14, Y3
-
- // Clamp and store poly key
- VPAND ·polyClampMask<>+0(SB), Y3, Y3
- VMOVDQA Y3, (BP)
-
- // Stream for the first 64 bytes
- VPERM2I128 $0x13, Y0, Y14, Y0
- VPERM2I128 $0x13, Y12, Y4, Y14
-
- // Hash AD + first 64 bytes
- MOVQ ad_len+80(FP), R9
- CALL polyHashADInternal<>(SB)
- XORQ CX, CX
-
-openAVX2InitialHash64:
- ADDQ (SI)(CX*1), R10
- ADCQ 8(SI)(CX*1), R11
- ADCQ $0x01, R12
- MOVQ (BP), DX
- MOVQ DX, R15
- MULXQ R10, R13, R14
- IMULQ R12, R15
- MULXQ R11, AX, DX
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), DX
- MULXQ R10, R10, AX
- ADDQ R10, R14
- MULXQ R11, R11, R8
- ADCQ R11, R15
- ADCQ $0x00, R8
- IMULQ R12, DX
- ADDQ AX, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- ADDQ $0x10, CX
- CMPQ CX, $0x40
- JNE openAVX2InitialHash64
-
- // Decrypt the first 64 bytes
- VPXOR (SI), Y0, Y0
- VPXOR 32(SI), Y14, Y14
- VMOVDQU Y0, (DI)
- VMOVDQU Y14, 32(DI)
- LEAQ 64(SI), SI
- LEAQ 64(DI), DI
- SUBQ $0x40, BX
-
-openAVX2MainLoop:
- CMPQ BX, $0x00000200
- JB openAVX2MainLoopDone
-
- // Load state, increment counter blocks, store the incremented counters
- VMOVDQU ·chacha20Constants<>+0(SB), Y0
- VMOVDQA Y0, Y5
- VMOVDQA Y0, Y6
- VMOVDQA Y0, Y7
- VMOVDQA 32(BP), Y14
- VMOVDQA Y14, Y9
- VMOVDQA Y14, Y10
- VMOVDQA Y14, Y11
- VMOVDQA 64(BP), Y12
- VMOVDQA Y12, Y13
- VMOVDQA Y12, Y8
- VMOVDQA Y12, Y15
- VMOVDQA 192(BP), Y4
- VPADDD ·avx2IncMask<>+0(SB), Y4, Y4
- VPADDD ·avx2IncMask<>+0(SB), Y4, Y1
- VPADDD ·avx2IncMask<>+0(SB), Y1, Y2
- VPADDD ·avx2IncMask<>+0(SB), Y2, Y3
- VMOVDQA Y4, 96(BP)
- VMOVDQA Y1, 128(BP)
- VMOVDQA Y2, 160(BP)
- VMOVDQA Y3, 192(BP)
- XORQ CX, CX
-
-openAVX2InternalLoop:
- ADDQ (SI)(CX*1), R10
- ADCQ 8(SI)(CX*1), R11
- ADCQ $0x01, R12
- VPADDD Y14, Y0, Y0
- VPADDD Y9, Y5, Y5
- VPADDD Y10, Y6, Y6
- VPADDD Y11, Y7, Y7
- MOVQ (BP), DX
- MOVQ DX, R15
- MULXQ R10, R13, R14
- IMULQ R12, R15
- MULXQ R11, AX, DX
- ADDQ AX, R14
- ADCQ DX, R15
- VPXOR Y0, Y4, Y4
- VPXOR Y5, Y1, Y1
- VPXOR Y6, Y2, Y2
- VPXOR Y7, Y3, Y3
- VPSHUFB ·rol16<>+0(SB), Y4, Y4
- VPSHUFB ·rol16<>+0(SB), Y1, Y1
- VPSHUFB ·rol16<>+0(SB), Y2, Y2
- VPSHUFB ·rol16<>+0(SB), Y3, Y3
- MOVQ 8(BP), DX
- MULXQ R10, R10, AX
- ADDQ R10, R14
- MULXQ R11, R11, R8
- ADCQ R11, R15
- ADCQ $0x00, R8
- VPADDD Y4, Y12, Y12
- VPADDD Y1, Y13, Y13
- VPADDD Y2, Y8, Y8
- VPADDD Y3, Y15, Y15
- VPXOR Y12, Y14, Y14
- VPXOR Y13, Y9, Y9
- VPXOR Y8, Y10, Y10
- VPXOR Y15, Y11, Y11
- IMULQ R12, DX
- ADDQ AX, R15
- ADCQ DX, R8
- VMOVDQA Y15, 224(BP)
- VPSLLD $0x0c, Y14, Y15
- VPSRLD $0x14, Y14, Y14
- VPXOR Y15, Y14, Y14
- VPSLLD $0x0c, Y9, Y15
- VPSRLD $0x14, Y9, Y9
- VPXOR Y15, Y9, Y9
- VPSLLD $0x0c, Y10, Y15
- VPSRLD $0x14, Y10, Y10
- VPXOR Y15, Y10, Y10
- VPSLLD $0x0c, Y11, Y15
- VPSRLD $0x14, Y11, Y11
- VPXOR Y15, Y11, Y11
- VMOVDQA 224(BP), Y15
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- VPADDD Y14, Y0, Y0
- VPADDD Y9, Y5, Y5
- VPADDD Y10, Y6, Y6
- VPADDD Y11, Y7, Y7
- VPXOR Y0, Y4, Y4
- VPXOR Y5, Y1, Y1
- VPXOR Y6, Y2, Y2
- VPXOR Y7, Y3, Y3
- VPSHUFB ·rol8<>+0(SB), Y4, Y4
- VPSHUFB ·rol8<>+0(SB), Y1, Y1
- VPSHUFB ·rol8<>+0(SB), Y2, Y2
- VPSHUFB ·rol8<>+0(SB), Y3, Y3
- ADDQ 16(SI)(CX*1), R10
- ADCQ 24(SI)(CX*1), R11
- ADCQ $0x01, R12
- VPADDD Y4, Y12, Y12
- VPADDD Y1, Y13, Y13
- VPADDD Y2, Y8, Y8
- VPADDD Y3, Y15, Y15
- MOVQ (BP), DX
- MOVQ DX, R15
- MULXQ R10, R13, R14
- IMULQ R12, R15
- MULXQ R11, AX, DX
- ADDQ AX, R14
- ADCQ DX, R15
- VPXOR Y12, Y14, Y14
- VPXOR Y13, Y9, Y9
- VPXOR Y8, Y10, Y10
- VPXOR Y15, Y11, Y11
- VMOVDQA Y15, 224(BP)
- VPSLLD $0x07, Y14, Y15
- VPSRLD $0x19, Y14, Y14
- VPXOR Y15, Y14, Y14
- VPSLLD $0x07, Y9, Y15
- VPSRLD $0x19, Y9, Y9
- VPXOR Y15, Y9, Y9
- VPSLLD $0x07, Y10, Y15
- VPSRLD $0x19, Y10, Y10
- VPXOR Y15, Y10, Y10
- VPSLLD $0x07, Y11, Y15
- VPSRLD $0x19, Y11, Y11
- VPXOR Y15, Y11, Y11
- VMOVDQA 224(BP), Y15
- MOVQ 8(BP), DX
- MULXQ R10, R10, AX
- ADDQ R10, R14
- MULXQ R11, R11, R8
- ADCQ R11, R15
- ADCQ $0x00, R8
- VPALIGNR $0x04, Y14, Y14, Y14
- VPALIGNR $0x04, Y9, Y9, Y9
- VPALIGNR $0x04, Y10, Y10, Y10
- VPALIGNR $0x04, Y11, Y11, Y11
- VPALIGNR $0x08, Y12, Y12, Y12
- VPALIGNR $0x08, Y13, Y13, Y13
- VPALIGNR $0x08, Y8, Y8, Y8
- VPALIGNR $0x08, Y15, Y15, Y15
- VPALIGNR $0x0c, Y4, Y4, Y4
- VPALIGNR $0x0c, Y1, Y1, Y1
- VPALIGNR $0x0c, Y2, Y2, Y2
- VPALIGNR $0x0c, Y3, Y3, Y3
- VPADDD Y14, Y0, Y0
- VPADDD Y9, Y5, Y5
- VPADDD Y10, Y6, Y6
- VPADDD Y11, Y7, Y7
- IMULQ R12, DX
- ADDQ AX, R15
- ADCQ DX, R8
- VPXOR Y0, Y4, Y4
- VPXOR Y5, Y1, Y1
- VPXOR Y6, Y2, Y2
- VPXOR Y7, Y3, Y3
- VPSHUFB ·rol16<>+0(SB), Y4, Y4
- VPSHUFB ·rol16<>+0(SB), Y1, Y1
- VPSHUFB ·rol16<>+0(SB), Y2, Y2
- VPSHUFB ·rol16<>+0(SB), Y3, Y3
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- VPADDD Y4, Y12, Y12
- VPADDD Y1, Y13, Y13
- VPADDD Y2, Y8, Y8
- VPADDD Y3, Y15, Y15
- VPXOR Y12, Y14, Y14
- VPXOR Y13, Y9, Y9
- VPXOR Y8, Y10, Y10
- VPXOR Y15, Y11, Y11
- ADDQ 32(SI)(CX*1), R10
- ADCQ 40(SI)(CX*1), R11
- ADCQ $0x01, R12
- LEAQ 48(CX), CX
- VMOVDQA Y15, 224(BP)
- VPSLLD $0x0c, Y14, Y15
- VPSRLD $0x14, Y14, Y14
- VPXOR Y15, Y14, Y14
- VPSLLD $0x0c, Y9, Y15
- VPSRLD $0x14, Y9, Y9
- VPXOR Y15, Y9, Y9
- VPSLLD $0x0c, Y10, Y15
- VPSRLD $0x14, Y10, Y10
- VPXOR Y15, Y10, Y10
- VPSLLD $0x0c, Y11, Y15
- VPSRLD $0x14, Y11, Y11
- VPXOR Y15, Y11, Y11
- VMOVDQA 224(BP), Y15
- MOVQ (BP), DX
- MOVQ DX, R15
- MULXQ R10, R13, R14
- IMULQ R12, R15
- MULXQ R11, AX, DX
- ADDQ AX, R14
- ADCQ DX, R15
- VPADDD Y14, Y0, Y0
- VPADDD Y9, Y5, Y5
- VPADDD Y10, Y6, Y6
- VPADDD Y11, Y7, Y7
- VPXOR Y0, Y4, Y4
- VPXOR Y5, Y1, Y1
- VPXOR Y6, Y2, Y2
- VPXOR Y7, Y3, Y3
- MOVQ 8(BP), DX
- MULXQ R10, R10, AX
- ADDQ R10, R14
- MULXQ R11, R11, R8
- ADCQ R11, R15
- ADCQ $0x00, R8
- VPSHUFB ·rol8<>+0(SB), Y4, Y4
- VPSHUFB ·rol8<>+0(SB), Y1, Y1
- VPSHUFB ·rol8<>+0(SB), Y2, Y2
- VPSHUFB ·rol8<>+0(SB), Y3, Y3
- VPADDD Y4, Y12, Y12
- VPADDD Y1, Y13, Y13
- VPADDD Y2, Y8, Y8
- VPADDD Y3, Y15, Y15
- IMULQ R12, DX
- ADDQ AX, R15
- ADCQ DX, R8
- VPXOR Y12, Y14, Y14
- VPXOR Y13, Y9, Y9
- VPXOR Y8, Y10, Y10
- VPXOR Y15, Y11, Y11
- VMOVDQA Y15, 224(BP)
- VPSLLD $0x07, Y14, Y15
- VPSRLD $0x19, Y14, Y14
- VPXOR Y15, Y14, Y14
- VPSLLD $0x07, Y9, Y15
- VPSRLD $0x19, Y9, Y9
- VPXOR Y15, Y9, Y9
- VPSLLD $0x07, Y10, Y15
- VPSRLD $0x19, Y10, Y10
- VPXOR Y15, Y10, Y10
- VPSLLD $0x07, Y11, Y15
- VPSRLD $0x19, Y11, Y11
- VPXOR Y15, Y11, Y11
- VMOVDQA 224(BP), Y15
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- VPALIGNR $0x0c, Y14, Y14, Y14
- VPALIGNR $0x0c, Y9, Y9, Y9
- VPALIGNR $0x0c, Y10, Y10, Y10
- VPALIGNR $0x0c, Y11, Y11, Y11
- VPALIGNR $0x08, Y12, Y12, Y12
- VPALIGNR $0x08, Y13, Y13, Y13
- VPALIGNR $0x08, Y8, Y8, Y8
- VPALIGNR $0x08, Y15, Y15, Y15
- VPALIGNR $0x04, Y4, Y4, Y4
- VPALIGNR $0x04, Y1, Y1, Y1
- VPALIGNR $0x04, Y2, Y2, Y2
- VPALIGNR $0x04, Y3, Y3, Y3
- CMPQ CX, $0x000001e0
- JNE openAVX2InternalLoop
- VPADDD ·chacha20Constants<>+0(SB), Y0, Y0
- VPADDD ·chacha20Constants<>+0(SB), Y5, Y5
- VPADDD ·chacha20Constants<>+0(SB), Y6, Y6
- VPADDD ·chacha20Constants<>+0(SB), Y7, Y7
- VPADDD 32(BP), Y14, Y14
- VPADDD 32(BP), Y9, Y9
- VPADDD 32(BP), Y10, Y10
- VPADDD 32(BP), Y11, Y11
- VPADDD 64(BP), Y12, Y12
- VPADDD 64(BP), Y13, Y13
- VPADDD 64(BP), Y8, Y8
- VPADDD 64(BP), Y15, Y15
- VPADDD 96(BP), Y4, Y4
- VPADDD 128(BP), Y1, Y1
- VPADDD 160(BP), Y2, Y2
- VPADDD 192(BP), Y3, Y3
- VMOVDQA Y15, 224(BP)
-
- // We only hashed 480 of the 512 bytes available - hash the remaining 32 here
- ADDQ 480(SI), R10
- ADCQ 488(SI), R11
- ADCQ $0x01, R12
- MOVQ (BP), DX
- MOVQ DX, R15
- MULXQ R10, R13, R14
- IMULQ R12, R15
- MULXQ R11, AX, DX
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), DX
- MULXQ R10, R10, AX
- ADDQ R10, R14
- MULXQ R11, R11, R8
- ADCQ R11, R15
- ADCQ $0x00, R8
- IMULQ R12, DX
- ADDQ AX, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- VPERM2I128 $0x02, Y0, Y14, Y15
- VPERM2I128 $0x13, Y0, Y14, Y14
- VPERM2I128 $0x02, Y12, Y4, Y0
- VPERM2I128 $0x13, Y12, Y4, Y12
- VPXOR (SI), Y15, Y15
- VPXOR 32(SI), Y0, Y0
- VPXOR 64(SI), Y14, Y14
- VPXOR 96(SI), Y12, Y12
- VMOVDQU Y15, (DI)
- VMOVDQU Y0, 32(DI)
- VMOVDQU Y14, 64(DI)
- VMOVDQU Y12, 96(DI)
- VPERM2I128 $0x02, Y5, Y9, Y0
- VPERM2I128 $0x02, Y13, Y1, Y14
- VPERM2I128 $0x13, Y5, Y9, Y12
- VPERM2I128 $0x13, Y13, Y1, Y4
- VPXOR 128(SI), Y0, Y0
- VPXOR 160(SI), Y14, Y14
- VPXOR 192(SI), Y12, Y12
- VPXOR 224(SI), Y4, Y4
- VMOVDQU Y0, 128(DI)
- VMOVDQU Y14, 160(DI)
- VMOVDQU Y12, 192(DI)
- VMOVDQU Y4, 224(DI)
-
- // and here
- ADDQ 496(SI), R10
- ADCQ 504(SI), R11
- ADCQ $0x01, R12
- MOVQ (BP), DX
- MOVQ DX, R15
- MULXQ R10, R13, R14
- IMULQ R12, R15
- MULXQ R11, AX, DX
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), DX
- MULXQ R10, R10, AX
- ADDQ R10, R14
- MULXQ R11, R11, R8
- ADCQ R11, R15
- ADCQ $0x00, R8
- IMULQ R12, DX
- ADDQ AX, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- VPERM2I128 $0x02, Y6, Y10, Y0
- VPERM2I128 $0x02, Y8, Y2, Y14
- VPERM2I128 $0x13, Y6, Y10, Y12
- VPERM2I128 $0x13, Y8, Y2, Y4
- VPXOR 256(SI), Y0, Y0
- VPXOR 288(SI), Y14, Y14
- VPXOR 320(SI), Y12, Y12
- VPXOR 352(SI), Y4, Y4
- VMOVDQU Y0, 256(DI)
- VMOVDQU Y14, 288(DI)
- VMOVDQU Y12, 320(DI)
- VMOVDQU Y4, 352(DI)
- VPERM2I128 $0x02, Y7, Y11, Y0
- VPERM2I128 $0x02, 224(BP), Y3, Y14
- VPERM2I128 $0x13, Y7, Y11, Y12
- VPERM2I128 $0x13, 224(BP), Y3, Y4
- VPXOR 384(SI), Y0, Y0
- VPXOR 416(SI), Y14, Y14
- VPXOR 448(SI), Y12, Y12
- VPXOR 480(SI), Y4, Y4
- VMOVDQU Y0, 384(DI)
- VMOVDQU Y14, 416(DI)
- VMOVDQU Y12, 448(DI)
- VMOVDQU Y4, 480(DI)
- LEAQ 512(SI), SI
- LEAQ 512(DI), DI
- SUBQ $0x00000200, BX
- JMP openAVX2MainLoop
-
-openAVX2MainLoopDone:
- // Handle the various tail sizes efficiently
- TESTQ BX, BX
- JE openSSEFinalize
- CMPQ BX, $0x80
- JBE openAVX2Tail128
- CMPQ BX, $0x00000100
- JBE openAVX2Tail256
- CMPQ BX, $0x00000180
- JBE openAVX2Tail384
- JMP openAVX2Tail512
-
-openAVX2192:
- VMOVDQA Y0, Y5
- VMOVDQA Y14, Y9
- VMOVDQA Y12, Y13
- VPADDD ·avx2IncMask<>+0(SB), Y4, Y1
- VMOVDQA Y0, Y6
- VMOVDQA Y14, Y10
- VMOVDQA Y12, Y8
- VMOVDQA Y4, Y2
- VMOVDQA Y1, Y15
- MOVQ $0x0000000a, R9
-
-openAVX2192InnerCipherLoop:
- VPADDD Y14, Y0, Y0
- VPXOR Y0, Y4, Y4
- VPSHUFB ·rol16<>+0(SB), Y4, Y4
- VPADDD Y4, Y12, Y12
- VPXOR Y12, Y14, Y14
- VPSLLD $0x0c, Y14, Y3
- VPSRLD $0x14, Y14, Y14
- VPXOR Y3, Y14, Y14
- VPADDD Y14, Y0, Y0
- VPXOR Y0, Y4, Y4
- VPSHUFB ·rol8<>+0(SB), Y4, Y4
- VPADDD Y4, Y12, Y12
- VPXOR Y12, Y14, Y14
- VPSLLD $0x07, Y14, Y3
- VPSRLD $0x19, Y14, Y14
- VPXOR Y3, Y14, Y14
- VPADDD Y9, Y5, Y5
- VPXOR Y5, Y1, Y1
- VPSHUFB ·rol16<>+0(SB), Y1, Y1
- VPADDD Y1, Y13, Y13
- VPXOR Y13, Y9, Y9
- VPSLLD $0x0c, Y9, Y3
- VPSRLD $0x14, Y9, Y9
- VPXOR Y3, Y9, Y9
- VPADDD Y9, Y5, Y5
- VPXOR Y5, Y1, Y1
- VPSHUFB ·rol8<>+0(SB), Y1, Y1
- VPADDD Y1, Y13, Y13
- VPXOR Y13, Y9, Y9
- VPSLLD $0x07, Y9, Y3
- VPSRLD $0x19, Y9, Y9
- VPXOR Y3, Y9, Y9
- VPALIGNR $0x04, Y14, Y14, Y14
- VPALIGNR $0x04, Y9, Y9, Y9
- VPALIGNR $0x08, Y12, Y12, Y12
- VPALIGNR $0x08, Y13, Y13, Y13
- VPALIGNR $0x0c, Y4, Y4, Y4
- VPALIGNR $0x0c, Y1, Y1, Y1
- VPADDD Y14, Y0, Y0
- VPXOR Y0, Y4, Y4
- VPSHUFB ·rol16<>+0(SB), Y4, Y4
- VPADDD Y4, Y12, Y12
- VPXOR Y12, Y14, Y14
- VPSLLD $0x0c, Y14, Y3
- VPSRLD $0x14, Y14, Y14
- VPXOR Y3, Y14, Y14
- VPADDD Y14, Y0, Y0
- VPXOR Y0, Y4, Y4
- VPSHUFB ·rol8<>+0(SB), Y4, Y4
- VPADDD Y4, Y12, Y12
- VPXOR Y12, Y14, Y14
- VPSLLD $0x07, Y14, Y3
- VPSRLD $0x19, Y14, Y14
- VPXOR Y3, Y14, Y14
- VPADDD Y9, Y5, Y5
- VPXOR Y5, Y1, Y1
- VPSHUFB ·rol16<>+0(SB), Y1, Y1
- VPADDD Y1, Y13, Y13
- VPXOR Y13, Y9, Y9
- VPSLLD $0x0c, Y9, Y3
- VPSRLD $0x14, Y9, Y9
- VPXOR Y3, Y9, Y9
- VPADDD Y9, Y5, Y5
- VPXOR Y5, Y1, Y1
- VPSHUFB ·rol8<>+0(SB), Y1, Y1
- VPADDD Y1, Y13, Y13
- VPXOR Y13, Y9, Y9
- VPSLLD $0x07, Y9, Y3
- VPSRLD $0x19, Y9, Y9
- VPXOR Y3, Y9, Y9
- VPALIGNR $0x0c, Y14, Y14, Y14
- VPALIGNR $0x0c, Y9, Y9, Y9
- VPALIGNR $0x08, Y12, Y12, Y12
- VPALIGNR $0x08, Y13, Y13, Y13
- VPALIGNR $0x04, Y4, Y4, Y4
- VPALIGNR $0x04, Y1, Y1, Y1
- DECQ R9
- JNE openAVX2192InnerCipherLoop
- VPADDD Y6, Y0, Y0
- VPADDD Y6, Y5, Y5
- VPADDD Y10, Y14, Y14
- VPADDD Y10, Y9, Y9
- VPADDD Y8, Y12, Y12
- VPADDD Y8, Y13, Y13
- VPADDD Y2, Y4, Y4
- VPADDD Y15, Y1, Y1
- VPERM2I128 $0x02, Y0, Y14, Y3
-
- // Clamp and store poly key
- VPAND ·polyClampMask<>+0(SB), Y3, Y3
- VMOVDQA Y3, (BP)
-
- // Stream for up to 192 bytes
- VPERM2I128 $0x13, Y0, Y14, Y0
- VPERM2I128 $0x13, Y12, Y4, Y14
- VPERM2I128 $0x02, Y5, Y9, Y12
- VPERM2I128 $0x02, Y13, Y1, Y4
- VPERM2I128 $0x13, Y5, Y9, Y5
- VPERM2I128 $0x13, Y13, Y1, Y9
-
-openAVX2ShortOpen:
- // Hash
- MOVQ ad_len+80(FP), R9
- CALL polyHashADInternal<>(SB)
-
-openAVX2ShortOpenLoop:
- CMPQ BX, $0x20
- JB openAVX2ShortTail32
- SUBQ $0x20, BX
-
- // Load for hashing
- ADDQ (SI), R10
- ADCQ 8(SI), R11
- ADCQ $0x01, R12
- MOVQ (BP), DX
- MOVQ DX, R15
- MULXQ R10, R13, R14
- IMULQ R12, R15
- MULXQ R11, AX, DX
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), DX
- MULXQ R10, R10, AX
- ADDQ R10, R14
- MULXQ R11, R11, R8
- ADCQ R11, R15
- ADCQ $0x00, R8
- IMULQ R12, DX
- ADDQ AX, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- ADDQ 16(SI), R10
- ADCQ 24(SI), R11
- ADCQ $0x01, R12
- MOVQ (BP), DX
- MOVQ DX, R15
- MULXQ R10, R13, R14
- IMULQ R12, R15
- MULXQ R11, AX, DX
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), DX
- MULXQ R10, R10, AX
- ADDQ R10, R14
- MULXQ R11, R11, R8
- ADCQ R11, R15
- ADCQ $0x00, R8
- IMULQ R12, DX
- ADDQ AX, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
-
- // Load for decryption
- VPXOR (SI), Y0, Y0
- VMOVDQU Y0, (DI)
- LEAQ 32(SI), SI
- LEAQ 32(DI), DI
-
- // Shift stream left
- VMOVDQA Y14, Y0
- VMOVDQA Y12, Y14
- VMOVDQA Y4, Y12
- VMOVDQA Y5, Y4
- VMOVDQA Y9, Y5
- VMOVDQA Y13, Y9
- VMOVDQA Y1, Y13
- VMOVDQA Y6, Y1
- VMOVDQA Y10, Y6
- JMP openAVX2ShortOpenLoop
-
-openAVX2ShortTail32:
- CMPQ BX, $0x10
- VMOVDQA X0, X1
- JB openAVX2ShortDone
- SUBQ $0x10, BX
-
- // Load for hashing
- ADDQ (SI), R10
- ADCQ 8(SI), R11
- ADCQ $0x01, R12
- MOVQ (BP), DX
- MOVQ DX, R15
- MULXQ R10, R13, R14
- IMULQ R12, R15
- MULXQ R11, AX, DX
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), DX
- MULXQ R10, R10, AX
- ADDQ R10, R14
- MULXQ R11, R11, R8
- ADCQ R11, R15
- ADCQ $0x00, R8
- IMULQ R12, DX
- ADDQ AX, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
-
- // Load for decryption
- VPXOR (SI), X0, X12
- VMOVDQU X12, (DI)
- LEAQ 16(SI), SI
- LEAQ 16(DI), DI
- VPERM2I128 $0x11, Y0, Y0, Y0
- VMOVDQA X0, X1
-
-openAVX2ShortDone:
- VZEROUPPER
- JMP openSSETail16
-
-openAVX2320:
- VMOVDQA Y0, Y5
- VMOVDQA Y14, Y9
- VMOVDQA Y12, Y13
- VPADDD ·avx2IncMask<>+0(SB), Y4, Y1
- VMOVDQA Y0, Y6
- VMOVDQA Y14, Y10
- VMOVDQA Y12, Y8
- VPADDD ·avx2IncMask<>+0(SB), Y1, Y2
- VMOVDQA Y14, Y7
- VMOVDQA Y12, Y11
- VMOVDQA Y4, Y15
- MOVQ $0x0000000a, R9
-
-openAVX2320InnerCipherLoop:
- VPADDD Y14, Y0, Y0
- VPXOR Y0, Y4, Y4
- VPSHUFB ·rol16<>+0(SB), Y4, Y4
- VPADDD Y4, Y12, Y12
- VPXOR Y12, Y14, Y14
- VPSLLD $0x0c, Y14, Y3
- VPSRLD $0x14, Y14, Y14
- VPXOR Y3, Y14, Y14
- VPADDD Y14, Y0, Y0
- VPXOR Y0, Y4, Y4
- VPSHUFB ·rol8<>+0(SB), Y4, Y4
- VPADDD Y4, Y12, Y12
- VPXOR Y12, Y14, Y14
- VPSLLD $0x07, Y14, Y3
- VPSRLD $0x19, Y14, Y14
- VPXOR Y3, Y14, Y14
- VPADDD Y9, Y5, Y5
- VPXOR Y5, Y1, Y1
- VPSHUFB ·rol16<>+0(SB), Y1, Y1
- VPADDD Y1, Y13, Y13
- VPXOR Y13, Y9, Y9
- VPSLLD $0x0c, Y9, Y3
- VPSRLD $0x14, Y9, Y9
- VPXOR Y3, Y9, Y9
- VPADDD Y9, Y5, Y5
- VPXOR Y5, Y1, Y1
- VPSHUFB ·rol8<>+0(SB), Y1, Y1
- VPADDD Y1, Y13, Y13
- VPXOR Y13, Y9, Y9
- VPSLLD $0x07, Y9, Y3
- VPSRLD $0x19, Y9, Y9
- VPXOR Y3, Y9, Y9
- VPADDD Y10, Y6, Y6
- VPXOR Y6, Y2, Y2
- VPSHUFB ·rol16<>+0(SB), Y2, Y2
- VPADDD Y2, Y8, Y8
- VPXOR Y8, Y10, Y10
- VPSLLD $0x0c, Y10, Y3
- VPSRLD $0x14, Y10, Y10
- VPXOR Y3, Y10, Y10
- VPADDD Y10, Y6, Y6
- VPXOR Y6, Y2, Y2
- VPSHUFB ·rol8<>+0(SB), Y2, Y2
- VPADDD Y2, Y8, Y8
- VPXOR Y8, Y10, Y10
- VPSLLD $0x07, Y10, Y3
- VPSRLD $0x19, Y10, Y10
- VPXOR Y3, Y10, Y10
- VPALIGNR $0x04, Y14, Y14, Y14
- VPALIGNR $0x04, Y9, Y9, Y9
- VPALIGNR $0x04, Y10, Y10, Y10
- VPALIGNR $0x08, Y12, Y12, Y12
- VPALIGNR $0x08, Y13, Y13, Y13
- VPALIGNR $0x08, Y8, Y8, Y8
- VPALIGNR $0x0c, Y4, Y4, Y4
- VPALIGNR $0x0c, Y1, Y1, Y1
- VPALIGNR $0x0c, Y2, Y2, Y2
- VPADDD Y14, Y0, Y0
- VPXOR Y0, Y4, Y4
- VPSHUFB ·rol16<>+0(SB), Y4, Y4
- VPADDD Y4, Y12, Y12
- VPXOR Y12, Y14, Y14
- VPSLLD $0x0c, Y14, Y3
- VPSRLD $0x14, Y14, Y14
- VPXOR Y3, Y14, Y14
- VPADDD Y14, Y0, Y0
- VPXOR Y0, Y4, Y4
- VPSHUFB ·rol8<>+0(SB), Y4, Y4
- VPADDD Y4, Y12, Y12
- VPXOR Y12, Y14, Y14
- VPSLLD $0x07, Y14, Y3
- VPSRLD $0x19, Y14, Y14
- VPXOR Y3, Y14, Y14
- VPADDD Y9, Y5, Y5
- VPXOR Y5, Y1, Y1
- VPSHUFB ·rol16<>+0(SB), Y1, Y1
- VPADDD Y1, Y13, Y13
- VPXOR Y13, Y9, Y9
- VPSLLD $0x0c, Y9, Y3
- VPSRLD $0x14, Y9, Y9
- VPXOR Y3, Y9, Y9
- VPADDD Y9, Y5, Y5
- VPXOR Y5, Y1, Y1
- VPSHUFB ·rol8<>+0(SB), Y1, Y1
- VPADDD Y1, Y13, Y13
- VPXOR Y13, Y9, Y9
- VPSLLD $0x07, Y9, Y3
- VPSRLD $0x19, Y9, Y9
- VPXOR Y3, Y9, Y9
- VPADDD Y10, Y6, Y6
- VPXOR Y6, Y2, Y2
- VPSHUFB ·rol16<>+0(SB), Y2, Y2
- VPADDD Y2, Y8, Y8
- VPXOR Y8, Y10, Y10
- VPSLLD $0x0c, Y10, Y3
- VPSRLD $0x14, Y10, Y10
- VPXOR Y3, Y10, Y10
- VPADDD Y10, Y6, Y6
- VPXOR Y6, Y2, Y2
- VPSHUFB ·rol8<>+0(SB), Y2, Y2
- VPADDD Y2, Y8, Y8
- VPXOR Y8, Y10, Y10
- VPSLLD $0x07, Y10, Y3
- VPSRLD $0x19, Y10, Y10
- VPXOR Y3, Y10, Y10
- VPALIGNR $0x0c, Y14, Y14, Y14
- VPALIGNR $0x0c, Y9, Y9, Y9
- VPALIGNR $0x0c, Y10, Y10, Y10
- VPALIGNR $0x08, Y12, Y12, Y12
- VPALIGNR $0x08, Y13, Y13, Y13
- VPALIGNR $0x08, Y8, Y8, Y8
- VPALIGNR $0x04, Y4, Y4, Y4
- VPALIGNR $0x04, Y1, Y1, Y1
- VPALIGNR $0x04, Y2, Y2, Y2
- DECQ R9
- JNE openAVX2320InnerCipherLoop
- VMOVDQA ·chacha20Constants<>+0(SB), Y3
- VPADDD Y3, Y0, Y0
- VPADDD Y3, Y5, Y5
- VPADDD Y3, Y6, Y6
- VPADDD Y7, Y14, Y14
- VPADDD Y7, Y9, Y9
- VPADDD Y7, Y10, Y10
- VPADDD Y11, Y12, Y12
- VPADDD Y11, Y13, Y13
- VPADDD Y11, Y8, Y8
- VMOVDQA ·avx2IncMask<>+0(SB), Y3
- VPADDD Y15, Y4, Y4
- VPADDD Y3, Y15, Y15
- VPADDD Y15, Y1, Y1
- VPADDD Y3, Y15, Y15
- VPADDD Y15, Y2, Y2
-
- // Clamp and store poly key
- VPERM2I128 $0x02, Y0, Y14, Y3
- VPAND ·polyClampMask<>+0(SB), Y3, Y3
- VMOVDQA Y3, (BP)
-
- // Stream for up to 320 bytes
- VPERM2I128 $0x13, Y0, Y14, Y0
- VPERM2I128 $0x13, Y12, Y4, Y14
- VPERM2I128 $0x02, Y5, Y9, Y12
- VPERM2I128 $0x02, Y13, Y1, Y4
- VPERM2I128 $0x13, Y5, Y9, Y5
- VPERM2I128 $0x13, Y13, Y1, Y9
- VPERM2I128 $0x02, Y6, Y10, Y13
- VPERM2I128 $0x02, Y8, Y2, Y1
- VPERM2I128 $0x13, Y6, Y10, Y6
- VPERM2I128 $0x13, Y8, Y2, Y10
- JMP openAVX2ShortOpen
-
-openAVX2Tail128:
- // Need to decrypt up to 128 bytes - prepare two blocks
- VMOVDQA ·chacha20Constants<>+0(SB), Y5
- VMOVDQA 32(BP), Y9
- VMOVDQA 64(BP), Y13
- VMOVDQA 192(BP), Y1
- VPADDD ·avx2IncMask<>+0(SB), Y1, Y1
- VMOVDQA Y1, Y4
- XORQ R9, R9
- MOVQ BX, CX
- ANDQ $-16, CX
- TESTQ CX, CX
- JE openAVX2Tail128LoopB
-
-openAVX2Tail128LoopA:
- ADDQ (SI)(R9*1), R10
- ADCQ 8(SI)(R9*1), R11
- ADCQ $0x01, R12
- MOVQ (BP), DX
- MOVQ DX, R15
- MULXQ R10, R13, R14
- IMULQ R12, R15
- MULXQ R11, AX, DX
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), DX
- MULXQ R10, R10, AX
- ADDQ R10, R14
- MULXQ R11, R11, R8
- ADCQ R11, R15
- ADCQ $0x00, R8
- IMULQ R12, DX
- ADDQ AX, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
-
-openAVX2Tail128LoopB:
- ADDQ $0x10, R9
- VPADDD Y9, Y5, Y5
- VPXOR Y5, Y1, Y1
- VPSHUFB ·rol16<>+0(SB), Y1, Y1
- VPADDD Y1, Y13, Y13
- VPXOR Y13, Y9, Y9
- VPSLLD $0x0c, Y9, Y3
- VPSRLD $0x14, Y9, Y9
- VPXOR Y3, Y9, Y9
- VPADDD Y9, Y5, Y5
- VPXOR Y5, Y1, Y1
- VPSHUFB ·rol8<>+0(SB), Y1, Y1
- VPADDD Y1, Y13, Y13
- VPXOR Y13, Y9, Y9
- VPSLLD $0x07, Y9, Y3
- VPSRLD $0x19, Y9, Y9
- VPXOR Y3, Y9, Y9
- VPALIGNR $0x04, Y9, Y9, Y9
- VPALIGNR $0x08, Y13, Y13, Y13
- VPALIGNR $0x0c, Y1, Y1, Y1
- VPADDD Y9, Y5, Y5
- VPXOR Y5, Y1, Y1
- VPSHUFB ·rol16<>+0(SB), Y1, Y1
- VPADDD Y1, Y13, Y13
- VPXOR Y13, Y9, Y9
- VPSLLD $0x0c, Y9, Y3
- VPSRLD $0x14, Y9, Y9
- VPXOR Y3, Y9, Y9
- VPADDD Y9, Y5, Y5
- VPXOR Y5, Y1, Y1
- VPSHUFB ·rol8<>+0(SB), Y1, Y1
- VPADDD Y1, Y13, Y13
- VPXOR Y13, Y9, Y9
- VPSLLD $0x07, Y9, Y3
- VPSRLD $0x19, Y9, Y9
- VPXOR Y3, Y9, Y9
- VPALIGNR $0x0c, Y9, Y9, Y9
- VPALIGNR $0x08, Y13, Y13, Y13
- VPALIGNR $0x04, Y1, Y1, Y1
- CMPQ R9, CX
- JB openAVX2Tail128LoopA
- CMPQ R9, $0xa0
- JNE openAVX2Tail128LoopB
- VPADDD ·chacha20Constants<>+0(SB), Y5, Y5
- VPADDD 32(BP), Y9, Y9
- VPADDD 64(BP), Y13, Y13
- VPADDD Y4, Y1, Y1
- VPERM2I128 $0x02, Y5, Y9, Y0
- VPERM2I128 $0x02, Y13, Y1, Y14
- VPERM2I128 $0x13, Y5, Y9, Y12
- VPERM2I128 $0x13, Y13, Y1, Y4
-
-openAVX2TailLoop:
- CMPQ BX, $0x20
- JB openAVX2Tail
- SUBQ $0x20, BX
-
- // Load for decryption
- VPXOR (SI), Y0, Y0
- VMOVDQU Y0, (DI)
- LEAQ 32(SI), SI
- LEAQ 32(DI), DI
- VMOVDQA Y14, Y0
- VMOVDQA Y12, Y14
- VMOVDQA Y4, Y12
- JMP openAVX2TailLoop
-
-openAVX2Tail:
- CMPQ BX, $0x10
- VMOVDQA X0, X1
- JB openAVX2TailDone
- SUBQ $0x10, BX
-
- // Load for decryption
- VPXOR (SI), X0, X12
- VMOVDQU X12, (DI)
- LEAQ 16(SI), SI
- LEAQ 16(DI), DI
- VPERM2I128 $0x11, Y0, Y0, Y0
- VMOVDQA X0, X1
-
-openAVX2TailDone:
- VZEROUPPER
- JMP openSSETail16
-
-openAVX2Tail256:
- VMOVDQA ·chacha20Constants<>+0(SB), Y0
- VMOVDQA Y0, Y5
- VMOVDQA 32(BP), Y14
- VMOVDQA Y14, Y9
- VMOVDQA 64(BP), Y12
- VMOVDQA Y12, Y13
- VMOVDQA 192(BP), Y4
- VPADDD ·avx2IncMask<>+0(SB), Y4, Y4
- VPADDD ·avx2IncMask<>+0(SB), Y4, Y1
- VMOVDQA Y4, Y7
- VMOVDQA Y1, Y11
-
- // Compute the number of iterations that will hash data
- MOVQ BX, 224(BP)
- MOVQ BX, CX
- SUBQ $0x80, CX
- SHRQ $0x04, CX
- MOVQ $0x0000000a, R9
- CMPQ CX, $0x0a
- CMOVQGT R9, CX
- MOVQ SI, BX
- XORQ R9, R9
-
-openAVX2Tail256LoopA:
- ADDQ (BX), R10
- ADCQ 8(BX), R11
- ADCQ $0x01, R12
- MOVQ (BP), DX
- MOVQ DX, R15
- MULXQ R10, R13, R14
- IMULQ R12, R15
- MULXQ R11, AX, DX
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), DX
- MULXQ R10, R10, AX
- ADDQ R10, R14
- MULXQ R11, R11, R8
- ADCQ R11, R15
- ADCQ $0x00, R8
- IMULQ R12, DX
- ADDQ AX, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- LEAQ 16(BX), BX
-
-openAVX2Tail256LoopB:
- VPADDD Y14, Y0, Y0
- VPXOR Y0, Y4, Y4
- VPSHUFB ·rol16<>+0(SB), Y4, Y4
- VPADDD Y4, Y12, Y12
- VPXOR Y12, Y14, Y14
- VPSLLD $0x0c, Y14, Y3
- VPSRLD $0x14, Y14, Y14
- VPXOR Y3, Y14, Y14
+openAVX2InternalLoop:
+ ADDQ (SI)(CX*1), R10
+ ADCQ 8(SI)(CX*1), R11
+ ADCQ $0x01, R12
VPADDD Y14, Y0, Y0
- VPXOR Y0, Y4, Y4
- VPSHUFB ·rol8<>+0(SB), Y4, Y4
- VPADDD Y4, Y12, Y12
- VPXOR Y12, Y14, Y14
- VPSLLD $0x07, Y14, Y3
- VPSRLD $0x19, Y14, Y14
- VPXOR Y3, Y14, Y14
VPADDD Y9, Y5, Y5
+ VPADDD Y10, Y6, Y6
+ VPADDD Y11, Y7, Y7
+ MOVQ (BP), DX
+ MOVQ DX, R15
+ MULXQ R10, R13, R14
+ IMULQ R12, R15
+ MULXQ R11, AX, DX
+ ADDQ AX, R14
+ ADCQ DX, R15
+ VPXOR Y0, Y4, Y4
VPXOR Y5, Y1, Y1
+ VPXOR Y6, Y2, Y2
+ VPXOR Y7, Y3, Y3
+ VPSHUFB ·rol16<>+0(SB), Y4, Y4
VPSHUFB ·rol16<>+0(SB), Y1, Y1
+ VPSHUFB ·rol16<>+0(SB), Y2, Y2
+ VPSHUFB ·rol16<>+0(SB), Y3, Y3
+ MOVQ 8(BP), DX
+ MULXQ R10, R10, AX
+ ADDQ R10, R14
+ MULXQ R11, R11, R8
+ ADCQ R11, R15
+ ADCQ $0x00, R8
+ VPADDD Y4, Y12, Y12
VPADDD Y1, Y13, Y13
+ VPADDD Y2, Y8, Y8
+ VPADDD Y3, Y15, Y15
+ VPXOR Y12, Y14, Y14
VPXOR Y13, Y9, Y9
- VPSLLD $0x0c, Y9, Y3
+ VPXOR Y8, Y10, Y10
+ VPXOR Y15, Y11, Y11
+ IMULQ R12, DX
+ ADDQ AX, R15
+ ADCQ DX, R8
+ VMOVDQA Y15, 224(BP)
+ VPSLLD $0x0c, Y14, Y15
+ VPSRLD $0x14, Y14, Y14
+ VPXOR Y15, Y14, Y14
+ VPSLLD $0x0c, Y9, Y15
VPSRLD $0x14, Y9, Y9
- VPXOR Y3, Y9, Y9
+ VPXOR Y15, Y9, Y9
+ VPSLLD $0x0c, Y10, Y15
+ VPSRLD $0x14, Y10, Y10
+ VPXOR Y15, Y10, Y10
+ VPSLLD $0x0c, Y11, Y15
+ VPSRLD $0x14, Y11, Y11
+ VPXOR Y15, Y11, Y11
+ VMOVDQA 224(BP), Y15
+ MOVQ R13, R10
+ MOVQ R14, R11
+ MOVQ R15, R12
+ ANDQ $0x03, R12
+ MOVQ R15, R13
+ ANDQ $-4, R13
+ MOVQ R8, R14
+ SHRQ $0x02, R8, R15
+ SHRQ $0x02, R8
+ ADDQ R13, R10
+ ADCQ R14, R11
+ ADCQ $0x00, R12
+ ADDQ R15, R10
+ ADCQ R8, R11
+ ADCQ $0x00, R12
+ VPADDD Y14, Y0, Y0
VPADDD Y9, Y5, Y5
+ VPADDD Y10, Y6, Y6
+ VPADDD Y11, Y7, Y7
+ VPXOR Y0, Y4, Y4
VPXOR Y5, Y1, Y1
+ VPXOR Y6, Y2, Y2
+ VPXOR Y7, Y3, Y3
+ VPSHUFB ·rol8<>+0(SB), Y4, Y4
VPSHUFB ·rol8<>+0(SB), Y1, Y1
+ VPSHUFB ·rol8<>+0(SB), Y2, Y2
+ VPSHUFB ·rol8<>+0(SB), Y3, Y3
+ ADDQ 16(SI)(CX*1), R10
+ ADCQ 24(SI)(CX*1), R11
+ ADCQ $0x01, R12
+ VPADDD Y4, Y12, Y12
VPADDD Y1, Y13, Y13
+ VPADDD Y2, Y8, Y8
+ VPADDD Y3, Y15, Y15
+ MOVQ (BP), DX
+ MOVQ DX, R15
+ MULXQ R10, R13, R14
+ IMULQ R12, R15
+ MULXQ R11, AX, DX
+ ADDQ AX, R14
+ ADCQ DX, R15
+ VPXOR Y12, Y14, Y14
VPXOR Y13, Y9, Y9
- VPSLLD $0x07, Y9, Y3
+ VPXOR Y8, Y10, Y10
+ VPXOR Y15, Y11, Y11
+ VMOVDQA Y15, 224(BP)
+ VPSLLD $0x07, Y14, Y15
+ VPSRLD $0x19, Y14, Y14
+ VPXOR Y15, Y14, Y14
+ VPSLLD $0x07, Y9, Y15
VPSRLD $0x19, Y9, Y9
- VPXOR Y3, Y9, Y9
+ VPXOR Y15, Y9, Y9
+ VPSLLD $0x07, Y10, Y15
+ VPSRLD $0x19, Y10, Y10
+ VPXOR Y15, Y10, Y10
+ VPSLLD $0x07, Y11, Y15
+ VPSRLD $0x19, Y11, Y11
+ VPXOR Y15, Y11, Y11
+ VMOVDQA 224(BP), Y15
+ MOVQ 8(BP), DX
+ MULXQ R10, R10, AX
+ ADDQ R10, R14
+ MULXQ R11, R11, R8
+ ADCQ R11, R15
+ ADCQ $0x00, R8
VPALIGNR $0x04, Y14, Y14, Y14
VPALIGNR $0x04, Y9, Y9, Y9
+ VPALIGNR $0x04, Y10, Y10, Y10
+ VPALIGNR $0x04, Y11, Y11, Y11
VPALIGNR $0x08, Y12, Y12, Y12
VPALIGNR $0x08, Y13, Y13, Y13
+ VPALIGNR $0x08, Y8, Y8, Y8
+ VPALIGNR $0x08, Y15, Y15, Y15
VPALIGNR $0x0c, Y4, Y4, Y4
VPALIGNR $0x0c, Y1, Y1, Y1
- INCQ R9
- VPADDD Y14, Y0, Y0
- VPXOR Y0, Y4, Y4
- VPSHUFB ·rol16<>+0(SB), Y4, Y4
- VPADDD Y4, Y12, Y12
- VPXOR Y12, Y14, Y14
- VPSLLD $0x0c, Y14, Y3
- VPSRLD $0x14, Y14, Y14
- VPXOR Y3, Y14, Y14
+ VPALIGNR $0x0c, Y2, Y2, Y2
+ VPALIGNR $0x0c, Y3, Y3, Y3
VPADDD Y14, Y0, Y0
- VPXOR Y0, Y4, Y4
- VPSHUFB ·rol8<>+0(SB), Y4, Y4
- VPADDD Y4, Y12, Y12
- VPXOR Y12, Y14, Y14
- VPSLLD $0x07, Y14, Y3
- VPSRLD $0x19, Y14, Y14
- VPXOR Y3, Y14, Y14
VPADDD Y9, Y5, Y5
+ VPADDD Y10, Y6, Y6
+ VPADDD Y11, Y7, Y7
+ IMULQ R12, DX
+ ADDQ AX, R15
+ ADCQ DX, R8
+ VPXOR Y0, Y4, Y4
VPXOR Y5, Y1, Y1
+ VPXOR Y6, Y2, Y2
+ VPXOR Y7, Y3, Y3
+ VPSHUFB ·rol16<>+0(SB), Y4, Y4
VPSHUFB ·rol16<>+0(SB), Y1, Y1
+ VPSHUFB ·rol16<>+0(SB), Y2, Y2
+ VPSHUFB ·rol16<>+0(SB), Y3, Y3
+ MOVQ R13, R10
+ MOVQ R14, R11
+ MOVQ R15, R12
+ ANDQ $0x03, R12
+ MOVQ R15, R13
+ ANDQ $-4, R13
+ MOVQ R8, R14
+ SHRQ $0x02, R8, R15
+ SHRQ $0x02, R8
+ ADDQ R13, R10
+ ADCQ R14, R11
+ ADCQ $0x00, R12
+ ADDQ R15, R10
+ ADCQ R8, R11
+ ADCQ $0x00, R12
+ VPADDD Y4, Y12, Y12
VPADDD Y1, Y13, Y13
+ VPADDD Y2, Y8, Y8
+ VPADDD Y3, Y15, Y15
+ VPXOR Y12, Y14, Y14
VPXOR Y13, Y9, Y9
- VPSLLD $0x0c, Y9, Y3
+ VPXOR Y8, Y10, Y10
+ VPXOR Y15, Y11, Y11
+ ADDQ 32(SI)(CX*1), R10
+ ADCQ 40(SI)(CX*1), R11
+ ADCQ $0x01, R12
+ LEAQ 48(CX), CX
+ VMOVDQA Y15, 224(BP)
+ VPSLLD $0x0c, Y14, Y15
+ VPSRLD $0x14, Y14, Y14
+ VPXOR Y15, Y14, Y14
+ VPSLLD $0x0c, Y9, Y15
VPSRLD $0x14, Y9, Y9
- VPXOR Y3, Y9, Y9
+ VPXOR Y15, Y9, Y9
+ VPSLLD $0x0c, Y10, Y15
+ VPSRLD $0x14, Y10, Y10
+ VPXOR Y15, Y10, Y10
+ VPSLLD $0x0c, Y11, Y15
+ VPSRLD $0x14, Y11, Y11
+ VPXOR Y15, Y11, Y11
+ VMOVDQA 224(BP), Y15
+ MOVQ (BP), DX
+ MOVQ DX, R15
+ MULXQ R10, R13, R14
+ IMULQ R12, R15
+ MULXQ R11, AX, DX
+ ADDQ AX, R14
+ ADCQ DX, R15
+ VPADDD Y14, Y0, Y0
VPADDD Y9, Y5, Y5
+ VPADDD Y10, Y6, Y6
+ VPADDD Y11, Y7, Y7
+ VPXOR Y0, Y4, Y4
VPXOR Y5, Y1, Y1
+ VPXOR Y6, Y2, Y2
+ VPXOR Y7, Y3, Y3
+ MOVQ 8(BP), DX
+ MULXQ R10, R10, AX
+ ADDQ R10, R14
+ MULXQ R11, R11, R8
+ ADCQ R11, R15
+ ADCQ $0x00, R8
+ VPSHUFB ·rol8<>+0(SB), Y4, Y4
VPSHUFB ·rol8<>+0(SB), Y1, Y1
+ VPSHUFB ·rol8<>+0(SB), Y2, Y2
+ VPSHUFB ·rol8<>+0(SB), Y3, Y3
+ VPADDD Y4, Y12, Y12
VPADDD Y1, Y13, Y13
+ VPADDD Y2, Y8, Y8
+ VPADDD Y3, Y15, Y15
+ IMULQ R12, DX
+ ADDQ AX, R15
+ ADCQ DX, R8
+ VPXOR Y12, Y14, Y14
VPXOR Y13, Y9, Y9
- VPSLLD $0x07, Y9, Y3
+ VPXOR Y8, Y10, Y10
+ VPXOR Y15, Y11, Y11
+ VMOVDQA Y15, 224(BP)
+ VPSLLD $0x07, Y14, Y15
+ VPSRLD $0x19, Y14, Y14
+ VPXOR Y15, Y14, Y14
+ VPSLLD $0x07, Y9, Y15
VPSRLD $0x19, Y9, Y9
- VPXOR Y3, Y9, Y9
- VPALIGNR $0x0c, Y14, Y14, Y14
- VPALIGNR $0x0c, Y9, Y9, Y9
- VPALIGNR $0x08, Y12, Y12, Y12
- VPALIGNR $0x08, Y13, Y13, Y13
- VPALIGNR $0x04, Y4, Y4, Y4
- VPALIGNR $0x04, Y1, Y1, Y1
- CMPQ R9, CX
- JB openAVX2Tail256LoopA
- CMPQ R9, $0x0a
- JNE openAVX2Tail256LoopB
- MOVQ BX, R9
- SUBQ SI, BX
- MOVQ BX, CX
- MOVQ 224(BP), BX
-
-openAVX2Tail256Hash:
- ADDQ $0x10, CX
- CMPQ CX, BX
- JGT openAVX2Tail256HashEnd
- ADDQ (R9), R10
- ADCQ 8(R9), R11
- ADCQ $0x01, R12
- MOVQ (BP), DX
- MOVQ DX, R15
- MULXQ R10, R13, R14
- IMULQ R12, R15
- MULXQ R11, AX, DX
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), DX
- MULXQ R10, R10, AX
- ADDQ R10, R14
- MULXQ R11, R11, R8
- ADCQ R11, R15
- ADCQ $0x00, R8
- IMULQ R12, DX
- ADDQ AX, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- LEAQ 16(R9), R9
- JMP openAVX2Tail256Hash
+ VPXOR Y15, Y9, Y9
+ VPSLLD $0x07, Y10, Y15
+ VPSRLD $0x19, Y10, Y10
+ VPXOR Y15, Y10, Y10
+ VPSLLD $0x07, Y11, Y15
+ VPSRLD $0x19, Y11, Y11
+ VPXOR Y15, Y11, Y11
+ VMOVDQA 224(BP), Y15
+ MOVQ R13, R10
+ MOVQ R14, R11
+ MOVQ R15, R12
+ ANDQ $0x03, R12
+ MOVQ R15, R13
+ ANDQ $-4, R13
+ MOVQ R8, R14
+ SHRQ $0x02, R8, R15
+ SHRQ $0x02, R8
+ ADDQ R13, R10
+ ADCQ R14, R11
+ ADCQ $0x00, R12
+ ADDQ R15, R10
+ ADCQ R8, R11
+ ADCQ $0x00, R12
+ VPALIGNR $0x0c, Y14, Y14, Y14
+ VPALIGNR $0x0c, Y9, Y9, Y9
+ VPALIGNR $0x0c, Y10, Y10, Y10
+ VPALIGNR $0x0c, Y11, Y11, Y11
+ VPALIGNR $0x08, Y12, Y12, Y12
+ VPALIGNR $0x08, Y13, Y13, Y13
+ VPALIGNR $0x08, Y8, Y8, Y8
+ VPALIGNR $0x08, Y15, Y15, Y15
+ VPALIGNR $0x04, Y4, Y4, Y4
+ VPALIGNR $0x04, Y1, Y1, Y1
+ VPALIGNR $0x04, Y2, Y2, Y2
+ VPALIGNR $0x04, Y3, Y3, Y3
+ CMPQ CX, $0x000001e0
+ JNE openAVX2InternalLoop
+ VPADDD ·chacha20Constants<>+0(SB), Y0, Y0
+ VPADDD ·chacha20Constants<>+0(SB), Y5, Y5
+ VPADDD ·chacha20Constants<>+0(SB), Y6, Y6
+ VPADDD ·chacha20Constants<>+0(SB), Y7, Y7
+ VPADDD 32(BP), Y14, Y14
+ VPADDD 32(BP), Y9, Y9
+ VPADDD 32(BP), Y10, Y10
+ VPADDD 32(BP), Y11, Y11
+ VPADDD 64(BP), Y12, Y12
+ VPADDD 64(BP), Y13, Y13
+ VPADDD 64(BP), Y8, Y8
+ VPADDD 64(BP), Y15, Y15
+ VPADDD 96(BP), Y4, Y4
+ VPADDD 128(BP), Y1, Y1
+ VPADDD 160(BP), Y2, Y2
+ VPADDD 192(BP), Y3, Y3
+ VMOVDQA Y15, 224(BP)
-openAVX2Tail256HashEnd:
- VPADDD ·chacha20Constants<>+0(SB), Y0, Y0
- VPADDD ·chacha20Constants<>+0(SB), Y5, Y5
- VPADDD 32(BP), Y14, Y14
- VPADDD 32(BP), Y9, Y9
- VPADDD 64(BP), Y12, Y12
- VPADDD 64(BP), Y13, Y13
- VPADDD Y7, Y4, Y4
- VPADDD Y11, Y1, Y1
- VPERM2I128 $0x02, Y0, Y14, Y6
- VPERM2I128 $0x02, Y12, Y4, Y10
- VPERM2I128 $0x13, Y0, Y14, Y8
- VPERM2I128 $0x13, Y12, Y4, Y2
+ // We only hashed 480 of the 512 bytes available - hash the remaining 32 here
+ ADDQ 480(SI), R10
+ ADCQ 488(SI), R11
+ ADCQ $0x01, R12
+ MOVQ (BP), DX
+ MOVQ DX, R15
+ MULXQ R10, R13, R14
+ IMULQ R12, R15
+ MULXQ R11, AX, DX
+ ADDQ AX, R14
+ ADCQ DX, R15
+ MOVQ 8(BP), DX
+ MULXQ R10, R10, AX
+ ADDQ R10, R14
+ MULXQ R11, R11, R8
+ ADCQ R11, R15
+ ADCQ $0x00, R8
+ IMULQ R12, DX
+ ADDQ AX, R15
+ ADCQ DX, R8
+ MOVQ R13, R10
+ MOVQ R14, R11
+ MOVQ R15, R12
+ ANDQ $0x03, R12
+ MOVQ R15, R13
+ ANDQ $-4, R13
+ MOVQ R8, R14
+ SHRQ $0x02, R8, R15
+ SHRQ $0x02, R8
+ ADDQ R13, R10
+ ADCQ R14, R11
+ ADCQ $0x00, R12
+ ADDQ R15, R10
+ ADCQ R8, R11
+ ADCQ $0x00, R12
+ VPERM2I128 $0x02, Y0, Y14, Y15
+ VPERM2I128 $0x13, Y0, Y14, Y14
+ VPERM2I128 $0x02, Y12, Y4, Y0
+ VPERM2I128 $0x13, Y12, Y4, Y12
+ VPXOR (SI), Y15, Y15
+ VPXOR 32(SI), Y0, Y0
+ VPXOR 64(SI), Y14, Y14
+ VPXOR 96(SI), Y12, Y12
+ VMOVDQU Y15, (DI)
+ VMOVDQU Y0, 32(DI)
+ VMOVDQU Y14, 64(DI)
+ VMOVDQU Y12, 96(DI)
VPERM2I128 $0x02, Y5, Y9, Y0
VPERM2I128 $0x02, Y13, Y1, Y14
VPERM2I128 $0x13, Y5, Y9, Y12
VPERM2I128 $0x13, Y13, Y1, Y4
- VPXOR (SI), Y6, Y6
- VPXOR 32(SI), Y10, Y10
- VPXOR 64(SI), Y8, Y8
- VPXOR 96(SI), Y2, Y2
- VMOVDQU Y6, (DI)
- VMOVDQU Y10, 32(DI)
- VMOVDQU Y8, 64(DI)
- VMOVDQU Y2, 96(DI)
- LEAQ 128(SI), SI
- LEAQ 128(DI), DI
- SUBQ $0x80, BX
- JMP openAVX2TailLoop
+ VPXOR 128(SI), Y0, Y0
+ VPXOR 160(SI), Y14, Y14
+ VPXOR 192(SI), Y12, Y12
+ VPXOR 224(SI), Y4, Y4
+ VMOVDQU Y0, 128(DI)
+ VMOVDQU Y14, 160(DI)
+ VMOVDQU Y12, 192(DI)
+ VMOVDQU Y4, 224(DI)
-openAVX2Tail384:
- // Need to decrypt up to 384 bytes - prepare six blocks
- VMOVDQA ·chacha20Constants<>+0(SB), Y0
- VMOVDQA Y0, Y5
- VMOVDQA Y0, Y6
- VMOVDQA 32(BP), Y14
- VMOVDQA Y14, Y9
- VMOVDQA Y14, Y10
- VMOVDQA 64(BP), Y12
- VMOVDQA Y12, Y13
- VMOVDQA Y12, Y8
- VMOVDQA 192(BP), Y4
- VPADDD ·avx2IncMask<>+0(SB), Y4, Y4
- VPADDD ·avx2IncMask<>+0(SB), Y4, Y1
- VPADDD ·avx2IncMask<>+0(SB), Y1, Y2
- VMOVDQA Y4, 96(BP)
- VMOVDQA Y1, 128(BP)
- VMOVDQA Y2, 160(BP)
+ // and here
+ ADDQ 496(SI), R10
+ ADCQ 504(SI), R11
+ ADCQ $0x01, R12
+ MOVQ (BP), DX
+ MOVQ DX, R15
+ MULXQ R10, R13, R14
+ IMULQ R12, R15
+ MULXQ R11, AX, DX
+ ADDQ AX, R14
+ ADCQ DX, R15
+ MOVQ 8(BP), DX
+ MULXQ R10, R10, AX
+ ADDQ R10, R14
+ MULXQ R11, R11, R8
+ ADCQ R11, R15
+ ADCQ $0x00, R8
+ IMULQ R12, DX
+ ADDQ AX, R15
+ ADCQ DX, R8
+ MOVQ R13, R10
+ MOVQ R14, R11
+ MOVQ R15, R12
+ ANDQ $0x03, R12
+ MOVQ R15, R13
+ ANDQ $-4, R13
+ MOVQ R8, R14
+ SHRQ $0x02, R8, R15
+ SHRQ $0x02, R8
+ ADDQ R13, R10
+ ADCQ R14, R11
+ ADCQ $0x00, R12
+ ADDQ R15, R10
+ ADCQ R8, R11
+ ADCQ $0x00, R12
+ VPERM2I128 $0x02, Y6, Y10, Y0
+ VPERM2I128 $0x02, Y8, Y2, Y14
+ VPERM2I128 $0x13, Y6, Y10, Y12
+ VPERM2I128 $0x13, Y8, Y2, Y4
+ VPXOR 256(SI), Y0, Y0
+ VPXOR 288(SI), Y14, Y14
+ VPXOR 320(SI), Y12, Y12
+ VPXOR 352(SI), Y4, Y4
+ VMOVDQU Y0, 256(DI)
+ VMOVDQU Y14, 288(DI)
+ VMOVDQU Y12, 320(DI)
+ VMOVDQU Y4, 352(DI)
+ VPERM2I128 $0x02, Y7, Y11, Y0
+ VPERM2I128 $0x02, 224(BP), Y3, Y14
+ VPERM2I128 $0x13, Y7, Y11, Y12
+ VPERM2I128 $0x13, 224(BP), Y3, Y4
+ VPXOR 384(SI), Y0, Y0
+ VPXOR 416(SI), Y14, Y14
+ VPXOR 448(SI), Y12, Y12
+ VPXOR 480(SI), Y4, Y4
+ VMOVDQU Y0, 384(DI)
+ VMOVDQU Y14, 416(DI)
+ VMOVDQU Y12, 448(DI)
+ VMOVDQU Y4, 480(DI)
+ LEAQ 512(SI), SI
+ LEAQ 512(DI), DI
+ SUBQ $0x00000200, BX
+ JMP openAVX2MainLoop
- // Compute the number of iterations that will hash two blocks of data
- MOVQ BX, 224(BP)
- MOVQ BX, CX
- SUBQ $0x00000100, CX
- SHRQ $0x04, CX
- ADDQ $0x06, CX
- MOVQ $0x0000000a, R9
- CMPQ CX, $0x0a
- CMOVQGT R9, CX
- MOVQ SI, BX
- XORQ R9, R9
+openAVX2MainLoopDone:
+ // Handle the various tail sizes efficiently
+ TESTQ BX, BX
+ JE openSSEFinalize
+ CMPQ BX, $0x80
+ JBE openAVX2Tail128
+ CMPQ BX, $0x00000100
+ JBE openAVX2Tail256
+ CMPQ BX, $0x00000180
+ JBE openAVX2Tail384
+ JMP openAVX2Tail512
-openAVX2Tail384LoopB:
- ADDQ (BX), R10
- ADCQ 8(BX), R11
+openSSEFinalize:
+ // Hash in the PT, AAD lengths
+ ADDQ ad_len+80(FP), R10
+ ADCQ src_len+56(FP), R11
ADCQ $0x01, R12
- MOVQ (BP), DX
- MOVQ DX, R15
- MULXQ R10, R13, R14
+ MOVQ (BP), AX
+ MOVQ AX, R15
+ MULQ R10
+ MOVQ AX, R13
+ MOVQ DX, R14
+ MOVQ (BP), AX
+ MULQ R11
IMULQ R12, R15
- MULXQ R11, AX, DX
ADDQ AX, R14
ADCQ DX, R15
- MOVQ 8(BP), DX
- MULXQ R10, R10, AX
- ADDQ R10, R14
- MULXQ R11, R11, R8
- ADCQ R11, R15
- ADCQ $0x00, R8
- IMULQ R12, DX
+ MOVQ 8(BP), AX
+ MOVQ AX, R8
+ MULQ R10
+ ADDQ AX, R14
+ ADCQ $0x00, DX
+ MOVQ DX, R10
+ MOVQ 8(BP), AX
+ MULQ R11
ADDQ AX, R15
+ ADCQ $0x00, DX
+ IMULQ R12, R8
+ ADDQ R10, R15
ADCQ DX, R8
MOVQ R13, R10
MOVQ R14, R11
@@ -4075,174 +797,261 @@ openAVX2Tail384LoopB:
ADDQ R15, R10
ADCQ R8, R11
ADCQ $0x00, R12
- LEAQ 16(BX), BX
-openAVX2Tail384LoopA:
- VPADDD Y14, Y0, Y0
- VPXOR Y0, Y4, Y4
- VPSHUFB ·rol16<>+0(SB), Y4, Y4
- VPADDD Y4, Y12, Y12
- VPXOR Y12, Y14, Y14
- VPSLLD $0x0c, Y14, Y3
- VPSRLD $0x14, Y14, Y14
- VPXOR Y3, Y14, Y14
- VPADDD Y14, Y0, Y0
- VPXOR Y0, Y4, Y4
- VPSHUFB ·rol8<>+0(SB), Y4, Y4
- VPADDD Y4, Y12, Y12
- VPXOR Y12, Y14, Y14
- VPSLLD $0x07, Y14, Y3
- VPSRLD $0x19, Y14, Y14
- VPXOR Y3, Y14, Y14
- VPADDD Y9, Y5, Y5
- VPXOR Y5, Y1, Y1
- VPSHUFB ·rol16<>+0(SB), Y1, Y1
- VPADDD Y1, Y13, Y13
- VPXOR Y13, Y9, Y9
- VPSLLD $0x0c, Y9, Y3
- VPSRLD $0x14, Y9, Y9
- VPXOR Y3, Y9, Y9
- VPADDD Y9, Y5, Y5
- VPXOR Y5, Y1, Y1
- VPSHUFB ·rol8<>+0(SB), Y1, Y1
- VPADDD Y1, Y13, Y13
- VPXOR Y13, Y9, Y9
- VPSLLD $0x07, Y9, Y3
- VPSRLD $0x19, Y9, Y9
- VPXOR Y3, Y9, Y9
- VPADDD Y10, Y6, Y6
- VPXOR Y6, Y2, Y2
- VPSHUFB ·rol16<>+0(SB), Y2, Y2
- VPADDD Y2, Y8, Y8
- VPXOR Y8, Y10, Y10
- VPSLLD $0x0c, Y10, Y3
- VPSRLD $0x14, Y10, Y10
- VPXOR Y3, Y10, Y10
- VPADDD Y10, Y6, Y6
- VPXOR Y6, Y2, Y2
- VPSHUFB ·rol8<>+0(SB), Y2, Y2
- VPADDD Y2, Y8, Y8
- VPXOR Y8, Y10, Y10
- VPSLLD $0x07, Y10, Y3
- VPSRLD $0x19, Y10, Y10
- VPXOR Y3, Y10, Y10
- VPALIGNR $0x04, Y14, Y14, Y14
- VPALIGNR $0x04, Y9, Y9, Y9
- VPALIGNR $0x04, Y10, Y10, Y10
- VPALIGNR $0x08, Y12, Y12, Y12
- VPALIGNR $0x08, Y13, Y13, Y13
- VPALIGNR $0x08, Y8, Y8, Y8
- VPALIGNR $0x0c, Y4, Y4, Y4
- VPALIGNR $0x0c, Y1, Y1, Y1
- VPALIGNR $0x0c, Y2, Y2, Y2
- ADDQ (BX), R10
- ADCQ 8(BX), R11
- ADCQ $0x01, R12
- MOVQ (BP), DX
- MOVQ DX, R15
- MULXQ R10, R13, R14
- IMULQ R12, R15
- MULXQ R11, AX, DX
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), DX
- MULXQ R10, R10, AX
- ADDQ R10, R14
- MULXQ R11, R11, R8
- ADCQ R11, R15
- ADCQ $0x00, R8
- IMULQ R12, DX
- ADDQ AX, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- LEAQ 16(BX), BX
- INCQ R9
- VPADDD Y14, Y0, Y0
- VPXOR Y0, Y4, Y4
- VPSHUFB ·rol16<>+0(SB), Y4, Y4
- VPADDD Y4, Y12, Y12
- VPXOR Y12, Y14, Y14
- VPSLLD $0x0c, Y14, Y3
- VPSRLD $0x14, Y14, Y14
- VPXOR Y3, Y14, Y14
- VPADDD Y14, Y0, Y0
- VPXOR Y0, Y4, Y4
- VPSHUFB ·rol8<>+0(SB), Y4, Y4
- VPADDD Y4, Y12, Y12
- VPXOR Y12, Y14, Y14
- VPSLLD $0x07, Y14, Y3
- VPSRLD $0x19, Y14, Y14
- VPXOR Y3, Y14, Y14
- VPADDD Y9, Y5, Y5
- VPXOR Y5, Y1, Y1
- VPSHUFB ·rol16<>+0(SB), Y1, Y1
- VPADDD Y1, Y13, Y13
- VPXOR Y13, Y9, Y9
- VPSLLD $0x0c, Y9, Y3
- VPSRLD $0x14, Y9, Y9
- VPXOR Y3, Y9, Y9
- VPADDD Y9, Y5, Y5
- VPXOR Y5, Y1, Y1
- VPSHUFB ·rol8<>+0(SB), Y1, Y1
- VPADDD Y1, Y13, Y13
- VPXOR Y13, Y9, Y9
- VPSLLD $0x07, Y9, Y3
- VPSRLD $0x19, Y9, Y9
- VPXOR Y3, Y9, Y9
- VPADDD Y10, Y6, Y6
- VPXOR Y6, Y2, Y2
- VPSHUFB ·rol16<>+0(SB), Y2, Y2
- VPADDD Y2, Y8, Y8
- VPXOR Y8, Y10, Y10
- VPSLLD $0x0c, Y10, Y3
- VPSRLD $0x14, Y10, Y10
- VPXOR Y3, Y10, Y10
- VPADDD Y10, Y6, Y6
- VPXOR Y6, Y2, Y2
- VPSHUFB ·rol8<>+0(SB), Y2, Y2
- VPADDD Y2, Y8, Y8
- VPXOR Y8, Y10, Y10
- VPSLLD $0x07, Y10, Y3
- VPSRLD $0x19, Y10, Y10
- VPXOR Y3, Y10, Y10
- VPALIGNR $0x0c, Y14, Y14, Y14
- VPALIGNR $0x0c, Y9, Y9, Y9
- VPALIGNR $0x0c, Y10, Y10, Y10
- VPALIGNR $0x08, Y12, Y12, Y12
- VPALIGNR $0x08, Y13, Y13, Y13
- VPALIGNR $0x08, Y8, Y8, Y8
- VPALIGNR $0x04, Y4, Y4, Y4
- VPALIGNR $0x04, Y1, Y1, Y1
- VPALIGNR $0x04, Y2, Y2, Y2
- CMPQ R9, CX
- JB openAVX2Tail384LoopB
- CMPQ R9, $0x0a
- JNE openAVX2Tail384LoopA
- MOVQ BX, R9
- SUBQ SI, BX
- MOVQ BX, CX
- MOVQ 224(BP), BX
+ // Final reduce
+ MOVQ R10, R13
+ MOVQ R11, R14
+ MOVQ R12, R15
+ SUBQ $-5, R10
+ SBBQ $-1, R11
+ SBBQ $0x03, R12
+ CMOVQCS R13, R10
+ CMOVQCS R14, R11
+ CMOVQCS R15, R12
+
+ // Add in the "s" part of the key
+ ADDQ 16(BP), R10
+ ADCQ 24(BP), R11
+
+ // Finally, constant time compare to the tag at the end of the message
+ XORQ AX, AX
+ MOVQ $0x00000001, DX
+ XORQ (SI), R10
+ XORQ 8(SI), R11
+ ORQ R11, R10
+ CMOVQEQ DX, AX
+
+ // Return true iff tags are equal
+ MOVB AX, ret+96(FP)
+ RET
+
+openSSETail16:
+ TESTQ BX, BX
+ JE openSSEFinalize
+
+ // We can safely load the CT from the end, because it is padded with the MAC
+ MOVQ BX, R9
+ SHLQ $0x04, R9
+ LEAQ ·andMask<>+0(SB), R13
+ MOVOU (SI), X12
+ ADDQ BX, SI
+ PAND -16(R13)(R9*1), X12
+ MOVO X12, 64(BP)
+ MOVQ X12, R13
+ MOVQ 72(BP), R14
+ PXOR X1, X12
+
+ // We can only store one byte at a time, since plaintext can be shorter than 16 bytes
+openSSETail16Store:
+ MOVQ X12, R8
+ MOVB R8, (DI)
+ PSRLDQ $0x01, X12
+ INCQ DI
+ DECQ BX
+ JNE openSSETail16Store
+ ADDQ R13, R10
+ ADCQ R14, R11
+ ADCQ $0x01, R12
+ MOVQ (BP), AX
+ MOVQ AX, R15
+ MULQ R10
+ MOVQ AX, R13
+ MOVQ DX, R14
+ MOVQ (BP), AX
+ MULQ R11
+ IMULQ R12, R15
+ ADDQ AX, R14
+ ADCQ DX, R15
+ MOVQ 8(BP), AX
+ MOVQ AX, R8
+ MULQ R10
+ ADDQ AX, R14
+ ADCQ $0x00, DX
+ MOVQ DX, R10
+ MOVQ 8(BP), AX
+ MULQ R11
+ ADDQ AX, R15
+ ADCQ $0x00, DX
+ IMULQ R12, R8
+ ADDQ R10, R15
+ ADCQ DX, R8
+ MOVQ R13, R10
+ MOVQ R14, R11
+ MOVQ R15, R12
+ ANDQ $0x03, R12
+ MOVQ R15, R13
+ ANDQ $-4, R13
+ MOVQ R8, R14
+ SHRQ $0x02, R8, R15
+ SHRQ $0x02, R8
+ ADDQ R13, R10
+ ADCQ R14, R11
+ ADCQ $0x00, R12
+ ADDQ R15, R10
+ ADCQ R8, R11
+ ADCQ $0x00, R12
+ JMP openSSEFinalize
-openAVX2Tail384Hash:
- ADDQ $0x10, CX
- CMPQ CX, BX
- JGT openAVX2Tail384HashEnd
- ADDQ (R9), R10
- ADCQ 8(R9), R11
+openAVX2192:
+ VMOVDQA Y0, Y5
+ VMOVDQA Y14, Y9
+ VMOVDQA Y12, Y13
+ VPADDD ·avx2IncMask<>+0(SB), Y4, Y1
+ VMOVDQA Y0, Y6
+ VMOVDQA Y14, Y10
+ VMOVDQA Y12, Y8
+ VMOVDQA Y4, Y2
+ VMOVDQA Y1, Y15
+ MOVQ $0x0000000a, R9
+
+openAVX2192InnerCipherLoop:
+ VPADDD Y14, Y0, Y0
+ VPXOR Y0, Y4, Y4
+ VPSHUFB ·rol16<>+0(SB), Y4, Y4
+ VPADDD Y4, Y12, Y12
+ VPXOR Y12, Y14, Y14
+ VPSLLD $0x0c, Y14, Y3
+ VPSRLD $0x14, Y14, Y14
+ VPXOR Y3, Y14, Y14
+ VPADDD Y14, Y0, Y0
+ VPXOR Y0, Y4, Y4
+ VPSHUFB ·rol8<>+0(SB), Y4, Y4
+ VPADDD Y4, Y12, Y12
+ VPXOR Y12, Y14, Y14
+ VPSLLD $0x07, Y14, Y3
+ VPSRLD $0x19, Y14, Y14
+ VPXOR Y3, Y14, Y14
+ VPADDD Y9, Y5, Y5
+ VPXOR Y5, Y1, Y1
+ VPSHUFB ·rol16<>+0(SB), Y1, Y1
+ VPADDD Y1, Y13, Y13
+ VPXOR Y13, Y9, Y9
+ VPSLLD $0x0c, Y9, Y3
+ VPSRLD $0x14, Y9, Y9
+ VPXOR Y3, Y9, Y9
+ VPADDD Y9, Y5, Y5
+ VPXOR Y5, Y1, Y1
+ VPSHUFB ·rol8<>+0(SB), Y1, Y1
+ VPADDD Y1, Y13, Y13
+ VPXOR Y13, Y9, Y9
+ VPSLLD $0x07, Y9, Y3
+ VPSRLD $0x19, Y9, Y9
+ VPXOR Y3, Y9, Y9
+ VPALIGNR $0x04, Y14, Y14, Y14
+ VPALIGNR $0x04, Y9, Y9, Y9
+ VPALIGNR $0x08, Y12, Y12, Y12
+ VPALIGNR $0x08, Y13, Y13, Y13
+ VPALIGNR $0x0c, Y4, Y4, Y4
+ VPALIGNR $0x0c, Y1, Y1, Y1
+ VPADDD Y14, Y0, Y0
+ VPXOR Y0, Y4, Y4
+ VPSHUFB ·rol16<>+0(SB), Y4, Y4
+ VPADDD Y4, Y12, Y12
+ VPXOR Y12, Y14, Y14
+ VPSLLD $0x0c, Y14, Y3
+ VPSRLD $0x14, Y14, Y14
+ VPXOR Y3, Y14, Y14
+ VPADDD Y14, Y0, Y0
+ VPXOR Y0, Y4, Y4
+ VPSHUFB ·rol8<>+0(SB), Y4, Y4
+ VPADDD Y4, Y12, Y12
+ VPXOR Y12, Y14, Y14
+ VPSLLD $0x07, Y14, Y3
+ VPSRLD $0x19, Y14, Y14
+ VPXOR Y3, Y14, Y14
+ VPADDD Y9, Y5, Y5
+ VPXOR Y5, Y1, Y1
+ VPSHUFB ·rol16<>+0(SB), Y1, Y1
+ VPADDD Y1, Y13, Y13
+ VPXOR Y13, Y9, Y9
+ VPSLLD $0x0c, Y9, Y3
+ VPSRLD $0x14, Y9, Y9
+ VPXOR Y3, Y9, Y9
+ VPADDD Y9, Y5, Y5
+ VPXOR Y5, Y1, Y1
+ VPSHUFB ·rol8<>+0(SB), Y1, Y1
+ VPADDD Y1, Y13, Y13
+ VPXOR Y13, Y9, Y9
+ VPSLLD $0x07, Y9, Y3
+ VPSRLD $0x19, Y9, Y9
+ VPXOR Y3, Y9, Y9
+ VPALIGNR $0x0c, Y14, Y14, Y14
+ VPALIGNR $0x0c, Y9, Y9, Y9
+ VPALIGNR $0x08, Y12, Y12, Y12
+ VPALIGNR $0x08, Y13, Y13, Y13
+ VPALIGNR $0x04, Y4, Y4, Y4
+ VPALIGNR $0x04, Y1, Y1, Y1
+ DECQ R9
+ JNE openAVX2192InnerCipherLoop
+ VPADDD Y6, Y0, Y0
+ VPADDD Y6, Y5, Y5
+ VPADDD Y10, Y14, Y14
+ VPADDD Y10, Y9, Y9
+ VPADDD Y8, Y12, Y12
+ VPADDD Y8, Y13, Y13
+ VPADDD Y2, Y4, Y4
+ VPADDD Y15, Y1, Y1
+ VPERM2I128 $0x02, Y0, Y14, Y3
+
+ // Clamp and store poly key
+ VPAND ·polyClampMask<>+0(SB), Y3, Y3
+ VMOVDQA Y3, (BP)
+
+ // Stream for up to 192 bytes
+ VPERM2I128 $0x13, Y0, Y14, Y0
+ VPERM2I128 $0x13, Y12, Y4, Y14
+ VPERM2I128 $0x02, Y5, Y9, Y12
+ VPERM2I128 $0x02, Y13, Y1, Y4
+ VPERM2I128 $0x13, Y5, Y9, Y5
+ VPERM2I128 $0x13, Y13, Y1, Y9
+
+openAVX2ShortOpen:
+ // Hash
+ MOVQ ad_len+80(FP), R9
+ CALL polyHashADInternal<>(SB)
+
+openAVX2ShortOpenLoop:
+ CMPQ BX, $0x20
+ JB openAVX2ShortTail32
+ SUBQ $0x20, BX
+
+ // Load for hashing
+ ADDQ (SI), R10
+ ADCQ 8(SI), R11
+ ADCQ $0x01, R12
+ MOVQ (BP), DX
+ MOVQ DX, R15
+ MULXQ R10, R13, R14
+ IMULQ R12, R15
+ MULXQ R11, AX, DX
+ ADDQ AX, R14
+ ADCQ DX, R15
+ MOVQ 8(BP), DX
+ MULXQ R10, R10, AX
+ ADDQ R10, R14
+ MULXQ R11, R11, R8
+ ADCQ R11, R15
+ ADCQ $0x00, R8
+ IMULQ R12, DX
+ ADDQ AX, R15
+ ADCQ DX, R8
+ MOVQ R13, R10
+ MOVQ R14, R11
+ MOVQ R15, R12
+ ANDQ $0x03, R12
+ MOVQ R15, R13
+ ANDQ $-4, R13
+ MOVQ R8, R14
+ SHRQ $0x02, R8, R15
+ SHRQ $0x02, R8
+ ADDQ R13, R10
+ ADCQ R14, R11
+ ADCQ $0x00, R12
+ ADDQ R15, R10
+ ADCQ R8, R11
+ ADCQ $0x00, R12
+ ADDQ 16(SI), R10
+ ADCQ 24(SI), R11
ADCQ $0x01, R12
MOVQ (BP), DX
MOVQ DX, R15
@@ -4275,83 +1084,34 @@ openAVX2Tail384Hash:
ADDQ R15, R10
ADCQ R8, R11
ADCQ $0x00, R12
- LEAQ 16(R9), R9
- JMP openAVX2Tail384Hash
-openAVX2Tail384HashEnd:
- VPADDD ·chacha20Constants<>+0(SB), Y0, Y0
- VPADDD ·chacha20Constants<>+0(SB), Y5, Y5
- VPADDD ·chacha20Constants<>+0(SB), Y6, Y6
- VPADDD 32(BP), Y14, Y14
- VPADDD 32(BP), Y9, Y9
- VPADDD 32(BP), Y10, Y10
- VPADDD 64(BP), Y12, Y12
- VPADDD 64(BP), Y13, Y13
- VPADDD 64(BP), Y8, Y8
- VPADDD 96(BP), Y4, Y4
- VPADDD 128(BP), Y1, Y1
- VPADDD 160(BP), Y2, Y2
- VPERM2I128 $0x02, Y0, Y14, Y3
- VPERM2I128 $0x02, Y12, Y4, Y7
- VPERM2I128 $0x13, Y0, Y14, Y11
- VPERM2I128 $0x13, Y12, Y4, Y15
- VPXOR (SI), Y3, Y3
- VPXOR 32(SI), Y7, Y7
- VPXOR 64(SI), Y11, Y11
- VPXOR 96(SI), Y15, Y15
- VMOVDQU Y3, (DI)
- VMOVDQU Y7, 32(DI)
- VMOVDQU Y11, 64(DI)
- VMOVDQU Y15, 96(DI)
- VPERM2I128 $0x02, Y5, Y9, Y3
- VPERM2I128 $0x02, Y13, Y1, Y7
- VPERM2I128 $0x13, Y5, Y9, Y11
- VPERM2I128 $0x13, Y13, Y1, Y15
- VPXOR 128(SI), Y3, Y3
- VPXOR 160(SI), Y7, Y7
- VPXOR 192(SI), Y11, Y11
- VPXOR 224(SI), Y15, Y15
- VMOVDQU Y3, 128(DI)
- VMOVDQU Y7, 160(DI)
- VMOVDQU Y11, 192(DI)
- VMOVDQU Y15, 224(DI)
- VPERM2I128 $0x02, Y6, Y10, Y0
- VPERM2I128 $0x02, Y8, Y2, Y14
- VPERM2I128 $0x13, Y6, Y10, Y12
- VPERM2I128 $0x13, Y8, Y2, Y4
- LEAQ 256(SI), SI
- LEAQ 256(DI), DI
- SUBQ $0x00000100, BX
- JMP openAVX2TailLoop
+ // Load for decryption
+ VPXOR (SI), Y0, Y0
+ VMOVDQU Y0, (DI)
+ LEAQ 32(SI), SI
+ LEAQ 32(DI), DI
-openAVX2Tail512:
- VMOVDQU ·chacha20Constants<>+0(SB), Y0
- VMOVDQA Y0, Y5
- VMOVDQA Y0, Y6
- VMOVDQA Y0, Y7
- VMOVDQA 32(BP), Y14
- VMOVDQA Y14, Y9
- VMOVDQA Y14, Y10
- VMOVDQA Y14, Y11
- VMOVDQA 64(BP), Y12
- VMOVDQA Y12, Y13
- VMOVDQA Y12, Y8
- VMOVDQA Y12, Y15
- VMOVDQA 192(BP), Y4
- VPADDD ·avx2IncMask<>+0(SB), Y4, Y4
- VPADDD ·avx2IncMask<>+0(SB), Y4, Y1
- VPADDD ·avx2IncMask<>+0(SB), Y1, Y2
- VPADDD ·avx2IncMask<>+0(SB), Y2, Y3
- VMOVDQA Y4, 96(BP)
- VMOVDQA Y1, 128(BP)
- VMOVDQA Y2, 160(BP)
- VMOVDQA Y3, 192(BP)
- XORQ CX, CX
- MOVQ SI, R9
+ // Shift stream left
+ VMOVDQA Y14, Y0
+ VMOVDQA Y12, Y14
+ VMOVDQA Y4, Y12
+ VMOVDQA Y5, Y4
+ VMOVDQA Y9, Y5
+ VMOVDQA Y13, Y9
+ VMOVDQA Y1, Y13
+ VMOVDQA Y6, Y1
+ VMOVDQA Y10, Y6
+ JMP openAVX2ShortOpenLoop
+
+openAVX2ShortTail32:
+ CMPQ BX, $0x10
+ VMOVDQA X0, X1
+ JB openAVX2ShortDone
+ SUBQ $0x10, BX
-openAVX2Tail512LoopB:
- ADDQ (R9), R10
- ADCQ 8(R9), R11
+ // Load for hashing
+ ADDQ (SI), R10
+ ADCQ 8(SI), R11
ADCQ $0x01, R12
MOVQ (BP), DX
MOVQ DX, R15
@@ -4384,252 +1144,202 @@ openAVX2Tail512LoopB:
ADDQ R15, R10
ADCQ R8, R11
ADCQ $0x00, R12
- LEAQ 16(R9), R9
-openAVX2Tail512LoopA:
+ // Load for decryption
+ VPXOR (SI), X0, X12
+ VMOVDQU X12, (DI)
+ LEAQ 16(SI), SI
+ LEAQ 16(DI), DI
+ VPERM2I128 $0x11, Y0, Y0, Y0
+ VMOVDQA X0, X1
+
+openAVX2ShortDone:
+ VZEROUPPER
+ JMP openSSETail16
+
+openAVX2320:
+ VMOVDQA Y0, Y5
+ VMOVDQA Y14, Y9
+ VMOVDQA Y12, Y13
+ VPADDD ·avx2IncMask<>+0(SB), Y4, Y1
+ VMOVDQA Y0, Y6
+ VMOVDQA Y14, Y10
+ VMOVDQA Y12, Y8
+ VPADDD ·avx2IncMask<>+0(SB), Y1, Y2
+ VMOVDQA Y14, Y7
+ VMOVDQA Y12, Y11
+ VMOVDQA Y4, Y15
+ MOVQ $0x0000000a, R9
+
+openAVX2320InnerCipherLoop:
VPADDD Y14, Y0, Y0
- VPADDD Y9, Y5, Y5
- VPADDD Y10, Y6, Y6
- VPADDD Y11, Y7, Y7
VPXOR Y0, Y4, Y4
- VPXOR Y5, Y1, Y1
- VPXOR Y6, Y2, Y2
- VPXOR Y7, Y3, Y3
VPSHUFB ·rol16<>+0(SB), Y4, Y4
- VPSHUFB ·rol16<>+0(SB), Y1, Y1
- VPSHUFB ·rol16<>+0(SB), Y2, Y2
- VPSHUFB ·rol16<>+0(SB), Y3, Y3
VPADDD Y4, Y12, Y12
- VPADDD Y1, Y13, Y13
- VPADDD Y2, Y8, Y8
- VPADDD Y3, Y15, Y15
VPXOR Y12, Y14, Y14
- VPXOR Y13, Y9, Y9
- VPXOR Y8, Y10, Y10
- VPXOR Y15, Y11, Y11
- VMOVDQA Y15, 224(BP)
- VPSLLD $0x0c, Y14, Y15
+ VPSLLD $0x0c, Y14, Y3
VPSRLD $0x14, Y14, Y14
- VPXOR Y15, Y14, Y14
- VPSLLD $0x0c, Y9, Y15
- VPSRLD $0x14, Y9, Y9
- VPXOR Y15, Y9, Y9
- VPSLLD $0x0c, Y10, Y15
- VPSRLD $0x14, Y10, Y10
- VPXOR Y15, Y10, Y10
- VPSLLD $0x0c, Y11, Y15
- VPSRLD $0x14, Y11, Y11
- VPXOR Y15, Y11, Y11
- VMOVDQA 224(BP), Y15
- ADDQ (R9), R10
- ADCQ 8(R9), R11
- ADCQ $0x01, R12
- MOVQ (BP), DX
- MOVQ DX, R15
- MULXQ R10, R13, R14
- IMULQ R12, R15
- MULXQ R11, AX, DX
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), DX
- MULXQ R10, R10, AX
- ADDQ R10, R14
- MULXQ R11, R11, R8
- ADCQ R11, R15
- ADCQ $0x00, R8
- IMULQ R12, DX
- ADDQ AX, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
+ VPXOR Y3, Y14, Y14
VPADDD Y14, Y0, Y0
- VPADDD Y9, Y5, Y5
- VPADDD Y10, Y6, Y6
- VPADDD Y11, Y7, Y7
VPXOR Y0, Y4, Y4
- VPXOR Y5, Y1, Y1
- VPXOR Y6, Y2, Y2
- VPXOR Y7, Y3, Y3
VPSHUFB ·rol8<>+0(SB), Y4, Y4
- VPSHUFB ·rol8<>+0(SB), Y1, Y1
- VPSHUFB ·rol8<>+0(SB), Y2, Y2
- VPSHUFB ·rol8<>+0(SB), Y3, Y3
VPADDD Y4, Y12, Y12
- VPADDD Y1, Y13, Y13
- VPADDD Y2, Y8, Y8
- VPADDD Y3, Y15, Y15
VPXOR Y12, Y14, Y14
- VPXOR Y13, Y9, Y9
- VPXOR Y8, Y10, Y10
- VPXOR Y15, Y11, Y11
- VMOVDQA Y15, 224(BP)
- VPSLLD $0x07, Y14, Y15
+ VPSLLD $0x07, Y14, Y3
VPSRLD $0x19, Y14, Y14
- VPXOR Y15, Y14, Y14
- VPSLLD $0x07, Y9, Y15
+ VPXOR Y3, Y14, Y14
+ VPADDD Y9, Y5, Y5
+ VPXOR Y5, Y1, Y1
+ VPSHUFB ·rol16<>+0(SB), Y1, Y1
+ VPADDD Y1, Y13, Y13
+ VPXOR Y13, Y9, Y9
+ VPSLLD $0x0c, Y9, Y3
+ VPSRLD $0x14, Y9, Y9
+ VPXOR Y3, Y9, Y9
+ VPADDD Y9, Y5, Y5
+ VPXOR Y5, Y1, Y1
+ VPSHUFB ·rol8<>+0(SB), Y1, Y1
+ VPADDD Y1, Y13, Y13
+ VPXOR Y13, Y9, Y9
+ VPSLLD $0x07, Y9, Y3
VPSRLD $0x19, Y9, Y9
- VPXOR Y15, Y9, Y9
- VPSLLD $0x07, Y10, Y15
+ VPXOR Y3, Y9, Y9
+ VPADDD Y10, Y6, Y6
+ VPXOR Y6, Y2, Y2
+ VPSHUFB ·rol16<>+0(SB), Y2, Y2
+ VPADDD Y2, Y8, Y8
+ VPXOR Y8, Y10, Y10
+ VPSLLD $0x0c, Y10, Y3
+ VPSRLD $0x14, Y10, Y10
+ VPXOR Y3, Y10, Y10
+ VPADDD Y10, Y6, Y6
+ VPXOR Y6, Y2, Y2
+ VPSHUFB ·rol8<>+0(SB), Y2, Y2
+ VPADDD Y2, Y8, Y8
+ VPXOR Y8, Y10, Y10
+ VPSLLD $0x07, Y10, Y3
VPSRLD $0x19, Y10, Y10
- VPXOR Y15, Y10, Y10
- VPSLLD $0x07, Y11, Y15
- VPSRLD $0x19, Y11, Y11
- VPXOR Y15, Y11, Y11
- VMOVDQA 224(BP), Y15
+ VPXOR Y3, Y10, Y10
VPALIGNR $0x04, Y14, Y14, Y14
VPALIGNR $0x04, Y9, Y9, Y9
VPALIGNR $0x04, Y10, Y10, Y10
- VPALIGNR $0x04, Y11, Y11, Y11
VPALIGNR $0x08, Y12, Y12, Y12
VPALIGNR $0x08, Y13, Y13, Y13
VPALIGNR $0x08, Y8, Y8, Y8
- VPALIGNR $0x08, Y15, Y15, Y15
VPALIGNR $0x0c, Y4, Y4, Y4
VPALIGNR $0x0c, Y1, Y1, Y1
VPALIGNR $0x0c, Y2, Y2, Y2
- VPALIGNR $0x0c, Y3, Y3, Y3
VPADDD Y14, Y0, Y0
- VPADDD Y9, Y5, Y5
- VPADDD Y10, Y6, Y6
- VPADDD Y11, Y7, Y7
VPXOR Y0, Y4, Y4
- VPXOR Y5, Y1, Y1
- VPXOR Y6, Y2, Y2
- VPXOR Y7, Y3, Y3
VPSHUFB ·rol16<>+0(SB), Y4, Y4
- VPSHUFB ·rol16<>+0(SB), Y1, Y1
- VPSHUFB ·rol16<>+0(SB), Y2, Y2
- VPSHUFB ·rol16<>+0(SB), Y3, Y3
VPADDD Y4, Y12, Y12
- VPADDD Y1, Y13, Y13
- VPADDD Y2, Y8, Y8
- VPADDD Y3, Y15, Y15
VPXOR Y12, Y14, Y14
- VPXOR Y13, Y9, Y9
- VPXOR Y8, Y10, Y10
- VPXOR Y15, Y11, Y11
- ADDQ 16(R9), R10
- ADCQ 24(R9), R11
- ADCQ $0x01, R12
- MOVQ (BP), DX
- MOVQ DX, R15
- MULXQ R10, R13, R14
- IMULQ R12, R15
- MULXQ R11, AX, DX
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), DX
- MULXQ R10, R10, AX
- ADDQ R10, R14
- MULXQ R11, R11, R8
- ADCQ R11, R15
- ADCQ $0x00, R8
- IMULQ R12, DX
- ADDQ AX, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- LEAQ 32(R9), R9
- VMOVDQA Y15, 224(BP)
- VPSLLD $0x0c, Y14, Y15
+ VPSLLD $0x0c, Y14, Y3
VPSRLD $0x14, Y14, Y14
- VPXOR Y15, Y14, Y14
- VPSLLD $0x0c, Y9, Y15
- VPSRLD $0x14, Y9, Y9
- VPXOR Y15, Y9, Y9
- VPSLLD $0x0c, Y10, Y15
- VPSRLD $0x14, Y10, Y10
- VPXOR Y15, Y10, Y10
- VPSLLD $0x0c, Y11, Y15
- VPSRLD $0x14, Y11, Y11
- VPXOR Y15, Y11, Y11
- VMOVDQA 224(BP), Y15
+ VPXOR Y3, Y14, Y14
VPADDD Y14, Y0, Y0
+ VPXOR Y0, Y4, Y4
+ VPSHUFB ·rol8<>+0(SB), Y4, Y4
+ VPADDD Y4, Y12, Y12
+ VPXOR Y12, Y14, Y14
+ VPSLLD $0x07, Y14, Y3
+ VPSRLD $0x19, Y14, Y14
+ VPXOR Y3, Y14, Y14
+ VPADDD Y9, Y5, Y5
+ VPXOR Y5, Y1, Y1
+ VPSHUFB ·rol16<>+0(SB), Y1, Y1
+ VPADDD Y1, Y13, Y13
+ VPXOR Y13, Y9, Y9
+ VPSLLD $0x0c, Y9, Y3
+ VPSRLD $0x14, Y9, Y9
+ VPXOR Y3, Y9, Y9
VPADDD Y9, Y5, Y5
+ VPXOR Y5, Y1, Y1
+ VPSHUFB ·rol8<>+0(SB), Y1, Y1
+ VPADDD Y1, Y13, Y13
+ VPXOR Y13, Y9, Y9
+ VPSLLD $0x07, Y9, Y3
+ VPSRLD $0x19, Y9, Y9
+ VPXOR Y3, Y9, Y9
+ VPADDD Y10, Y6, Y6
+ VPXOR Y6, Y2, Y2
+ VPSHUFB ·rol16<>+0(SB), Y2, Y2
+ VPADDD Y2, Y8, Y8
+ VPXOR Y8, Y10, Y10
+ VPSLLD $0x0c, Y10, Y3
+ VPSRLD $0x14, Y10, Y10
+ VPXOR Y3, Y10, Y10
VPADDD Y10, Y6, Y6
- VPADDD Y11, Y7, Y7
- VPXOR Y0, Y4, Y4
- VPXOR Y5, Y1, Y1
VPXOR Y6, Y2, Y2
- VPXOR Y7, Y3, Y3
- VPSHUFB ·rol8<>+0(SB), Y4, Y4
- VPSHUFB ·rol8<>+0(SB), Y1, Y1
VPSHUFB ·rol8<>+0(SB), Y2, Y2
- VPSHUFB ·rol8<>+0(SB), Y3, Y3
- VPADDD Y4, Y12, Y12
- VPADDD Y1, Y13, Y13
VPADDD Y2, Y8, Y8
- VPADDD Y3, Y15, Y15
- VPXOR Y12, Y14, Y14
- VPXOR Y13, Y9, Y9
VPXOR Y8, Y10, Y10
- VPXOR Y15, Y11, Y11
- VMOVDQA Y15, 224(BP)
- VPSLLD $0x07, Y14, Y15
- VPSRLD $0x19, Y14, Y14
- VPXOR Y15, Y14, Y14
- VPSLLD $0x07, Y9, Y15
- VPSRLD $0x19, Y9, Y9
- VPXOR Y15, Y9, Y9
- VPSLLD $0x07, Y10, Y15
+ VPSLLD $0x07, Y10, Y3
VPSRLD $0x19, Y10, Y10
- VPXOR Y15, Y10, Y10
- VPSLLD $0x07, Y11, Y15
- VPSRLD $0x19, Y11, Y11
- VPXOR Y15, Y11, Y11
- VMOVDQA 224(BP), Y15
+ VPXOR Y3, Y10, Y10
VPALIGNR $0x0c, Y14, Y14, Y14
VPALIGNR $0x0c, Y9, Y9, Y9
VPALIGNR $0x0c, Y10, Y10, Y10
- VPALIGNR $0x0c, Y11, Y11, Y11
VPALIGNR $0x08, Y12, Y12, Y12
VPALIGNR $0x08, Y13, Y13, Y13
VPALIGNR $0x08, Y8, Y8, Y8
- VPALIGNR $0x08, Y15, Y15, Y15
VPALIGNR $0x04, Y4, Y4, Y4
VPALIGNR $0x04, Y1, Y1, Y1
VPALIGNR $0x04, Y2, Y2, Y2
- VPALIGNR $0x04, Y3, Y3, Y3
- INCQ CX
- CMPQ CX, $0x04
- JLT openAVX2Tail512LoopB
- CMPQ CX, $0x0a
- JNE openAVX2Tail512LoopA
- MOVQ BX, CX
- SUBQ $0x00000180, CX
- ANDQ $-16, CX
+ DECQ R9
+ JNE openAVX2320InnerCipherLoop
+ VMOVDQA ·chacha20Constants<>+0(SB), Y3
+ VPADDD Y3, Y0, Y0
+ VPADDD Y3, Y5, Y5
+ VPADDD Y3, Y6, Y6
+ VPADDD Y7, Y14, Y14
+ VPADDD Y7, Y9, Y9
+ VPADDD Y7, Y10, Y10
+ VPADDD Y11, Y12, Y12
+ VPADDD Y11, Y13, Y13
+ VPADDD Y11, Y8, Y8
+ VMOVDQA ·avx2IncMask<>+0(SB), Y3
+ VPADDD Y15, Y4, Y4
+ VPADDD Y3, Y15, Y15
+ VPADDD Y15, Y1, Y1
+ VPADDD Y3, Y15, Y15
+ VPADDD Y15, Y2, Y2
-openAVX2Tail512HashLoop:
- TESTQ CX, CX
- JE openAVX2Tail512HashEnd
- ADDQ (R9), R10
- ADCQ 8(R9), R11
+ // Clamp and store poly key
+ VPERM2I128 $0x02, Y0, Y14, Y3
+ VPAND ·polyClampMask<>+0(SB), Y3, Y3
+ VMOVDQA Y3, (BP)
+
+ // Stream for up to 320 bytes
+ VPERM2I128 $0x13, Y0, Y14, Y0
+ VPERM2I128 $0x13, Y12, Y4, Y14
+ VPERM2I128 $0x02, Y5, Y9, Y12
+ VPERM2I128 $0x02, Y13, Y1, Y4
+ VPERM2I128 $0x13, Y5, Y9, Y5
+ VPERM2I128 $0x13, Y13, Y1, Y9
+ VPERM2I128 $0x02, Y6, Y10, Y13
+ VPERM2I128 $0x02, Y8, Y2, Y1
+ VPERM2I128 $0x13, Y6, Y10, Y6
+ VPERM2I128 $0x13, Y8, Y2, Y10
+ JMP openAVX2ShortOpen
+
+openAVX2Tail128:
+ // Need to decrypt up to 128 bytes - prepare two blocks
+ VMOVDQA ·chacha20Constants<>+0(SB), Y5
+ VMOVDQA 32(BP), Y9
+ VMOVDQA 64(BP), Y13
+ VMOVDQA 192(BP), Y1
+ VPADDD ·avx2IncMask<>+0(SB), Y1, Y1
+ VMOVDQA Y1, Y4
+ XORQ R9, R9
+ MOVQ BX, CX
+ ANDQ $-16, CX
+ TESTQ CX, CX
+ JE openAVX2Tail128LoopB
+
+openAVX2Tail128LoopA:
+ ADDQ (SI)(R9*1), R10
+ ADCQ 8(SI)(R9*1), R11
ADCQ $0x01, R12
MOVQ (BP), DX
MOVQ DX, R15
@@ -4662,884 +1372,137 @@ openAVX2Tail512HashLoop:
ADDQ R15, R10
ADCQ R8, R11
ADCQ $0x00, R12
- LEAQ 16(R9), R9
- SUBQ $0x10, CX
- JMP openAVX2Tail512HashLoop
-openAVX2Tail512HashEnd:
- VPADDD ·chacha20Constants<>+0(SB), Y0, Y0
+openAVX2Tail128LoopB:
+ ADDQ $0x10, R9
+ VPADDD Y9, Y5, Y5
+ VPXOR Y5, Y1, Y1
+ VPSHUFB ·rol16<>+0(SB), Y1, Y1
+ VPADDD Y1, Y13, Y13
+ VPXOR Y13, Y9, Y9
+ VPSLLD $0x0c, Y9, Y3
+ VPSRLD $0x14, Y9, Y9
+ VPXOR Y3, Y9, Y9
+ VPADDD Y9, Y5, Y5
+ VPXOR Y5, Y1, Y1
+ VPSHUFB ·rol8<>+0(SB), Y1, Y1
+ VPADDD Y1, Y13, Y13
+ VPXOR Y13, Y9, Y9
+ VPSLLD $0x07, Y9, Y3
+ VPSRLD $0x19, Y9, Y9
+ VPXOR Y3, Y9, Y9
+ VPALIGNR $0x04, Y9, Y9, Y9
+ VPALIGNR $0x08, Y13, Y13, Y13
+ VPALIGNR $0x0c, Y1, Y1, Y1
+ VPADDD Y9, Y5, Y5
+ VPXOR Y5, Y1, Y1
+ VPSHUFB ·rol16<>+0(SB), Y1, Y1
+ VPADDD Y1, Y13, Y13
+ VPXOR Y13, Y9, Y9
+ VPSLLD $0x0c, Y9, Y3
+ VPSRLD $0x14, Y9, Y9
+ VPXOR Y3, Y9, Y9
+ VPADDD Y9, Y5, Y5
+ VPXOR Y5, Y1, Y1
+ VPSHUFB ·rol8<>+0(SB), Y1, Y1
+ VPADDD Y1, Y13, Y13
+ VPXOR Y13, Y9, Y9
+ VPSLLD $0x07, Y9, Y3
+ VPSRLD $0x19, Y9, Y9
+ VPXOR Y3, Y9, Y9
+ VPALIGNR $0x0c, Y9, Y9, Y9
+ VPALIGNR $0x08, Y13, Y13, Y13
+ VPALIGNR $0x04, Y1, Y1, Y1
+ CMPQ R9, CX
+ JB openAVX2Tail128LoopA
+ CMPQ R9, $0xa0
+ JNE openAVX2Tail128LoopB
VPADDD ·chacha20Constants<>+0(SB), Y5, Y5
- VPADDD ·chacha20Constants<>+0(SB), Y6, Y6
- VPADDD ·chacha20Constants<>+0(SB), Y7, Y7
- VPADDD 32(BP), Y14, Y14
VPADDD 32(BP), Y9, Y9
- VPADDD 32(BP), Y10, Y10
- VPADDD 32(BP), Y11, Y11
- VPADDD 64(BP), Y12, Y12
VPADDD 64(BP), Y13, Y13
- VPADDD 64(BP), Y8, Y8
- VPADDD 64(BP), Y15, Y15
- VPADDD 96(BP), Y4, Y4
- VPADDD 128(BP), Y1, Y1
- VPADDD 160(BP), Y2, Y2
- VPADDD 192(BP), Y3, Y3
- VMOVDQA Y15, 224(BP)
- VPERM2I128 $0x02, Y0, Y14, Y15
- VPERM2I128 $0x13, Y0, Y14, Y14
- VPERM2I128 $0x02, Y12, Y4, Y0
- VPERM2I128 $0x13, Y12, Y4, Y12
- VPXOR (SI), Y15, Y15
- VPXOR 32(SI), Y0, Y0
- VPXOR 64(SI), Y14, Y14
- VPXOR 96(SI), Y12, Y12
- VMOVDQU Y15, (DI)
- VMOVDQU Y0, 32(DI)
- VMOVDQU Y14, 64(DI)
- VMOVDQU Y12, 96(DI)
- VPERM2I128 $0x02, Y5, Y9, Y0
- VPERM2I128 $0x02, Y13, Y1, Y14
- VPERM2I128 $0x13, Y5, Y9, Y12
- VPERM2I128 $0x13, Y13, Y1, Y4
- VPXOR 128(SI), Y0, Y0
- VPXOR 160(SI), Y14, Y14
- VPXOR 192(SI), Y12, Y12
- VPXOR 224(SI), Y4, Y4
- VMOVDQU Y0, 128(DI)
- VMOVDQU Y14, 160(DI)
- VMOVDQU Y12, 192(DI)
- VMOVDQU Y4, 224(DI)
- VPERM2I128 $0x02, Y6, Y10, Y0
- VPERM2I128 $0x02, Y8, Y2, Y14
- VPERM2I128 $0x13, Y6, Y10, Y12
- VPERM2I128 $0x13, Y8, Y2, Y4
- VPXOR 256(SI), Y0, Y0
- VPXOR 288(SI), Y14, Y14
- VPXOR 320(SI), Y12, Y12
- VPXOR 352(SI), Y4, Y4
- VMOVDQU Y0, 256(DI)
- VMOVDQU Y14, 288(DI)
- VMOVDQU Y12, 320(DI)
- VMOVDQU Y4, 352(DI)
- VPERM2I128 $0x02, Y7, Y11, Y0
- VPERM2I128 $0x02, 224(BP), Y3, Y14
- VPERM2I128 $0x13, Y7, Y11, Y12
- VPERM2I128 $0x13, 224(BP), Y3, Y4
- LEAQ 384(SI), SI
- LEAQ 384(DI), DI
- SUBQ $0x00000180, BX
- JMP openAVX2TailLoop
-
-DATA ·chacha20Constants<>+0(SB)/4, $0x61707865
-DATA ·chacha20Constants<>+4(SB)/4, $0x3320646e
-DATA ·chacha20Constants<>+8(SB)/4, $0x79622d32
-DATA ·chacha20Constants<>+12(SB)/4, $0x6b206574
-DATA ·chacha20Constants<>+16(SB)/4, $0x61707865
-DATA ·chacha20Constants<>+20(SB)/4, $0x3320646e
-DATA ·chacha20Constants<>+24(SB)/4, $0x79622d32
-DATA ·chacha20Constants<>+28(SB)/4, $0x6b206574
-GLOBL ·chacha20Constants<>(SB), RODATA|NOPTR, $32
-
-DATA ·polyClampMask<>+0(SB)/8, $0x0ffffffc0fffffff
-DATA ·polyClampMask<>+8(SB)/8, $0x0ffffffc0ffffffc
-DATA ·polyClampMask<>+16(SB)/8, $0xffffffffffffffff
-DATA ·polyClampMask<>+24(SB)/8, $0xffffffffffffffff
-GLOBL ·polyClampMask<>(SB), RODATA|NOPTR, $32
-
-DATA ·sseIncMask<>+0(SB)/8, $0x0000000000000001
-DATA ·sseIncMask<>+8(SB)/8, $0x0000000000000000
-GLOBL ·sseIncMask<>(SB), RODATA|NOPTR, $16
-
-DATA ·andMask<>+0(SB)/8, $0x00000000000000ff
-DATA ·andMask<>+8(SB)/8, $0x0000000000000000
-DATA ·andMask<>+16(SB)/8, $0x000000000000ffff
-DATA ·andMask<>+24(SB)/8, $0x0000000000000000
-DATA ·andMask<>+32(SB)/8, $0x0000000000ffffff
-DATA ·andMask<>+40(SB)/8, $0x0000000000000000
-DATA ·andMask<>+48(SB)/8, $0x00000000ffffffff
-DATA ·andMask<>+56(SB)/8, $0x0000000000000000
-DATA ·andMask<>+64(SB)/8, $0x000000ffffffffff
-DATA ·andMask<>+72(SB)/8, $0x0000000000000000
-DATA ·andMask<>+80(SB)/8, $0x0000ffffffffffff
-DATA ·andMask<>+88(SB)/8, $0x0000000000000000
-DATA ·andMask<>+96(SB)/8, $0x00ffffffffffffff
-DATA ·andMask<>+104(SB)/8, $0x0000000000000000
-DATA ·andMask<>+112(SB)/8, $0xffffffffffffffff
-DATA ·andMask<>+120(SB)/8, $0x0000000000000000
-DATA ·andMask<>+128(SB)/8, $0xffffffffffffffff
-DATA ·andMask<>+136(SB)/8, $0x00000000000000ff
-DATA ·andMask<>+144(SB)/8, $0xffffffffffffffff
-DATA ·andMask<>+152(SB)/8, $0x000000000000ffff
-DATA ·andMask<>+160(SB)/8, $0xffffffffffffffff
-DATA ·andMask<>+168(SB)/8, $0x0000000000ffffff
-DATA ·andMask<>+176(SB)/8, $0xffffffffffffffff
-DATA ·andMask<>+184(SB)/8, $0x00000000ffffffff
-DATA ·andMask<>+192(SB)/8, $0xffffffffffffffff
-DATA ·andMask<>+200(SB)/8, $0x000000ffffffffff
-DATA ·andMask<>+208(SB)/8, $0xffffffffffffffff
-DATA ·andMask<>+216(SB)/8, $0x0000ffffffffffff
-DATA ·andMask<>+224(SB)/8, $0xffffffffffffffff
-DATA ·andMask<>+232(SB)/8, $0x00ffffffffffffff
-GLOBL ·andMask<>(SB), RODATA|NOPTR, $240
+ VPADDD Y4, Y1, Y1
+ VPERM2I128 $0x02, Y5, Y9, Y0
+ VPERM2I128 $0x02, Y13, Y1, Y14
+ VPERM2I128 $0x13, Y5, Y9, Y12
+ VPERM2I128 $0x13, Y13, Y1, Y4
-DATA ·avx2InitMask<>+0(SB)/8, $0x0000000000000000
-DATA ·avx2InitMask<>+8(SB)/8, $0x0000000000000000
-DATA ·avx2InitMask<>+16(SB)/8, $0x0000000000000001
-DATA ·avx2InitMask<>+24(SB)/8, $0x0000000000000000
-GLOBL ·avx2InitMask<>(SB), RODATA|NOPTR, $32
+openAVX2TailLoop:
+ CMPQ BX, $0x20
+ JB openAVX2Tail
+ SUBQ $0x20, BX
-DATA ·rol16<>+0(SB)/8, $0x0504070601000302
-DATA ·rol16<>+8(SB)/8, $0x0d0c0f0e09080b0a
-DATA ·rol16<>+16(SB)/8, $0x0504070601000302
-DATA ·rol16<>+24(SB)/8, $0x0d0c0f0e09080b0a
-GLOBL ·rol16<>(SB), RODATA|NOPTR, $32
+ // Load for decryption
+ VPXOR (SI), Y0, Y0
+ VMOVDQU Y0, (DI)
+ LEAQ 32(SI), SI
+ LEAQ 32(DI), DI
+ VMOVDQA Y14, Y0
+ VMOVDQA Y12, Y14
+ VMOVDQA Y4, Y12
+ JMP openAVX2TailLoop
-DATA ·rol8<>+0(SB)/8, $0x0605040702010003
-DATA ·rol8<>+8(SB)/8, $0x0e0d0c0f0a09080b
-DATA ·rol8<>+16(SB)/8, $0x0605040702010003
-DATA ·rol8<>+24(SB)/8, $0x0e0d0c0f0a09080b
-GLOBL ·rol8<>(SB), RODATA|NOPTR, $32
+openAVX2Tail:
+ CMPQ BX, $0x10
+ VMOVDQA X0, X1
+ JB openAVX2TailDone
+ SUBQ $0x10, BX
-DATA ·avx2IncMask<>+0(SB)/8, $0x0000000000000002
-DATA ·avx2IncMask<>+8(SB)/8, $0x0000000000000000
-DATA ·avx2IncMask<>+16(SB)/8, $0x0000000000000002
-DATA ·avx2IncMask<>+24(SB)/8, $0x0000000000000000
-GLOBL ·avx2IncMask<>(SB), RODATA|NOPTR, $32
+ // Load for decryption
+ VPXOR (SI), X0, X12
+ VMOVDQU X12, (DI)
+ LEAQ 16(SI), SI
+ LEAQ 16(DI), DI
+ VPERM2I128 $0x11, Y0, Y0, Y0
+ VMOVDQA X0, X1
-// func chacha20Poly1305Seal(dst []byte, key []uint32, src []byte, ad []byte)
-// Requires: AVX, AVX2, BMI2, CMOV, SSE2
-TEXT ·chacha20Poly1305Seal(SB), $288-96
- MOVQ SP, BP
- ADDQ $0x20, BP
- ANDQ $-32, BP
- MOVQ dst_base+0(FP), DI
- MOVQ key_base+24(FP), R8
- MOVQ src_base+48(FP), SI
- MOVQ src_len+56(FP), BX
- MOVQ ad_base+72(FP), CX
- CMPB ·useAVX2+0(SB), $0x01
- JE chacha20Poly1305Seal_AVX2
+openAVX2TailDone:
+ VZEROUPPER
+ JMP openSSETail16
- // Special optimization, for very short buffers
- CMPQ BX, $0x80
- JBE sealSSE128
-
- // In the seal case - prepare the poly key + 3 blocks of stream in the first iteration
- MOVOU ·chacha20Constants<>+0(SB), X0
- MOVOU 16(R8), X3
- MOVOU 32(R8), X6
- MOVOU 48(R8), X9
-
- // Store state on stack for future use
- MOVO X3, 32(BP)
- MOVO X6, 48(BP)
-
- // Load state, increment counter blocks
- MOVO X0, X1
- MOVO X3, X4
- MOVO X6, X7
- MOVO X9, X10
- PADDL ·sseIncMask<>+0(SB), X10
- MOVO X1, X2
- MOVO X4, X5
- MOVO X7, X8
- MOVO X10, X11
- PADDL ·sseIncMask<>+0(SB), X11
- MOVO X2, X12
- MOVO X5, X13
- MOVO X8, X14
- MOVO X11, X15
- PADDL ·sseIncMask<>+0(SB), X15
-
- // Store counters
- MOVO X9, 80(BP)
- MOVO X10, 96(BP)
- MOVO X11, 112(BP)
- MOVO X15, 128(BP)
- MOVQ $0x0000000a, R9
-
-sealSSEIntroLoop:
- MOVO X14, 64(BP)
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X14)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X3
- PXOR X14, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X14)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X3
- PXOR X14, X3
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X14)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X4
- PXOR X14, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X14)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X4
- PXOR X14, X4
- PADDD X5, X2
- PXOR X2, X11
- ROL16(X11, X14)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X5
- PXOR X14, X5
- PADDD X5, X2
- PXOR X2, X11
- ROL8(X11, X14)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X5
- PXOR X14, X5
- MOVO 64(BP), X14
- MOVO X7, 64(BP)
- PADDD X13, X12
- PXOR X12, X15
- ROL16(X15, X7)
- PADDD X15, X14
- PXOR X14, X13
- MOVO X13, X7
- PSLLL $0x0c, X7
- PSRLL $0x14, X13
- PXOR X7, X13
- PADDD X13, X12
- PXOR X12, X15
- ROL8(X15, X7)
- PADDD X15, X14
- PXOR X14, X13
- MOVO X13, X7
- PSLLL $0x07, X7
- PSRLL $0x19, X13
- PXOR X7, X13
- MOVO 64(BP), X7
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc0
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x0c
- MOVO X14, 64(BP)
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X14)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X3
- PXOR X14, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X14)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X3
- PXOR X14, X3
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X14)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X4
- PXOR X14, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X14)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X4
- PXOR X14, X4
- PADDD X5, X2
- PXOR X2, X11
- ROL16(X11, X14)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X5
- PXOR X14, X5
- PADDD X5, X2
- PXOR X2, X11
- ROL8(X11, X14)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X5
- PXOR X14, X5
- MOVO 64(BP), X14
- MOVO X7, 64(BP)
- PADDD X13, X12
- PXOR X12, X15
- ROL16(X15, X7)
- PADDD X15, X14
- PXOR X14, X13
- MOVO X13, X7
- PSLLL $0x0c, X7
- PSRLL $0x14, X13
- PXOR X7, X13
- PADDD X13, X12
- PXOR X12, X15
- ROL8(X15, X7)
- PADDD X15, X14
- PXOR X14, X13
- MOVO X13, X7
- PSLLL $0x07, X7
- PSRLL $0x19, X13
- PXOR X7, X13
- MOVO 64(BP), X7
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc0
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x04
- DECQ R9
- JNE sealSSEIntroLoop
-
- // Add in the state
- PADDD ·chacha20Constants<>+0(SB), X0
- PADDD ·chacha20Constants<>+0(SB), X1
- PADDD ·chacha20Constants<>+0(SB), X2
- PADDD ·chacha20Constants<>+0(SB), X12
- PADDD 32(BP), X3
- PADDD 32(BP), X4
- PADDD 32(BP), X5
- PADDD 32(BP), X13
- PADDD 48(BP), X7
- PADDD 48(BP), X8
- PADDD 48(BP), X14
- PADDD 96(BP), X10
- PADDD 112(BP), X11
- PADDD 128(BP), X15
-
- // Clamp and store the key
- PAND ·polyClampMask<>+0(SB), X0
- MOVO X0, (BP)
- MOVO X3, 16(BP)
-
- // Hash AAD
- MOVQ ad_len+80(FP), R9
- CALL polyHashADInternal<>(SB)
- MOVOU (SI), X0
- MOVOU 16(SI), X3
- MOVOU 32(SI), X6
- MOVOU 48(SI), X9
- PXOR X0, X1
- PXOR X3, X4
- PXOR X6, X7
- PXOR X9, X10
- MOVOU X1, (DI)
- MOVOU X4, 16(DI)
- MOVOU X7, 32(DI)
- MOVOU X10, 48(DI)
- MOVOU 64(SI), X0
- MOVOU 80(SI), X3
- MOVOU 96(SI), X6
- MOVOU 112(SI), X9
- PXOR X0, X2
- PXOR X3, X5
- PXOR X6, X8
- PXOR X9, X11
- MOVOU X2, 64(DI)
- MOVOU X5, 80(DI)
- MOVOU X8, 96(DI)
- MOVOU X11, 112(DI)
- MOVQ $0x00000080, CX
- SUBQ $0x80, BX
- LEAQ 128(SI), SI
- MOVO X12, X1
- MOVO X13, X4
- MOVO X14, X7
- MOVO X15, X10
- CMPQ BX, $0x40
- JBE sealSSE128SealHash
- MOVOU (SI), X0
- MOVOU 16(SI), X3
- MOVOU 32(SI), X6
- MOVOU 48(SI), X9
- PXOR X0, X12
- PXOR X3, X13
- PXOR X6, X14
- PXOR X9, X15
- MOVOU X12, 128(DI)
- MOVOU X13, 144(DI)
- MOVOU X14, 160(DI)
- MOVOU X15, 176(DI)
- ADDQ $0x40, CX
- SUBQ $0x40, BX
- LEAQ 64(SI), SI
- MOVQ $0x00000002, CX
- MOVQ $0x00000008, R9
- CMPQ BX, $0x40
- JBE sealSSETail64
- CMPQ BX, $0x80
- JBE sealSSETail128
- CMPQ BX, $0xc0
- JBE sealSSETail192
-
-sealSSEMainLoop:
- // Load state, increment counter blocks
- MOVO ·chacha20Constants<>+0(SB), X0
- MOVO 32(BP), X3
- MOVO 48(BP), X6
- MOVO 128(BP), X9
- PADDL ·sseIncMask<>+0(SB), X9
- MOVO X0, X1
- MOVO X3, X4
- MOVO X6, X7
- MOVO X9, X10
- PADDL ·sseIncMask<>+0(SB), X10
- MOVO X1, X2
- MOVO X4, X5
- MOVO X7, X8
- MOVO X10, X11
- PADDL ·sseIncMask<>+0(SB), X11
- MOVO X2, X12
- MOVO X5, X13
- MOVO X8, X14
- MOVO X11, X15
- PADDL ·sseIncMask<>+0(SB), X15
-
- // Store counters
- MOVO X9, 80(BP)
- MOVO X10, 96(BP)
- MOVO X11, 112(BP)
- MOVO X15, 128(BP)
-
-sealSSEInnerLoop:
- MOVO X14, 64(BP)
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X14)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X3
- PXOR X14, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X14)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X3
- PXOR X14, X3
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X14)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X4
- PXOR X14, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X14)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X4
- PXOR X14, X4
- PADDD X5, X2
- PXOR X2, X11
- ROL16(X11, X14)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X5
- PXOR X14, X5
- PADDD X5, X2
- PXOR X2, X11
- ROL8(X11, X14)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X5
- PXOR X14, X5
- MOVO 64(BP), X14
- MOVO X7, 64(BP)
- PADDD X13, X12
- PXOR X12, X15
- ROL16(X15, X7)
- PADDD X15, X14
- PXOR X14, X13
- MOVO X13, X7
- PSLLL $0x0c, X7
- PSRLL $0x14, X13
- PXOR X7, X13
- PADDD X13, X12
- PXOR X12, X15
- ROL8(X15, X7)
- PADDD X15, X14
- PXOR X14, X13
- MOVO X13, X7
- PSLLL $0x07, X7
- PSRLL $0x19, X13
- PXOR X7, X13
- MOVO 64(BP), X7
- ADDQ (DI), R10
- ADCQ 8(DI), R11
+openAVX2Tail256:
+ VMOVDQA ·chacha20Constants<>+0(SB), Y0
+ VMOVDQA Y0, Y5
+ VMOVDQA 32(BP), Y14
+ VMOVDQA Y14, Y9
+ VMOVDQA 64(BP), Y12
+ VMOVDQA Y12, Y13
+ VMOVDQA 192(BP), Y4
+ VPADDD ·avx2IncMask<>+0(SB), Y4, Y4
+ VPADDD ·avx2IncMask<>+0(SB), Y4, Y1
+ VMOVDQA Y4, Y7
+ VMOVDQA Y1, Y11
+
+ // Compute the number of iterations that will hash data
+ MOVQ BX, 224(BP)
+ MOVQ BX, CX
+ SUBQ $0x80, CX
+ SHRQ $0x04, CX
+ MOVQ $0x0000000a, R9
+ CMPQ CX, $0x0a
+ CMOVQGT R9, CX
+ MOVQ SI, BX
+ XORQ R9, R9
+
+openAVX2Tail256LoopA:
+ ADDQ (BX), R10
+ ADCQ 8(BX), R11
ADCQ $0x01, R12
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc0
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x0c
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
+ MOVQ (BP), DX
+ MOVQ DX, R15
+ MULXQ R10, R13, R14
IMULQ R12, R15
+ MULXQ R11, AX, DX
ADDQ AX, R14
ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
+ MOVQ 8(BP), DX
+ MULXQ R10, R10, AX
+ ADDQ R10, R14
+ MULXQ R11, R11, R8
+ ADCQ R11, R15
+ ADCQ $0x00, R8
+ IMULQ R12, DX
ADDQ AX, R15
- ADCQ $0x00, DX
- LEAQ 16(DI), DI
- MOVO X14, 64(BP)
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X14)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X3
- PXOR X14, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X14)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X3
- PXOR X14, X3
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X14)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X4
- PXOR X14, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X14)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X4
- PXOR X14, X4
- PADDD X5, X2
- PXOR X2, X11
- ROL16(X11, X14)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X14
- PSLLL $0x0c, X14
- PSRLL $0x14, X5
- PXOR X14, X5
- PADDD X5, X2
- PXOR X2, X11
- ROL8(X11, X14)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X14
- PSLLL $0x07, X14
- PSRLL $0x19, X5
- PXOR X14, X5
- MOVO 64(BP), X14
- MOVO X7, 64(BP)
- IMULQ R12, R8
- ADDQ R10, R15
ADCQ DX, R8
- PADDD X13, X12
- PXOR X12, X15
- ROL16(X15, X7)
- PADDD X15, X14
- PXOR X14, X13
- MOVO X13, X7
- PSLLL $0x0c, X7
- PSRLL $0x14, X13
- PXOR X7, X13
- PADDD X13, X12
- PXOR X12, X15
- ROL8(X15, X7)
- PADDD X15, X14
- PXOR X14, X13
- MOVO X13, X7
- PSLLL $0x07, X7
- PSRLL $0x19, X13
- PXOR X7, X13
- MOVO 64(BP), X7
MOVQ R13, R10
MOVQ R14, R11
MOVQ R15, R12
@@ -5555,112 +1518,117 @@ sealSSEInnerLoop:
ADDQ R15, R10
ADCQ R8, R11
ADCQ $0x00, R12
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc0
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x04
- DECQ R9
- JGE sealSSEInnerLoop
- ADDQ (DI), R10
- ADCQ 8(DI), R11
+ LEAQ 16(BX), BX
+
+openAVX2Tail256LoopB:
+ VPADDD Y14, Y0, Y0
+ VPXOR Y0, Y4, Y4
+ VPSHUFB ·rol16<>+0(SB), Y4, Y4
+ VPADDD Y4, Y12, Y12
+ VPXOR Y12, Y14, Y14
+ VPSLLD $0x0c, Y14, Y3
+ VPSRLD $0x14, Y14, Y14
+ VPXOR Y3, Y14, Y14
+ VPADDD Y14, Y0, Y0
+ VPXOR Y0, Y4, Y4
+ VPSHUFB ·rol8<>+0(SB), Y4, Y4
+ VPADDD Y4, Y12, Y12
+ VPXOR Y12, Y14, Y14
+ VPSLLD $0x07, Y14, Y3
+ VPSRLD $0x19, Y14, Y14
+ VPXOR Y3, Y14, Y14
+ VPADDD Y9, Y5, Y5
+ VPXOR Y5, Y1, Y1
+ VPSHUFB ·rol16<>+0(SB), Y1, Y1
+ VPADDD Y1, Y13, Y13
+ VPXOR Y13, Y9, Y9
+ VPSLLD $0x0c, Y9, Y3
+ VPSRLD $0x14, Y9, Y9
+ VPXOR Y3, Y9, Y9
+ VPADDD Y9, Y5, Y5
+ VPXOR Y5, Y1, Y1
+ VPSHUFB ·rol8<>+0(SB), Y1, Y1
+ VPADDD Y1, Y13, Y13
+ VPXOR Y13, Y9, Y9
+ VPSLLD $0x07, Y9, Y3
+ VPSRLD $0x19, Y9, Y9
+ VPXOR Y3, Y9, Y9
+ VPALIGNR $0x04, Y14, Y14, Y14
+ VPALIGNR $0x04, Y9, Y9, Y9
+ VPALIGNR $0x08, Y12, Y12, Y12
+ VPALIGNR $0x08, Y13, Y13, Y13
+ VPALIGNR $0x0c, Y4, Y4, Y4
+ VPALIGNR $0x0c, Y1, Y1, Y1
+ INCQ R9
+ VPADDD Y14, Y0, Y0
+ VPXOR Y0, Y4, Y4
+ VPSHUFB ·rol16<>+0(SB), Y4, Y4
+ VPADDD Y4, Y12, Y12
+ VPXOR Y12, Y14, Y14
+ VPSLLD $0x0c, Y14, Y3
+ VPSRLD $0x14, Y14, Y14
+ VPXOR Y3, Y14, Y14
+ VPADDD Y14, Y0, Y0
+ VPXOR Y0, Y4, Y4
+ VPSHUFB ·rol8<>+0(SB), Y4, Y4
+ VPADDD Y4, Y12, Y12
+ VPXOR Y12, Y14, Y14
+ VPSLLD $0x07, Y14, Y3
+ VPSRLD $0x19, Y14, Y14
+ VPXOR Y3, Y14, Y14
+ VPADDD Y9, Y5, Y5
+ VPXOR Y5, Y1, Y1
+ VPSHUFB ·rol16<>+0(SB), Y1, Y1
+ VPADDD Y1, Y13, Y13
+ VPXOR Y13, Y9, Y9
+ VPSLLD $0x0c, Y9, Y3
+ VPSRLD $0x14, Y9, Y9
+ VPXOR Y3, Y9, Y9
+ VPADDD Y9, Y5, Y5
+ VPXOR Y5, Y1, Y1
+ VPSHUFB ·rol8<>+0(SB), Y1, Y1
+ VPADDD Y1, Y13, Y13
+ VPXOR Y13, Y9, Y9
+ VPSLLD $0x07, Y9, Y3
+ VPSRLD $0x19, Y9, Y9
+ VPXOR Y3, Y9, Y9
+ VPALIGNR $0x0c, Y14, Y14, Y14
+ VPALIGNR $0x0c, Y9, Y9, Y9
+ VPALIGNR $0x08, Y12, Y12, Y12
+ VPALIGNR $0x08, Y13, Y13, Y13
+ VPALIGNR $0x04, Y4, Y4, Y4
+ VPALIGNR $0x04, Y1, Y1, Y1
+ CMPQ R9, CX
+ JB openAVX2Tail256LoopA
+ CMPQ R9, $0x0a
+ JNE openAVX2Tail256LoopB
+ MOVQ BX, R9
+ SUBQ SI, BX
+ MOVQ BX, CX
+ MOVQ 224(BP), BX
+
+openAVX2Tail256Hash:
+ ADDQ $0x10, CX
+ CMPQ CX, BX
+ JGT openAVX2Tail256HashEnd
+ ADDQ (R9), R10
+ ADCQ 8(R9), R11
ADCQ $0x01, R12
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
+ MOVQ (BP), DX
+ MOVQ DX, R15
+ MULXQ R10, R13, R14
IMULQ R12, R15
+ MULXQ R11, AX, DX
ADDQ AX, R14
ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
+ MOVQ 8(BP), DX
+ MULXQ R10, R10, AX
+ ADDQ R10, R14
+ MULXQ R11, R11, R8
+ ADCQ R11, R15
+ ADCQ $0x00, R8
+ IMULQ R12, DX
ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
ADCQ DX, R8
MOVQ R13, R10
MOVQ R14, R11
@@ -5672,143 +1640,94 @@ sealSSEInnerLoop:
SHRQ $0x02, R8, R15
SHRQ $0x02, R8
ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- LEAQ 16(DI), DI
- DECQ CX
- JG sealSSEInnerLoop
-
- // Add in the state
- PADDD ·chacha20Constants<>+0(SB), X0
- PADDD ·chacha20Constants<>+0(SB), X1
- PADDD ·chacha20Constants<>+0(SB), X2
- PADDD ·chacha20Constants<>+0(SB), X12
- PADDD 32(BP), X3
- PADDD 32(BP), X4
- PADDD 32(BP), X5
- PADDD 32(BP), X13
- PADDD 48(BP), X6
- PADDD 48(BP), X7
- PADDD 48(BP), X8
- PADDD 48(BP), X14
- PADDD 80(BP), X9
- PADDD 96(BP), X10
- PADDD 112(BP), X11
- PADDD 128(BP), X15
- MOVO X15, 64(BP)
-
- // Load - xor - store
- MOVOU (SI), X15
- PXOR X15, X0
- MOVOU 16(SI), X15
- PXOR X15, X3
- MOVOU 32(SI), X15
- PXOR X15, X6
- MOVOU 48(SI), X15
- PXOR X15, X9
- MOVOU X0, (DI)
- MOVOU X3, 16(DI)
- MOVOU X6, 32(DI)
- MOVOU X9, 48(DI)
- MOVO 64(BP), X15
- MOVOU 64(SI), X0
- MOVOU 80(SI), X3
- MOVOU 96(SI), X6
- MOVOU 112(SI), X9
- PXOR X0, X1
- PXOR X3, X4
- PXOR X6, X7
- PXOR X9, X10
- MOVOU X1, 64(DI)
- MOVOU X4, 80(DI)
- MOVOU X7, 96(DI)
- MOVOU X10, 112(DI)
- MOVOU 128(SI), X0
- MOVOU 144(SI), X3
- MOVOU 160(SI), X6
- MOVOU 176(SI), X9
- PXOR X0, X2
- PXOR X3, X5
- PXOR X6, X8
- PXOR X9, X11
- MOVOU X2, 128(DI)
- MOVOU X5, 144(DI)
- MOVOU X8, 160(DI)
- MOVOU X11, 176(DI)
- ADDQ $0xc0, SI
- MOVQ $0x000000c0, CX
- SUBQ $0xc0, BX
- MOVO X12, X1
- MOVO X13, X4
- MOVO X14, X7
- MOVO X15, X10
- CMPQ BX, $0x40
- JBE sealSSE128SealHash
- MOVOU (SI), X0
- MOVOU 16(SI), X3
- MOVOU 32(SI), X6
- MOVOU 48(SI), X9
- PXOR X0, X12
- PXOR X3, X13
- PXOR X6, X14
- PXOR X9, X15
- MOVOU X12, 192(DI)
- MOVOU X13, 208(DI)
- MOVOU X14, 224(DI)
- MOVOU X15, 240(DI)
- LEAQ 64(SI), SI
- SUBQ $0x40, BX
- MOVQ $0x00000006, CX
- MOVQ $0x00000004, R9
- CMPQ BX, $0xc0
- JG sealSSEMainLoop
- MOVQ BX, CX
- TESTQ BX, BX
- JE sealSSE128SealHash
- MOVQ $0x00000006, CX
- CMPQ BX, $0x40
- JBE sealSSETail64
- CMPQ BX, $0x80
- JBE sealSSETail128
- JMP sealSSETail192
-
-sealSSETail64:
- MOVO ·chacha20Constants<>+0(SB), X1
- MOVO 32(BP), X4
- MOVO 48(BP), X7
- MOVO 128(BP), X10
- PADDL ·sseIncMask<>+0(SB), X10
- MOVO X10, 80(BP)
-
-sealSSETail64LoopA:
- ADDQ (DI), R10
- ADCQ 8(DI), R11
+ ADCQ R14, R11
+ ADCQ $0x00, R12
+ ADDQ R15, R10
+ ADCQ R8, R11
+ ADCQ $0x00, R12
+ LEAQ 16(R9), R9
+ JMP openAVX2Tail256Hash
+
+openAVX2Tail256HashEnd:
+ VPADDD ·chacha20Constants<>+0(SB), Y0, Y0
+ VPADDD ·chacha20Constants<>+0(SB), Y5, Y5
+ VPADDD 32(BP), Y14, Y14
+ VPADDD 32(BP), Y9, Y9
+ VPADDD 64(BP), Y12, Y12
+ VPADDD 64(BP), Y13, Y13
+ VPADDD Y7, Y4, Y4
+ VPADDD Y11, Y1, Y1
+ VPERM2I128 $0x02, Y0, Y14, Y6
+ VPERM2I128 $0x02, Y12, Y4, Y10
+ VPERM2I128 $0x13, Y0, Y14, Y8
+ VPERM2I128 $0x13, Y12, Y4, Y2
+ VPERM2I128 $0x02, Y5, Y9, Y0
+ VPERM2I128 $0x02, Y13, Y1, Y14
+ VPERM2I128 $0x13, Y5, Y9, Y12
+ VPERM2I128 $0x13, Y13, Y1, Y4
+ VPXOR (SI), Y6, Y6
+ VPXOR 32(SI), Y10, Y10
+ VPXOR 64(SI), Y8, Y8
+ VPXOR 96(SI), Y2, Y2
+ VMOVDQU Y6, (DI)
+ VMOVDQU Y10, 32(DI)
+ VMOVDQU Y8, 64(DI)
+ VMOVDQU Y2, 96(DI)
+ LEAQ 128(SI), SI
+ LEAQ 128(DI), DI
+ SUBQ $0x80, BX
+ JMP openAVX2TailLoop
+
+openAVX2Tail384:
+ // Need to decrypt up to 384 bytes - prepare six blocks
+ VMOVDQA ·chacha20Constants<>+0(SB), Y0
+ VMOVDQA Y0, Y5
+ VMOVDQA Y0, Y6
+ VMOVDQA 32(BP), Y14
+ VMOVDQA Y14, Y9
+ VMOVDQA Y14, Y10
+ VMOVDQA 64(BP), Y12
+ VMOVDQA Y12, Y13
+ VMOVDQA Y12, Y8
+ VMOVDQA 192(BP), Y4
+ VPADDD ·avx2IncMask<>+0(SB), Y4, Y4
+ VPADDD ·avx2IncMask<>+0(SB), Y4, Y1
+ VPADDD ·avx2IncMask<>+0(SB), Y1, Y2
+ VMOVDQA Y4, 96(BP)
+ VMOVDQA Y1, 128(BP)
+ VMOVDQA Y2, 160(BP)
+
+ // Compute the number of iterations that will hash two blocks of data
+ MOVQ BX, 224(BP)
+ MOVQ BX, CX
+ SUBQ $0x00000100, CX
+ SHRQ $0x04, CX
+ ADDQ $0x06, CX
+ MOVQ $0x0000000a, R9
+ CMPQ CX, $0x0a
+ CMOVQGT R9, CX
+ MOVQ SI, BX
+ XORQ R9, R9
+
+openAVX2Tail384LoopB:
+ ADDQ (BX), R10
+ ADCQ 8(BX), R11
ADCQ $0x01, R12
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
+ MOVQ (BP), DX
+ MOVQ DX, R15
+ MULXQ R10, R13, R14
IMULQ R12, R15
+ MULXQ R11, AX, DX
ADDQ AX, R14
ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
+ MOVQ 8(BP), DX
+ MULXQ R10, R10, AX
+ ADDQ R10, R14
+ MULXQ R11, R11, R8
+ ADCQ R11, R15
+ ADCQ $0x00, R8
+ IMULQ R12, DX
ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
ADCQ DX, R8
MOVQ R13, R10
MOVQ R14, R11
@@ -5825,175 +1744,190 @@ sealSSETail64LoopA:
ADDQ R15, R10
ADCQ R8, R11
ADCQ $0x00, R12
- LEAQ 16(DI), DI
+ LEAQ 16(BX), BX
+
+openAVX2Tail384LoopA:
+ VPADDD Y14, Y0, Y0
+ VPXOR Y0, Y4, Y4
+ VPSHUFB ·rol16<>+0(SB), Y4, Y4
+ VPADDD Y4, Y12, Y12
+ VPXOR Y12, Y14, Y14
+ VPSLLD $0x0c, Y14, Y3
+ VPSRLD $0x14, Y14, Y14
+ VPXOR Y3, Y14, Y14
+ VPADDD Y14, Y0, Y0
+ VPXOR Y0, Y4, Y4
+ VPSHUFB ·rol8<>+0(SB), Y4, Y4
+ VPADDD Y4, Y12, Y12
+ VPXOR Y12, Y14, Y14
+ VPSLLD $0x07, Y14, Y3
+ VPSRLD $0x19, Y14, Y14
+ VPXOR Y3, Y14, Y14
+ VPADDD Y9, Y5, Y5
+ VPXOR Y5, Y1, Y1
+ VPSHUFB ·rol16<>+0(SB), Y1, Y1
+ VPADDD Y1, Y13, Y13
+ VPXOR Y13, Y9, Y9
+ VPSLLD $0x0c, Y9, Y3
+ VPSRLD $0x14, Y9, Y9
+ VPXOR Y3, Y9, Y9
+ VPADDD Y9, Y5, Y5
+ VPXOR Y5, Y1, Y1
+ VPSHUFB ·rol8<>+0(SB), Y1, Y1
+ VPADDD Y1, Y13, Y13
+ VPXOR Y13, Y9, Y9
+ VPSLLD $0x07, Y9, Y3
+ VPSRLD $0x19, Y9, Y9
+ VPXOR Y3, Y9, Y9
+ VPADDD Y10, Y6, Y6
+ VPXOR Y6, Y2, Y2
+ VPSHUFB ·rol16<>+0(SB), Y2, Y2
+ VPADDD Y2, Y8, Y8
+ VPXOR Y8, Y10, Y10
+ VPSLLD $0x0c, Y10, Y3
+ VPSRLD $0x14, Y10, Y10
+ VPXOR Y3, Y10, Y10
+ VPADDD Y10, Y6, Y6
+ VPXOR Y6, Y2, Y2
+ VPSHUFB ·rol8<>+0(SB), Y2, Y2
+ VPADDD Y2, Y8, Y8
+ VPXOR Y8, Y10, Y10
+ VPSLLD $0x07, Y10, Y3
+ VPSRLD $0x19, Y10, Y10
+ VPXOR Y3, Y10, Y10
+ VPALIGNR $0x04, Y14, Y14, Y14
+ VPALIGNR $0x04, Y9, Y9, Y9
+ VPALIGNR $0x04, Y10, Y10, Y10
+ VPALIGNR $0x08, Y12, Y12, Y12
+ VPALIGNR $0x08, Y13, Y13, Y13
+ VPALIGNR $0x08, Y8, Y8, Y8
+ VPALIGNR $0x0c, Y4, Y4, Y4
+ VPALIGNR $0x0c, Y1, Y1, Y1
+ VPALIGNR $0x0c, Y2, Y2, Y2
+ ADDQ (BX), R10
+ ADCQ 8(BX), R11
+ ADCQ $0x01, R12
+ MOVQ (BP), DX
+ MOVQ DX, R15
+ MULXQ R10, R13, R14
+ IMULQ R12, R15
+ MULXQ R11, AX, DX
+ ADDQ AX, R14
+ ADCQ DX, R15
+ MOVQ 8(BP), DX
+ MULXQ R10, R10, AX
+ ADDQ R10, R14
+ MULXQ R11, R11, R8
+ ADCQ R11, R15
+ ADCQ $0x00, R8
+ IMULQ R12, DX
+ ADDQ AX, R15
+ ADCQ DX, R8
+ MOVQ R13, R10
+ MOVQ R14, R11
+ MOVQ R15, R12
+ ANDQ $0x03, R12
+ MOVQ R15, R13
+ ANDQ $-4, R13
+ MOVQ R8, R14
+ SHRQ $0x02, R8, R15
+ SHRQ $0x02, R8
+ ADDQ R13, R10
+ ADCQ R14, R11
+ ADCQ $0x00, R12
+ ADDQ R15, R10
+ ADCQ R8, R11
+ ADCQ $0x00, R12
+ LEAQ 16(BX), BX
+ INCQ R9
+ VPADDD Y14, Y0, Y0
+ VPXOR Y0, Y4, Y4
+ VPSHUFB ·rol16<>+0(SB), Y4, Y4
+ VPADDD Y4, Y12, Y12
+ VPXOR Y12, Y14, Y14
+ VPSLLD $0x0c, Y14, Y3
+ VPSRLD $0x14, Y14, Y14
+ VPXOR Y3, Y14, Y14
+ VPADDD Y14, Y0, Y0
+ VPXOR Y0, Y4, Y4
+ VPSHUFB ·rol8<>+0(SB), Y4, Y4
+ VPADDD Y4, Y12, Y12
+ VPXOR Y12, Y14, Y14
+ VPSLLD $0x07, Y14, Y3
+ VPSRLD $0x19, Y14, Y14
+ VPXOR Y3, Y14, Y14
+ VPADDD Y9, Y5, Y5
+ VPXOR Y5, Y1, Y1
+ VPSHUFB ·rol16<>+0(SB), Y1, Y1
+ VPADDD Y1, Y13, Y13
+ VPXOR Y13, Y9, Y9
+ VPSLLD $0x0c, Y9, Y3
+ VPSRLD $0x14, Y9, Y9
+ VPXOR Y3, Y9, Y9
+ VPADDD Y9, Y5, Y5
+ VPXOR Y5, Y1, Y1
+ VPSHUFB ·rol8<>+0(SB), Y1, Y1
+ VPADDD Y1, Y13, Y13
+ VPXOR Y13, Y9, Y9
+ VPSLLD $0x07, Y9, Y3
+ VPSRLD $0x19, Y9, Y9
+ VPXOR Y3, Y9, Y9
+ VPADDD Y10, Y6, Y6
+ VPXOR Y6, Y2, Y2
+ VPSHUFB ·rol16<>+0(SB), Y2, Y2
+ VPADDD Y2, Y8, Y8
+ VPXOR Y8, Y10, Y10
+ VPSLLD $0x0c, Y10, Y3
+ VPSRLD $0x14, Y10, Y10
+ VPXOR Y3, Y10, Y10
+ VPADDD Y10, Y6, Y6
+ VPXOR Y6, Y2, Y2
+ VPSHUFB ·rol8<>+0(SB), Y2, Y2
+ VPADDD Y2, Y8, Y8
+ VPXOR Y8, Y10, Y10
+ VPSLLD $0x07, Y10, Y3
+ VPSRLD $0x19, Y10, Y10
+ VPXOR Y3, Y10, Y10
+ VPALIGNR $0x0c, Y14, Y14, Y14
+ VPALIGNR $0x0c, Y9, Y9, Y9
+ VPALIGNR $0x0c, Y10, Y10, Y10
+ VPALIGNR $0x08, Y12, Y12, Y12
+ VPALIGNR $0x08, Y13, Y13, Y13
+ VPALIGNR $0x08, Y8, Y8, Y8
+ VPALIGNR $0x04, Y4, Y4, Y4
+ VPALIGNR $0x04, Y1, Y1, Y1
+ VPALIGNR $0x04, Y2, Y2, Y2
+ CMPQ R9, CX
+ JB openAVX2Tail384LoopB
+ CMPQ R9, $0x0a
+ JNE openAVX2Tail384LoopA
+ MOVQ BX, R9
+ SUBQ SI, BX
+ MOVQ BX, CX
+ MOVQ 224(BP), BX
-sealSSETail64LoopB:
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X13)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X13
- PSLLL $0x0c, X13
- PSRLL $0x14, X4
- PXOR X13, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X13)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X13
- PSLLL $0x07, X13
- PSRLL $0x19, X4
- PXOR X13, X4
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x0c
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X13)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X13
- PSLLL $0x0c, X13
- PSRLL $0x14, X4
- PXOR X13, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X13)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X13
- PSLLL $0x07, X13
- PSRLL $0x19, X4
- PXOR X13, X4
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x04
- ADDQ (DI), R10
- ADCQ 8(DI), R11
- ADCQ $0x01, R12
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
- IMULQ R12, R15
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
- ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- LEAQ 16(DI), DI
- DECQ CX
- JG sealSSETail64LoopA
- DECQ R9
- JGE sealSSETail64LoopB
- PADDL ·chacha20Constants<>+0(SB), X1
- PADDL 32(BP), X4
- PADDL 48(BP), X7
- PADDL 80(BP), X10
- JMP sealSSE128Seal
-
-sealSSETail128:
- MOVO ·chacha20Constants<>+0(SB), X0
- MOVO 32(BP), X3
- MOVO 48(BP), X6
- MOVO 128(BP), X9
- PADDL ·sseIncMask<>+0(SB), X9
- MOVO X9, 80(BP)
- MOVO X0, X1
- MOVO X3, X4
- MOVO X6, X7
- MOVO X9, X10
- PADDL ·sseIncMask<>+0(SB), X10
- MOVO X10, 96(BP)
-
-sealSSETail128LoopA:
- ADDQ (DI), R10
- ADCQ 8(DI), R11
+openAVX2Tail384Hash:
+ ADDQ $0x10, CX
+ CMPQ CX, BX
+ JGT openAVX2Tail384HashEnd
+ ADDQ (R9), R10
+ ADCQ 8(R9), R11
ADCQ $0x01, R12
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
+ MOVQ (BP), DX
+ MOVQ DX, R15
+ MULXQ R10, R13, R14
IMULQ R12, R15
+ MULXQ R11, AX, DX
ADDQ AX, R14
ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
+ MOVQ 8(BP), DX
+ MULXQ R10, R10, AX
+ ADDQ R10, R14
+ MULXQ R11, R11, R8
+ ADCQ R11, R15
+ ADCQ $0x00, R8
+ IMULQ R12, DX
ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
ADCQ DX, R8
MOVQ R13, R10
MOVQ R14, R11
@@ -6010,430 +1944,99 @@ sealSSETail128LoopA:
ADDQ R15, R10
ADCQ R8, R11
ADCQ $0x00, R12
- LEAQ 16(DI), DI
+ LEAQ 16(R9), R9
+ JMP openAVX2Tail384Hash
-sealSSETail128LoopB:
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X3
- PXOR X12, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X3
- PXOR X12, X3
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X4
- PXOR X12, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X4
- PXOR X12, X4
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x0c
- ADDQ (DI), R10
- ADCQ 8(DI), R11
- ADCQ $0x01, R12
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
- IMULQ R12, R15
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
- ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- LEAQ 16(DI), DI
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X3
- PXOR X12, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X3
- PXOR X12, X3
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X4
- PXOR X12, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X4
- PXOR X12, X4
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x04
- DECQ CX
- JG sealSSETail128LoopA
- DECQ R9
- JGE sealSSETail128LoopB
- PADDL ·chacha20Constants<>+0(SB), X0
- PADDL ·chacha20Constants<>+0(SB), X1
- PADDL 32(BP), X3
- PADDL 32(BP), X4
- PADDL 48(BP), X6
- PADDL 48(BP), X7
- PADDL 80(BP), X9
- PADDL 96(BP), X10
- MOVOU (SI), X12
- MOVOU 16(SI), X13
- MOVOU 32(SI), X14
- MOVOU 48(SI), X15
- PXOR X12, X0
- PXOR X13, X3
- PXOR X14, X6
- PXOR X15, X9
- MOVOU X0, (DI)
- MOVOU X3, 16(DI)
- MOVOU X6, 32(DI)
- MOVOU X9, 48(DI)
- MOVQ $0x00000040, CX
- LEAQ 64(SI), SI
- SUBQ $0x40, BX
- JMP sealSSE128SealHash
-
-sealSSETail192:
- MOVO ·chacha20Constants<>+0(SB), X0
- MOVO 32(BP), X3
- MOVO 48(BP), X6
- MOVO 128(BP), X9
- PADDL ·sseIncMask<>+0(SB), X9
- MOVO X9, 80(BP)
- MOVO X0, X1
- MOVO X3, X4
- MOVO X6, X7
- MOVO X9, X10
- PADDL ·sseIncMask<>+0(SB), X10
- MOVO X10, 96(BP)
- MOVO X1, X2
- MOVO X4, X5
- MOVO X7, X8
- MOVO X10, X11
- PADDL ·sseIncMask<>+0(SB), X11
- MOVO X11, 112(BP)
-
-sealSSETail192LoopA:
- ADDQ (DI), R10
- ADCQ 8(DI), R11
- ADCQ $0x01, R12
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
- IMULQ R12, R15
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
- ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- LEAQ 16(DI), DI
+openAVX2Tail384HashEnd:
+ VPADDD ·chacha20Constants<>+0(SB), Y0, Y0
+ VPADDD ·chacha20Constants<>+0(SB), Y5, Y5
+ VPADDD ·chacha20Constants<>+0(SB), Y6, Y6
+ VPADDD 32(BP), Y14, Y14
+ VPADDD 32(BP), Y9, Y9
+ VPADDD 32(BP), Y10, Y10
+ VPADDD 64(BP), Y12, Y12
+ VPADDD 64(BP), Y13, Y13
+ VPADDD 64(BP), Y8, Y8
+ VPADDD 96(BP), Y4, Y4
+ VPADDD 128(BP), Y1, Y1
+ VPADDD 160(BP), Y2, Y2
+ VPERM2I128 $0x02, Y0, Y14, Y3
+ VPERM2I128 $0x02, Y12, Y4, Y7
+ VPERM2I128 $0x13, Y0, Y14, Y11
+ VPERM2I128 $0x13, Y12, Y4, Y15
+ VPXOR (SI), Y3, Y3
+ VPXOR 32(SI), Y7, Y7
+ VPXOR 64(SI), Y11, Y11
+ VPXOR 96(SI), Y15, Y15
+ VMOVDQU Y3, (DI)
+ VMOVDQU Y7, 32(DI)
+ VMOVDQU Y11, 64(DI)
+ VMOVDQU Y15, 96(DI)
+ VPERM2I128 $0x02, Y5, Y9, Y3
+ VPERM2I128 $0x02, Y13, Y1, Y7
+ VPERM2I128 $0x13, Y5, Y9, Y11
+ VPERM2I128 $0x13, Y13, Y1, Y15
+ VPXOR 128(SI), Y3, Y3
+ VPXOR 160(SI), Y7, Y7
+ VPXOR 192(SI), Y11, Y11
+ VPXOR 224(SI), Y15, Y15
+ VMOVDQU Y3, 128(DI)
+ VMOVDQU Y7, 160(DI)
+ VMOVDQU Y11, 192(DI)
+ VMOVDQU Y15, 224(DI)
+ VPERM2I128 $0x02, Y6, Y10, Y0
+ VPERM2I128 $0x02, Y8, Y2, Y14
+ VPERM2I128 $0x13, Y6, Y10, Y12
+ VPERM2I128 $0x13, Y8, Y2, Y4
+ LEAQ 256(SI), SI
+ LEAQ 256(DI), DI
+ SUBQ $0x00000100, BX
+ JMP openAVX2TailLoop
-sealSSETail192LoopB:
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X3
- PXOR X12, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X3
- PXOR X12, X3
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X4
- PXOR X12, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X4
- PXOR X12, X4
- PADDD X5, X2
- PXOR X2, X11
- ROL16(X11, X12)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X5
- PXOR X12, X5
- PADDD X5, X2
- PXOR X2, X11
- ROL8(X11, X12)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X5
- PXOR X12, X5
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc0
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x0c
- ADDQ (DI), R10
- ADCQ 8(DI), R11
- ADCQ $0x01, R12
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
+openAVX2Tail512:
+ VMOVDQU ·chacha20Constants<>+0(SB), Y0
+ VMOVDQA Y0, Y5
+ VMOVDQA Y0, Y6
+ VMOVDQA Y0, Y7
+ VMOVDQA 32(BP), Y14
+ VMOVDQA Y14, Y9
+ VMOVDQA Y14, Y10
+ VMOVDQA Y14, Y11
+ VMOVDQA 64(BP), Y12
+ VMOVDQA Y12, Y13
+ VMOVDQA Y12, Y8
+ VMOVDQA Y12, Y15
+ VMOVDQA 192(BP), Y4
+ VPADDD ·avx2IncMask<>+0(SB), Y4, Y4
+ VPADDD ·avx2IncMask<>+0(SB), Y4, Y1
+ VPADDD ·avx2IncMask<>+0(SB), Y1, Y2
+ VPADDD ·avx2IncMask<>+0(SB), Y2, Y3
+ VMOVDQA Y4, 96(BP)
+ VMOVDQA Y1, 128(BP)
+ VMOVDQA Y2, 160(BP)
+ VMOVDQA Y3, 192(BP)
+ XORQ CX, CX
+ MOVQ SI, R9
+
+openAVX2Tail512LoopB:
+ ADDQ (R9), R10
+ ADCQ 8(R9), R11
+ ADCQ $0x01, R12
+ MOVQ (BP), DX
+ MOVQ DX, R15
+ MULXQ R10, R13, R14
IMULQ R12, R15
+ MULXQ R11, AX, DX
ADDQ AX, R14
ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
+ MOVQ 8(BP), DX
+ MULXQ R10, R10, AX
+ ADDQ R10, R14
+ MULXQ R11, R11, R8
+ ADCQ R11, R15
+ ADCQ $0x00, R8
+ IMULQ R12, DX
ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
ADCQ DX, R8
MOVQ R13, R10
MOVQ R14, R11
@@ -6450,465 +2053,268 @@ sealSSETail192LoopB:
ADDQ R15, R10
ADCQ R8, R11
ADCQ $0x00, R12
- LEAQ 16(DI), DI
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X3
- PXOR X12, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X3
- PXOR X12, X3
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X4
- PXOR X12, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X4
- PXOR X12, X4
- PADDD X5, X2
- PXOR X2, X11
- ROL16(X11, X12)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X5
- PXOR X12, X5
- PADDD X5, X2
- PXOR X2, X11
- ROL8(X11, X12)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X5
- PXOR X12, X5
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc0
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x04
- DECQ CX
- JG sealSSETail192LoopA
- DECQ R9
- JGE sealSSETail192LoopB
- PADDL ·chacha20Constants<>+0(SB), X0
- PADDL ·chacha20Constants<>+0(SB), X1
- PADDL ·chacha20Constants<>+0(SB), X2
- PADDL 32(BP), X3
- PADDL 32(BP), X4
- PADDL 32(BP), X5
- PADDL 48(BP), X6
- PADDL 48(BP), X7
- PADDL 48(BP), X8
- PADDL 80(BP), X9
- PADDL 96(BP), X10
- PADDL 112(BP), X11
- MOVOU (SI), X12
- MOVOU 16(SI), X13
- MOVOU 32(SI), X14
- MOVOU 48(SI), X15
- PXOR X12, X0
- PXOR X13, X3
- PXOR X14, X6
- PXOR X15, X9
- MOVOU X0, (DI)
- MOVOU X3, 16(DI)
- MOVOU X6, 32(DI)
- MOVOU X9, 48(DI)
- MOVOU 64(SI), X12
- MOVOU 80(SI), X13
- MOVOU 96(SI), X14
- MOVOU 112(SI), X15
- PXOR X12, X1
- PXOR X13, X4
- PXOR X14, X7
- PXOR X15, X10
- MOVOU X1, 64(DI)
- MOVOU X4, 80(DI)
- MOVOU X7, 96(DI)
- MOVOU X10, 112(DI)
- MOVO X2, X1
- MOVO X5, X4
- MOVO X8, X7
- MOVO X11, X10
- MOVQ $0x00000080, CX
- LEAQ 128(SI), SI
- SUBQ $0x80, BX
- JMP sealSSE128SealHash
-
-sealSSE128:
- MOVOU ·chacha20Constants<>+0(SB), X0
- MOVOU 16(R8), X3
- MOVOU 32(R8), X6
- MOVOU 48(R8), X9
- MOVO X0, X1
- MOVO X3, X4
- MOVO X6, X7
- MOVO X9, X10
- PADDL ·sseIncMask<>+0(SB), X10
- MOVO X1, X2
- MOVO X4, X5
- MOVO X7, X8
- MOVO X10, X11
- PADDL ·sseIncMask<>+0(SB), X11
- MOVO X3, X13
- MOVO X6, X14
- MOVO X10, X15
- MOVQ $0x0000000a, R9
-
-sealSSE128InnerCipherLoop:
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X3
- PXOR X12, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X3
- PXOR X12, X3
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X4
- PXOR X12, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X4
- PXOR X12, X4
- PADDD X5, X2
- PXOR X2, X11
- ROL16(X11, X12)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X5
- PXOR X12, X5
- PADDD X5, X2
- PXOR X2, X11
- ROL8(X11, X12)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X5
- PXOR X12, X5
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x04
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc0
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x0c
- PADDD X3, X0
- PXOR X0, X9
- ROL16(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X3
- PXOR X12, X3
- PADDD X3, X0
- PXOR X0, X9
- ROL8(X9, X12)
- PADDD X9, X6
- PXOR X6, X3
- MOVO X3, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X3
- PXOR X12, X3
- PADDD X4, X1
- PXOR X1, X10
- ROL16(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X4
- PXOR X12, X4
- PADDD X4, X1
- PXOR X1, X10
- ROL8(X10, X12)
- PADDD X10, X7
- PXOR X7, X4
- MOVO X4, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X4
- PXOR X12, X4
- PADDD X5, X2
- PXOR X2, X11
- ROL16(X11, X12)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X12
- PSLLL $0x0c, X12
- PSRLL $0x14, X5
- PXOR X12, X5
- PADDD X5, X2
- PXOR X2, X11
- ROL8(X11, X12)
- PADDD X11, X8
- PXOR X8, X5
- MOVO X5, X12
- PSLLL $0x07, X12
- PSRLL $0x19, X5
- PXOR X12, X5
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xe4
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xed
- BYTE $0x0c
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xf6
- BYTE $0x08
- BYTE $0x66
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xff
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc0
- BYTE $0x08
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xc9
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xd2
- BYTE $0x04
- BYTE $0x66
- BYTE $0x45
- BYTE $0x0f
- BYTE $0x3a
- BYTE $0x0f
- BYTE $0xdb
- BYTE $0x04
- DECQ R9
- JNE sealSSE128InnerCipherLoop
-
- // A0|B0 hold the Poly1305 32-byte key, C0,D0 can be discarded
- PADDL ·chacha20Constants<>+0(SB), X0
- PADDL ·chacha20Constants<>+0(SB), X1
- PADDL ·chacha20Constants<>+0(SB), X2
- PADDL X13, X3
- PADDL X13, X4
- PADDL X13, X5
- PADDL X14, X7
- PADDL X14, X8
- PADDL X15, X10
- PADDL ·sseIncMask<>+0(SB), X15
- PADDL X15, X11
- PAND ·polyClampMask<>+0(SB), X0
- MOVOU X0, (BP)
- MOVOU X3, 16(BP)
+ LEAQ 16(R9), R9
- // Hash
- MOVQ ad_len+80(FP), R9
- CALL polyHashADInternal<>(SB)
- XORQ CX, CX
+openAVX2Tail512LoopA:
+ VPADDD Y14, Y0, Y0
+ VPADDD Y9, Y5, Y5
+ VPADDD Y10, Y6, Y6
+ VPADDD Y11, Y7, Y7
+ VPXOR Y0, Y4, Y4
+ VPXOR Y5, Y1, Y1
+ VPXOR Y6, Y2, Y2
+ VPXOR Y7, Y3, Y3
+ VPSHUFB ·rol16<>+0(SB), Y4, Y4
+ VPSHUFB ·rol16<>+0(SB), Y1, Y1
+ VPSHUFB ·rol16<>+0(SB), Y2, Y2
+ VPSHUFB ·rol16<>+0(SB), Y3, Y3
+ VPADDD Y4, Y12, Y12
+ VPADDD Y1, Y13, Y13
+ VPADDD Y2, Y8, Y8
+ VPADDD Y3, Y15, Y15
+ VPXOR Y12, Y14, Y14
+ VPXOR Y13, Y9, Y9
+ VPXOR Y8, Y10, Y10
+ VPXOR Y15, Y11, Y11
+ VMOVDQA Y15, 224(BP)
+ VPSLLD $0x0c, Y14, Y15
+ VPSRLD $0x14, Y14, Y14
+ VPXOR Y15, Y14, Y14
+ VPSLLD $0x0c, Y9, Y15
+ VPSRLD $0x14, Y9, Y9
+ VPXOR Y15, Y9, Y9
+ VPSLLD $0x0c, Y10, Y15
+ VPSRLD $0x14, Y10, Y10
+ VPXOR Y15, Y10, Y10
+ VPSLLD $0x0c, Y11, Y15
+ VPSRLD $0x14, Y11, Y11
+ VPXOR Y15, Y11, Y11
+ VMOVDQA 224(BP), Y15
+ ADDQ (R9), R10
+ ADCQ 8(R9), R11
+ ADCQ $0x01, R12
+ MOVQ (BP), DX
+ MOVQ DX, R15
+ MULXQ R10, R13, R14
+ IMULQ R12, R15
+ MULXQ R11, AX, DX
+ ADDQ AX, R14
+ ADCQ DX, R15
+ MOVQ 8(BP), DX
+ MULXQ R10, R10, AX
+ ADDQ R10, R14
+ MULXQ R11, R11, R8
+ ADCQ R11, R15
+ ADCQ $0x00, R8
+ IMULQ R12, DX
+ ADDQ AX, R15
+ ADCQ DX, R8
+ MOVQ R13, R10
+ MOVQ R14, R11
+ MOVQ R15, R12
+ ANDQ $0x03, R12
+ MOVQ R15, R13
+ ANDQ $-4, R13
+ MOVQ R8, R14
+ SHRQ $0x02, R8, R15
+ SHRQ $0x02, R8
+ ADDQ R13, R10
+ ADCQ R14, R11
+ ADCQ $0x00, R12
+ ADDQ R15, R10
+ ADCQ R8, R11
+ ADCQ $0x00, R12
+ VPADDD Y14, Y0, Y0
+ VPADDD Y9, Y5, Y5
+ VPADDD Y10, Y6, Y6
+ VPADDD Y11, Y7, Y7
+ VPXOR Y0, Y4, Y4
+ VPXOR Y5, Y1, Y1
+ VPXOR Y6, Y2, Y2
+ VPXOR Y7, Y3, Y3
+ VPSHUFB ·rol8<>+0(SB), Y4, Y4
+ VPSHUFB ·rol8<>+0(SB), Y1, Y1
+ VPSHUFB ·rol8<>+0(SB), Y2, Y2
+ VPSHUFB ·rol8<>+0(SB), Y3, Y3
+ VPADDD Y4, Y12, Y12
+ VPADDD Y1, Y13, Y13
+ VPADDD Y2, Y8, Y8
+ VPADDD Y3, Y15, Y15
+ VPXOR Y12, Y14, Y14
+ VPXOR Y13, Y9, Y9
+ VPXOR Y8, Y10, Y10
+ VPXOR Y15, Y11, Y11
+ VMOVDQA Y15, 224(BP)
+ VPSLLD $0x07, Y14, Y15
+ VPSRLD $0x19, Y14, Y14
+ VPXOR Y15, Y14, Y14
+ VPSLLD $0x07, Y9, Y15
+ VPSRLD $0x19, Y9, Y9
+ VPXOR Y15, Y9, Y9
+ VPSLLD $0x07, Y10, Y15
+ VPSRLD $0x19, Y10, Y10
+ VPXOR Y15, Y10, Y10
+ VPSLLD $0x07, Y11, Y15
+ VPSRLD $0x19, Y11, Y11
+ VPXOR Y15, Y11, Y11
+ VMOVDQA 224(BP), Y15
+ VPALIGNR $0x04, Y14, Y14, Y14
+ VPALIGNR $0x04, Y9, Y9, Y9
+ VPALIGNR $0x04, Y10, Y10, Y10
+ VPALIGNR $0x04, Y11, Y11, Y11
+ VPALIGNR $0x08, Y12, Y12, Y12
+ VPALIGNR $0x08, Y13, Y13, Y13
+ VPALIGNR $0x08, Y8, Y8, Y8
+ VPALIGNR $0x08, Y15, Y15, Y15
+ VPALIGNR $0x0c, Y4, Y4, Y4
+ VPALIGNR $0x0c, Y1, Y1, Y1
+ VPALIGNR $0x0c, Y2, Y2, Y2
+ VPALIGNR $0x0c, Y3, Y3, Y3
+ VPADDD Y14, Y0, Y0
+ VPADDD Y9, Y5, Y5
+ VPADDD Y10, Y6, Y6
+ VPADDD Y11, Y7, Y7
+ VPXOR Y0, Y4, Y4
+ VPXOR Y5, Y1, Y1
+ VPXOR Y6, Y2, Y2
+ VPXOR Y7, Y3, Y3
+ VPSHUFB ·rol16<>+0(SB), Y4, Y4
+ VPSHUFB ·rol16<>+0(SB), Y1, Y1
+ VPSHUFB ·rol16<>+0(SB), Y2, Y2
+ VPSHUFB ·rol16<>+0(SB), Y3, Y3
+ VPADDD Y4, Y12, Y12
+ VPADDD Y1, Y13, Y13
+ VPADDD Y2, Y8, Y8
+ VPADDD Y3, Y15, Y15
+ VPXOR Y12, Y14, Y14
+ VPXOR Y13, Y9, Y9
+ VPXOR Y8, Y10, Y10
+ VPXOR Y15, Y11, Y11
+ ADDQ 16(R9), R10
+ ADCQ 24(R9), R11
+ ADCQ $0x01, R12
+ MOVQ (BP), DX
+ MOVQ DX, R15
+ MULXQ R10, R13, R14
+ IMULQ R12, R15
+ MULXQ R11, AX, DX
+ ADDQ AX, R14
+ ADCQ DX, R15
+ MOVQ 8(BP), DX
+ MULXQ R10, R10, AX
+ ADDQ R10, R14
+ MULXQ R11, R11, R8
+ ADCQ R11, R15
+ ADCQ $0x00, R8
+ IMULQ R12, DX
+ ADDQ AX, R15
+ ADCQ DX, R8
+ MOVQ R13, R10
+ MOVQ R14, R11
+ MOVQ R15, R12
+ ANDQ $0x03, R12
+ MOVQ R15, R13
+ ANDQ $-4, R13
+ MOVQ R8, R14
+ SHRQ $0x02, R8, R15
+ SHRQ $0x02, R8
+ ADDQ R13, R10
+ ADCQ R14, R11
+ ADCQ $0x00, R12
+ ADDQ R15, R10
+ ADCQ R8, R11
+ ADCQ $0x00, R12
+ LEAQ 32(R9), R9
+ VMOVDQA Y15, 224(BP)
+ VPSLLD $0x0c, Y14, Y15
+ VPSRLD $0x14, Y14, Y14
+ VPXOR Y15, Y14, Y14
+ VPSLLD $0x0c, Y9, Y15
+ VPSRLD $0x14, Y9, Y9
+ VPXOR Y15, Y9, Y9
+ VPSLLD $0x0c, Y10, Y15
+ VPSRLD $0x14, Y10, Y10
+ VPXOR Y15, Y10, Y10
+ VPSLLD $0x0c, Y11, Y15
+ VPSRLD $0x14, Y11, Y11
+ VPXOR Y15, Y11, Y11
+ VMOVDQA 224(BP), Y15
+ VPADDD Y14, Y0, Y0
+ VPADDD Y9, Y5, Y5
+ VPADDD Y10, Y6, Y6
+ VPADDD Y11, Y7, Y7
+ VPXOR Y0, Y4, Y4
+ VPXOR Y5, Y1, Y1
+ VPXOR Y6, Y2, Y2
+ VPXOR Y7, Y3, Y3
+ VPSHUFB ·rol8<>+0(SB), Y4, Y4
+ VPSHUFB ·rol8<>+0(SB), Y1, Y1
+ VPSHUFB ·rol8<>+0(SB), Y2, Y2
+ VPSHUFB ·rol8<>+0(SB), Y3, Y3
+ VPADDD Y4, Y12, Y12
+ VPADDD Y1, Y13, Y13
+ VPADDD Y2, Y8, Y8
+ VPADDD Y3, Y15, Y15
+ VPXOR Y12, Y14, Y14
+ VPXOR Y13, Y9, Y9
+ VPXOR Y8, Y10, Y10
+ VPXOR Y15, Y11, Y11
+ VMOVDQA Y15, 224(BP)
+ VPSLLD $0x07, Y14, Y15
+ VPSRLD $0x19, Y14, Y14
+ VPXOR Y15, Y14, Y14
+ VPSLLD $0x07, Y9, Y15
+ VPSRLD $0x19, Y9, Y9
+ VPXOR Y15, Y9, Y9
+ VPSLLD $0x07, Y10, Y15
+ VPSRLD $0x19, Y10, Y10
+ VPXOR Y15, Y10, Y10
+ VPSLLD $0x07, Y11, Y15
+ VPSRLD $0x19, Y11, Y11
+ VPXOR Y15, Y11, Y11
+ VMOVDQA 224(BP), Y15
+ VPALIGNR $0x0c, Y14, Y14, Y14
+ VPALIGNR $0x0c, Y9, Y9, Y9
+ VPALIGNR $0x0c, Y10, Y10, Y10
+ VPALIGNR $0x0c, Y11, Y11, Y11
+ VPALIGNR $0x08, Y12, Y12, Y12
+ VPALIGNR $0x08, Y13, Y13, Y13
+ VPALIGNR $0x08, Y8, Y8, Y8
+ VPALIGNR $0x08, Y15, Y15, Y15
+ VPALIGNR $0x04, Y4, Y4, Y4
+ VPALIGNR $0x04, Y1, Y1, Y1
+ VPALIGNR $0x04, Y2, Y2, Y2
+ VPALIGNR $0x04, Y3, Y3, Y3
+ INCQ CX
+ CMPQ CX, $0x04
+ JLT openAVX2Tail512LoopB
+ CMPQ CX, $0x0a
+ JNE openAVX2Tail512LoopA
+ MOVQ BX, CX
+ SUBQ $0x00000180, CX
+ ANDQ $-16, CX
-sealSSE128SealHash:
- CMPQ CX, $0x10
- JB sealSSE128Seal
- ADDQ (DI), R10
- ADCQ 8(DI), R11
+openAVX2Tail512HashLoop:
+ TESTQ CX, CX
+ JE openAVX2Tail512HashEnd
+ ADDQ (R9), R10
+ ADCQ 8(R9), R11
ADCQ $0x01, R12
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
+ MOVQ (BP), DX
+ MOVQ DX, R15
+ MULXQ R10, R13, R14
IMULQ R12, R15
+ MULXQ R11, AX, DX
ADDQ AX, R14
ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
+ MOVQ 8(BP), DX
+ MULXQ R10, R10, AX
+ ADDQ R10, R14
+ MULXQ R11, R11, R8
+ ADCQ R11, R15
+ ADCQ $0x00, R8
+ IMULQ R12, DX
ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
ADCQ DX, R8
MOVQ R13, R10
MOVQ R14, R11
@@ -6925,238 +2331,162 @@ sealSSE128SealHash:
ADDQ R15, R10
ADCQ R8, R11
ADCQ $0x00, R12
+ LEAQ 16(R9), R9
SUBQ $0x10, CX
- ADDQ $0x10, DI
- JMP sealSSE128SealHash
-
-sealSSE128Seal:
- CMPQ BX, $0x10
- JB sealSSETail
- SUBQ $0x10, BX
-
- // Load for decryption
- MOVOU (SI), X12
- PXOR X12, X1
- MOVOU X1, (DI)
- LEAQ 16(SI), SI
- LEAQ 16(DI), DI
-
- // Extract for hashing
- MOVQ X1, R13
- PSRLDQ $0x08, X1
- MOVQ X1, R14
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x01, R12
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
- IMULQ R12, R15
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
- ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
-
- // Shift the stream "left"
- MOVO X4, X1
- MOVO X7, X4
- MOVO X10, X7
- MOVO X2, X10
- MOVO X5, X2
- MOVO X8, X5
- MOVO X11, X8
- JMP sealSSE128Seal
+ JMP openAVX2Tail512HashLoop
-sealSSETail:
- TESTQ BX, BX
- JE sealSSEFinalize
+openAVX2Tail512HashEnd:
+ VPADDD ·chacha20Constants<>+0(SB), Y0, Y0
+ VPADDD ·chacha20Constants<>+0(SB), Y5, Y5
+ VPADDD ·chacha20Constants<>+0(SB), Y6, Y6
+ VPADDD ·chacha20Constants<>+0(SB), Y7, Y7
+ VPADDD 32(BP), Y14, Y14
+ VPADDD 32(BP), Y9, Y9
+ VPADDD 32(BP), Y10, Y10
+ VPADDD 32(BP), Y11, Y11
+ VPADDD 64(BP), Y12, Y12
+ VPADDD 64(BP), Y13, Y13
+ VPADDD 64(BP), Y8, Y8
+ VPADDD 64(BP), Y15, Y15
+ VPADDD 96(BP), Y4, Y4
+ VPADDD 128(BP), Y1, Y1
+ VPADDD 160(BP), Y2, Y2
+ VPADDD 192(BP), Y3, Y3
+ VMOVDQA Y15, 224(BP)
+ VPERM2I128 $0x02, Y0, Y14, Y15
+ VPERM2I128 $0x13, Y0, Y14, Y14
+ VPERM2I128 $0x02, Y12, Y4, Y0
+ VPERM2I128 $0x13, Y12, Y4, Y12
+ VPXOR (SI), Y15, Y15
+ VPXOR 32(SI), Y0, Y0
+ VPXOR 64(SI), Y14, Y14
+ VPXOR 96(SI), Y12, Y12
+ VMOVDQU Y15, (DI)
+ VMOVDQU Y0, 32(DI)
+ VMOVDQU Y14, 64(DI)
+ VMOVDQU Y12, 96(DI)
+ VPERM2I128 $0x02, Y5, Y9, Y0
+ VPERM2I128 $0x02, Y13, Y1, Y14
+ VPERM2I128 $0x13, Y5, Y9, Y12
+ VPERM2I128 $0x13, Y13, Y1, Y4
+ VPXOR 128(SI), Y0, Y0
+ VPXOR 160(SI), Y14, Y14
+ VPXOR 192(SI), Y12, Y12
+ VPXOR 224(SI), Y4, Y4
+ VMOVDQU Y0, 128(DI)
+ VMOVDQU Y14, 160(DI)
+ VMOVDQU Y12, 192(DI)
+ VMOVDQU Y4, 224(DI)
+ VPERM2I128 $0x02, Y6, Y10, Y0
+ VPERM2I128 $0x02, Y8, Y2, Y14
+ VPERM2I128 $0x13, Y6, Y10, Y12
+ VPERM2I128 $0x13, Y8, Y2, Y4
+ VPXOR 256(SI), Y0, Y0
+ VPXOR 288(SI), Y14, Y14
+ VPXOR 320(SI), Y12, Y12
+ VPXOR 352(SI), Y4, Y4
+ VMOVDQU Y0, 256(DI)
+ VMOVDQU Y14, 288(DI)
+ VMOVDQU Y12, 320(DI)
+ VMOVDQU Y4, 352(DI)
+ VPERM2I128 $0x02, Y7, Y11, Y0
+ VPERM2I128 $0x02, 224(BP), Y3, Y14
+ VPERM2I128 $0x13, Y7, Y11, Y12
+ VPERM2I128 $0x13, 224(BP), Y3, Y4
+ LEAQ 384(SI), SI
+ LEAQ 384(DI), DI
+ SUBQ $0x00000180, BX
+ JMP openAVX2TailLoop
- // We can only load the PT one byte at a time to avoid read after end of buffer
- MOVQ BX, R9
- SHLQ $0x04, R9
- LEAQ ·andMask<>+0(SB), R13
- MOVQ BX, CX
- LEAQ -1(SI)(BX*1), SI
- XORQ R15, R15
- XORQ R8, R8
- XORQ AX, AX
+DATA ·chacha20Constants<>+0(SB)/4, $0x61707865
+DATA ·chacha20Constants<>+4(SB)/4, $0x3320646e
+DATA ·chacha20Constants<>+8(SB)/4, $0x79622d32
+DATA ·chacha20Constants<>+12(SB)/4, $0x6b206574
+DATA ·chacha20Constants<>+16(SB)/4, $0x61707865
+DATA ·chacha20Constants<>+20(SB)/4, $0x3320646e
+DATA ·chacha20Constants<>+24(SB)/4, $0x79622d32
+DATA ·chacha20Constants<>+28(SB)/4, $0x6b206574
+GLOBL ·chacha20Constants<>(SB), RODATA|NOPTR, $32
-sealSSETailLoadLoop:
- SHLQ $0x08, R15, R8
- SHLQ $0x08, R15
- MOVB (SI), AX
- XORQ AX, R15
- LEAQ -1(SI), SI
- DECQ CX
- JNE sealSSETailLoadLoop
- MOVQ R15, 64(BP)
- MOVQ R8, 72(BP)
- PXOR 64(BP), X1
- MOVOU X1, (DI)
- MOVOU -16(R13)(R9*1), X12
- PAND X12, X1
- MOVQ X1, R13
- PSRLDQ $0x08, X1
- MOVQ X1, R14
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x01, R12
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
- IMULQ R12, R15
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
- ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
- ADDQ BX, DI
+DATA ·avx2InitMask<>+0(SB)/8, $0x0000000000000000
+DATA ·avx2InitMask<>+8(SB)/8, $0x0000000000000000
+DATA ·avx2InitMask<>+16(SB)/8, $0x0000000000000001
+DATA ·avx2InitMask<>+24(SB)/8, $0x0000000000000000
+GLOBL ·avx2InitMask<>(SB), RODATA|NOPTR, $32
-sealSSEFinalize:
- // Hash in the buffer lengths
- ADDQ ad_len+80(FP), R10
- ADCQ src_len+56(FP), R11
- ADCQ $0x01, R12
- MOVQ (BP), AX
- MOVQ AX, R15
- MULQ R10
- MOVQ AX, R13
- MOVQ DX, R14
- MOVQ (BP), AX
- MULQ R11
- IMULQ R12, R15
- ADDQ AX, R14
- ADCQ DX, R15
- MOVQ 8(BP), AX
- MOVQ AX, R8
- MULQ R10
- ADDQ AX, R14
- ADCQ $0x00, DX
- MOVQ DX, R10
- MOVQ 8(BP), AX
- MULQ R11
- ADDQ AX, R15
- ADCQ $0x00, DX
- IMULQ R12, R8
- ADDQ R10, R15
- ADCQ DX, R8
- MOVQ R13, R10
- MOVQ R14, R11
- MOVQ R15, R12
- ANDQ $0x03, R12
- MOVQ R15, R13
- ANDQ $-4, R13
- MOVQ R8, R14
- SHRQ $0x02, R8, R15
- SHRQ $0x02, R8
- ADDQ R13, R10
- ADCQ R14, R11
- ADCQ $0x00, R12
- ADDQ R15, R10
- ADCQ R8, R11
- ADCQ $0x00, R12
+DATA ·rol16<>+0(SB)/8, $0x0504070601000302
+DATA ·rol16<>+8(SB)/8, $0x0d0c0f0e09080b0a
+DATA ·rol16<>+16(SB)/8, $0x0504070601000302
+DATA ·rol16<>+24(SB)/8, $0x0d0c0f0e09080b0a
+GLOBL ·rol16<>(SB), RODATA|NOPTR, $32
- // Final reduce
- MOVQ R10, R13
- MOVQ R11, R14
- MOVQ R12, R15
- SUBQ $-5, R10
- SBBQ $-1, R11
- SBBQ $0x03, R12
- CMOVQCS R13, R10
- CMOVQCS R14, R11
- CMOVQCS R15, R12
+DATA ·rol8<>+0(SB)/8, $0x0605040702010003
+DATA ·rol8<>+8(SB)/8, $0x0e0d0c0f0a09080b
+DATA ·rol8<>+16(SB)/8, $0x0605040702010003
+DATA ·rol8<>+24(SB)/8, $0x0e0d0c0f0a09080b
+GLOBL ·rol8<>(SB), RODATA|NOPTR, $32
- // Add in the "s" part of the key
- ADDQ 16(BP), R10
- ADCQ 24(BP), R11
+DATA ·polyClampMask<>+0(SB)/8, $0x0ffffffc0fffffff
+DATA ·polyClampMask<>+8(SB)/8, $0x0ffffffc0ffffffc
+DATA ·polyClampMask<>+16(SB)/8, $0xffffffffffffffff
+DATA ·polyClampMask<>+24(SB)/8, $0xffffffffffffffff
+GLOBL ·polyClampMask<>(SB), RODATA|NOPTR, $32
- // Finally store the tag at the end of the message
- MOVQ R10, (DI)
- MOVQ R11, 8(DI)
- RET
+DATA ·avx2IncMask<>+0(SB)/8, $0x0000000000000002
+DATA ·avx2IncMask<>+8(SB)/8, $0x0000000000000000
+DATA ·avx2IncMask<>+16(SB)/8, $0x0000000000000002
+DATA ·avx2IncMask<>+24(SB)/8, $0x0000000000000000
+GLOBL ·avx2IncMask<>(SB), RODATA|NOPTR, $32
+
+DATA ·andMask<>+0(SB)/8, $0x00000000000000ff
+DATA ·andMask<>+8(SB)/8, $0x0000000000000000
+DATA ·andMask<>+16(SB)/8, $0x000000000000ffff
+DATA ·andMask<>+24(SB)/8, $0x0000000000000000
+DATA ·andMask<>+32(SB)/8, $0x0000000000ffffff
+DATA ·andMask<>+40(SB)/8, $0x0000000000000000
+DATA ·andMask<>+48(SB)/8, $0x00000000ffffffff
+DATA ·andMask<>+56(SB)/8, $0x0000000000000000
+DATA ·andMask<>+64(SB)/8, $0x000000ffffffffff
+DATA ·andMask<>+72(SB)/8, $0x0000000000000000
+DATA ·andMask<>+80(SB)/8, $0x0000ffffffffffff
+DATA ·andMask<>+88(SB)/8, $0x0000000000000000
+DATA ·andMask<>+96(SB)/8, $0x00ffffffffffffff
+DATA ·andMask<>+104(SB)/8, $0x0000000000000000
+DATA ·andMask<>+112(SB)/8, $0xffffffffffffffff
+DATA ·andMask<>+120(SB)/8, $0x0000000000000000
+DATA ·andMask<>+128(SB)/8, $0xffffffffffffffff
+DATA ·andMask<>+136(SB)/8, $0x00000000000000ff
+DATA ·andMask<>+144(SB)/8, $0xffffffffffffffff
+DATA ·andMask<>+152(SB)/8, $0x000000000000ffff
+DATA ·andMask<>+160(SB)/8, $0xffffffffffffffff
+DATA ·andMask<>+168(SB)/8, $0x0000000000ffffff
+DATA ·andMask<>+176(SB)/8, $0xffffffffffffffff
+DATA ·andMask<>+184(SB)/8, $0x00000000ffffffff
+DATA ·andMask<>+192(SB)/8, $0xffffffffffffffff
+DATA ·andMask<>+200(SB)/8, $0x000000ffffffffff
+DATA ·andMask<>+208(SB)/8, $0xffffffffffffffff
+DATA ·andMask<>+216(SB)/8, $0x0000ffffffffffff
+DATA ·andMask<>+224(SB)/8, $0xffffffffffffffff
+DATA ·andMask<>+232(SB)/8, $0x00ffffffffffffff
+GLOBL ·andMask<>(SB), RODATA|NOPTR, $240
-chacha20Poly1305Seal_AVX2:
+// func chacha20Poly1305Seal(dst []byte, key []uint32, src []byte, ad []byte)
+// Requires: AVX, AVX2, BMI2, CMOV, SSE2
+TEXT ·chacha20Poly1305Seal(SB), $288-96
+ MOVQ SP, BP
+ ADDQ $0x20, BP
+ ANDQ $-32, BP
+ MOVQ dst_base+0(FP), DI
+ MOVQ key_base+24(FP), R8
+ MOVQ src_base+48(FP), SI
+ MOVQ src_len+56(FP), BX
+ MOVQ ad_base+72(FP), CX
VZEROUPPER
- VMOVDQU ·chacha20Constants<>+0(SB), Y0
- BYTE $0xc4
- BYTE $0x42
- BYTE $0x7d
- BYTE $0x5a
- BYTE $0x70
- BYTE $0x10
- BYTE $0xc4
- BYTE $0x42
- BYTE $0x7d
- BYTE $0x5a
- BYTE $0x60
- BYTE $0x20
- BYTE $0xc4
- BYTE $0xc2
- BYTE $0x7d
- BYTE $0x5a
- BYTE $0x60
- BYTE $0x30
- VPADDD ·avx2InitMask<>+0(SB), Y4, Y4
+ VMOVDQU ·chacha20Constants<>+0(SB), Y0
+ VBROADCASTI128 16(R8), Y14
+ VBROADCASTI128 32(R8), Y12
+ VBROADCASTI128 48(R8), Y4
+ VPADDD ·avx2InitMask<>+0(SB), Y4, Y4
// Special optimizations, for very short buffers
CMPQ BX, $0x000000c0
@@ -8170,6 +3500,144 @@ sealAVX2InternalLoopStart:
JBE sealAVX2Tail384
JMP sealAVX2Tail512
+sealSSETail:
+ TESTQ BX, BX
+ JE sealSSEFinalize
+
+ // We can only load the PT one byte at a time to avoid read after end of buffer
+ MOVQ BX, R9
+ SHLQ $0x04, R9
+ LEAQ ·andMask<>+0(SB), R13
+ MOVQ BX, CX
+ LEAQ -1(SI)(BX*1), SI
+ XORQ R15, R15
+ XORQ R8, R8
+ XORQ AX, AX
+
+sealSSETailLoadLoop:
+ SHLQ $0x08, R15, R8
+ SHLQ $0x08, R15
+ MOVB (SI), AX
+ XORQ AX, R15
+ LEAQ -1(SI), SI
+ DECQ CX
+ JNE sealSSETailLoadLoop
+ MOVQ R15, 64(BP)
+ MOVQ R8, 72(BP)
+ PXOR 64(BP), X1
+ MOVOU X1, (DI)
+ MOVOU -16(R13)(R9*1), X12
+ PAND X12, X1
+ MOVQ X1, R13
+ PSRLDQ $0x08, X1
+ MOVQ X1, R14
+ ADDQ R13, R10
+ ADCQ R14, R11
+ ADCQ $0x01, R12
+ MOVQ (BP), AX
+ MOVQ AX, R15
+ MULQ R10
+ MOVQ AX, R13
+ MOVQ DX, R14
+ MOVQ (BP), AX
+ MULQ R11
+ IMULQ R12, R15
+ ADDQ AX, R14
+ ADCQ DX, R15
+ MOVQ 8(BP), AX
+ MOVQ AX, R8
+ MULQ R10
+ ADDQ AX, R14
+ ADCQ $0x00, DX
+ MOVQ DX, R10
+ MOVQ 8(BP), AX
+ MULQ R11
+ ADDQ AX, R15
+ ADCQ $0x00, DX
+ IMULQ R12, R8
+ ADDQ R10, R15
+ ADCQ DX, R8
+ MOVQ R13, R10
+ MOVQ R14, R11
+ MOVQ R15, R12
+ ANDQ $0x03, R12
+ MOVQ R15, R13
+ ANDQ $-4, R13
+ MOVQ R8, R14
+ SHRQ $0x02, R8, R15
+ SHRQ $0x02, R8
+ ADDQ R13, R10
+ ADCQ R14, R11
+ ADCQ $0x00, R12
+ ADDQ R15, R10
+ ADCQ R8, R11
+ ADCQ $0x00, R12
+ ADDQ BX, DI
+
+sealSSEFinalize:
+ // Hash in the buffer lengths
+ ADDQ ad_len+80(FP), R10
+ ADCQ src_len+56(FP), R11
+ ADCQ $0x01, R12
+ MOVQ (BP), AX
+ MOVQ AX, R15
+ MULQ R10
+ MOVQ AX, R13
+ MOVQ DX, R14
+ MOVQ (BP), AX
+ MULQ R11
+ IMULQ R12, R15
+ ADDQ AX, R14
+ ADCQ DX, R15
+ MOVQ 8(BP), AX
+ MOVQ AX, R8
+ MULQ R10
+ ADDQ AX, R14
+ ADCQ $0x00, DX
+ MOVQ DX, R10
+ MOVQ 8(BP), AX
+ MULQ R11
+ ADDQ AX, R15
+ ADCQ $0x00, DX
+ IMULQ R12, R8
+ ADDQ R10, R15
+ ADCQ DX, R8
+ MOVQ R13, R10
+ MOVQ R14, R11
+ MOVQ R15, R12
+ ANDQ $0x03, R12
+ MOVQ R15, R13
+ ANDQ $-4, R13
+ MOVQ R8, R14
+ SHRQ $0x02, R8, R15
+ SHRQ $0x02, R8
+ ADDQ R13, R10
+ ADCQ R14, R11
+ ADCQ $0x00, R12
+ ADDQ R15, R10
+ ADCQ R8, R11
+ ADCQ $0x00, R12
+
+ // Final reduce
+ MOVQ R10, R13
+ MOVQ R11, R14
+ MOVQ R12, R15
+ SUBQ $-5, R10
+ SBBQ $-1, R11
+ SBBQ $0x03, R12
+ CMOVQCS R13, R10
+ CMOVQCS R14, R11
+ CMOVQCS R15, R12
+
+ // Add in the "s" part of the key
+ ADDQ 16(BP), R10
+ ADCQ 24(BP), R11
+
+ // Finally store the tag at the end of the message
+ MOVQ R10, (DI)
+ MOVQ R11, 8(DI)
+ RET
+
seal192AVX2:
VMOVDQA Y0, Y5
VMOVDQA Y14, Y9
diff --git a/vendor/golang.org/x/crypto/hkdf/hkdf.go b/vendor/golang.org/x/crypto/hkdf/hkdf.go
index 3bee66294..49f3a5582 100644
--- a/vendor/golang.org/x/crypto/hkdf/hkdf.go
+++ b/vendor/golang.org/x/crypto/hkdf/hkdf.go
@@ -11,6 +11,7 @@
package hkdf
import (
+ "crypto/hkdf"
"crypto/hmac"
"errors"
"hash"
@@ -24,15 +25,19 @@ import (
// Expand invocations and different context values. Most common scenarios,
// including the generation of multiple keys, should use New instead.
func Extract(hash func() hash.Hash, secret, salt []byte) []byte {
- if salt == nil {
- salt = make([]byte, hash().Size())
+ // Use the stdlib Extract, which disables FIPS 140 enforcement of the HMAC
+ // key (which in HKDF is the salt). The only possible error is FIPS 140
+ // enforcement of the hash, which had to panic under this API anyway. We
+ // don't use the stdlib Expand, because it switched to returning a []byte
+ // instead of an io.Reader, and Expand uses the HMAC key as a key.
+ out, err := hkdf.Extract(hash, secret, salt)
+ if err != nil {
+ panic(err)
}
- extractor := hmac.New(hash, salt)
- extractor.Write(secret)
- return extractor.Sum(nil)
+ return out
}
-type hkdf struct {
+type hkdfReader struct {
expander hash.Hash
size int
@@ -43,7 +48,7 @@ type hkdf struct {
buf []byte
}
-func (f *hkdf) Read(p []byte) (int, error) {
+func (f *hkdfReader) Read(p []byte) (int, error) {
// Check whether enough data can be generated
need := len(p)
remains := len(f.buf) + int(255-f.counter+1)*f.size
@@ -84,7 +89,7 @@ func (f *hkdf) Read(p []byte) (int, error) {
// 3.3. Most common scenarios will want to use New instead.
func Expand(hash func() hash.Hash, pseudorandomKey, info []byte) io.Reader {
expander := hmac.New(hash, pseudorandomKey)
- return &hkdf{expander, expander.Size(), info, 1, nil, nil}
+ return &hkdfReader{expander, expander.Size(), info, 1, nil, nil}
}
// New returns a Reader, from which keys can be read, using the given hash,
diff --git a/vendor/golang.org/x/crypto/pkcs12/crypto.go b/vendor/golang.org/x/crypto/pkcs12/crypto.go
index 212538cb5..3f307323c 100644
--- a/vendor/golang.org/x/crypto/pkcs12/crypto.go
+++ b/vendor/golang.org/x/crypto/pkcs12/crypto.go
@@ -80,6 +80,10 @@ func pbDecrypterFor(algorithm pkix.AlgorithmIdentifier, password []byte) (cipher
return nil, 0, err
}
+ if params.Iterations < 0 || params.Iterations > maxIterations {
+ return nil, 0, NotImplementedError("iteration count is invalid or too high")
+ }
+
key := cipherType.deriveKey(params.Salt, password, params.Iterations)
iv := cipherType.deriveIV(params.Salt, password, params.Iterations)
diff --git a/vendor/golang.org/x/crypto/pkcs12/mac.go b/vendor/golang.org/x/crypto/pkcs12/mac.go
index 5f38aa7de..84039cee1 100644
--- a/vendor/golang.org/x/crypto/pkcs12/mac.go
+++ b/vendor/golang.org/x/crypto/pkcs12/mac.go
@@ -27,11 +27,19 @@ var (
oidSHA1 = asn1.ObjectIdentifier([]int{1, 3, 14, 3, 2, 26})
)
+// maxIterations is a safety limit to prevent CPU exhaustion from
+// crafted PKCS#12 files with unreasonable iteration counts.
+const maxIterations = 1 << 20 // ~1 million
+
func verifyMac(macData *macData, message, password []byte) error {
if !macData.Mac.Algorithm.Algorithm.Equal(oidSHA1) {
return NotImplementedError("unknown digest algorithm: " + macData.Mac.Algorithm.Algorithm.String())
}
+ if macData.Iterations < 0 || macData.Iterations > maxIterations {
+ return NotImplementedError("iteration count is invalid or too high")
+ }
+
key := pbkdf(sha1Sum, 20, 64, macData.MacSalt, password, macData.Iterations, 3, 20)
mac := hmac.New(sha1.New, key)
diff --git a/vendor/golang.org/x/mod/modfile/read.go b/vendor/golang.org/x/mod/modfile/read.go
index 504a2f1df..5b528c718 100644
--- a/vendor/golang.org/x/mod/modfile/read.go
+++ b/vendor/golang.org/x/mod/modfile/read.go
@@ -9,6 +9,7 @@ import (
"errors"
"fmt"
"os"
+ "slices"
"strconv"
"strings"
"unicode"
@@ -105,8 +106,7 @@ func (x *FileSyntax) addLine(hint Expr, tokens ...string) *Line {
if hint == nil {
// If no hint given, add to the last statement of the given type.
Loop:
- for i := len(x.Stmt) - 1; i >= 0; i-- {
- stmt := x.Stmt[i]
+ for _, stmt := range slices.Backward(x.Stmt) {
switch stmt := stmt.(type) {
case *Line:
if stmt.Token != nil && stmt.Token[0] == tokens[0] {
@@ -718,9 +718,7 @@ func (in *input) assignComments() {
}
// Assign suffix comments to syntax immediately before.
- for i := len(in.post) - 1; i >= 0; i-- {
- x := in.post[i]
-
+ for _, x := range slices.Backward(in.post) {
start, end := x.Span()
if debug {
fmt.Fprintf(os.Stderr, "post %T :%d:%d #%d :%d:%d #%d\n", x, start.Line, start.LineRune, start.Byte, end.Line, end.LineRune, end.Byte)
diff --git a/vendor/golang.org/x/mod/modfile/rule.go b/vendor/golang.org/x/mod/modfile/rule.go
index c5b8305de..9ab203b56 100644
--- a/vendor/golang.org/x/mod/modfile/rule.go
+++ b/vendor/golang.org/x/mod/modfile/rule.go
@@ -327,6 +327,7 @@ func parseToFile(file string, data []byte, fix VersionFixer, strict bool) (parse
}
var GoVersionRE = lazyregexp.New(`^([1-9][0-9]*)\.(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))?([a-z]+[0-9]+)?$`)
+
var laxGoVersionRE = lazyregexp.New(`^v?(([1-9][0-9]*)\.(0|[1-9][0-9]*))([^0-9].*)$`)
// Toolchains must be named beginning with `go1`,
@@ -1272,6 +1273,17 @@ func (f *File) SetRequire(req []*Require) {
// SetRequireSeparateIndirect will split it into a direct-only and indirect-only
// block. This aids in the transition to separate blocks.
func (f *File) SetRequireSeparateIndirect(req []*Require) {
+ f.setRequireSeparateIndirect(req, false)
+}
+
+// SetRequireAtMostTwo is like SetRequireSeparateIndirect but it aggressively
+// consolidates all requirements into at most two blocks (one direct, one indirect).
+// It ignores existing blocks and comments when deciding where to place requirements.
+func (f *File) SetRequireAtMostTwo(req []*Require) {
+ f.setRequireSeparateIndirect(req, true)
+}
+
+func (f *File) setRequireSeparateIndirect(req []*Require, simplify bool) {
// hasComments returns whether a line or block has comments
// other than "indirect".
hasComments := func(c Comments) bool {
@@ -1304,6 +1316,17 @@ func (f *File) SetRequireSeparateIndirect(req []*Require) {
}
// Examine existing require lines and blocks.
+ need := make(map[string]*Require)
+ for _, r := range req {
+ need[r.Mod.Path] = r
+ }
+ lineIndirect := make(map[*Line]bool)
+ for _, r := range f.Require {
+ if n := need[r.Mod.Path]; n != nil {
+ lineIndirect[r.Syntax] = n.Indirect
+ }
+ }
+
var (
// We may insert new requirements into the last uncommented
// direct-only and indirect-only blocks. We may also move requirements
@@ -1321,7 +1344,9 @@ func (f *File) SetRequireSeparateIndirect(req []*Require) {
// Track the block each requirement belongs to (if any) so we can
// move them later.
- lineToBlock = make(map[*Line]*LineBlock)
+ lineToBlock = make(map[*Line]*LineBlock)
+ directBlockComments []Comment
+ indirectBlockComments []Comment
)
for i, stmt := range f.Syntax.Stmt {
switch stmt := stmt.(type) {
@@ -1364,6 +1389,24 @@ func (f *File) SetRequireSeparateIndirect(req []*Require) {
if allIndirect {
lastIndirectIndex = i
}
+ if simplify {
+ anyDirect := false
+ for _, line := range stmt.Line {
+ if ind, ok := lineIndirect[line]; ok && !ind {
+ anyDirect = true
+ break
+ }
+ }
+ target := &directBlockComments
+ if !anyDirect && len(stmt.Line) > 0 {
+ target = &indirectBlockComments
+ }
+ if len(*target) > 0 && len(stmt.Comments.Before) > 0 {
+ *target = append(*target, Comment{Token: "//"})
+ }
+ *target = append(*target, stmt.Comments.Before...)
+ stmt.Comments.Before = nil
+ }
}
}
@@ -1422,6 +1465,15 @@ func (f *File) SetRequireSeparateIndirect(req []*Require) {
lastIndirectBlock = ensureBlock(lastIndirectIndex)
}
+ if simplify {
+ if len(directBlockComments) > 0 {
+ lastDirectBlock.Comments.Before = append(lastDirectBlock.Comments.Before, directBlockComments...)
+ }
+ if len(indirectBlockComments) > 0 {
+ lastIndirectBlock.Comments.Before = append(lastIndirectBlock.Comments.Before, indirectBlockComments...)
+ }
+ }
+
// Delete requirements we don't want anymore.
// Update versions and indirect comments on requirements we want to keep.
// If a requirement is in last{Direct,Indirect}Block with the wrong
@@ -1430,10 +1482,6 @@ func (f *File) SetRequireSeparateIndirect(req []*Require) {
// correct block.
//
// Some blocks may be empty after this. Cleanup will remove them.
- need := make(map[string]*Require)
- for _, r := range req {
- need[r.Mod.Path] = r
- }
have := make(map[string]*Require)
for _, r := range f.Require {
path := r.Mod.Path
@@ -1446,10 +1494,10 @@ func (f *File) SetRequireSeparateIndirect(req []*Require) {
r.setVersion(need[path].Mod.Version)
r.setIndirect(need[path].Indirect)
if need[path].Indirect &&
- (oneFlatUncommentedBlock || lineToBlock[r.Syntax] == lastDirectBlock) {
+ (simplify || oneFlatUncommentedBlock || lineToBlock[r.Syntax] == lastDirectBlock) {
moveReq(r, lastIndirectBlock)
} else if !need[path].Indirect &&
- (oneFlatUncommentedBlock || lineToBlock[r.Syntax] == lastIndirectBlock) {
+ (simplify || oneFlatUncommentedBlock || lineToBlock[r.Syntax] == lastIndirectBlock) {
moveReq(r, lastDirectBlock)
}
}
@@ -1736,8 +1784,7 @@ func removeDups(syntax *FileSyntax, exclude *[]*Exclude, replace *[]*Replace, to
// Remove duplicate replacements.
// Later replacements take priority over earlier ones.
haveReplace := make(map[module.Version]bool)
- for i := len(*replace) - 1; i >= 0; i-- {
- x := (*replace)[i]
+ for _, x := range slices.Backward(*replace) {
if haveReplace[x.Old] {
kill[x.Syntax] = true
continue
diff --git a/vendor/golang.org/x/net/html/entity.go b/vendor/golang.org/x/net/html/entity.go
index b628880a0..4e8d5d55f 100644
--- a/vendor/golang.org/x/net/html/entity.go
+++ b/vendor/golang.org/x/net/html/entity.go
@@ -2156,9 +2156,8 @@ var entity = map[string]rune{
// HTML entities that are two unicode codepoints.
var entity2 = map[string][2]rune{
- // TODO(nigeltao): Handle replacements that are wider than their names.
- // "nLt;": {'\u226A', '\u20D2'},
- // "nGt;": {'\u226B', '\u20D2'},
+ "nLt;": {'\u226A', '\u20D2'},
+ "nGt;": {'\u226B', '\u20D2'},
"NotEqualTilde;": {'\u2242', '\u0338'},
"NotGreaterFullEqual;": {'\u2267', '\u0338'},
"NotGreaterGreater;": {'\u226B', '\u0338'},
diff --git a/vendor/golang.org/x/net/html/escape.go b/vendor/golang.org/x/net/html/escape.go
index 12f227370..df3edc5b1 100644
--- a/vendor/golang.org/x/net/html/escape.go
+++ b/vendor/golang.org/x/net/html/escape.go
@@ -6,6 +6,7 @@ package html
import (
"bytes"
+ "slices"
"strings"
"unicode/utf8"
)
@@ -50,25 +51,24 @@ var replacementTable = [...]rune{
// 0x0D->'\u000D' is a no-op.
}
-// unescapeEntity reads an entity like "<" from b[src:] and writes the
-// corresponding "<" to b[dst:], returning the incremented dst and src cursors.
-// Precondition: b[src] == '&' && dst <= src.
-// attribute should be true if parsing an attribute value.
-func unescapeEntity(b []byte, dst, src int, attribute bool) (dst1, src1 int) {
+// unescapeEntity attempts to consume a character reference from s[src:],
+// returning the rune, potential second rune, and number of bytes consumed
+// (which indicates the length of the character reference). It is assumed that
+// the first byte of s is '&'. attribute should be true if parsing an attribute
+// value.
+func unescapeEntity(s []byte, attribute bool) (rune, rune, int) {
// https://html.spec.whatwg.org/multipage/syntax.html#consume-a-character-reference
// i starts at 1 because we already know that s[0] == '&'.
- i, s := 1, b[src:]
+ i := 1
if len(s) <= 1 {
- b[dst] = b[src]
- return dst + 1, src + 1
+ return '&', 0, 1
}
if s[i] == '#' {
- if len(s) <= 3 { // We need to have at least ".".
- b[dst] = b[src]
- return dst + 1, src + 1
+ if len(s) <= 2 { // We need to have at least "".
+ return '&', 0, 1
}
i++
c := s[i]
@@ -78,34 +78,43 @@ func unescapeEntity(b []byte, dst, src int, attribute bool) (dst1, src1 int) {
i++
}
+ i0 := i
x := '\x00'
for i < len(s) {
c = s[i]
- i++
+ var d rune
+ var mult rune
if hex {
+ mult = 16
if '0' <= c && c <= '9' {
- x = 16*x + rune(c) - '0'
- continue
+ d = rune(c) - '0'
} else if 'a' <= c && c <= 'f' {
- x = 16*x + rune(c) - 'a' + 10
- continue
+ d = rune(c) - 'a' + 10
} else if 'A' <= c && c <= 'F' {
- x = 16*x + rune(c) - 'A' + 10
- continue
+ d = rune(c) - 'A' + 10
+ } else {
+ break
+ }
+ } else {
+ mult = 10
+ if '0' <= c && c <= '9' {
+ d = rune(c) - '0'
+ } else {
+ break
}
- } else if '0' <= c && c <= '9' {
- x = 10*x + rune(c) - '0'
- continue
}
- if c != ';' {
- i--
+ if x <= 0x10FFFF {
+ x = mult*x + d
}
- break
+ i++
+ }
+
+ if i == i0 { // No characters matched.
+ return '&', 0, 1
}
- if i <= 3 { // No characters matched.
- b[dst] = b[src]
- return dst + 1, src + 1
+ if i < len(s) && s[i] == ';' {
+ i++
}
if 0x80 <= x && x <= 0x9F {
@@ -116,7 +125,7 @@ func unescapeEntity(b []byte, dst, src int, attribute bool) (dst1, src1 int) {
x = '\uFFFD'
}
- return dst + utf8.EncodeRune(b[dst:], x), src + i
+ return x, 0, i
}
// Consume the maximum number of characters possible, with the
@@ -141,10 +150,9 @@ func unescapeEntity(b []byte, dst, src int, attribute bool) (dst1, src1 int) {
} else if attribute && entityName[len(entityName)-1] != ';' && len(s) > i && s[i] == '=' {
// No-op.
} else if x := entity[entityName]; x != 0 {
- return dst + utf8.EncodeRune(b[dst:], x), src + i
+ return x, 0, i
} else if x := entity2[entityName]; x[0] != 0 {
- dst1 := dst + utf8.EncodeRune(b[dst:], x[0])
- return dst1 + utf8.EncodeRune(b[dst1:], x[1]), src + i
+ return x[0], x[1], i
} else if !attribute {
maxLen := len(entityName) - 1
if maxLen > longestEntityWithoutSemicolon {
@@ -152,35 +160,67 @@ func unescapeEntity(b []byte, dst, src int, attribute bool) (dst1, src1 int) {
}
for j := maxLen; j > 1; j-- {
if x := entity[entityName[:j]]; x != 0 {
- return dst + utf8.EncodeRune(b[dst:], x), src + j + 1
+ return x, 0, j + 1
}
}
}
- dst1, src1 = dst+i, src+i
- copy(b[dst:dst1], b[src:src1])
- return dst1, src1
+ return '&', 0, 1
}
-// unescape unescapes b's entities in-place, so that "a<b" becomes "a entityNameLen {
+ if reusingB {
+ out = slices.Clone(out)
+ reusingB = false
}
- return b[0:dst]
+ out = slices.Grow(out, replLen)
+ }
+ out = utf8.AppendRune(out, r1)
+ if r2 != 0 {
+ out = utf8.AppendRune(out, r2)
}
+
+ src += entityNameLen
}
- return b
+
+ return out
}
// lower lower-cases the A-Z bytes in b in-place, so that "aBc" becomes "abc".
diff --git a/vendor/golang.org/x/net/html/foreign.go b/vendor/golang.org/x/net/html/foreign.go
index e8515d8e8..65d01d1ed 100644
--- a/vendor/golang.org/x/net/html/foreign.go
+++ b/vendor/golang.org/x/net/html/foreign.go
@@ -23,7 +23,7 @@ func adjustForeignAttributes(aa []Attribute) {
}
switch a.Key {
case "xlink:actuate", "xlink:arcrole", "xlink:href", "xlink:role", "xlink:show",
- "xlink:title", "xlink:type", "xml:base", "xml:lang", "xml:space", "xmlns:xlink":
+ "xlink:title", "xlink:type", "xml:lang", "xml:space", "xmlns:xlink":
j := strings.Index(a.Key, ":")
aa[i].Namespace = a.Key[:j]
aa[i].Key = a.Key[j+1:]
diff --git a/vendor/golang.org/x/net/html/parse.go b/vendor/golang.org/x/net/html/parse.go
index 88fc0056a..165b6108d 100644
--- a/vendor/golang.org/x/net/html/parse.go
+++ b/vendor/golang.org/x/net/html/parse.go
@@ -5,9 +5,11 @@
package html
import (
+ "cmp"
"errors"
"fmt"
"io"
+ "slices"
"strings"
a "golang.org/x/net/html/atom"
@@ -61,7 +63,7 @@ func (p *parser) top() *Node {
// Stop tags for use in popUntil. These come from section 12.2.4.2.
var (
defaultScopeStopTags = map[string][]a.Atom{
- "": {a.Applet, a.Caption, a.Html, a.Table, a.Td, a.Th, a.Marquee, a.Object, a.Template},
+ "": {a.Applet, a.Caption, a.Html, a.Table, a.Td, a.Th, a.Marquee, a.Object, a.Template, a.Select},
"math": {a.AnnotationXml, a.Mi, a.Mn, a.Mo, a.Ms, a.Mtext},
"svg": {a.Desc, a.ForeignObject, a.Title},
}
@@ -76,7 +78,6 @@ const (
tableScope
tableRowScope
tableBodyScope
- selectScope
)
// popUntil pops the stack of open elements at the highest element whose tag
@@ -131,10 +132,6 @@ func (p *parser) indexOfElementInScope(s scope, matchTags ...a.Atom) int {
if tagAtom == a.Html || tagAtom == a.Table || tagAtom == a.Template {
return -1
}
- case selectScope:
- if tagAtom != a.Optgroup && tagAtom != a.Option {
- return -1
- }
default:
panic(fmt.Sprintf("html: internal error: indexOfElementInScope unknown scope: %d", s))
}
@@ -328,6 +325,14 @@ func (p *parser) addText(text string) {
})
}
+func attrCompare(a, b Attribute) int {
+ return cmp.Or(
+ cmp.Compare(a.Namespace, b.Namespace),
+ cmp.Compare(a.Key, b.Key),
+ cmp.Compare(a.Val, b.Val),
+ )
+}
+
// addElement adds a child element based on the current token.
func (p *parser) addElement() {
p.addChild(&Node{
@@ -343,6 +348,10 @@ func (p *parser) addFormattingElement() {
tagAtom, attr := p.tok.DataAtom, p.tok.Attr
p.addElement()
+ // In order to optimize the search, we need the attributes to be sorted, so we
+ // can just use slices.Equal.
+ slices.SortFunc(attr, attrCompare)
+
// Implement the Noah's Ark clause, but with three per family instead of two.
identicalElements := 0
findIdenticalElements:
@@ -360,19 +369,7 @@ findIdenticalElements:
if n.DataAtom != tagAtom {
continue
}
- if len(n.Attr) != len(attr) {
- continue
- }
- compareAttributes:
- for _, t0 := range n.Attr {
- for _, t1 := range attr {
- if t0.Key == t1.Key && t0.Namespace == t1.Namespace && t0.Val == t1.Val {
- // Found a match for this attribute, continue with the next attribute.
- continue compareAttributes
- }
- }
- // If we get here, there is no attribute that matches a.
- // Therefore the element is not identical to the new one.
+ if !slices.Equal(n.Attr, attr) {
continue findIdenticalElements
}
@@ -382,7 +379,11 @@ findIdenticalElements:
}
}
- p.afe = append(p.afe, p.top())
+ // Sort the attributes to optimize future identical-element searches.
+ top := p.top()
+ slices.SortFunc(top.Attr, attrCompare)
+
+ p.afe = append(p.afe, top)
}
// Section 12.2.4.3.
@@ -454,21 +455,6 @@ func (p *parser) resetInsertionMode() {
}
switch n.DataAtom {
- case a.Select:
- if !last {
- for ancestor, first := n, p.oe[0]; ancestor != first; {
- ancestor = p.oe[p.oe.index(ancestor)-1]
- switch ancestor.DataAtom {
- case a.Template:
- p.im = inSelectIM
- return
- case a.Table:
- p.im = inSelectInTableIM
- return
- }
- }
- }
- p.im = inSelectIM
case a.Td, a.Th:
// TODO: remove this divergence from the HTML5 spec.
//
@@ -996,7 +982,10 @@ func inBodyIM(p *parser) bool {
p.popUntil(buttonScope, a.P)
p.addElement()
case a.Button:
- p.popUntil(defaultScope, a.Button)
+ if p.elementInScope(defaultScope, a.Button) {
+ p.generateImpliedEndTags()
+ p.popUntil(defaultScope, a.Button)
+ }
p.reconstructActiveFormattingElements()
p.addElement()
p.framesetOK = false
@@ -1034,7 +1023,18 @@ func inBodyIM(p *parser) bool {
p.framesetOK = false
p.im = inTableIM
return true
- case a.Area, a.Br, a.Embed, a.Img, a.Input, a.Keygen, a.Wbr:
+ case a.Area, a.Br, a.Embed, a.Img, a.Keygen, a.Wbr:
+ p.reconstructActiveFormattingElements()
+ p.addElement()
+ p.oe.pop()
+ p.acknowledgeSelfClosingTag()
+ p.framesetOK = false
+ case a.Input:
+ if p.fragment && p.context.DataAtom == a.Select {
+ // Ignore the token.
+ return true
+ }
+ p.popUntil(defaultScope, a.Select)
p.reconstructActiveFormattingElements()
p.addElement()
p.oe.pop()
@@ -1055,7 +1055,13 @@ func inBodyIM(p *parser) bool {
p.oe.pop()
p.acknowledgeSelfClosingTag()
case a.Hr:
- p.popUntil(buttonScope, a.P)
+ if p.elementInScope(buttonScope, a.P) {
+ p.generateImpliedEndTags("p")
+ p.popUntil(defaultScope, a.P)
+ }
+ if p.elementInScope(defaultScope, a.Select) {
+ p.generateImpliedEndTags()
+ }
p.addElement()
p.oe.pop()
p.acknowledgeSelfClosingTag()
@@ -1089,13 +1095,30 @@ func inBodyIM(p *parser) bool {
// Don't let the tokenizer go into raw text mode when scripting is disabled.
p.tokenizer.NextIsNotRawText()
case a.Select:
+ if p.fragment && p.context.DataAtom == a.Select {
+ // Ignore the token.
+ return true
+ } else if p.popUntil(defaultScope, a.Select) {
+ return true
+ }
p.reconstructActiveFormattingElements()
p.addElement()
p.framesetOK = false
- p.im = inSelectIM
return true
- case a.Optgroup, a.Option:
- if p.top().DataAtom == a.Option {
+ case a.Option:
+ if p.elementInScope(defaultScope, a.Select) {
+ p.generateImpliedEndTags("optgroup")
+ // If oe has option element in scope, parse error?
+ } else if p.top().DataAtom == a.Option {
+ p.oe.pop()
+ }
+ p.reconstructActiveFormattingElements()
+ p.addElement()
+ case a.Optgroup:
+ if p.elementInScope(defaultScope, a.Select) {
+ p.generateImpliedEndTags()
+ // If oe has option or optgroup element in scope, parse error?
+ } else if p.top().DataAtom == a.Option {
p.oe.pop()
}
p.reconstructActiveFormattingElements()
@@ -1143,7 +1166,12 @@ func inBodyIM(p *parser) bool {
return false
}
return true
- case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Main, a.Menu, a.Nav, a.Ol, a.Pre, a.Search, a.Section, a.Summary, a.Ul:
+ case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Main, a.Menu, a.Nav, a.Ol, a.Pre, a.Search, a.Section, a.Select, a.Summary, a.Ul:
+ if !p.elementInScope(defaultScope, p.tok.DataAtom) {
+ // Ignore the token.
+ return true
+ }
+ p.generateImpliedEndTags()
p.popUntil(defaultScope, p.tok.DataAtom)
case a.Form:
if p.oe.contains(a.Template) {
@@ -1372,8 +1400,6 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) {
}
// inBodyEndTagOther performs the "any other end tag" algorithm for inBodyIM.
-// "Any other end tag" handling from 12.2.6.5 The rules for parsing tokens in foreign content
-// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inforeign
func (p *parser) inBodyEndTagOther(tagAtom a.Atom, tagName string) {
for i := len(p.oe) - 1; i >= 0; i-- {
// Two element nodes have the same tag if they have the same Data (a
@@ -1383,7 +1409,7 @@ func (p *parser) inBodyEndTagOther(tagAtom a.Atom, tagName string) {
// Uncommon (custom) tags get a zero DataAtom.
//
// The if condition here is equivalent to (p.oe[i].Data == tagName).
- if (p.oe[i].DataAtom == tagAtom) &&
+ if p.oe[i].Namespace == "" && (p.oe[i].DataAtom == tagAtom) &&
((tagAtom != 0) || (p.oe[i].Data == tagName)) {
p.oe = p.oe[:i]
break
@@ -1484,17 +1510,6 @@ func inTableIM(p *parser) bool {
}
p.addElement()
p.form = p.oe.pop()
- case a.Select:
- p.reconstructActiveFormattingElements()
- switch p.top().DataAtom {
- case a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr:
- p.fosterParenting = true
- }
- p.addElement()
- p.fosterParenting = false
- p.framesetOK = false
- p.im = inSelectInTableIM
- return true
}
case EndTagToken:
switch p.tok.DataAtom {
@@ -1543,12 +1558,6 @@ func inCaptionIM(p *parser) bool {
p.clearActiveFormattingElements()
p.im = inTableIM
return false
- case a.Select:
- p.reconstructActiveFormattingElements()
- p.addElement()
- p.framesetOK = false
- p.im = inSelectInTableIM
- return true
}
case EndTagToken:
switch p.tok.DataAtom {
@@ -1758,12 +1767,6 @@ func inCellIM(p *parser) bool {
}
// Ignore the token.
return true
- case a.Select:
- p.reconstructActiveFormattingElements()
- p.addElement()
- p.framesetOK = false
- p.im = inSelectInTableIM
- return true
}
case EndTagToken:
switch p.tok.DataAtom {
@@ -1794,118 +1797,6 @@ func inCellIM(p *parser) bool {
return inBodyIM(p)
}
-// Section 12.2.6.4.16.
-func inSelectIM(p *parser) bool {
- switch p.tok.Type {
- case TextToken:
- p.addText(strings.Replace(p.tok.Data, "\x00", "", -1))
- case StartTagToken:
- switch p.tok.DataAtom {
- case a.Html:
- return inBodyIM(p)
- case a.Option:
- if p.top().DataAtom == a.Option {
- p.oe.pop()
- }
- p.addElement()
- case a.Optgroup:
- if p.top().DataAtom == a.Option {
- p.oe.pop()
- }
- if p.top().DataAtom == a.Optgroup {
- p.oe.pop()
- }
- p.addElement()
- case a.Select:
- if !p.popUntil(selectScope, a.Select) {
- // Ignore the token.
- return true
- }
- p.resetInsertionMode()
- case a.Input, a.Keygen, a.Textarea:
- if p.elementInScope(selectScope, a.Select) {
- p.parseImpliedToken(EndTagToken, a.Select, a.Select.String())
- return false
- }
- // In order to properly ignore