703 B
703 B
layout
| layout |
|---|
| default |
Ejemplo: Configurando Parámetros
import { ChatOpenAI } from "@langchain/openai";
const model = new ChatOpenAI({
model: "gpt-4.1-mini",
temperature: 0.7, // Balance entre creatividad y coherencia
maxTokens: 500, // Limitar longitud de respuesta
topP: 0.9, // Nucleus sampling
});
const response = await model.invoke(
"Explica qué es un agente en LangChain"
);
console.log(response.content);
💡 Tip: Usa
temperature: 0 para respuestas deterministas (útil en tests)