outputguard

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRestrictedGeneratedText = errors.New("generated answer contains restricted output")

Functions

This section is empty.

Types

type CheckRequest added in v1.29.0

type CheckRequest struct {
	Text           string   `json:"text"`
	ProtectedTexts []string `json:"protected_texts,omitempty"`
}

type Decision added in v1.29.0

type Decision string
const (
	DecisionAllow Decision = "allow"
	DecisionBlock Decision = "block"
)

type Evaluation added in v1.29.0

type Evaluation struct {
	Decision    Decision     `json:"decision"`
	ReasonCodes []ReasonCode `json:"reason_codes,omitempty"`
	RuleIDs     []string     `json:"rule_ids,omitempty"`
	OutputBytes int          `json:"output_bytes"`
}

type Guard added in v1.29.0

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

func NewGuard added in v1.29.0

func NewGuard() *Guard

func (*Guard) Check added in v1.29.0

func (g *Guard) Check(req CheckRequest) Evaluation

func (*Guard) Validate added in v1.29.0

func (g *Guard) Validate(req CheckRequest) error

type ReasonCode added in v1.29.0

type ReasonCode string
const (
	ReasonRoleBlock              ReasonCode = "role_block"
	ReasonSecretPattern          ReasonCode = "secret_pattern"
	ReasonProtectedTextOverlap   ReasonCode = "protected_text_overlap"
	ReasonProtectedInputOversize ReasonCode = "protected_input_oversize"
	ReasonOutputOversize         ReasonCode = "output_oversize"
)

Jump to

Keyboard shortcuts

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