Skip to main content
Inconsistent provenance

Files in this release originate from inconsistent repositories or configurations. View details.

GLLM Evaluator SDK

A comprehensive evaluation framework for Generative AI applications including LLM outputs, AI Agent responses, and RAG (Retrieval-Augmented Generation) systems.

Overview

The GLLM Evaluator SDK provides a robust, extensible framework designed to make AI evaluation as simple and seamless as possible across the GDP Labs ecosystem. Built with integration-first philosophy, it enables teams to easily assess the quality of generated content from any AI system while seamlessly connecting with experiment tracking and observability platforms.

Philosophy

Easy Evaluation Everywhere: Standardize evaluation practices across all GDP Labs AI applications with minimal setup and maximum flexibility.

Integration-First Design: Built to work seamlessly with your existing experiment tracking, observability, and MLOps infrastructure.

Extensible by Design: Add new evaluators, metrics, and integrations without breaking existing workflows.

Key Features

  • 🌐 GDP Labs Ecosystem Ready: Standardized evaluation framework across all internal AI applications
  • 🔌 Seamless Integration: Easy integration with experiment tracking and observability platforms
  • 🚀 Async-First Design: High-performance async evaluation with parallel processing
  • 🔧 Extensible Architecture: Easy to add new evaluators and metrics for any use case
  • 🤖 LLM as a Judge: Advanced language models for nuanced, contextual evaluation
  • 📐 Traditional Metrics: Support for classical evaluation metrics and custom scoring functions
  • 🔗 Popular Evaluator Integration: Integration with popular evaluators such as DeepEval
  • ⚡ Zero-Config Start: Get started with sensible defaults, customize as needed

Installation

Prerequisites

Mandatory:

  1. Python 3.11+ — Install here
  2. pip — Install here
  3. uv — Install here
  4. gcloud CLI (for authentication) — Install here, then log in using:
    gcloud auth login
    

Install from Artifact

Because gllm-evals is a private library hosted in a secure Google Cloud repository, you must provide an access token to install it. The command below handles this authorization inline by using an access token from the gcloud CLI.

uv pip install --extra-index-url https://oauth2accesstoken:$(gcloud auth print-access-token)@glsdk.gdplabs.id/gen-ai-internal/simple/ gllm-evals

Local Development Setup

Prerequisites

  1. Python 3.11+ — Install here

  2. pip — Install here

  3. uv — Install here

  4. gcloud CLI — Install here, then log in using:

    gcloud auth login
    
  5. Git — Install here

  6. Trivy — Install here (required by the pre-push git hook, which runs a vulnerability scan on changed libraries before every push)

  7. Access to the GDP Labs SDK GitHub repository


1. Clone Repository

git clone git@github.com:GDP-ADMIN/gl-sdk.git
cd gl-sdk/libs/gllm-evals

2. Setup Authentication

Because gllm-evals is a private library, you first need to configure uv to authenticate with our secure Google Cloud repositories. Set the following environment variables to authenticate with internal package indexes:

export UV_INDEX_GEN_AI_INTERNAL_USERNAME=oauth2accesstoken
export UV_INDEX_GEN_AI_INTERNAL_PASSWORD="$(gcloud auth print-access-token)"

3. Quick Setup

Run:

make setup

4. Activate Virtual Environment

source .venv/bin/activate

Local Development Utilities

The following Makefile commands are available for quick operations:

Install uv

make install-uv

Install Pre-Commit

make install-pre-commit

This installs both the pre-commit and pre-push git hooks from the repository-root .pre-commit-config.yaml. The pre-push hook runs unit tests, a changed-line coverage check, and a Trivy vulnerability scan for every changed library before a push completes, so make sure Trivy is installed and gcloud auth login is active.

Install Dependencies

make install

Update Dependencies

make update

Run Tests

make test

Adding the Package

Once authorization is configured, you can add gllm-evals to your project:

uv add gllm-evals

Dependencies

The SDK requires:

  • gllm-core and gllm-inference for LLM interactions
  • pydantic for data validation

Quick Start

Basic Usage

import asyncio
import os
from gllm_evals.evaluator.geval_generation_evaluator import GEvalGenerationEvaluator

async def main():
    # Initialize the evaluator
    evaluator = GEvalGenerationEvaluator(
        model_credentials=os.getenv("GOOGLE_API_KEY")
    )

    # Prepare evaluation data
    data = {
        "query": "What is the capital of France?",
        "expected_response": "Paris is the capital of France.",
        "generated_response": "The capital of France is Paris.",
        "retrieved_context": "Paris is the capital and largest city of France."
    }

    # Evaluate
    result = await evaluator.evaluate(data)
    print(result)

if __name__ == "__main__":
    asyncio.run(main())

Multimodal Evaluation

Use [ATTACHMENT:<id-or-uri>] placeholders in evaluation fields when the judge needs image context. Attachments may be declared by ID through LLMTestCase.attachments, or referenced inline with https://, http://, file://, or data: URIs.

import asyncio

from gllm_evals import AttachmentRef, LLMTestCase, evaluate
from gllm_evals.evaluator.geval_generation_evaluator import GEvalGenerationEvaluator


