mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-30 16:21:46 +00:00
Merge pull request #2274 from seefs001/feature/thinking_level
feat: gemini thinking_level && snake params
This commit is contained in:
@@ -142,7 +142,38 @@ type GeminiThinkingConfig struct {
|
|||||||
IncludeThoughts bool `json:"includeThoughts,omitempty"`
|
IncludeThoughts bool `json:"includeThoughts,omitempty"`
|
||||||
ThinkingBudget *int `json:"thinkingBudget,omitempty"`
|
ThinkingBudget *int `json:"thinkingBudget,omitempty"`
|
||||||
// TODO Conflict with thinkingbudget.
|
// TODO Conflict with thinkingbudget.
|
||||||
// ThinkingLevel json.RawMessage `json:"thinkingLevel,omitempty"`
|
ThinkingLevel json.RawMessage `json:"thinkingLevel,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON allows GeminiThinkingConfig to accept both snake_case and camelCase fields.
|
||||||
|
func (c *GeminiThinkingConfig) UnmarshalJSON(data []byte) error {
|
||||||
|
type Alias GeminiThinkingConfig
|
||||||
|
var aux struct {
|
||||||
|
Alias
|
||||||
|
IncludeThoughtsSnake *bool `json:"include_thoughts,omitempty"`
|
||||||
|
ThinkingBudgetSnake *int `json:"thinking_budget,omitempty"`
|
||||||
|
ThinkingLevelSnake json.RawMessage `json:"thinking_level,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := common.Unmarshal(data, &aux); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
*c = GeminiThinkingConfig(aux.Alias)
|
||||||
|
|
||||||
|
if aux.IncludeThoughtsSnake != nil {
|
||||||
|
c.IncludeThoughts = *aux.IncludeThoughtsSnake
|
||||||
|
}
|
||||||
|
|
||||||
|
if aux.ThinkingBudgetSnake != nil {
|
||||||
|
c.ThinkingBudget = aux.ThinkingBudgetSnake
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(aux.ThinkingLevelSnake) > 0 {
|
||||||
|
c.ThinkingLevel = aux.ThinkingLevelSnake
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *GeminiThinkingConfig) SetThinkingBudget(budget int) {
|
func (c *GeminiThinkingConfig) SetThinkingBudget(budget int) {
|
||||||
|
|||||||
Reference in New Issue
Block a user