Help us shape the future of Go! Take the 2026 Go Developer Survey

outputguard

package
v1.43.1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidProtectedTexts = errors.New("outputguard: invalid protected texts")
View Source
var ErrRestrictedGeneratedText = errors.New("generated answer contains restricted output")

Functions

This section is empty.

Types

type BoundGuard added in v1.30.1

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

BoundGuard는 한 요청의 정규화된 protected text index를 소유한다.

func (*BoundGuard) Check added in v1.30.1

func (g *BoundGuard) Check(text string) Evaluation

func (*BoundGuard) Validate added in v1.30.1

func (g *BoundGuard) Validate(text string) error

type CheckRequest added in v1.29.0

type CheckRequest struct {
	Text string `json:"text"`
}

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{}

func NewGuard added in v1.29.0

func NewGuard() *Guard

func (*Guard) Bind added in v1.30.1

func (g *Guard) Bind(protectedTexts []string) (*BoundGuard, error)

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"
	ReasonProtectedInputInvalid ReasonCode = "protected_input_invalid"
	ReasonDecodeIncomplete      ReasonCode = "decode_incomplete"
	ReasonOutputOversize        ReasonCode = "output_oversize"
)

Jump to

Keyboard shortcuts

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