trulens.feedback.jury¶
trulens.feedback.jury
¶
LLM Jury β ensemble multiple LLM judges into a single feedback callable.
A single LLM judge is noisy and subject to intra-model bias. Ensembling a panel of diverse judges (a "jury") improves reliability, reduces bias, and can be cheaper when smaller models are used.
Classes¶
Jury
¶
Ensemble multiple LLM judges into a single feedback callable.
Jury wraps N provider instances, calls the same named method on each
in parallel, and aggregates their scores using a configurable strategy.
Because Jury.__call__ exposes the same parameter names as the
underlying provider method, it plugs directly into
Metric(implementation=jury) β no changes to Metric, Selector, or
the evaluation pipeline are needed.
__call__ always returns (score, {"reason": ...}), matching the
_with_cot_reasons convention so per-juror breakdowns flow into
FeedbackCall.meta["reason"] and are visible in OTEL spans and the
dashboard without any UI changes.
| PARAMETER | DESCRIPTION |
|---|---|
jurors
|
Non-empty list of |
method
|
Name of the feedback method to call on each juror, e.g.
TYPE:
|
aggregation
|
How to combine individual juror scores. Accepts a
strategy name ( |
weights
|
Per-juror weights for |
threshold
|
Binarisation threshold for
TYPE:
|
max_workers
|
Maximum parallel threads. Defaults to
TYPE:
|
Example::
from trulens.core import Metric
from trulens.feedback.jury import Jury
from trulens.providers.openai import OpenAI
from trulens.providers.litellm import LiteLLM
jury = Jury(
jurors=[
OpenAI(model_engine="gpt-4o-mini"),
OpenAI(model_engine="gpt-4.1-mini"),
LiteLLM(model_engine="anthropic/claude-3-haiku-20240307"),
],
method="relevance",
aggregation="median",
)
m = Metric(implementation=jury, name="Jury Relevance").on_input().on_output()
Functions¶
__call__
¶
Evaluate the same arguments in parallel across all jurors.
Always returns (score, {"reason": ...}), matching the
_with_cot_reasons convention. Per-juror scores and any CoT
explanations are embedded in the reason string so they appear in
OTEL spans and the dashboard automatically.