Versions in this module Expand all Collapse all v0 v0.1.0 Sep 21, 2026 Changes in this version + const AnswerKey + const DefaultRequestsPerMinute + const DefaultTokensPerSecond + const Version + var ErrBadRequest = errors.New("jev: bad request") + var ErrBodyTooLarge = errors.New("jev: response body exceeds 16 MiB") + var ErrConfig = errors.New("jev: invalid configuration") + var ErrConnection = errors.New("jev: connection error") + var ErrForbidden = errors.New("jev: forbidden") + var ErrNotFound = errors.New("jev: not found") + var ErrOverloaded = errors.New("jev: overloaded") + var ErrRateLimited = errors.New("jev: rate limited") + var ErrRequest = errors.New("jev: invalid request") + var ErrResponse = errors.New("jev: invalid response") + var ErrServer = errors.New("jev: server error") + var ErrStatus = errors.New("jev: unexpected status") + var ErrTimeout = errors.New("jev: request timed out") + var ErrUnauthorized = errors.New("jev: unauthorized") + var ErrUnprocessable = errors.New("jev: unprocessable") + type APIError struct + Attempts int + Body []byte + Header http.Header + Message string + Method string + RequestID string + Status int + URL string + func (e *APIError) Error() string + func (e *APIError) Is(target error) bool + func (e *APIError) RetryAfter() (time.Duration, bool) + type Answer interface + Type func() string + type Choice struct + Criteria any + Instructions any + type ChoiceAnswer struct + Choice string + Confidence float64 + Probabilities map[string]float64 + func (ChoiceAnswer) Type() string + type Client struct + func New(opts ...Option) (*Client, error) + func (c *Client) BaseURL() string + func (c *Client) Choice(ctx context.Context, state any, q Choice, opts ...Option) (ChoiceAnswer, error) + func (c *Client) ChoiceAs[T any](ctx context.Context, state any, q Choice, opts ...Option) (T, error) + func (c *Client) Classify(ctx context.Context, state any, instructions any, criteria any, opts ...Option) (ChoiceAnswer, error) + func (c *Client) ClassifyAs[T any](ctx context.Context, state any, instructions any, criteria any, opts ...Option) (T, error) + func (c *Client) CloseIdleConnections() + func (c *Client) Limiter() Limiter + func (c *Client) ListModels(ctx context.Context, opts ...Option) ([]ModelInfo, error) + func (c *Client) Model() string + func (c *Client) Noul(ctx context.Context, state any, question any, opts ...Option) (NoulAnswer, error) + func (c *Client) NoulAs[T any](ctx context.Context, state any, question any, opts ...Option) (T, error) + func (c *Client) Rate(ctx context.Context, state any, instructions any, levels any, opts ...Option) (ScoreAnswer, error) + func (c *Client) RateAs[T any](ctx context.Context, state any, instructions any, levels any, opts ...Option) (T, error) + func (c *Client) Score(ctx context.Context, state any, q Score, opts ...Option) (ScoreAnswer, error) + func (c *Client) ScoreAs[T any](ctx context.Context, state any, q Score, opts ...Option) (T, error) + func (c *Client) SystemOne(ctx context.Context, req Request, opts ...Option) (*Response, error) + func (c *Client) SystemOneAs[T any](ctx context.Context, req Request, opts ...Option) (T, error) + type ConnectionError struct + Attempts int + Err error + Method string + RequestID string + Timeout time.Duration + URL string + func (e *ConnectionError) Error() string + func (e *ConnectionError) Is(target error) bool + func (e *ConnectionError) Unwrap() error + type Limiter interface + Wait func(ctx context.Context) error + func NewLimiter(limit RateLimit) Limiter + type ModelInfo struct + Description string + Name string + ReleaseDate string + type Noul struct + Criteria *NoulCriteria + Instructions any + type NoulAnswer struct + Noul float64 + func (NoulAnswer) Type() string + type NoulCriteria struct + False any + True any + type Option func(*config) error + func WithAPIKey(key string) Option + func WithBaseURL(baseURL string) Option + func WithHTTPClient(client *http.Client) Option + func WithHeader(key, value string) Option + func WithLogger(logger *slog.Logger) Option + func WithModel(model string) Option + func WithRateLimit(limit RateLimit) Option + func WithRateLimiter(l Limiter) Option + func WithRetry(policy RetryPolicy) Option + func WithTimeout(timeout time.Duration) Option + type Question interface + type Questions map[string]Question + type RateLimit struct + RequestsPerMinute int + TokensPerSecond int + func DefaultRateLimit() RateLimit + func (l RateLimit) IsZero() bool + type Raw map[string]any + type Request struct + Extra map[string]any + Model string + Questions Questions + State any + type Response struct + Answers map[string]Answer + Attempts int + Model string + RequestID string + Usage Usage + func (r *Response) As[T any]() (T, error) + func (r *Response) Choice(name string) (ChoiceAnswer, bool) + func (r *Response) Noul(name string) (NoulAnswer, bool) + func (r *Response) Raw() []byte + func (r *Response) Score(name string) (ScoreAnswer, bool) + type ResponseError struct + Body []byte + Err error + Field string + Method string + RequestID string + URL string + func (e *ResponseError) Error() string + func (e *ResponseError) Is(target error) bool + func (e *ResponseError) Unwrap() error + type RetryPolicy struct + InitialBackoff time.Duration + Jitter float64 + MaxBackoff time.Duration + MaxElapsed time.Duration + MaxRetries int + MaxRetryAfter time.Duration + RespectRetryAfter bool + RetryConnection bool + RetryTimeout bool + Statuses []int + func DefaultRetryPolicy() RetryPolicy + type Score struct + Criteria any + Instructions any + type ScoreAnswer struct + Confidence float64 + Legend map[string]any + Probabilities map[string]float64 + Score float64 + func (ScoreAnswer) Type() string + type UnknownAnswer struct + Kind string + Raw []byte + func (a UnknownAnswer) Type() string + type Usage struct + InputTokens int + OutputTokens int