Skip to content

Commit 0c3f655

Browse files
style(internal): sort fields (#82)
1 parent 2b735f9 commit 0c3f655

File tree

85 files changed

+4808
-4808
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+4808
-4808
lines changed

openai-java-core/src/main/kotlin/com/openai/models/Assistant.kt

Lines changed: 184 additions & 184 deletions
Large diffs are not rendered by default.

openai-java-core/src/main/kotlin/com/openai/models/AssistantStreamEvent.kt

Lines changed: 404 additions & 404 deletions
Large diffs are not rendered by default.

openai-java-core/src/main/kotlin/com/openai/models/Batch.kt

Lines changed: 209 additions & 209 deletions
Large diffs are not rendered by default.

openai-java-core/src/main/kotlin/com/openai/models/BatchError.kt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,38 +21,38 @@ class BatchError
2121
@JsonCreator
2222
private constructor(
2323
@JsonProperty("code") @ExcludeMissing private val code: JsonField<String> = JsonMissing.of(),
24+
@JsonProperty("line") @ExcludeMissing private val line: JsonField<Long> = JsonMissing.of(),
2425
@JsonProperty("message")
2526
@ExcludeMissing
2627
private val message: JsonField<String> = JsonMissing.of(),
2728
@JsonProperty("param") @ExcludeMissing private val param: JsonField<String> = JsonMissing.of(),
28-
@JsonProperty("line") @ExcludeMissing private val line: JsonField<Long> = JsonMissing.of(),
2929
@JsonAnySetter private val additionalProperties: Map<String, JsonValue> = immutableEmptyMap(),
3030
) {
3131

3232
/** An error code identifying the error type. */
3333
fun code(): Optional<String> = Optional.ofNullable(code.getNullable("code"))
3434

35+
/** The line number of the input file where the error occurred, if applicable. */
36+
fun line(): Optional<Long> = Optional.ofNullable(line.getNullable("line"))
37+
3538
/** A human-readable message providing more details about the error. */
3639
fun message(): Optional<String> = Optional.ofNullable(message.getNullable("message"))
3740

3841
/** The name of the parameter that caused the error, if applicable. */
3942
fun param(): Optional<String> = Optional.ofNullable(param.getNullable("param"))
4043

41-
/** The line number of the input file where the error occurred, if applicable. */
42-
fun line(): Optional<Long> = Optional.ofNullable(line.getNullable("line"))
43-
4444
/** An error code identifying the error type. */
4545
@JsonProperty("code") @ExcludeMissing fun _code() = code
4646

47+
/** The line number of the input file where the error occurred, if applicable. */
48+
@JsonProperty("line") @ExcludeMissing fun _line() = line
49+
4750
/** A human-readable message providing more details about the error. */
4851
@JsonProperty("message") @ExcludeMissing fun _message() = message
4952

5053
/** The name of the parameter that caused the error, if applicable. */
5154
@JsonProperty("param") @ExcludeMissing fun _param() = param
5255

53-
/** The line number of the input file where the error occurred, if applicable. */
54-
@JsonProperty("line") @ExcludeMissing fun _line() = line
55-
5656
@JsonAnyGetter
5757
@ExcludeMissing
5858
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
@@ -62,9 +62,9 @@ private constructor(
6262
fun validate(): BatchError = apply {
6363
if (!validated) {
6464
code()
65+
line()
6566
message()
6667
param()
67-
line()
6868
validated = true
6969
}
7070
}
@@ -79,17 +79,17 @@ private constructor(
7979
class Builder {
8080

8181
private var code: JsonField<String> = JsonMissing.of()
82+
private var line: JsonField<Long> = JsonMissing.of()
8283
private var message: JsonField<String> = JsonMissing.of()
8384
private var param: JsonField<String> = JsonMissing.of()
84-
private var line: JsonField<Long> = JsonMissing.of()
8585
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
8686

8787
@JvmSynthetic
8888
internal fun from(batchError: BatchError) = apply {
8989
code = batchError.code
90+
line = batchError.line
9091
message = batchError.message
9192
param = batchError.param
92-
line = batchError.line
9393
additionalProperties = batchError.additionalProperties.toMutableMap()
9494
}
9595

@@ -99,6 +99,12 @@ private constructor(
9999
/** An error code identifying the error type. */
100100
fun code(code: JsonField<String>) = apply { this.code = code }
101101

102+
/** The line number of the input file where the error occurred, if applicable. */
103+
fun line(line: Long) = line(JsonField.of(line))
104+
105+
/** The line number of the input file where the error occurred, if applicable. */
106+
fun line(line: JsonField<Long>) = apply { this.line = line }
107+
102108
/** A human-readable message providing more details about the error. */
103109
fun message(message: String) = message(JsonField.of(message))
104110

@@ -111,12 +117,6 @@ private constructor(
111117
/** The name of the parameter that caused the error, if applicable. */
112118
fun param(param: JsonField<String>) = apply { this.param = param }
113119

114-
/** The line number of the input file where the error occurred, if applicable. */
115-
fun line(line: Long) = line(JsonField.of(line))
116-
117-
/** The line number of the input file where the error occurred, if applicable. */
118-
fun line(line: JsonField<Long>) = apply { this.line = line }
119-
120120
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
121121
this.additionalProperties.clear()
122122
putAllAdditionalProperties(additionalProperties)
@@ -139,9 +139,9 @@ private constructor(
139139
fun build(): BatchError =
140140
BatchError(
141141
code,
142+
line,
142143
message,
143144
param,
144-
line,
145145
additionalProperties.toImmutable(),
146146
)
147147
}
@@ -151,15 +151,15 @@ private constructor(
151151
return true
152152
}
153153

154-
return /* spotless:off */ other is BatchError && code == other.code && message == other.message && param == other.param && line == other.line && additionalProperties == other.additionalProperties /* spotless:on */
154+
return /* spotless:off */ other is BatchError && code == other.code && line == other.line && message == other.message && param == other.param && additionalProperties == other.additionalProperties /* spotless:on */
155155
}
156156

157157
/* spotless:off */
158-
private val hashCode: Int by lazy { Objects.hash(code, message, param, line, additionalProperties) }
158+
private val hashCode: Int by lazy { Objects.hash(code, line, message, param, additionalProperties) }
159159
/* spotless:on */
160160

161161
override fun hashCode(): Int = hashCode
162162

163163
override fun toString() =
164-
"BatchError{code=$code, message=$message, param=$param, line=$line, additionalProperties=$additionalProperties}"
164+
"BatchError{code=$code, line=$line, message=$message, param=$param, additionalProperties=$additionalProperties}"
165165
}

openai-java-core/src/main/kotlin/com/openai/models/BatchRequestCounts.kt

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,32 @@ import java.util.Objects
2020
class BatchRequestCounts
2121
@JsonCreator
2222
private constructor(
23-
@JsonProperty("total") @ExcludeMissing private val total: JsonField<Long> = JsonMissing.of(),
2423
@JsonProperty("completed")
2524
@ExcludeMissing
2625
private val completed: JsonField<Long> = JsonMissing.of(),
2726
@JsonProperty("failed") @ExcludeMissing private val failed: JsonField<Long> = JsonMissing.of(),
27+
@JsonProperty("total") @ExcludeMissing private val total: JsonField<Long> = JsonMissing.of(),
2828
@JsonAnySetter private val additionalProperties: Map<String, JsonValue> = immutableEmptyMap(),
2929
) {
3030

31-
/** Total number of requests in the batch. */
32-
fun total(): Long = total.getRequired("total")
33-
3431
/** Number of requests that have been completed successfully. */
3532
fun completed(): Long = completed.getRequired("completed")
3633

3734
/** Number of requests that have failed. */
3835
fun failed(): Long = failed.getRequired("failed")
3936

4037
/** Total number of requests in the batch. */
41-
@JsonProperty("total") @ExcludeMissing fun _total() = total
38+
fun total(): Long = total.getRequired("total")
4239

4340
/** Number of requests that have been completed successfully. */
4441
@JsonProperty("completed") @ExcludeMissing fun _completed() = completed
4542

4643
/** Number of requests that have failed. */
4744
@JsonProperty("failed") @ExcludeMissing fun _failed() = failed
4845

46+
/** Total number of requests in the batch. */
47+
@JsonProperty("total") @ExcludeMissing fun _total() = total
48+
4949
@JsonAnyGetter
5050
@ExcludeMissing
5151
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
@@ -54,9 +54,9 @@ private constructor(
5454

5555
fun validate(): BatchRequestCounts = apply {
5656
if (!validated) {
57-
total()
5857
completed()
5958
failed()
59+
total()
6060
validated = true
6161
}
6262
}
@@ -70,25 +70,19 @@ private constructor(
7070

7171
class Builder {
7272

73-
private var total: JsonField<Long> = JsonMissing.of()
7473
private var completed: JsonField<Long> = JsonMissing.of()
7574
private var failed: JsonField<Long> = JsonMissing.of()
75+
private var total: JsonField<Long> = JsonMissing.of()
7676
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
7777

7878
@JvmSynthetic
7979
internal fun from(batchRequestCounts: BatchRequestCounts) = apply {
80-
total = batchRequestCounts.total
8180
completed = batchRequestCounts.completed
8281
failed = batchRequestCounts.failed
82+
total = batchRequestCounts.total
8383
additionalProperties = batchRequestCounts.additionalProperties.toMutableMap()
8484
}
8585

86-
/** Total number of requests in the batch. */
87-
fun total(total: Long) = total(JsonField.of(total))
88-
89-
/** Total number of requests in the batch. */
90-
fun total(total: JsonField<Long>) = apply { this.total = total }
91-
9286
/** Number of requests that have been completed successfully. */
9387
fun completed(completed: Long) = completed(JsonField.of(completed))
9488

@@ -101,6 +95,12 @@ private constructor(
10195
/** Number of requests that have failed. */
10296
fun failed(failed: JsonField<Long>) = apply { this.failed = failed }
10397

98+
/** Total number of requests in the batch. */
99+
fun total(total: Long) = total(JsonField.of(total))
100+
101+
/** Total number of requests in the batch. */
102+
fun total(total: JsonField<Long>) = apply { this.total = total }
103+
104104
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
105105
this.additionalProperties.clear()
106106
putAllAdditionalProperties(additionalProperties)
@@ -122,9 +122,9 @@ private constructor(
122122

123123
fun build(): BatchRequestCounts =
124124
BatchRequestCounts(
125-
total,
126125
completed,
127126
failed,
127+
total,
128128
additionalProperties.toImmutable(),
129129
)
130130
}
@@ -134,15 +134,15 @@ private constructor(
134134
return true
135135
}
136136

137-
return /* spotless:off */ other is BatchRequestCounts && total == other.total && completed == other.completed && failed == other.failed && additionalProperties == other.additionalProperties /* spotless:on */
137+
return /* spotless:off */ other is BatchRequestCounts && completed == other.completed && failed == other.failed && total == other.total && additionalProperties == other.additionalProperties /* spotless:on */
138138
}
139139

140140
/* spotless:off */
141-
private val hashCode: Int by lazy { Objects.hash(total, completed, failed, additionalProperties) }
141+
private val hashCode: Int by lazy { Objects.hash(completed, failed, total, additionalProperties) }
142142
/* spotless:on */
143143

144144
override fun hashCode(): Int = hashCode
145145

146146
override fun toString() =
147-
"BatchRequestCounts{total=$total, completed=$completed, failed=$failed, additionalProperties=$additionalProperties}"
147+
"BatchRequestCounts{completed=$completed, failed=$failed, total=$total, additionalProperties=$additionalProperties}"
148148
}

openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantCreateParams.kt

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -996,21 +996,14 @@ constructor(
996996
class VectorStore
997997
@JsonCreator
998998
private constructor(
999-
@JsonProperty("file_ids") private val fileIds: List<String>?,
1000999
@JsonProperty("chunking_strategy")
10011000
private val chunkingStrategy: FileChunkingStrategyParam?,
1001+
@JsonProperty("file_ids") private val fileIds: List<String>?,
10021002
@JsonProperty("metadata") private val metadata: JsonValue?,
10031003
@JsonAnySetter
10041004
private val additionalProperties: Map<String, JsonValue> = immutableEmptyMap(),
10051005
) {
10061006

1007-
/**
1008-
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to add
1009-
* to the vector store. There can be a maximum of 10000 files in a vector store.
1010-
*/
1011-
@JsonProperty("file_ids")
1012-
fun fileIds(): Optional<List<String>> = Optional.ofNullable(fileIds)
1013-
10141007
/**
10151008
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
10161009
* strategy. Only applicable if `file_ids` is non-empty.
@@ -1019,6 +1012,13 @@ constructor(
10191012
fun chunkingStrategy(): Optional<FileChunkingStrategyParam> =
10201013
Optional.ofNullable(chunkingStrategy)
10211014

1015+
/**
1016+
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to add
1017+
* to the vector store. There can be a maximum of 10000 files in a vector store.
1018+
*/
1019+
@JsonProperty("file_ids")
1020+
fun fileIds(): Optional<List<String>> = Optional.ofNullable(fileIds)
1021+
10221022
/**
10231023
* Set of 16 key-value pairs that can be attached to a vector store. This can be
10241024
* useful for storing additional information about the vector store in a structured
@@ -1041,37 +1041,19 @@ constructor(
10411041

10421042
class Builder {
10431043

1044-
private var fileIds: MutableList<String>? = null
10451044
private var chunkingStrategy: FileChunkingStrategyParam? = null
1045+
private var fileIds: MutableList<String>? = null
10461046
private var metadata: JsonValue? = null
10471047
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
10481048

10491049
@JvmSynthetic
10501050
internal fun from(vectorStore: VectorStore) = apply {
1051-
fileIds = vectorStore.fileIds?.toMutableList()
10521051
chunkingStrategy = vectorStore.chunkingStrategy
1052+
fileIds = vectorStore.fileIds?.toMutableList()
10531053
metadata = vectorStore.metadata
10541054
additionalProperties = vectorStore.additionalProperties.toMutableMap()
10551055
}
10561056

1057-
/**
1058-
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
1059-
* add to the vector store. There can be a maximum of 10000 files in a vector
1060-
* store.
1061-
*/
1062-
fun fileIds(fileIds: List<String>) = apply {
1063-
this.fileIds = fileIds.toMutableList()
1064-
}
1065-
1066-
/**
1067-
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
1068-
* add to the vector store. There can be a maximum of 10000 files in a vector
1069-
* store.
1070-
*/
1071-
fun addFileId(fileId: String) = apply {
1072-
fileIds = (fileIds ?: mutableListOf()).apply { add(fileId) }
1073-
}
1074-
10751057
/**
10761058
* The chunking strategy used to chunk the file(s). If not set, will use the
10771059
* `auto` strategy. Only applicable if `file_ids` is non-empty.
@@ -1102,6 +1084,24 @@ constructor(
11021084
)
11031085
}
11041086

1087+
/**
1088+
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
1089+
* add to the vector store. There can be a maximum of 10000 files in a vector
1090+
* store.
1091+
*/
1092+
fun fileIds(fileIds: List<String>) = apply {
1093+
this.fileIds = fileIds.toMutableList()
1094+
}
1095+
1096+
/**
1097+
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
1098+
* add to the vector store. There can be a maximum of 10000 files in a vector
1099+
* store.
1100+
*/
1101+
fun addFileId(fileId: String) = apply {
1102+
fileIds = (fileIds ?: mutableListOf()).apply { add(fileId) }
1103+
}
1104+
11051105
/**
11061106
* Set of 16 key-value pairs that can be attached to a vector store. This can be
11071107
* useful for storing additional information about the vector store in a
@@ -1134,8 +1134,8 @@ constructor(
11341134

11351135
fun build(): VectorStore =
11361136
VectorStore(
1137-
fileIds?.toImmutable(),
11381137
chunkingStrategy,
1138+
fileIds?.toImmutable(),
11391139
metadata,
11401140
additionalProperties.toImmutable(),
11411141
)
@@ -1146,17 +1146,17 @@ constructor(
11461146
return true
11471147
}
11481148

1149-
return /* spotless:off */ other is VectorStore && fileIds == other.fileIds && chunkingStrategy == other.chunkingStrategy && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */
1149+
return /* spotless:off */ other is VectorStore && chunkingStrategy == other.chunkingStrategy && fileIds == other.fileIds && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */
11501150
}
11511151

11521152
/* spotless:off */
1153-
private val hashCode: Int by lazy { Objects.hash(fileIds, chunkingStrategy, metadata, additionalProperties) }
1153+
private val hashCode: Int by lazy { Objects.hash(chunkingStrategy, fileIds, metadata, additionalProperties) }
11541154
/* spotless:on */
11551155

11561156
override fun hashCode(): Int = hashCode
11571157

11581158
override fun toString() =
1159-
"VectorStore{fileIds=$fileIds, chunkingStrategy=$chunkingStrategy, metadata=$metadata, additionalProperties=$additionalProperties}"
1159+
"VectorStore{chunkingStrategy=$chunkingStrategy, fileIds=$fileIds, metadata=$metadata, additionalProperties=$additionalProperties}"
11601160
}
11611161

11621162
override fun equals(other: Any?): Boolean {

0 commit comments

Comments
 (0)