Versions in this module Expand all Collapse all v1 v1.0.0 Sep 18, 2026 Changes in this version + const APIKeyEnvVar + const BaseURLEnvVar + const DefaultBaseURL + const DefaultModel + const DefaultModelEnvVar + const LogLevelEnvVar + const Version + type APIError struct + Body []byte + Headers http.Header + Method string + Status string + StatusCode int + URL string + func (e *APIError) Error() string + func (e *APIError) RequestID() string + type AbortError struct + Err error + Method string + URL string + func (e *AbortError) Error() string + func (e *AbortError) Unwrap() error + type Answer interface + Type func() string + type AuthenticationError struct + func (e *AuthenticationError) Unwrap() error + type BadRequestError struct + func (e *BadRequestError) Unwrap() error + type ChoiceAnswer struct + Choice string + Confidence float64 + Probabilities map[string]float64 + func (ChoiceAnswer) Type() string + type ChoiceQuestion struct + Criteria map[string]any + Instructions any + func Choice(instructions string, criteria map[string]any) ChoiceQuestion + func ChoiceStrings(instructions string, criteria map[string]string) ChoiceQuestion + func (q ChoiceQuestion) MarshalJSON() ([]byte, error) + type Client struct + func NewClient(opts ...Option) (*Client, error) + func (c *Client) BaseURL() string + func (c *Client) DefaultModel() string + func (c *Client) ListModels(ctx context.Context, opts ...RequestOption) (*ListModelsResponse, error) + func (c *Client) RetryPolicy() RetryPolicy + func (c *Client) SystemOne(ctx context.Context, req SystemOneRequest, opts ...RequestOption) (*Response, error) + func (c *Client) Timeout() time.Duration + type ConnectionError struct + Err error + Method string + URL string + func (e *ConnectionError) Error() string + func (e *ConnectionError) Unwrap() error + type InternalServerError struct + func (e *InternalServerError) Unwrap() error + type ListModelsResponse struct + Models []ModelMetadata + RequestID string + type LogLevel int + const LogLevelDebug + const LogLevelError + const LogLevelInfo + const LogLevelOff + const LogLevelWarn + type Logger interface + Debugf func(format string, args ...any) + Errorf func(format string, args ...any) + Infof func(format string, args ...any) + Warnf func(format string, args ...any) + type ModelMetadata struct + Description string + Name string + ReleaseDate string + type NotFoundError struct + func (e *NotFoundError) Unwrap() error + type NoulAnswer struct + Noul float64 + func (NoulAnswer) Type() string + type NoulCriteria struct + False any + True any + type NoulQuestion struct + Criteria *NoulCriteria + Instructions any + func Noul(instructions string) NoulQuestion + func (q NoulQuestion) MarshalJSON() ([]byte, error) + func (q NoulQuestion) WithCriteria(trueDesc, falseDesc any) NoulQuestion + type Option func(*clientConfig) + func WithAPIKey(key string) Option + func WithBaseURL(baseURL string) Option + func WithDefaultModel(model string) Option + func WithHTTPClient(hc *http.Client) Option + func WithHeader(key, value string) Option + func WithLogLevel(level LogLevel) Option + func WithLogger(l Logger) Option + func WithRetryPolicy(policy RetryPolicy) Option + func WithTimeout(d time.Duration) Option + type PermissionDeniedError struct + func (e *PermissionDeniedError) Unwrap() error + type Question interface + type Questions map[string]Question + type RateLimitError struct + RetryAfter time.Duration + func (e *RateLimitError) Unwrap() error + type RequestOption func(*requestConfig) + func WithRequestHeader(key, value string) RequestOption + func WithRequestRetryPolicy(policy RetryPolicy) RequestOption + func WithRequestTimeout(d time.Duration) RequestOption + type Response struct + Answers map[string]Answer + Header http.Header + Model string + RequestID string + Usage Usage + func (r *Response) Choice(name string) (ChoiceAnswer, error) + func (r *Response) Noul(name string) (NoulAnswer, error) + func (r *Response) Score(name string) (ScoreAnswer, error) + func (r *Response) UnmarshalJSON(data []byte) error + type ResponseValidationError struct + Body []byte + Err error + FieldPath string + func (e *ResponseValidationError) Error() string + func (e *ResponseValidationError) Unwrap() error + type RetryPolicy struct + BackoffInitial time.Duration + BackoffJitter float64 + BackoffMax time.Duration + HTTPStatuses map[int]bool + MaxRetries int + MaxRetryAfter time.Duration + RespectRetryAfter bool + RetryConnectionErrors bool + RetryTimeoutErrors bool + Timeout time.Duration + func DefaultRetryPolicy() RetryPolicy + type ScoreAnswer struct + Confidence float64 + Legend map[string]any + Probabilities map[string]float64 + Score float64 + func (ScoreAnswer) Type() string + type ScoreQuestion struct + Criteria []any + Instructions any + func Score(instructions string, levels ...any) ScoreQuestion + func (q ScoreQuestion) MarshalJSON() ([]byte, error) + type StdLogger struct + func NewStdLogger(l *log.Logger) *StdLogger + func (s *StdLogger) Debugf(format string, args ...any) + func (s *StdLogger) Errorf(format string, args ...any) + func (s *StdLogger) Infof(format string, args ...any) + func (s *StdLogger) Warnf(format string, args ...any) + type SystemOneRequest struct + Model string + Questions Questions + State any + type TimeoutError struct + Timeout time.Duration + func (e *TimeoutError) Error() string + type UnprocessableEntityError struct + func (e *UnprocessableEntityError) Unwrap() error + type Usage struct + InputTokens *int64 + OutputTokens *int64