initial commit: slides ready + upgraded
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
|
||||
# Streaming: Respuestas en Tiempo Real
|
||||
|
||||
<div class="mt-8">
|
||||
|
||||
<v-click>
|
||||
|
||||
<div class="text-sm mb-6">
|
||||
|
||||
**¿Por qué streaming?**
|
||||
|
||||
- ✅ Experiencia de usuario mejorada (como ChatGPT)
|
||||
- ✅ Feedback inmediato (no esperar 10-20 segundos)
|
||||
- ✅ Procesar mientras se genera
|
||||
|
||||
</div>
|
||||
|
||||
</v-click>
|
||||
|
||||
<v-click>
|
||||
|
||||
```typescript
|
||||
import { ChatOpenAI } from "@langchain/openai";
|
||||
|
||||
const model = new ChatOpenAI({
|
||||
model: "gpt-4.1-mini",
|
||||
streaming: true,
|
||||
});
|
||||
|
||||
const stream = await model.stream("Explica qué es LangChain");
|
||||
|
||||
for await (const chunk of stream) {
|
||||
console.log(chunk.content); // Imprime palabra por palabra
|
||||
}
|
||||
```
|
||||
|
||||
</v-click>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user