async def main():
    data = [
        LLMTestCase(
            input="Describe this image: [ATTACHMENT:sample_image]",
            actual_output="The image shows a mountain landscape.",
            expected_output="A mountainous outdoor landscape is visible.",
            retrieved_context=["Reference image: [ATTACHMENT:sample_image]"],
            attachments={
                "sample_image": AttachmentRef(
                    uri="https://picsum.photos/id/29/640/480.jpg",
                    mime_type="image/jpeg",
                )
            },
        )
    ]

    results = await evaluate(data=data, evaluators=[GEvalGenerationEvaluator()])
    print(results)


if __name__ == "__main__":
    asyncio.run(main())

You can place image placeholders in input, actual_output, expected_output, retrieved_context, and expected_context. The evaluator resolves placeholders before invoking the judge; unresolved placeholders fail validation instead of being sent as raw text.

For CSV and spreadsheet datasets, put row-level attachments in an attachments JSON cell:

input,actual_output,expected_output,attachments
"Describe [ATTACHMENT:image_1]","A mountain landscape.","A mountain landscape.","{""image_1"":{""uri"":""https://picsum.photos/id/29/640/480.jpg"",""mime_type"":""image/jpeg""}}"

See examples/evaluate/example_multimodal_evaluate_from_csv.py for a runnable CSV example that references bundled local image files, including a chart image used for a chart-comprehension question.

Inline URI and data URL placeholders are also supported without a named attachment entry:

LLMTestCase(
    input="Describe [ATTACHMENT:https://example.com/image.jpg]",
    actual_output="A product photo.",
)

Pass multimodal=False to suppress multimodal judging rules on the metrics that expose the option — LMBasedMetric and the GEval-family metrics (DeepEvalGEvalMetric and its subclasses, e.g. groundedness, completeness, and redundancy). Placeholder resolution still occurs, so raw [ATTACHMENT:...] text is not sent to the judge.

Dataset Evaluation

import asyncio
import os
from gllm_evals.dataset.dict_dataset import DictDataset
from gllm_evals.evaluator.geval_generation_evaluator import GEvalGenerationEvaluator
from gllm_evals.runner import Runner
from gllm_evals.experiment_tracker.csv_experiment_tracker import CSVExperimentTracker

async def dataset_evaluation():
    # Initialize evaluator
    evaluator = GEvalGenerationEvaluator(
        model_credentials=os.getenv("GOOGLE_API_KEY"),
        run_parallel=True  # Enable parallel processing
    )

    # Create dataset
    dataset = DictDataset([
        {
            "query": "What is the capital of France?",
            "expected_response": "Paris",
            "generated_response": "Paris is the capital of France.",
            "retrieved_context": "Paris is the capital of France."
        },
        {
            "query": "What is 1 + 1?",
            "expected_response": "2",
            "generated_response": "The answer is 2.",
            "retrieved_context": "1 + 1 equals 2."
        }
    ])

    # Run evaluation
    runner = Runner(evaluator, batch_size=10)
    results = await runner.evaluate(dataset)

    # Track results
    tracker = CSVExperimentTracker(score_key="generation/score")
    tracker.log_batch(results)

    print(f"Evaluation Results: {tracker.get_results()}")

if __name__ == "__main__":
    asyncio.run(dataset_evaluation())

Test case ids

Every test case in an evaluate_suites run has a test_case_id, so you can read its scores by id instead of by position. Set your own id, or point id_column at a column the file already has:

from gllm_evals import EvalSuite, evaluate_suites
from gllm_evals.dataset.dict_dataset import DictDataset
from gllm_evals.types import LLMTestCase

refund = [LLMTestCase(test_case_id="refund-042", input="...", expected_output="...", actual_output="...")]
# faq.jsonl rows: {"question_id": "faq-007", "input": "...", ...}; question_id is kept on the test case
faq = DictDataset.from_jsonl("faq.jsonl", id_column="question_id")

result = await evaluate_suites([EvalSuite(name="refund", data=refund, evaluators=[evaluator]),
                                EvalSuite(name="faq", data=faq, evaluators=[evaluator])])

by_id = result.results_by_id()  # test_case_id -> evaluator name -> EvaluatorOutput, every suite in one dict
by_id["refund-042"][evaluator.name].aggregate_success
failed = {failure.test_case_id for failure in result.failures}
  • A test case without an id gets auto- plus a hash of its question fields. The hash leaves out the answer (actual_output, retrieved_context, tools_called, agent_trajectory) and extra fields, so a rerun with a new answer keeps the id, and so does shuffling the suite.
  • Every id in a run must be unique, across all suites. Two test cases with the same id raise EvalInputError before any judge call, and the error says which suites and rows repeat it. This includes two test cases with the same question and no id, for example the same question with two answers. Give those test cases a test_case_id or load them with an id_column.
  • To compare two pipelines on the same dataset, run each pipeline in its own evaluate_suites call and compare the two results_by_id() dicts.
  • SuiteResult.test_case_ids lists the ids in the same order as SuiteResult.results. MetricFailure and MetricFallback carry test_case_id beside test_case_index.
  • The CSV tracker writes a test_case_id column, and the Google Sheets tracker uses it to skip rows it already wrote. A row logged without an id, for example through Runner, is keyed in Sheets on its whole test case instead.
  • Set id_column on the loader, because each file can name its id column differently. evaluate_suites rejects id_column, so load a file that has one with its loader, as in faq above, or set id_column under dataset.kwargs in a YAML suite. A CSV or Google Sheets id column is read as text, so 007 stays 007, and an integer id becomes a string.

