from typing import cast, override

from sentence_transformers import SentenceTransformer

from template_project.application.common.embedding import Embedder


class MiniLMEmbedder(Embedder):
    def __init__(self, model: SentenceTransformer) -> None:
        self._model = model

    @override
    async def encode(self, text: str) -> list[float]:
        embedding = self._model.encode(text)
        return cast(list[float], embedding.tolist())
