Files
Orchestrator/privat/NoteGraph/ingestion/config.py
T
ankn a5f8fb49ab Migrate all repos into monorepo context folders
Bahn: aisupport, Analyse-O2C-C2S, awesome-bahn-mcp-servers, beam-mcp,
      Confluence_Bot, db-planet-mcp-server, O2C-Harness, project-audit,
      Projekt-KIQ-HP, teamlandkarte-mcp
Dhive: Jury-Voting
Privat: CV, NoteGraph (NOTE: NoteGraph needs complete redo after consolidation)
Shared: AI-Orchestrator, OrgMyLife, power_skills_and_more
Shared/references: symphony (read-only)

Bahn repos remain available as independent remotes - this monorepo
pulls them in via subtree, the originals are untouched.
2026-06-30 20:39:52 +02:00

67 lines
2.1 KiB
Python

"""Configuration for the NoteGraph ingestion service."""
from pathlib import Path
from pydantic_settings import BaseSettings
class IngestionConfig(BaseSettings):
"""All configuration loaded from environment variables / .env file."""
# LLM Provider
llm_provider: str = "openai"
llm_model: str = "gpt-4o"
openai_api_key: str = ""
anthropic_api_key: str = ""
google_api_key: str = ""
mistral_api_key: str = ""
ollama_base_url: str = "http://localhost:11434"
# OrgMyLife Integration
orgmylife_api_url: str = "https://api.andreknie.de"
orgmylife_api_key: str = ""
# Nextcloud Inbox
nextcloud_inbox_url: str = ""
nextcloud_inbox_user: str = ""
nextcloud_inbox_password: str = ""
# Paths
notes_dir: str = "./notes"
inbox_dir: str = "./ingestion/inbox"
# OCR
ocr_enabled: bool = True
ocr_language: str = "deu+eng"
# Behavior
confidence_threshold: float = 0.7
auto_commit: bool = True
# Web Upload Auth (same as SilverBullet)
sb_user: str = "admin:changeme"
model_config = {"env_file": ".env", "env_prefix": "", "extra": "ignore"}
@property
def llm_model_string(self) -> str:
"""LiteLLM model string (e.g., 'openai/gpt-4o', 'ollama/llama3')."""
if self.llm_provider == "ollama":
return f"ollama/{self.llm_model}"
return f"{self.llm_provider}/{self.llm_model}"
def validate_api_key(self) -> None:
"""Exit with a clear error if the required API key is missing."""
key_map = {
"openai": ("openai_api_key", "OPENAI_API_KEY"),
"anthropic": ("anthropic_api_key", "ANTHROPIC_API_KEY"),
"google": ("google_api_key", "GOOGLE_API_KEY"),
"mistral": ("mistral_api_key", "MISTRAL_API_KEY"),
}
if self.llm_provider in key_map:
attr, env_name = key_map[self.llm_provider]
if not getattr(self, attr):
raise SystemExit(
f"ERROR: {env_name} is required for provider '{self.llm_provider}' but not set."
)