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
+8 -1
View File
@@ -26,6 +26,13 @@ const (
// condition. Chains advance past it without penalizing the target's health.
var ErrModelNotFound = errors.New("model not found")
// ErrUnsupported marks a request the target cannot serve by declaration —
// e.g. images that cannot be normalized to its capabilities, or a feature
// (tools, structured output) it does not support. Permanent for the target,
// but chains advance past it without penalizing health: another element may
// well be able to serve the request.
var ErrUnsupported = errors.New("request unsupported by target")
// APIError is a structured provider error carrying enough context to
// classify it and to debug it.
type APIError struct {
@@ -96,7 +103,7 @@ func Classify(err error) ErrorClass {
if errors.Is(err, context.DeadlineExceeded) {
return ClassTransient
}
if errors.Is(err, ErrModelNotFound) {
if errors.Is(err, ErrModelNotFound) || errors.Is(err, ErrUnsupported) {
return ClassPermanent
}
if errors.Is(err, syscall.ECONNREFUSED) || errors.Is(err, syscall.ECONNRESET) {