- Modelo por defecto mistral-ocr-4-0 (.env.example, config.py, docker-compose) - MistralClient: OCR en lote via API Batch (/v1/ocr) subiendo JSONL, polling y descarga de resultados - Reintentos con backoff exponencial en llamadas a Mistral (429/5xx/red); sin reintento en 401/400 - PdfProcessor: lote cuando >= umbral de paginas, fallback sincrono pagina a pagina, placeholder rastreable por pagina fallida - Errores etiquetados ([AUTH_MISTRAL], [BATCH], [NETWORK], [OCR_EMPTY], [PDF_PARSE]...) en el mensaje del job - Nuevas variables: MISTRAL_OCR_BATCH_THRESHOLD/POLL_SECONDS/TIMEOUT_SECONDS/RETRY_ATTEMPTS/RETRY_BACKOFF_BASE
23 lines
697 B
Python
23 lines
697 B
Python
from pathlib import Path
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
app_env: str = "development"
|
|
app_data_dir: Path = Path("./data")
|
|
database_path: Path = Path("./data/app.db")
|
|
mistral_api_key: str = ""
|
|
mistral_ocr_model: str = "mistral-ocr-4-0"
|
|
mistral_ocr_batch_threshold: int = 3
|
|
mistral_ocr_batch_poll_seconds: int = 10
|
|
mistral_ocr_batch_timeout_seconds: int = 1800
|
|
mistral_ocr_retry_attempts: int = 3
|
|
mistral_ocr_retry_backoff_base: float = 2.0
|
|
deepgram_api_key: str = ""
|
|
|
|
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
|
|
|
|
|
|
settings = Settings()
|