Client for communicating with local Ollama LLM server.
More...
#include <OllamaClient.hpp>
|
| | OllamaClient (const std::string &model="llama3.2", const std::string &baseUrl="http://localhost:11434") |
| |
| | ~OllamaClient () override=default |
| |
| std::string | SendPrompt (const std::string &prompt, std::function< void(const std::string &)> callback=nullptr) override |
| | Send a prompt to the AI and get a response.
|
| |
| bool | IsAvailable () const override |
| | Check if the AI service is available.
|
| |
| std::string | GetModelName () const override |
| | Get the name of the model being used.
|
| |
| void | SetModelName (const std::string &model) override |
| |
| void | SetBaseUrl (const std::string &url) |
| |
| std::vector< ModelInfo > | GetInstalledModels () const |
| | Get list of installed models from Ollama.
|
| |
| virtual std::string | GetProviderName () const override |
| | Get the name of the AI provider.
|
| |
| std::string | GetServiceId () const override |
| | Unique identifier for this service instance.
|
| |
| std::string | GetServiceType () const override |
| | Type of service ("ai", "analyzer", "exporter", etc.)
|
| |
|
| std::string | SendHttpPost (const std::string &endpoint, const std::string &jsonBody) const |
| |
| std::string | SendHttpGet (const std::string &endpoint) const |
| |
Client for communicating with local Ollama LLM server.
Ollama runs locally and provides OpenAI-compatible API. Default endpoint: http://localhost:11434
◆ OllamaClient()
| ai::OllamaClient::OllamaClient |
( |
const std::string & |
model = "llama3.2", |
|
|
const std::string & |
baseUrl = "http://localhost:11434" |
|
) |
| |
|
explicit |
◆ ~OllamaClient()
| ai::OllamaClient::~OllamaClient |
( |
| ) |
|
|
overridedefault |
◆ GetInstalledModels()
| std::vector< ModelInfo > OllamaClient::GetInstalledModels |
( |
| ) |
const |
Get list of installed models from Ollama.
- Returns
- Vector of model information
◆ GetModelName()
| std::string OllamaClient::GetModelName |
( |
| ) |
const |
|
overridevirtual |
◆ GetProviderName()
| virtual std::string ai::OllamaClient::GetProviderName |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ GetServiceId()
| std::string OllamaClient::GetServiceId |
( |
| ) |
const |
|
overridevirtual |
◆ GetServiceType()
| std::string ai::IAIService::GetServiceType |
( |
| ) |
const |
|
inlineoverridevirtualinherited |
◆ IsAvailable()
| bool OllamaClient::IsAvailable |
( |
| ) |
const |
|
overridevirtual |
Check if the AI service is available.
- Returns
- true if service can be reached
Implements ai::IAIService.
◆ SendHttpGet()
| std::string OllamaClient::SendHttpGet |
( |
const std::string & |
endpoint | ) |
const |
|
private |
◆ SendHttpPost()
| std::string OllamaClient::SendHttpPost |
( |
const std::string & |
endpoint, |
|
|
const std::string & |
jsonBody |
|
) |
| const |
|
private |
◆ SendPrompt()
| std::string ai::OllamaClient::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.
◆ SetBaseUrl()
| void OllamaClient::SetBaseUrl |
( |
const std::string & |
url | ) |
|
◆ SetModelName()
| void OllamaClient::SetModelName |
( |
const std::string & |
model | ) |
|
|
overridevirtual |
◆ m_baseUrl
| std::string ai::OllamaClient::m_baseUrl |
|
private |
◆ m_model
| std::string ai::OllamaClient::m_model |
|
private |
The documentation for this class was generated from the following files: