Skip to main content

RAGAS integration adapter for Metrics Computation Engine

Project description

RAGAS Adapter for Metrics Computation Engine

This plugin provides integration between the Metrics Computation Engine and RAGAS (Retrieval Augmented Generation Assessment) metrics.

Overview

The RAGAS adapter enables the use of RAGAS metrics within the MCE framework, specifically designed for evaluating RAG applications and conversational AI systems.

Supported Metrics

  • TopicAdherenceScore: Measures how well a conversation stays on topic

Installation

Development Setup

# From the plugin directory
./dev-setup.sh

Manual Installation

# Install in development mode
uv pip install -e .

# Or install specific dependencies
uv pip install ragas>=0.2.0 langchain-openai langchain-core

Usage

Basic Usage

from metrics_computation_engine.registry import MetricRegistry

# Register the RAGAS adapter
registry = MetricRegistry()
registry.register_metric("ragas.TopicAdherenceScore")

# Use with processor
processor = MetricsProcessor(registry=registry)
results = await processor.compute_metrics(traces_by_session)

Configuration

The RAGAS adapter requires LLM configuration:

from metrics_computation_engine.models.requests import LLMJudgeConfig

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

Metric Details

TopicAdherenceScore

  • Type: Session-level metric
  • Aggregation Level: session
  • Required Entity Types: llm
  • Description: Evaluates how well a multi-turn conversation maintains focus on specified reference topics
  • Output: Float score between 0.0 and 1.0

Dependencies

  • ragas>=0.2.0: Core RAGAS library
  • langchain-openai: LLM integration
  • langchain-core: Core LangChain functionality

Development

Running Tests

pytest tests/

Code Formatting

black src/ tests/

Type Checking

mypy src/

Contributing

  1. Follow the existing code style and patterns
  2. Add tests for new functionality
  3. Update documentation as needed
  4. Ensure all tests pass before submitting

License

Apache License 2.0 - see the main project LICENSE file for details.

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

mce_ragas_adapter-0.1.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

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

mce_ragas_adapter-0.1.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mce_ragas_adapter-0.1.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mce_ragas_adapter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a535a1d09fc0d71ba39d6880d0139c2ddb3be3b16df4f92411f1511c0bce3032
MD5 d345c5747dc640ca9b6f06d60c804610
BLAKE2b-256 ca47745bb190d53f0fe500b0b08b1b1b92432aca5dfd9c03fad737d4aa88f27e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mce_ragas_adapter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 97b60e1841aae0c6d85354246a93cb00d49921fa2c9aeb41eae895dd0c08e36b
MD5 d2af0e2e2394eabf1f2530f32cfd86d9
BLAKE2b-256 2b001a9aae0d143b420e9b06aa0919edf904cf3586b020d8638fad842c1b5f77

See more details on using hashes here.

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