812 B
812 B
layout, layoutClass
| layout | layoutClass |
|---|---|
| two-cols | gap-8 |
Ejemplo con Google Gemini
Alternativa gratuita a OpenAI
// gemini-example.ts
import { ChatGoogle } from "@langchain/google";
// 1. Crear el modelo
const model = new ChatGoogle({
model: "gemini-2.5-flash",
});
// 2. Invocar
const response = await model.invoke(
"¿Qué es LangChain?"
);
console.log(response.content);
::right::
📦 Instalación
npm install @langchain/google
🔑 API Key
# .env
GOOGLE_API_KEY=AI...
Obtener gratis en: ai.google.dev/gemini-api
⚡ Ejecutar
npx tsx --env-file=.env gemini-example.ts