feat: Add Oghma RAG Proxy for SkyrimNet lore injection

RAG proxy that intercepts SkyrimNet LLM requests and enriches them
with relevant Tamrielic lore from CHIM's Oghma Infinium database.

Features:
- FastAPI proxy compatible with OpenAI API
- ChromaDB semantic search for lore retrieval
- NPC profile extraction from SkyrimNet prompts
- Google Sheets ingestion for CHIM's Oghma data
- Kubernetes deployment manifests
- Debug endpoint for RAG operation monitoring

Collections ingested to iris-dev ChromaDB:
- oghma_lore: 1951 entries (scholar knowledge)
- oghma_basic: 1949 entries (commoner knowledge)
- oghma_visual: 1151 entries (Omnisight perception)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
dafit
2026-03-30 23:22:46 +02:00
parent 62dcee5fbf
commit 3926ab676f
20 changed files with 2367 additions and 0 deletions

76
oghma-proxy/config.yaml Normal file
View File

@@ -0,0 +1,76 @@
# 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