NeuralPlus 0.2.0
A small C++17 SDK for AI clients, sessions, tools, and tracing
Loading...
Searching...
No Matches
neuralplus::FunctionTool Class Referencefinal

Callback-backed Tool for applications that do not need a subclass. More...

#include <tool.hpp>

Inheritance diagram for neuralplus::FunctionTool:
neuralplus::Tool

Public Types

using Function = std::function< ToolOutput(ToolContext &, const JsonValue &)>
 Callback signature for one tool invocation.
 

Public Member Functions

 FunctionTool (ToolSpec spec, Function function)
 Creates a tool from its declaration and callback.
 
const ToolSpecspec () const noexcept override
 Returns the immutable declaration supplied at construction.
 
ToolOutput invoke (ToolContext &context, const JsonValue &arguments) override
 Delegates one invocation to the configured callback.
 

Detailed Description

Callback-backed Tool for applications that do not need a subclass.

Member Function Documentation

◆ invoke()

ToolOutput neuralplus::FunctionTool::invoke ( ToolContext context,
const JsonValue arguments 
)
overridevirtual

Delegates one invocation to the configured callback.

Implements neuralplus::Tool.

◆ spec()

const ToolSpec & neuralplus::FunctionTool::spec ( ) const
overridevirtualnoexcept

Returns the immutable declaration supplied at construction.

Implements neuralplus::Tool.


The documentation for this class was generated from the following file: