File size: 466 Bytes
105b369
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from typing import Optional, Dict, List, Tuple

from pydantic import BaseModel, ConfigDict


class Embedder(BaseModel):
    """Base class for managing embedders"""

    dimensions: int = 1536

    model_config = ConfigDict(arbitrary_types_allowed=True)

    def get_embedding(self, text: str) -> List[float]:
        raise NotImplementedError

    def get_embedding_and_usage(self, text: str) -> Tuple[List[float], Optional[Dict]]:
        raise NotImplementedError