@@ -27,8 +27,8 @@ import kotlin.jvm.optionals.getOrNull
27
27
@JsonSerialize(using = AnnotationDelta .Serializer ::class )
28
28
class AnnotationDelta
29
29
private constructor (
30
- private val fileCitationDeltaAnnotation : FileCitationDeltaAnnotation ? = null ,
31
- private val filePathDeltaAnnotation : FilePathDeltaAnnotation ? = null ,
30
+ private val fileCitation : FileCitationDeltaAnnotation ? = null ,
31
+ private val filePath : FilePathDeltaAnnotation ? = null ,
32
32
private val _json : JsonValue ? = null ,
33
33
) {
34
34
@@ -37,43 +37,37 @@ private constructor(
37
37
* with the assistant or the message. Generated when the assistant uses the "file_search" tool
38
38
* to search files.
39
39
*/
40
- fun fileCitationDeltaAnnotation (): Optional <FileCitationDeltaAnnotation > =
41
- Optional .ofNullable(fileCitationDeltaAnnotation)
40
+ fun fileCitation (): Optional <FileCitationDeltaAnnotation > = Optional .ofNullable(fileCitation)
42
41
43
42
/* *
44
43
* A URL for the file that's generated when the assistant used the `code_interpreter` tool to
45
44
* generate a file.
46
45
*/
47
- fun filePathDeltaAnnotation (): Optional <FilePathDeltaAnnotation > =
48
- Optional .ofNullable(filePathDeltaAnnotation)
46
+ fun filePath (): Optional <FilePathDeltaAnnotation > = Optional .ofNullable(filePath)
49
47
50
- fun isFileCitationDeltaAnnotation (): Boolean = fileCitationDeltaAnnotation != null
48
+ fun isFileCitation (): Boolean = fileCitation != null
51
49
52
- fun isFilePathDeltaAnnotation (): Boolean = filePathDeltaAnnotation != null
50
+ fun isFilePath (): Boolean = filePath != null
53
51
54
52
/* *
55
53
* A citation within the message that points to a specific quote from a specific File associated
56
54
* with the assistant or the message. Generated when the assistant uses the "file_search" tool
57
55
* to search files.
58
56
*/
59
- fun asFileCitationDeltaAnnotation (): FileCitationDeltaAnnotation =
60
- fileCitationDeltaAnnotation.getOrThrow(" fileCitationDeltaAnnotation" )
57
+ fun asFileCitation (): FileCitationDeltaAnnotation = fileCitation.getOrThrow(" fileCitation" )
61
58
62
59
/* *
63
60
* A URL for the file that's generated when the assistant used the `code_interpreter` tool to
64
61
* generate a file.
65
62
*/
66
- fun asFilePathDeltaAnnotation (): FilePathDeltaAnnotation =
67
- filePathDeltaAnnotation.getOrThrow(" filePathDeltaAnnotation" )
63
+ fun asFilePath (): FilePathDeltaAnnotation = filePath.getOrThrow(" filePath" )
68
64
69
65
fun _json (): Optional <JsonValue > = Optional .ofNullable(_json )
70
66
71
67
fun <T > accept (visitor : Visitor <T >): T {
72
68
return when {
73
- fileCitationDeltaAnnotation != null ->
74
- visitor.visitFileCitationDeltaAnnotation(fileCitationDeltaAnnotation)
75
- filePathDeltaAnnotation != null ->
76
- visitor.visitFilePathDeltaAnnotation(filePathDeltaAnnotation)
69
+ fileCitation != null -> visitor.visitFileCitation(fileCitation)
70
+ filePath != null -> visitor.visitFilePath(filePath)
77
71
else -> visitor.unknown(_json )
78
72
}
79
73
}
@@ -87,16 +81,12 @@ private constructor(
87
81
88
82
accept(
89
83
object : Visitor <Unit > {
90
- override fun visitFileCitationDeltaAnnotation (
91
- fileCitationDeltaAnnotation : FileCitationDeltaAnnotation
92
- ) {
93
- fileCitationDeltaAnnotation.validate()
84
+ override fun visitFileCitation (fileCitation : FileCitationDeltaAnnotation ) {
85
+ fileCitation.validate()
94
86
}
95
87
96
- override fun visitFilePathDeltaAnnotation (
97
- filePathDeltaAnnotation : FilePathDeltaAnnotation
98
- ) {
99
- filePathDeltaAnnotation.validate()
88
+ override fun visitFilePath (filePath : FilePathDeltaAnnotation ) {
89
+ filePath.validate()
100
90
}
101
91
}
102
92
)
@@ -108,17 +98,15 @@ private constructor(
108
98
return true
109
99
}
110
100
111
- return /* spotless:off */ other is AnnotationDelta && fileCitationDeltaAnnotation == other.fileCitationDeltaAnnotation && filePathDeltaAnnotation == other.filePathDeltaAnnotation /* spotless:on */
101
+ return /* spotless:off */ other is AnnotationDelta && fileCitation == other.fileCitation && filePath == other.filePath /* spotless:on */
112
102
}
113
103
114
- override fun hashCode (): Int = /* spotless:off */ Objects .hash(fileCitationDeltaAnnotation, filePathDeltaAnnotation ) /* spotless:on */
104
+ override fun hashCode (): Int = /* spotless:off */ Objects .hash(fileCitation, filePath ) /* spotless:on */
115
105
116
106
override fun toString (): String =
117
107
when {
118
- fileCitationDeltaAnnotation != null ->
119
- " AnnotationDelta{fileCitationDeltaAnnotation=$fileCitationDeltaAnnotation }"
120
- filePathDeltaAnnotation != null ->
121
- " AnnotationDelta{filePathDeltaAnnotation=$filePathDeltaAnnotation }"
108
+ fileCitation != null -> " AnnotationDelta{fileCitation=$fileCitation }"
109
+ filePath != null -> " AnnotationDelta{filePath=$filePath }"
122
110
_json != null -> " AnnotationDelta{_unknown=$_json }"
123
111
else -> throw IllegalStateException (" Invalid AnnotationDelta" )
124
112
}
@@ -131,17 +119,15 @@ private constructor(
131
119
* "file_search" tool to search files.
132
120
*/
133
121
@JvmStatic
134
- fun ofFileCitationDeltaAnnotation (
135
- fileCitationDeltaAnnotation : FileCitationDeltaAnnotation
136
- ) = AnnotationDelta (fileCitationDeltaAnnotation = fileCitationDeltaAnnotation)
122
+ fun ofFileCitation (fileCitation : FileCitationDeltaAnnotation ) =
123
+ AnnotationDelta (fileCitation = fileCitation)
137
124
138
125
/* *
139
126
* A URL for the file that's generated when the assistant used the `code_interpreter` tool
140
127
* to generate a file.
141
128
*/
142
129
@JvmStatic
143
- fun ofFilePathDeltaAnnotation (filePathDeltaAnnotation : FilePathDeltaAnnotation ) =
144
- AnnotationDelta (filePathDeltaAnnotation = filePathDeltaAnnotation)
130
+ fun ofFilePath (filePath : FilePathDeltaAnnotation ) = AnnotationDelta (filePath = filePath)
145
131
}
146
132
147
133
interface Visitor <out T > {
@@ -151,15 +137,13 @@ private constructor(
151
137
* associated with the assistant or the message. Generated when the assistant uses the
152
138
* "file_search" tool to search files.
153
139
*/
154
- fun visitFileCitationDeltaAnnotation (
155
- fileCitationDeltaAnnotation : FileCitationDeltaAnnotation
156
- ): T
140
+ fun visitFileCitation (fileCitation : FileCitationDeltaAnnotation ): T
157
141
158
142
/* *
159
143
* A URL for the file that's generated when the assistant used the `code_interpreter` tool
160
144
* to generate a file.
161
145
*/
162
- fun visitFilePathDeltaAnnotation ( filePathDeltaAnnotation : FilePathDeltaAnnotation ): T
146
+ fun visitFilePath ( filePath : FilePathDeltaAnnotation ): T
163
147
164
148
fun unknown (json : JsonValue ? ): T {
165
149
throw OpenAIInvalidDataException (" Unknown AnnotationDelta: $json " )
@@ -178,15 +162,15 @@ private constructor(
178
162
it.validate()
179
163
}
180
164
?.let {
181
- return AnnotationDelta (fileCitationDeltaAnnotation = it, _json = json)
165
+ return AnnotationDelta (fileCitation = it, _json = json)
182
166
}
183
167
}
184
168
" file_path" -> {
185
169
tryDeserialize(node, jacksonTypeRef<FilePathDeltaAnnotation >()) {
186
170
it.validate()
187
171
}
188
172
?.let {
189
- return AnnotationDelta (filePathDeltaAnnotation = it, _json = json)
173
+ return AnnotationDelta (filePath = it, _json = json)
190
174
}
191
175
}
192
176
}
@@ -203,10 +187,8 @@ private constructor(
203
187
provider : SerializerProvider
204
188
) {
205
189
when {
206
- value.fileCitationDeltaAnnotation != null ->
207
- generator.writeObject(value.fileCitationDeltaAnnotation)
208
- value.filePathDeltaAnnotation != null ->
209
- generator.writeObject(value.filePathDeltaAnnotation)
190
+ value.fileCitation != null -> generator.writeObject(value.fileCitation)
191
+ value.filePath != null -> generator.writeObject(value.filePath)
210
192
value._json != null -> generator.writeObject(value._json )
211
193
else -> throw IllegalStateException (" Invalid AnnotationDelta" )
212
194
}
0 commit comments