Async release
This commit is contained in:
13
app/services/abc/third_parties/__init__.py
Normal file
13
app/services/abc/third_parties/__init__.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from .stt import ISpeechToTextService
|
||||
from .tts import ITextToSpeechService
|
||||
from .llm import ILLMService
|
||||
from .vid_gen import IVideoGeneratorService
|
||||
from .ai_detector import IAIDetectorService
|
||||
|
||||
__all__ = [
|
||||
"ISpeechToTextService",
|
||||
"ITextToSpeechService",
|
||||
"ILLMService",
|
||||
"IVideoGeneratorService",
|
||||
"IAIDetectorService"
|
||||
]
|
||||
13
app/services/abc/third_parties/ai_detector.py
Normal file
13
app/services/abc/third_parties/ai_detector.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Dict, Optional
|
||||
|
||||
|
||||
class IAIDetectorService(ABC):
|
||||
|
||||
@abstractmethod
|
||||
async def run_detection(self, text: str):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def _parse_detection(self, response: Dict) -> Optional[Dict]:
|
||||
pass
|
||||
21
app/services/abc/third_parties/llm.py
Normal file
21
app/services/abc/third_parties/llm.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import List, Optional
|
||||
|
||||
|
||||
class ILLMService(ABC):
|
||||
|
||||
@abstractmethod
|
||||
async def prediction(
|
||||
self,
|
||||
model: str,
|
||||
messages: List,
|
||||
fields_to_check: Optional[List[str]],
|
||||
temperature: float,
|
||||
check_blacklisted: bool = True,
|
||||
token_count: int = -1
|
||||
):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def prediction_override(self, **kwargs):
|
||||
pass
|
||||
8
app/services/abc/third_parties/stt.py
Normal file
8
app/services/abc/third_parties/stt.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
|
||||
class ISpeechToTextService(ABC):
|
||||
|
||||
@abstractmethod
|
||||
async def speech_to_text(self, file_path):
|
||||
pass
|
||||
22
app/services/abc/third_parties/tts.py
Normal file
22
app/services/abc/third_parties/tts.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Union
|
||||
|
||||
|
||||
class ITextToSpeechService(ABC):
|
||||
|
||||
@abstractmethod
|
||||
async def synthesize_speech(self, text: str, voice: str, engine: str, output_format: str):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def text_to_speech(self, text: Union[list[str], str], file_name: str):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def _conversation_to_speech(self, conversation: list):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def _text_to_speech(self, text: str):
|
||||
pass
|
||||
|
||||
10
app/services/abc/third_parties/vid_gen.py
Normal file
10
app/services/abc/third_parties/vid_gen.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
from app.configs.constants import AvatarEnum
|
||||
|
||||
|
||||
class IVideoGeneratorService(ABC):
|
||||
|
||||
@abstractmethod
|
||||
async def create_video(self, text: str, avatar: str):
|
||||
pass
|
||||
Reference in New Issue
Block a user