# MosaicMLInstructorEmbeddings

> **Class** in `langchain_community`

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

MosaicML embedding service.

To use, you should have the
environment variable ``MOSAICML_API_TOKEN`` set with your API token, or pass
it as a named parameter to the constructor.

## Signature

```python
MosaicMLInstructorEmbeddings()
```

## Description

**Example:**

.. code-block:: python

from langchain_community.llms import MosaicMLInstructorEmbeddings
endpoint_url = (
    "https://models.hosted-on.mosaicml.hosting/instructor-large/v1/predict"
)
mosaic_llm = MosaicMLInstructorEmbeddings(
    endpoint_url=endpoint_url,
    mosaicml_api_token="my-api-key"
)

## Extends

- `BaseModel`
- `Embeddings`

## Properties

- `endpoint_url`
- `embed_instruction`
- `query_instruction`
- `retry_sleep`
- `mosaicml_api_token`
- `model_config`

## Methods

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

---

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