@@ -92,18 +92,22 @@ type ChatMessagePart struct {
92
92
}
93
93
94
94
type ChatCompletionMessage struct {
95
- Role string `json:"role"`
96
- ReasoningContent string `json:"reasoning_content,omitempty"`
97
- Content string `json:"content"`
98
- Refusal string `json:"refusal,omitempty"`
99
- MultiContent []ChatMessagePart
95
+ Role string `json:"role"`
96
+ Content string `json:"content"`
97
+ Refusal string `json:"refusal,omitempty"`
98
+ MultiContent []ChatMessagePart
100
99
101
100
// This property isn't in the official documentation, but it's in
102
101
// the documentation for the official library for python:
103
102
// - https://github.com/openai/openai-python/blob/main/chatml.md
104
103
// - https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb
105
104
Name string `json:"name,omitempty"`
106
105
106
+ // This property is used for the "reasoning" feature supported by deepseek-reasoner which is not in the official documentation.
107
+ // the doc from deepseek:
108
+ // - https://api-docs.deepseek.com/api/create-chat-completion#responses
109
+ ReasoningContent string `json:"reasoning_content,omitempty"`
110
+
107
111
FunctionCall * FunctionCall `json:"function_call,omitempty"`
108
112
109
113
// For Role=assistant prompts this may be set to the tool calls generated by the model, such as function calls.
@@ -120,11 +124,11 @@ func (m ChatCompletionMessage) MarshalJSON() ([]byte, error) {
120
124
if len (m .MultiContent ) > 0 {
121
125
msg := struct {
122
126
Role string `json:"role"`
123
- ReasoningContent string `json:"reasoning_content,omitempty"`
124
127
Content string `json:"-"`
125
128
Refusal string `json:"refusal,omitempty"`
126
129
MultiContent []ChatMessagePart `json:"content,omitempty"`
127
130
Name string `json:"name,omitempty"`
131
+ ReasoningContent string `json:"reasoning_content,omitempty"`
128
132
FunctionCall * FunctionCall `json:"function_call,omitempty"`
129
133
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
130
134
ToolCallID string `json:"tool_call_id,omitempty"`
@@ -134,11 +138,11 @@ func (m ChatCompletionMessage) MarshalJSON() ([]byte, error) {
134
138
135
139
msg := struct {
136
140
Role string `json:"role"`
137
- ReasoningContent string `json:"reasoning_content,omitempty"`
138
141
Content string `json:"content"`
139
142
Refusal string `json:"refusal,omitempty"`
140
143
MultiContent []ChatMessagePart `json:"-"`
141
144
Name string `json:"name,omitempty"`
145
+ ReasoningContent string `json:"reasoning_content,omitempty"`
142
146
FunctionCall * FunctionCall `json:"function_call,omitempty"`
143
147
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
144
148
ToolCallID string `json:"tool_call_id,omitempty"`
@@ -149,11 +153,11 @@ func (m ChatCompletionMessage) MarshalJSON() ([]byte, error) {
149
153
func (m * ChatCompletionMessage ) UnmarshalJSON (bs []byte ) error {
150
154
msg := struct {
151
155
Role string `json:"role"`
152
- ReasoningContent string `json:"reasoning_content,omitempty"`
153
156
Content string `json:"content"`
154
157
Refusal string `json:"refusal,omitempty"`
155
158
MultiContent []ChatMessagePart
156
159
Name string `json:"name,omitempty"`
160
+ ReasoningContent string `json:"reasoning_content,omitempty"`
157
161
FunctionCall * FunctionCall `json:"function_call,omitempty"`
158
162
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
159
163
ToolCallID string `json:"tool_call_id,omitempty"`
@@ -165,11 +169,11 @@ func (m *ChatCompletionMessage) UnmarshalJSON(bs []byte) error {
165
169
}
166
170
multiMsg := struct {
167
171
Role string `json:"role"`
168
- ReasoningContent string `json:"reasoning_content,omitempty"`
169
172
Content string
170
173
Refusal string `json:"refusal,omitempty"`
171
174
MultiContent []ChatMessagePart `json:"content"`
172
175
Name string `json:"name,omitempty"`
176
+ ReasoningContent string `json:"reasoning_content,omitempty"`
173
177
FunctionCall * FunctionCall `json:"function_call,omitempty"`
174
178
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
175
179
ToolCallID string `json:"tool_call_id,omitempty"`
0 commit comments