- Compare performance across versions.
- Roll back to previous versions.
- Pin experiments to specific versions.
- Track which version is used in production.
Pin a specific version
Every prompt save creates a new version with a unique ID. Pin a version in production code so later saves don’t affect your application until you update the pin. Both ways of using a prompt in code accept aversion parameter.
To pin a version you invoke on Braintrust:
version parameter, every one of these uses the latest version.
Use environments
Environments separate dev, staging, and production configurations. Assign a prompt version to an environment, then load the version assigned to that environment from your code. To assign a prompt to an environment:- UI
- CLI
- API
- Go to Prompts.
- Open the prompt.
- Click the icon.
- Select an environment.
- SDK
- API
Invoke an environment-pinned prompt with invoke()
Invoke an environment-pinned prompt with invoke()
invoke() does not accept an environment parameter. To execute an environment-pinned prompt server-side via invoke(), resolve the version with loadPrompt() first and pass it to invoke():loadPrompt() ran. Re-call loadPrompt() if you need to pick up environment reassignments.Next steps
- Manage environments to separate dev, staging, and production across prompts, datasets, and functions.
- Use prompts in code to invoke pinned or environment-scoped prompts.
- Manage prompts to duplicate prompts and customize the Prompts page.
- Monitor deployments to track prompt performance in production.