Graph_RAG / backend /app /core /config.py
Aigenthix's picture
Upload 2585 files
711f785 verified
Raw
History Blame Contribute Delete
1.86 kB
"""Application configuration management"""
from pydantic_settings import BaseSettings
from functools import lru_cache
import os
class Settings(BaseSettings):
"""Application settings loaded from environment variables"""
# Environment
environment: str = "development"
debug: bool = False
log_level: str = "INFO"
# API Keys
groq_api_key: str = ""
# Database
database_url: str = "sqlite:///./data/ragapp.db"
vector_db_type: str = "chroma"
chroma_storage_path: str = "./data/chroma_data"
# Vector DB Configuration
pinecone_api_key: str = ""
pinecone_environment: str = ""
weaviate_url: str = "http://localhost:8080"
weaviate_api_key: str = ""
qdrant_url: str = "http://localhost:6333"
qdrant_api_key: str = ""
# Service Configuration
default_model: str = "llama-3.1-8b-instant"
default_embedding_model: str = "all-MiniLM-L6-v2"
default_tokenizer: str = "tiktoken"
chunk_size: int = 512
chunk_overlap: int = 50
retrieval_top_k: int = 5
generation_temperature: float = 0.7
# Security
secret_key: str = "your-secret-key-change-in-production"
jwt_algorithm: str = "HS256"
jwt_expiration_hours: int = 24
# CORS
frontend_url: str = "http://localhost:3000"
# File Upload
upload_dir: str = "./data/uploads"
max_file_size: int = 52428800
# Logging
log_file: str = "./logs/ragapp.log"
class Config:
env_file = ".env"
case_sensitive = False
def __init__(self, **data):
super().__init__(**data)
os.makedirs(self.upload_dir, exist_ok=True)
os.makedirs(self.chroma_storage_path, exist_ok=True)
os.makedirs(os.path.dirname(self.log_file), exist_ok=True)
@lru_cache()
def get_settings() -> Settings:
"""Get cached settings instance"""
return Settings()