Documentation
¶
Index ¶
Constants ¶
View Source
const ( PolicyDenyOnPattern = "deny_on_pattern" PolicyAllowOnPattern = "allow_on_pattern" )
View Source
const ID = "pre-request-policy"
ID is the bundled feature plugin id for LLM-backed pre-request admission policy.
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
func NewHandler(cfg HandlerConfig) (prerequest.Handler, error)
NewHandler builds one policy handler. Tests may pass Prompt directly to avoid filesystem I/O.
func NewHandlers ¶
func NewHandlers(cfg Config) ([]prerequest.Handler, error)
NewHandlers builds sorted pre-request handlers and loads configured prompt files.
Types ¶
type Config ¶
type Config struct {
PromptDir string `yaml:"prompt_dir"`
Handlers []HandlerConfig `yaml:"handlers"`
}
Config is the plugin-level configuration for chained pre-request policy handlers.
type HandlerConfig ¶
type HandlerConfig struct {
ID string `yaml:"id"`
Priority int `yaml:"priority"`
PromptFilename string `yaml:"prompt_filename"`
Prompt string `yaml:"-"`
ModelRoutingString string `yaml:"model_routing_string"`
AllowPattern string `yaml:"allow_pattern"`
DenyPattern string `yaml:"deny_pattern"`
Policy string `yaml:"policy"`
DenyMessage string `yaml:"deny_message"`
Timeout time.Duration `yaml:"-"`
TimeoutRaw string `yaml:"timeout"`
}
HandlerConfig configures one pre-request policy model call.
Click to show internal directories.
Click to hide internal directories.