134 lines
4.3 KiB
Plaintext
134 lines
4.3 KiB
Plaintext
╔════════════════════════════════════════════════════════════════════════════╗
|
||
║ ║
|
||
║ 🎉 SISTEMA DE TOOLS IMPLEMENTADO 🎉 ║
|
||
║ ║
|
||
║ ✅ Patrón Registry para NaliiaBot ║
|
||
║ ║
|
||
╚════════════════════════════════════════════════════════════════════════════╝
|
||
|
||
📚 DOCUMENTACIÓN DISPONIBLE:
|
||
|
||
🗺️ TOOLS_DOCUMENTATION_INDEX.md
|
||
└─ Punto de partida. Lee esto primero. (10 min)
|
||
|
||
🚀 QUICK_START.py
|
||
└─ Tutorial interactivo. Ejecutar y aprender. (5 min)
|
||
|
||
📖 TOOLS_GUIDE.md
|
||
└─ Guía completa con ejemplos. (20 min)
|
||
|
||
💼 AGENDA_TOOLS_EXAMPLE.py
|
||
└─ 5 herramientas reales funcionando. (15 min)
|
||
|
||
📋 REGISTRY_IMPLEMENTATION_SUMMARY.md
|
||
└─ Qué se hizo y cómo. (10 min)
|
||
|
||
|
||
🏗️ ESTRUCTURA DEL PROYECTO:
|
||
|
||
src/naliiabot/bot/tools/
|
||
├── __init__.py
|
||
├── tool_registry.py (infraestructura)
|
||
└── tools.py (← TUS HERRAMIENTAS AQUÍ)
|
||
|
||
tests/
|
||
└── test_naliia_agent_tools.py (tests automáticos)
|
||
|
||
|
||
🚀 COMIENZA CON ESTOS 3 PASOS:
|
||
|
||
1️⃣ Abre: TOOLS_DOCUMENTATION_INDEX.md
|
||
└─ Entiende la estructura
|
||
|
||
2️⃣ Abre: QUICK_START.py
|
||
└─ Crea tu primera herramienta
|
||
|
||
3️⃣ Abre: src/naliiabot/bot/tools/tools.py
|
||
└─ Agrega tus herramientas aquí
|
||
|
||
|
||
📊 ¿QUÉ ES EL PATRÓN REGISTRY?
|
||
|
||
Un sistema para registrar y gestionar herramientas de forma centralizada.
|
||
|
||
Flujo:
|
||
1. Define una herramienta (clase que hereda de BaseTool)
|
||
2. Regístrala en el ToolRegistry
|
||
3. Pásala al Agent
|
||
4. El LLM ahora puede usarla
|
||
|
||
|
||
✨ BENEFICIOS:
|
||
|
||
✅ Centralizado - Un único lugar para todas las tools
|
||
✅ Extensible - Agregar tools sin tocar código existente
|
||
✅ Testeable - Cada tool se prueba independientemente
|
||
✅ Mantenible - Cambios aislados
|
||
✅ Escalable - Funciona con 1 o 100 tools
|
||
✅ Validado - Schema automático de argumentos
|
||
|
||
|
||
💻 EJEMPLO RÁPIDO (copiar y pegar):
|
||
|
||
# 1. Crear una herramienta
|
||
class MiTool(BaseTool):
|
||
@property
|
||
def name(self) -> str:
|
||
return "mi_herramienta"
|
||
|
||
@property
|
||
def description(self) -> str:
|
||
return "Descripción"
|
||
|
||
@property
|
||
def args_schema(self):
|
||
return {"type": "object", "properties": {}}
|
||
|
||
def invoke(self, **kwargs) -> str:
|
||
return "resultado"
|
||
|
||
# 2. Registrar
|
||
registry = ToolRegistry()
|
||
registry.register(MiTool())
|
||
tools = registry.get_all_tools_as_langchain()
|
||
|
||
# 3. Usar con Agent
|
||
agent = Agent(model=modelo, tools=tools)
|
||
|
||
|
||
🎯 PRÓXIMOS PASOS:
|
||
|
||
Ahora mismo:
|
||
[ ] Abre TOOLS_DOCUMENTATION_INDEX.md
|
||
[ ] Lee QUICK_START.py
|
||
[ ] Intenta crear una herramienta
|
||
|
||
Después:
|
||
[ ] Revisa ejemplos en AGENDA_TOOLS_EXAMPLE.py
|
||
[ ] Crea tus herramientas personalizadas
|
||
[ ] Escribe tests
|
||
|
||
|
||
❓ ¿PREGUNTAS?
|
||
|
||
¿Cómo creo una tool?
|
||
→ TOOLS_GUIDE.md sección 2
|
||
|
||
¿Cómo registro tools?
|
||
→ TOOLS_GUIDE.md sección 3
|
||
|
||
¿Cuáles son los métodos disponibles?
|
||
→ TOOLS_GUIDE.md sección 4
|
||
|
||
¿Necesito ejemplos?
|
||
→ AGENDA_TOOLS_EXAMPLE.py
|
||
|
||
|
||
═══════════════════════════════════════════════════════════════════════════════
|
||
|
||
🎓 TODO LISTO PARA EMPEZAR
|
||
|
||
👉 Comienza por: TOOLS_DOCUMENTATION_INDEX.md
|
||
|
||
═══════════════════════════════════════════════════════════════════════════════
|