validators

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArenaAssertionMiddleware

func ArenaAssertionMiddleware(registry *runtimeValidators.Registry, assertions []runtimeValidators.ValidatorConfig) pipeline.Middleware

ArenaAssertionMiddleware creates middleware that validates assertions after LLM responses

func NewArenaAssertionRegistry

func NewArenaAssertionRegistry() *runtimeValidators.Registry

NewArenaAssertionRegistry creates a new registry with arena-specific assertion validators

func NewContentIncludesValidator

func NewContentIncludesValidator(params map[string]interface{}) runtimeValidators.Validator

NewContentIncludesValidator creates a new content_includes validator from params

func NewContentMatchesValidator

func NewContentMatchesValidator(params map[string]interface{}) runtimeValidators.Validator

NewContentMatchesValidator creates a new content_matches validator from params

func NewToolsCalledValidator

func NewToolsCalledValidator(params map[string]interface{}) runtimeValidators.Validator

NewToolsCalledValidator creates a new tools_called validator from params

func NewToolsNotCalledValidator

func NewToolsNotCalledValidator(params map[string]interface{}) runtimeValidators.Validator

NewToolsNotCalledValidator creates a new tools_not_called validator from params

Types

type ContentIncludesValidator

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

ContentIncludesValidator checks that content includes all expected patterns

func (*ContentIncludesValidator) Validate

func (v *ContentIncludesValidator) Validate(content string, params map[string]interface{}) runtimeValidators.ValidationResult

Validate checks if all patterns are present in content (case-insensitive)

type ContentMatchesValidator

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

ContentMatchesValidator checks that content matches a regex pattern

func (*ContentMatchesValidator) Validate

func (v *ContentMatchesValidator) Validate(content string, params map[string]interface{}) runtimeValidators.ValidationResult

Validate checks if content matches the regex pattern

type LengthCapValidator

type LengthCapValidator struct{}

LengthCapValidator ensures user messages are at most 2 sentences

func NewLengthCapValidator

func NewLengthCapValidator() *LengthCapValidator

NewLengthCapValidator creates a new length cap validator

func (*LengthCapValidator) SupportsStreaming

func (v *LengthCapValidator) SupportsStreaming() bool

SupportsStreaming returns false as sentence counting requires complete content

func (*LengthCapValidator) Validate

func (v *LengthCapValidator) Validate(content string, params map[string]interface{}) ValidationResult

Validate checks for sentence count violations

type QuestionCapValidator

type QuestionCapValidator struct{}

QuestionCapValidator ensures user messages have at most one question

func NewQuestionCapValidator

func NewQuestionCapValidator() *QuestionCapValidator

NewQuestionCapValidator creates a new question cap validator

func (*QuestionCapValidator) SupportsStreaming

func (v *QuestionCapValidator) SupportsStreaming() bool

SupportsStreaming returns false as question counting requires complete content

func (*QuestionCapValidator) Validate

func (v *QuestionCapValidator) Validate(content string, params map[string]interface{}) ValidationResult

Validate checks for question count violations

type RoleIntegrityValidator

type RoleIntegrityValidator struct{}

RoleIntegrityValidator checks that user LLM doesn't provide assistant-like responses

func NewRoleIntegrityValidator

func NewRoleIntegrityValidator() *RoleIntegrityValidator

NewRoleIntegrityValidator creates a new role integrity validator

func (*RoleIntegrityValidator) SupportsStreaming

func (v *RoleIntegrityValidator) SupportsStreaming() bool

SupportsStreaming returns false as role integrity requires complete content

func (*RoleIntegrityValidator) Validate

func (v *RoleIntegrityValidator) Validate(content string, params map[string]interface{}) ValidationResult

Validate checks for role integrity violations

type ToolsCalledValidator

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

ToolsCalledValidator checks that expected tools were called in the response

func (*ToolsCalledValidator) Validate

func (v *ToolsCalledValidator) Validate(content string, params map[string]interface{}) runtimeValidators.ValidationResult

Validate checks if expected tools were called

type ToolsNotCalledValidator

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

ToolsNotCalledValidator checks that forbidden tools were NOT called in the response

func (*ToolsNotCalledValidator) Validate

func (v *ToolsNotCalledValidator) Validate(content string, params map[string]interface{}) runtimeValidators.ValidationResult

Validate checks if any forbidden tools were called

type ValidationResult

type ValidationResult = validators.ValidationResult

ValidationResult is an alias for runtime validators.ValidationResult

Jump to

Keyboard shortcuts

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