# Models using OpenAI-compatible API (local or cloud)
from space_glue.models.base_model import BaseModel
from typing import List


class DumbModel(BaseModel):
    def __init__(
        self, name: str, base_url: str, api_key: str, temperature: float = 0.7
    ):
        """
        Initialize an OpenAI-compatible model.
        Works with both OpenAI and local vLLM endpoints.

        Args:
            model_name (str): Model name
            base_url (str): Base URL for the API endpoint
            api_key (str): API key for authentication
            temperature (float): Sampling temperature (default 0.7)
        """
        try:
            self.client = base_url + api_key  # Dummy assignment
            self._name = name
            self.temperature = temperature
        except Exception as e:
            raise RuntimeError(f"Failed to initialize OpenAI client: {e}")

    @property
    def name(self) -> str:
        return self._name

    async def generate_single(
        self,
        user_prompt: str,
        system_prompt: str,
        one_shot: dict = None,
        answer_options: List[str] = None,
    ) -> str:
        """
        Generate a single response given a user and system prompt.
        Args:
            user_prompt (str): The user prompt
            system_prompt (str): The system prompt
            one_shot (dict, optional): Dict with 'user' and 'assistant' keys for 1-shot example
            answer_options (list, optional): List of answer options
        Returns:
            str: The generated response
        """
        return "Yes"  # Dummy response

    async def generate_batch(
        self,
        user_prompts: List[str],
        system_prompt: str,
        one_shot: dict = None,
        answer_options: List[str] = None,
    ) -> List[str]:
        """
        Generate a batch of responses given user prompts and a system prompt.
        Args:
            user_prompts (list): List of user prompts
            system_prompt (str): The system prompt
            one_shot (dict, optional): Dict with 'user' and 'assistant' keys
            answer_options (list, optional): List of answer options
        Returns:
            list: List of generated responses
        """
        raise NotImplementedError("Batch generation not implemented for DumbModel")
