File tree Expand file tree Collapse file tree 4 files changed +20
-7
lines changed
src/main/kotlin/com/cjcrafter/openai/chat Expand file tree Collapse file tree 4 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -13,15 +13,16 @@ import com.google.gson.JsonObject
1313 * generate, the more tokens you use. In general, it is best to **ONLY**
1414 * generate 1 response, and to let the user regenerate the response.
1515 *
16- * @param index The index in the array... 0 if [ChatRequest.n]=1.
17- * @param message The generated text.
18- * @param finishReason Why did the bot stop generating tokens?
16+ * @property index The index in the array... 0 if [ChatRequest.n]=1.
17+ * @property message The generated text.
18+ * @property finishReason Why did the bot stop generating tokens?
19+ * @constructor Create a new chat choice, for internal usage.
1920 * @see FinishReason
2021 */
2122class ChatChoice (val index : Int , val message : ChatMessage , val finishReason : FinishReason ? ) {
2223
2324 /* *
24- * JSON constructor for internal use .
25+ * JSON constructor for internal usage .
2526 */
2627 constructor (json: JsonObject ) : this (
2728 json[" index" ].asInt,
Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ import com.google.gson.JsonObject
66 * ChatGPT's biggest innovation is its conversation memory. To remember the
77 * conversation, we need to map each message to who sent it. This data class
88 * wraps a message with the user who sent the message.
9+ *
10+ * @property role The user who sent this message.
11+ * @property content The string content of the message.
12+ * @see ChatUser
913 */
1014data class ChatMessage (val role : ChatUser , val content : String ) {
1115
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ import com.google.gson.annotations.SerializedName
3333 * @property presencePenalty Prevent talking about duplicate topics. Defaults to `0.0`.
3434 * @property frequencyPenalty Prevent repeating the same text. Defaults to `0.0`.
3535 * @property logitBias Increase/Decrease the chances of a specific token to appear in generated text. Defaults to `null`.
36- * @property user Who send this request (for moderation).
36+ * @property user Who sent this request (for moderation).
3737 * @constructor Create a chat request
3838 * @see ChatBot.generateResponse
3939 * @see <a href="https://platform.openai.com/docs/api-reference/completions/create">OpenAI Wiki</a>
Original file line number Diff line number Diff line change @@ -3,8 +3,16 @@ package com.cjcrafter.openai.chat
33import com.google.gson.JsonObject
44
55/* *
6- * This is the object returned from the API. You want to access choices[0]
7- * to get your response.
6+ * The [ChatResponse] contains all the data returned by the OpenAI Chat API.
7+ * For most use cases, [ChatResponse.get] (passing 0 to the index argument) is
8+ * all you need.
9+ *
10+ * @property id
11+ * @property object
12+ * @property created
13+ * @property choices
14+ * @property usage
15+ * @constructor Create empty Chat response
816 */
917class ChatResponse (
1018 val id : String ,
You can’t perform that action at this time.
0 commit comments