initial commit: slides ready + upgraded

This commit is contained in:
2026-05-24 10:37:53 +02:00
commit f6f46972c3
173 changed files with 16756 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
---
layout: default
---
# Prompt Templates
<div class="mt-4 text-sm">
<v-click>
<div class="mb-4">
**ChatPromptTemplate** permite reutilizar prompts con variables dinámicas y la notación abreviada de roles
</div>
</v-click>
<v-click>
```typescript
import { ChatPromptTemplate } from "@langchain/core/prompts";
const template = ChatPromptTemplate.fromMessages([
["system", "Eres un experto en {topic}"], // ← shorthand de SystemMessage
["human", "{question}"] // ← shorthand de HumanMessage
]);
const prompt = await template.invoke({
topic: "JavaScript",
question: "¿Qué es async/await?"
});
const response = await model.invoke(prompt);
```
</v-click>
<v-click>
<div class="mt-3 text-xs bg-gray-100 dark:bg-gray-800 rounded p-2">
💡 Los templates son útiles para <b>reutilización</b>, <b>testing</b> y separar prompts de la lógica. Pero para casos simples, puedes usar mensajes directamente.
</div>
</v-click>
</div>