anthropic

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Overview

Package anthropic implements LLMProvider for the Anthropic Claude API. Importing this package (even with a blank import) registers the "anthropic" provider in the global registry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct{}

Provider implements providers.LLMProvider using the Anthropic Claude API.

func (*Provider) Complete

func (p *Provider) Complete(ctx context.Context, model, systemPrompt, userMsg string, maxTokens int) (string, error)

Complete implements providers.Completer for single-turn non-streaming calls. It is used by callers that need a simple system-prompt + user-message → text response without the full agentic tool-use loop (e.g. the optimizer meta-agent).

func (*Provider) RunTask

func (p *Provider) RunTask(
	ctx context.Context,
	cfg *config.Config,
	task queue.Task,
	tools []mcp.Tool,
	callTool func(context.Context, string, json.RawMessage) (string, error),
	chunkFn func(string),
) (string, queue.TokenUsage, error)

RunTask executes a task through the Anthropic agentic tool-use loop. It keeps calling the API until the model stops requesting tool use. Token usage is accumulated across all API calls and returned with the result. If chunkFn is non-nil, every turn is streamed and text tokens are forwarded to chunkFn as they arrive.

Jump to

Keyboard shortcuts

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