Skip to main content

Installation

Make sure you have the Vals Python Package installed
pip install valsai

Authentication

Create an API key in the web app, then set it as an environment variable:
export VALS_API_KEY="your-api-key"
Alternatively, you can configure credentials programmatically:
from vals import configure_credentials

configure_credentials(api_key="your-api-key")

EU Region

If you are using the EU platform, set the VALS_REGION environment variable:
export VALS_REGION="europe"
Or configure it programmatically:
configure_credentials(api_key="your-api-key", in_eu=True)

Custom Endpoint

For custom deployments, you can set the VALS_ENDPOINT environment variable:
export VALS_ENDPOINT="https://your-org.platform.vals.ai"
Or pass it programmatically:
configure_credentials(api_key="your-api-key", endpoint="https://your-org.platform.vals.ai")

Prerequisites

This guide assumes you are familiar with the basic concepts of Test Suites, Tests, Checks, etc. If not, see the Test Suite Creation Page.

Async Note

All SDK functions are asynchronous, so you will need to call them from an asynchronous context. For example:
import asyncio
from vals import Suite

async def main():
    suite = await Suite.from_id("your-suite-id")
    print(suite.title)

asyncio.run(main())
See the async docs for more information.