Class ClaudeApiService
- Namespace
- SunamoAI
- Assembly
- SunamoAI.dll
Service for calling Claude API (Anthropic HTTP API) with configurable logging levels.
public class ClaudeApiService
- Inheritance
-
ClaudeApiService
- Inherited Members
- Extension Methods
Constructors
ClaudeApiService(ILogger, string, bool, bool)
Initializes a new instance of the ClaudeApiService class.
public ClaudeApiService(ILogger logger, string apiKey, bool isVerboseLoggingEnabled = false, bool isDetailedLoggingEnabled = false)
Parameters
loggerILoggerLogger instance for logging operations.
apiKeystringAnthropic API key for authentication.
isVerboseLoggingEnabledboolWhether verbose logging is enabled for debugging.
isDetailedLoggingEnabledboolWhether detailed logging is enabled for API calls.
Methods
CallClaudeApi(string, string, int, double)
Calls Claude API with a prompt and returns the response.
public Task<string?> CallClaudeApi(string prompt, string model = "claude-sonnet-4-20250514", int maxTokens = 1024, double temperature = 0)
Parameters
promptstringThe prompt to send to Claude.
modelstringClaude model to use (default: claude-sonnet-4-20250514).
maxTokensintMaximum tokens in response (default: 1024).
temperaturedoubleTemperature for response generation (default: 0.0).