initial commit: slides ready + upgraded
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
|
||||
# Tools: Definiendo Herramientas
|
||||
|
||||
<div class="mt-6 text-xs">
|
||||
|
||||
<v-click>
|
||||
|
||||
```typescript
|
||||
import { tool } from "@langchain/core/tools";
|
||||
import { z } from "zod";
|
||||
|
||||
const weatherTool = tool(
|
||||
async ({ location }) => {
|
||||
// Llamar a API del tiempo
|
||||
return `El tiempo en ${location} es soleado, 22°C`;
|
||||
},
|
||||
{
|
||||
name: "get_weather",
|
||||
description: "Obtiene el tiempo actual de una ubicación",
|
||||
schema: z.object({
|
||||
location: z.string().describe("Ciudad o ubicación"),
|
||||
}),
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
</v-click>
|
||||
|
||||
<v-click>
|
||||
|
||||
```typescript
|
||||
// El agente decide automáticamente cuándo usar cada tool
|
||||
const agent = createAgent({
|
||||
model: "mistral:mistral-large-latest",
|
||||
tools: [weatherTool, calculatorTool, searchTool],
|
||||
});
|
||||
```
|
||||
|
||||
</v-click>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user