Documentation
¶
Index ¶
- Constants
- func IsAuthenticationError(err error) bool
- func IsNotFoundError(err error) bool
- func IsPermissionError(err error) bool
- func IsRateLimitError(err error) bool
- func IsValidationError(err error) bool
- func ShouldEscalateDecision(resp *DecisionResponse, opts EscalationOptions) bool
- type APIError
- type APIKeyInfo
- type APIKeysService
- func (s *APIKeysService) Create(ctx context.Context, req CreateAPIKeyRequest) (*CreateAPIKeyResponse, error)
- func (s *APIKeysService) List(ctx context.Context) ([]APIKeyInfo, error)
- func (s *APIKeysService) Revoke(ctx context.Context, keyID string) (map[string]any, error)
- func (s *APIKeysService) Rotate(ctx context.Context, keyID string, req RotateAPIKeyRequest) (*RotateAPIKeyResponse, error)
- type BatchRecordOutcomeRequest
- type Candidate
- type Client
- type CreateAPIKeyRequest
- type CreateAPIKeyResponse
- type CustomerFeedbackRequest
- type CustomerFeedbackResponse
- type DecisionItem
- type DecisionRequest
- type DecisionResponse
- type DplBundle
- type EngineStatus
- type EnginesService
- type EscalationOptions
- type EvaluateRequest
- type EvaluateResponse
- type ExportBundleRequest
- type FeedbackService
- type Option
- type ProvenanceRecordsParams
- type ProvenanceService
- func (s *ProvenanceService) Calibration(ctx context.Context) (map[string]any, error)
- func (s *ProvenanceService) Chain(ctx context.Context, fromSeq, limit *int) (map[string]any, error)
- func (s *ProvenanceService) Export(ctx context.Context, req ExportBundleRequest) (map[string]any, error)
- func (s *ProvenanceService) GetRecord(ctx context.Context, entryID string) (map[string]any, error)
- func (s *ProvenanceService) GetRequest(ctx context.Context, requestID string) (map[string]any, error)
- func (s *ProvenanceService) Keys(ctx context.Context) (map[string]any, error)
- func (s *ProvenanceService) Manifest(ctx context.Context) (map[string]any, error)
- func (s *ProvenanceService) Metrics(ctx context.Context) (map[string]any, error)
- func (s *ProvenanceService) RecordOutcome(ctx context.Context, req RecordOutcomeRequest) (map[string]any, error)
- func (s *ProvenanceService) RecordOutcomesBatch(ctx context.Context, req BatchRecordOutcomeRequest) (map[string]any, error)
- func (s *ProvenanceService) Records(ctx context.Context, params ProvenanceRecordsParams) (map[string]any, error)
- func (s *ProvenanceService) Verify(ctx context.Context, bundle DplBundle) (map[string]any, error)
- type RecordOutcomeRequest
- type RotateAPIKeyRequest
- type RotateAPIKeyResponse
- type UsageEngineBreakdown
- type UsageModel
- type UsageService
- type UsageSummaryResponse
- type UsageTimeseriesPoint
- type UsageTimeseriesResponse
Constants ¶
View Source
const ( SDKVersion = "0.1.0" DefaultBaseURL = "https://api.bipkit.io" DefaultTimeout = 30 * time.Second DefaultMaxRetries = 2 )
Variables ¶
This section is empty.
Functions ¶
func IsAuthenticationError ¶
func IsNotFoundError ¶
func IsPermissionError ¶
func IsRateLimitError ¶
func IsValidationError ¶
func ShouldEscalateDecision ¶
func ShouldEscalateDecision(resp *DecisionResponse, opts EscalationOptions) bool
Types ¶
type APIError ¶
type APIError struct {
StatusCode int
Message string
RequestID string
RetryAfter *float64
Body []byte
}
APIError represents an error returned by the Bipkit HTTP API.
type APIKeyInfo ¶
type APIKeyInfo struct {
ID string `json:"id"`
Name string `json:"name"`
KeyPrefix string `json:"key_prefix"`
Environment string `json:"environment"`
Scopes []string `json:"scopes"`
IsActive bool `json:"is_active"`
LastUsedAt *string `json:"last_used_at,omitempty"`
ExpiresAt *string `json:"expires_at,omitempty"`
CreatedAt string `json:"created_at"`
}
type APIKeysService ¶
type APIKeysService struct {
// contains filtered or unexported fields
}
func (*APIKeysService) Create ¶
func (s *APIKeysService) Create(ctx context.Context, req CreateAPIKeyRequest) (*CreateAPIKeyResponse, error)
func (*APIKeysService) List ¶
func (s *APIKeysService) List(ctx context.Context) ([]APIKeyInfo, error)
func (*APIKeysService) Rotate ¶
func (s *APIKeysService) Rotate(ctx context.Context, keyID string, req RotateAPIKeyRequest) (*RotateAPIKeyResponse, error)
type BatchRecordOutcomeRequest ¶
type BatchRecordOutcomeRequest struct {
Items []RecordOutcomeRequest `json:"items"`
}
type Client ¶
type Client struct {
Feedback *FeedbackService
Engines *EnginesService
APIKeys *APIKeysService
Usage *UsageService
Provenance *ProvenanceService
// contains filtered or unexported fields
}
func (*Client) Decide ¶
func (c *Client) Decide(ctx context.Context, req DecisionRequest) (*DecisionResponse, error)
func (*Client) Evaluate ¶
func (c *Client) Evaluate(ctx context.Context, req EvaluateRequest) (*EvaluateResponse, error)
type CreateAPIKeyRequest ¶
type CreateAPIKeyResponse ¶
type CustomerFeedbackRequest ¶
type DecisionItem ¶
type DecisionRequest ¶
type DecisionResponse ¶
type DplBundle ¶
type DplBundle struct {
SchemaVersion string `json:"schema_version,omitempty"`
Record map[string]any `json:"record"`
StateDisclosure map[string]any `json:"state_disclosure,omitempty"`
Outcome map[string]any `json:"outcome,omitempty"`
Manifest map[string]any `json:"manifest"`
Signature map[string]any `json:"signature,omitempty"`
}
type EngineStatus ¶
type EnginesService ¶
type EnginesService struct {
// contains filtered or unexported fields
}
func (*EnginesService) List ¶
func (s *EnginesService) List(ctx context.Context) ([]EngineStatus, error)
type EscalationOptions ¶
type EvaluateRequest ¶
type EvaluateResponse ¶
type ExportBundleRequest ¶
type FeedbackService ¶
type FeedbackService struct {
// contains filtered or unexported fields
}
func (*FeedbackService) Submit ¶
func (s *FeedbackService) Submit(ctx context.Context, req CustomerFeedbackRequest) (*CustomerFeedbackResponse, error)
type Option ¶
type Option func(*Client)
func WithAPIKey ¶
func WithBaseURL ¶
func WithHTTPClient ¶
func WithHeader ¶
func WithMaxRetries ¶
func WithTimeout ¶
type ProvenanceRecordsParams ¶
type ProvenanceService ¶
type ProvenanceService struct {
// contains filtered or unexported fields
}
func (*ProvenanceService) Calibration ¶
func (*ProvenanceService) Export ¶
func (s *ProvenanceService) Export(ctx context.Context, req ExportBundleRequest) (map[string]any, error)
func (*ProvenanceService) GetRequest ¶
func (*ProvenanceService) RecordOutcome ¶
func (s *ProvenanceService) RecordOutcome(ctx context.Context, req RecordOutcomeRequest) (map[string]any, error)
func (*ProvenanceService) RecordOutcomesBatch ¶
func (s *ProvenanceService) RecordOutcomesBatch(ctx context.Context, req BatchRecordOutcomeRequest) (map[string]any, error)
func (*ProvenanceService) Records ¶
func (s *ProvenanceService) Records(ctx context.Context, params ProvenanceRecordsParams) (map[string]any, error)
type RecordOutcomeRequest ¶
type RotateAPIKeyRequest ¶
type RotateAPIKeyRequest struct {
GracePeriodMinutes int `json:"grace_period_minutes"`
}
type RotateAPIKeyResponse ¶
type RotateAPIKeyResponse struct {
NewKey CreateAPIKeyResponse `json:"new_key"`
RotatedKeyID string `json:"rotated_key_id"`
PreviousKeyRevokedImmediately bool `json:"previous_key_revoked_immediately"`
PreviousKeyExpiresAt *string `json:"previous_key_expires_at,omitempty"`
}
type UsageEngineBreakdown ¶
type UsageModel ¶
type UsageService ¶
type UsageService struct {
// contains filtered or unexported fields
}
func (*UsageService) Summary ¶
func (s *UsageService) Summary(ctx context.Context) (*UsageSummaryResponse, error)
func (*UsageService) Timeseries ¶
func (s *UsageService) Timeseries(ctx context.Context, days *int) (*UsageTimeseriesResponse, error)
type UsageSummaryResponse ¶
type UsageSummaryResponse struct {
OrganizationID string `json:"organization_id"`
PeriodYM string `json:"period_ym"`
PlanSlug string `json:"plan_slug"`
PlanName string `json:"plan_name"`
SubscriptionStatus string `json:"subscription_status"`
DecisionsUsed int `json:"decisions_used"`
EvaluationsUsed int `json:"evaluations_used"`
TotalTokens int `json:"total_tokens"`
MonthlyLimit int `json:"monthly_limit"`
RemainingQuota int `json:"remaining_quota"`
AvgLatencyMs float64 `json:"avg_latency_ms"`
ByEngine []UsageEngineBreakdown `json:"by_engine"`
}
type UsageTimeseriesPoint ¶
type UsageTimeseriesResponse ¶
type UsageTimeseriesResponse struct {
OrganizationID string `json:"organization_id"`
Days int `json:"days"`
Points []UsageTimeseriesPoint `json:"points"`
}
Click to show internal directories.
Click to hide internal directories.