ExUnit integration for LLM evaluations.
Usage
defmodule MyApp.RAGEvalTest do
use ExUnit.Case
use Tribunal.ExUnit
@moduletag :eval
test "response is faithful" do
response = MyApp.RAG.query("What's the return policy?")
assert response =~ "30 days"
assert_faithful response, context: @docs, threshold: 0.8
end
endDataset-Driven Tests
defmodule MyApp.RAGEvalTest do
use ExUnit.Case
use Tribunal.ExUnit
@moduletag :eval
tribunal_dataset "test/evals/datasets/questions.json",
provider: {MyApp.RAG, :query}
endRun with: mix test --only eval
Summary
Functions
Evaluates a zero-arity callback one or more times inside a normal ExUnit test.
Generates tests from a dataset file.
Functions
Evaluates a zero-arity callback one or more times inside a normal ExUnit test.
:input and a non-empty :expected assertion list are required. :repeat
defaults to 1 and :pass_rule defaults to :all.
Generates tests from a dataset file.
Options
:provider-{Module, :function}to call for each input:defaults- Default assertion options