complexity

package
v0.34.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package complexity is a client for the Firewall Complexity API, which scores the complexity of a user message in [0,1] so the load balancer can route by difficulty.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotConfigured = errors.New("complexity: client not configured")

ErrNotConfigured is returned when Score is called without a base URL and token provider.

View Source
var ErrUnauthorized = errors.New("complexity: unauthorized")

ErrUnauthorized is returned when the Firewall Complexity API rejects the token.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client calls the Firewall Complexity API.

func NewClient

func NewClient(baseURL string, tokenProvider TokenProvider, timeout time.Duration) *Client

NewClient builds a Client. Missing endpoint credentials leave it unconfigured.

func (*Client) Configured

func (c *Client) Configured() bool

Configured reports whether the endpoint and token provider are configured.

func (*Client) Score

func (c *Client) Score(ctx context.Context, input, conversationID, tenantID string) (float64, error)

Score returns the session-smoothed complexity score in [0,1] for input. conversationID and tenantID are optional and omitted from the request when empty.

type TokenProvider added in v0.34.0

type TokenProvider interface {
	Configured() bool
	Invalidate()
	Token() (string, error)
}

TokenProvider supplies authentication tokens for Firewall requests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL