2025-03-16 17:17:01 +08:00
|
|
|
#ifndef HUMANUS_TOOL_TERMINATE_H
|
|
|
|
#define HUMANUS_TOOL_TERMINATE_H
|
|
|
|
#include "base.h"
|
|
|
|
|
|
|
|
namespace humanus {
|
|
|
|
|
|
|
|
const char* _TERMINATE_DESCRIPTION = "Terminate the interaction when the request is met OR if the assistant cannot proceed further with the task.";
|
|
|
|
|
|
|
|
struct Terminate : BaseTool {
|
|
|
|
inline static const std::string name_ = "terminate";
|
|
|
|
inline static const std::string description_ = _TERMINATE_DESCRIPTION;
|
|
|
|
inline static const json parameters_ = {
|
|
|
|
{"type", "object"},
|
|
|
|
{"properties", {
|
|
|
|
{"status", {
|
|
|
|
{"type", "string"},
|
|
|
|
{"description", "The finish status of the interaction."},
|
|
|
|
{"enum", {"success", "failure"}}
|
|
|
|
}}
|
|
|
|
}},
|
|
|
|
{"required", {"status"}}
|
|
|
|
};
|
|
|
|
|
|
|
|
Terminate() : BaseTool(name_, description_, parameters_) {}
|
|
|
|
|
2025-03-16 22:56:03 +08:00
|
|
|
// Finish the current execution
|
2025-03-16 17:17:01 +08:00
|
|
|
ToolResult execute(const json& arguments) override {
|
|
|
|
return ToolResult{
|
2025-03-16 22:56:03 +08:00
|
|
|
"The interaction has been completed with status: " + arguments.value("status", "unknown")
|
2025-03-16 17:17:01 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // HUMANUS_TOOL_TERMINATE_H
|