Pale Fire uses a centralized configuration system managed through config.py. All settings can be customized via environment variables in a .env file.
All configuration is defined in config.py, which:
- Loads environment variables from
.envfile - Provides sensible defaults for all settings
- Validates configuration on startup
- Offers helper functions for accessing configuration
NEO4J_URI=bolt://10.147.18.253:7687
NEO4J_USER=neo4j
NEO4J_PASSWORD=passwordThese settings are required for Pale Fire to connect to your Neo4j database.
# Choose 'ollama' or 'openai'
LLM_PROVIDER=ollama# Required by Graphiti (can be placeholder for Ollama)
OPENAI_API_KEY=your-api-key-hereOLLAMA_BASE_URL=http://10.147.18.253:11434/v1
OLLAMA_MODEL=deepseek-r1:7b
OLLAMA_SMALL_MODEL=deepseek-r1:7b
OLLAMA_VERIFICATION_MODEL=gpt-oss:latest # Optional: separate model for NER verification (defaults to OLLAMA_MODEL)
OLLAMA_VERIFICATION_TIMEOUT=300 # Timeout in seconds for verification requests (default: 300 = 5 minutes)
OLLAMA_API_KEY=ollama # PlaceholderNotes:
OLLAMA_VERIFICATION_MODELis optional. If not specified, the system will useOLLAMA_MODELfor verification. This allows you to use a specialized, lightweight model (likegpt-oss:latest) specifically for NER verification while using a different model for other LLM operations.OLLAMA_VERIFICATION_TIMEOUTsets the timeout for LLM verification requests. Increase this value if you're processing large numbers of entities or using slower models. Default is 300 seconds (5 minutes).
OPENAI_BASE_URL=https://api.openai.com/v1
OPENAI_MODEL=gpt-4
OPENAI_SMALL_MODEL=gpt-3.5-turbo# Choose 'ollama' or 'openai'
EMBEDDER_PROVIDER=ollamaOLLAMA_EMBEDDING_MODEL=nomic-embed-text
OLLAMA_EMBEDDING_DIM=768
OLLAMA_EMBEDDING_BASE_URL=http://10.147.18.253:11434/v1OPENAI_EMBEDDING_MODEL=text-embedding-ada-002
OPENAI_EMBEDDING_DIM=1536# Default search method: 'standard', 'connection', 'question-aware'
DEFAULT_SEARCH_METHOD=question-awareAvailable methods:
- standard: Basic semantic search
- connection: Adds connection-based ranking
- question-aware: Full 5-factor ranking with question-type detection (recommended)
# Number of results to retrieve before reranking
SEARCH_RESULT_LIMIT=20
# Number of top results to return to user
SEARCH_TOP_K=5Pale Fire uses a multi-factor ranking system. Configure the weight of each factor:
WEIGHT_CONNECTION=0.15 # Node connectivity importance
WEIGHT_TEMPORAL=0.20 # Time-based relevance
WEIGHT_QUERY_MATCH=0.20 # Query term matching
WEIGHT_ENTITY_TYPE=0.15 # Entity type relevanceImportant: The sum of all weights must be ≤ 1.0. The remaining weight is automatically assigned to semantic similarity.
Example calculation:
Semantic weight = 1.0 - (0.15 + 0.20 + 0.20 + 0.15) = 0.30
- WEIGHT_CONNECTION (0.0-0.3): Higher values favor well-connected entities (hubs)
- WEIGHT_TEMPORAL (0.0-0.3): Higher values favor entities with matching time periods
- WEIGHT_QUERY_MATCH (0.0-0.4): Higher values favor exact term matches
- WEIGHT_ENTITY_TYPE (0.0-0.3): Higher values favor entities matching question type
- Semantic (remaining): Automatically calculated, represents embedding similarity
# Enable/disable NER enrichment
NER_ENABLED=true
# Use spaCy (more accurate) or pattern-based (faster) NER
NER_USE_SPACY=true
# spaCy model to use
SPACY_MODEL=en_core_web_smNER (Named Entity Recognition) enriches episodes with entity types:
- PER: Person names
- LOC: Locations
- ORG: Organizations
- DATE: Dates and time periods
- GPE: Geopolitical entities
- POSITION: Job titles/roles
LOG_LEVEL=INFO
LOG_FORMAT=%(asctime)s - %(name)s - %(levelname)s - %(message)s
LOG_DATE_FORMAT=%Y-%m-%d %H:%M:%SAvailable log levels: DEBUG, INFO, WARNING, ERROR, CRITICAL
# Prefix for episode names
EPISODE_NAME_PREFIX=Episode
# Use current time for episode timestamps
USE_CURRENT_TIME=trueThe config.py module provides helper functions:
Validates all required settings and raises ValueError if any are missing or invalid.
try:
config.validate_config()
except ValueError as e:
print(f"Configuration error: {e}")Returns LLM configuration based on the selected provider:
llm_cfg = config.get_llm_config()
# Returns: {'api_key': '...', 'model': '...', 'small_model': '...', 'base_url': '...'}Returns embedder configuration based on the selected provider:
emb_cfg = config.get_embedder_config()
# Returns: {'api_key': '...', 'embedding_model': '...', 'embedding_dim': 768, 'base_url': '...'}Displays the current configuration in a formatted table:
python palefire-cli.py configOutput:
================================================================================
⚙️ PALE FIRE CONFIGURATION
================================================================================
Neo4j URI: bolt://10.147.18.253:7687
Neo4j User: neo4j
LLM Provider: ollama
LLM Model: deepseek-r1:7b
LLM Verification Model: gpt-oss:latest
LLM Base URL: http://10.147.18.253:11434/v1
Embedder Provider: ollama
Embedder Model: nomic-embed-text
Embedder Dimensions: 768
Search Configuration:
Default Method: question-aware
Result Limit: 20
Top K: 5
Ranking Weights:
Connection: 0.15
Temporal: 0.20
Query Match: 0.20
Entity Type: 0.15
Semantic: 0.30
================================================================================
cd /path/to/palefire
cp env.example .envnano .env # or your preferred editorpython palefire-cli.py configpython palefire-cli.py query "Who was the California Attorney General in 2020?"# Use specific, stable models
OLLAMA_MODEL=llama2:13b
OLLAMA_EMBEDDING_MODEL=nomic-embed-text
# Conservative search limits
SEARCH_RESULT_LIMIT=30
SEARCH_TOP_K=10
# Balanced weights
WEIGHT_CONNECTION=0.15
WEIGHT_TEMPORAL=0.20
WEIGHT_QUERY_MATCH=0.20
WEIGHT_ENTITY_TYPE=0.15
# Enable NER for better accuracy
NER_ENABLED=true
NER_USE_SPACY=true
# Production logging
LOG_LEVEL=INFO# Faster models
OLLAMA_MODEL=deepseek-r1:7b
OLLAMA_SMALL_MODEL=deepseek-r1:7b
# Smaller search limits for speed
SEARCH_RESULT_LIMIT=10
SEARCH_TOP_K=3
# Debug logging
LOG_LEVEL=DEBUG
# Disable NER for faster iteration
NER_ENABLED=false# Larger search space
SEARCH_RESULT_LIMIT=50
SEARCH_TOP_K=20
# Experiment with weights
WEIGHT_CONNECTION=0.10
WEIGHT_TEMPORAL=0.15
WEIGHT_QUERY_MATCH=0.25
WEIGHT_ENTITY_TYPE=0.10
# Semantic = 0.40 (remaining)
# Enable detailed logging
LOG_LEVEL=DEBUGIf your .env file isn't being read:
- Check file location (must be in palefire directory)
- Verify file name is exactly
.env(notenv.txtor.env.example) - Check file permissions:
chmod 600 .env
If you get configuration errors:
# Check current config
python palefire-cli.py config
# Validate weights sum
python -c "import config; config.validate_config()"If Neo4j connection fails:
- Verify Neo4j is running:
neo4j status - Check URI format:
bolt://host:portorneo4j://host:port - Test credentials:
cypher-shell -u neo4j -p password
If LLM or embedder fails:
- Verify Ollama is running:
curl http://localhost:11434/api/tags - Check model is downloaded:
ollama list - Test API endpoint:
curl http://localhost:11434/v1/models
You can extend config.py with your own settings:
# In config.py
CUSTOM_SETTING = os.environ.get('CUSTOM_SETTING', 'default_value')
def get_custom_config():
return {
'setting1': CUSTOM_SETTING,
'setting2': 'value2'
}Override configuration at runtime:
import config
# Override for this session
config.SEARCH_TOP_K = 10
config.WEIGHT_CONNECTION = 0.25Use different .env files for different environments:
# Development
cp env.example .env.dev
# Edit .env.dev
# Production
cp env.example .env.prod
# Edit .env.prod
# Load specific environment
ln -sf .env.dev .env # or .env.prod- CLI Guide - Command-line interface documentation
- Setup Guide - Installation and setup instructions
- Quick Reference - Quick command reference