SpacyEmbeddings#
- class langchain_community.embeddings.spacy_embeddings.SpacyEmbeddings[source]#
Bases:
BaseModel
,Embeddings
Embeddings by spaCy models.
- model_name#
Name of a spaCy model.
- Type:
str
- nlp#
The spaCy model loaded into memory.
- Type:
Any
- embed_documents(texts
List[str]) -> List[List[float]]: Generates embeddings for a list of documents.
- embed_query(text
str) -> List[float]: Generates an embedding for a single piece of text.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- param model_name: str = 'en_core_web_sm'#
- param nlp: Any | None = None#
- async aembed_documents(texts: List[str]) List[List[float]] [source]#
Asynchronously generates embeddings for a list of documents. This method is not implemented and raises a NotImplementedError.
- Parameters:
texts (List[str]) – The documents to generate embeddings for.
- Raises:
NotImplementedError – This method is not implemented.
- Return type:
List[List[float]]
- async aembed_query(text: str) List[float] [source]#
Asynchronously generates an embedding for a single piece of text. This method is not implemented and raises a NotImplementedError.
- Parameters:
text (str) – The text to generate an embedding for.
- Raises:
NotImplementedError – This method is not implemented.
- Return type:
List[float]
Examples using SpacyEmbeddings