# BaichuanTextEmbeddings

> **Class** in `langchain_community`

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

Baichuan Text Embedding models.

## Signature

```python
BaichuanTextEmbeddings()
```

## Description

**Setup:**

To use, you should set the environment variable ``BAICHUAN_API_KEY`` to
your API key or pass it as a named parameter to the constructor.

.. code-block:: bash

    export BAICHUAN_API_KEY="your-api-key"

**Instantiate:**

.. code-block:: python

from langchain_community.embeddings import BaichuanTextEmbeddings

embeddings = BaichuanTextEmbeddings()

**Embed:**

.. code-block:: python

# embed the documents
vectors = embeddings.embed_documents([text1, text2, ...])

# embed the query
vectors = embeddings.embed_query(text)

## Extends

- `BaseModel`
- `Embeddings`

## Properties

- `session`
- `model_name`
- `baichuan_api_key`
- `chunk_size`
- `model_config`

## Methods

- [`validate_environment()`](https://reference.langchain.com/python/langchain-community/embeddings/baichuan/BaichuanTextEmbeddings/validate_environment)
- [`embed_documents()`](https://reference.langchain.com/python/langchain-community/embeddings/baichuan/BaichuanTextEmbeddings/embed_documents)
- [`embed_query()`](https://reference.langchain.com/python/langchain-community/embeddings/baichuan/BaichuanTextEmbeddings/embed_query)

---

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