Skip to main content

inDoxJudge

Typing SVG

License PyPI Python Downloads

Discord GitHub stars

Official Website • Documentation • Releases • Discord

NEW: Subscribe to our mailing list for updates and news!

Welcome to IndoxJudge! This repository provides a comprehensive suite of evaluation metrics for assessing the performance and quality of large language models (LLMs). Whether you're a researcher, developer, or enthusiast, this toolkit offers essential tools to measure various aspects of LLMs, including knowledge retention, bias, toxicity, and more.

IndoxJudge Evaluate LLMs with metrics & Model Safety

Overview

IndoxJudge is designed to provide a standardized and extensible framework for evaluating LLMs. With a focus on accuracy, fairness, and relevancy, this toolkit supports a wide range of evaluation metrics and is continuously updated to include the latest advancements in the field.

Features

  • Comprehensive Metrics: Evaluate LLMs across multiple dimensions, including accuracy, bias, toxicity, and contextual relevancy.
  • RAG Evaluation: Includes specialized metrics for evaluating retrieval-augmented generation (RAG) models.
  • Safety Evaluation: Assess the safety of model outputs, focusing on toxicity, bias, and ethical considerations.
  • Extensible Framework: Easily integrate new metrics or customize existing ones to suit specific needs.
  • User-Friendly Interface: Intuitive and easy-to-use interface for seamless evaluation.
  • Continuous Updates: Regular updates to incorporate new metrics and improvements.

Supported Models

Every judge runs through IndoxHub, the gateway that fronts 200+ models across 14 providers behind one key and one wire format:

from indoxJudge.models import IndoxHub

llm = IndoxHub(model="openai/gpt-4o-mini")       # or anthropic/claude-sonnet-4,
                                                  # google/gemini-2.0-flash, mistralai/mistral-large, ...

Set INDOXHUB_API_KEY in your environment and the key is picked up for you; set INDOXHUB_BASE_URL to point at a self-hosted or staging gateway. Browse the model list at api.indoxhub.com.

Changing the judge is a string change. That is why there is one provider here instead of seven — a per-vendor client is a per-vendor set of failure modes to maintain, and the gateway already speaks to all of them.

Metrics

IndoxJudge ships 60 metrics. Each name links to its page; docs/metrics has them all, one folder per group.

General quality

  • GEval: Rubric-driven judge over coherence, relevance, accuracy, fluency and more.
  • AnswerRelevancy: Is the answer relevant to the question?
  • KnowledgeRetention: Does the model keep facts consistent across a conversation?
  • Hallucination: Finds statements the given context does not support.
  • Toxicity: Toxic content in the output.
  • Bias: Biased opinions in the output.
  • BertScore: Embedding similarity to one or more reference answers.
  • BLEU: n-gram precision against reference answers.
  • Rouge: n-gram overlap against reference answers.
  • METEOR: Reference match that credits stems and synonyms.
  • Gruen: Grammaticality, redundancy and focus of generated text.

Retrieval (RAG)

Agents

Conversations

  • PerTurn: Runs any single-turn metric across every turn of a conversation.
  • ConversationCompleteness: Did the thread, as a whole, give the user what they came for?
  • RoleAdherence: Did the assistant hold its persona for the whole conversation?

Define your own

  • CriteriaJudge: Score anything you can state as a sentence. No code.
  • DecisionGraph: A rubric as a decision tree; the score comes with the path that made it.
  • PromptAlignment: Share of the prompt's instructions the output followed.
  • PairwiseComparison: Head-to-head: which answer is better on a criterion you name?

Format (no judge call)

Safety

Summarization

Pipelines

Evaluators bundle metrics for a job and add weighting, scoring and charts:

Installation

IndoxJudge needs Python 3.12 or newer. Install it from PyPI:

pip install indoxJudge

From source

git clone https://github.com/nematiai/indoxJudge.git
cd indoxJudge
python -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate
pip install -e .

For development (tests, lint, notebooks), add the dev group (needs pip 25.1+, or use uv sync):

pip install -e . --group dev
pytest

Or run the tests in Docker, with nothing installed on your machine:

echo "TORCH_BACKEND=cpu" > .env    # or e.g. cu128 for a GPU; add INDOXHUB_API_KEY to call a judge
make build
make test                # everything; `make test-fast` skips the model downloads

Usage

