Skip to main content

AI Guard | Golang SDK

Text guard (Beta)

func (e *aiGuard) GuardText(ctx context.Context, input *TextGuardRequest) (*pangea.PangeaResponse[TextGuardResult], error)

Guard text.

required parameters

context.Context
input := &ai_guard.TextGuardRequest{Text: "hello world"}
response, err := client.GuardText(ctx, input)

Type Client

type Client interface

AI Guard API client.

required parameters

func(ctx context.Context, input *TextGuardRequest) (*pangea.PangeaResponse[TextGuardResult], error)
context.Context
pangea.BaseServicer

Base service methods.

type Client interface {
	GuardText(ctx context.Context, input *TextGuardRequest) (*pangea.PangeaResponse[TextGuardResult], error)

	// Base service methods.
	pangea.BaseServicer
}

Type IntelResults

type IntelResults struct

required parameters

[]string `json:"category"`
int `json:"score"`
string `json:"verdict"`
type 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 struct

required parameters

string `json:"field_type"`
int `json:"score"`
string `json:"text"`
int `json:"start"`
int `json:"end"`
bool `json:"redacted"`
type 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 struct

required parameters

int `json:"count"`
type RedactReport struct {
	Count			int				`json:"count"`
	RecognizerResults	[]RedactRecognizerResult	`json:"recognizer_results"`
}

Type TextGuardArtifact

type TextGuardArtifact struct

required parameters

bool `json:"defanged"`
int `json:"end"`
int `json:"start"`
string `json:"type"`
string `json:"value"`
string `json:"verdict,omitempty"`
type 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 struct

required parameters

int `json:"artifact_count"`
int `json:"malicious_count"`
type TextGuardFindings struct {
	ArtifactCount	int			`json:"artifact_count"`
	MaliciousCount	int			`json:"malicious_count"`
	SecurityIssues	TextGuardSecurityIssues	`json:"security_issues"`
}

Type TextGuardReport

type TextGuardReport struct

required parameters

*IntelResults `json:"domain_intel,omitempty"`
*user_intel.UserBreachedData `json:"user_intel,omitempty"`
type 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 struct

required parameters

string `json:"text"`
string `json:"recipe,omitempty"`
bool `json:"debug,omitempty"`
type TextGuardRequest struct {
	pangea.BaseRequest

	Text	string	`json:"text"`
	Recipe	string	`json:"recipe,omitempty"`
	Debug	bool	`json:"debug,omitempty"`
}

Type TextGuardResult

type TextGuardResult struct

required parameters

[]TextGuardArtifact `json:"artifacts,omitempty"`
string `json:"redacted_prompt"`
type 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 struct

required parameters

int `json:"compromised_email_addresses"`
int `json:"malicious_domain_count"`
int `json:"malicious_ip_count"`
int `json:"malicious_url_count"`
int `json:"redact_rule_match_count"`
type 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 struct
type aiGuard struct {
	pangea.BaseService
}