feat: conversion-driven extensions — resolvers, DefineTool, hooks, ops controls
Phase 9a (ADR-0014): Registry.RegisterResolver for dynamic tiers; DefineTool[Args] typed tools; Usage cache/reasoning detail fields wired through anthropic/openai/google; WithPromptCaching (Anthropic cache_control); agent supervision hooks (WithMaxStepsFunc, WithSteer, WithCompactor, WithToolErrorLimits + ErrToolLoop); health Bench/Unbench/Snapshot; ChainConfig.Observer failover events. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -43,6 +43,11 @@ type Request struct {
|
||||
// Providers map it to their native knob (OpenAI reasoning_effort,
|
||||
// Ollama think levels) and ignore it where no mapping exists.
|
||||
ReasoningEffort string
|
||||
|
||||
// PromptCache opts the request into the provider's prompt caching
|
||||
// (Anthropic cache_control; ignored by providers that cache
|
||||
// automatically or not at all).
|
||||
PromptCache bool
|
||||
}
|
||||
|
||||
// Option mutates a Request before it is sent. Options passed to Generate or
|
||||
@@ -100,6 +105,12 @@ func WithReasoningEffort(level string) Option {
|
||||
return func(r *Request) { r.ReasoningEffort = level }
|
||||
}
|
||||
|
||||
// WithPromptCaching opts into provider prompt caching where it is an
|
||||
// explicit feature (Anthropic); a no-op elsewhere.
|
||||
func WithPromptCaching() Option {
|
||||
return func(r *Request) { r.PromptCache = true }
|
||||
}
|
||||
|
||||
// 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 {
|
||||
|
||||
Reference in New Issue
Block a user