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

public class DeepSeekPromptHandler extends AbstractLLMHandler
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.

  • Constructor Details

    • DeepSeekPromptHandler

      public DeepSeekPromptHandler()
      Constructs a new DeepSeekPromptHandler 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 model
      model - the model identifier to use
      apiKey - the DeepSeek API key for authentication
      temperature - 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