Table of Contents

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

logger ILogger

Logger instance for logging operations.

apiKey string

Google API key for authentication.

isBasicLoggingEnabled bool

Whether basic logging is enabled.

isVerboseLoggingEnabled bool

Whether verbose logging is enabled for debugging.

isDetailedLoggingEnabled bool

Whether 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

prompt string

The prompt to send to Gemini.

model string

Gemini model to use (default: gemini-2.5-flash).

temperature float

Temperature for response generation (default: 0.0).

maxOutputTokens int

Maximum tokens in response (default: 8192).

Returns

Task<string>

Gemini's response text, or null if the call failed.