Documentation
¶
Overview ¶
Package promptlearning contains the pure admission, sanitization, and fingerprinting boundary for prompt-learning samples. It deliberately has no persistence, transport, worker, relay, credential, or logging dependencies.
Index ¶
Constants ¶
const ( DefaultMaxTextBytes = 64 * 1024 MaxTextBytesLimit = 1024 * 1024 TextPolicyVersion = "nfkc-lf-tab-cf-reject-v4" RedactionPolicyVersion = "redaction-context-state-machine-v6" FingerprintPolicyVersion = "hmac-sha256-v2" OccurrencePolicyVersion = "occurrence-v2" )
Variables ¶
var ErrInvalidConfig = errors.New("invalid prompt-learning kernel configuration")
Functions ¶
This section is empty.
Types ¶
type Confidence ¶
type Confidence string
Confidence determines how a caller may use a reviewed sample. Trusted means only that a future persistence layer may attempt a unique occurrence insert; the kernel never declares an occurrence counted.
const ( ConfidenceTrusted Confidence = "trusted" ConfidenceMedium Confidence = "medium" ConfidenceLow Confidence = "low" ConfidenceRejected Confidence = "rejected" )
type Config ¶
type Config struct {
ActiveKey HMACKeyVersion
RetiredKeys []HMACKeyVersion
MaxTextBytes int
}
type ExcludedContent ¶
type ExcludedContent string
ExcludedContent identifies material that must never become a learning sample.
const ( ContentHistory ExcludedContent = "history" ContentSystem ExcludedContent = "system" ContentDeveloper ExcludedContent = "developer" ContentAssistant ExcludedContent = "assistant" ContentTool ExcludedContent = "tool" ContentAttachment ExcludedContent = "attachment" ContentResponse ExcludedContent = "response" ContentInternalTask ExcludedContent = "internal_task" ContentAutoAnalysis ExcludedContent = "automatic_analysis" )
type HMACKeyVersion ¶
HMACKeyVersion is one version of two domain-specific fingerprint keys. Key material is copied by NewKernel and is never returned by this package.
type Kernel ¶
type Kernel struct {
// contains filtered or unexported fields
}
Kernel is immutable after construction and safe for concurrent use.
type Reason ¶
type Reason string
Reason is deliberately machine-readable and never includes submitted text.
const ( ReasonAcceptedLiveUserTurn Reason = "accepted_live_user_turn" ReasonAcceptedTrustedImport Reason = "accepted_trusted_import" ReasonAcceptedLegacyCandidate Reason = "accepted_legacy_candidate" ReasonAcceptedUntrustedClaim Reason = "accepted_untrusted_candidate" ReasonUntrustedOriginClaim Reason = "untrusted_origin_claim" ReasonHistoricalContent Reason = "historical_content" ReasonSystemContent Reason = "system_content" ReasonDeveloperContent Reason = "developer_content" ReasonAssistantContent Reason = "assistant_content" ReasonToolContent Reason = "tool_content" ReasonAttachmentContent Reason = "attachment_content" ReasonResponseContent Reason = "response_content" ReasonInternalContent Reason = "internal_content" ReasonInvalidCandidate Reason = "invalid_candidate" ReasonInvalidProvenance Reason = "invalid_provenance" ReasonTextTooLarge Reason = "text_too_large" ReasonInvalidUTF8 Reason = "invalid_utf8" ReasonUnsupportedControl Reason = "unsupported_control_character" ReasonUnsafeUnicodeFormat Reason = "unsafe_unicode_format_character" ReasonEmptyText Reason = "empty_text" ReasonRedactedTextTooLarge Reason = "redacted_text_too_large" ReasonRedactionFailed Reason = "redaction_failed" )
type RedactionKind ¶
type RedactionKind string
const ( RedactionURLCredential RedactionKind = "url_credential" RedactionJWT RedactionKind = "jwt" RedactionAPIKey RedactionKind = "api_key" RedactionEmail RedactionKind = "email" RedactionPhone RedactionKind = "phone" RedactionSecret RedactionKind = "secret" RedactionHighEntropy RedactionKind = "high_entropy" )
type RedactionSummary ¶
type RedactionSummary map[RedactionKind]int