Skip to main content
The Evaluation Service in the Galtea SDK allows you to manage evaluations for assessing your products. This Service is exposed by the galtea.evaluations object.
Remember that we will be using the galtea object. More information here.

Quick Example

from galtea import Galtea

galtea = Galtea(api_key="YOUR_API_KEY")

# Create a single-turn evaluation
evaluations = galtea.evaluations.create_single_turn(
    version_id="YOUR_VERSION_ID",
    test_case_id="YOUR_TEST_CASE_ID",
    actual_output="Paris is the capital of France.",
    metrics=[
        {"name": "Faithfulness"},
        {"name": "Answer Relevancy"}
    ]
)

print(f"Created {len(evaluations)} evaluations")
for evaluation in evaluations:
    print(f"Metric: {evaluation.metric_name}")
    print(f"Score: {evaluation.score}")
    print(f"Reason: {evaluation.reason}")

# List all evaluations for a session
session_evaluations = galtea.evaluations.list(
    session_id="YOUR_SESSION_ID"
)
print(f"Total evaluations: {len(session_evaluations)}")

Service Methods

Evaluation

The assessment of an evaluation using a specific metric’s criteria