Module de.seggebaeing.sqlanalyzer
Class GeminiPromptHandler
java.lang.Object
de.seggebaeing.sqlanalyzer.logic.promptable.impl.llm.AbstractLLMHandler
de.seggebaeing.sqlanalyzer.logic.promptable.impl.llm.GeminiPromptHandler
- All Implemented Interfaces:
Promptable
Handles communication with the Google Gemini API.
Builds a generateContent
request, sends it via the shared HTTP client,
and extracts the generated text from the response. Non-200 responses are parsed
for provider error details; HTTP 429 triggers a RateLimitException
.
- Since:
- 1.0
- Author:
- Felix Seggebäing
-
Field Summary
Fields inherited from class de.seggebaeing.sqlanalyzer.logic.promptable.impl.llm.AbstractLLMHandler
client, gson
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newGeminiPromptHandler
, initializing the shared HTTP client and JSON parser via the superclass. -
Method Summary
-
Constructor Details
-
GeminiPromptHandler
public GeminiPromptHandler()Constructs a newGeminiPromptHandler
, initializing the shared HTTP client and JSON parser via the superclass.
-
-
Method Details
-
prompt
public String prompt(String input, String model, String apiKey, double temperature) throws LLMException Sends a prompt request to the Gemini API and returns the model's response text.- Parameters:
input
- the user input or query to be processed by the modelmodel
- the Gemini model identifier to useapiKey
- the API key for authenticating with the Gemini APItemperature
- the sampling temperature controlling randomness in the response- Returns:
- the generated response text from Gemini
- Throws:
LLMException
- if the API returns an error, a rate limit is hit, or the response is invalid
-