Module de.seggebaeing.sqlanalyzer
Class DeepSeekPromptHandler
java.lang.Object
de.seggebaeing.sqlanalyzer.logic.promptable.impl.llm.AbstractLLMHandler
de.seggebaeing.sqlanalyzer.logic.promptable.impl.llm.DeepSeekPromptHandler
- All Implemented Interfaces:
Promptable
Handles communication with the DeepSeek API for generating chat completions.
Builds and sends requests to the DeepSeek endpoint, processes responses, and extracts the generated text. Handles error responses, including unexpected formats, API errors, and potential rate limits.
-
Field Summary
Fields inherited from class de.seggebaeing.sqlanalyzer.logic.promptable.impl.llm.AbstractLLMHandler
client, gson
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newDeepSeekPromptHandler
and initializes the required HTTP client and JSON utilities via the superclass. -
Method Summary
-
Constructor Details
-
DeepSeekPromptHandler
public DeepSeekPromptHandler()Constructs a newDeepSeekPromptHandler
and initializes the required HTTP client and JSON utilities 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 DeepSeek API and retrieves the generated response.Builds a JSON request with the given parameters, sends it via HTTP, and parses the API response to extract the first choice's message content.
- Parameters:
input
- the user prompt to send to the modelmodel
- the model identifier to useapiKey
- the DeepSeek API key for authenticationtemperature
- the sampling temperature controlling randomness- Returns:
- the generated response text from DeepSeek
- Throws:
LLMException
- if the request fails, returns an error, or the response is malformed
-