Prompt Guard | Golang SDK
Guard (Beta)
func (e *promptGuard) Guard(ctx context.Context, input *GuardRequest) (*pangea.PangeaResponse[GuardResult], error)Guard messages.
input := &prompt_guard.GuardRequest{Messages: []prompt_guard.Message{{Role: "user", Content: "how are you?"}}}
response, err := client.Guard(ctx, input)
Type Client
type Client interfacePrompt Guard API client.
type Client interface {
Guard(ctx context.Context, input *GuardRequest) (*pangea.PangeaResponse[GuardResult], error)
// Base service methods.
pangea.BaseServicer
}
Type GuardRequest
type GuardRequest structtype GuardRequest struct {
pangea.BaseRequest
Messages []Message `json:"messages"`
}
Type GuardResult
type GuardResult structtype GuardResult struct {
Detected bool `json:"detected"`
Type string `json:"type,omitempty"`
Detector string `json:"detector,omitempty"`
Confidence int `json:"confidence"`
}
Type Message
type Message structtype Message struct {
Role string `json:"role"`
Content string `json:"content"`
}
Type promptGuard
type promptGuard structtype promptGuard struct {
pangea.BaseService
}