humanus.cpp/tool/terminate.h

36 lines
1.1 KiB
C
Raw Normal View History

2025-03-16 17:17:01 +08:00
#ifndef HUMANUS_TOOL_TERMINATE_H
#define HUMANUS_TOOL_TERMINATE_H
2025-03-19 18:44:54 +08:00
2025-03-16 17:17:01 +08:00
#include "base.h"
2025-03-19 18:44:54 +08:00
#include "prompt.h"
namespace humanus {
2025-03-16 17:17:01 +08:00
struct Terminate : BaseTool {
2025-03-16 17:17:01 +08:00
inline static const std::string name_ = "terminate";
2025-03-17 01:58:37 +08:00
inline static const std::string description_ = "Terminate the interaction when the request is met OR if the assistant cannot proceed further with the task.";
inline static const humanus::json parameters_ = {
2025-03-16 17:17:01 +08:00
{"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-19 18:44:54 +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
};
}
};
2025-03-19 18:44:54 +08:00
}
2025-03-16 17:17:01 +08:00
#endif // HUMANUS_TOOL_TERMINATE_H