Skip to main content

TestRelic SDK for DeepEval - LLM evaluation results land in TestRelic instead of Confident AI.

Project description

testrelic-deepeval

The TestRelic Python SDK for DeepEval. Capture LLM evaluation results from your existing DeepEval test suite and ship them to your TestRelic workspace in one line of install.

pip install testrelic-deepeval
testrelic login
deepeval test run tests/

That's it. The pytest plugin captures DeepEval's in-memory TestRun at session finish and uploads cases + metrics to TestRelic's /api/v1/evals/* endpoints.

What this is (and isn't)

  • Is: a pytest plugin + Python client for sending DeepEval results to TestRelic
  • Is: a drop-in testrelic.evaluate() wrapper for programmatic eval runs
  • Is: a CLI (testrelic login, testrelic test, testrelic view)
  • Is not: a replacement for DeepEval (use DeepEval to author tests; we just receive the results)
  • Is not: a Confident AI proxy — we use TestRelic's own API, not Confident's

Install

pip install testrelic-deepeval                  # core
pip install "testrelic-deepeval[deepeval]"      # also pull deepeval if not already installed
pip install "testrelic-deepeval[otel]"          # OTel tracing (Phase 4, preview)

Supported Python versions: 3.9, 3.10, 3.11, 3.12.

Authenticate

testrelic login --api-key tr_yourkey_here

Credentials are stored at ~/.testrelic/credentials.toml with 0600 permissions on POSIX. Or pass credentials via environment:

export TESTRELIC_API_KEY=tr_yourkey
export TESTRELIC_BASE_URL=https://platform.testrelic.ai/api/v1/evals  # only override if self-hosted

Precedence (highest to lowest): explicit configure() args → env vars → credentials file → built-in defaults.

Use with pytest

No code changes needed. After install + login:

deepeval test run tests/
# or, if you want the wrapper that double-checks credentials:
testrelic test tests/

Every test run uploads as a new eval run in TestRelic, annotated with the current branch, commit, and CI run URL (auto-detected for GitHub Actions, GitLab, Jenkins, CircleCI, and Buildkite).

Use programmatically

from deepeval.test_case import LLMTestCase
from deepeval.metrics import AnswerRelevancyMetric
from testrelic import evaluate

results = evaluate(
    test_cases=[LLMTestCase(input="Hi", actual_output="Hello")],
    metrics=[AnswerRelevancyMetric(threshold=0.7)],
)
# results is whatever deepeval.evaluate() returns; upload is automatic

Datasets

from testrelic import datasets

# Pull a dataset version into a deepeval EvaluationDataset
ds = datasets.pull("customer-support-qa", label="latest")

# Push goldens up to a new version
datasets.push(
    alias="customer-support-qa",
    goldens=[{"input": "...", "expected_output": "..."}],
    label="v2",
    description="Refreshed Q1 2026 examples",
)

Migrating from Confident AI

See docs/migration-from-confident-ai.md. The TL;DR is:

  1. pip install testrelic-deepeval
  2. testrelic login
  3. Remove CONFIDENT_API_KEY from CI
  4. Run your existing tests unchanged

Or, in one shot: testrelic migrate-from-confident.

Offline / flaky networks

Failed uploads land in ~/.testrelic/queue/. Replay them with:

testrelic drain

The plugin never fails your test run because of an upload error — uploads run at pytest_sessionfinish(trylast=True) and swallow exceptions with a warning log.

CLI

Command Purpose
testrelic login Save credentials
testrelic logout Remove credentials
testrelic test <path> Wrap deepeval test run with credential check
testrelic view [run_id] Open latest (or specific) eval run in browser
testrelic drain Replay queued offline uploads
testrelic version Print SDK version
testrelic migrate-from-confident Print migration steps

Development

git clone https://github.com/testrelic-ai/testrelic-python-sdk
cd testrelic-python-sdk
pip install -e ".[dev]"
ruff check src tests
mypy src/testrelic
pytest

License

MIT. See LICENSE.

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

testrelic_deepeval-0.1.0.tar.gz (27.8 kB view details)

Uploaded Source

Built Distribution

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

testrelic_deepeval-0.1.0-py3-none-any.whl (26.9 kB view details)

Uploaded Python 3

File details

Details for the file testrelic_deepeval-0.1.0.tar.gz.

File metadata

  • Download URL: testrelic_deepeval-0.1.0.tar.gz
  • Upload date:
  • Size: 27.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for testrelic_deepeval-0.1.0.tar.gz
Algorithm Hash digest
SHA256 11003c1baa7c226f61e450a99fb2975707f06400e47fc398ea93fe363ffc4f6a
MD5 f5b9683ccc9221fbfe380230fae051cd
BLAKE2b-256 8947cdcc8fe910729813d4b153b70fc7dc48a7a02fba409322768b45f2b628d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for testrelic_deepeval-0.1.0.tar.gz:

Publisher: publish-prod.yml on testrelic-ai/testrelic-python-sdk

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

File details

Details for the file testrelic_deepeval-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for testrelic_deepeval-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a22b55ad0585e73df7bdce1dfac5bf8155830389003ef5eb4c7e419cad22ae42
MD5 a376182158161e720c53d80d9957f037
BLAKE2b-256 2a854454815b466241e8f493f93e7194efdc02d1b3aa24787daf025c0303e646

See more details on using hashes here.

Provenance

The following attestation bundles were made for testrelic_deepeval-0.1.0-py3-none-any.whl:

Publisher: publish-prod.yml on testrelic-ai/testrelic-python-sdk

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