Files
NaliiaBot/src/naliiabot/bot/tools/tools.py

55 lines
1.5 KiB
Python

"""
Implementaciones concretas de herramientas del agente.
Este módulo contiene las herramientas concretas que extienden BaseTool
y pueden ser registradas en el ToolRegistry.
Ejemplo de cómo crear una herramienta personalizada:
from typing import Any, Dict
from .tool_registry import BaseTool
class MiHerramienta(BaseTool):
@property
def name(self) -> str:
return "mi_herramienta"
@property
def description(self) -> str:
return "Descripción de qué hace mi herramienta"
@property
def args_schema(self) -> Dict[str, Any]:
return {
"type": "object",
"properties": {
"param1": {
"type": "string",
"description": "Descripción del parámetro"
}
},
"required": ["param1"]
}
def invoke(self, **kwargs) -> str:
param1 = kwargs.get("param1")
# Implementa la lógica de tu herramienta
return f"Resultado: {param1}"
Luego registra tu herramienta:
from .tool_registry import ToolRegistry
from .tools import MiHerramienta
registry = ToolRegistry()
registry.register(MiHerramienta())
tools = registry.get_all_tools_as_langchain()
"""
from typing import Any, Dict
from .tool_registry import BaseTool
# Define aquí tus herramientas personalizadas
# Ejemplo: class MiHerramienta(BaseTool): ...