Class DeepSeekCompletionCallHandler

java.lang.Object
de.entwicklertraining.deepseek4j.chat.completion.DeepSeekCompletionCallHandler

public final class DeepSeekCompletionCallHandler extends Object
DeepSeekCompletionCallHandler orchestrates sending a DeepSeekCompletionRequest, handling any tool calls (function calls), and continuing the conversation until a final answer is reached or the max turns is exceeded. Supports: - Parallel tool calls if the server chooses (though the doc says we must handle them). - Structured outputs (response_format) if the user set that in the request. - "finish_reason" like "stop", "length", "content_filter", "tool_calls", "insufficient_system_resource"
  • Constructor Details

    • DeepSeekCompletionCallHandler

      public DeepSeekCompletionCallHandler(DeepSeekClient client)
  • Method Details

    • handleRequest

      public DeepSeekCompletionResponse handleRequest(DeepSeekCompletionRequest initialRequest, boolean useExponentialBackoff)
      Main method: sends the conversation to DeepSeek, handles potential tool calls, and repeats until a final response is reached or an error occurs.