from __future__ import annotations

from django.conf import settings


DEFAULTS: dict = {
    "MAX_QUERY_LIMIT": 100,
    "DEFAULT_MODEL": "gpt-4",
    "DEFAULT_PROVIDER": "openai",
    "SHOW_INTERNAL": False,
    "SYSTEM_PROMPT_EXTRA": "",
}


def get_setting(key: str) -> object:
    """Return a django-anyllm setting, falling back to the default.

    Args:
        key: The setting name (without prefix).

    Returns:
        The configured value or the default.
    """
    user_settings = getattr(settings, "DJANGO_ANYLLM", {})
    return user_settings.get(key, DEFAULTS[key])
