anthropic

package
v0.8.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package anthropic implements the llm.Provider contract against the Anthropic Messages API. Stdlib-only: net/http for transport, bufio for SSE, encoding/json for payloads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Provider)

Option configures a Provider.

func WithAPIKey

func WithAPIKey(k string) Option

WithAPIKey overrides the key picked up from ANTHROPIC_API_KEY.

func WithBaseURL

func WithBaseURL(u string) Option

WithBaseURL points the client at a custom origin (used by tests).

func WithHTTPClient

func WithHTTPClient(c *http.Client) Option

WithHTTPClient swaps the underlying http.Client (used by tests).

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider is an Anthropic Messages API client.

func New

func New(opts ...Option) (*Provider, error)

New constructs a Provider. ANTHROPIC_API_KEY is required unless WithAPIKey is supplied.

func (*Provider) Stream

func (p *Provider) Stream(ctx context.Context, req llm.Request) (<-chan llm.Event, error)

Stream sends req to /v1/messages with stream=true and forwards SSE events onto the returned channel.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL