# MosaicML

> **Class** in `langchain_community`

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

MosaicML LLM 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
MosaicML()
```

## Description

**Example:**

.. code-block:: python

from langchain_community.llms import MosaicML
endpoint_url = (
    "https://models.hosted-on.mosaicml.hosting/mpt-7b-instruct/v1/predict"
)
mosaic_llm = MosaicML(
    endpoint_url=endpoint_url,
    mosaicml_api_token="my-api-key"
)

## Extends

- `LLM`

## Properties

- `endpoint_url`
- `inject_instruction_format`
- `model_kwargs`
- `retry_sleep`
- `mosaicml_api_token`
- `model_config`

## Methods

- [`validate_environment()`](https://reference.langchain.com/python/langchain-community/llms/mosaicml/MosaicML/validate_environment)

---

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