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
13
13
* generate, the more tokens you use. In general, it is best to **ONLY**
14
14
* generate 1 response, and to let the user regenerate the response.
15
15
*
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.
19
20
* @see FinishReason
20
21
*/
21
22
class ChatChoice (val index : Int , val message : ChatMessage , val finishReason : FinishReason ? ) {
22
23
23
24
/* *
24
- * JSON constructor for internal use .
25
+ * JSON constructor for internal usage .
25
26
*/
26
27
constructor (json: JsonObject ) : this (
27
28
json[" index" ].asInt,
Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ import com.google.gson.JsonObject
6
6
* ChatGPT's biggest innovation is its conversation memory. To remember the
7
7
* conversation, we need to map each message to who sent it. This data class
8
8
* 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
9
13
*/
10
14
data class ChatMessage (val role : ChatUser , val content : String ) {
11
15
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ import com.google.gson.annotations.SerializedName
33
33
* @property presencePenalty Prevent talking about duplicate topics. Defaults to `0.0`.
34
34
* @property frequencyPenalty Prevent repeating the same text. Defaults to `0.0`.
35
35
* @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).
37
37
* @constructor Create a chat request
38
38
* @see ChatBot.generateResponse
39
39
* @see <a href="https://platform.openai.com/docs/api-reference/completions/create">OpenAI Uncyclo</a>
Original file line number Diff line number Diff line change @@ -3,8 +3,16 @@ package com.cjcrafter.openai.chat
3
3
import com.google.gson.JsonObject
4
4
5
5
/* *
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
8
16
*/
9
17
class ChatResponse (
10
18
val id : String ,
You can’t perform that action at this time.
0 commit comments