31 lines
687 B
Python
31 lines
687 B
Python
from abc import abstractmethod, ABC
|
|
from pathlib import Path
|
|
from typing import Literal
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class Argument(BaseModel):
|
|
type: Literal['str', 'int', 'float']
|
|
description: str | None = None
|
|
|
|
|
|
class ModelDescription(BaseModel):
|
|
engine: str
|
|
name: str
|
|
arguments: dict[str, Argument]
|
|
description: None | str = None
|
|
|
|
|
|
class EngineABC(ABC):
|
|
def __init__(self, save_path: 'Path'):
|
|
self.save_path = save_path
|
|
|
|
@abstractmethod
|
|
def discovery(self) -> tuple[ModelDescription, ...]:
|
|
...
|
|
|
|
@abstractmethod
|
|
def synth(self, text: str, model: str, *args, **kwargs) -> bytes:
|
|
...
|