Versions in this module Expand all Collapse all v0 v0.1.0 Sep 22, 2026 Changes in this version + const DefaultBaseURL + const DefaultModel + const Version + var ErrMissingAPIKey = errors.New("typesafe: no API key provided (use WithAPIKey or set TYPESAFE_API_KEY)") + type APIConnectionError struct + Err error + func (e *APIConnectionError) Error() string + func (e *APIConnectionError) Unwrap() error + type APIError struct + Body []byte + Code string + Header http.Header + Message string + StatusCode int + func (e *APIError) Error() string + type APITimeoutError struct + Err error + func (e *APITimeoutError) Error() string + func (e *APITimeoutError) Unwrap() error + type Answer interface + AnswerType func() string + type AuthenticationError struct + func (e *AuthenticationError) Unwrap() error + type BadRequestError struct + func (e *BadRequestError) Unwrap() error + type Choice struct + Criteria map[string]any + Instructions any + func (c Choice) MarshalJSON() ([]byte, error) + type ChoiceAnswer struct + Choice string + Confidence float64 + Probabilities map[string]float64 + func (ChoiceAnswer) AnswerType() string + type Client struct + func NewClient(opts ...Option) (*Client, error) + func (c *Client) SystemOne(ctx context.Context, req *Request) (*Response, error) + type InternalServerError struct + func (e *InternalServerError) Unwrap() error + type NotFoundError struct + func (e *NotFoundError) Unwrap() error + type Noul struct + Criteria *NoulCriteria + Instructions any + func (n Noul) MarshalJSON() ([]byte, error) + type NoulAnswer struct + Noul float64 + func (NoulAnswer) AnswerType() string + type NoulCriteria struct + False any + True any + type Option func(*Client) + func WithAPIKey(apiKey string) Option + func WithBaseURL(baseURL string) Option + func WithDefaultModel(model string) Option + func WithHTTPClient(httpClient *http.Client) Option + func WithMaxRequestBodySize(maxBytes int) Option + func WithMaxResponseBodySize(maxBytes int) Option + func WithRetryPolicy(policy RetryPolicy) Option + func WithTimeout(timeout time.Duration) Option + func WithUserAgent(userAgent string) Option + type PermissionDeniedError struct + func (e *PermissionDeniedError) Unwrap() error + type Question interface + type RateLimitError struct + RetryAfter time.Duration + func (e *RateLimitError) Unwrap() error + type RawAnswer struct + Raw json.RawMessage + Type string + func (a RawAnswer) AnswerType() string + type Request struct + Model string + Questions map[string]Question + State any + func (r Request) MarshalJSON() ([]byte, error) + type Response struct + Answers map[string]Answer + Model string + Usage Usage + func (r *Response) UnmarshalJSON(data []byte) error + type RetryPolicy struct + BaseDelay time.Duration + MaxDelay time.Duration + MaxRetries int + RetryableStatusCodes []int + func DefaultRetryPolicy() RetryPolicy + func NoRetry() RetryPolicy + type Score struct + Criteria []any + Instructions any + func (s Score) MarshalJSON() ([]byte, error) + type ScoreAnswer struct + Confidence float64 + Legend map[string]string + Probabilities map[string]float64 + Score float64 + func (ScoreAnswer) AnswerType() string + type UnprocessableEntityError struct + func (e *UnprocessableEntityError) Unwrap() error + type Usage struct + InputTokens int + OutputTokens int