5#ifndef FORESTHUB_CORE_TYPES_HPP
6#define FORESTHUB_CORE_TYPES_HPP
26using json = nlohmann::json;
45 std::vector<std::shared_ptr<Tool>>
tools;
82 tools.push_back(std::move(tool));
88 file_ids.push_back(std::move(file_id));
106 options.WithTemperature(temperature);
112 options.WithMaxTokens(max_tokens);
130 options.WithFrequencyPenalty(frequency_penalty);
136 options.WithPresencePenalty(presence_penalty);
Wrapper for nlohmann/json that works around abs macro conflicts.
Model metadata and capability identifiers.
Core abstractions: requests, responses, tools, input types, and provider interface.
std::string ModelID
Unique identifier for an LLM model.
Definition model.hpp:23
std::string FileID
Unique identifier for an uploaded file.
Definition types.hpp:29
json NormalizeSchema(json schema)
Wraps a minimal properties-only JSON object into a full JSON Schema.
Top-level namespace for the ForestHub SDK.
Minimal Optional<T> polyfill for C++14 compatibility.
Model-specific generation options (temperature, max_tokens, etc.).
JSON Schema normalization utilities.
Minimal Optional<T> polyfill for C++14 compatibility.
Definition optional.hpp:21
std::string previous_response_id
Previous response ID for multi-turn context.
Definition types.hpp:43
std::vector< std::shared_ptr< Tool > > tools
Tools available to the model.
Definition types.hpp:45
ChatRequest & WithPreviousResponseId(std::string id)
Link to a previous response for multi-turn context.
Definition types.hpp:68
ChatRequest & WithTopK(int top_k)
Set the top-k sampling limit.
Definition types.hpp:117
ChatRequest & AddImageUrl(std::string url)
Attach an image by URL.
Definition types.hpp:99
ChatRequest & WithTopP(float top_p)
Set the nucleus sampling cutoff.
Definition types.hpp:123
ChatRequest & WithPresencePenalty(float presence_penalty)
Set the presence penalty.
Definition types.hpp:135
std::vector< FileID > file_ids
Attached file identifiers.
Definition types.hpp:46
ModelID model
Target model identifier.
Definition types.hpp:40
ChatRequest & AddFileId(FileID file_id)
Attach an uploaded file to the request.
Definition types.hpp:87
std::vector< FileID > image_ids
Attached image identifiers.
Definition types.hpp:47
std::vector< std::string > image_urls
Attached image URLs.
Definition types.hpp:48
ChatRequest & WithTemperature(float temperature)
Set the sampling temperature.
Definition types.hpp:105
ChatRequest(ModelID model, std::shared_ptr< Input > input)
Construct a request with model and input.
Definition types.hpp:57
ChatRequest & AddTool(std::shared_ptr< Tool > tool)
Append a tool to the request.
Definition types.hpp:81
foresthub::Optional< ResponseFormat > response_format
Optional structured output format.
Definition types.hpp:44
ChatRequest & AddImageId(FileID image_id)
Attach an uploaded image to the request.
Definition types.hpp:93
ChatRequest & WithSystemPrompt(std::string prompt)
Set the system prompt.
Definition types.hpp:62
ChatRequest()=default
Default constructor. Use the two-argument constructor or builder methods for configuration.
Options options
Generation parameters.
Definition types.hpp:49
ChatRequest & WithMaxTokens(int max_tokens)
Set the maximum number of tokens to generate.
Definition types.hpp:111
std::shared_ptr< Input > input
Polymorphic input (InputString or InputItems).
Definition types.hpp:41
std::string system_prompt
System-level instructions.
Definition types.hpp:42
ChatRequest & WithSeed(int seed)
Set the random seed for deterministic output.
Definition types.hpp:141
ChatRequest & WithResponseFormat(ResponseFormat format)
Set the structured output format.
Definition types.hpp:74
ChatRequest & WithFrequencyPenalty(float frequency_penalty)
Set the frequency penalty.
Definition types.hpp:129
Chat completion response from an LLM provider.
Definition types.hpp:148
std::vector< ToolCallRequest > tool_call_requests
Pending function calls requested by the model.
Definition types.hpp:151
std::string text
Generated text output.
Definition types.hpp:149
std::vector< std::shared_ptr< InternalToolCall > > tools_called
Log of internal tools invoked by the model.
Definition types.hpp:150
std::string response_id
Provider-assigned response identifier.
Definition types.hpp:152
int tokens_used
Total tokens consumed.
Definition types.hpp:153
Model-specific generation options.
Definition options.hpp:17