Versions in this module Expand all Collapse all v0 v0.0.2 Sep 12, 2026 v0.0.1 Sep 11, 2026 Changes in this version + const DefaultMaxRetries + const DefaultRetryBaseDelay + const DefaultRetryMaxDelay + const DefaultStepLimit + func RetryAfterFromHeader(h http.Header) time.Duration + type ContentPart struct + Kind ContentPartKind + Text string + ToolCall *ToolCall + ToolResult *ToolResult + func TextPart(text string) ContentPart + type ContentPartKind string + const ContentText + const ContentToolCall + const ContentToolResult + type ErrorClass int + const ErrClassAuth + const ErrClassContextLength + const ErrClassInvalidRequest + const ErrClassOverloaded + const ErrClassRateLimited + const ErrClassTransient + const ErrClassUpstream + func ClassifyStatus(status int, contextLengthHint bool) ErrorClass + func (c ErrorClass) Retryable() bool + type FinishReason string + const FinishCanceled + const FinishError + const FinishLength + const FinishStepLimit + const FinishStop + const FinishToolCalls + type LoopOptions struct + Headers map[string]string + MaxOutputTokens int + MaxRetries int + Messages []Message + Model Model + OnStep func(Usage) + RetryBaseDelay time.Duration + RetryMaxDelay time.Duration + StepLimit int + System string + Tools ToolSet + type Message struct + Content []ContentPart + Role Role + func UserMessage(text string) Message + type Model interface + ModelID func() string + Stream func(ctx context.Context, req Request) (StreamReader, error) + type ModelError struct + Class ErrorClass + Err error + RetryAfter time.Duration + func NewModelError(class ErrorClass, retryAfter time.Duration, err error) *ModelError + func (e *ModelError) Error() string + func (e *ModelError) Unwrap() error + type Request struct + Headers map[string]string + MaxOutputTokens int + Messages []Message + System string + Tools []ToolDefinition + type Role string + const RoleAssistant + const RoleTool + const RoleUser + type SendFunc func(StreamPart) bool + type StreamPart struct + Err error + FinishReason FinishReason + Kind StreamPartKind + Text string + ToolCall *ToolCall + ToolResult *ToolResult + TotalUsage Usage + Usage Usage + type StreamPartKind string + const StreamPartError + const StreamPartFinish + const StreamPartStepFinish + const StreamPartTextDelta + const StreamPartToolCall + const StreamPartToolResult + type StreamReader interface + Close func() error + Recv func() (StreamPart, error) + func Run(ctx context.Context, opts LoopOptions) StreamReader + func StreamFunc(produce func(send SendFunc), onClose func()) StreamReader + type Tool interface + Definition func() ToolDefinition + Execute func(ctx context.Context, input json.RawMessage) (string, error) + type ToolCall struct + ID string + Input json.RawMessage + Name string + type ToolDefinition struct + Description string + InputSchema json.RawMessage + Name string + type ToolResult struct + Content string + IsError bool + Name string + ToolCallID string + type ToolSet map[string]Tool + func (ts ToolSet) Definitions() []ToolDefinition + type Usage struct + CacheRead int64 + CacheWrite int64 + Input int64 + Output int64 + func (u Usage) Add(other Usage) Usage