Tests can be generated automatically by Galtea providing a knowledge file as shown here.

In this guide, we will show you how to create custom tests, where you can define the test cases.

Creating Tests with the SDK

Tests group the test cases that will evaluate your product’s performance. The Galtea SDK provides methods to create both quality tests and red teaming tests.

If you already have a prepared test file, you can upload it directly to the Galtea platform.

from galtea import Galtea

# Initialize the SDK with your API key
galtea = Galtea(api_key="YOUR_API_KEY")

# Upload test to Galtea Platform
test = galtea.tests.create(
    name="product-knowledge-test",
    type="QUALITY",  # Options: "QUALITY" or "RED_TEAMING"
    product_id="YOUR_PRODUCT_ID",
    test_file_path="path/to/your/test_file.csv"
)

print(f"Test created with ID: {test.id}")

The test file should follow the appropriate structure for either quality tests or red teaming tests.

If the file is not correctly formatted, the test cases will not be created. But they can be created manually following this example.

Next Steps

After creating a test: