Skip to main content

MCE DeepEval Adapter

A Python adapter library that integrates DeepEval metrics as third-party plugins for the Metric Computation Engine (MCE). This adapter enables seamless use of DeepEval's LLM evaluation metrics within the MCE framework for evaluating agentic applications.

Installation

Install via MCE extras:

pip install "metrics-computation-engine[deepeval]"

Prerequisites

Supported DeepEval Metrics

The following DeepEval metrics are supported by this adapter (use with the deepeval. prefix in service payloads):

Metric Name Description
AnswerRelevancyMetric Measures how relevant the model answer is to the user query
RoleAdherenceMetric Evaluates adherence to specified roles across a conversation
TaskCompletionMetric Assesses whether the task was completed given tool calls and responses
ConversationCompletenessMetric Evaluates whether the conversation covered necessary elements
BiasMetric Detects various forms of bias in responses
CoherenceMetric Scores coherence and logical flow of the output
GroundednessMetric Evaluates how well outputs are grounded in the provided input/context
TonalityMetric Evaluates tone and stylistic appropriateness of the output
ToxicityMetric Identifies toxic or unsafe content in outputs
AnswerCorrectnessMetric Measures correctness of the answer versus expected output
GeneralStructureAndStyleMetric Evaluates structure and style quality of the output

For requests to support additional DeepEval metrics, please file an issue in our repo: agntcy/telemetry-hub.

Usage

Basic Usage

import asyncio
from mce_deepeval_adapter.adapter import DeepEvalMetricAdapter
from metrics_computation_engine.models.requests import LLMJudgeConfig
from metrics_computation_engine.registry import MetricRegistry

# Initialize LLM configuration
llm_config = LLMJudgeConfig(
    LLM_BASE_MODEL_URL="https://api.openai.com/v1",
    LLM_MODEL_NAME="gpt-4o",
    LLM_API_KEY="your-api-key-here"
)

# Create registry and register DeepEval metrics
registry = MetricRegistry()

# Method 1: Direct registration with metric name
registry.register_metric(DeepEvalMetricAdapter, "AnswerRelevancyMetric")

# Method 2: Using get_metric_class helper with prefix
from metrics_computation_engine.util import get_metric_class
metric, metric_name = get_metric_class("deepeval.RoleAdherenceMetric")
registry.register_metric(metric, metric_name)

Using with MCE REST API

When using the MCE as a service, include DeepEval metrics in your API request:

{
  "metrics": [
    "deepeval.AnswerRelevancyMetric",
    "deepeval.RoleAdherenceMetric",
  ],
  "llm_judge_config": {
    "LLM_API_KEY": "your-api-key",
    "LLM_MODEL_NAME": "gpt-4o",
    "LLM_BASE_MODEL_URL": "https://api.openai.com/v1"
  },
  "data_fetching_infos": {
    "batch_config": {
      "time_range": { "start": "2024-01-01T00:00:00Z", "end": "2024-12-31T23:59:59Z" }
    },
    "session_ids": []
  }
}

Contributing

Contributions are welcome! Please follow these steps to contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Commit your changes (git commit -am 'Add new feature').
  4. Push to the branch (git push origin feature-branch).
  5. Create a new Pull Request.

Metadata

Release files for mce-deepeval-adapter 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mce-deepeval-adapter 0.1.6
File Size Uploaded
mce_deepeval_adapter-0.1.6.tar.gz 216.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mce-deepeval-adapter 0.1.6
File Interpreter ABI Platform
mce_deepeval_adapter-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 232.0 kB

Release files / mce_deepeval_adapter-0.1.6.tar.gz

Download URL mce_deepeval_adapter-0.1.6.tar.gz
Size 216.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6167db654d5421085af230c2a9afc4c26c3d356a56c69bfb89211c8a3b35be98
BLAKE2b-256 checksum
How to use checksums
a13b12986ad0cd570f1264c9ad64bd656a04be817e16bc8a574fbc86d25d2717
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / mce_deepeval_adapter-0.1.6-py3-none-any.whl

Download URL mce_deepeval_adapter-0.1.6-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1da2af71afc7ed59c0f97483dd4e0eb8fe7e02fe48c729e284357a3222de61c
BLAKE2b-256 checksum
How to use checksums
d59075492befcbcaa40b6f6d2278a5e75a2915bdb18e8b9a10269b4582973695
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page