Spaces:
Running
Running
| """Abstract base class for all embedding providers.""" | |
| from abc import ABC, abstractmethod | |
| class BaseEmbedder(ABC): | |
| """Interface every embedder must implement.""" | |
| def embed_query(self, text: str) -> list[float]: | |
| """Embed a single query string and return its vector.""" | |
| ... | |
| def embed_documents(self, texts: list[str]) -> list[list[float]]: | |
| """Embed a batch of document strings and return their vectors.""" | |
| ... | |
| def model_id(self) -> str: | |
| """Return the canonical model identifier.""" | |
| ... | |
| # ββ concrete helper ββββββββββββββββββββββββββββββββββββββββββββββ | |
| def get_dimension(self) -> int: | |
| """Return the dimensionality of the embedding vectors.""" | |
| return len(self.embed_query("dimension test")) | |