Files
wehub-resource-sync e4dcfc49aa
Tests / Import Check (Python 3.13) (push) Has been cancelled
Tests / Import Check (Python 3.14) (push) Has been cancelled
Tests / Python Tests (Python 3.11) (push) Has been cancelled
Tests / Python Tests (Python 3.12) (push) Has been cancelled
Tests / Python Tests (Python 3.14) (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled
Tests / Lint and Format (push) Has been cancelled
Tests / Web Node Tests (push) Has been cancelled
Tests / Import Check (Python 3.11) (push) Has been cancelled
Tests / Import Check (Python 3.12) (push) Has been cancelled
Tests / Python Tests (Python 3.13) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:00:43 +08:00

25 lines
627 B
Python

"""Base abstraction for image-generation adapters."""
from __future__ import annotations
from abc import ABC, abstractmethod
from deeptutor.services.imagegen.config import ImagegenConfig
class BaseImagegenAdapter(ABC):
"""Abstract text-to-image adapter."""
@abstractmethod
async def generate(
self, prompt: str, config: ImagegenConfig, *, n: int = 1
) -> list[tuple[bytes, str]]:
"""Generate ``n`` images for ``prompt``.
Returns a list of ``(image_bytes, content_type)`` — content type is
best-effort, e.g. ``image/png``.
"""
__all__ = ["BaseImagegenAdapter"]