Documentation
¶
Index ¶
Constants ¶
View Source
const EngineVersion = "promptguard-engine-v3.1.0"
Variables ¶
View Source
var ( ErrInvalidCheckRequest = errors.New("invalid prompt guard check request") )
Functions ¶
Types ¶
type BlockedError ¶
type BlockedError struct {
Score float64
Threshold float64
Families []string
Rules []string
Source string
Decision Decision
}
func (*BlockedError) Error ¶
func (e *BlockedError) Error() string
type CheckRequest ¶ added in v1.29.0
type CheckRequest struct {
Text string
Source Source
Enforcement Enforcement
}
type Enforcement ¶ added in v1.29.0
type Enforcement uint8
const ( EnforcementUnspecified Enforcement = iota EnforcementObserve EnforcementInteractive EnforcementPersistent )
type Evaluation ¶
type Evaluation struct {
Decision Decision `json:"decision"`
Score float64 `json:"score"`
Hits []Match `json:"hits"`
Threshold float64 `json:"threshold"`
ReviewThreshold float64 `json:"review_threshold,omitempty"`
DistinctFamilies int `json:"distinct_families,omitempty"`
Source Source `json:"source,omitempty"`
OversizeBlocked bool `json:"oversize_blocked,omitempty"`
FallbackBlocked bool `json:"fallback_blocked,omitempty"`
SegmentBudgetExceeded bool `json:"segment_budget_exceeded,omitempty"`
}
type EvaluationEvent ¶ added in v1.29.0
type Guard ¶
type Guard struct {
// contains filtered or unexported fields
}
func (*Guard) Check ¶ added in v1.29.0
func (g *Guard) Check(req CheckRequest) (Evaluation, error)
func (*Guard) PolicyDigest ¶ added in v1.29.0
type Source ¶ added in v1.29.0
type Source string
const ( SourceUserPrompt Source = "user_prompt" SourcePromptBundle Source = "prompt_bundle" SourceRetrievedMemory Source = "retrieved_memory" SourceMemoryCandidate Source = "memory_candidate" SourceSessionPatch Source = "session_patch" SourceSimulationState Source = "simulation_state" SourceLawContext Source = "law_context" SourceSessionContext Source = "session_context" SourceChatLog Source = "chat_log" SourceWebSearchResult Source = "web_search_result" SourceImagePrompt Source = "image_prompt" )
type TTLCache ¶
type TTLCache[K comparable, V any] struct { // contains filtered or unexported fields }
func NewTTLCache ¶
Click to show internal directories.
Click to hide internal directories.