Environment
Configure your environment for Instructor
Environment Configuration
Instructor uses environment variables for configuration settings and API keys. The library comes with
a .env-dist
template file that lists all supported variables.
You can copy it to .env
(or merge with your .env
file) and fill in your values.
Alternatively, you can set the variables directly in your environment
Check setup instructions for more details on how to set up your environment and how it can be done automatically with the Instructor’s CLI tool.
Keep your .env file secure and never commit it to version control. For production, consider using your environment’s secrets management system.
LLM Provider API Keys
Instructor supports multiple LLM providers.
Configure the ones you plan to use:
Only configure the services you plan to use; others can remain empty.
Other API Keys in .env-dist
Instructor comes with bundled add-on capabilities that use other APIs for various purposes.
You can find them in the .env-dist
file. They are not required for the core functionality of Instructor.
Instructor Configuration Directory Path
Instructor uses a configuration directory to store its settings, e.g. LLM provider configurations.
You can set the path to this directory in your .env
file:
This tells Instructor where to find its configuration files, if it has not been configured manually
via Settings
class. The path is relative to the vendor directory where Instructor is installed.
INSTRUCTOR_CONFIG_PATH
is set automatically if you use the Instructor CLI tool to publish assets.