# -*- coding: utf-8 -*-"""The embedding model base class."""fromtypingimportAnyfrom._embedding_responseimportEmbeddingResponse
[文档]classEmbeddingModelBase:"""Base class for embedding models."""model_name:str"""The embedding model name"""supported_modalities:list[str]"""The supported data modalities, e.g. "text", "image", "video"."""dimensions:int"""The dimensions of the embedding vector."""
[文档]def__init__(self,model_name:str,dimensions:int,)->None:"""Initialize the embedding model base class. Args: model_name (`str`): The name of the embedding model. dimensions (`int`): The dimension of the embedding vector. """self.model_name=model_nameself.dimensions=dimensions
[文档]asyncdef__call__(self,*args:Any,**kwargs:Any,)->EmbeddingResponse:"""Call the embedding API with the given arguments."""raiseNotImplementedError(f"The {self.__class__.__name__} class does not implement "f"the __call__ method.",)