Documentation
¶
Overview ¶
Package anthropic is the provider-native Anthropic model adapter: the anti-corruption layer that is the ONLY package allowed to import github.com/anthropics/anthropic-sdk-go. It translates that SDK to and from agentcore types, so consumers (gyr, johnny, ...) never see a vendor type.
The adapter satisfies the llm.LLM port, so it plugs straight into jess.WithModel. It uses adaptive thinking + effort, and never sends temperature / top_p / top_k.
Index ¶
- type Adapter
- func (a *Adapter) Generate(ctx context.Context, messages []agentcore.Message, tools []agentcore.ToolSpec, ...) (*agentcore.LLMResponse, error)
- func (a *Adapter) GenerateStream(ctx context.Context, messages []agentcore.Message, tools []agentcore.ToolSpec, ...) (<-chan agentcore.StreamEvent, error)
- func (a *Adapter) ProviderName() string
- func (a *Adapter) SupportsTools() bool
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter wraps the Anthropic SDK client as an agentcore.ChatModel.
func New ¶
New builds an Adapter from config. It returns an error when the model id is empty (Anthropic requires it on every request).
func (*Adapter) Generate ¶
func (a *Adapter) Generate(ctx context.Context, messages []agentcore.Message, tools []agentcore.ToolSpec, opts ...agentcore.CallOption) (*agentcore.LLMResponse, error)
Generate produces a synchronous response.
func (*Adapter) GenerateStream ¶
func (a *Adapter) GenerateStream(ctx context.Context, messages []agentcore.Message, tools []agentcore.ToolSpec, opts ...agentcore.CallOption) (<-chan agentcore.StreamEvent, error)
GenerateStream produces a streaming response, emitting the agentcore StreamEvent sequence the agent loop expects: text/thinking start-delta-end, tool-call start/delta/end with the completed call, a terminal done event carrying the fully assembled message + stop reason, and an error event on provider failure.
The Anthropic Go stream has no GetFinalMessage; the message is reconstructed with Message.Accumulate. The fully assembled message is converted once at the end (via convertResponse), guaranteeing every tool_use block becomes an agentcore tool call in the done event — the load-bearing invariant.
func (*Adapter) ProviderName ¶
ProviderName implements agentcore.ProviderNamer.
func (*Adapter) SupportsTools ¶
SupportsTools reports that this provider supports tool calling.