ForestHub SDK 0.1.0
C++14 LLM SDK for PC and embedded platforms
Loading...
Searching...
No Matches
foresthub::provider::remote::GeminiProvider Class Reference

Direct Google Gemini provider using the native generateContent API (v1beta). More...

#include <gemini.hpp>

Inheritance diagram for foresthub::provider::remote::GeminiProvider:
foresthub::core::Provider foresthub::core::LLMClient

Public Member Functions

 GeminiProvider (const config::ProviderConfig &cfg, std::shared_ptr< core::HttpClient > http_client)
 Construct a Gemini provider from configuration.
core::ProviderID ProviderId () const override
 Returns "gemini" as the provider identifier.
std::string Health () const override
 Check that the Gemini API is reachable.
std::shared_ptr< core::ChatResponseChat (const core::ChatRequest &req) override
 Send a chat request to the Gemini generateContent API.
bool SupportsModel (const core::ModelID &model) const override
 Check if this provider handles the given model.

Detailed Description

Direct Google Gemini provider using the native generateContent API (v1beta).

Google Search Grounding is supported via the WebSearch tool type, but it cannot be combined with function calling in the same request. When both are present, function calling takes priority and Google Search is silently dropped.

Constructor & Destructor Documentation

◆ GeminiProvider()

foresthub::provider::remote::GeminiProvider::GeminiProvider ( const config::ProviderConfig & cfg,
std::shared_ptr< core::HttpClient > http_client )

Construct a Gemini provider from configuration.

Parameters
cfgProvider configuration (api_key, base_url, supported_models).
http_clientHTTP implementation for API calls.

Member Function Documentation

◆ Chat()

std::shared_ptr< core::ChatResponse > foresthub::provider::remote::GeminiProvider::Chat ( const core::ChatRequest & req)
overridevirtual

Send a chat request to the Gemini generateContent API.

Parameters
reqChat request with model, input, and options.
Returns
Chat response, or nullptr on error.

Implements foresthub::core::LLMClient.

◆ Health()

std::string foresthub::provider::remote::GeminiProvider::Health ( ) const
overridevirtual

Check that the Gemini API is reachable.

Returns
Error message on failure, empty on success.

Implements foresthub::core::Provider.

◆ SupportsModel()

bool foresthub::provider::remote::GeminiProvider::SupportsModel ( const core::ModelID & model) const
overridevirtual

Check if this provider handles the given model.

Parameters
modelModel identifier to check.
Returns
True if supported_models is empty (accept all) or model is in the list.

Implements foresthub::core::Provider.


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