Spaces:
Configuration error
Configuration error
| import os | |
| from typing import Optional | |
| class Config: | |
| """Application configuration""" | |
| # API Keys | |
| ANTHROPIC_API_KEY: Optional[str] = os.getenv("ANTHROPIC_API_KEY","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") | |
| # Model settings | |
| MODEL_ID: str = "ds4sd/SmolDocling-256M-preview" | |
| MAX_PAGES_PER_CHUNK: int = int(os.getenv("MAX_PAGES_PER_CHUNK", "10")) | |
| MAX_NEW_TOKENS: int = 8192 | |
| # Device settings | |
| DEVICE: str = os.getenv("MODEL_DEVICE", "auto") # auto, cuda, cpu | |
| # Processing settings | |
| PDF_DPI: int = 200 # DPI for PDF to image conversion | |
| # Anthropic settings | |
| ANTHROPIC_MODEL: str = "claude-3-haiku-20240307" | |
| ANTHROPIC_MAX_TOKENS: int = 4000 | |
| ANTHROPIC_TEMPERATURE: float = 0.3 | |
| # Text chunking settings | |
| MAX_TOKENS_PER_CHUNK: int = 90000 # Half of Claude's context window | |
| def validate(cls) -> bool: | |
| """Validate configuration""" | |
| if not cls.ANTHROPIC_API_KEY: | |
| print("Warning: ANTHROPIC_API_KEY not set. Summary generation will not be available.") | |
| return False | |
| return True | |
| # Create global config instance | |
| config = Config() |