Using Jev with GEval

Every GEval metric (built-in and custom DeepEvalGEvalMetric) accepts a decisions-model (DM) invoker such as TypeSafe Jev in models and fallback_models, next to regular LM invokers. Set OPENROUTER_API_KEY first.

import os

from gllm_inference.dm_invoker import build_dm_invoker
from gllm_inference.lm_invoker import build_lm_invoker
from gllm_evals.metrics.generation.geval_completeness import GEvalCompletenessMetric

jev = build_dm_invoker(
    model_id="openrouter/typesafe/jev-1.14",
    credentials=os.getenv("OPENROUTER_API_KEY"),
    config={"provider": {"order": ["typesafe"], "allow_fallbacks": False}},
)
deepseek = build_lm_invoker(
    model_id="openrouter/deepseek/deepseek-v4.1-flash-1017",
    credentials=os.getenv("OPENROUTER_API_KEY"),
    config={"provider": {"order": ["inference-net"], "allow_fallbacks": False}},
)

metric = GEvalCompletenessMetric(models=jev)                                         # Jev only
metric = GEvalCompletenessMetric(models=jev, fallback_models=[deepseek])             # Jev, then an LM
metric = GEvalCompletenessMetric(models=[jev, jev, jev])                             # three judges, majority vote

result = await metric.evaluate(row)
result.score                    # normalized score in [0, 1]
result.decision.choice          # e.g. "3", the rubric score Jev chose
result.decision.confidence      # e.g. 0.99
result.decision.probabilities   # e.g. {"1": 0.0, "2": 0.01, "3": 0.99}
  • Fallback is per complete attempt, in the configured order. A judge that raises an invoker error, times out, or gives an unusable answer (a choice that was not offered) hands the row to the next judge. If exactly one judge was tried and failed, its result carries that error. If two or more failed with the same error class and code, the result carries the primary judge's error, so a caller can catch that class. If they failed in different ways, the result carries EvalJudgesExhaustedError with each attempt in children. If every attempt exceeds its context limit and a decision model is among them, the result carries EvalInputError instead. An authentication, billing, or unknown-model error also hands the row to the next judge. If every judge fails that way, the run stops. A configuration, input, or unsupported-operation failure stops the fallback chain at once.

  • result.decision is set only when a single Jev judge produced the score. With several judges it is None on the aggregate; each judge's own entry keeps its decision.

  • Fewshot, evaluation_steps, custom GEval and thresholds are accepted as with an LM judge. Jev receives the criteria, then the configured steps (never steps another LM generated), then row context (additional_info, fewshot, and in Conversational GEval the chatbot role). When both criteria and evaluation steps are configured, Jev includes both in the request. For a criteria-only custom metric, Jev judges from the criteria, context, and rubric.

  • YAML suites: give a model entry type: dm (type defaults to lm):

    evaluators:
      - class_name: GEvalGenerationEvaluator
        models:
          - type: dm
            model_id: openrouter/typesafe/jev-1.14
            credentials: ${OPENROUTER_API_KEY}
            config:
              provider:
                order: [typesafe]
                allow_fallbacks: false
    
  • Other metrics. The native DeepEval metrics in Using Jev with native DeepEval metrics also accept a DM invoker. Conversational GEval supports a DM judge through SDK-side mapping. Metrics without decision-model support raise EvalUnsupportedOperationError when given a DM invoker.

  • Fallback scope. The chain moves on when a judge's invoker fails or times out, when Jev's answer is unusable, and when an LM judge returns invalid JSON. Other errors, such as a row missing a required field, are raised.

  • Rows with images. Each decision model is checked against the blessed multimodal list first and otherwise probed for image reading (probe calls are billed and definitive verdicts are cached; skip_multimodal_check applies to LM judges only). Capable decision models receive the resolved images in their state with multimodal rules appended. Judges that cannot be confirmed to accept images are skipped so a later image-capable judge in fallback_models can score the row; if none can, the row fails with EvalUnsupportedOperationError. A transient probe failure (such as a rate limit, connection failure, or timeout) is not cached as a permanent text-only verdict.

  • Token usage is reported per model; no cost is calculated for Jev.

  • get_full_prompt returns the Jev request as JSON when Jev is the primary judge.

Using Jev with native DeepEval metrics

Nineteen DeepEval metrics accept a DM invoker such as Jev in models and fallback_models. With a DM judge, DeepEval runs the metric in its native system_one mode: DeepEval asks its own questions and computes the score, and no LM is called. With an LM judge, the metric behaves as before.

Rows Metrics Required fields
Single-turn (LLMTestCase) DeepEvalAnswerRelevancyMetric, DeepEvalPromptAlignmentMetric input, actual_output
DeepEvalFaithfulnessMetric, DeepEvalContextualRelevancyMetric input, actual_output, retrieved_context
DeepEvalContextualPrecisionMetric, DeepEvalContextualRecallMetric input, expected_output, retrieved_context
DeepEvalHallucinationMetric input, actual_output, expected_context
DeepEvalToolCorrectnessMetric input; tool calls come from tools_called and expected_tools, or from agent_trajectory and expected_agent_trajectory
Conversational (ConversationalTestCase) DeepEvalConversationCompletenessMetric, DeepEvalGoalAccuracyMetric, DeepEvalKnowledgeRetentionMetric, DeepEvalTurnRelevancyMetric, DeepEvalTopicAdherenceMetric turns
DeepEvalRoleAdherenceMetric turns, chatbot_role
DeepEvalTurnFaithfulnessMetric, DeepEvalTurnContextualRelevancyMetric turns, with retrieved_context on at least one turn
DeepEvalTurnContextualPrecisionMetric, DeepEvalTurnContextualRecallMetric turns with retrieved_context, and expected_output
DeepEvalToolUseMetric turns, with tools_called on at least one turn

