Module de.seggebaeing.sqlanalyzer
Class ClaudePromptHandler
java.lang.Object
de.seggebaeing.sqlanalyzer.logic.promptable.impl.llm.AbstractLLMHandler
de.seggebaeing.sqlanalyzer.logic.promptable.impl.llm.ClaudePromptHandler
- All Implemented Interfaces:
Promptable
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.
-
Field Summary
Fields inherited from class de.seggebaeing.sqlanalyzer.logic.promptable.impl.llm.AbstractLLMHandler
client, gson
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newClaudePromptHandler
instance, initializing the underlying HTTP client and JSON parser via theAbstractLLMHandler
superclass. -
Method Summary
-
Constructor Details
-
ClaudePromptHandler
public ClaudePromptHandler()Constructs a newClaudePromptHandler
instance, initializing the underlying HTTP client and JSON parser via theAbstractLLMHandler
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 modelmodel
- the Claude model identifierapiKey
- the API key used for authenticationtemperature
- 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
-