fix: when reasoningEffort = "", no "reasoning" field
This commit is contained in:
4
model.go
4
model.go
@@ -14,7 +14,7 @@ type OpenaiChatCompletionReq struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OpenaiResponseReasoning struct {
|
type OpenaiResponseReasoning struct {
|
||||||
Effort string `json:"effort"`
|
Effort string `json:"effort,omitempty"`
|
||||||
Summary string `json:"summary,omitempty"` // auto, concise, detailed
|
Summary string `json:"summary,omitempty"` // auto, concise, detailed
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ type OpenaiChatResponseReq struct {
|
|||||||
Model string `json:"model"`
|
Model string `json:"model"`
|
||||||
Input []OpenaiChatMessage `json:"input"`
|
Input []OpenaiChatMessage `json:"input"`
|
||||||
Temperature *float64 `json:"temperature,omitempty"`
|
Temperature *float64 `json:"temperature,omitempty"`
|
||||||
Reasoning OpenaiResponseReasoning `json:"reasoning,omitempty"`
|
Reasoning *OpenaiResponseReasoning `json:"reasoning,omitempty"`
|
||||||
Stream bool `json:"stream"`
|
Stream bool `json:"stream"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,10 +32,13 @@ func OpenaiStreamChatResponses(
|
|||||||
Model: model,
|
Model: model,
|
||||||
Input: msgs,
|
Input: msgs,
|
||||||
Temperature: temperature,
|
Temperature: temperature,
|
||||||
Reasoning: OpenaiResponseReasoning{Effort: reasoningEffort},
|
|
||||||
Stream: true,
|
Stream: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if reasoningEffort != "" {
|
||||||
|
body.Reasoning = &OpenaiResponseReasoning{Effort: reasoningEffort}
|
||||||
|
}
|
||||||
|
|
||||||
payload, err := json.Marshal(body)
|
payload, err := json.Marshal(body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user