Skip to main content

Anthropic client plugin for space-evals

Project description

space-evals-client-anthropic

Anthropic client plugin for space-evals. Lets you use Anthropic models (Claude Sonnet, Claude Opus, Claude Haiku, etc.) as the target, customer, or judge in your space-evals test suite.

Installation

pip install space-evals-client-anthropic

This installs the core space-evals package and the anthropic SDK as dependencies.

Setup

Set your API key:

export ANTHROPIC_API_KEY=sk-ant-...

Or use a custom env var name in your config (see below).

Usage

Via config file

Add provider: anthropic to any client role in your space-evals.yaml:

clients:
  target:
    provider: anthropic
    model: claude-sonnet-4-20250514

  customer:
    provider: anthropic
    model: claude-haiku-4-5-20251001

  judge:
    provider: anthropic
    model: claude-sonnet-4-20250514

Then run your tests:

space-evals run ./tests/

Via programmatic API

import asyncio
from space_evals.engine import run_tests
from space_evals.clients.base import get_client

target = get_client("anthropic", model="claude-sonnet-4-20250514")

result = asyncio.run(run_tests(
    path="./tests/",
    target_client=target,
))

Configuration

Field Type Default Description
provider string -- Must be "anthropic"
model string -- Model ID (e.g. claude-sonnet-4-20250514, claude-opus-4-20250514, claude-haiku-4-5-20251001)
api_key_env string ANTHROPIC_API_KEY Env var containing your API key
params object {} Extra parameters passed to the Anthropic API (e.g. temperature, max_tokens)

Example with extra params

clients:
  target:
    provider: anthropic
    model: claude-sonnet-4-20250514
    api_key_env: MY_ANTHROPIC_KEY
    params:
      temperature: 0
      max_tokens: 4096

What this plugin does

  • Translates space-evals's Message format to Anthropic's messages API
  • Extracts tool use blocks from responses into space-evals's ToolCall format
  • Handles system prompts via Anthropic's system parameter (used by the customer and judge roles)
  • Lazy-loads the Anthropic SDK on first use
  • Defaults max_tokens to 1024 if not specified

Requirements

  • Python >= 3.11
  • space-evals >= 0.1.0
  • anthropic >= 0.30
  • ANTHROPIC_API_KEY environment variable (or custom via api_key_env)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

space_evals_client_anthropic-0.2.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

space_evals_client_anthropic-0.2.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file space_evals_client_anthropic-0.2.0.tar.gz.

File metadata

File hashes

Hashes for space_evals_client_anthropic-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b5a4b81ba91a102a5a927ff46d1c2672597cc75b0b78743dc665274bfcb7ce5c
MD5 dfc0b27ceecbb5b92099ae4b7d42dbfb
BLAKE2b-256 a2bba925716778734d835082ba442ba102283015e4fe2ad54ae2e07df493d980

See more details on using hashes here.

Provenance

The following attestation bundles were made for space_evals_client_anthropic-0.2.0.tar.gz:

Publisher: publish.yaml on Raghav-Sahai/Evals

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file space_evals_client_anthropic-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for space_evals_client_anthropic-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 519e8b916021d2f80a924a8964b4ff04302cee2d8075f58aecac6fa2860a5720
MD5 da964982c592ec20ef733c13f92b7d16
BLAKE2b-256 9d306e55418b8b9bb20f7d188dda0be60b01b9d0a7ef44e9d0013300dbb9b5b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for space_evals_client_anthropic-0.2.0-py3-none-any.whl:

Publisher: publish.yaml on Raghav-Sahai/Evals

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page