LogViewer
A modern log viewer with AI-assisted analysis (Qt 6)
Loading...
Searching...
No Matches
AnthropicClient.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "IAIService.hpp"
4#include <string>
5
6namespace ai
7{
8
17{
18public:
19 explicit AnthropicClient(const std::string& apiKey,
20 const std::string& model = "claude-3-sonnet-20240229",
21 const std::string& baseUrl = "https://api.anthropic.com/v1");
22 ~AnthropicClient() override = default;
23
24 std::string SendPrompt(const std::string& prompt,
25 std::function<void(const std::string&)> callback = nullptr) override;
26
27 bool IsAvailable() const override;
28 std::string GetModelName() const override { return m_model; }
29
30 void SetModelName(const std::string& model) override;
31
35 virtual std::string GetProviderName() const override { return "anthropic"; }
36
38 std::string GetServiceId() const override;
39
40private:
41 std::string m_apiKey;
42 std::string m_model;
43 std::string m_baseUrl;
44
45 std::string SendHttpPost(const std::string& endpoint,
46 const std::string& jsonBody,
47 const std::string& apiKeyHeader) const;
48};
49
50} // namespace ai
Client for Anthropic API (Claude)
Definition AnthropicClient.hpp:17
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.
Definition AnthropicClient.cpp:34
std::string SendHttpPost(const std::string &endpoint, const std::string &jsonBody, const std::string &apiKeyHeader) const
Definition AnthropicClient.cpp:102
void SetModelName(const std::string &model) override
Definition AnthropicClient.cpp:91
std::string m_apiKey
Definition AnthropicClient.hpp:41
std::string GetServiceId() const override
Unique identifier for this service instance.
Definition AnthropicClient.cpp:97
std::string GetModelName() const override
Get the name of the model being used.
Definition AnthropicClient.hpp:28
std::string m_baseUrl
Definition AnthropicClient.hpp:43
bool IsAvailable() const override
Check if the AI service is available.
Definition AnthropicClient.cpp:86
virtual std::string GetProviderName() const override
Get the name of the AI provider.
Definition AnthropicClient.hpp:35
std::string m_model
Definition AnthropicClient.hpp:42
~AnthropicClient() override=default
Interface for AI service communication.
Definition IAIService.hpp:14
Definition GemmaInferenceEngine.cpp:18