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

Direct OpenAI provider using the Responses API (POST /v1/responses). More...

#include <openai.hpp>

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

Public Member Functions

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

Detailed Description

Direct OpenAI provider using the Responses API (POST /v1/responses).

Constructor & Destructor Documentation

◆ OpenAIProvider()

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

Construct an OpenAI 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::OpenAIProvider::Chat ( const core::ChatRequest & req)
overridevirtual

Send a chat request to the OpenAI Responses 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::OpenAIProvider::Health ( ) const
overridevirtual

Check that the OpenAI API is reachable.

Returns
Error message on failure, empty on success.

Implements foresthub::core::Provider.

◆ SupportsModel()

bool foresthub::provider::remote::OpenAIProvider::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: