|
ForestHub SDK 0.1.0
C++14 LLM SDK for PC and embedded platforms
|
Core abstractions: requests, responses, tools, input types, and provider interface. More...
Namespaces | |
| namespace | capability |
| Model capability identifiers. | |
Classes | |
| struct | ChatRequest |
| Chat completion request sent to an LLM provider. More... | |
| struct | ChatResponse |
| Chat completion response from an LLM provider. More... | |
| class | ExternalTool |
| Tool with description and parameter schema, handled outside the LLM provider. More... | |
| class | ExternalToolBase |
| Base implementation of ExternalTool with name, description, and parameters. More... | |
| class | FunctionTool |
| ExternalTool with a C++ callback for execution. More... | |
| class | HttpClient |
| Abstract interface for HTTP operations. More... | |
| struct | HttpResponse |
| Simple HTTP response container. More... | |
| class | Input |
| Abstract base for all input types. More... | |
| class | InputItem |
| Abstract base for items inside an InputItems list. More... | |
| class | InputItems |
| An ordered list of InputItem elements. More... | |
| class | InputString |
| A string that acts as both top-level Input and InputItem. More... | |
| class | InternalToolCall |
| Represents a tool call initiated internally by the model. More... | |
| class | LLMClient |
| Abstract interface for LLM chat operations. More... | |
| struct | ModelInfo |
| Metadata about an LLM model. More... | |
| struct | Options |
| Model-specific generation options. More... | |
| class | Provider |
| Extended LLM interface with health checks and model discovery. More... | |
| struct | ResponseFormat |
| Structured output format with JSON schema constraints. More... | |
| class | Tool |
| Base interface for all tools. More... | |
| class | ToolCallRequest |
| Request from the model to call a tool. More... | |
| class | ToolResult |
| Output of an executed tool. More... | |
| class | WebSearch |
| Built-in web search tool. More... | |
| class | WebSearchToolCall |
| Log entry for a web search invocation. More... | |
Enumerations | |
| enum class | InputType : uint8_t { kString , kItems } |
| Type discriminator for Input subclasses. More... | |
| enum class | InputItemType : uint8_t { kString , kToolCall , kToolResult } |
| Type discriminator for InputItem subclasses. More... | |
| enum class | ToolType : uint8_t { kFunction , kWebSearch , kHandoff } |
| Type discriminator for Tool subclasses. More... | |
Functions | |
| std::shared_ptr< InputItems > | AsInputItems (const std::shared_ptr< Input > &input) |
| Normalize input to InputItems. | |
| void | to_json (json &j, const Options &opts) |
| Serialize Options to JSON. | |
| void | from_json (const json &j, Options &opts) |
| Deserialize Options from JSON. | |
| void | to_json (json &j, const ResponseFormat &format) |
| Serialize ResponseFormat to JSON. | |
| void | from_json (const json &j, ResponseFormat &format) |
| Deserialize ResponseFormat from JSON. | |
| void | to_json (json &j, const std::shared_ptr< InputItem > &item) |
| Serialize an InputItem (dispatches by subtype; nullptr produces JSON null). | |
| void | to_json (json &j, const std::shared_ptr< Tool > &tool) |
| Serialize a Tool (dispatches by subtype). | |
| void | to_json (json &j, const ChatRequest &req) |
| Serialize ChatRequest to JSON. | |
| void | from_json (const json &j, ChatRequest &req) |
| Deserialize ChatRequest from JSON. | |
| void | from_json (const json &j, ChatResponse &resp) |
| Deserialize ChatResponse from JSON. | |
| template<typename T, typename R> | |
| std::shared_ptr< FunctionTool > | NewFunctionTool (std::string name, std::string description, const json &schema, const std::function< R(T)> &handler) |
| Create a FunctionTool with type-safe argument parsing. | |
Core abstractions: requests, responses, tools, input types, and provider interface.
|
strong |
Type discriminator for InputItem subclasses.
| Enumerator | |
|---|---|
| kString | Plain text (InputString). |
| kToolCall | Tool call request from the model (ToolCallRequest). |
| kToolResult | Tool execution result (ToolResult). |
|
strong |
Type discriminator for Input subclasses.
| Enumerator | |
|---|---|
| kString | Single text string. |
| kItems | Ordered list of conversation items. |
|
strong |
Type discriminator for Tool subclasses.
| Enumerator | |
|---|---|
| kFunction | User-defined function tool with C++ callback. |
| kWebSearch | Built-in web search tool. |
| kHandoff | Agent handoff tool. |
|
inline |
Normalize input to InputItems.
| input | Input to normalize (string or items); nullptr returns an empty InputItems. |
| std::shared_ptr< FunctionTool > foresthub::core::NewFunctionTool | ( | std::string | name, |
| std::string | description, | ||
| const json & | schema, | ||
| const std::function< R(T)> & | handler ) |
Create a FunctionTool with type-safe argument parsing.
| T | Argument struct type, deserialized from JSON via from_json(). T's from_json() MUST NOT throw — on no-exception platforms a throwing from_json() causes undefined behavior (typically abort). Use j.value() with defaults, not j.at(). |
| R | Return type of the handler, convertible to nlohmann::json. |
| name | Tool name visible to the LLM in the tool schema. |
| description | Human-readable description sent to the LLM. |
| schema | JSON schema for tool parameters. |
| handler | Callback that receives parsed arguments and returns a result. |