Versions in this module Expand all Collapse all v0 v0.2.0 Sep 24, 2026 v0.1.0 Sep 23, 2026 Changes in this version + const APIKeyEnv + const BaseURLEnv + const DefaultBaseURL + const DefaultModel + const DefaultModelEnv + const DefaultTimeout + const LevelOff + const LogLevelEnv + const MaxChoiceOptions + const MaxScoreLevels + const MinScoreLevels + const NoTimeout + var ErrAnswerType = errors.New("answer is of a different question type") + var ErrAuthentication = errors.New("systemone: authentication failed") + var ErrIncompleteAnswer = errors.New("answer is missing a required field") + var ErrInvalidRequest = errors.New("systemone: invalid request") + var ErrNoAPIKey = errors.New("systemone: no API key") + var ErrNoAnswer = errors.New("no answer for question") + var ErrNotFound = errors.New("systemone: not found") + var ErrOverloaded = errors.New("systemone: service overloaded") + var ErrPermissionDenied = errors.New("systemone: permission denied") + var ErrRateLimit = errors.New("systemone: rate limit exceeded") + var ErrServer = errors.New("systemone: server error") + var ErrUnprocessable = errors.New("systemone: request failed validation") + type Choice struct + func NewChoice[T ~string](id string, instructions Content, opts ...ChoiceOption[T]) *Choice[T] + func (q *Choice) ID() string + func (q *Choice[T]) From(r *Response) (ChoiceAnswer[T], error) + func (q *Choice[T]) Options() []T + type ChoiceAnswer struct + Confidence float64 + Probabilities map[T]float64 + Value T + func (a ChoiceAnswer[T]) Probability(option T) float64 + func (a ChoiceAnswer[T]) Ranked() []T + type ChoiceOption interface + func Option[T ~string](value T, description Content) ChoiceOption[T] + func Options[T ~string](values ...T) ChoiceOption[T] + type Client struct + func New(opts ...ClientOption) (*Client, error) + func (c *Client) Ask(ctx context.Context, state any, questions ...Question) (*Response, error) + func (c *Client) Do(ctx context.Context, req Request) (*Response, error) + func (c *Client) Model() string + func (c *Client) Models(ctx context.Context) ([]Model, error) + type ClientOption interface + func WithAPIKey(key string) ClientOption + func WithBaseURL(rawURL string) ClientOption + func WithHTTPClient(hc *http.Client) ClientOption + func WithHeader(key, value string) ClientOption + func WithLogLevel(level slog.Level) ClientOption + func WithLogger(log *slog.Logger) ClientOption + func WithModel(model string) ClientOption + func WithRetry(p RetryPolicy) ClientOption + func WithTimeout(d time.Duration) ClientOption + func WithUserAgent(ua string) ClientOption + type Content = any + type Error struct + Body []byte + Header http.Header + RequestID string + RetryAfter time.Duration + StatusCode int + func (e *Error) Error() string + func (e *Error) Is(target error) bool + type Model struct + Description string + Name string + ReleaseDate time.Time + func (m *Model) UnmarshalJSON(data []byte) error + type Noul struct + func NewNoul(id string, instructions Content, opts ...NoulOption) *Noul + func (q *Noul) From(r *Response) (NoulAnswer, error) + func (q *Noul) ID() string + type NoulAnswer struct + Value float64 + func (a NoulAnswer) Yes(threshold float64) bool + type NoulOption interface + func No(description Content) NoulOption + func Yes(description Content) NoulOption + type Question interface + ID func() string + type QuestionError struct + Err error + QuestionID string + func (e *QuestionError) Error() string + func (e *QuestionError) Unwrap() error + type RawQuestion struct + Body Content + QuestionID string + func (q RawQuestion) From(r *Response) (json.RawMessage, error) + func (q RawQuestion) ID() string + type Request struct + Extra map[string]any + Header http.Header + Model string + Questions []Question + Retry *RetryPolicy + State any + Timeout time.Duration + type Response struct + Model string + RequestID string + Usage Usage + func (r *Response) IDs() []string + func (r *Response) Raw() []byte + type RetryPolicy struct + InitialBackoff time.Duration + Jitter float64 + MaxBackoff time.Duration + MaxRetries int + RespectRetryAfter bool + Retry func(status int) bool + RetryTransportError bool + func DefaultRetry() RetryPolicy + type Score struct + func NewScore[T ~int](id string, instructions Content, opts ...ScoreOption[T]) *Score[T] + func (q *Score) ID() string + func (q *Score[T]) From(r *Response) (ScoreAnswer[T], error) + func (q *Score[T]) Levels() int + type ScoreAnswer struct + Confidence float64 + Legend map[T]Content + Level T + LevelCount int + Probabilities map[T]float64 + Value float64 + func (a ScoreAnswer[T]) Describe() string + func (a ScoreAnswer[T]) Normalized() float64 + func (a ScoreAnswer[T]) Probability(level T) float64 + type ScoreOption interface + func Level[T ~int](level T, description Content) ScoreOption[T] + func Levels[T ~int](descriptions ...Content) ScoreOption[T] + type Usage struct + InputTokens int + OutputTokens int