Prompt Alignment also needs prompt_instructions, Topic Adherence needs relevant_topics, and Tool Use needs available_tools. These go to the metric constructor. JSON Correctness scores deterministically. Image metrics require an LM judge. Conversational GEval supports Jev through the SDK.

A single-turn metric judged by Jev only, with a second Jev as the fallback:

import os

from gllm_inference.dm_invoker import build_dm_invoker
from gllm_evals.metrics.generation import DeepEvalAnswerRelevancyMetric
from gllm_evals.types import LLMTestCase

provider = {"provider": {"order": ["typesafe"], "allow_fallbacks": False}}
jev = build_dm_invoker(
    model_id="openrouter/typesafe/jev-1.14", credentials=os.getenv("OPENROUTER_API_KEY"), config=provider
)
backup_jev = build_dm_invoker(
    model_id="openrouter/typesafe/jev-1.13", credentials=os.getenv("OPENROUTER_API_KEY"), config=provider
)

metric = DeepEvalAnswerRelevancyMetric(models=jev, fallback_models=[backup_jev])

result = await metric.evaluate(
    LLMTestCase(input="What is the capital of France?", actual_output="The capital of France is Paris.")
)
result.score       # DeepEval's native score in [0, 1]
result.model_id    # the judge that scored the row
result.decision    # None: native metrics have no single rubric decision

Set OPENROUTER_API_KEY, then configure Jev as the primary judge and DeepSeek as the fallback.

import os

from gllm_inference.dm_invoker import build_dm_invoker
from gllm_inference.lm_invoker import build_lm_invoker
from gllm_evals.metrics.generation import DeepEvalAnswerRelevancyMetric

jev = build_dm_invoker(
    model_id="openrouter/typesafe/jev-1.14",
    credentials=os.getenv("OPENROUTER_API_KEY"),
    config={"provider": {"order": ["typesafe"], "allow_fallbacks": False}},
)
deepseek = build_lm_invoker(
    model_id="openrouter/deepseek/deepseek-v4.1-flash-1017",
    credentials=os.getenv("OPENROUTER_API_KEY"),
    config={"provider": {"order": ["inference-net"], "allow_fallbacks": False}},
)

metric = DeepEvalAnswerRelevancyMetric(models=jev, fallback_models=[deepseek])

A conversational metric scores the whole conversation. Put retrieved context on each assistant turn that it grounds, not only at the top level. A conversational expected_output is the outcome the conversation should reach:

from gllm_evals.metrics.retrieval import DeepEvalTurnContextualPrecisionMetric
from gllm_evals.metrics.tool_use import DeepEvalToolUseMetric
from gllm_evals.types import ConversationalTestCase, ToolCall, Turn

row = ConversationalTestCase(
    turns=[
        Turn(role="user", content="How long do I have to return my order?"),
        Turn(
            role="assistant",
            content="You have 14 days from delivery.",
            retrieved_context=["Returns are accepted within 14 days of delivery."],
            tools_called=[ToolCall(name="lookup_policy", input_parameters={"topic": "returns"}, output="14 days")],
        ),
    ],
    expected_output="The user learns the 14-day return window.",
)

precision = DeepEvalTurnContextualPrecisionMetric(models=jev)
tool_use = DeepEvalToolUseMetric(
    available_tools=[{"name": "lookup_policy", "description": "Look up a store policy."}],
    models=jev,
)
precision_result = await precision.evaluate(row)
tool_use_result = await tool_use.evaluate(row)

EvalSuite.data holds one row type, so put single-turn and conversational rows in separate suites. Configure each metric before you pass it to an evaluator:

from gllm_evals import EvalSuite, evaluate_suites
from gllm_evals.evaluator import CompositeEvaluator
from gllm_evals.metrics.generation import DeepEvalTurnRelevancyMetric

