f3530cf4ae
Mid-size models (gpt-4o-mini, qwen2.5-14b) resist persona instructions — help-desk closers and feelings-disclaimers leak through regardless. Route live chat to a stronger model while keeping bulk consolidation cheap: - config: CHAT_MODEL (default gpt-4o), distinct from CLOUD_MODEL (gpt-4o-mini) - llm.complete gains a `model` override; chat.respond uses chat_model on cloud, consolidation paths keep cloud_model - persona: reword the "no sign-off" rule so genuine questions are welcome and only reflexive customer-service closers are discouraged Verified: on gpt-4o she owns her mood without disclaimers and drops most help-desk tails — clearly more in-character than mini/qwen. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
44 lines
1.6 KiB
Python
44 lines
1.6 KiB
Python
"""Environment-driven configuration."""
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
from dataclasses import dataclass
|
|
from pathlib import Path
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class Config:
|
|
local_base_url: str
|
|
local_model: str
|
|
mi50_base_url: str # OpenAI-compatible llama.cpp server on the MI50 box
|
|
mi50_model: str
|
|
openai_api_key: str
|
|
cloud_model: str # cloud model for bulk/consolidation work (cheap)
|
|
chat_model: str # cloud model for live chat (stronger; persona fidelity)
|
|
embed_backend: str # "cloud" (OpenAI) or "local" (Ollama)
|
|
embed_model: str # OpenAI embedding model
|
|
local_embed_model: str # Ollama embedding model
|
|
summary_backend: str # "local" or "cloud" — backend used to compact memory
|
|
db_path: Path
|
|
|
|
|
|
def load() -> Config:
|
|
return Config(
|
|
local_base_url=os.getenv("LOCAL_BASE_URL", "http://localhost:11434"),
|
|
local_model=os.getenv("LOCAL_MODEL", "qwen2.5:7b-instruct"),
|
|
mi50_base_url=os.getenv("MI50_BASE_URL", "http://10.0.0.42:8080/v1"),
|
|
mi50_model=os.getenv("MI50_MODEL", "local-gpu"),
|
|
openai_api_key=os.getenv("OPENAI_API_KEY", ""),
|
|
cloud_model=os.getenv("CLOUD_MODEL", "gpt-4o-mini"),
|
|
chat_model=os.getenv("CHAT_MODEL", "gpt-4o"),
|
|
embed_backend=os.getenv("EMBED_BACKEND", "cloud").lower(),
|
|
embed_model=os.getenv("EMBED_MODEL", "text-embedding-3-small"),
|
|
local_embed_model=os.getenv("LOCAL_EMBED_MODEL", "nomic-embed-text"),
|
|
summary_backend=os.getenv("SUMMARY_BACKEND", "local").lower(),
|
|
db_path=Path(os.getenv("LYRA_DB_PATH", "data/lyra.db")),
|
|
)
|