"""Abstract LLM provider interface."""
from abc import ABC, abstractmethod
from typing import Optional, Dict, Any
import logging

logger = logging.getLogger(__name__)


class BaseLLMProvider(ABC):
    """Abstract base class for LLM providers."""

    def __init__(self, name: str = "base"):
        """Initialize LLM provider."""
        self.name = name
        self.logger = logging.getLogger(f"{__name__}.{self.__class__.__name__}")

    @abstractmethod
    def complete(self, prompt: str, **kwargs) -> str:
        """
        Get completion from LLM.

        Args:
            prompt: Input prompt
            **kwargs: Model-specific parameters (temperature, max_tokens, etc.)

        Returns:
            LLM response text
        """
        pass

    @abstractmethod
    def test_connection(self) -> bool:
        """Test if LLM is available and working."""
        pass

    def is_available(self) -> bool:
        """Check if provider is available."""
        try:
            return self.test_connection()
        except Exception as e:
            self.logger.error(f"Provider check failed: {e}")
            return False