To use IndoxJudge, load your API key, select the model, and choose the evaluation metrics. Here's an example demonstrating how to evaluate a model's response for faithfulness:

import os
from dotenv import load_dotenv

# Load environment variables
load_dotenv()

# Import IndoxJudge and supported models
from indoxJudge.pipelines import Evaluator
from indoxJudge.models import IndoxHub
from indoxJudge.metrics import Faithfulness

# Initialize the model with your API key
model = IndoxHub(model="openai/gpt-4o-mini")

# Define your query and retrieval context
query = "What are the benefits of a Mediterranean diet?"
retrieval_context = [
    "The Mediterranean diet emphasizes eating primarily plant-based foods, such as fruits and vegetables, whole grains, legumes, and nuts. It also includes moderate amounts of fish and poultry, and low consumption of red meat. Olive oil is the main source of fat, providing monounsaturated fats which are beneficial for heart health.",
    "Research has shown that the Mediterranean diet can reduce the risk of heart disease, stroke, and type 2 diabetes. It is also associated with improved cognitive function and a lower risk of Alzheimer's disease. The diet's high content of fiber, antioxidants, and healthy fats contributes to its numerous health benefits.",
    "A Mediterranean diet has been linked to a longer lifespan and a reduced risk of chronic diseases. It promotes healthy aging and weight management due to its emphasis on whole, unprocessed foods and balanced nutrition."
]

# Obtain the model's response
response = "The Mediterranean diet is known for its health benefits, including reducing the risk of heart disease, stroke, and diabetes. It encourages the consumption of fruits, vegetables, whole grains, nuts, and olive oil, while limiting red meat. Additionally, this diet has been associated with better cognitive function and a reduced risk of Alzheimer's disease, promoting longevity and overall well-being."

# Initialize the Faithfulness metric
faithfulness_metrics = Faithfulness(llm_response=response, retrieval_context=retrieval_context)

# Create an evaluator with the selected metrics
evaluator = Evaluator(metrics=[faithfulness_metrics], model=model)

# Evaluate the response
faithfulness_result = evaluator.judge()

# Output the evaluation result
print(faithfulness_result)

Running metrics concurrently

Metrics do not depend on each other, so the only thing serialising them is the wait on the provider. Every evaluator also exposes ajudge(), which runs them at once:

import asyncio
from indoxJudge.pipelines import SafetyEvaluator

evaluator = SafetyEvaluator(model=model, input="Some sentence to check.")
results = asyncio.run(evaluator.ajudge())

ajudge() returns exactly what judge() returns. On a ten-metric suite at 0.3s per call this is 3.1s -> 0.6s. At most INDOXJUDGE_MAX_CONCURRENCY calls are in flight at a time (default 8); set the environment variable, or pass max_concurrency= when you build the evaluator, to stay inside your provider's rate limit.

An individual metric can be awaited on its own with await metric.a_measure().

Evaluating a whole dataset

One sample at a time is the exception; a suite is the normal case. Load samples from csv or jsonl, hand the runner a factory that turns a sample into metrics, and get per-sample results plus the means:

from indoxJudge.dataset import EvaluationDataset
from indoxJudge.metrics import AnswerRelevancy, Faithfulness
from indoxJudge.runner import DatasetRunner

dataset = EvaluationDataset.from_jsonl("evals.jsonl")

def build_metrics(sample):
    return [
        Faithfulness(llm_response=sample.llm_response, retrieval_context=sample.joined_context()),
        AnswerRelevancy(query=sample.query, llm_response=sample.llm_response),
    ]

runner = DatasetRunner(model=llm, build_metrics=build_metrics)
runner.run(dataset)                     # or asyncio.run(runner.arun(dataset))

print(runner.mean_score)                # 0.78
print(runner.per_metric_means())        # {"Faithfulness": 0.81, "AnswerRelevancy": 0.75}
runner.to_jsonl("results.jsonl")

You supply the factory rather than naming metrics, because only you know what your samples can support - a dataset without ground_truth cannot feed ContextualRecall, and nothing here guesses. Under arun() the samples overlap as well as the metrics within each one; a sample that raises is recorded as an error and the rest of the run continues.

List fields survive the csv round trip: they are stored JSON-encoded in the cell, which is the one thing a naive csv writer gets wrong.

Caching judge replies

While you are iterating on a prompt or a metric, the same judge calls get paid for again on every run. Set INDOXJUDGE_CACHE=1 and identical calls are served from a local SQLite file instead:

