probe

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: MIT

SPDX-License-Identifier: MIT

SPDX-License-Identifier: MIT

Index

Constants

This section is empty.

Variables

View Source
var Categories = []string{
	"prompt-injection",
	"jailbreak",
	"extraction",
	"guardrail-bypass",
	"owasp-llm",
	"hallucination",
	"harmful-content",
	"bias",
}

Categories is the list of all valid probe categories.

Functions

func CountByCategory

func CountByCategory(probes []Resolved) map[string]int

CountByCategory returns a map of category → probe count.

func ValidCategory

func ValidCategory(category string) bool

ValidCategory returns true if the given category is valid.

Types

type Case

type Case struct {
	ID    string   `yaml:"id"`
	Name  string   `yaml:"name"`
	Input string   `yaml:"input"`
	Judge JudgeDef `yaml:"judge"`
}

Case is a single test case within a probe suite.

type Indicator

type Indicator struct {
	Contains    string   `yaml:"contains,omitempty"`
	ContainsAny []string `yaml:"contains_any,omitempty"`
	Regex       string   `yaml:"regex,omitempty"`
	StartsWith  string   `yaml:"starts_with,omitempty"`
}

Indicator is a single matching rule used by the judge.

type JudgeDef

type JudgeDef struct {
	SuccessIndicators []Indicator `yaml:"success_indicators"`
	FailureIndicators []Indicator `yaml:"failure_indicators"`
	LLMJudgeCriteria  string      `yaml:"llm_judge_criteria,omitempty"`
}

JudgeDef defines the success and failure indicators for judging a probe result.

type Loader

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

Loader loads probe suites from an embed.FS or os filesystem.

func NewLoader

func NewLoader(fsys fs.FS) *Loader

NewLoader creates a probe loader that reads from the given filesystem. Typically pass autoattack.EmbeddedProbes for the embedded probe library.

func (*Loader) LoadAll

func (l *Loader) LoadAll() ([]Suite, error)

LoadAll loads all probe suites from the probes/ directory.

func (*Loader) LoadCategory

func (l *Loader) LoadCategory(category string) ([]Suite, error)

LoadCategory loads all probe suites in a specific category.

type Resolved

type Resolved struct {
	SuiteID     string
	Version     int
	Category    string
	Subcategory string
	Severity    Severity
	OWASPLLM    string
	CaseID      string
	CaseName    string
	Input       string
	Judge       JudgeDef
}

Resolved is a flattened probe ready for execution, combining suite metadata with a specific case.

func FilterByCategories

func FilterByCategories(probes []Resolved, categories []string) []Resolved

FilterByCategories filters resolved probes to only include specified categories.

func FilterByOWASP

func FilterByOWASP(probes []Resolved) []Resolved

FilterByOWASP filters resolved probes to only those with an OWASP LLM tag.

func Resolve

func Resolve(suites []Suite) []Resolved

Resolve flattens suites into individual resolved probes ready for execution.

type Severity

type Severity string

Severity levels for probe findings.

const (
	SeverityCritical Severity = "critical"
	SeverityHigh     Severity = "high"
	SeverityMedium   Severity = "medium"
	SeverityLow      Severity = "low"
)

type Suite

type Suite struct {
	ID          string   `yaml:"id"`
	Version     int      `yaml:"version"`
	Name        string   `yaml:"name"`
	Category    string   `yaml:"category"`
	Subcategory string   `yaml:"subcategory"`
	Severity    Severity `yaml:"severity"`
	OWASPLLM    string   `yaml:"owasp_llm"`
	Description string   `yaml:"description"`
	References  []string `yaml:"references"`
	Cases       []Case   `yaml:"cases"`
}

Suite is a collection of test cases loaded from a single YAML file.

Jump to

Keyboard shortcuts

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