ReMe/experiencemaker/tool/terminate_tool.py
2025-06-09 20:54:25 +08:00

24 lines
836 B
Python

from experiencemaker.tool.base_tool import BaseTool, TOOL_REGISTRY
class TerminateTool(BaseTool):
name: str = "terminate"
description: str = "If you can answer the user's question based on the context, be sure to use the **terminate** tool."
parameters: dict = {
"type": "object",
"properties": {
"status": {
"type": "string",
"description": "Please determine whether the user's question has been completed. (success / failure)",
"enum": ["success", "failure"],
}
},
"required": ["status"],
}
def execute(self, status: str):
self.success = status in ["success", "failure"]
return f"The interaction has been completed with status: {status}"
TOOL_REGISTRY.register(TerminateTool, "terminate")