GEPA.Adapters.GenericRAG.Metrics (GEPA v0.3.0)

Copy Markdown View Source

Deterministic retrieval and generation metrics for the Generic RAG adapter.

Summary

Functions

answer_confidence(answer)

answer_relevance(answer, context)

combined_rag_score(retrieval_metrics, generation_metrics, opts \\ [])

@spec combined_rag_score(map(), map(), keyword()) :: float()

evaluate_generation(generated_answer, ground_truth, context \\ "")

@spec evaluate_generation(String.t(), String.t(), String.t()) :: map()

evaluate_retrieval(retrieved_docs, relevant_doc_ids)

@spec evaluate_retrieval([map()], [term()]) :: map()

exact_match?(generated, truth)

extract_phrases(text)

@spec extract_phrases(term()) :: MapSet.t(String.t())

Extract simple contiguous two- and three-token phrases.

faithfulness(answer, context)

normalize_text(text)

@spec normalize_text(term()) :: String.t()

Normalize text for exact-match style comparisons.

simple_bleu(generated, truth)

token_f1(generated, truth)