Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache wraps a Provider with an in-memory verdict cache. Identical requests (same model, prompt, content) return cached verdicts without calling the underlying provider. Errors are not cached.
func NewCache ¶
func NewCache(provider Provider, opts ...CacheOption) *Cache
NewCache creates a caching wrapper around a Provider.
type CacheOption ¶
type CacheOption func(*Cache)
CacheOption configures a Cache.
func WithMaxSize ¶
func WithMaxSize(n int) CacheOption
WithMaxSize sets the maximum number of cached verdicts. When exceeded, the oldest entries are evicted. Default: 10,000. Values less than 1 are clamped to 1.
type Request ¶
type Request struct {
Prompt string // The judgment prompt from the rule
Content string // The content to judge
Model string // Model identifier (shortcut or full ID)
}
Request is the input to a judge call.
Click to show internal directories.
Click to hide internal directories.