- Upgrade qdrant-client usage to query_points (replacing deprecated search) - Relax qdrant-client version constraint in requirements.txt (>=1.7.0) - Config: Allow extra environment variables in Settings (for local dev) - test_roles_rag.py: Fix import path for local execution
58 lines
1.5 KiB
Python
58 lines
1.5 KiB
Python
# app/config.py
|
|
import os
|
|
from typing import Optional
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""
|
|
Application settings with environment variable support.
|
|
All settings can be overridden via environment variables.
|
|
"""
|
|
|
|
# Database settings (existing)
|
|
mariadb_host: str = "db"
|
|
mariadb_user: str = "crumb"
|
|
mariadb_password: str = "secret"
|
|
mariadb_database: str = "crumbcrm"
|
|
|
|
# Session settings (existing)
|
|
secret_key: str = "change-me-in-production"
|
|
|
|
# AI Provider API Keys
|
|
openai_api_key: Optional[str] = None
|
|
openrouter_api_key: Optional[str] = None
|
|
anthropic_api_key: Optional[str] = None
|
|
|
|
# RAG Configuration - Default Providers
|
|
default_embedding_provider: str = "openrouter" # Use OpenRouter (supports both embeddings and Claude)
|
|
default_embedding_model: str = "text-embedding-3-small" # Without openai/ prefix (works for both providers)
|
|
default_completion_provider: str = "openrouter"
|
|
default_completion_model: str = "anthropic/claude-3-5-sonnet"
|
|
|
|
# Qdrant Configuration
|
|
qdrant_host: str = "qdrant"
|
|
qdrant_port: int = 6333
|
|
|
|
# RAG Settings
|
|
rag_chunk_size: int = 1000
|
|
rag_chunk_overlap: int = 200
|
|
rag_collection_prefix: str = "posts"
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = False
|
|
extra = "ignore"
|
|
|
|
|
|
# Global settings instance
|
|
settings = Settings()
|
|
|
|
|
|
def get_settings() -> Settings:
|
|
"""
|
|
Get the global settings instance.
|
|
Can be used as a FastAPI dependency.
|
|
"""
|
|
return settings
|