|
🛰️航天仿真算法库 SpaceAST 0.4.0
|
#include <ChatTools.hpp>
Public 成员函数 | |
| ChatTools (ChatTools &&)=default | |
| ChatTools & | operator= (ChatTools &&)=default |
| std::string | handleToolCall (const JsonValue &toolCall) |
| ChatTool * | addTool (std::unique_ptr< ChatTool > &&tool) |
| template<typename Func > | |
| ChatTool * | addTool (Func func) |
| void | clearTools () |
| ChatTool * | findTool (StringView name) const |
| const std::vector< std::unique_ptr< ChatTool > > & | tools () const |
| size_t | size () const |
| JsonValue | toJson () const |
| bool | empty () const |
AI工具集合
所有AI工具的集合,用于管理工具的添加、删除和调用。 同名工具只保留第一个;工具可以在添加后再设置名称。
|
inline |
添加函数形式的工具
| func | 工具函数,签名为 std::string(const JsonValue&) |
| ChatTool * ast::ChatTools::findTool | ( | StringView | name | ) | const |
查找工具
| name | 工具名称 |
| std::string ast::ChatTools::handleToolCall | ( | const JsonValue & | toolCall | ) |
处理工具调用
| toolCall | 工具调用参数 |
| JsonValue ast::ChatTools::toJson | ( | ) | const |
将工具集合转换为JSON格式