Skip to content

Commit 7a5d7d2

Browse files
committed
use data classes
1 parent 7d10bcd commit 7a5d7d2

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

src/main/kotlin/com/cjcrafter/openai/chat/ChatChoice.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import com.google.gson.JsonObject
1919
* @constructor Create a new chat choice, for internal usage.
2020
* @see FinishReason
2121
*/
22-
class ChatChoice(val index: Int, val message: ChatMessage, val finishReason: FinishReason?) {
22+
data class ChatChoice(val index: Int, val message: ChatMessage, val finishReason: FinishReason?) {
2323

2424
/**
2525
* JSON constructor for internal usage.

src/main/kotlin/com/cjcrafter/openai/chat/ChatRequest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ import com.google.gson.annotations.SerializedName
3636
* @property user Who sent this request (for moderation).
3737
* @constructor Create a chat request
3838
* @see ChatBot.generateResponse
39-
* @see <a href="https://platform.openai.com/docs/api-reference/completions/create">OpenAI Uncyclo</a>
39+
* @see <a href="https://platform.openai.com/docs/api-reference/completions/create">Chat API Reference</a>
40+
* @see <a href="https://platform.openai.com/docs/guides/chat">Chat User Reference</a>
4041
*/
4142
data class ChatRequest @JvmOverloads constructor(
4243
var model: String,

src/main/kotlin/com/cjcrafter/openai/chat/ChatUsage.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ import com.google.gson.JsonObject
1313
* @param promptTokens How many tokens the input used.
1414
* @param completionTokens How many tokens the output used.
1515
* @param totalTokens How many tokens in total.
16+
* @see <a href="https://platform.openai.com/docs/guides/chat/managing-tokens">Managing Tokens Guide</a>
1617
*/
17-
class ChatUsage(val promptTokens: Int, val completionTokens: Int, val totalTokens: Int) {
18+
data class ChatUsage(val promptTokens: Int, val completionTokens: Int, val totalTokens: Int) {
1819

1920
/**
2021
* JSON constructor for internal usage.

src/main/kotlin/com/cjcrafter/openai/chat/FinishReason.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package com.cjcrafter.openai.chat
22

33
/**
44
* [FinishReason] wraps the possible reasons that a generation model may stop
5-
* generating tokens. For most **PROPER** use cases (see [best practices]()),
5+
* generating tokens. For most **PROPER** use cases (see [best practices](https://platform.openai.com/docs/guides/chat/introduction)),
66
* the finish reason will be [STOP]. When working with streams, finish reason
77
* will be `null` since it has not completed the message yet.
88
*/

0 commit comments

Comments
 (0)