Skip to content

Commit fa75675

Browse files
docs: builder, enum, and union comments (#171)
1 parent a928bc0 commit fa75675

File tree

207 files changed

+4613
-0
lines changed

Some content is hidden

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

207 files changed

+4613
-0
lines changed

openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClient.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class OpenAIOkHttpClient private constructor() {
2424
@JvmStatic fun fromEnv(): OpenAIClient = builder().fromEnv().build()
2525
}
2626

27+
/** A builder for [OpenAIOkHttpClient]. */
2728
class Builder internal constructor() {
2829

2930
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()

openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClientAsync.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class OpenAIOkHttpClientAsync private constructor() {
2424
@JvmStatic fun fromEnv(): OpenAIClientAsync = builder().fromEnv().build()
2525
}
2626

27+
/** A builder for [OpenAIOkHttpClientAsync]. */
2728
class Builder internal constructor() {
2829

2930
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()

openai-java-core/src/main/kotlin/com/openai/core/ClientOptions.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ private constructor(
4848
@JvmStatic fun fromEnv(): ClientOptions = builder().fromEnv().build()
4949
}
5050

51+
/** A builder for [ClientOptions]. */
5152
class Builder internal constructor() {
5253

5354
private var httpClient: HttpClient? = null

openai-java-core/src/main/kotlin/com/openai/errors/OpenAIError.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ private constructor(
3030
@JvmStatic fun builder() = Builder()
3131
}
3232

33+
/** A builder for [OpenAIError]. */
3334
class Builder internal constructor() {
3435

3536
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ private constructor(
129129
@JvmStatic fun ofFilePath(filePath: FilePathAnnotation) = Annotation(filePath = filePath)
130130
}
131131

132+
/** An interface that defines how to map each variant of [Annotation] to a value of type [T]. */
132133
interface Visitor<out T> {
133134

134135
/**
@@ -144,6 +145,15 @@ private constructor(
144145
*/
145146
fun visitFilePath(filePath: FilePathAnnotation): T
146147

148+
/**
149+
* Maps an unknown variant of [Annotation] to a value of type [T].
150+
*
151+
* An instance of [Annotation] can contain an unknown variant if it was deserialized from
152+
* data that doesn't match any known variant. For example, if the SDK is on an older version
153+
* than the API, then the API may respond with new variants that the SDK is unaware of.
154+
*
155+
* @throws OpenAIInvalidDataException in the default implementation.
156+
*/
147157
fun unknown(json: JsonValue?): T {
148158
throw OpenAIInvalidDataException("Unknown Annotation: $json")
149159
}

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ private constructor(
130130
fun ofFilePath(filePath: FilePathDeltaAnnotation) = AnnotationDelta(filePath = filePath)
131131
}
132132

133+
/**
134+
* An interface that defines how to map each variant of [AnnotationDelta] to a value of type
135+
* [T].
136+
*/
133137
interface Visitor<out T> {
134138

135139
/**
@@ -145,6 +149,16 @@ private constructor(
145149
*/
146150
fun visitFilePath(filePath: FilePathDeltaAnnotation): T
147151

152+
/**
153+
* Maps an unknown variant of [AnnotationDelta] to a value of type [T].
154+
*
155+
* An instance of [AnnotationDelta] can contain an unknown variant if it was deserialized
156+
* from data that doesn't match any known variant. For example, if the SDK is on an older
157+
* version than the API, then the API may respond with new variants that the SDK is unaware
158+
* of.
159+
*
160+
* @throws OpenAIInvalidDataException in the default implementation.
161+
*/
148162
fun unknown(json: JsonValue?): T {
149163
throw OpenAIInvalidDataException("Unknown AnnotationDelta: $json")
150164
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ private constructor(
261261
@JvmStatic fun builder() = Builder()
262262
}
263263

264+
/** A builder for [Assistant]. */
264265
class Builder internal constructor() {
265266

266267
private var id: JsonField<String>? = null
@@ -754,6 +755,7 @@ private constructor(
754755
@JvmStatic fun builder() = Builder()
755756
}
756757

758+
/** A builder for [ToolResources]. */
757759
class Builder internal constructor() {
758760

759761
private var codeInterpreter: JsonField<CodeInterpreter> = JsonMissing.of()
@@ -857,6 +859,7 @@ private constructor(
857859
@JvmStatic fun builder() = Builder()
858860
}
859861

862+
/** A builder for [CodeInterpreter]. */
860863
class Builder internal constructor() {
861864

862865
private var fileIds: JsonField<MutableList<String>>? = null
@@ -1001,6 +1004,7 @@ private constructor(
10011004
@JvmStatic fun builder() = Builder()
10021005
}
10031006

1007+
/** A builder for [FileSearch]. */
10041008
class Builder internal constructor() {
10051009

10061010
private var vectorStoreIds: JsonField<MutableList<String>>? = null

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ private constructor(
6767
@JvmStatic fun builder() = Builder()
6868
}
6969

70+
/** A builder for [AssistantDeleted]. */
7071
class Builder internal constructor() {
7172

7273
private var id: JsonField<String>? = null

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ private constructor(
171171
AssistantResponseFormatOption(responseFormatJsonSchema = responseFormatJsonSchema)
172172
}
173173

174+
/**
175+
* An interface that defines how to map each variant of [AssistantResponseFormatOption] to a
176+
* value of type [T].
177+
*/
174178
interface Visitor<out T> {
175179

176180
/** `auto` is the default value */
@@ -182,6 +186,16 @@ private constructor(
182186

183187
fun visitResponseFormatJsonSchema(responseFormatJsonSchema: ResponseFormatJsonSchema): T
184188

189+
/**
190+
* Maps an unknown variant of [AssistantResponseFormatOption] to a value of type [T].
191+
*
192+
* An instance of [AssistantResponseFormatOption] can contain an unknown variant if it was
193+
* deserialized from data that doesn't match any known variant. For example, if the SDK is
194+
* on an older version than the API, then the API may respond with new variants that the SDK
195+
* is unaware of.
196+
*
197+
* @throws OpenAIInvalidDataException in the default implementation.
198+
*/
185199
fun unknown(json: JsonValue?): T {
186200
throw OpenAIInvalidDataException("Unknown AssistantResponseFormatOption: $json")
187201
}

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,10 @@ private constructor(
858858
fun ofErrorEvent(errorEvent: ErrorEvent) = AssistantStreamEvent(errorEvent = errorEvent)
859859
}
860860

861+
/**
862+
* An interface that defines how to map each variant of [AssistantStreamEvent] to a value of
863+
* type [T].
864+
*/
861865
interface Visitor<out T> {
862866

863867
/**
@@ -1008,6 +1012,16 @@ private constructor(
10081012
*/
10091013
fun visitErrorEvent(errorEvent: ErrorEvent): T
10101014

1015+
/**
1016+
* Maps an unknown variant of [AssistantStreamEvent] to a value of type [T].
1017+
*
1018+
* An instance of [AssistantStreamEvent] can contain an unknown variant if it was
1019+
* deserialized from data that doesn't match any known variant. For example, if the SDK is
1020+
* on an older version than the API, then the API may respond with new variants that the SDK
1021+
* is unaware of.
1022+
*
1023+
* @throws OpenAIInvalidDataException in the default implementation.
1024+
*/
10111025
fun unknown(json: JsonValue?): T {
10121026
throw OpenAIInvalidDataException("Unknown AssistantStreamEvent: $json")
10131027
}
@@ -1298,6 +1312,7 @@ private constructor(
12981312
@JvmStatic fun builder() = Builder()
12991313
}
13001314

1315+
/** A builder for [ThreadCreated]. */
13011316
class Builder internal constructor() {
13021317

13031318
private var data: JsonField<Thread>? = null
@@ -1434,6 +1449,7 @@ private constructor(
14341449
@JvmStatic fun builder() = Builder()
14351450
}
14361451

1452+
/** A builder for [ThreadRunCreated]. */
14371453
class Builder internal constructor() {
14381454

14391455
private var data: JsonField<Run>? = null
@@ -1561,6 +1577,7 @@ private constructor(
15611577
@JvmStatic fun builder() = Builder()
15621578
}
15631579

1580+
/** A builder for [ThreadRunQueued]. */
15641581
class Builder internal constructor() {
15651582

15661583
private var data: JsonField<Run>? = null
@@ -1688,6 +1705,7 @@ private constructor(
16881705
@JvmStatic fun builder() = Builder()
16891706
}
16901707

1708+
/** A builder for [ThreadRunInProgress]. */
16911709
class Builder internal constructor() {
16921710

16931711
private var data: JsonField<Run>? = null
@@ -1815,6 +1833,7 @@ private constructor(
18151833
@JvmStatic fun builder() = Builder()
18161834
}
18171835

1836+
/** A builder for [ThreadRunRequiresAction]. */
18181837
class Builder internal constructor() {
18191838

18201839
private var data: JsonField<Run>? = null
@@ -1941,6 +1960,7 @@ private constructor(
19411960
@JvmStatic fun builder() = Builder()
19421961
}
19431962

1963+
/** A builder for [ThreadRunCompleted]. */
19441964
class Builder internal constructor() {
19451965

19461966
private var data: JsonField<Run>? = null
@@ -2068,6 +2088,7 @@ private constructor(
20682088
@JvmStatic fun builder() = Builder()
20692089
}
20702090

2091+
/** A builder for [ThreadRunIncomplete]. */
20712092
class Builder internal constructor() {
20722093

20732094
private var data: JsonField<Run>? = null
@@ -2192,6 +2213,7 @@ private constructor(
21922213
@JvmStatic fun builder() = Builder()
21932214
}
21942215

2216+
/** A builder for [ThreadRunFailed]. */
21952217
class Builder internal constructor() {
21962218

21972219
private var data: JsonField<Run>? = null
@@ -2319,6 +2341,7 @@ private constructor(
23192341
@JvmStatic fun builder() = Builder()
23202342
}
23212343

2344+
/** A builder for [ThreadRunCancelling]. */
23222345
class Builder internal constructor() {
23232346

23242347
private var data: JsonField<Run>? = null
@@ -2445,6 +2468,7 @@ private constructor(
24452468
@JvmStatic fun builder() = Builder()
24462469
}
24472470

2471+
/** A builder for [ThreadRunCancelled]. */
24482472
class Builder internal constructor() {
24492473

24502474
private var data: JsonField<Run>? = null
@@ -2569,6 +2593,7 @@ private constructor(
25692593
@JvmStatic fun builder() = Builder()
25702594
}
25712595

2596+
/** A builder for [ThreadRunExpired]. */
25722597
class Builder internal constructor() {
25732598

25742599
private var data: JsonField<Run>? = null
@@ -2692,6 +2717,7 @@ private constructor(
26922717
@JvmStatic fun builder() = Builder()
26932718
}
26942719

2720+
/** A builder for [ThreadRunStepCreated]. */
26952721
class Builder internal constructor() {
26962722

26972723
private var data: JsonField<RunStep>? = null
@@ -2810,6 +2836,7 @@ private constructor(
28102836
@JvmStatic fun builder() = Builder()
28112837
}
28122838

2839+
/** A builder for [ThreadRunStepInProgress]. */
28132840
class Builder internal constructor() {
28142841

28152842
private var data: JsonField<RunStep>? = null
@@ -2928,6 +2955,7 @@ private constructor(
29282955
@JvmStatic fun builder() = Builder()
29292956
}
29302957

2958+
/** A builder for [ThreadRunStepDelta]. */
29312959
class Builder internal constructor() {
29322960

29332961
private var data: JsonField<RunStepDeltaEvent>? = null
@@ -3050,6 +3078,7 @@ private constructor(
30503078
@JvmStatic fun builder() = Builder()
30513079
}
30523080

3081+
/** A builder for [ThreadRunStepCompleted]. */
30533082
class Builder internal constructor() {
30543083

30553084
private var data: JsonField<RunStep>? = null
@@ -3167,6 +3196,7 @@ private constructor(
31673196
@JvmStatic fun builder() = Builder()
31683197
}
31693198

3199+
/** A builder for [ThreadRunStepFailed]. */
31703200
class Builder internal constructor() {
31713201

31723202
private var data: JsonField<RunStep>? = null
@@ -3285,6 +3315,7 @@ private constructor(
32853315
@JvmStatic fun builder() = Builder()
32863316
}
32873317

3318+
/** A builder for [ThreadRunStepCancelled]. */
32883319
class Builder internal constructor() {
32893320

32903321
private var data: JsonField<RunStep>? = null
@@ -3402,6 +3433,7 @@ private constructor(
34023433
@JvmStatic fun builder() = Builder()
34033434
}
34043435

3436+
/** A builder for [ThreadRunStepExpired]. */
34053437
class Builder internal constructor() {
34063438

34073439
private var data: JsonField<RunStep>? = null
@@ -3525,6 +3557,7 @@ private constructor(
35253557
@JvmStatic fun builder() = Builder()
35263558
}
35273559

3560+
/** A builder for [ThreadMessageCreated]. */
35283561
class Builder internal constructor() {
35293562

35303563
private var data: JsonField<Message>? = null
@@ -3654,6 +3687,7 @@ private constructor(
36543687
@JvmStatic fun builder() = Builder()
36553688
}
36563689

3690+
/** A builder for [ThreadMessageInProgress]. */
36573691
class Builder internal constructor() {
36583692

36593693
private var data: JsonField<Message>? = null
@@ -3777,6 +3811,7 @@ private constructor(
37773811
@JvmStatic fun builder() = Builder()
37783812
}
37793813

3814+
/** A builder for [ThreadMessageDelta]. */
37803815
class Builder internal constructor() {
37813816

37823817
private var data: JsonField<MessageDeltaEvent>? = null
@@ -3900,6 +3935,7 @@ private constructor(
39003935
@JvmStatic fun builder() = Builder()
39013936
}
39023937

3938+
/** A builder for [ThreadMessageCompleted]. */
39033939
class Builder internal constructor() {
39043940

39053941
private var data: JsonField<Message>? = null
@@ -4029,6 +4065,7 @@ private constructor(
40294065
@JvmStatic fun builder() = Builder()
40304066
}
40314067

4068+
/** A builder for [ThreadMessageIncomplete]. */
40324069
class Builder internal constructor() {
40334070

40344071
private var data: JsonField<Message>? = null
@@ -4150,6 +4187,7 @@ private constructor(
41504187
@JvmStatic fun builder() = Builder()
41514188
}
41524189

4190+
/** A builder for [ErrorEvent]. */
41534191
class Builder internal constructor() {
41544192

41554193
private var data: JsonField<ErrorObject>? = null

0 commit comments

Comments
 (0)