File tree Expand file tree Collapse file tree 2 files changed +4
-7
lines changed
aisdk/ai/provider/openai/internal/codec Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -110,9 +110,6 @@ func decodeReasoning(item responses.ResponseOutputItemUnion) (*api.ReasoningBloc
110110 }
111111
112112 reasoningItem := item .AsReasoning ()
113- if len (reasoningItem .Summary ) == 0 {
114- return nil , fmt .Errorf ("reasoning item has no summary" )
115- }
116113
117114 // For now, we'll concatenate all summary texts with newlines if there are multiple
118115 // Another option would be to return a slice of ReasoningBlocks.
@@ -125,9 +122,9 @@ func decodeReasoning(item responses.ResponseOutputItemUnion) (*api.ReasoningBloc
125122 texts = append (texts , summary .Text )
126123 }
127124
128- if len ( texts ) == 0 {
129- return nil , fmt . Errorf ( "no valid text found in reasoning summaries" )
130- }
125+ // NOTE: we don't check that the text is non-empty because sometimes the model returns an empty
126+ // reasoning block. That behavior is technically against the API spec, but it's been observed in practice.
127+ // Consider omitting the ReasoningBlock and adding a warning instead.
131128
132129 return & api.ReasoningBlock {
133130 Text : strings .Join (texts , "\n " ),
Original file line number Diff line number Diff line change @@ -1192,7 +1192,7 @@ func TestDecodeReasoning(t *testing.T) {
11921192 "id": "reason_123",
11931193 "summary": []
11941194 }` ,
1195- wantErr : "reasoning item has no summary" ,
1195+ want : & api. ReasoningBlock {} ,
11961196 },
11971197 {
11981198 name : "empty text in summary" ,
You can’t perform that action at this time.
0 commit comments