---
layout: two-cols
layoutClass: gap-8
---

# Ejemplo con Mistral AI

Alternativa europea (Francia)

```typescript {all|1-2|4-7|9-11|all}
// mistral-example.ts
import { ChatMistralAI } from "@langchain/mistralai";

// 1. Crear el modelo
const model = new ChatMistralAI({
  model: "mistral-large-latest",
});

// 2. Invocar
const response = await model.invoke(
  "¿Qué es LangChain?"
);

console.log(response.content);
```

::right::

<div class="mt-12 text-sm pl-4">

<v-click>

## 📦 Instalación

```bash
npm install @langchain/mistralai
```

</v-click>

<v-click>

## 🔑 API Key

```bash
# .env
MISTRAL_API_KEY=...
```

Obtener en:
[console.mistral.ai](https://console.mistral.ai)

</v-click>

<v-click>

## ⚡ Ejecutar

```bash
npx tsx --env-file=.env mistral-example.ts
```

</v-click>

</div>
