Skip to main content

Prompt Guard | Golang SDK

Guard (Beta)

func (e *promptGuard) Guard(ctx context.Context, input *GuardRequest) (*pangea.PangeaResponse[GuardResult], error)

Guard messages.

required parameters

context.Context
input := &prompt_guard.GuardRequest{Messages: []prompt_guard.Message{{Role: "user", Content: "how are you?"}}}
response, err := client.Guard(ctx, input)

Type Client

type Client interface

Prompt Guard API client.

required parameters

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

Base service methods.

type Client interface {
	Guard(ctx context.Context, input *GuardRequest) (*pangea.PangeaResponse[GuardResult], error)

	// Base service methods.
	pangea.BaseServicer
}

Type GuardRequest

type GuardRequest struct

required parameters

[]Message `json:"messages"`
type GuardRequest struct {
	pangea.BaseRequest

	Messages	[]Message	`json:"messages"`
}

Type GuardResult

type GuardResult struct

required parameters

bool `json:"detected"`
string `json:"type,omitempty"`
string `json:"detector,omitempty"`
int `json:"confidence"`
type GuardResult struct {
	Detected	bool	`json:"detected"`
	Type		string	`json:"type,omitempty"`
	Detector	string	`json:"detector,omitempty"`
	Confidence	int	`json:"confidence"`
}

Type Message

type Message struct

required parameters

string `json:"role"`
string `json:"content"`
type Message struct {
	Role	string	`json:"role"`
	Content	string	`json:"content"`
}

Type promptGuard

type promptGuard struct
type promptGuard struct {
	pangea.BaseService
}