Generic client for communicating with LLM services.
More...
#include <LLMClient.hpp>
|
| std::string | SendHttpPost (const std::string &endpoint, const std::string &jsonBody) const |
| |
| std::string | SendHttpGet (const std::string &endpoint) const |
| |
| std::string | BuildRequestBody (const std::string &prompt) const |
| |
| std::string | ParseResponse (const std::string &response) const |
| |
Generic client for communicating with LLM services.
Supports multiple providers:
◆ LLMClient()
◆ ~LLMClient()
| ai::LLMClient::~LLMClient |
( |
| ) |
|
|
overridedefault |
◆ BuildRequestBody()
| std::string ai::LLMClient::BuildRequestBody |
( |
const std::string & |
prompt | ) |
const |
|
private |
◆ GetBaseUrl()
| std::string ai::LLMClient::GetBaseUrl |
( |
| ) |
const |
|
inline |
◆ GetDefaultBaseUrl()
| std::string ai::LLMClient::GetDefaultBaseUrl |
( |
LLMProvider |
provider | ) |
|
|
static |
Get default base URL for a provider.
◆ GetInstalledModels()
| std::vector< ModelInfo > ai::LLMClient::GetInstalledModels |
( |
| ) |
const |
Get list of installed models (Ollama/LM Studio only)
- Returns
- Vector of model information
◆ GetModelName()
| std::string ai::LLMClient::GetModelName |
( |
| ) |
const |
|
overridevirtual |
◆ GetProvider()
◆ GetProviderName()
| std::string ai::LLMClient::GetProviderName |
( |
| ) |
const |
|
overridevirtual |
◆ GetServiceId()
| std::string ai::LLMClient::GetServiceId |
( |
| ) |
const |
|
overridevirtual |
◆ GetServiceType()
| std::string ai::IAIService::GetServiceType |
( |
| ) |
const |
|
inlineoverridevirtualinherited |
◆ IsAvailable()
| bool ai::LLMClient::IsAvailable |
( |
| ) |
const |
|
overridevirtual |
Check if the AI service is available.
- Returns
- true if service can be reached
Implements ai::IAIService.
◆ ParseResponse()
| std::string ai::LLMClient::ParseResponse |
( |
const std::string & |
response | ) |
const |
|
private |
◆ SendHttpGet()
| std::string ai::LLMClient::SendHttpGet |
( |
const std::string & |
endpoint | ) |
const |
|
private |
◆ SendHttpPost()
| std::string ai::LLMClient::SendHttpPost |
( |
const std::string & |
endpoint, |
|
|
const std::string & |
jsonBody |
|
) |
| const |
|
private |
◆ SendPrompt()
| std::string ai::LLMClient::SendPrompt |
( |
const std::string & |
prompt, |
|
|
std::function< void(const std::string &)> |
callback = nullptr |
|
) |
| |
|
overridevirtual |
Send a prompt to the AI and get a response.
- Parameters
-
| prompt | The text prompt to send |
| callback | Function called with response chunks as they arrive |
- Returns
- Complete response text
Implements ai::IAIService.
◆ SetApiKey()
| void ai::LLMClient::SetApiKey |
( |
const std::string & |
apiKey | ) |
|
◆ SetBaseUrl()
| void ai::LLMClient::SetBaseUrl |
( |
const std::string & |
url | ) |
|
◆ SetModelName()
| void ai::LLMClient::SetModelName |
( |
const std::string & |
model | ) |
|
|
overridevirtual |
◆ SetProvider()
| void ai::LLMClient::SetProvider |
( |
LLMProvider |
provider | ) |
|
◆ m_apiKey
| std::string ai::LLMClient::m_apiKey |
|
private |
◆ m_baseUrl
| std::string ai::LLMClient::m_baseUrl |
|
private |
◆ m_model
| std::string ai::LLMClient::m_model |
|
private |
◆ m_provider
The documentation for this class was generated from the following files: