langchain.embeddings.modelscope_hub.ModelScopeEmbeddings¶
- class langchain.embeddings.modelscope_hub.ModelScopeEmbeddings(*, embed: Any = None, model_id: str = 'damo/nlp_corom_sentence-embedding_english-base')[source]¶
Bases:
BaseModel,EmbeddingsModelScopeHub embedding models.
To use, you should have the
modelscopepython package installed.Example
from langchain.embeddings import ModelScopeEmbeddings model_id = "damo/nlp_corom_sentence-embedding_english-base" embed = ModelScopeEmbeddings(model_id=model_id)
Initialize the modelscope
- param embed: Any = None¶
- param model_id: str = 'damo/nlp_corom_sentence-embedding_english-base'¶
Model name to use.
- embed_documents(texts: List[str]) List[List[float]][source]¶
Compute doc embeddings using a modelscope embedding model.
- Parameters
texts – The list of texts to embed.
- Returns
List of embeddings, one for each text.