| # Environment Configuration Template | |
| # Copy this file to .env and fill in your actual values | |
| # ============================================================================= | |
| # Core Application Settings | |
| # ============================================================================= | |
| ENVIRONMENT=development | |
| DEBUG=true | |
| LOG_LEVEL=INFO | |
| APP_NAME=Context-Aware Research Assistant | |
| APP_VERSION=1.0.0 | |
| # ============================================================================= | |
| # API Keys (Required) | |
| # ============================================================================= | |
| # Google Gemini API Key (Required) | |
| # Get your free API key from: https://makersuite.google.com/app/apikey | |
| GOOGLE_API_KEY=your_gemini_api_key_here | |
| # Google Custom Search API (Required for web search) | |
| # Get from: https://console.cloud.google.com/ | |
| GOOGLE_CSE_ID=your_custom_search_engine_id_here | |
| # Together AI API Key (Required for Llama models) | |
| # Sign up at: https://together.ai/ | |
| TOGETHER_API_KEY=your_together_api_key_here | |
| # Tavily Search API Key (Optional but recommended) | |
| # Sign up at: https://tavily.com/ | |
| TAVILY_API_KEY=your_tavily_api_key_here | |
| # LangSmith (Optional - for monitoring and debugging) | |
| LANGSMITH_API_KEY=your_langsmith_api_key_here | |
| LANGCHAIN_TRACING_V2=true | |
| LANGCHAIN_ENDPOINT=https://api.smith.langchain.com | |
| LANGCHAIN_PROJECT=context-aware-research-app | |
| # ============================================================================= | |
| # Application Configuration | |
| # ============================================================================= | |
| # Supabase Configuration (Optional - for database features) | |
| # Sign up at: https://supabase.com/ | |
| SUPABASE_URL=your_supabase_project_url_here | |
| SUPABASE_KEY=your_supabase_anon_key_here | |
| SUPABASE_SERVICE_KEY=your_supabase_service_role_key_here | |
| DATABASE_URL=postgresql://postgres:your_password@db.your-project-ref.supabase.co:5432/postgres | |
| # Server Configuration | |
| API_HOST=0.0.0.0 | |
| API_PORT=8000 | |
| API_WORKERS=1 | |
| FRONTEND_PORT=8501 | |
| # Request Settings | |
| API_TIMEOUT=60 | |
| MAX_SOURCES=10 | |
| MAX_RETRIES=3 | |
| REQUEST_TIMEOUT=300 | |
| # Rate Limiting | |
| REQUESTS_PER_MINUTE=60 | |
| RATE_LIMIT_PER_MINUTE=30 | |
| BURST_LIMIT=100 | |
| # ============================================================================= | |
| # Research Configuration | |
| # ============================================================================= | |
| # Search Settings | |
| DEFAULT_SEARCH_DEPTH=2 | |
| MAX_SEARCH_RESULTS=20 | |
| CONTENT_FETCH_TIMEOUT=30 | |
| MAX_CONTENT_LENGTH=50000 | |
| # Quality Thresholds | |
| MIN_CONFIDENCE_SCORE=5.0 | |
| MIN_WORD_COUNT=100 | |
| # Context Management | |
| MAX_CONTEXT_HISTORY=5 | |
| CONTEXT_SUMMARY_LENGTH=1000 | |
| # ============================================================================= | |
| # LLM Configuration | |
| # ============================================================================= | |
| # Model Selection | |
| DEFAULT_LLM_PROVIDER=gemini | |
| GEMINI_MODEL=gemini-1.5-flash | |
| PRIMARY_MODEL=gemini-1.5-flash | |
| FALLBACK_MODEL=gemini-1.5-flash | |
| ANALYSIS_MODEL=gemini-1.5-pro | |
| # Token Limits | |
| MAX_TOKENS=4096 | |
| MAX_INPUT_TOKENS=30000 | |
| MAX_OUTPUT_TOKENS=8000 | |
| TEMPERATURE=0.1 | |
| # ============================================================================= | |
| # Cache and Performance | |
| # ============================================================================= | |
| # Caching | |
| CACHE_TTL=3600 | |
| ENABLE_CACHE=true | |
| CACHE_TYPE=memory | |
| # Performance | |
| PARALLEL_REQUESTS=5 | |
| BATCH_SIZE=10 | |
| ENABLE_STREAMING=true | |
| # ============================================================================= | |
| # Security Settings | |
| # ============================================================================= | |
| # CORS | |
| CORS_ORIGINS=["http://localhost:8501", "http://127.0.0.1:8501"] | |
| CORS_METHODS=["GET", "POST", "OPTIONS"] | |
| CORS_HEADERS=["*"] | |
| # Security Headers | |
| ENABLE_SECURITY_HEADERS=true | |
| SECRET_KEY=your_secret_key_here_change_in_production | |
| # ============================================================================= | |
| # Monitoring and Observability | |
| # ============================================================================= | |
| # Logging | |
| LOG_FILE=logs/app.log | |
| LOG_ROTATION=daily | |
| LOG_RETENTION_DAYS=30 | |
| # Metrics | |
| ENABLE_METRICS=true | |
| METRICS_PORT=9090 | |
| # ============================================================================= | |
| # Feature Flags | |
| # ============================================================================= | |
| # Experimental Features | |
| ENABLE_PDF_EXPORT=false | |
| ENABLE_WORD_CLOUD=false | |
| ENABLE_ANALYTICS_DASHBOARD=false | |
| ENABLE_VOICE_INTERFACE=false | |
| # Data Sources | |
| ENABLE_ACADEMIC_SEARCH=false | |
| ENABLE_NEWS_SEARCH=true | |
| ENABLE_SOCIAL_MEDIA=false | |
| # ============================================================================= | |
| # Development Settings | |
| # ============================================================================= | |
| # Development Only | |
| RELOAD_ON_CHANGE=true | |
| ENABLE_DEBUG_TOOLBAR=true | |
| SHOW_SQL_QUERIES=false | |
| MOCK_EXTERNAL_APIS=false | |
| # Testing | |
| ENABLE_TEST_MODE=false | |
| # ============================================================================= | |
| # Production Overrides | |
| # ============================================================================= | |
| # Uncomment these for production deployment | |
| # ENVIRONMENT=production | |
| # DEBUG=false | |
| # LOG_LEVEL=WARNING | |
| # ENABLE_SECURITY_HEADERS=true | |
| # ENABLE_RATE_LIMITING=true | |
| # CACHE_TYPE=redis | |
| # REDIS_URL=redis://localhost:6379/0 | |
| # ============================================================================= | |
| # STREAMLIT CLOUD DEPLOYMENT | |
| # ============================================================================= | |
| # When deploying to Streamlit Cloud, add these to your app secrets: | |
| # | |
| # Required secrets: | |
| # GOOGLE_API_KEY = "your_gemini_api_key_here" | |
| # GOOGLE_CSE_ID = "your_custom_search_engine_id_here" | |
| # TOGETHER_API_KEY = "your_together_api_key_here" | |
| # TAVILY_API_KEY = "your_tavily_api_key_here" | |
| # LANGSMITH_API_KEY = "your_langsmith_api_key_here" | |
| # | |
| # Optional secrets: | |
| # SUPABASE_URL = "your_supabase_project_url_here" | |
| # SUPABASE_KEY = "your_supabase_anon_key_here" | |
| # SUPABASE_SERVICE_KEY = "your_supabase_service_role_key_here" | |
| # | |
| # Configuration secrets: | |
| # LANGCHAIN_TRACING_V2 = "true" | |
| # LANGCHAIN_PROJECT = "context-aware-research-app" | |
| # DEFAULT_LLM_PROVIDER = "gemini" | |
| # GEMINI_MODEL = "gemini-1.5-flash" | |
| # MAX_TOKENS = "4096" | |
| # TEMPERATURE = "0.1" | |
| # | |
| # ============================================================================= | |
| # API SETUP INSTRUCTIONS | |
| # ============================================================================= | |
| # | |
| # 1. Google API Setup: | |
| # a) Go to: https://console.cloud.google.com/ | |
| # b) Create new project or select existing | |
| # c) Enable "Custom Search API" | |
| # d) Go to "Credentials" → "Create Credentials" → "API Key" | |
| # e) Copy the API key to GOOGLE_API_KEY | |
| # f) Go to: https://cse.google.com/cse/ | |
| # g) Create a new search engine | |
| # h) Copy the Search Engine ID to GOOGLE_CSE_ID | |
| # | |
| # 2. Together AI Setup: | |
| # a) Sign up at: https://together.ai/ | |
| # b) Go to "API Keys" section | |
| # c) Generate new API key | |
| # d) Copy to TOGETHER_API_KEY | |
| # | |
| # 3. LangSmith Setup (Optional): | |
| # a) Sign up at: https://smith.langchain.com/ | |
| # b) Go to "Settings" → "API Keys" | |
| # c) Generate new API key | |
| # d) Copy to LANGSMITH_API_KEY | |
| # | |
| # 4. Tavily Setup (Optional): | |
| # a) Sign up at: https://tavily.com/ | |
| # b) Get API key from dashboard | |
| # c) Copy to TAVILY_API_KEY | |
| # | |
| # 5. Supabase Setup (Optional): | |
| # a) Sign up at: https://supabase.com/ | |
| # b) Create new project | |
| # c) Go to "Settings" → "API" | |
| # d) Copy URL and keys to respective variables | |