suites = [
    EvalSuite(
        name="single-turn",
        data=[LLMTestCase(input="What is 2 + 2?", actual_output="4.")],
        evaluators=[CompositeEvaluator(name="generation", metrics=[DeepEvalAnswerRelevancyMetric(models=jev)])],
    ),
    EvalSuite(
        name="multi-turn",
        data=[
            ConversationalTestCase(
                turns=[Turn(role="user", content="What is 2 + 2?"), Turn(role="assistant", content="4.")]
            )
        ],
        evaluators=[CompositeEvaluator(name="conversation", metrics=[DeepEvalTurnRelevancyMetric(models=jev)])],
    ),
]
report = await evaluate_suites(suites)  # CSV column e.g. "generation.deepeval_answer_relevancy.score"
  • Evaluator overrides. An evaluator that sets models keeps each metric's own fallback_models unless you also pass fallback_models. models=jev with LM fallbacks becomes a mixed chain. Pass DM fallbacks, or fallback_models=[], to keep every row on Jev.
  • Mixed chains try the judges in the configured order. Each judge runs one complete measurement in its own mode, so an LM fallback re-runs the whole row. Rows of one run can be scored by different judges under the same metric name; each result's model_id names the judge that scored it. A panel such as models=[jev, gpt] scores each judge in its own mode and aggregates as usual.
  • Explanations come from DeepEval's native reason and name the deciding judge. include_reason=False leaves result.explanation empty, also when an LM fallback scores the row. strict_mode=True gives 1 only when every native question passes, otherwise 0.
  • Whole conversation. A DM judge scores Turn Faithfulness, Turn Relevancy and the three Turn Contextual metrics over the whole conversation, so window_size applies to LM judges only. Turn Faithfulness accepts only the default mean turn_aggregation when any judge in the chain or panel is a DM; other strategies raise EvalConfigurationError before any judge call.
  • Custom templates. A custom evaluation_template also supplies the native questions. DM judges answer only Noul and Score questions. A valid Choice question raises EvalConfigurationError, and DeepEval raises DeepEvalError if it cannot parse the questions. Both errors occur before the DM judge is called. In a mixed chain or panel, an earlier or concurrent LM judge may still be called.
  • Metric specifics. Hallucination stays lower-is-better. Tool Correctness matches tool calls deterministically and asks Jev one tool-selection question only when available_tools is set; without it no judge is called. Tool Use always needs a non-empty available_tools.
  • Text only. With a DM in the chain, media in a field the metric does not read is ignored. A DM-only chain rejects a row that references media in a field the metric reads, with EvalUnsupportedOperationError before any judge call. In a mixed chain, the DMs are skipped for that row and an image-capable LM scores it. Tool Correctness has no image path, so it rejects such a row in every chain.
  • Input size. A row larger than the native context budget fails with EvalInputError before any request to Jev. In a mixed chain, the LM fallbacks can still score that row.
  • Token usage is reported per model, including billed requests of judges that failed. No cost is calculated for Jev.
  • YAML suites declare Jev with type: dm, as for GEval. Inline conversational rows also need test_case_type: ConversationalTestCase.

Using Jev with Conversational GEval

DeepEvalConversationalGEvalMetric accepts Jev through models or fallback_models. Give the metric a name and either criteria or evaluation_steps, then pass a ConversationalTestCase. The SDK sends the selected fields of the full conversation in one Choice request. Jev receives the criteria, then the configured steps, then row context (role, additional_info, fewshot), matching single-turn GEval, so a DM-only evaluation makes zero generative LM calls.

Configuration models fallback_models
LM only deepseek []
Jev only jev []
Jev with LM fallback jev [deepseek]
LM with Jev fallback deepseek [jev]

Each attempt uses the full conversation. result.model_id identifies the judge that scored it. A Jev winner sets result.decision with the selected rubric label and any confidence or probabilities returned by the judge. An LM winner leaves decision empty. The SDK normalizes each score to [0, 1]. For a conversation with referenced media in a selected field (or chatbot_role), each decision model is checked against the blessed multimodal list or probed for image reading (probe calls are billed and definitive verdicts are cached; skip_multimodal_check applies to LM judges only). Capable decision models score the conversation with the resolved images attached in state and multimodal rules appended; if no configured judge in the chain can be confirmed to accept the media, the row fails with EvalUnsupportedOperationError.

Run the Jev-primary example with LM fallback or the multimodal conversational example with OPENROUTER_API_KEY set.

Custom Metrics

Create domain-specific metrics easily:

from gllm_evals.metrics.metric import BaseMetric
from gllm_evals.types import LLMTestCase, MetricScore

class DomainSpecificMetric(BaseMetric):
    """Custom metric for domain-specific evaluation."""

    name = "domain_accuracy"

    async def _evaluate(self, data: LLMTestCase) -> MetricScore:
        # Your domain-specific evaluation logic
        score = self.calculate_domain_score(data)
        return MetricScore(score=score, explanation="Domain-specific reasoning")

_evaluate receives one row. metric.evaluate([...]) calls _evaluate for each row and returns one result per row. Each row follows the error policy below. A failed row retains its error and billed token usage.

A float score must be finite. MetricScore rejects NaN and infinity.

Input validation and judge errors

Metrics, evaluators, Runner, and evaluate_suites check all test cases before the first judge call. A missing required field or an unsupported test case type raises EvalInputError. The message names the test case, metric, and SDK field, such as retrieved_context. For conversational DeepEval metrics, a blank or whitespace-only conversation-level field (such as expected_output) counts as missing, and a required turn-level field counts as missing when no turn carries a non-blank value. For the classical retrieval metrics, an empty retrieved_chunks or ground_truth_chunk_ids is a missing field. Runner and evaluate_suites reject empty datasets with EvalInputError, even when skips are enabled. If any suite has an empty dataset, no suite runs.

Metric thresholds must be finite values from 0 to 1, inclusive. Metric constructors with a threshold argument reject invalid thresholds with EvalConfigurationError. Preflight checks also reject invalid thresholds that callers set after construction, before any metric runs.

For live traffic with optional context, permit skips:

report = await evaluate_suites(suites, skip_on_missing_fields=True)

