@@ -18,24 +18,117 @@ object ChatRequestResponseData {
18
18
implicit val messageRW : SnakePickle .Reader [Message ] = SnakePickle .macroR[Message ]
19
19
}
20
20
21
+ /** Represents a choice in the chat completion.
22
+ *
23
+ * @param message
24
+ * The message associated with this choice.
25
+ * @param finishReason
26
+ * The reason the model stopped generating tokens. This will be stop if the model hit a natural stop point or a provided stop sequence,
27
+ * length if the maximum number of tokens specified in the request was reached, content_filter if content was omitted due to a flag
28
+ * from our content filters, tool_calls if the model called a tool, or function_call (deprecated) if the model called a function.
29
+ * @param index
30
+ * The index of this choice.
31
+ * @param logprobs
32
+ * Log probability information for the choice.
33
+ */
21
34
case class Choices (
22
35
message : Message ,
23
36
finishReason : String ,
24
- index : Int
37
+ index : Int ,
38
+ logprobs : Option [Logprobs ] = None
25
39
)
26
40
27
41
object Choices {
28
42
implicit val choicesR : SnakePickle .Reader [Choices ] = SnakePickle .macroR[Choices ]
29
43
}
30
44
45
+ /** @param content
46
+ * A list of message content tokens with log probability information.
47
+ * @param refusal
48
+ * A list of message refusal tokens with log probability information.
49
+ */
50
+ case class Logprobs (
51
+ content : Option [Seq [LogprobData ]] = None ,
52
+ refusal : Option [Seq [LogprobData ]] = None
53
+ )
54
+
55
+ object Logprobs {
56
+ implicit val logprobsR : SnakePickle .Reader [Logprobs ] = SnakePickle .macroR[Logprobs ]
57
+ }
58
+
59
+ /** @param token
60
+ * The token.
61
+ * @param logprob
62
+ * The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify
63
+ * that the token is very unlikely.
64
+ * @param bytes
65
+ * A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by
66
+ * multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is
67
+ * no bytes representation for the token.
68
+ * @param topLogprobs
69
+ * List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number
70
+ * of requested top_logprobs returned.
71
+ */
72
+ case class LogprobData (
73
+ token : String ,
74
+ logprob : Float ,
75
+ bytes : Option [Seq [Int ]] = None ,
76
+ topLogprobs : Seq [TopLogprobs ]
77
+ )
78
+
79
+ object LogprobData {
80
+ implicit val contentR : SnakePickle .Reader [LogprobData ] = SnakePickle .macroR[LogprobData ]
81
+ }
82
+
83
+ /** @param token
84
+ * The token.
85
+ * @param logprob
86
+ * The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify
87
+ * that the token is very unlikely.
88
+ * @param bytes
89
+ * A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by
90
+ * multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is
91
+ * no bytes representation for the token.
92
+ */
93
+ case class TopLogprobs (
94
+ token : String ,
95
+ logprob : Float ,
96
+ bytes : Option [Seq [Int ]] = None
97
+ )
98
+
99
+ object TopLogprobs {
100
+ implicit val topLogprobsR : SnakePickle .Reader [TopLogprobs ] = SnakePickle .macroR[TopLogprobs ]
101
+ }
102
+
103
+ /** Represents the response of a chat completion.
104
+ *
105
+ * @param id
106
+ * A unique identifier for the chat completion.
107
+ * @param choices
108
+ * A list of chat completion choices. Can be more than one if n is greater than 1.
109
+ * @param created
110
+ * The Unix timestamp (in seconds) of when the chat completion was created.
111
+ * @param model
112
+ * The model used for the chat completion.
113
+ * @param `object`
114
+ * The object type, which is always chat.completion.
115
+ * @param usage
116
+ * Usage statistics for the completion request.
117
+ * @param systemFingerprint
118
+ * This fingerprint represents the backend configuration that the model runs with. Can be used in conjunction with the seed request
119
+ * parameter to understand when backend changes have been made that might impact determinism.
120
+ * @param serviceTier
121
+ * The service tier used for processing the request.
122
+ */
31
123
case class ChatResponse (
32
124
id : String ,
33
125
choices : Seq [Choices ],
34
126
created : Int ,
35
127
model : String ,
36
128
`object` : String ,
37
129
usage : Usage ,
38
- systemFingerprint : Option [String ] = None
130
+ systemFingerprint : Option [String ] = None ,
131
+ serviceTier : Option [String ] = None
39
132
)
40
133
41
134
object ChatResponse {
0 commit comments