Client for Anthropic API (Claude)
More...
#include <AnthropicClient.hpp>
|
| | AnthropicClient (const std::string &apiKey, const std::string &model="claude-3-sonnet-20240229", const std::string &baseUrl="https://api.anthropic.com/v1") |
| |
| | ~AnthropicClient () 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 |
| |
| 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 &apiKeyHeader) const |
| |
Client for Anthropic API (Claude)
Supports: claude-3-opus, claude-3-sonnet, claude-3-haiku API: https://api.anthropic.com/v1 Authentication: x-api-key header
◆ AnthropicClient()
| ai::AnthropicClient::AnthropicClient |
( |
const std::string & |
apiKey, |
|
|
const std::string & |
model = "claude-3-sonnet-20240229", |
|
|
const std::string & |
baseUrl = "https://api.anthropic.com/v1" |
|
) |
| |
|
explicit |
◆ ~AnthropicClient()
| ai::AnthropicClient::~AnthropicClient |
( |
| ) |
|
|
overridedefault |
◆ GetModelName()
| std::string ai::AnthropicClient::GetModelName |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ GetProviderName()
| virtual std::string ai::AnthropicClient::GetProviderName |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ GetServiceId()
| std::string ai::AnthropicClient::GetServiceId |
( |
| ) |
const |
|
overridevirtual |
◆ GetServiceType()
| std::string ai::IAIService::GetServiceType |
( |
| ) |
const |
|
inlineoverridevirtualinherited |
◆ IsAvailable()
| bool ai::AnthropicClient::IsAvailable |
( |
| ) |
const |
|
overridevirtual |
Check if the AI service is available.
- Returns
- true if service can be reached
Implements ai::IAIService.
◆ SendHttpPost()
| std::string ai::AnthropicClient::SendHttpPost |
( |
const std::string & |
endpoint, |
|
|
const std::string & |
jsonBody, |
|
|
const std::string & |
apiKeyHeader |
|
) |
| const |
|
private |
◆ SendPrompt()
| std::string ai::AnthropicClient::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.
◆ SetModelName()
| void ai::AnthropicClient::SetModelName |
( |
const std::string & |
model | ) |
|
|
overridevirtual |
◆ m_apiKey
| std::string ai::AnthropicClient::m_apiKey |
|
private |
◆ m_baseUrl
| std::string ai::AnthropicClient::m_baseUrl |
|
private |
◆ m_model
| std::string ai::AnthropicClient::m_model |
|
private |
The documentation for this class was generated from the following files: