Store model credentials in .env files
.env file instead of using inline credentials, allowing you to follow best practices for security when running Jupyter Notebooks.
March 25, 2026
Initialize the ValidMind Library with the code snippet unique to each model per document to connect your environment to the ValidMind Platform, ensuring test results are uploaded to the correct model and automatically populated in the right document.
The ValidMind Library requires access to the data sources where relevant datasets and model files are stored in order to help you run tests.
In order to upload test results from the ValidMind Library to the ValidMind Platform, provide the following information through a code snippet copied from the platform:
| Argument | Description |
|---|---|
api_host |
The location of the ValidMind API |
api_key |
The account API key |
api_secret |
The account secret key |
document |
The model document identifier key |
model |
The model identifier |
Retrieve your code snippet for your model's selected document from the ValidMind Platform:
In the left sidebar, click Inventory.
Select a model by clicking on it or find your model by applying a filter or searching for it.4
In the left sidebar that appears for your model, click Getting Started.
Select the document you want to automatically upload test results to.5
Click Copy snippet to clipboard.
A template must already be applied to your selected document to populate test results in the ValidMind Platform. Attempting to initialize the library with a document that does not have a template applied will result in an error.
To install the library:
To initialize the library, paste the code snippet with the client integration details directly into your development source code, replacing this example with your own:
To also enable monitoring, add monitoring=True to the vm.init method in your code snippet. 7
After you run the code snippet in your environment, the ValidMind Library will connect to your model and selected document in the ValidMind Platform. Automate your workflow by using the library to run tests, then seamlessly upload your test results to the platform.
After installing the ValidMind Library,8 you'll want to periodically make sure you are on the latest version to access any new features and other enhancements:
In your Jupyter Notebook or developer environment, retrieve the information for the currently installed version of the library:
If the version returned is lower than the version indicated in our production open-source code,9 run the following command:
9 ValidMind GitHub: validmind-library/validmind/__version__.py