Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions chatcompletion.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:"-"`
}

Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions streamaccumulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down