java.lang.Object
de.seggebaeing.sqlanalyzer.logic.promptable.impl.llm.AbstractLLMHandler
de.seggebaeing.sqlanalyzer.logic.promptable.impl.llm.GeminiPromptHandler
All Implemented Interfaces:
Promptable

public class GeminiPromptHandler extends AbstractLLMHandler
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
  • Constructor Details

    • GeminiPromptHandler

      public GeminiPromptHandler()
      Constructs a new GeminiPromptHandler, 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 model
      model - the Gemini model identifier to use
      apiKey - the API key for authenticating with the Gemini API
      temperature - 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