kiln_ai.adapters.eval

Evals

This module contains the code for evaluating the performance of a model.

The submodules contain:

  • BaseEval: each eval technique implements this interface.
  • G-Eval: an eval implementation, that implements G-Eval and LLM as Judge.
  • EvalRunner: a class that runs an full evaluation (many smaller evals jobs). Includes async parallel processing, and the ability to restart where it left off.
  • EvalRegistry: a registry for all eval implementations.

The datamodel for Evals is in the kiln_ai.datamodel.eval module.

Submodules are loaded lazily via PEP 562 __getattr__ so that importing kiln_ai.adapters.eval does not eagerly pull in every eval adapter and its transitive dependencies.

 1"""
 2# Evals
 3
 4This module contains the code for evaluating the performance of a model.
 5
 6The submodules contain:
 7
 8- BaseEval: each eval technique implements this interface.
 9- G-Eval: an eval implementation, that implements G-Eval and LLM as Judge.
10- EvalRunner: a class that runs an full evaluation (many smaller evals jobs). Includes async parallel processing, and the ability to restart where it left off.
11- EvalRegistry: a registry for all eval implementations.
12
13The datamodel for Evals is in the `kiln_ai.datamodel.eval` module.
14
15Submodules are loaded lazily via PEP 562 __getattr__ so that importing
16``kiln_ai.adapters.eval`` does not eagerly pull in every eval adapter and
17its transitive dependencies.
18"""
19
20from __future__ import annotations
21
22import importlib
23from typing import TYPE_CHECKING
24
25if TYPE_CHECKING:
26    from . import (
27        base_eval,
28        eval_runner,
29        g_eval,
30        registry,
31        v2_eval_code_eval,
32        v2_eval_contains,
33        v2_eval_exact_match,
34        v2_eval_llm_judge,
35        v2_eval_pattern_match,
36        v2_eval_set_check,
37        v2_eval_step_count_check,
38        v2_eval_tool_call_check,
39    )
40
41__all__ = [
42    "base_eval",
43    "eval_runner",
44    "g_eval",
45    "registry",
46    "v2_eval_code_eval",
47    "v2_eval_contains",
48    "v2_eval_exact_match",
49    "v2_eval_llm_judge",
50    "v2_eval_pattern_match",
51    "v2_eval_set_check",
52    "v2_eval_step_count_check",
53    "v2_eval_tool_call_check",
54]
55
56
57def __getattr__(name: str) -> object:
58    if name in __all__:
59        return importlib.import_module(f".{name}", __name__)
60    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
61
62
63def __dir__() -> list[str]:
64    return __all__