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

GNU Affero General Public License v3.0 or later (AGPL-3.0-or-later). See LICENSE.

Note for integrators: AGPL-3.0 is a strong copyleft license. If you distribute or run a modified version of this SDK as part of a network service, the AGPL's network-use clause requires you to make the corresponding source available to users of that service. If you only use the SDK as a library to upload results to TestRelic, you are not distributing or modifying it and the AGPL terms do not encumber your application code.

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.1.tar.gz (39.2 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.1-py3-none-any.whl (38.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: testrelic_deepeval-0.1.1.tar.gz
  • Upload date:
  • Size: 39.2 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.1.tar.gz
Algorithm Hash digest
SHA256 06fae428d7da400d98112e15f839af5d5c9220dfb0a5553f4685ecdc7035d7d4
MD5 ae5ce7cde98e560dda21a5c25005a838
BLAKE2b-256 a9fd3a123533bf9c716cca698933a01b5e4fa5a2b640bd5f37c8e58abddc4e4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for testrelic_deepeval-0.1.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for testrelic_deepeval-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ca911d428c4d161fc1bec19cc092429c24716784d823fae7022598a07a547d13
MD5 99cc2dbba2cc2cbbd91d0b9e0996dc05
BLAKE2b-256 1c5c299b4c355c1a2c5615b49d823a3ac617febdd0aa596713a821185c00084b

See more details on using hashes here.

Provenance

The following attestation bundles were made for testrelic_deepeval-0.1.1-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