MixtrainDocs

Access Claude models (Claude 3 Opus, Sonnet, Haiku) through the Anthropic integration.

Setup

Add Provider

mixtrain provider add anthropic

Or via SDK:

from mixtrain import MixClient

client = MixClient()
client.create_model_provider(
    provider_type="anthropic",
    secrets={"api_key": "sk-ant-..."}
)

Once added, Anthropic models are available via mixtrain model catalog.

Usage

from mixtrain import get_model

model = get_model("claude-opus")
result = model.run({
    "prompt": "Explain quantum computing",
    "max_tokens": 1024
})

Available Models

Model IDDescription
claude-3-opus-20240229Most capable, best for complex tasks
claude-3-sonnet-20240229Balanced performance and speed
claude-3-haiku-20240307Fastest, best for simple tasks

Configuration Options

ParameterDescription
max_tokensMaximum tokens to generate
temperatureSampling temperature (0-1)
top_pNucleus sampling parameter
stop_sequencesStop generation at these strings

Getting an API Key

  1. Sign up at console.anthropic.com
  2. Navigate to API Keys
  3. Create a new API key
  4. Add it to Mixtrain using the setup steps above

On this page