Class GeminiApiService
- Namespace
- SunamoAI
- Assembly
- SunamoAI.dll
Service for calling Google Gemini API with configurable logging levels.
public class GeminiApiService
- Inheritance
-
GeminiApiService
- Inherited Members
- Extension Methods
Constructors
GeminiApiService(ILogger, string, bool, bool, bool)
Initializes a new instance of the GeminiApiService class.
public GeminiApiService(ILogger logger, string apiKey, bool isBasicLoggingEnabled = false, bool isVerboseLoggingEnabled = false, bool isDetailedLoggingEnabled = false)
Parameters
loggerILoggerLogger instance for logging operations.
apiKeystringGoogle API key for authentication.
isBasicLoggingEnabledboolWhether basic logging is enabled.
isVerboseLoggingEnabledboolWhether verbose logging is enabled for debugging.
isDetailedLoggingEnabledboolWhether detailed logging is enabled for API calls.
Methods
CallGeminiApi(string, string, float, int)
Calls Gemini API with a prompt and returns the response.
public Task<string?> CallGeminiApi(string prompt, string model = "gemini-2.5-flash", float temperature = 0, int maxOutputTokens = 8192)
Parameters
promptstringThe prompt to send to Gemini.
modelstringGemini model to use (default: gemini-2.5-flash).
temperaturefloatTemperature for response generation (default: 0.0).
maxOutputTokensintMaximum tokens in response (default: 8192).