Source code for agentscope.embedding._embedding_base
# -*- coding: utf-8 -*-"""The embedding model base class."""fromtypingimportAny,List,TYPE_CHECKINGfrom._embedding_responseimportEmbeddingResponseifTYPE_CHECKING:from..modelimportChatResponseelse:ChatResponse="ChatResponse"
[docs]classEmbeddingModelBase:"""Base class for embedding models."""model_name:str"""The embedding model name"""
[docs]def__init__(self,model_name:str,)->None:"""Initialize the embedding model base class. Args: model_name (`str`): The name of the embedding model. """self.model_name=model_name
[docs]asyncdef__call__(self,text:List[str],**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.",)