Only evaluate_suites exposes skip_on_missing_fields. Direct metric, evaluator, and runner calls always reject missing required fields.

Each skipped metric remains in the result with skipped=True, score=None, and a reason in explanation. The aggregate explanation also names the skip. Metrics that ran determine aggregate_success. A test case with only skips fails. Direct metric calls require complete input.

The default judge requires its API key before any metric runs.

Every error has one of three outcomes:

Outcome When What happens
Reject the run Before the first judge call The run does not start. Input and configuration errors, such as a missing required field or an invalid threshold, have this outcome.
Stop the run During the run The runner cancels waiting calls and raises the error. evaluate_suites returns no report. Batches that the tracker saved before stay saved.
Fail the test case During the run The metric gets score=None, success=False, and error. Other metrics and test cases continue. report.failures lists the failure.

During the run, the scope of an error selects "stop the run" or "fail the test case":

Scope Examples Outcome
JUDGE_CALL Rate limit, timeout, connection failure, provider failure, invalid request (HTTP 400, including a content-filter rejection), unusable judge reply, a reply that holds NaN The next fallback judge is tried. If no judge succeeds, the test case fails.
TEST_CASE Missing or unreadable attachment, missing local image, input error found during the run, operation the component cannot do for that test case The test case fails. Fallback judges are not tried.
JUDGE_SETUP Authentication, billing, unknown model The next fallback judge is tried. If every judge fails this way, the run stops. In a panel of judges, the other judges score the test case.
RUN Configuration, missing dependency, denied access (also an attachment URL that returns 401 or 403), invalid result shape, unexpected defect The run stops at once.

