feat(llm): ReasoningEffort request option and ErrUnsupported sentinel

Groundwork for the provider phase: reasoning levels map to native knobs
(OpenAI reasoning_effort, Ollama think); ErrUnsupported marks declared
capability mismatches that chains advance past without health penalty.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 12:40:47 +02:00
parent 0d0e8e069e
commit 323558ed72
4 changed files with 25 additions and 2 deletions
+12
View File
@@ -37,6 +37,12 @@ type Request struct {
// StopSequences halt generation when emitted.
StopSequences []string
// ReasoningEffort requests a reasoning/thinking level from models that
// support one: "low", "medium", or "high" (empty = provider default).
// Providers map it to their native knob (OpenAI reasoning_effort,
// Ollama think levels) and ignore it where no mapping exists.
ReasoningEffort string
}
// Option mutates a Request before it is sent. Options passed to Generate or
@@ -88,6 +94,12 @@ func WithStopSequences(stops ...string) Option {
return func(r *Request) { r.StopSequences = stops }
}
// WithReasoningEffort requests a reasoning/thinking level ("low", "medium",
// "high") from models that support one.
func WithReasoningEffort(level string) Option {
return func(r *Request) { r.ReasoningEffort = level }
}
// Apply returns a copy of the request with all options applied. Providers
// and wrappers call this once at the top of Generate/Stream.
func (r Request) Apply(opts ...Option) Request {