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. Get your key at indoxhub.com.

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.

Judge settings

Every setting has a default that suits a judge, and every one can be changed for the model you use:

Setting Default Change it when
temperature 0.2 You want more varied verdicts (e.g. 1.0 with GEval(samples=...)), or the model rejects it: temperature=None leaves it out of the request
max_tokens 2048 Long replies get cut off (raise it), or the model wants another name for it: max_tokens=None, max_completion_tokens=4096
timeout 120 seconds Slow models or long prompts
max_retries 3 Rate limits, timeouts and server errors are retried this many times with back-off; 0 turns retries off
any other keyword not sent Model-specific options pass straight through: top_p=, seed=, reasoning_effort=, ...
IndoxHub(model="openai/gpt-4o-mini")                                    # defaults
IndoxHub(model="anthropic/claude-sonnet-4", temperature=None)            # leaves temperature out
IndoxHub(model="openai/o4-mini", temperature=None, max_tokens=None,
         max_completion_tokens=4096, reasoning_effort="low")

A bad setting fails at once with a ValueError naming it. A call that fails at the model raises JudgeError (from indoxJudge.models.errors import JudgeError) with the model, the cause and what to change, for example:

Judge 'openai/o4-mini' at https://api.indoxhub.com/v1: it rejects temperature=0.2: pass temperature=None
to leave it out, or a value it accepts. (400: Unsupported value: 'temperature' does not support 0.2)

The same happens for a rejected key (401), a model the key cannot use (403), an unknown model (404), rate limits or credits (429, after the retries), gateway failures (5xx), timeouts, an unreachable gateway, and a reply cut off at max_tokens. Inside an evaluator the error is recorded under the metric's name, {"error": "..."}, and the other metrics still run.

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: Does the response contradict the given context? Scores the share of contexts it contradicts.
  • Toxicity: Toxic content in the output.
  • Bias: Biased opinions in the output.
  • BertScore: Embedding similarity to one or more reference answers. Needs [models].
  • BLEU: n-gram precision against reference answers. Needs [nlp].
  • Rouge: n-gram overlap against reference answers. Needs [nlp].
  • METEOR: Reference match that credits stems and synonyms. Needs [nlp].
  • Gruen: Grammaticality, redundancy and focus of generated text. Needs [models].

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:

LLMEvaluator, RagEvaluator and SummaryEvaluator include local metrics, so install [models] for them. Charts and the dashboard need [graph].

Installation

IndoxJudge needs Python 3.12 or newer. The base install runs every judge metric through IndoxHub; add an extra for the metrics that run on your machine:

pip install indoxJudge                    # every judge metric: agents, retrieval, safety, conversations, custom
pip install "indoxJudge[nlp]"             # + BLEU, METEOR, Rouge and their summary versions
pip install "indoxJudge[models]"          # + BertScore, Gruen, SummaryBertScore (torch, transformers)
pip install "indoxJudge[summarization]"   # every summarization metric (nlp + models)
pip install "indoxJudge[graph]"           # + charts and the dashboard (dash, plotly, pandas)
pip install "indoxJudge[all]"             # everything

A metric whose extra is missing raises an error naming the pip install command to run.

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 ".[all]"

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

pip install -e ".[all]" --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)

General benchmarks

Human-labelled (tests/benchmark/human/): each judge metric is compared with human labels from public datasets, pre-registered before scoring (prereg*.json: seed, item ids, pass bars), with every dataset file pinned by SHA-256 (and to a commit where its host has one) and downloaded at run time. Only ids, MIT/CC0 labels and scores are committed. Judge: Claude Opus through script/local_judge.py; 95% intervals from 10,000 resamples of source groups.

Metric Data (held-out unless noted) Result Published anchor
GEval SummEval, 75 summaries (pilot) Spearman .79 consistency, .55 relevance G-Eval-4: .51, .55
Hallucination RAGTruth, 76 responses Scott's pi .71, F1 .85 prompted GPT-4 F1 .63
Toxicity ToxiGen + Civil Comments, 120 Scott's pi .85, F1 .92, AUC .93 fine-tuned classifiers AUC .85-.93
KnowledgeRetention LongMemEval, 30 constructed dialogues Scott's pi .93, F1 .97 none (labels constructed)
Bias BABE media-bias sentences, 76 Scott's pi .23, AUC .68 none; BABE labels media bias, not group bias
AnswerRelevancy WikiEval, 50 pairs (reused) pairwise accuracy .50, no reversals Ragas .78; the ties are incomplete answers
BLEU, ROUGE, METEOR, BERTScore SummEval, 1,600 summaries 20 of 24 Table 2 correlations reproduced Fabbri et al. 2021
GRUEN SummEval fluency and coherence Spearman .28 and .32, above every overlap metric Zhu & Bhat 2020