gllm_evals.utils.retry_policy.failure_scope returns the scope of an error. An error class that it does not list has RUN scope. An unexpected defect, such as a missing dictionary key, propagates as its own exception. Judge reply validation runs inside each fallback attempt. When gllm-evals rejects a reply, for example a reply that holds NaN, the result keeps the token usage of that reply. When gllm-inference rejects a reply first, for example a reply that is not JSON, its token usage is lost (see #8178). A NaN or infinite score that DeepEval computes from finite replies fails the test case without a fallback. The aggregate explanation includes the error code. The default judge uses get_default_retry_config() for transient provider failures.

report.fallbacks lists each test case where a fallback judge gave the score after the configured judge failed. The metric result lists the replaced judges in failed_judges. Each entry is a FailedJudge with the model_id of the judge that failed and its error. A fallback score is not a failure. A custom metric that does not apply can return a MetricResult with skipped=True. A skip is not a failure. To fail a test case, a custom metric raises an error. A returned MetricResult with an error is a EvalResultContractError and stops the run.

raise_on_error changes only the "fail the test case" outcome:

  • False (default): the run continues, and report.failures lists each failure.
  • True: the run stops at the first failed test case and raises its error. The debug_info of the error holds suite, test_case_index and test_case_id.

These changes address #7886 and the evals error policy in #7903. An unknown OpenRouter model has JUDGE_SETUP scope, and a refused connection has JUDGE_CALL scope. Direct metric callers must read result.error for service failures instead of an exception. A wrong test case type now raises EvalInputError instead of EvalUnsupportedOperationError.

Error types

Every error the SDK raises on purpose is a gllm_core.exceptions.BaseError with a stable code. gllm-evals' own errors are BaseEvalError subclasses with codes GLLM-EVAL-*, and each also inherits the closest built-in exception (for example EvalConfigurationError is a ValueError), so existing except ValueError blocks keep working. Errors from gllm-inference (GLLM-INF-*) pass through unchanged.

Class Code Typical cause
EvalConfigurationError GLLM-EVAL-CONFIGURATION Invalid option, metric setup, suite document or credentials setup
EvalInputError GLLM-EVAL-INPUT Invalid row, dataset content or attachment
EvalDependencyUnavailableError GLLM-EVAL-DEPENDENCY-UNAVAILABLE Missing or incompatible optional integration
EvalUnsupportedOperationError GLLM-EVAL-UNSUPPORTED-OPERATION Media, judge type or feature the component or judge does not support
EvalUnsupportedSyncOperationError GLLM-EVAL-UNSUPPORTED-SYNC-OPERATION A synchronous path was called on an async-only component. A subclass of EvalUnsupportedOperationError
EvalResourceNotFoundError GLLM-EVAL-RESOURCE-NOT-FOUND Missing file, worksheet or remote object
EvalAccessError GLLM-EVAL-ACCESS Authentication failed or permission denied
EvalConnectionError GLLM-EVAL-CONNECTION Connection could not be made or was lost; retryable
EvalTimeoutError GLLM-EVAL-TIMEOUT Request or retry deadline expired; retryable when a judge or metric timed out on one test case
EvalRateLimitError GLLM-EVAL-RATE-LIMIT A non-inference service throttled the request
EvalServiceError GLLM-EVAL-SERVICE A non-inference service failed or rejected the request
EvalServiceUnavailableError GLLM-EVAL-SERVICE-UNAVAILABLE A non-inference service failed temporarily (HTTP 500, 502, 503 and 504); retryable. A subclass of EvalServiceError
EvalIOError GLLM-EVAL-IO Local read, write or cleanup failed
EvalSerializationError GLLM-EVAL-SERIALIZATION SDK-owned artifact could not be encoded or decoded
EvalJudgeResponseError GLLM-EVAL-JUDGE-RESPONSE A judge answered, but the answer is unusable
EvalResultContractError GLLM-EVAL-RESULT-CONTRACT A metric or evaluator returned a result of the wrong shape
EvalAggregationError GLLM-EVAL-AGGREGATION Invalid aggregation, or no judge in a panel gave a usable result and the judges failed in different ways
EvalJudgesExhaustedError GLLM-EVAL-JUDGES-EXHAUSTED Two or more judges in a fallback chain failed in different ways
EvalExecutionError GLLM-EVAL-EXECUTION Unexpected failure; give support the reference ID

Each error also has recovery guidance (retryable, and retry_after_seconds when the service reported one) and, once it has been recorded, a reference_id.

Handle errors by class or code, never by message text. Messages are written for people and may change. Every message says what happened and then what to do next, whether it is a class's default message or a more specific one.

from gllm_core.exceptions import BaseError
from gllm_evals import evaluate
from gllm_evals.exceptions import EvalConfigurationError, EvalInputError

try:
    result = await evaluate(data="data.csv", evaluators=[evaluator])
except EvalInputError as error:           # the caller can fix the data
    print(error.code, error.message)
except EvalConfigurationError as error:   # the caller can fix the setup
    print(error.code, error.message)
except BaseError as error:                # any other normalized failure
    if error.recovery.get("retryable"):
        ...  # retry later
    raise

Service failures remain on the metric result as ErrorInfo, with the error code and reference ID. A failed metric makes aggregate_success=False, even when other metrics pass. Inspect each metric to distinguish a judge failure from a valid low score:

from gllm_evals.types import MetricResult

for row in result.results:
    for evaluator_result in row:
        for output in evaluator_result.values():
            for name, metric_result in output:
                if isinstance(metric_result, MetricResult) and metric_result.error:
                    print(name, metric_result.error.code, metric_result.error.reference_id)

Result fields, messages and log records never contain row content, prompts, file paths, URLs, credentials or the upstream error text. Handled failures are logged once on the gllm_evals.errors logger with the code in extra["error_code"]; the original exception stays available as __cause__ on a raised error. Direct Pydantic model construction (for example LLMTestCase(...)) still raises pydantic.ValidationError.

See examples/example_error_handling.py for a runnable walkthrough.

Architecture

Core Components

1. Evaluators

  • BaseEvaluator: Abstract base class for all evaluators - extend for any evaluation scenario
  • GEvalGenerationEvaluator: Production-ready GEval-backed evaluator for text generation quality with rule-based scoring

2. Metrics

  • BaseMetric: Abstract base class for metrics - create custom metrics for any domain
  • LMBasedMetric: Generic LM-powered metric evaluation with customizable prompts

3. Datasets

  • BaseDataset: Abstract base class for datasets - support any data format
  • DictDataset: Simple dictionary-based dataset implementation

4. Runner

  • Runner: Runner class for dataset evaluation

Metrics

Below is a list of metrics that are currently supported by the SDK.

Metric Description Type Score Range
LMBasedMetric An all purpose metric that can be used to evaluate any metric that can be expressed as a LM prompt LM-based -
DeepEvalGEvalMetric A versatile evaluation metric framework that can be used to create custom evaluation metrics with configurable criteria, evaluation steps, and rubrics LM-based -
GEvalCompletenessMetric A metric that can be used to evaluate the completeness of the generated output DeepEval GEval 1-3
GEvalRedundancyMetric A metric that can be used to evaluate the redundancy of the generated output DeepEval GEval 1-3
GEvalGroundednessMetric A metric that can be used to evaluate the groundedness of the generated output DeepEval GEval 1-3
GEvalLanguageConsistencyMetric A metric that can be used to evaluate language consistency between query and generated response DeepEval GEval 0-1
GEvalRefusalMetric A metric that can be used to evaluate refusal behavior from query and expected response DeepEval GEval 0-1
GEvalRefusalAlignmentMetric A metric that can be used to evaluate refusal alignment between expected and generated responses DeepEval GEval 0-1

Evaluators

Below is a list of evaluators that are currently supported by the SDK.

Evaluator Description Type
GEvalGenerationEvaluator An evaluator that can be used to evaluate the quality of the generated output LLM-based

Datasets

Below is a list of datasets that are currently supported by the SDK.

Dataset Description
DictDataset A dataset that loads data from a dictionary
HuggingFaceDataset A dataset that loads data from a HuggingFace dataset

Metadata

Release files for gllm-evals-binary 0.1.52

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

Inconsistent provenance

These files originate from different repositories or configurations.

We recommend inspecting each repository and configuration before proceeding. View details.

Built distributions (wheels)

Table of built distributions (wheels) for gllm-evals-binary 0.1.52
File Actions
gllm_evals_binary-0.1.52-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for gllm_evals_binary-0.1.52-cp313-cp313-win_amd64.whl
gllm_evals_binary-0.1.52-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details for gllm_evals_binary-0.1.52-cp313-cp313-manylinux_2_28_x86_64.whl
gllm_evals_binary-0.1.52-cp313-cp313-macosx_13_0_arm64.whl CPython 3.13 CPython 3.13 macOS 13.0+ ARM64 Details for gllm_evals_binary-0.1.52-cp313-cp313-macosx_13_0_arm64.whl
gllm_evals_binary-0.1.52-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for gllm_evals_binary-0.1.52-cp312-cp312-win_amd64.whl
gllm_evals_binary-0.1.52-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details for gllm_evals_binary-0.1.52-cp312-cp312-manylinux_2_28_x86_64.whl
gllm_evals_binary-0.1.52-cp312-cp312-macosx_13_0_arm64.whl CPython 3.12 CPython 3.12 macOS 13.0+ ARM64 Details for gllm_evals_binary-0.1.52-cp312-cp312-macosx_13_0_arm64.whl

Total release size: 21.0 MB

Release files / gllm_evals_binary-0.1.52-cp313-cp313-win_amd64.whl

Inconsistent provenance

This file belongs to a release with inconsistent provenance: the files in this release originate from different repositories or configurations.

We recommend inspecting each repository and configuration before proceeding. View details.

Download URL gllm_evals_binary-0.1.52-cp313-cp313-win_amd64.whl
Size 2.9 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
381617edfded4208c6594ce97487e77204f8adc4cb8d690411534d6930a9180b
BLAKE2b-256 checksum
How to use checksums
f973fa287f8fd14659d0bcf556fbf8c5ff70a98bc7841998fc4ebd751bed33c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / gllm_evals_binary-0.1.52-cp313-cp313-manylinux_2_28_x86_64.whl

Inconsistent provenance

This file belongs to a release with inconsistent provenance: the files in this release originate from different repositories or configurations.

We recommend inspecting each repository and configuration before proceeding. View details.

Download URL gllm_evals_binary-0.1.52-cp313-cp313-manylinux_2_28_x86_64.whl
Size 4.3 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
f869b25ec3c26d0c18a582280ceb80fd7644db5f2e35b0f032d926c44d6c31f7
BLAKE2b-256 checksum
How to use checksums
d6774aaab205ef4519b3b5775bdaa5e5e68e994b5afe56d6399dede2a9590299
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"AlmaLinux","version":"8.10","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by Google Cloud, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / gllm_evals_binary-0.1.52-cp313-cp313-macosx_13_0_arm64.whl

Inconsistent provenance

This file belongs to a release with inconsistent provenance: the files in this release originate from different repositories or configurations.

We recommend inspecting each repository and configuration before proceeding. View details.

Download URL gllm_evals_binary-0.1.52-cp313-cp313-macosx_13_0_arm64.whl
Size 3.4 MB
Tags CPython 3.13 macOS 13.0+ ARM64
SHA-256 checksum
How to use checksums
5bafb7fe633f01bd171f2de945333e580d84d13c45483e5ff7f7b54985841e75
BLAKE2b-256 checksum
How to use checksums
1cc0da0d075fecda3bd8fdd5e869fca0e833b439efd4ed05425860018b541d04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / gllm_evals_binary-0.1.52-cp312-cp312-win_amd64.whl

Inconsistent provenance

This file belongs to a release with inconsistent provenance: the files in this release originate from different repositories or configurations.

We recommend inspecting each repository and configuration before proceeding. View details.

Download URL gllm_evals_binary-0.1.52-cp312-cp312-win_amd64.whl
Size 2.9 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
b29c5ceae3152fc7a2a6aa9d47587414560b677a9cdd6381845e73b90a2f6328
BLAKE2b-256 checksum
How to use checksums
49dbb6651fa94b8ba8b9b85093a6fb55c1c5cbeed83e9f3e38c3387b3baa78ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / gllm_evals_binary-0.1.52-cp312-cp312-manylinux_2_28_x86_64.whl

Inconsistent provenance

This file belongs to a release with inconsistent provenance: the files in this release originate from different repositories or configurations.

We recommend inspecting each repository and configuration before proceeding. View details.

Download URL gllm_evals_binary-0.1.52-cp312-cp312-manylinux_2_28_x86_64.whl
Size 4.2 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
93b78d50d04bd53fcb9b73813ae423eabf99d6eba858f1e357a7b73529350c79
BLAKE2b-256 checksum
How to use checksums
4acb0b77dc972c10868df7a5e0f843c506f5736756eef38e2942c42749008c53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"AlmaLinux","version":"8.10","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by Google Cloud, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / gllm_evals_binary-0.1.52-cp312-cp312-macosx_13_0_arm64.whl

Inconsistent provenance

This file belongs to a release with inconsistent provenance: the files in this release originate from different repositories or configurations.

We recommend inspecting each repository and configuration before proceeding. View details.

Download URL gllm_evals_binary-0.1.52-cp312-cp312-macosx_13_0_arm64.whl
Size 3.3 MB
Tags CPython 3.12 macOS 13.0+ ARM64
SHA-256 checksum
How to use checksums
dd3ad873b5e27d8a0dd0368d6f49d84aa38e5476b09189729482913c6bce4c6c
BLAKE2b-256 checksum
How to use checksums
2786ca4b6bbd7e80058a2373c72c23d45b6ae708e02de27658a900599edf6c2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Security for gllm-evals-binary 0.1.52

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.

Inconsistent provenance

The release files originate from multiple, inconsistent repositories.

While this could reflect a legitimate choice by the project maintainers, it may also indicate that the release has been compromised.

Repository/Account

Select from 6 files

Attestation for gllm_evals_binary-0.1.52-cp313-cp313-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release
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