File size: 734 Bytes
644bdfe |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
from abc import ABC, abstractmethod
from enum import Enum
from typing import List
class EmbeddingProviderType(Enum):
OPENAI = "openai"
TEST = "test"
# SENTENCE_TRANSFORMERS = "sentence-transformers"
class EmbeddingProvider(ABC):
"""Abstract base class for embedding providers."""
@abstractmethod
def length_of_embedding(self) -> int:
"""Get the length of the embedding for a given model."""
pass
@abstractmethod
def embed_documents(self, documents: List[str]) -> List[List[float]]:
"""Embed a list of documents into vectors."""
pass
@abstractmethod
def embed_query(self, query: str) -> List[float]:
"""Embed a query into a vector."""
pass
|