Versions in this module Expand all Collapse all v1 v1.0.0 Feb 23, 2026 Changes in this version + const MiddlewareStateKey + type AnthropicConfig struct + APIKey string + BaseURL string + HTTPClient *http.Client + MaxRetries int + MaxTokens int + Model string + System string + Temperature *float64 + type AnthropicProvider struct + APIKey string + BaseURL string + CacheTTL time.Duration + MaxRetries int + MaxTokens int + ModelName string + System string + Temperature *float64 + func (p *AnthropicProvider) Model(ctx context.Context) (Model, error) + type ContentBlock struct + Data string + MediaType string + Text string + Type ContentBlockType + URL string + type ContentBlockType string + const ContentBlockDocument + const ContentBlockImage + const ContentBlockText + type Message struct + Content string + ContentBlocks []ContentBlock + ReasoningContent string + Role string + ToolCalls []ToolCall + func (m Message) TextContent() string + type MiddlewareState interface + SetModelInput func(any) + SetModelOutput func(any) + SetValue func(string, any) + type Model interface + Complete func(ctx context.Context, req Request) (*Response, error) + CompleteStream func(ctx context.Context, req Request, cb StreamHandler) error + func MustProvider(p Provider) Model + func NewAnthropic(cfg AnthropicConfig) (Model, error) + func NewOpenAI(cfg OpenAIConfig) (Model, error) + func NewOpenAIResponses(cfg OpenAIConfig) (Model, error) + type OpenAIConfig struct + APIKey string + BaseURL string + HTTPClient *http.Client + MaxRetries int + MaxTokens int + Model string + System string + Temperature *float64 + UseResponses bool + type OpenAIProvider struct + APIKey string + BaseURL string + CacheTTL time.Duration + MaxRetries int + MaxTokens int + ModelName string + System string + Temperature *float64 + func (p *OpenAIProvider) Model(ctx context.Context) (Model, error) + type Provider interface + Model func(ctx context.Context) (Model, error) + type ProviderFunc func(context.Context) (Model, error) + func (fn ProviderFunc) Model(ctx context.Context) (Model, error) + type Request struct + EnablePromptCache bool + MaxTokens int + Messages []Message + Model string + SessionID string + System string + Temperature *float64 + Tools []ToolDefinition + type Response struct + Message Message + StopReason string + Usage Usage + type StreamHandler func(StreamResult) error + type StreamOnlyModel struct + Inner Model + func NewStreamOnlyModel(inner Model) *StreamOnlyModel + func (s *StreamOnlyModel) Complete(ctx context.Context, req Request) (*Response, error) + func (s *StreamOnlyModel) CompleteStream(ctx context.Context, req Request, cb StreamHandler) error + type StreamOnlyProvider struct + Inner Provider + func (p *StreamOnlyProvider) Model(ctx context.Context) (Model, error) + type StreamResult struct + Delta string + Final bool + Response *Response + ToolCall *ToolCall + type ToolCall struct + Arguments map[string]any + ID string + Name string + Result string + type ToolDefinition struct + Description string + Name string + Parameters map[string]any + type Usage struct + CacheCreationTokens int + CacheReadTokens int + InputTokens int + OutputTokens int + TotalTokens int