@@ -12,6 +12,30 @@ import (
1212// MessageRole represents the role of a message in a chat conversation.
1313type MessageRole string
1414
15+ // ReasoningEffort controls how many reasoning tokens the model may use.
16+ // OpenAI defines these values for reasoning-capable models.
17+ type ReasoningEffort string
18+
19+ const (
20+ ReasoningEffortMinimal ReasoningEffort = "minimal"
21+ ReasoningEffortLow ReasoningEffort = "low"
22+ ReasoningEffortMedium ReasoningEffort = "medium"
23+ ReasoningEffortHigh ReasoningEffort = "high"
24+ ReasoningEffortXHigh ReasoningEffort = "xhigh"
25+ ReasoningEffortMax ReasoningEffort = "max"
26+ )
27+
28+ // Valid reports whether the reasoning effort is an OpenAI-supported value.
29+ func (r ReasoningEffort ) Valid () bool {
30+ switch r {
31+ case ReasoningEffortMinimal , ReasoningEffortLow , ReasoningEffortMedium ,
32+ ReasoningEffortHigh , ReasoningEffortXHigh , ReasoningEffortMax :
33+ return true
34+ default :
35+ return false
36+ }
37+ }
38+
1539const (
1640 MessageRoleDeveloper MessageRole = "developer" // Developer-provided instructions that the model should follow.
1741 MessageRoleUser MessageRole = "user" // Messages sent by an end user.
@@ -32,10 +56,11 @@ const (
3256// together to maximize cache hits. Keeping it here means it serializes with the
3357// conversation and so is restored naturally when deserializing it.
3458type Chat struct {
35- SessionID string `json:"session_id,omitempty"`
36- Model string `json:"model"`
37- Tools []Tool `json:"tools"`
38- Messages []Message `json:"messages"`
59+ SessionID string `json:"session_id,omitempty"`
60+ Model string `json:"model"`
61+ ReasoningEffort ReasoningEffort `json:"reasoning_effort,omitempty"`
62+ Tools []Tool `json:"tools"`
63+ Messages []Message `json:"messages"`
3964}
4065
4166// NewSessionID returns a random UUIDv4 used to identify a conversation.
0 commit comments