# Text2vecEmbeddings

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/embeddings/text2vec/Text2vecEmbeddings)

text2vec embedding models.

Install text2vec first, run 'pip install -U text2vec'.
The github repository for text2vec is : https://github.com/shibing624/text2vec

## Signature

```python
Text2vecEmbeddings(
    self,
    *,
    model: Any = None,
    model_name_or_path: Optional[str] = None,
    **kwargs: Any = {},
)
```

## Description

**Example:**

.. code-block:: python

from langchain_community.embeddings.text2vec import Text2vecEmbeddings

embedding = Text2vecEmbeddings()
embedding.embed_documents([
    "This is a CoSENT(Cosine Sentence) model.",
    "It maps sentences to a 768 dimensional dense vector space.",
])
embedding.embed_query(
    "It can be used for text matching or semantic search."
)

## Extends

- `Embeddings`
- `BaseModel`

## Constructors

```python
__init__(
    self,
    *,
    model: Any = None,
    model_name_or_path: Optional[str] = None,
    **kwargs: Any = {},
)
```

| Name | Type |
|------|------|
| `model` | `Any` |
| `model_name_or_path` | `Optional[str]` |


## Properties

- `model_name_or_path`
- `encoder_type`
- `max_seq_length`
- `device`
- `model`
- `model_config`

## Methods

- [`embed_documents()`](https://reference.langchain.com/python/langchain-community/embeddings/text2vec/Text2vecEmbeddings/embed_documents)
- [`embed_query()`](https://reference.langchain.com/python/langchain-community/embeddings/text2vec/Text2vecEmbeddings/embed_query)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/d5ea8358933260ad48dd31f7f8076555c7b4885a/libs/community/langchain_community/embeddings/text2vec.py#L9)