|
1 |
| -# Coming Soon |
| 1 | +# Configuration |
| 2 | + |
| 3 | +The `guidellm` application can be configured using command-line arguments, environment variables, or a `.env` file. This page details the file-based and environment variable configuration options. |
| 4 | + |
| 5 | +## Configuration Methods |
| 6 | + |
| 7 | +Settings are loaded with the following priority (highest priority first): |
| 8 | + |
| 9 | +1. Command-line arguments. |
| 10 | +2. Environment variables. |
| 11 | +3. Values in a `.env` file in the directory where the command is run. |
| 12 | +4. Default values. |
| 13 | + |
| 14 | +## Environment Variable Format |
| 15 | + |
| 16 | +All settings can be configured using environment variables. The variables must be prefixed with `GUIDELLM__`, and nested settings are separated by a double underscore `__`. |
| 17 | + |
| 18 | +For example, to set the `api_key` for the `openai` backend, you would use the following environment variable: |
| 19 | + |
| 20 | +```bash |
| 21 | +export GUIDELLM__OPENAI__API_KEY="your-api-key" |
| 22 | +``` |
| 23 | + |
| 24 | +### Target and Backend Configuration |
| 25 | + |
| 26 | +You can configure the connection to the target system using environment variables. This is an alternative to using the `--target-*` command-line flags. |
| 27 | + |
| 28 | +| Environment Variable | Description | Example | |
| 29 | +| ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | |
| 30 | +| `GUIDELLM__OPENAI__BASE_URL` | The endpoint of the target system. Equivalent to the `--target` CLI option. | `export GUIDELLM__OPENAI__BASE_URL="http://localhost:8080"` | |
| 31 | +| `GUIDELLM__OPENAI__API_KEY` | The API key to use for bearer token authentication. | `export GUIDELLM__OPENAI__API_KEY="your-secret-api-key"` | |
| 32 | +| `GUIDELLM__OPENAI__BEARER_TOKEN` | The full bearer token to use for authentication. | `export GUIDELLM__OPENAI__BEARER_TOKEN="Bearer your-secret-token"` | |
| 33 | +| `GUIDELLM__OPENAI__HEADERS` | A JSON string representing a dictionary of headers to send to the target. These headers will override any default headers. | `export GUIDELLM__OPENAI__HEADERS='{"Authorization": "Bearer my-token"}'` | |
| 34 | +| `GUIDELLM__OPENAI__ORGANIZATION` | The OpenAI organization to use for requests. | `export GUIDELLM__OPENAI__ORGANIZATION="org-12345"` | |
| 35 | +| `GUIDELLM__OPENAI__PROJECT` | The OpenAI project to use for requests. | `export GUIDELLM__OPENAI__PROJECT="proj-67890"` | |
| 36 | +| `GUIDELLM__OPENAI__VERIFY` | Set to `false` or `0` to disable certificate verification. | `export GUIDELLM__OPENAI__VERIFY=false` | |
| 37 | +| `GUIDELLM__OPENAI__MAX_OUTPUT_TOKENS` | The default maximum number of tokens to request for completions. | `export GUIDELLM__OPENAI__MAX_OUTPUT_TOKENS=2048` | |
| 38 | + |
| 39 | +### General HTTP Settings |
| 40 | + |
| 41 | +These settings control the behavior of the underlying HTTP client. |
| 42 | + |
| 43 | +| Environment Variable | Description | |
| 44 | +| ------------------------------------ | ------------------------------------------------------------------------------- | |
| 45 | +| `GUIDELLM__REQUEST_TIMEOUT` | The timeout in seconds for HTTP requests. Defaults to 300. | |
| 46 | +| `GUIDELLM__REQUEST_HTTP2` | Set to `true` or `1` to enable HTTP/2 support. Defaults to true. | |
| 47 | +| `GUIDELLM__REQUEST_FOLLOW_REDIRECTS` | Set to `true` or `1` to allow the client to follow redirects. Defaults to true. | |
| 48 | + |
| 49 | +### Using a `.env` file |
| 50 | + |
| 51 | +You can also place these variables in a `.env` file in your project's root directory: |
| 52 | + |
| 53 | +```dotenv |
| 54 | +# .env file |
| 55 | +GUIDELLM__OPENAI__BASE_URL="http://localhost:8080" |
| 56 | +GUIDELLM__OPENAI__API_KEY="your-api-key" |
| 57 | +GUIDELLM__OPENAI__HEADERS='{"Authorization": "Bearer my-token"}' |
| 58 | +GUIDELLM__OPENAI__VERIFY=false |
| 59 | +``` |
0 commit comments