# Oghma RAG Proxy Configuration
# Copy to config.local.yaml and customize for your environment

proxy:
  host: 0.0.0.0
  port: 8100
  workers: 1

upstream:
  # OpenRouter (cloud)
  url: https://openrouter.ai/api/v1
  api_key: ${OPENROUTER_API_KEY}

  # Local vLLM alternative:
  # url: http://localhost:8000/v1
  # api_key: ""

  timeout: 120  # seconds
  stream_timeout: 300  # for streaming responses

chromadb:
  host: iris-dev.eachpath.local
  port: 35000
  collection_lore: oghma_lore
  collection_basic: oghma_basic

retrieval:
  max_results: 5
  min_score: 0.55
  embedding_model: all-MiniLM-L6-v2  # Match SkyrimNet memory embeddings

injection:
  enabled: true
  position: after_bio  # after_bio | before_conversation | system_suffix

  # Injection template
  template: |
    ## Relevant Lore Knowledge

    Based on your background, you would know:

    {% for entry in lore_entries %}
    - **{{ entry.topic }}**: {{ entry.content }}
    {% endfor %}

    Remember: Reference this knowledge naturally in conversation when relevant.

npc_extraction:
  # Regex patterns for extracting NPC info from prompts
  patterns:
    bio_header: '## (?P<name>[\w\s]+) Bio\n- Gender: (?P<gender>\w+)\n- Race: (?P<race>\w+)'
    role_context: 'You are (?P<name>[^,]+), (?:a |an )?(?P<race>\w+)'
    faction_member: 'member of (?:the )?(?P<faction>[\w\s]+)'
    location_in: '(?:in|at|near) (?P<location>Whiterun|Windhelm|Solitude|Riften|Markarth|Morthal|Dawnstar|Winterhold|Falkreath)'

logging:
  level: INFO
  format: json  # json | console
  log_injections: true

  # Log decisions to phoebe for analysis
  phoebe:
    enabled: true
    host: phoebe-dev.eachpath.local
    port: 35432
    database: nimmerverse
    table: oghma_proxy_decisions

cache:
  enabled: true
  ttl_seconds: 300  # Cache lore lookups for 5 minutes
  max_size: 1000    # Max cached queries

metrics:
  enabled: true
  endpoint: /metrics  # Prometheus-compatible