These are small samples with wide intervals, judged by one model family. In the pilot, Qwen2.5-14B as judge scored much lower on GEval and Hallucination, slightly lower on Toxicity, about the same on Bias and higher on AnswerRelevancy (.52 against .32), so results depend on the judge. The public datasets may be in the judge's training data.

Smoke test (tests/benchmark/general/): 10 public-domain passages (NASA, NCI, EPA, NIST, NPS, FWS, USGS, NWS, USDA Forest Service), each with a good and a bad answer, scored by every General metric. Every metric ranks the good answer higher on 10 of 10, except GRUEN on 9 of 10 (it rates fluency, not facts). The answers were written and judged by Claude, so this is a wiring and regression check, not evidence of accuracy. Re-run with JUDGE_URL=<local judge URL> JUDGE_MODEL=<name> python tests/benchmark/general/run.py, or open examples/general_sample.ipynb, which scores the sample and shows the results table.

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. Each IndoxHub judge has at most INDOXJUDGE_MAX_CONCURRENCY calls in flight (default 8), however many metrics, samples or evaluators share it; set the variable to stay inside your provider's rate limit. max_concurrency= on an evaluator limits how many metrics it runs at once.

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))
                                        # a progress bar shows on a terminal; show_progress=False hides it

print(runner.mean_score)                # 0.78
print(runner.per_metric_means())        # {"Faithfulness": 0.81, "AnswerRelevancy": 0.75}
runner.save("results.csv")              # or .json / .jsonl - see "Saving a report"

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.

Saving a report

save() writes the results of an evaluator or a dataset run to a file; the extension picks the format:

evaluator.judge()
evaluator.save("report.json")    # summary + full results
evaluator.save("report.csv")     # one row per metric, opens in Excel or pandas
runner.save("results.jsonl")     # one sample per line
Format Shape Use it for
.json {"summary": {...}, "results": {...}} (or "samples" for a dataset) Keeping the whole run: every score, reason, verdict and error, plus the summary
.jsonl One sample per line: {"sample_id": ..., "<Metric>": {...}, "evaluation_score": ...} Large datasets, streaming, appending runs, loading with pandas.read_json(lines=True)
.csv One row per sample and metric Spreadsheets, BI tools, pandas.read_csv

The CSV columns are sample_id, metric, score, success, threshold, reason, input_tokens, output_tokens, cached_calls, error, details. Each sample also gets an evaluation_score row. Extras such as verdicts or a breakdown go into details as JSON, a failed metric fills error, and a value that does not apply is left blank. It is written with the csv module (RFC 4180 quoting) in UTF-8; pass encoding="utf-8-sig" if Excel shows the accents wrongly. For one column per metric instead: pd.read_csv("report.csv").pivot(index="sample_id", columns="metric", values="score").

The summary in the JSON report holds the number of samples, the mean evaluation score, each metric's mean score, pass rate and count, the number of errors, token totals, the judge model, a UTC timestamp and the indoxJudge version. The layout follows what other evaluation tools save: Ragas gives one row per sample, DeepEval nests metric results per test case, and lm-evaluation-harness keeps a JSON summary next to per-sample JSONL.

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. Token counts are estimates (tiktoken cl100k_base, or words when it cannot load), not what the provider bills.

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.

Verbose logging

indoxJudge is quiet by default. To watch each judge call, its token counts, every metric's score and any error as it happens, turn verbose on:

import indoxJudge

indoxJudge.verbose()        # show the log
indoxJudge.verbose(False)   # hide it again

or set it for a whole run without touching code:

export INDOXJUDGE_VERBOSE=1

The log goes to Python's standard logging, under the indoxJudge logger, so an application's own logging setup applies: logging.getLogger("indoxJudge").setLevel(logging.INFO) lets it through your handlers, and a logging.FileHandler keeps it in a file. Errors are reported in the results either way: a metric that fails shows up as {"error": "..."}.

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.5.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.5.1
File Size Uploaded Provenance Actions
indoxjudge-0.5.1.tar.gz 172.6 kB Without provenance Details for indoxjudge-0.5.1.tar.gz

Built distribution (wheel)

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

Total release size: 397.7 kB

Release files / indoxjudge-0.5.1.tar.gz

Download URL indoxjudge-0.5.1.tar.gz
Size 172.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1ffca75df92a6c4e4e20495db860b50a7ba22b3a50449314b3007f2fd7abae47
BLAKE2b-256 checksum
How to use checksums
fc9bdbef3fd8cfb47d148e4249c86c03a32bb6dd2e978a264bff6645e9d31986
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.5.1-py3-none-any.whl

Download URL indoxjudge-0.5.1-py3-none-any.whl
Size 225.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3d3c1130889d7977710b0e5b289b6c82168e5b3ea0f77bd746180ce8bc511f0
BLAKE2b-256 checksum
How to use checksums
f04b65921776abb2b68d02a162040c592ed6ec3dbfd8f9b020511b50b7eb7dd3
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.5.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