# Main Application Configuration
application_name: "JobSeekerTools"
debug_mode: true

# LLM Configuration (ChatLiteLLM unified)
llm_model: "gpt-4o-mini" # Model name routed via LiteLLM
llm_temperature: 0.7

# Concurrency
max_concurrent_tasks: 1 # Increased default slightly

# Enabled Data Sources - these are the services the researcher will attempt to use
enabled_data_sources:
  - "crunchbase"
  - "owler"
  - "glassdoor"
  - "uk-companies-house"
  - "trustpilot"
  - "linkedin"
  - "google_news" # Example: commented out to disable
  - "levelsfyi"

# API Key Configuration (Fallbacks if not set in environment variables)
# Environment variables (e.g., API__OPENAI_API_KEY) take precedence.
# These values are used if the corresponding environment variable is not found.
# For sensitive keys, it's strongly recommended to use environment variables or a secrets manager.
api_keys: {}
# firecrawl_api_key: "your_firecrawl_api_key_here_if_not_in_env"
# browserless_api_key: "your_browserless_api_key_here_if_not_in_env"
# openai_api_key: "sk-your_openai_api_key_here_if_not_in_env"
# anthropic_api_key: "sk-ant-your_anthropic_key_here_if_not_in_env"
# google_ai_api_key: "your_google_ai_key_here_if_not_in_env"
# serper_api_key: "your_serper_api_key_here_if_not_in_env"
# tavily_api_key: "your_tavily_api_key_here_if_not_in_env"
# bing_api_key: "your_bing_api_key_here_if_not_in_env"

# Logging Configuration
logging:
  level: "DEBUG" # DEBUG, INFO, WARNING, ERROR, CRITICAL
  verbose: true

# Rate Limiting Configuration (requests_per_minute, concurrent_requests)
# These are examples; adjust based on your API plan limits and expected usage.
rate_limits:
  firecrawl:
    requests_per_minute: 5
    concurrent_requests: 1
  browserless:
    requests_per_minute: 5
    concurrent_requests: 1
  openai: # Example for a specific OpenAI model tier
    requests_per_minute: 60 # Adjust based on your tier (e.g., Tier 1 might be 500 RPM for gpt-4o-mini)
    concurrent_requests: 3  # Adjust based on your tier (e.g., Tier 1 might be 5 RPD for gpt-4o-mini)
  anthropic:
    requests_per_minute: 60
    concurrent_requests: 5
  # google_ai:
  #   requests_per_minute: 60
  #   concurrent_requests: 5
  # serper:
  #   requests_per_minute: 6000 # Serper often has high free tier limits
  #   concurrent_requests: 10
  # tavily:
  #   requests_per_minute: 100
  #   concurrent_requests: 5
  # bing:
  #   requests_per_minute: 100 # Check current Bing API limits
  #   concurrent_requests: 3
  default: # Fallback for any service not explicitly listed
    requests_per_minute: 10
    concurrent_requests: 1

# Cache Configuration
cache:
  enabled: true
  database_path: "cache/company_research.db"
  raw_data_ttl_hours: 24  # 1 day
  summary_ttl_hours: 168  # 7 days
  auto_cleanup_enabled: true
  cleanup_interval_hours: 6  # Run cleanup every 6 hours

# Warning System Configuration
warnings:
  enabled: true
  min_severity: "WARNING"  # Options: INFO, WARNING, ERROR
  log_warnings: true
  collect_cache_warnings: false  # Set to true to collect cache-related warnings

# Retry Configuration
retry:
  enabled: true
  max_attempts: 2
  base_delay: 2.0  # Base delay in seconds
  max_delay: 60.0  # Maximum delay in seconds
  backoff_factor: 2.0  # Exponential backoff multiplier
  jitter: true  # Add random jitter to delays
  
  # Service-specific retry configurations
  services:
    firecrawl:
      max_attempts: 3
      base_delay: 2.0
      max_delay: 120.0
      backoff_factor: 2.0
    browserless:
      max_attempts: 2
      base_delay: 1.5
      max_delay: 60.0
      backoff_factor: 2.0
    crunchbase:
      max_attempts: 3
      base_delay: 2.0
      max_delay: 120.0
      backoff_factor: 2.0
    openai:
      max_attempts: 2
      base_delay: 1.0
      max_delay: 30.0
      backoff_factor: 2.0
    anthropic:
      max_attempts: 2
      base_delay: 1.0
      max_delay: 30.0
      backoff_factor: 2.0

# Observability Configuration
observability:
  enabled: true  # Master switch for observability features
  langfuse:
    # Keys can also be here as fallbacks if not in ENV, but ENV is preferred
    # public_key: "pk-lf-..."
    # secret_key: "sk-lf-..."
    # host: "https://cloud.langfuse.com"
    session_id_pattern: "company_research_{timestamp}"  # Pattern for session IDs
    trace_sample_rate: 1.0  # Sample rate for traces (0.0 to 1.0)
    debug_mode: false  # Enable debug mode for Langfuse client

# Service Endpoints (Example - not currently used by core researcher but demonstrates structure)
# service_endpoints:
#   auth_service: "http://localhost:8001/api"
#   data_service: "http://localhost:8002/v1"

# Session Storage
DATA_ROOT: "./data"
SQLITE_PATH: "./data/meta/sessions.db"
LOCK_DIR: "./data/locks"
RETENTION_DAYS: 7
GRACE_PERIOD_MINS: 10
# ROTATION_SALT: ""  # Optional: prefer APP_ROTATION_SALT env; if absent, SessionManager generates ephemeral in-memory
PERSIST_METADATA_DEFAULT: true

# Telegram Bot
telegram:
  bot_token: ""
  allowed_user_ids: []
  admin_user_ids: []
  max_text_preview_chars: 1500
  send_as_document_threshold_chars: 2000

# External Research Service Configuration
# Mirrors ExternalResearchConfig in code. If base_url is blank or enabled is false, the
# external research provider is skipped. Set base_url to the running FastAPI service
# (e.g., "http://localhost:8000").
external_research:
  enabled: true               # Master switch
  base_url: "http://localhost:8000"               # Base URL of the external research service
  http_timeout_seconds: 60    # Per HTTP request timeout
  poll_interval_seconds: 10   # Polling interval while waiting for completion
  max_minutes: 5              # Max minutes to wait before timing out
  ignore_cache_default: false # Submit with ignore_cache flag
  generate_report_default: true  # Ask external service to generate report.md
  refresh_sources_default: [] # List of source identifiers to force refresh (e.g. ["google_news"]) 