diff --git a/chatcompletion.go b/chatcompletion.go index 2f937388..871ffcac 100644 --- a/chatcompletion.go +++ b/chatcompletion.go @@ -242,13 +242,15 @@ type ChatCompletionChoice struct { // A chat completion message generated by the model. Message ChatCompletionMessage `json:"message,required"` // JSON contains metadata for fields, check presence with [respjson.Field.Valid]. - JSON struct { - FinishReason respjson.Field - Index respjson.Field - Logprobs respjson.Field - Message respjson.Field - ExtraFields map[string]respjson.Field - raw string + ReasoningContent string `json:"reasoning_content"` + JSON struct { + FinishReason respjson.Field + Index respjson.Field + Logprobs respjson.Field + Message respjson.Field + ReasoningContent respjson.Field + ExtraFields map[string]respjson.Field + raw string } `json:"-"` } @@ -687,6 +689,8 @@ type ChatCompletionChunkChoiceDelta struct { // Deprecated and replaced by `tool_calls`. The name and arguments of a function // that should be called, as generated by the model. // + ReasoningContent string `json:"reasoning_content,nullable"` + // Deprecated: deprecated FunctionCall ChatCompletionChunkChoiceDeltaFunctionCall `json:"function_call"` // The refusal message generated by the model. diff --git a/streamaccumulator.go b/streamaccumulator.go index 3f4d6491..8161d225 100644 --- a/streamaccumulator.go +++ b/streamaccumulator.go @@ -121,6 +121,7 @@ func (cc *ChatCompletion) accumulateDelta(chunk ChatCompletionChunk) bool { choice.Message.Content += delta.Delta.Content choice.Message.Refusal += delta.Delta.Refusal + choice.ReasoningContent += delta.Delta.ReasoningContent for j := range delta.Delta.ToolCalls { deltaTool := &delta.Delta.ToolCalls[j]