Newer
Older
cortex-hub / ai-hub / app / core / providers / base.py
from abc import ABC, abstractmethod
from typing import AsyncGenerator

class LLMProvider(ABC):
    """Abstract base class for all LLM providers."""
    @abstractmethod
    async def generate_response(self, prompt: str) -> str:
        """Generates a response from the LLM."""
        pass

class TTSProvider(ABC):
    """Abstract base class for all Text-to-Speech providers."""
    @abstractmethod
    async def generate_speech(self, text: str) -> AsyncGenerator[bytes, None]:
        """Generates speech from text and streams the audio data."""
        pass

class STTProvider(ABC):
    """Abstract base class for all Speech-to-Text providers."""
    @abstractmethod
    async def transcribe_audio(self, audio_data: bytes) -> str:
        """Transcribes audio data into text."""
        pass