ForestHub SDK 0.1.0
C++14 LLM SDK for PC and embedded platforms
Loading...
Searching...
No Matches
serialization.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: AGPL-3.0-only
2// Copyright (c) 2026 ForestHub. All rights reserved.
3// For commercial licensing, visit https://github.com/ForestHubAI/fh-sdk
4
5#ifndef FORESTHUB_CORE_SERIALIZATION_HPP
6#define FORESTHUB_CORE_SERIALIZATION_HPP
7
10
11#include <memory>
12
18
19namespace foresthub {
20namespace core {
21
22using json = nlohmann::json;
23
24// -- Core structure serialization --
25
27void to_json(json& j, const Options& opts);
29void from_json(const json& j, Options& opts);
31void to_json(json& j, const ResponseFormat& format);
33void from_json(const json& j, ResponseFormat& format);
34
35// -- Polymorphic serialization helpers --
36
39void to_json(json& j, const std::shared_ptr<InputItem>& item);
41void to_json(json& j, const std::shared_ptr<Tool>& tool);
42
43// -- Request/Response serialization --
44
46void to_json(json& j, const ChatRequest& req);
48void from_json(const json& j, ChatRequest& req);
50void from_json(const json& j, ChatResponse& resp);
51
52} // namespace core
53} // namespace foresthub
54
55#endif // FORESTHUB_CORE_SERIALIZATION_HPP
ChatRequest and ChatResponse types with fluent builder API.
Polymorphic input types for chat requests.
Wrapper for nlohmann/json that works around abs macro conflicts.
Core abstractions: requests, responses, tools, input types, and provider interface.
void to_json(json &j, const Options &opts)
Serialize Options to JSON.
void from_json(const json &j, Options &opts)
Deserialize Options from JSON.
Top-level namespace for the ForestHub SDK.
Model-specific generation options (temperature, max_tokens, etc.).
Chat completion request sent to an LLM provider.
Definition types.hpp:39
Chat completion response from an LLM provider.
Definition types.hpp:148
Model-specific generation options.
Definition options.hpp:17
Structured output format with JSON schema constraints.
Definition types.hpp:32
Tool system: ExternalTool, FunctionTool, WebSearch, and tool call types.