Instructor comes with a set of configuration files and prompt templates that you can publish to your project directory.

There are 2 ways to set up the location of Instructor’s configuration directory:

  • Using Settings class method setPath()
  • Using environment variable (recommended)

To check how to publish configuration files to your project see Setup section.

Setting Configuration Path via Settings Class

You can set Instructor configuration path using the Settings::setPath() method:

<?php
use Cognesy\Instructor\Utils\Settings;

Settings::setPath('/path/to/config');
?>

Setting Configuration Path via Environment Variable

You can set the path to Instructor’s configuration directory in your .env file:

INSTRUCTOR_CONFIG_PATH='/path/to/config/'

Configuration Location Resolution

Instructor uses a configuration directory with a set of .php files to store its settings, e.g. LLM provider configurations.

Instructor will look for its configuration location in the following order:

  • If static variable value $path in Settings class is set, it will use it,
  • If INSTRUCTOR_CONFIG_PATH environment variable is set, it will use its value,
  • Finally, it will default to the directory, which is bundled with Instructor package (under /config) and contains default set of configuration files.