Skip to content

Commit 1aa6b17

Browse files
fix(api): fix nullability of logprobs
Makes ResponseOutputText.logprobs nullable, matching with 2.6.1. While this is always present in the server response, this inadvertently affected params and some constructors
1 parent 605b436 commit 1aa6b17

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 123
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-3c5d1593d7c6f2b38a7d78d7906041465ee9d6e9022f0651e1da194654488108.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-eeba8addf3a5f412e5ce8d22031e60c61650cee3f5d9e587a2533f6818a249ea.yml
33
openapi_spec_hash: 0a4d8ad2469823ce24a3fd94f23f1c2b
4-
config_hash: 032995825500a503a76da119f5354905
4+
config_hash: 0bb1941a78ece0b610a2fbba7d74a84c

responses/response.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3087,18 +3087,18 @@ func (r *ResponseContentPartAddedEvent) UnmarshalJSON(data []byte) error {
30873087
type ResponseContentPartAddedEventPartUnion struct {
30883088
// This field is from variant [ResponseOutputText].
30893089
Annotations []ResponseOutputTextAnnotationUnion `json:"annotations"`
3090-
// This field is from variant [ResponseOutputText].
3091-
Logprobs []ResponseOutputTextLogprob `json:"logprobs"`
3092-
Text string `json:"text"`
3090+
Text string `json:"text"`
30933091
// Any of "output_text", "refusal", "reasoning_text".
30943092
Type string `json:"type"`
3093+
// This field is from variant [ResponseOutputText].
3094+
Logprobs []ResponseOutputTextLogprob `json:"logprobs"`
30953095
// This field is from variant [ResponseOutputRefusal].
30963096
Refusal string `json:"refusal"`
30973097
JSON struct {
30983098
Annotations respjson.Field
3099-
Logprobs respjson.Field
31003099
Text respjson.Field
31013100
Type respjson.Field
3101+
Logprobs respjson.Field
31023102
Refusal respjson.Field
31033103
raw string
31043104
} `json:"-"`
@@ -3223,18 +3223,18 @@ func (r *ResponseContentPartDoneEvent) UnmarshalJSON(data []byte) error {
32233223
type ResponseContentPartDoneEventPartUnion struct {
32243224
// This field is from variant [ResponseOutputText].
32253225
Annotations []ResponseOutputTextAnnotationUnion `json:"annotations"`
3226-
// This field is from variant [ResponseOutputText].
3227-
Logprobs []ResponseOutputTextLogprob `json:"logprobs"`
3228-
Text string `json:"text"`
3226+
Text string `json:"text"`
32293227
// Any of "output_text", "refusal", "reasoning_text".
32303228
Type string `json:"type"`
3229+
// This field is from variant [ResponseOutputText].
3230+
Logprobs []ResponseOutputTextLogprob `json:"logprobs"`
32313231
// This field is from variant [ResponseOutputRefusal].
32323232
Refusal string `json:"refusal"`
32333233
JSON struct {
32343234
Annotations respjson.Field
3235-
Logprobs respjson.Field
32363235
Text respjson.Field
32373236
Type respjson.Field
3237+
Logprobs respjson.Field
32383238
Refusal respjson.Field
32393239
raw string
32403240
} `json:"-"`
@@ -10252,18 +10252,18 @@ type ResponseOutputMessageContentUnion struct {
1025210252
// This field is from variant [ResponseOutputText].
1025310253
Annotations []ResponseOutputTextAnnotationUnion `json:"annotations"`
1025410254
// This field is from variant [ResponseOutputText].
10255-
Logprobs []ResponseOutputTextLogprob `json:"logprobs"`
10256-
// This field is from variant [ResponseOutputText].
1025710255
Text string `json:"text"`
1025810256
// Any of "output_text", "refusal".
1025910257
Type string `json:"type"`
10258+
// This field is from variant [ResponseOutputText].
10259+
Logprobs []ResponseOutputTextLogprob `json:"logprobs"`
1026010260
// This field is from variant [ResponseOutputRefusal].
1026110261
Refusal string `json:"refusal"`
1026210262
JSON struct {
1026310263
Annotations respjson.Field
10264-
Logprobs respjson.Field
1026510264
Text respjson.Field
1026610265
Type respjson.Field
10266+
Logprobs respjson.Field
1026710267
Refusal respjson.Field
1026810268
raw string
1026910269
} `json:"-"`
@@ -10390,17 +10390,17 @@ func (u ResponseOutputMessageContentUnionParam) GetAnnotations() []ResponseOutpu
1039010390
}
1039110391

1039210392
// Returns a pointer to the underlying variant's property, if present.
10393-
func (u ResponseOutputMessageContentUnionParam) GetLogprobs() []ResponseOutputTextLogprobParam {
10393+
func (u ResponseOutputMessageContentUnionParam) GetText() *string {
1039410394
if vt := u.OfOutputText; vt != nil {
10395-
return vt.Logprobs
10395+
return &vt.Text
1039610396
}
1039710397
return nil
1039810398
}
1039910399

1040010400
// Returns a pointer to the underlying variant's property, if present.
10401-
func (u ResponseOutputMessageContentUnionParam) GetText() *string {
10401+
func (u ResponseOutputMessageContentUnionParam) GetLogprobs() []ResponseOutputTextLogprobParam {
1040210402
if vt := u.OfOutputText; vt != nil {
10403-
return &vt.Text
10403+
return vt.Logprobs
1040410404
}
1040510405
return nil
1040610406
}
@@ -10480,17 +10480,17 @@ func (r *ResponseOutputRefusalParam) UnmarshalJSON(data []byte) error {
1048010480
type ResponseOutputText struct {
1048110481
// The annotations of the text output.
1048210482
Annotations []ResponseOutputTextAnnotationUnion `json:"annotations,required"`
10483-
Logprobs []ResponseOutputTextLogprob `json:"logprobs,required"`
1048410483
// The text output from the model.
1048510484
Text string `json:"text,required"`
1048610485
// The type of the output text. Always `output_text`.
10487-
Type constant.OutputText `json:"type,required"`
10486+
Type constant.OutputText `json:"type,required"`
10487+
Logprobs []ResponseOutputTextLogprob `json:"logprobs"`
1048810488
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
1048910489
JSON struct {
1049010490
Annotations respjson.Field
10491-
Logprobs respjson.Field
1049210491
Text respjson.Field
1049310492
Type respjson.Field
10493+
Logprobs respjson.Field
1049410494
ExtraFields map[string]respjson.Field
1049510495
raw string
1049610496
} `json:"-"`
@@ -10774,13 +10774,13 @@ func (r *ResponseOutputTextLogprobTopLogprob) UnmarshalJSON(data []byte) error {
1077410774

1077510775
// A text output from the model.
1077610776
//
10777-
// The properties Annotations, Logprobs, Text, Type are required.
10777+
// The properties Annotations, Text, Type are required.
1077810778
type ResponseOutputTextParam struct {
1077910779
// The annotations of the text output.
1078010780
Annotations []ResponseOutputTextAnnotationUnionParam `json:"annotations,omitzero,required"`
10781-
Logprobs []ResponseOutputTextLogprobParam `json:"logprobs,omitzero,required"`
1078210781
// The text output from the model.
10783-
Text string `json:"text,required"`
10782+
Text string `json:"text,required"`
10783+
Logprobs []ResponseOutputTextLogprobParam `json:"logprobs,omitzero"`
1078410784
// The type of the output text. Always `output_text`.
1078510785
//
1078610786
// This field can be elided, and will marshal its zero value as "output_text".
@@ -12495,19 +12495,19 @@ type ResponseStreamEventUnionPart struct {
1249512495
// This field is from variant [ResponseContentPartAddedEventPartUnion],
1249612496
// [ResponseContentPartDoneEventPartUnion].
1249712497
Annotations []ResponseOutputTextAnnotationUnion `json:"annotations"`
12498+
Text string `json:"text"`
12499+
Type string `json:"type"`
1249812500
// This field is from variant [ResponseContentPartAddedEventPartUnion],
1249912501
// [ResponseContentPartDoneEventPartUnion].
1250012502
Logprobs []ResponseOutputTextLogprob `json:"logprobs"`
12501-
Text string `json:"text"`
12502-
Type string `json:"type"`
1250312503
// This field is from variant [ResponseContentPartAddedEventPartUnion],
1250412504
// [ResponseContentPartDoneEventPartUnion].
1250512505
Refusal string `json:"refusal"`
1250612506
JSON struct {
1250712507
Annotations respjson.Field
12508-
Logprobs respjson.Field
1250912508
Text respjson.Field
1251012509
Type respjson.Field
12510+
Logprobs respjson.Field
1251112511
Refusal respjson.Field
1251212512
raw string
1251312513
} `json:"-"`

0 commit comments

Comments
 (0)