> ## Documentation Index
> Fetch the complete documentation index at: https://docs.inceptionlabs.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# LangChain

> Call Mercury 2 from LangChain.

### **Setup Instructions**

1. Install langchain and langchain-openai in your Python environment via `pip install -qU langchain-openai`
2. Export your API key as an environment variable in your terminal.

<CodeGroup>
  ```bash macOS / Linux theme={null}
  export INCEPTION_API_KEY="your_api_key_here"
  ```

  ```bash Windows theme={null}
  set INCEPTION_API_KEY="your_api_key_here"
  ```
</CodeGroup>

3. The following code shows how you can interact with our model in LangChain.

### **Code**

```python theme={null}
import os
from langchain_openai import ChatOpenAI
api_key = os.environ["INCEPTION_API_KEY"]
llm = ChatOpenAI(
    model="mercury-2",
    temperature=0.75,
    api_key=api_key,
    base_url="https://api.inceptionlabs.ai/v1"
)
response = llm.invoke([("user", "What is a diffusion model?")]).content
print(response)
```

[Documentation](https://python.langchain.com/docs/introduction/)
