Deploy to environments
In this guide we will demonstrate how to create and use environments.
Environments enable you to deploy model configurations and experiments, making them accessible via API, while also maintaining a streamlined production workflow. These environments are created at the organizational level and can be utilized on a per-project basis.
Create an environment
Go to your Organization’s Environments page.
Click the + Environment button to open the new environment dialog.
Assign a custom name to the environment.
Click Create.
![](https://fdr-prod-docs-files-public.s3.amazonaws.com/https://humanloop.docs.buildwithfern.com/docs/2024-07-19T19:46:40.702Z/assets/images/cb0f398-image.png)
Deploying to an environment
Prerequisites
- You already have a Prompt — if not, please follow our Prompt creation guide first.
- Ensure that your project has existing model configs that you wish to use.
To deploy a model config to an environment:
Navigate to the Dashboard of your project.
Click the dropdown menu of the environment.
![](https://fdr-prod-docs-files-public.s3.amazonaws.com/https://humanloop.docs.buildwithfern.com/docs/2024-07-19T19:46:40.702Z/assets/images/1b04c4c-image.png)
Click the Change deployment button
Select a version
From the model configs or experiments within that project, click on the one that you wish to deploy to the target environment
![](https://fdr-prod-docs-files-public.s3.amazonaws.com/https://humanloop.docs.buildwithfern.com/docs/2024-07-19T19:46:40.702Z/assets/images/a4a5484-image.png)
Click the Deploy button.
Calling the model in the environment
Prerequisites
- You have already deployed either a chat or completion model config - if not, please follow the steps in either the Generate chat responses or Generate completions guides.
- You have multiple environments, with a model config deployed in a non-default environment. See the Deploying to an environment section above.
The following steps assume you’re using an OpenAI model and that you’re
calling a chat
workflow. The steps needed to target a specific environment
for a completion
workflow are similar.
Navigate to the Models tab of your Humanloop project.
Click the dropdown menu of the environment you wish to use.
Click the Use API menu option.
A dialog will open with code snippets.
Select the language you wish to use (e.g. Python, TypeScript). The value of environment
parameter is the name of environment you wish to target via the chat-deployed call.
An example of this can be seen in the code below.
![](https://fdr-prod-docs-files-public.s3.amazonaws.com/https://humanloop.docs.buildwithfern.com/docs/2024-07-19T19:46:40.702Z/assets/images/21369d3-image.png)
Updating the default environment
Only Enterprise customers can update their default environment
Prerequisites
- You have multiple environments - if not first go through the Create an environment section.
Every organization will have a default environment. This can be updated by the following:
Go to your Organization’s Environments page.
Click on the dropdown menu of an environment that is not already the default.
Click the Make default option
A dialog will open asking you if you are certain this is a change you want to make. If so, click the Make default button.
Verify the default tag has moved to the environment you selected.
![](https://fdr-prod-docs-files-public.s3.amazonaws.com/https://humanloop.docs.buildwithfern.com/docs/2024-07-19T19:46:40.702Z/assets/images/962074b-image.png)