Documentation
¶
Overview ¶
Package extension adapts the Sentinel engine as a Forge extension.
Index ¶
- Constants
- type Config
- type ExtOption
- func WithBasePath(path string) ExtOption
- func WithConfig(cfg Config) ExtOption
- func WithDisableMigrate() ExtOption
- func WithDisableRoutes() ExtOption
- func WithEngineOption(opt engine.Option) ExtOption
- func WithExtension(x plugin.Extension) ExtOption
- func WithGroveDatabase(name string) ExtOption
- func WithRequireConfig(require bool) ExtOption
- func WithScorer(d scorer.Descriptor, f scorer.Factory) ExtOption
- func WithStore(s store.Store) ExtOption
- func WithTarget(name, description string, t target.Target) ExtOption
- type Extension
- func (e *Extension) API() *api.API
- func (e *Extension) Engine() *engine.Engine
- func (e *Extension) Handler() http.Handler
- func (e *Extension) Health(ctx context.Context) error
- func (e *Extension) Register(fapp forge.App) error
- func (e *Extension) RegisterContractContributor(disp *dispatcher.Dispatcher, reg dashcontract.Registry, ...) error
- func (e *Extension) RegisterRoutes(router forge.Router)
- func (e *Extension) Start(ctx context.Context) error
- func (e *Extension) Stop(ctx context.Context) error
Constants ¶
const ExtensionDescription = "Composable AI evaluation and testing framework with persona-aware scoring"
ExtensionDescription is the human-readable description.
const ExtensionName = "sentinel"
ExtensionName is the name registered with Forge.
const ExtensionVersion = "0.1.0"
ExtensionVersion is the semantic version.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// DisableRoutes prevents HTTP route registration.
DisableRoutes bool `json:"disable_routes" mapstructure:"disable_routes" yaml:"disable_routes"`
// DisableMigrate prevents auto-migration on start.
DisableMigrate bool `json:"disable_migrate" mapstructure:"disable_migrate" yaml:"disable_migrate"`
// BasePath is the URL prefix for all sentinel routes.
BasePath string `json:"base_path" mapstructure:"base_path" yaml:"base_path"`
// DefaultModel is the LLM model to use when not specified per-suite.
DefaultModel string `json:"default_model" mapstructure:"default_model" yaml:"default_model"`
// Temperature is the default sampling temperature.
Temperature float64 `json:"temperature" mapstructure:"temperature" yaml:"temperature"`
// PassThreshold is the minimum score to consider a test case passed.
PassThreshold float64 `json:"pass_threshold" mapstructure:"pass_threshold" yaml:"pass_threshold"`
// RegressionThreshold is how far below the current baseline a metric
// may fall before a run counts as regressed. Default 0.05.
RegressionThreshold float64 `json:"regression_threshold" mapstructure:"regression_threshold" yaml:"regression_threshold"`
// Concurrency is the number of parallel evaluation workers.
Concurrency int `json:"concurrency" mapstructure:"concurrency" yaml:"concurrency"`
// ShutdownTimeout is the maximum time to wait for graceful shutdown.
ShutdownTimeout time.Duration `json:"shutdown_timeout" mapstructure:"shutdown_timeout" yaml:"shutdown_timeout"`
// GroveDatabase is the name of a grove.DB registered in the DI container.
// When set, the extension resolves this named database and auto-constructs
// the appropriate store based on the driver type (pg/sqlite/mongo).
// When empty and WithGroveDatabase was called, the default (unnamed) DB is used.
GroveDatabase string `json:"grove_database" mapstructure:"grove_database" yaml:"grove_database"`
// DashboardAppID is the app the dashboard reads and writes when the
// signed-in principal carries no app_id claim. Nothing populates that
// claim today, so a deployment that wants the dashboard sets this. There
// is no default: with neither, every dashboard request is refused,
// because an empty app id matches every app in every store.
DashboardAppID string `json:"dashboard_app_id" mapstructure:"dashboard_app_id" yaml:"dashboard_app_id"`
// RequireConfig requires config to be present in YAML files.
// If true and no config is found, Register returns an error.
RequireConfig bool `json:"-" yaml:"-"`
}
Config holds the Sentinel extension configuration. Fields can be set programmatically via ExtOption functions or loaded from YAML configuration files (under "extensions.sentinel" or "sentinel" keys).
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default configuration for the Sentinel extension.
type ExtOption ¶
type ExtOption func(*Extension)
ExtOption configures the Sentinel Forge extension.
func WithBasePath ¶
WithBasePath sets the URL prefix for all sentinel routes.
func WithConfig ¶
WithConfig sets the extension configuration.
func WithDisableMigrate ¶
func WithDisableMigrate() ExtOption
WithDisableMigrate disables auto-migration on start.
func WithDisableRoutes ¶
func WithDisableRoutes() ExtOption
WithDisableRoutes disables HTTP route registration.
func WithEngineOption ¶
WithEngineOption passes an engine option directly.
func WithExtension ¶
WithExtension registers a Sentinel extension (lifecycle hooks).
func WithGroveDatabase ¶
WithGroveDatabase sets the name of the grove.DB to resolve from the DI container. The extension will auto-construct the appropriate store backend (postgres/sqlite/mongo) based on the grove driver type. Pass an empty string to use the default (unnamed) grove.DB.
func WithRequireConfig ¶
WithRequireConfig requires config to be present in YAML files. If true and no config is found, Register returns an error.
func WithScorer ¶
func WithScorer(d scorer.Descriptor, f scorer.Factory) ExtOption
WithScorer registers a scorer the dashboard can offer for a run. Use it for the LLM scorers, which need the application's LLMClient.
type Extension ¶
type Extension struct {
*forge.BaseExtension
// contains filtered or unexported fields
}
Extension adapts Sentinel as a Forge extension.
func (*Extension) Engine ¶
Engine returns the underlying Sentinel engine. This is nil until Register is called.
func (*Extension) Health ¶
Health implements forge.Extension.
func (*Extension) Register ¶
Register implements forge.Extension. It initializes the engine, builds the API, and optionally registers HTTP routes.
func (*Extension) RegisterContractContributor ¶
func (e *Extension) RegisterContractContributor( disp *dispatcher.Dispatcher, reg dashcontract.Registry, wreg dashcontract.WardenRegistry, ) error
RegisterContractContributor implements dashboard.ContractContributorAware: it registers the sentinel contract contributor the React shell reads.
func (*Extension) RegisterRoutes ¶
RegisterRoutes registers all Sentinel API routes into a Forge router.