Documentation
¶
Overview ¶
Package palveron provides the official Go SDK for the PALVERON AI Governance Platform.
Usage:
client := palveron.NewClient("pv_live_xxx")
result, err := client.Verify(ctx, &palveron.VerifyRequest{
Prompt: "User input here",
})
if err != nil {
log.Fatal(err)
}
if result.Decision == palveron.Blocked {
log.Fatalf("Blocked: %s", result.Reason)
}
Index ¶
- Constants
- func IsAuthError(err error) bool
- func IsRateLimited(err error) bool
- type Attachment
- type Client
- func (c *Client) Check(ctx context.Context, prompt string) (*VerifyResponse, error)
- func (c *Client) Health(ctx context.Context) (*HealthResponse, error)
- func (c *Client) Verify(ctx context.Context, req *VerifyRequest) (*VerifyResponse, error)
- func (c *Client) VerifyFile(ctx context.Context, prompt, path string) (*VerifyResponse, error)
- type Decision
- type Finding
- type HealthResponse
- type Option
- type PalveronError
- type RequestContext
- type VerifyRequest
- type VerifyResponse
Constants ¶
const ( Version = "0.5.0" DefaultBaseURL = "https://gateway.palveron.com" DefaultTimeout = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func IsAuthError ¶
IsAuthError returns true if the error is an authentication failure.
func IsRateLimited ¶
IsRateLimited returns true if the error is a rate limit.
Types ¶
type Attachment ¶
type Attachment struct {
ContentType string `json:"content_type"`
Data string `json:"data"` // Base64
Filename string `json:"filename,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
Attachment represents a multi-modal file attachment.
func AttachmentFromFile ¶
func AttachmentFromFile(path string) (*Attachment, error)
AttachmentFromFile creates an Attachment from a local file path.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the PALVERON API client.
func (*Client) Health ¶
func (c *Client) Health(ctx context.Context) (*HealthResponse, error)
Health checks the gateway health.
func (*Client) Verify ¶
func (c *Client) Verify(ctx context.Context, req *VerifyRequest) (*VerifyResponse, error)
Verify sends a governance verification request.
func (*Client) VerifyFile ¶
VerifyFile verifies a prompt with a file attachment.
type Finding ¶
type Finding struct {
Risk string `json:"risk"`
Category string `json:"category"`
Description string `json:"description"`
Confidence float64 `json:"confidence"`
}
Finding represents a security finding from content analysis.
type HealthResponse ¶
type HealthResponse struct {
Status string `json:"status"`
Version string `json:"version"`
Uptime float64 `json:"uptime"`
}
HealthResponse represents the gateway health status.
type Option ¶
type Option func(*Client)
Option configures the Client.
func WithBaseURL ¶
WithBaseURL sets a custom gateway URL (e.g., for on-prem).
func WithHTTPClient ¶
WithHTTPClient sets a custom http.Client (for proxies, TLS config, etc.).
func WithHeaders ¶
WithHeaders adds custom headers to every request.
type PalveronError ¶
type PalveronError struct {
Code string
Message string
StatusCode int
RequestID string
Retryable bool
}
PalveronError is the base error type for all SDK errors.
func (*PalveronError) Error ¶
func (e *PalveronError) Error() string
type RequestContext ¶
type RequestContext struct {
MCPServer string `json:"mcp_server,omitempty"`
ToolName string `json:"tool_name,omitempty"`
ChainDepth int `json:"chain_depth,omitempty"`
SourceSystem string `json:"source_system,omitempty"`
SessionID string `json:"session_id,omitempty"`
}
RequestContext provides agentic context for MCP/tool chains.
type VerifyRequest ¶
type VerifyRequest struct {
Prompt string `json:"prompt"`
ExtractedText string `json:"extracted_text,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
Attachments []Attachment `json:"attachments,omitempty"`
Context *RequestContext `json:"context,omitempty"`
}
VerifyRequest is the input for a governance check.
type VerifyResponse ¶
type VerifyResponse struct {
Decision Decision `json:"decision"`
Output string `json:"output"`
Reason string `json:"reason"`
TraceID string `json:"trace_id"`
IntegrityHash string `json:"integrity_hash"`
ShouldAnchor bool `json:"should_anchor"`
FlareStatus string `json:"flare_status"`
FlareTxHash *string `json:"flare_tx_hash"`
ContentType string `json:"content_type"`
Findings []Finding `json:"findings"`
LatencyMs float64 `json:"-"` // Client-measured
}
VerifyResponse is the output of a governance check.
func (*VerifyResponse) IsAllowed ¶
func (r *VerifyResponse) IsAllowed() bool
IsAllowed returns true if the decision is ALLOWED.
func (*VerifyResponse) IsBlocked ¶
func (r *VerifyResponse) IsBlocked() bool
IsBlocked returns true if the decision is BLOCKED.