Configuration Overview
Configuration Overview
Section titled “Configuration Overview”The Rawi Command Line Interface (Rawi CLI) uses configuration settings to determine how it interacts with AI providers and manages your sessions. Proper configuration ensures optimal performance and seamless integration with your workflow.
Configuration Components
Section titled “Configuration Components”Rawi configuration includes:
- Credentials: API keys and authentication tokens for AI providers
- Provider and Model: Which AI service and specific model to use
- Profiles: Named configurations for different use cases
- Generation Settings: Temperature, max tokens, and language preferences
- Provider Settings: Custom endpoints, regions, and provider-specific options
Configuration Precedence
Section titled “Configuration Precedence”Rawi CLI reads configuration from multiple sources in order of precedence:
- Command line options – Highest priority (e.g.,
--provider
,--model
,--api-key
) - Environment variables – System-level settings (e.g.,
OPENAI_API_KEY
,RAWI_PROFILE
) - Profile configuration files – User-defined profiles in
~/.config/rawi/profiles/
- Default profile – Fallback configuration used when no profile is specified
Quick Start Configuration
Section titled “Quick Start Configuration”-
Run interactive configuration:
Terminal window rawi configureThis will guide you through:
- Selecting an AI provider
- Choosing a model
- Entering credentials
- Setting preferences
-
Verify your setup:
Terminal window rawi info -
Test your configuration:
Terminal window rawi ask "Hello, world!"
-
Configure OpenAI provider:
Terminal window rawi configure --provider openai --model gpt-4o --api-key sk-your-key -
Set generation parameters:
Terminal window rawi configure --temperature 0.7 --max-tokens 2048 --language english -
Test the configuration:
Terminal window rawi ask "What is artificial intelligence?"
Profile Management
Section titled “Profile Management”Profiles allow you to maintain different configurations for various use cases:
Creating Profiles
Section titled “Creating Profiles”# Work profile with enterprise settingsrawi configure --profile work \ --provider azure \ --model gpt-4 \ --resource-name company-openai \ --api-key work-key
# Personal profile for experimentationrawi configure --profile personal \ --provider openai \ --model gpt-3.5-turbo \ --api-key personal-key \ --temperature 0.8
# Local profile for privacyrawi configure --profile local \ --provider ollama \ --model llama2 \ --base-url http://localhost:11434
Profile Examples by Use Case
Section titled “Profile Examples by Use Case”Development Profiles
Section titled “Development Profiles”# Code review profile (detailed analysis)rawi configure --profile code-review \ --provider anthropic \ --model claude-3-5-sonnet-20241022 \ --temperature 0.1 \ --max-tokens 4000
# Quick development profile (fast responses)rawi configure --profile dev-quick \ --provider openai \ --model gpt-3.5-turbo \ --temperature 0.3 \ --max-tokens 1000
Content Creation Profiles
Section titled “Content Creation Profiles”# Creative writing profilerawi configure --profile creative \ --provider openai \ --model gpt-4 \ --temperature 0.9 \ --max-tokens 3000
# Technical documentation profilerawi configure --profile docs \ --provider anthropic \ --model claude-3-5-sonnet-20241022 \ --temperature 0.3 \ --max-tokens 2500
Using Profiles
Section titled “Using Profiles”# Use specific profilerawi ask "Review this code" --profile code-review
# List all profilesrawi configure --list
# Show profile detailsrawi configure --profile work --show
# Set default profilerawi configure --profile work --set-default
Provider-Specific Configuration
Section titled “Provider-Specific Configuration”OpenAI Configuration
Section titled “OpenAI Configuration”# Basic OpenAI setuprawi configure --provider openai --model gpt-4o --api-key sk-your-key
# Advanced OpenAI setuprawi configure --provider openai \ --model gpt-4o \ --api-key sk-your-key \ --temperature 0.7 \ --max-tokens 2048 \ --base-url https://api.openai.com/v1
Anthropic Configuration
Section titled “Anthropic Configuration”# Claude setuprawi configure --provider anthropic \ --model claude-3-5-sonnet-20241022 \ --api-key sk-ant-your-key \ --temperature 0.1 \ --max-tokens 4000
Azure OpenAI Configuration
Section titled “Azure OpenAI Configuration”# Azure OpenAI setuprawi configure --provider azure \ --model gpt-4 \ --api-key your-azure-key \ --resource-name your-resource \ --base-url https://your-resource.openai.azure.com \ --api-version 2024-10-01-preview
Local Providers (Ollama)
Section titled “Local Providers (Ollama)”# Ollama setuprawi configure --provider ollama \ --model llama2 \ --base-url http://localhost:11434
# Custom Ollama modelrawi configure --provider ollama \ --model codellama:13b \ --base-url http://localhost:11434
Environment Variables
Section titled “Environment Variables”You can configure Rawi using environment variables for automation and CI/CD:
API Keys
Section titled “API Keys”# Common API keysexport OPENAI_API_KEY="sk-your-openai-key"export ANTHROPIC_API_KEY="sk-ant-your-anthropic-key"export GOOGLE_API_KEY="your-google-key"
# Azure-specificexport AZURE_OPENAI_API_KEY="your-azure-key"export AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com"
# AWS Bedrockexport AWS_ACCESS_KEY_ID="your-access-key"export AWS_SECRET_ACCESS_KEY="your-secret-key"export AWS_REGION="us-east-1"
Default Settings
Section titled “Default Settings”# Default profile and providerexport RAWI_PROFILE="work"export RAWI_PROVIDER="openai"export RAWI_MODEL="gpt-4"
# Generation settingsexport RAWI_TEMPERATURE="0.7"export RAWI_MAX_TOKENS="2048"export RAWI_LANGUAGE="english"
Configuration Files
Section titled “Configuration Files”Rawi stores configuration in structured files:
Directory Structure
Section titled “Directory Structure”~/.config/rawi/├── config.json # Global settings├── profiles/│ ├── default.json # Default profile│ ├── work.json # Work profile│ └── personal.json # Personal profile├── history/ # Session history├── templates/ # Custom templates└── cache/ # Temporary cache
Profile File Example
Section titled “Profile File Example”{ "name": "work", "provider": "azure", "model": "gpt-4", "apiKey": "your-azure-key", "baseUrl": "https://company-openai.openai.azure.com", "resourceName": "company-openai", "temperature": 0.3, "maxTokens": 2048, "language": "english", "createdAt": "2024-01-15T10:30:00Z", "lastUsed": "2024-01-20T15:45:00Z"}
Advanced Configuration
Section titled “Advanced Configuration”Custom Base URLs
Section titled “Custom Base URLs”# Custom OpenAI endpointrawi configure --provider openai \ --base-url https://custom-openai-proxy.com/v1 \ --api-key your-key
# Local LM Studiorawi configure --provider openai \ --base-url http://localhost:1234/v1 \ --model local-model
Regional Configuration
Section titled “Regional Configuration”# AWS Bedrock in different regionrawi configure --provider bedrock \ --region eu-west-1 \ --model anthropic.claude-3-sonnet-20240229-v1:0
# Azure in specific regionrawi configure --provider azure \ --model gpt-4 \ --base-url https://westeurope-openai.openai.azure.com
Proxy Configuration
Section titled “Proxy Configuration”# HTTP proxyexport HTTP_PROXY="http://proxy.company.com:8080"export HTTPS_PROXY="http://proxy.company.com:8080"
# Custom CA bundlerawi configure --ca-bundle /path/to/custom-ca.pem
Configuration Best Practices
Section titled “Configuration Best Practices”Security
Section titled “Security”- Use Environment Variables: Store API keys in environment variables for production
- Profile Separation: Use different profiles for different security contexts
- Regular Rotation: Rotate API keys regularly
- Local Providers: Use Ollama for sensitive data processing
Performance
Section titled “Performance”- Model Selection: Choose appropriate models for your use case
- Token Limits: Set reasonable token limits to control costs
- Temperature Settings: Lower for factual tasks, higher for creative work
- Profile Optimization: Create task-specific profiles
Organization
Section titled “Organization”- Descriptive Names: Use clear profile names like
work-gpt4
,personal-claude
- Environment Profiles: Separate dev, staging, and production configurations
- Team Standards: Standardize configurations across team members
- Documentation: Document your profile configurations
Troubleshooting Configuration
Section titled “Troubleshooting Configuration”Common Issues
Section titled “Common Issues”Configuration not saved:
# Check permissionsls -la ~/.config/rawi/# Create directory if missingmkdir -p ~/.config/rawi/profiles/
API key not working:
# Test configurationrawi configure --test# Verify API key formatrawi configure --show
Provider connection fails:
# Check network connectivitycurl -s https://api.openai.com/v1/models -H "Authorization: Bearer $OPENAI_API_KEY"# Try different providerrawi configure --provider anthropic
Configuration Validation
Section titled “Configuration Validation”# Test current configurationrawi ask "test" --verbose
# Validate specific profilerawi configure --profile work --test
# Check provider statusrawi info --providers
Migration and Backup
Section titled “Migration and Backup”Export Configuration
Section titled “Export Configuration”# Export all profilesrawi configure --export > rawi-config-backup.json
# Backup configuration directorycp -r ~/.config/rawi/ ~/rawi-backup-$(date +%Y%m%d)/
Import Configuration
Section titled “Import Configuration”# Import configurationrawi configure --import rawi-config-backup.json
# Restore from backupcp -r ~/rawi-backup-20240115/ ~/.config/rawi/
Next Steps
Section titled “Next Steps”After configuring Rawi:
- Learn about specific providers: Supported Providers
- Explore environment variables: Environment Variables
- Set up act templates: Act Templates
- Configure advanced options: Advanced Settings
- Start using Rawi: Quick Start Guide