Access Claude models (Claude 3 Opus, Sonnet, Haiku) through the Anthropic integration.
Setup
Add Provider
mixtrain provider add anthropicOr 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 ID | Description |
|---|---|
claude-3-opus-20240229 | Most capable, best for complex tasks |
claude-3-sonnet-20240229 | Balanced performance and speed |
claude-3-haiku-20240307 | Fastest, best for simple tasks |
Configuration Options
| Parameter | Description |
|---|---|
max_tokens | Maximum tokens to generate |
temperature | Sampling temperature (0-1) |
top_p | Nucleus sampling parameter |
stop_sequences | Stop generation at these strings |
Getting an API Key
- Sign up at console.anthropic.com
- Navigate to API Keys
- Create a new API key
- Add it to Mixtrain using the setup steps above