from core.tool import ToolBase, tool, tool_func

# 加法工具
@tool('add', 'add tool')
class AddTool(ToolBase):
    @tool_func({
        "type": "object",
        "properties": {
            "a": {
                "type": "int",
                "description": "operator 1"
            },
            "b": {
                "type": "int",
                "description": "operator 2"
            }
        },
        "required": [
            "a",
            "b"
        ]
    })
    def add(self, a, b):
        return a + b


if __name__ == '__main__':
    tool = AddTool()
    print(AddTool._name)
    print(tool.execute(1, 2))