Class DeepSeekCompletionResponse
java.lang.Object
de.entwicklertraining.api.base.ApiResponse<DeepSeekCompletionRequest>
de.entwicklertraining.deepseek4j.DeepSeekResponse<DeepSeekCompletionRequest>
de.entwicklertraining.deepseek4j.chat.completion.DeepSeekCompletionResponse
Represents a response from the DeepSeek Chat Completion API.
Provides methods to access various parts of the response data.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a single choice in the chat completion response.static classRepresents detailed token counts within the completion usage.static classRepresents the function details within a tool call.static classRepresents log probability information for the completion.static classRepresents a message within a choice, including content and potential tool calls.static classRepresents log probability information for a single token.static classRepresents a tool call requested by the model.static classRepresents log probability information for one of the top alternative tokens.static classRepresents usage statistics for the API call. -
Field Summary
Fields inherited from class de.entwicklertraining.deepseek4j.DeepSeekResponse
json -
Constructor Summary
ConstructorsConstructorDescriptionDeepSeekCompletionResponse(org.json.JSONObject json, DeepSeekCompletionRequest request) Constructs a DeepSeekCompletionResponse. -
Method Summary
Modifier and TypeMethodDescriptionConvenience method to get the message content from the first choice.Convenience method to get the finish reason from the first choice.Gets the list of chat completion choices.longGets the Unix timestamp (in seconds) of when the chat completion was created.getId()Gets the unique identifier for the chat completion.getModel()Gets the model used for the chat completion.Gets the object type, which is always "chat.completion".Gets the system fingerprint representing the backend configuration used for the request.getUsage()Gets the usage statistics for the completion request.Methods inherited from class de.entwicklertraining.deepseek4j.DeepSeekResponse
getJson, getRequest
-
Constructor Details
-
DeepSeekCompletionResponse
Constructs a DeepSeekCompletionResponse.- Parameters:
json- The raw JSON response object.request- The original request that led to this response.
-
-
Method Details
-
getId
Gets the unique identifier for the chat completion.- Returns:
- The ID string, or null if not present. [cite: 30]
-
getObject
Gets the object type, which is always "chat.completion".- Returns:
- The object type string, or null if not present.
-
getCreated
public long getCreated()Gets the Unix timestamp (in seconds) of when the chat completion was created.- Returns:
- The creation timestamp, or 0 if not present.
-
getModel
Gets the model used for the chat completion.- Returns:
- The model ID string, or null if not present.
-
getSystemFingerprint
Gets the system fingerprint representing the backend configuration used for the request.- Returns:
- The system fingerprint string, or null if not present.
-
getChoices
Gets the list of chat completion choices.- Returns:
- A list of Choice objects, or an empty list if not present or invalid. [cite: 31, 32]
-
getUsage
Gets the usage statistics for the completion request.- Returns:
- A Usage object, or null if the "usage" field is not present or invalid. [cite: 27]
-
assistantMessage
Convenience method to get the message content from the first choice.- Returns:
- The content string, or null if no choices or message content exists.
-
finishReason
Convenience method to get the finish reason from the first choice.- Returns:
- The finish reason string (e.g., "stop", "tool_calls"), or null if no choices exist.
-