AI Guard | Golang SDK
Text guard (Beta)
func (e *aiGuard) GuardText(ctx context.Context, input *TextGuardRequest) (*pangea.PangeaResponse[TextGuardResult], error)Guard text.
input := &ai_guard.TextGuardRequest{Text: "hello world"}
response, err := client.GuardText(ctx, input)
Type Client
type Client interfaceAI Guard API client.
type Client interface {
GuardText(ctx context.Context, input *TextGuardRequest) (*pangea.PangeaResponse[TextGuardResult], error)
// Base service methods.
pangea.BaseServicer
}
Type IntelResults
type IntelResults structtype IntelResults struct {
Category []string `json:"category"` // The categories that apply to this indicator as determined by the provider.
Score int `json:"score"` // The score, given by the Pangea service, for the indicator.
Verdict string `json:"verdict"` // The verdict for the indicator.
}
Type RedactRecognizerResult
type RedactRecognizerResult structtype RedactRecognizerResult struct {
FieldType string `json:"field_type"` // The entity name.
Score int `json:"score"` // The certainty score that the entity matches this specific snippet.
Text string `json:"text"` // The text snippet that matched.
Start int `json:"start"` // The starting index of a snippet.
End int `json:"end"` // The ending index of a snippet.
Redacted bool `json:"redacted"` // Indicates if this rule was used to anonymize a text snippet.
}
Type RedactReport
type RedactReport structtype RedactReport struct {
Count int `json:"count"`
RecognizerResults []RedactRecognizerResult `json:"recognizer_results"`
}
Type TextGuardArtifact
type TextGuardArtifact structtype TextGuardArtifact struct {
Defanged bool `json:"defanged"`
End int `json:"end"`
Start int `json:"start"`
Type string `json:"type"`
Value string `json:"value"`
Verdict string `json:"verdict,omitempty"`
}
Type TextGuardFindings
type TextGuardFindings structtype TextGuardFindings struct {
ArtifactCount int `json:"artifact_count"`
MaliciousCount int `json:"malicious_count"`
SecurityIssues TextGuardSecurityIssues `json:"security_issues"`
}
Type TextGuardReport
type TextGuardReport structtype TextGuardReport struct {
DomainIntel *IntelResults `json:"domain_intel,omitempty"`
IPIntel *IntelResults `json:"ip_intel,omitempty"`
Redact RedactReport `json:"redact"`
URLIntel *IntelResults `json:"url_intel,omitempty"`
UserIntel *user_intel.UserBreachedData `json:"user_intel,omitempty"`
}
Type TextGuardRequest
type TextGuardRequest structtype TextGuardRequest struct {
pangea.BaseRequest
Text string `json:"text"`
Recipe string `json:"recipe,omitempty"`
Debug bool `json:"debug,omitempty"`
}
Type TextGuardResult
type TextGuardResult structtype TextGuardResult struct {
Artifacts []TextGuardArtifact `json:"artifacts,omitempty"`
Findings TextGuardFindings `json:"findings"`
RedactedPrompt string `json:"redacted_prompt"`
// `debug=true` only.
Report *TextGuardReport `json:"report,omitempty"`
}
Type TextGuardSecurityIssues
type TextGuardSecurityIssues structtype TextGuardSecurityIssues struct {
CompromisedEmailAddresses int `json:"compromised_email_addresses"`
MaliciousDomainCount int `json:"malicious_domain_count"`
MaliciousIPCount int `json:"malicious_ip_count"`
MaliciousURLCount int `json:"malicious_url_count"`
RedactRuleMatchCount int `json:"redact_rule_match_count"`
}
Type aiGuard
type aiGuard structtype aiGuard struct {
pangea.BaseService
}