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

public class ClaudePromptHandler extends AbstractLLMHandler
Handles communication with the Anthropic Claude API. Builds the request payload, sends the HTTP request, processes the response, and returns the generated text. Supports error handling for rate limits and API-specific error messages.
  • Constructor Details

    • ClaudePromptHandler

      public ClaudePromptHandler()
      Constructs a new ClaudePromptHandler instance, initializing the underlying HTTP client and JSON parser via the AbstractLLMHandler superclass.
  • Method Details

    • prompt

      public String prompt(String input, String model, String apiKey, double temperature) throws LLMException
      Sends a prompt request to the Claude API and returns the model's response text.

      Builds and submits an HTTP request containing the user input, model name, API key, and temperature parameter. Handles HTTP errors and rate limits, parsing error messages or retry-after values where available.

      Parameters:
      input - the user input to be processed by the model
      model - the Claude model identifier
      apiKey - the API key used for authentication
      temperature - the sampling temperature for response generation
      Returns:
      the text content of Claude's response
      Throws:
      LLMException - if the request fails, is rate limited, or the response is invalid