nxt::ai::tools namespace

Classes

struct function_call
Function-call item emitted by a Responses model.
struct function_tool
Local executable function tool plus its JSON schema.

Functions

auto function_call_from_item(const nlohmann::json& item) →  std::optional<function_call>
Parse a Responses output item as a function call when possible.
auto function_call_output(std::string call_id, std::string output) →  nlohmann::json
Build the structured input item that returns output for a function call.
auto function_tool_definition(const function_tool& tool) →  nlohmann::json
Convert one local function tool to the Responses tool-definition object.
auto function_tool_definitions(const std::vector<function_tool>& tools) →  nlohmann::json
Convert a list of local function tools to a Responses tools array.
auto run_function_tool(const std::vector<function_tool>& tools, const function_call& call) →  nxt::task<std::string>
Find and execute a local tool, returning a JSON error string on failure.

Function documentation

std::optional<function_call> nxt::ai::tools::function_call_from_item(const nlohmann::json& item)

Parse a Responses output item as a function call when possible.

nlohmann::json nxt::ai::tools::function_call_output(std::string call_id, std::string output)

Build the structured input item that returns output for a function call.

nlohmann::json nxt::ai::tools::function_tool_definition(const function_tool& tool)

Convert one local function tool to the Responses tool-definition object.

nlohmann::json nxt::ai::tools::function_tool_definitions(const std::vector<function_tool>& tools)

Convert a list of local function tools to a Responses tools array.

nxt::task<std::string> nxt::ai::tools::run_function_tool(const std::vector<function_tool>& tools, const function_call& call)

Find and execute a local tool, returning a JSON error string on failure.