General configuration


Settings and profiles for your private GPT

The configuration of your private GPT server is done thanks to settings files (more precisely settings.yaml). These text files are written using the YAML syntax.

While privateGPT is distributing safe and universal configuration files, you might want to quickly customize your privateGPT, and this can be done using the settings files.

This project is defining the concept of profiles (or configuration profiles). This mechanism, using your environment variables, is giving you the ability to easily switch between configuration you’ve made.

A typical use case of profile is to easily switch between LLM and embeddings. To be a bit more precise, you can change the language (to French, Spanish, Italian, English, etc) by simply changing the profile you’ve selected; no code changes required!

PrivateGPT is configured through profiles that are defined using yaml files, and selected through env variables. The full list of properties configurable can be found in settings.yaml.

How to know which profiles exist

Given that a profile foo_bar points to the file settings-foo_bar.yaml and vice-versa, you simply have to look at the files starting with settings and ending in .yaml.

How to use an existing profiles

Please note that the syntax to set the value of an environment variables depends on your OS. You have to set environment variable PGPT_PROFILES to the name of the profile you want to use.

For example, on linux and macOS, this gives:

$export PGPT_PROFILES=my_profile_name_here

Windows Powershell(s) have a different syntax, one of them being:

$set PGPT_PROFILES=my_profile_name_here

If the above is not working, you might want to try other ways to set an env variable in your window’s terminal.

Once you’ve set this environment variable to the desired profile, you can simply launch your privateGPT, and it will run using your profile on top of the default configuration.


Additional details on the profiles are described in this section

Environment variable PGPT_SETTINGS_FOLDER

The location of the settings folder. Defaults to the root of the project. Should contain the default settings.yaml and any other settings-{profile}.yaml.

Environment variable PGPT_PROFILES

By default, the profile definition in settings.yaml is loaded. Using this env var you can load additional profiles; format is a comma separated list of profile names. This will merge settings-{profile}.yaml on top of the base settings file.

For example: PGPT_PROFILES=local,cuda will load settings-local.yaml and settings-cuda.yaml, their contents will be merged with later profiles properties overriding values of earlier ones like settings.yaml.

During testing, the test profile will be active along with the default, therefore settings-test.yaml file is required.

Environment variables expansion

Configuration files can contain environment variables, they will be expanded at runtime.

Expansion must follow the pattern ${VARIABLE_NAME:default_value}.

For example, the following configuration will use the value of the PORT environment variable or 8001 if it’s not set. Missing variables with no default will produce an error.

2 port: ${PORT:8001}