invoice-processing-google-d.../core/config.py

40 lines
1.2 KiB
Python

# core/config.py
from pydantic_settings import BaseSettings, SettingsConfigDict
from typing import List, Dict
class Settings(BaseSettings):
# Carga las variables desde un fichero .env
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8")
# --- Configuración de Seguridad ---
SECRET_KEY: str
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
# --- Configuración de Google Cloud Document AI ---
GCP_PROJECT_ID: str
GCP_LOCATION: str
DOCAI_PROCESSOR_ID: str
# --- Lógica de Negocio (pedido por Jaime, datos a extraer) ---
REQUIRED_FIELDS: List[str] = [
"invoice_id",
"invoice_date",
"total_amount",
# "net_amount",
"receiver_name",
"supplier_tax_id"
]
# --- CAMBIO PARA DEPURACIÓN ---
# Bajamos los umbrales para asegurarnos de que los datos se extraen.
CONFIDENCE_THRESHOLDS: Dict[str, float] = {
"__default__": 0.82,
"supplier_name": 0.80,
"total_amount": 0.75,
# "net_amount": 0.92,
"receiver_name": 0.74,
"supplier_tax_id": 0.46
}
# Creamos una única instancia global de la configuración
settings = Settings()