Add OpenRouter reasoning support
This commit is contained in:
@@ -138,6 +138,7 @@ type Delta struct {
|
||||
Content string `json:"content,omitempty"`
|
||||
Refusal string `json:"refusal,omitempty"`
|
||||
ReasoningContent string `json:"reasoning_content,omitempty"`
|
||||
Reasoning string `json:"reasoning,omitempty"`
|
||||
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
|
||||
}
|
||||
|
||||
@@ -199,6 +200,7 @@ type Message struct {
|
||||
ContentParts []ContentPart `json:"content,omitempty"`
|
||||
Refusal string `json:"refusal,omitempty"`
|
||||
ReasoningContent string `json:"reasoning_content,omitempty"`
|
||||
Reasoning string `json:"reasoning,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
|
||||
ToolCallID string `json:"tool_call_id,omitempty"`
|
||||
@@ -244,16 +246,21 @@ func (m *Message) UnmarshalJSON(data []byte) error {
|
||||
m.ContentParts = append(m.ContentParts, part)
|
||||
}
|
||||
}
|
||||
// Normalize: if ReasoningContent is empty but Reasoning is set, use Reasoning
|
||||
if m.ReasoningContent == "" && m.Reasoning != "" {
|
||||
m.ReasoningContent = m.Reasoning
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Model represents an available model from the API.
|
||||
type Model struct {
|
||||
ID string `json:"id"`
|
||||
Created int64 `json:"created"`
|
||||
Object string `json:"object"`
|
||||
OwnedBy string `json:"owned_by"`
|
||||
Meta *ModelMeta `json:"meta,omitempty"`
|
||||
ID string `json:"id"`
|
||||
Created int64 `json:"created"`
|
||||
Object string `json:"object"`
|
||||
OwnedBy string `json:"owned_by"`
|
||||
Meta *ModelMeta `json:"meta,omitempty"`
|
||||
ContextLength int `json:"context_length,omitempty"`
|
||||
}
|
||||
|
||||
// ModelMeta contains optional model metadata from the provider.
|
||||
|
||||
Reference in New Issue
Block a user