โ๏ธ Configurationยถ
CellMage offers multiple ways to configure its behavior, from environment variables to runtime commands. This flexibility allows you to set up your environment once and then make temporary adjustments as needed.
๐ง Configuration Methodsยถ
1. Environment Variablesยถ
Environment variables provide a system-wide way to configure CellMage. All environment variables use the CELLMAGE_ prefix.
# Example: Setting environment variables in your shell
export CELLMAGE_API_KEY="your_openai_api_key"
export CELLMAGE_DEFAULT_MODEL="gpt-4o"
export CELLMAGE_PERSONAS_DIRS="~/my_personas,~/project_personas"
2. .env Fileยถ
You can also place a .env file in your working directory with your configuration:
# Example .env file
CELLMAGE_API_KEY=your_openai_api_key
CELLMAGE_DEFAULT_MODEL=gpt-4o
CELLMAGE_PERSONAS_DIRS=~/my_personas,~/project_personas
This approach is particularly useful for project-specific settings and avoids exposing sensitive information in your environment or code.
3. Runtime Configurationยถ
Use the %llm_config magic command to change settings during a session:
# View current configuration
%llm_config --status
# Change the default model
%llm_config --model gpt-4o-mini
# Set parameter overrides for the session
%llm_config --set-override temperature 0.7
See the Magic Commands documentation for a complete reference of all available configuration commands.
4. Model Mapping Fileยถ
CellMage supports model aliasing through a YAML configuration file named cellmage_models.yml, which allows you to create shorthand names for models:
# Example cellmage_models.yml
mappings:
g4: gpt-4o
g4m: gpt-4o-mini
g3: gpt-3.5-turbo
claud3h: claude-3-haiku
claud3s: claude-3-sonnet
CellMage will automatically look for this file in your working directory, or you can specify a custom path with the CELLMAGE_MODEL_MAPPINGS_FILE environment variable.
๐ Configuration Optionsยถ
Hereโs the complete list of configuration options organized by category:
Core Settingsยถ
Environment Variable |
Description |
Default Value |
Type |
|---|---|---|---|
|
Your LLM API key (OpenAI or compatible) |
None (Required) |
string |
|
API base URL |
https://api.openai.com/v1 |
string |
|
Default model to use |
gpt-4.1-nano |
string |
|
Default persona to use on startup |
None |
string |
Resource Directoriesยถ
Environment Variable |
Description |
Default Value |
Type |
|---|---|---|---|
|
Primary directory containing persona definitions |
./llm_personas |
string |
|
Additional directories to search for personas (comma-separated) |
[] |
string/list |
|
Primary directory containing snippets |
./llm_snippets |
string |
|
Additional directories to search for snippets (comma-separated) |
[] |
string/list |
|
Directory for saving conversations |
./llm_conversations |
string |
Storage Configurationยถ
Environment Variable |
Description |
Default Value |
Type |
|---|---|---|---|
|
Storage backend type (โsqliteโ, โmemoryโ, or โfileโ) |
sqlite |
string |
|
Path to SQLite database |
~/.cellmage/conversations.db |
string |
|
Whether to store raw API request/response data |
False |
boolean |
|
Whether to automatically save conversations |
True |
boolean |
|
Filename for auto-saved conversations |
autosaved_conversation |
string |
Model Mapping Configurationยถ
Environment Variable |
Description |
Default Value |
Type |
|---|---|---|---|
|
Path to YAML file containing model name mappings |
None |
string |
|
Automatically look for cellmage_models.yml in notebook directory |
True |
boolean |
Adapter Configurationยถ
Environment Variable |
Description |
Default Value |
Type |
|---|---|---|---|
|
LLM adapter type (direct or langchain) |
direct |
string |
|
Whether to automatically display chat messages |
True |
boolean |
Logging Configurationยถ
Environment Variable |
Description |
Default Value |
Type |
|---|---|---|---|
|
Global logging level |
INFO |
string |
|
Console logging level |
WARNING |
string |
|
Log file path |
cellmage.log |
string |
๐ Service-Specific Configurationยถ
Jira Integrationยถ
JIRA_URL=https://your-company.atlassian.net
JIRA_USER_EMAIL=your.email@company.com
JIRA_API_TOKEN=your_jira_api_token
Confluence Integrationยถ
CONFLUENCE_URL=https://your-company.atlassian.net/wiki
# Confluence uses Jira credentials
JIRA_USER_EMAIL=your.email@company.com
JIRA_API_TOKEN=your_jira_api_token
GitHub Integrationยถ
GITHUB_TOKEN=your_github_personal_access_token
GitLab Integrationยถ
GITLAB_URL=https://gitlab.com
GITLAB_PAT=your_gitlab_personal_access_token
# Or alternatively:
GITLAB_PRIVATE_TOKEN=your_gitlab_personal_access_token
Google Docs Integrationยถ
# OAuth configuration (default)
CELLMAGE_GDOCS_AUTH_TYPE=oauth
CELLMAGE_GDOCS_TOKEN_PATH=~/.cellmage/gdocs_token.pickle
CELLMAGE_GDOCS_CREDENTIALS_PATH=~/.cellmage/gdocs_credentials.json
# Or service account configuration
CELLMAGE_GDOCS_AUTH_TYPE=service_account
CELLMAGE_GDOCS_SERVICE_ACCOUNT_PATH=~/.cellmage/gdocs_service_account.json
# Optional: Override the scopes (comma-separated)
CELLMAGE_GDOCS_SCOPES=https://www.googleapis.com/auth/documents.readonly
๐ Custom Headersยถ
CellMage supports custom headers for LLM requests using the CELLMAGE_HEADER_ prefix:
# Add custom header to LLM requests
CELLMAGE_HEADER_X_MY_CUSTOM_HEADER=my_value
# Will send header: x-my-custom-header: my_value
# Example: Allow certain entity types in redaction services
CELLMAGE_HEADER_X_REDACT_ALLOW=LOCATION,PERSON
Header names are automatically converted from environment variable format to proper HTTP header format (lowercase with hyphens instead of underscores).
๐ Directory Handlingยถ
For CELLMAGE_PERSONAS_DIRS and CELLMAGE_SNIPPETS_DIRS, you can specify multiple directories using commas or semicolons:
# Comma-separated example
export CELLMAGE_PERSONAS_DIRS="~/global_personas,./project_personas,/shared/team_personas"
# Semicolon-separated example (useful in Windows environments)
export CELLMAGE_PERSONAS_DIRS="~/global_personas;./project_personas;/shared/team_personas"
CellMage will automatically search all specified directories when looking for personas or snippets.
๐ก Tips and Best Practicesยถ
Sensitive Information: Keep API keys in environment variables or
.envfiles, never hardcode them in notebooksProject-Specific Settings: Use
.envfiles for project-specific settingsRuntime Adjustments: Use
%llm_configfor temporary changes during a sessionCheck Status: Use
%llm_config --statusto verify your current configurationCustom Model Aliases: Create short aliases for your frequently used models in
cellmage_models.ymlMulti-Directory Setup: For team environments, consider using a combination of global, team, and project-specific directories for personas and snippets
๐ Runtime Configuration with %llm_configยถ
The %llm_config magic command provides a flexible way to configure CellMage during a session without modifying environment variables or .env files. Here are some common use cases:
# View current configuration
%llm_config --status
# Change the model for the session
%llm_config --model gpt-4o
# Switch to a different persona
%llm_config --persona code_expert
# Set parameter overrides
%llm_config --set-override temperature 0.7
%llm_config --set-override max_tokens 1000
# Clear all overrides
%llm_config --clear-overrides
# Enable auto-saving
%llm_config --auto-save
# View model name mappings
%llm_config --list-mappings
# Add a new model alias
%llm_config --add-mapping g4t gpt-4-turbo
For a complete reference of all available %llm_config options, see the Magic Commands documentation.