humanus.cpp/tool/terminate.h

35 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
#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_) {}
ToolResult execute(const json& arguments) override {
return ToolResult{
"The interaction has been completed with status: " + arguments["status"].get<std::string>()
};
}
};
}
#endif // HUMANUS_TOOL_TERMINATE_H