Class DeepSeekRequest<T extends DeepSeekResponse<?>>
java.lang.Object
de.entwicklertraining.api.base.ApiRequest<T>
de.entwicklertraining.deepseek4j.DeepSeekRequest<T>
- Direct Known Subclasses:
DeepSeekCompletionRequest,DeepSeekModelsRequest,DeepSeekUserBalanceRequest
public abstract class DeepSeekRequest<T extends DeepSeekResponse<?>>
extends de.entwicklertraining.api.base.ApiRequest<T>
A generic request abstraction for DeepSeek calls (chat completions, etc.).
Subclasses must provide:
- the target URI (e.g. https://api.deepseek.com/chat/completions)
- the HTTP method (POST, GET, ...)
- the request body (JSON payload or null)
- a factory method to create the corresponding response object
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected <Y extends de.entwicklertraining.api.base.ApiRequestBuilderBase<?,?>> DeepSeekRequest(Y builder) -
Method Summary
Modifier and TypeMethodDescriptioncreateResponse(byte[] responseBytes) If the request expects a binary response, implement this method to produce the DeepSeekResponse from raw bytes.abstract TcreateResponse(String responseBody) abstract StringgetBody()Returns the request body as a String (often JSON).byte[]If there's a binary body, override this.By default, we use "application/json".abstract StringReturns the HTTP method (e.g.booleanIf the request expects a binary response, override and return true.Methods inherited from class de.entwicklertraining.api.base.ApiRequest
getAdditionalHeaders, getCaptureOnError, getCaptureOnSuccess, getIsCanceledSupplier, getMaxExecutionTimeInSeconds, getRelativeUrl, hasCaptureOnError, hasCaptureOnSuccess, setHeader
-
Constructor Details
-
DeepSeekRequest
protected <Y extends de.entwicklertraining.api.base.ApiRequestBuilderBase<?,?>> DeepSeekRequest(Y builder)
-
-
Method Details
-
getHttpMethod
Returns the HTTP method (e.g. "POST" or "GET").- Specified by:
getHttpMethodin classde.entwicklertraining.api.base.ApiRequest<T extends DeepSeekResponse<?>>
-
getBody
Returns the request body as a String (often JSON). May be null if GET.- Specified by:
getBodyin classde.entwicklertraining.api.base.ApiRequest<T extends DeepSeekResponse<?>>
-
createResponse
- Specified by:
createResponsein classde.entwicklertraining.api.base.ApiRequest<T extends DeepSeekResponse<?>>
-
isBinaryResponse
public boolean isBinaryResponse()If the request expects a binary response, override and return true. By default, this is false.- Overrides:
isBinaryResponsein classde.entwicklertraining.api.base.ApiRequest<T extends DeepSeekResponse<?>>
-
createResponse
If the request expects a binary response, implement this method to produce the DeepSeekResponse from raw bytes.- Overrides:
createResponsein classde.entwicklertraining.api.base.ApiRequest<T extends DeepSeekResponse<?>>
-
getContentType
By default, we use "application/json".- Overrides:
getContentTypein classde.entwicklertraining.api.base.ApiRequest<T extends DeepSeekResponse<?>>
-
getBodyBytes
public byte[] getBodyBytes()If there's a binary body, override this. Here it's unsupported.- Overrides:
getBodyBytesin classde.entwicklertraining.api.base.ApiRequest<T extends DeepSeekResponse<?>>
-