export INDOXJUDGE_CACHE=1
export INDOXJUDGE_CACHE_PATH=~/.cache/indoxjudge/prompts.db   # optional

A reply is only reused for the same model, temperature and max_tokens — your API key is never part of the key. evaluator.usage() reports input_tokens, output_tokens and cached_calls, so you can see what the run actually cost.

Caching is off by default and should stay off for a run whose numbers you intend to trust. A cached judge is a deterministic judge, and replaying yesterday's verdict would hide the change an evaluation exists to catch.

Example Output

{
  "faithfulness": {
    "claims": [
      "The Mediterranean diet is known for its health benefits.",
      "The Mediterranean diet reduces the risk of heart disease.",
      "The Mediterranean diet reduces the risk of stroke.",
      "The Mediterranean diet reduces the risk of diabetes.",
      "The Mediterranean diet encourages the consumption of fruits.",
      "The Mediterranean diet encourages the consumption of vegetables.",
      "The Mediterranean diet encourages the consumption of whole grains.",
      "The Mediterranean diet encourages the consumption of nuts.",
      "The Mediterranean diet encourages the consumption of olive oil.",
      "The Mediterranean diet limits red meat consumption.",
      "The Mediterranean diet is associated with better cognitive function.",
      "The Mediterranean diet is associated with a reduced risk of Alzheimer's disease.",
      "The Mediterranean diet promotes longevity.",
      "The Mediterranean diet promotes overall well-being."
    ],
    "truths": [
      "The Mediterranean diet is known for its health benefits.",
      "The Mediterranean diet reduces the risk of heart disease, stroke, and diabetes.",
      "The Mediterranean diet encourages the consumption of fruits, vegetables, whole grains, nuts, and olive oil.",
      "The Mediterranean diet limits red meat consumption.",
      "The Mediterranean diet has been associated with better cognitive function.",
      "The Mediterranean diet has been associated with a reduced risk of Alzheimer's disease.",
      "The Mediterranean diet promotes longevity and overall well-being."
    ],
    "reason": "The score is 1.0 because the 'actual output' aligns perfectly with the information presented in the 'retrieval context', showcasing the health benefits, disease risk reduction, cognitive function improvement, and overall well-being promotion of the Mediterranean diet."
  }
}

Roadmap

We have an exciting roadmap planned for IndoxJudge:

Plan
Integration of additional metrics such as Diversity and Coherence.
Introduction of a graphical user interface (GUI) for easier evaluation.
Expansion of the toolkit to support evaluation in multiple languages.
Release of a benchmarking suite for standardizing LLM evaluations.

Contributing

We welcome contributions from the community! If you'd like to contribute, please fork the repository and create a pull request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create a new branch from production (git checkout -b feature-branch)
  3. Make your change and run pytest
  4. Commit your changes (git commit -am 'Add new feature')
  5. Push to the branch (git push origin feature-branch)
  6. Open a pull request against production

Metadata

Release files for indoxJudge 0.2.1

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

Source distribution (sdist)

Source distribution for indoxJudge 0.2.1
File Size Uploaded Provenance Actions
indoxjudge-0.2.1.tar.gz 154.4 kB Without provenance Details for indoxjudge-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for indoxJudge 0.2.1
File Interpreter ABI Platform Actions
indoxjudge-0.2.1-py3-none-any.whl Python 3 none any Details for indoxjudge-0.2.1-py3-none-any.whl

Total release size: 369.8 kB

Release files / indoxjudge-0.2.1.tar.gz

Download URL indoxjudge-0.2.1.tar.gz
Size 154.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b6e864a48f977e277e03a3bbb015ca1a8445952c45ed520930a193503ec59d07
BLAKE2b-256 checksum
How to use checksums
84f5d303898f90859da6c2d97d6887dc04b916ad1ebb1f2d4d15a5c2c9e2d0b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / indoxjudge-0.2.1-py3-none-any.whl

Download URL indoxjudge-0.2.1-py3-none-any.whl
Size 215.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
79b72686ee9a875efab939cca724cdc0a9d3212c7d6969bc9b070765ea9035be
BLAKE2b-256 checksum
How to use checksums
78a7e12f5480c98122a9667c04fb8f3ae49999d45c6bdf16dd8ae6cd8999d592
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for indoxJudge 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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