tool_call_validation

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const PluginName = "tool_call_validation"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Scope    string          `mapstructure:"scope"`
	Semantic *SemanticConfig `mapstructure:"semantic"`
	Rules    []RuleConfig    `mapstructure:"rules"`
}

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

func New

func New(registry *adapter.Registry, llm providers.Client, logger *slog.Logger) *Plugin

func (*Plugin) Execute

func (p *Plugin) Execute(ctx context.Context, in appplugins.ExecInput) (*appplugins.Result, error)

func (*Plugin) MandatoryStages

func (p *Plugin) MandatoryStages() []policy.Stage

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) SupportedModes

func (p *Plugin) SupportedModes() []policy.Mode

func (*Plugin) SupportedStages

func (p *Plugin) SupportedStages() []policy.Stage

func (*Plugin) ValidateConfig

func (p *Plugin) ValidateConfig(settings map[string]any) error

type RuleConfig

type RuleConfig struct {
	Tool         string   `mapstructure:"tool"`
	Validator    string   `mapstructure:"validator"`
	ArgumentPath string   `mapstructure:"argument_path"`
	Pattern      string   `mapstructure:"pattern"`
	Denylist     []string `mapstructure:"denylist"`
	Behavior     string   `mapstructure:"behavior"`
	RedactWith   string   `mapstructure:"redact_with"`
}

type SemanticConfig

type SemanticConfig struct {
	Provider string `mapstructure:"provider"`
	APIKey   string `mapstructure:"api_key"` // #nosec G101 -- config field name, not a credential
	Model    string `mapstructure:"model"`
}

type ToolCallValidationData

type ToolCallValidationData struct {
	Validator         string `json:"validator,omitempty"`
	Action            string `json:"action,omitempty"`
	ToolName          string `json:"tool_name,omitempty"`
	SemanticReasoning string `json:"semantic_reasoning,omitempty"`
	Degraded          bool   `json:"degraded,omitempty"`
	DegradedReason    string `json:"degraded_reason,omitempty"`
}

type Validator

type Validator interface {
	Evaluate(in validatorInput) (violation, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL