Class GeminiService

java.lang.Object
springboot.bg.harisauto.chatbot.service.GeminiService

@Service public class GeminiService extends Object
GeminiService.java - Service for interacting with Gemini AI API.
Author:
Kristian Popov
  • Constructor Details

    • GeminiService

      public GeminiService(com.google.genai.Client client, com.google.genai.types.GenerateContentConfig config)
  • Method Details

    • getGeminiResponse

      @Retryable(retryFor=com.google.genai.errors.ServerException.class, maxAttempts=3, backoff=@Backoff(delay=2000L,multiplier=2.0)) public String getGeminiResponse(String prompt)
      Asks Gemini AI API for a response.
      Parameters:
      prompt - The prompt to send to Gemini.
      Returns:
      The response text from Gemini.