from typing import List, Dict, Any, Generator
from .providers.pollinations import PollinationsAI
from .providers.puter import Puter

class Client:
    def __init__(self):
        self.providers = {
            "pollinations": PollinationsAI(),
            "puter": Puter()
        }

    def chat_completion(
        self,
        model: str = "gpt-4",
        messages: List[Dict[str, str]] = None,
        provider: str = "pollinations",
        stream: bool = False,
        **kwargs: Any
    ) -> Generator[str, None, None] | str:
        if messages is None:
            messages = []
            
        provider_instance = self.providers.get(provider.lower())
        if not provider_instance:
            raise ValueError(f"Provider {provider} not found")
            
        return provider_instance.create_completion(model, messages, stream, **kwargs)
