4.2 KiB
Configuration
Edison provides several ways to configure its behavior to suit your needs. This guide explains the available configuration options and how to set them.
Configuration File
The primary way to configure Edison is through the edison.yaml file. This file is located in the Edison installation directory.
flowchart LR
A[edison.yaml] --> B[OpenAI Settings]
A --> C[Safety Settings]
A --> D[Shell Settings]
B --> B1[Model]
B --> B2[Temperature]
B --> B3[Max Tokens]
B --> B4[API Key]
C --> C1[Safety Mode]
D --> D1[Shell Type]
style A fill:#f9d5e5,stroke:#333,stroke-width:2px
style B fill:#eeeeee,stroke:#333,stroke-width:2px
style C fill:#d3f6db,stroke:#333,stroke-width:2px
style D fill:#d3f6f5,stroke:#333,stroke-width:2px
Sample Configuration File
Here's an example edison.yaml file with all available options:
# OpenAI API settings
model: gpt-4o-mini
temperature: 0
max_tokens: 500
openai_api_key: your_api_key_here # Optional, can be set via environment variable
streaming: true # Enable streaming command generation
# Safety settings
safety: true
# UI settings
show_generating_prefix: true # Show "Generating command:" prefix during generation
# Shell settings
shell: bash # Options: bash, zsh, powershell.exe, cmd.exe, etc.
Configuration Options
OpenAI API Settings
| Option | Description | Default | Possible Values |
|---|---|---|---|
| model | OpenAI model to use | gpt-4o-mini | gpt-4o-mini, gpt-3.5-turbo, gpt-4, etc. |
| temperature | Randomness of completions | 0 | 0.0 - 1.0 |
| max_tokens | Maximum tokens in response | 500 | 1 - 4096 |
| openai_api_key | Your OpenAI API key | - | Valid API key |
| streaming | Enable streaming command generation | true | true, false |
Safety Settings
| Option | Description | Default | Possible Values |
|---|---|---|---|
| safety | Require confirmation before execution | true | true, false |
UI Settings
| Option | Description | Default | Possible Values |
|---|---|---|---|
| show_generating_prefix | Show "Generating command:" prefix during generation | true | true, false |
Shell Settings
| Option | Description | Default | Possible Values |
|---|---|---|---|
| shell | Shell to use for command execution | (system default) | bash, zsh, powershell.exe, cmd.exe, etc. |
Setting Your OpenAI API Key
There are several ways to set your OpenAI API key, listed in order of precedence:
-
Environment variable:
- Linux/macOS:
export OPENAI_API_KEY=<yourkey> - Windows:
$env:OPENAI_API_KEY="<yourkey>"
- Linux/macOS:
-
API key file: Create a file at
~/.openai.apikeycontaining only your API key. -
Configuration file: Add your key to the
edison.yamlfile:openai_api_key: your_api_key_here
Viewing Current Configuration
To view your current configuration:
edison -c
This will display all current settings, including where your OpenAI API key is being loaded from (but will not display the key itself for security reasons).
Configuration Load Order
Edison loads configuration in this order:
- Default values
- Values from
edison.yaml - Environment variables (for API key)
- Command-line arguments
Later sources override earlier ones.
Recommended Configurations
For Beginners
model: gpt-4o-mini
temperature: 0
max_tokens: 500
safety: true
For Advanced Users
model: gpt-4 # If you have access
temperature: 0.2 # Slightly more creative
max_tokens: 1000 # For more detailed responses
safety: true # Keep safety on unless you really know what you're doing
For Performance
model: gpt-3.5-turbo # Fastest option if you need maximum speed
temperature: 0
max_tokens: 300 # Lower limits can be faster
Troubleshooting Configuration Issues
- Configuration not applying: Ensure your
edison.yamlfile is in the correct location - API key not recognized: Check for extra whitespace or quotes in your key
- Model not available: Verify you have access to the specified model in your OpenAI account