Skip to main content
The Test Case Service in the Galtea SDK allows you to manage test-cases for evaluating your products. This Service is exposed by the galtea.test_cases 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 test case
test_case = galtea.test_cases.create(
    test_id="YOUR_TEST_ID",
    input="What is the capital of France?",
    expected_output="Paris",
    context="France is a country in Europe. The capital is Paris.",
    variant="geography_question"
)

print(f"Created test case: {test_case.id}")
print(f"Input: {test_case.input}")
print(f"Expected: {test_case.expected_output}")

# List all test cases for a test
test_cases = galtea.test_cases.list(test_id="YOUR_TEST_ID")
print(f"Total test cases: {len(test_cases)}")

for tc in test_cases:
    print(f"- {tc.variant}: {tc.input[:50]}...")

Service Methods

Test Case

Each challenge in a test for evaluating product performance