From 32605d0b7081ee942e35e4195336aff693a269ae Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Thu, 31 Oct 2024 13:22:09 +0100 Subject: [PATCH] Complete the JavaDoc for API entities --- .../penguineering/hareairis/model/ChatError.java | 16 ++++++++++++++++ .../hareairis/model/ChatRequest.java | 13 +++++++++++-- .../hareairis/model/ChatResponse.java | 16 +++++++++++++++- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/penguineering/hareairis/model/ChatError.java b/src/main/java/com/penguineering/hareairis/model/ChatError.java index 877859b..1513ca0 100644 --- a/src/main/java/com/penguineering/hareairis/model/ChatError.java +++ b/src/main/java/com/penguineering/hareairis/model/ChatError.java @@ -6,17 +6,33 @@ import lombok.Getter; import lombok.NoArgsConstructor; +/** + * Represents a chat error. + * + *

Represents a chat error that can be sent back to the chat client.

+ */ @AllArgsConstructor @NoArgsConstructor @Getter @JsonIgnoreProperties(ignoreUnknown = true) public class ChatError { + /** + * The error code, matching an HTTP status code. + */ @JsonProperty("code") private int code; + /** + * The error message. + */ @JsonProperty("message") private String message; + /** + * Creates a new chat error from a chat exception. + * + * @param ex The chat exception. + */ public ChatError(ChatException ex) { this.code = ex.getCode(); this.message = ex.getMessage(); diff --git a/src/main/java/com/penguineering/hareairis/model/ChatRequest.java b/src/main/java/com/penguineering/hareairis/model/ChatRequest.java index 68d0757..b67bf75 100644 --- a/src/main/java/com/penguineering/hareairis/model/ChatRequest.java +++ b/src/main/java/com/penguineering/hareairis/model/ChatRequest.java @@ -6,16 +6,25 @@ import lombok.Getter; import lombok.NoArgsConstructor; -import java.util.Optional; - +/** + * Represents a chat request. + * + *

Represents a chat request that can be sent to the AI service.

+ */ @NoArgsConstructor @AllArgsConstructor @Getter @JsonIgnoreProperties(ignoreUnknown = true) public class ChatRequest { + /** + * The system message of the chat client. + */ @JsonProperty("system-message") private String systemMessage = ""; + /** + * The actual prompt. + */ @JsonProperty("prompt") private String prompt = ""; diff --git a/src/main/java/com/penguineering/hareairis/model/ChatResponse.java b/src/main/java/com/penguineering/hareairis/model/ChatResponse.java index ddd2830..54c7ce4 100644 --- a/src/main/java/com/penguineering/hareairis/model/ChatResponse.java +++ b/src/main/java/com/penguineering/hareairis/model/ChatResponse.java @@ -4,18 +4,32 @@ import com.fasterxml.jackson.annotation.JsonProperty; import lombok.*; +/** + * Represents a chat response. + * + *

Represents a chat response that can be sent back to the chat client.

+ */ @NoArgsConstructor @AllArgsConstructor @Getter @Builder(toBuilder = true) @JsonIgnoreProperties(ignoreUnknown = true) public class ChatResponse { + /** + * The response from the AI service. + */ @JsonProperty("response") private String response; + /** + * The number of input tokens. + */ @JsonProperty("input-tokens") private int inputTokens; + /** + * The number of output tokens. + */ @JsonProperty("output-tokens") private int outputTokens; -} \ No newline at end of file +}