@@ -157,6 +157,9 @@ type ChatMessage struct { //nolint:musttag
157
157
// ToolCallID is the ID of the tool call this message is for.
158
158
// Only present in tool messages.
159
159
ToolCallID string `json:"tool_call_id,omitempty"`
160
+
161
+ // This field is only used with the deepseek-reasoner model and represents the reasoning contents of the assistant message before the final answer.
162
+ ReasoningContent string `json:"reasoning_content,omitempty"`
160
163
}
161
164
162
165
func (m ChatMessage ) MarshalJSON () ([]byte , error ) {
@@ -181,6 +184,9 @@ func (m ChatMessage) MarshalJSON() ([]byte, error) {
181
184
// ToolCallID is the ID of the tool call this message is for.
182
185
// Only present in tool messages.
183
186
ToolCallID string `json:"tool_call_id,omitempty"`
187
+
188
+ // This field is only used with the deepseek-reasoner model and represents the reasoning contents of the assistant message before the final answer.
189
+ ReasoningContent string `json:"reasoning_content,omitempty"`
184
190
}(m )
185
191
return json .Marshal (msg )
186
192
}
@@ -196,6 +202,9 @@ func (m ChatMessage) MarshalJSON() ([]byte, error) {
196
202
// ToolCallID is the ID of the tool call this message is for.
197
203
// Only present in tool messages.
198
204
ToolCallID string `json:"tool_call_id,omitempty"`
205
+
206
+ // This field is only used with the deepseek-reasoner model and represents the reasoning contents of the assistant message before the final answer.
207
+ ReasoningContent string `json:"reasoning_content,omitempty"`
199
208
}(m )
200
209
return json .Marshal (msg )
201
210
}
@@ -221,6 +230,9 @@ func (m *ChatMessage) UnmarshalJSON(data []byte) error {
221
230
// ToolCallID is the ID of the tool call this message is for.
222
231
// Only present in tool messages.
223
232
ToolCallID string `json:"tool_call_id,omitempty"`
233
+
234
+ // This field is only used with the deepseek-reasoner model and represents the reasoning contents of the assistant message before the final answer.
235
+ ReasoningContent string `json:"reasoning_content,omitempty"`
224
236
}{}
225
237
err := json .Unmarshal (data , & msg )
226
238
if err != nil {
@@ -322,6 +334,8 @@ type StreamedChatResponsePayload struct {
322
334
FunctionCall * FunctionCall `json:"function_call,omitempty"`
323
335
// ToolCalls is a list of tools that were called in the message.
324
336
ToolCalls []* ToolCall `json:"tool_calls,omitempty"`
337
+ // This field is only used with the deepseek-reasoner model and represents the reasoning contents of the assistant message before the final answer.
338
+ ReasoningContent string `json:"reasoning_content,omitempty"`
325
339
} `json:"delta,omitempty"`
326
340
FinishReason FinishReason `json:"finish_reason,omitempty"`
327
341
} `json:"choices,omitempty"`
@@ -481,6 +495,7 @@ func combineStreamingChatResponse(
481
495
chunk := []byte (choice .Delta .Content )
482
496
response .Choices [0 ].Message .Content += choice .Delta .Content
483
497
response .Choices [0 ].FinishReason = choice .FinishReason
498
+ response .Choices [0 ].Message .ReasoningContent = choice .Delta .ReasoningContent
484
499
485
500
if choice .Delta .FunctionCall != nil {
486
501
chunk = updateFunctionCall (response .Choices [0 ].Message , choice .Delta .FunctionCall )
0 commit comments