diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 8f3e0a4..56b9e50 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.15.0"
+ ".": "0.15.1"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2ce227f..0bef6d1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 0.15.1 (2025-01-27)
+
+Full Changelog: [v0.15.0...v0.15.1](https://github.com/openai/openai-java/compare/v0.15.0...v0.15.1)
+
+### Documentation
+
+* builder, enum, and union comments ([#171](https://github.com/openai/openai-java/issues/171)) ([37acbbd](https://github.com/openai/openai-java/commit/37acbbd239d6b540a461084240bc266ad0491e9c))
+
## 0.15.0 (2025-01-27)
Full Changelog: [v0.14.1...v0.15.0](https://github.com/openai/openai-java/compare/v0.14.1...v0.15.0)
diff --git a/README.md b/README.md
index 5f86d67..1aea4b9 100644
--- a/README.md
+++ b/README.md
@@ -9,8 +9,8 @@
-[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/0.15.0)
-[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/0.15.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/0.15.0)
+[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/0.15.1)
+[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/0.15.1/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/0.15.1)
@@ -25,7 +25,7 @@ The REST API documentation can be found on [platform.openai.com](https://platfor
### Gradle
```kotlin
-implementation("com.openai:openai-java:0.15.0")
+implementation("com.openai:openai-java:0.15.1")
```
### Maven
@@ -34,7 +34,7 @@ implementation("com.openai:openai-java:0.15.0")
com.openai
openai-java
- 0.15.0
+ 0.15.1
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 6c03b8f..acb2afc 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.openai"
- version = "0.15.0" // x-release-please-version
+ version = "0.15.1" // x-release-please-version
}
subprojects {
diff --git a/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClient.kt b/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClient.kt
index a7fec00..abb408f 100644
--- a/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClient.kt
+++ b/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClient.kt
@@ -24,6 +24,7 @@ class OpenAIOkHttpClient private constructor() {
@JvmStatic fun fromEnv(): OpenAIClient = builder().fromEnv().build()
}
+ /** A builder for [OpenAIOkHttpClient]. */
class Builder internal constructor() {
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
diff --git a/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClientAsync.kt b/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClientAsync.kt
index de53143..3407fdc 100644
--- a/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClientAsync.kt
+++ b/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OpenAIOkHttpClientAsync.kt
@@ -24,6 +24,7 @@ class OpenAIOkHttpClientAsync private constructor() {
@JvmStatic fun fromEnv(): OpenAIClientAsync = builder().fromEnv().build()
}
+ /** A builder for [OpenAIOkHttpClientAsync]. */
class Builder internal constructor() {
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
diff --git a/openai-java-core/src/main/kotlin/com/openai/core/ClientOptions.kt b/openai-java-core/src/main/kotlin/com/openai/core/ClientOptions.kt
index 4b48545..d23b822 100644
--- a/openai-java-core/src/main/kotlin/com/openai/core/ClientOptions.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/core/ClientOptions.kt
@@ -48,6 +48,7 @@ private constructor(
@JvmStatic fun fromEnv(): ClientOptions = builder().fromEnv().build()
}
+ /** A builder for [ClientOptions]. */
class Builder internal constructor() {
private var httpClient: HttpClient? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/errors/OpenAIError.kt b/openai-java-core/src/main/kotlin/com/openai/errors/OpenAIError.kt
index 31a0d01..9508dc2 100644
--- a/openai-java-core/src/main/kotlin/com/openai/errors/OpenAIError.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/errors/OpenAIError.kt
@@ -30,6 +30,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [OpenAIError]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap = mutableMapOf()
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Annotation.kt b/openai-java-core/src/main/kotlin/com/openai/models/Annotation.kt
index 976b4f3..487dd69 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/Annotation.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/Annotation.kt
@@ -129,6 +129,7 @@ private constructor(
@JvmStatic fun ofFilePath(filePath: FilePathAnnotation) = Annotation(filePath = filePath)
}
+ /** An interface that defines how to map each variant of [Annotation] to a value of type [T]. */
interface Visitor {
/**
@@ -144,6 +145,15 @@ private constructor(
*/
fun visitFilePath(filePath: FilePathAnnotation): T
+ /**
+ * Maps an unknown variant of [Annotation] to a value of type [T].
+ *
+ * An instance of [Annotation] can contain an unknown variant if it was deserialized from
+ * data that doesn't match any known variant. For example, if the SDK is on an older version
+ * than the API, then the API may respond with new variants that the SDK is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Annotation: $json")
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AnnotationDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/AnnotationDelta.kt
index ea6141a..7eb9f64 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/AnnotationDelta.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/AnnotationDelta.kt
@@ -130,6 +130,10 @@ private constructor(
fun ofFilePath(filePath: FilePathDeltaAnnotation) = AnnotationDelta(filePath = filePath)
}
+ /**
+ * An interface that defines how to map each variant of [AnnotationDelta] to a value of type
+ * [T].
+ */
interface Visitor {
/**
@@ -145,6 +149,16 @@ private constructor(
*/
fun visitFilePath(filePath: FilePathDeltaAnnotation): T
+ /**
+ * Maps an unknown variant of [AnnotationDelta] to a value of type [T].
+ *
+ * An instance of [AnnotationDelta] can contain an unknown variant if it was deserialized
+ * from data that doesn't match any known variant. For example, if the SDK is on an older
+ * version than the API, then the API may respond with new variants that the SDK is unaware
+ * of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown AnnotationDelta: $json")
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Assistant.kt b/openai-java-core/src/main/kotlin/com/openai/models/Assistant.kt
index 41a3258..3b62306 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/Assistant.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/Assistant.kt
@@ -261,6 +261,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Assistant]. */
class Builder internal constructor() {
private var id: JsonField? = null
@@ -754,6 +755,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ToolResources]. */
class Builder internal constructor() {
private var codeInterpreter: JsonField = JsonMissing.of()
@@ -857,6 +859,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [CodeInterpreter]. */
class Builder internal constructor() {
private var fileIds: JsonField>? = null
@@ -1001,6 +1004,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [FileSearch]. */
class Builder internal constructor() {
private var vectorStoreIds: JsonField>? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AssistantDeleted.kt b/openai-java-core/src/main/kotlin/com/openai/models/AssistantDeleted.kt
index e7cf7a6..817d1bc 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/AssistantDeleted.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/AssistantDeleted.kt
@@ -67,6 +67,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [AssistantDeleted]. */
class Builder internal constructor() {
private var id: JsonField? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AssistantResponseFormatOption.kt b/openai-java-core/src/main/kotlin/com/openai/models/AssistantResponseFormatOption.kt
index f4a6f11..2ed580f 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/AssistantResponseFormatOption.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/AssistantResponseFormatOption.kt
@@ -171,6 +171,10 @@ private constructor(
AssistantResponseFormatOption(responseFormatJsonSchema = responseFormatJsonSchema)
}
+ /**
+ * An interface that defines how to map each variant of [AssistantResponseFormatOption] to a
+ * value of type [T].
+ */
interface Visitor {
/** `auto` is the default value */
@@ -182,6 +186,16 @@ private constructor(
fun visitResponseFormatJsonSchema(responseFormatJsonSchema: ResponseFormatJsonSchema): T
+ /**
+ * Maps an unknown variant of [AssistantResponseFormatOption] to a value of type [T].
+ *
+ * An instance of [AssistantResponseFormatOption] can contain an unknown variant if it was
+ * deserialized from data that doesn't match any known variant. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new variants that the SDK
+ * is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown AssistantResponseFormatOption: $json")
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AssistantStreamEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/AssistantStreamEvent.kt
index 661e18f..86c6ad8 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/AssistantStreamEvent.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/AssistantStreamEvent.kt
@@ -858,6 +858,10 @@ private constructor(
fun ofErrorEvent(errorEvent: ErrorEvent) = AssistantStreamEvent(errorEvent = errorEvent)
}
+ /**
+ * An interface that defines how to map each variant of [AssistantStreamEvent] to a value of
+ * type [T].
+ */
interface Visitor {
/**
@@ -1008,6 +1012,16 @@ private constructor(
*/
fun visitErrorEvent(errorEvent: ErrorEvent): T
+ /**
+ * Maps an unknown variant of [AssistantStreamEvent] to a value of type [T].
+ *
+ * An instance of [AssistantStreamEvent] can contain an unknown variant if it was
+ * deserialized from data that doesn't match any known variant. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new variants that the SDK
+ * is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown AssistantStreamEvent: $json")
}
@@ -1298,6 +1312,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadCreated]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -1434,6 +1449,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadRunCreated]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -1561,6 +1577,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadRunQueued]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -1688,6 +1705,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadRunInProgress]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -1815,6 +1833,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadRunRequiresAction]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -1941,6 +1960,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadRunCompleted]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -2068,6 +2088,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadRunIncomplete]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -2192,6 +2213,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadRunFailed]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -2319,6 +2341,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadRunCancelling]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -2445,6 +2468,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadRunCancelled]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -2569,6 +2593,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadRunExpired]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -2692,6 +2717,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadRunStepCreated]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -2810,6 +2836,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadRunStepInProgress]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -2928,6 +2955,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadRunStepDelta]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -3050,6 +3078,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadRunStepCompleted]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -3167,6 +3196,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadRunStepFailed]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -3285,6 +3315,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadRunStepCancelled]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -3402,6 +3433,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadRunStepExpired]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -3525,6 +3557,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadMessageCreated]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -3654,6 +3687,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadMessageInProgress]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -3777,6 +3811,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadMessageDelta]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -3900,6 +3935,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadMessageCompleted]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -4029,6 +4065,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ThreadMessageIncomplete]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -4150,6 +4187,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ErrorEvent]. */
class Builder internal constructor() {
private var data: JsonField? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AssistantTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/AssistantTool.kt
index 9188779..06b0617 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/AssistantTool.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/AssistantTool.kt
@@ -113,6 +113,9 @@ private constructor(
@JvmStatic fun ofFunction(function: FunctionTool) = AssistantTool(function = function)
}
+ /**
+ * An interface that defines how to map each variant of [AssistantTool] to a value of type [T].
+ */
interface Visitor {
fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool): T
@@ -121,6 +124,15 @@ private constructor(
fun visitFunction(function: FunctionTool): T
+ /**
+ * Maps an unknown variant of [AssistantTool] to a value of type [T].
+ *
+ * An instance of [AssistantTool] can contain an unknown variant if it was deserialized from
+ * data that doesn't match any known variant. For example, if the SDK is on an older version
+ * than the API, then the API may respond with new variants that the SDK is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown AssistantTool: $json")
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoice.kt b/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoice.kt
index b7cf8ab..c6eeced 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoice.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoice.kt
@@ -67,6 +67,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [AssistantToolChoice]. */
class Builder internal constructor() {
private var type: JsonField? = null
@@ -126,6 +127,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -139,19 +148,37 @@ private constructor(
@JvmStatic fun of(value: String) = Type(JsonField.of(value))
}
+ /** An enum containing [Type]'s known values. */
enum class Known {
FUNCTION,
CODE_INTERPRETER,
FILE_SEARCH,
}
+ /**
+ * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Type] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
FUNCTION,
CODE_INTERPRETER,
FILE_SEARCH,
+ /** An enum member indicating that [Type] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
FUNCTION -> Value.FUNCTION
@@ -160,6 +187,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
FUNCTION -> Known.FUNCTION
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoiceFunction.kt b/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoiceFunction.kt
index 56fbc30..b01f621 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoiceFunction.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoiceFunction.kt
@@ -52,6 +52,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [AssistantToolChoiceFunction]. */
class Builder internal constructor() {
private var name: JsonField? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoiceOption.kt b/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoiceOption.kt
index ee6b795..8b0e934 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoiceOption.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/AssistantToolChoiceOption.kt
@@ -128,6 +128,10 @@ private constructor(
AssistantToolChoiceOption(assistantToolChoice = assistantToolChoice)
}
+ /**
+ * An interface that defines how to map each variant of [AssistantToolChoiceOption] to a value
+ * of type [T].
+ */
interface Visitor {
/**
@@ -142,6 +146,16 @@ private constructor(
*/
fun visitAssistantToolChoice(assistantToolChoice: AssistantToolChoice): T
+ /**
+ * Maps an unknown variant of [AssistantToolChoiceOption] to a value of type [T].
+ *
+ * An instance of [AssistantToolChoiceOption] can contain an unknown variant if it was
+ * deserialized from data that doesn't match any known variant. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new variants that the SDK
+ * is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown AssistantToolChoiceOption: $json")
}
@@ -194,6 +208,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -207,19 +229,37 @@ private constructor(
@JvmStatic fun of(value: String) = Auto(JsonField.of(value))
}
+ /** An enum containing [Auto]'s known values. */
enum class Known {
NONE,
AUTO,
REQUIRED,
}
+ /**
+ * An enum containing [Auto]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Auto] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
NONE,
AUTO,
REQUIRED,
+ /** An enum member indicating that [Auto] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
NONE -> Value.NONE
@@ -228,6 +268,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
NONE -> Known.NONE
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/AutoFileChunkingStrategyParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/AutoFileChunkingStrategyParam.kt
index 73d8c15..0e5d089 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/AutoFileChunkingStrategyParam.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/AutoFileChunkingStrategyParam.kt
@@ -56,6 +56,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [AutoFileChunkingStrategyParam]. */
class Builder internal constructor() {
private var type: JsonValue = JsonValue.from("auto")
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Batch.kt b/openai-java-core/src/main/kotlin/com/openai/models/Batch.kt
index 32d478d..fe6f5d0 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/Batch.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/Batch.kt
@@ -260,6 +260,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Batch]. */
class Builder internal constructor() {
private var id: JsonField? = null
@@ -483,6 +484,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -506,6 +515,7 @@ private constructor(
@JvmStatic fun of(value: String) = Status(JsonField.of(value))
}
+ /** An enum containing [Status]'s known values. */
enum class Known {
VALIDATING,
FAILED,
@@ -517,6 +527,15 @@ private constructor(
CANCELLED,
}
+ /**
+ * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Status] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
VALIDATING,
FAILED,
@@ -526,9 +545,17 @@ private constructor(
EXPIRED,
CANCELLING,
CANCELLED,
+ /** An enum member indicating that [Status] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
VALIDATING -> Value.VALIDATING
@@ -542,6 +569,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
VALIDATING -> Known.VALIDATING
@@ -617,6 +653,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Errors]. */
class Builder internal constructor() {
private var data: JsonField>? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BatchCancelParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BatchCancelParams.kt
index 0c372b2..a4431b3 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BatchCancelParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BatchCancelParams.kt
@@ -54,6 +54,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BatchCancelParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BatchCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BatchCreateParams.kt
index 78a554c..1f93018 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BatchCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BatchCreateParams.kt
@@ -206,6 +206,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BatchCreateBody]. */
class Builder internal constructor() {
private var completionWindow: JsonField? = null
@@ -345,6 +346,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BatchCreateParams]. */
@NoAutoDetect
class Builder internal constructor() {
@@ -560,6 +562,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -569,21 +579,51 @@ private constructor(
@JvmStatic fun of(value: String) = CompletionWindow(JsonField.of(value))
}
+ /** An enum containing [CompletionWindow]'s known values. */
enum class Known {
_24H,
}
+ /**
+ * An enum containing [CompletionWindow]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [CompletionWindow] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
_24H,
+ /**
+ * An enum member indicating that [CompletionWindow] was instantiated with an unknown
+ * value.
+ */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
_24H -> Value._24H
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
_24H -> Known._24H
@@ -616,6 +656,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -629,19 +677,37 @@ private constructor(
@JvmStatic fun of(value: String) = Endpoint(JsonField.of(value))
}
+ /** An enum containing [Endpoint]'s known values. */
enum class Known {
V1_CHAT_COMPLETIONS,
V1_EMBEDDINGS,
V1_COMPLETIONS,
}
+ /**
+ * An enum containing [Endpoint]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Endpoint] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
V1_CHAT_COMPLETIONS,
V1_EMBEDDINGS,
V1_COMPLETIONS,
+ /** An enum member indicating that [Endpoint] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
V1_CHAT_COMPLETIONS -> Value.V1_CHAT_COMPLETIONS
@@ -650,6 +716,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
V1_CHAT_COMPLETIONS -> Known.V1_CHAT_COMPLETIONS
@@ -703,6 +778,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap = mutableMapOf()
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BatchError.kt b/openai-java-core/src/main/kotlin/com/openai/models/BatchError.kt
index 7b99b0b..c968866 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BatchError.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BatchError.kt
@@ -78,6 +78,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BatchError]. */
class Builder internal constructor() {
private var code: JsonField = JsonMissing.of()
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BatchListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BatchListParams.kt
index 166ae68..f42f524 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BatchListParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BatchListParams.kt
@@ -52,6 +52,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BatchListParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BatchRequestCounts.kt b/openai-java-core/src/main/kotlin/com/openai/models/BatchRequestCounts.kt
index ad9bf64..075cf81 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BatchRequestCounts.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BatchRequestCounts.kt
@@ -71,6 +71,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BatchRequestCounts]. */
class Builder internal constructor() {
private var completed: JsonField? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BatchRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BatchRetrieveParams.kt
index 40d5564..926a164 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BatchRetrieveParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BatchRetrieveParams.kt
@@ -40,6 +40,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BatchRetrieveParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantCreateParams.kt
index 382772e..8507230 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantCreateParams.kt
@@ -416,6 +416,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaAssistantCreateBody]. */
class Builder internal constructor() {
private var model: JsonField? = null
@@ -881,6 +882,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaAssistantCreateParams]. */
@NoAutoDetect
class Builder internal constructor() {
@@ -1420,6 +1422,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ToolResources]. */
class Builder internal constructor() {
private var codeInterpreter: JsonField = JsonMissing.of()
@@ -1523,6 +1526,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [CodeInterpreter]. */
class Builder internal constructor() {
private var fileIds: JsonField>? = null
@@ -1690,6 +1694,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [FileSearch]. */
class Builder internal constructor() {
private var vectorStoreIds: JsonField>? = null
@@ -1888,6 +1893,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [VectorStore]. */
class Builder internal constructor() {
private var chunkingStrategy: JsonField =
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantDeleteParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantDeleteParams.kt
index 81e5133..ac46d25 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantDeleteParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantDeleteParams.kt
@@ -50,6 +50,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaAssistantDeleteParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantListParams.kt
index dbe25ae..e3125dc 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantListParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantListParams.kt
@@ -73,6 +73,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaAssistantListParams]. */
@NoAutoDetect
class Builder internal constructor() {
@@ -275,6 +276,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -286,17 +295,35 @@ private constructor(
@JvmStatic fun of(value: String) = Order(JsonField.of(value))
}
+ /** An enum containing [Order]'s known values. */
enum class Known {
ASC,
DESC,
}
+ /**
+ * An enum containing [Order]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Order] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
ASC,
DESC,
+ /** An enum member indicating that [Order] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
ASC -> Value.ASC
@@ -304,6 +331,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
ASC -> Known.ASC
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantRetrieveParams.kt
index 7e30607..0b9af4c 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantRetrieveParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantRetrieveParams.kt
@@ -40,6 +40,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaAssistantRetrieveParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantUpdateParams.kt
index ecb67c0..8a3da00 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantUpdateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantUpdateParams.kt
@@ -426,6 +426,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaAssistantUpdateBody]. */
class Builder internal constructor() {
private var description: JsonField = JsonMissing.of()
@@ -883,6 +884,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaAssistantUpdateParams]. */
@NoAutoDetect
class Builder internal constructor() {
@@ -1419,6 +1421,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ToolResources]. */
class Builder internal constructor() {
private var codeInterpreter: JsonField = JsonMissing.of()
@@ -1522,6 +1525,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [CodeInterpreter]. */
class Builder internal constructor() {
private var fileIds: JsonField>? = null
@@ -1669,6 +1673,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [FileSearch]. */
class Builder internal constructor() {
private var vectorStoreIds: JsonField>? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateAndRunParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateAndRunParams.kt
index 409b003..1ec100a 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateAndRunParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateAndRunParams.kt
@@ -629,6 +629,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadCreateAndRunBody]. */
class Builder internal constructor() {
private var assistantId: JsonField? = null
@@ -1291,6 +1292,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadCreateAndRunParams]. */
@NoAutoDetect
class Builder internal constructor() {
@@ -2033,6 +2035,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Thread]. */
class Builder internal constructor() {
private var messages: JsonField>? = null
@@ -2226,6 +2229,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Message]. */
class Builder internal constructor() {
private var content: JsonField? = null
@@ -2457,6 +2461,10 @@ private constructor(
Content(arrayOfContentParts = arrayOfContentParts)
}
+ /**
+ * An interface that defines how to map each variant of [Content] to a value of type
+ * [T].
+ */
interface Visitor {
/** The text contents of the message. */
@@ -2472,6 +2480,16 @@ private constructor(
arrayOfContentParts: List
): T
+ /**
+ * Maps an unknown variant of [Content] to a value of type [T].
+ *
+ * An instance of [Content] can contain an unknown variant if it was
+ * deserialized from data that doesn't match any known variant. For example, if
+ * the SDK is on an older version than the API, then the API may respond with
+ * new variants that the SDK is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Content: $json")
}
@@ -2527,6 +2545,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that
+ * doesn't match any known member, and you want to know that value. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -2538,17 +2564,37 @@ private constructor(
@JvmStatic fun of(value: String) = Role(JsonField.of(value))
}
+ /** An enum containing [Role]'s known values. */
enum class Known {
USER,
ASSISTANT,
}
+ /**
+ * An enum containing [Role]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Role] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example,
+ * if the SDK is on an older version than the API, then the API may respond with
+ * new members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
USER,
ASSISTANT,
+ /**
+ * An enum member indicating that [Role] was instantiated with an unknown value.
+ */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if
+ * you want to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
USER -> Value.USER
@@ -2556,6 +2602,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a
+ * known member.
+ */
fun known(): Known =
when (this) {
USER -> Known.USER
@@ -2627,6 +2682,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Attachment]. */
class Builder internal constructor() {
private var fileId: JsonField = JsonMissing.of()
@@ -2793,12 +2849,26 @@ private constructor(
Tool(fileSearch = JsonValue.from(mapOf("type" to "file_search")))
}
+ /**
+ * An interface that defines how to map each variant of [Tool] to a value of
+ * type [T].
+ */
interface Visitor {
fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool): T
fun visitFileSearch(fileSearch: JsonValue): T
+ /**
+ * Maps an unknown variant of [Tool] to a value of type [T].
+ *
+ * An instance of [Tool] can contain an unknown variant if it was
+ * deserialized from data that doesn't match any known variant. For example,
+ * if the SDK is on an older version than the API, then the API may respond
+ * with new variants that the SDK is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Tool: $json")
}
@@ -2956,6 +3026,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ToolResources]. */
class Builder internal constructor() {
private var codeInterpreter: JsonField = JsonMissing.of()
@@ -3062,6 +3133,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [CodeInterpreter]. */
class Builder internal constructor() {
private var fileIds: JsonField>? = null
@@ -3229,6 +3301,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [FileSearch]. */
class Builder internal constructor() {
private var vectorStoreIds: JsonField>? = null
@@ -3429,6 +3502,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [VectorStore]. */
class Builder internal constructor() {
private var chunkingStrategy: JsonField =
@@ -3676,6 +3750,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ToolResources]. */
class Builder internal constructor() {
private var codeInterpreter: JsonField = JsonMissing.of()
@@ -3779,6 +3854,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [CodeInterpreter]. */
class Builder internal constructor() {
private var fileIds: JsonField>? = null
@@ -3923,6 +3999,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [FileSearch]. */
class Builder internal constructor() {
private var vectorStoreIds: JsonField>? = null
@@ -4131,6 +4208,7 @@ private constructor(
@JvmStatic fun ofFunction(function: FunctionTool) = Tool(function = function)
}
+ /** An interface that defines how to map each variant of [Tool] to a value of type [T]. */
interface Visitor {
fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool): T
@@ -4139,6 +4217,15 @@ private constructor(
fun visitFunction(function: FunctionTool): T
+ /**
+ * Maps an unknown variant of [Tool] to a value of type [T].
+ *
+ * An instance of [Tool] can contain an unknown variant if it was deserialized from data
+ * that doesn't match any known variant. For example, if the SDK is on an older version
+ * than the API, then the API may respond with new variants that the SDK is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Tool: $json")
}
@@ -4254,6 +4341,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [TruncationStrategy]. */
class Builder internal constructor() {
private var type: JsonField? = null
@@ -4350,6 +4438,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new members that the
+ * SDK is unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -4361,17 +4457,35 @@ private constructor(
@JvmStatic fun of(value: String) = Type(JsonField.of(value))
}
+ /** An enum containing [Type]'s known values. */
enum class Known {
AUTO,
LAST_MESSAGES,
}
+ /**
+ * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Type] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
AUTO,
LAST_MESSAGES,
+ /** An enum member indicating that [Type] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you
+ * want to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
AUTO -> Value.AUTO
@@ -4379,6 +4493,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
AUTO -> Known.AUTO
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateParams.kt
index 6de40eb..84f8635 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadCreateParams.kt
@@ -166,6 +166,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadCreateBody]. */
class Builder internal constructor() {
private var messages: JsonField>? = null
@@ -300,6 +301,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadCreateParams]. */
@NoAutoDetect
class Builder internal constructor() {
@@ -575,6 +577,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Message]. */
class Builder internal constructor() {
private var content: JsonField? = null
@@ -792,6 +795,10 @@ private constructor(
Content(arrayOfContentParts = arrayOfContentParts)
}
+ /**
+ * An interface that defines how to map each variant of [Content] to a value of type
+ * [T].
+ */
interface Visitor {
/** The text contents of the message. */
@@ -804,6 +811,16 @@ private constructor(
*/
fun visitArrayOfContentParts(arrayOfContentParts: List): T
+ /**
+ * Maps an unknown variant of [Content] to a value of type [T].
+ *
+ * An instance of [Content] can contain an unknown variant if it was deserialized
+ * from data that doesn't match any known variant. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new variants that the
+ * SDK is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Content: $json")
}
@@ -859,6 +876,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new members that the
+ * SDK is unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -870,17 +895,35 @@ private constructor(
@JvmStatic fun of(value: String) = Role(JsonField.of(value))
}
+ /** An enum containing [Role]'s known values. */
enum class Known {
USER,
ASSISTANT,
}
+ /**
+ * An enum containing [Role]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Role] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
USER,
ASSISTANT,
+ /** An enum member indicating that [Role] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you
+ * want to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
USER -> Value.USER
@@ -888,6 +931,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
USER -> Known.USER
@@ -959,6 +1011,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Attachment]. */
class Builder internal constructor() {
private var fileId: JsonField = JsonMissing.of()
@@ -1125,12 +1178,26 @@ private constructor(
Tool(fileSearch = JsonValue.from(mapOf("type" to "file_search")))
}
+ /**
+ * An interface that defines how to map each variant of [Tool] to a value of type
+ * [T].
+ */
interface Visitor {
fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool): T
fun visitFileSearch(fileSearch: JsonValue): T
+ /**
+ * Maps an unknown variant of [Tool] to a value of type [T].
+ *
+ * An instance of [Tool] can contain an unknown variant if it was deserialized
+ * from data that doesn't match any known variant. For example, if the SDK is on
+ * an older version than the API, then the API may respond with new variants
+ * that the SDK is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Tool: $json")
}
@@ -1283,6 +1350,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ToolResources]. */
class Builder internal constructor() {
private var codeInterpreter: JsonField = JsonMissing.of()
@@ -1386,6 +1454,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [CodeInterpreter]. */
class Builder internal constructor() {
private var fileIds: JsonField>? = null
@@ -1553,6 +1622,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [FileSearch]. */
class Builder internal constructor() {
private var vectorStoreIds: JsonField>? = null
@@ -1751,6 +1821,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [VectorStore]. */
class Builder internal constructor() {
private var chunkingStrategy: JsonField =
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadDeleteParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadDeleteParams.kt
index 71d0469..f302c92 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadDeleteParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadDeleteParams.kt
@@ -50,6 +50,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadDeleteParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageCreateParams.kt
index fdb3b54..931bae9 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageCreateParams.kt
@@ -181,6 +181,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadMessageCreateBody]. */
class Builder internal constructor() {
private var content: JsonField? = null
@@ -322,6 +323,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadMessageCreateParams]. */
@NoAutoDetect
class Builder internal constructor() {
@@ -626,6 +628,9 @@ private constructor(
Content(arrayOfContentParts = arrayOfContentParts)
}
+ /**
+ * An interface that defines how to map each variant of [Content] to a value of type [T].
+ */
interface Visitor {
/** The text contents of the message. */
@@ -638,6 +643,16 @@ private constructor(
*/
fun visitArrayOfContentParts(arrayOfContentParts: List): T
+ /**
+ * Maps an unknown variant of [Content] to a value of type [T].
+ *
+ * An instance of [Content] can contain an unknown variant if it was deserialized from
+ * data that doesn't match any known variant. For example, if the SDK is on an older
+ * version than the API, then the API may respond with new variants that the SDK is
+ * unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Content: $json")
}
@@ -693,6 +708,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -704,17 +727,35 @@ private constructor(
@JvmStatic fun of(value: String) = Role(JsonField.of(value))
}
+ /** An enum containing [Role]'s known values. */
enum class Known {
USER,
ASSISTANT,
}
+ /**
+ * An enum containing [Role]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Role] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
USER,
ASSISTANT,
+ /** An enum member indicating that [Role] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
USER -> Value.USER
@@ -722,6 +763,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
USER -> Known.USER
@@ -793,6 +843,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Attachment]. */
class Builder internal constructor() {
private var fileId: JsonField = JsonMissing.of()
@@ -954,12 +1005,25 @@ private constructor(
Tool(fileSearch = JsonValue.from(mapOf("type" to "file_search")))
}
+ /**
+ * An interface that defines how to map each variant of [Tool] to a value of type [T].
+ */
interface Visitor {
fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool): T
fun visitFileSearch(fileSearch: JsonValue): T
+ /**
+ * Maps an unknown variant of [Tool] to a value of type [T].
+ *
+ * An instance of [Tool] can contain an unknown variant if it was deserialized from
+ * data that doesn't match any known variant. For example, if the SDK is on an older
+ * version than the API, then the API may respond with new variants that the SDK is
+ * unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Tool: $json")
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageDeleteParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageDeleteParams.kt
index 7a603a4..018151b 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageDeleteParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageDeleteParams.kt
@@ -54,6 +54,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadMessageDeleteParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageListParams.kt
index 66ba530..d23251e 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageListParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageListParams.kt
@@ -89,6 +89,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadMessageListParams]. */
@NoAutoDetect
class Builder internal constructor() {
@@ -305,6 +306,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -316,17 +325,35 @@ private constructor(
@JvmStatic fun of(value: String) = Order(JsonField.of(value))
}
+ /** An enum containing [Order]'s known values. */
enum class Known {
ASC,
DESC,
}
+ /**
+ * An enum containing [Order]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Order] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
ASC,
DESC,
+ /** An enum member indicating that [Order] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
ASC -> Value.ASC
@@ -334,6 +361,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
ASC -> Known.ASC
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageRetrieveParams.kt
index 0386a28..96c7673 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageRetrieveParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageRetrieveParams.kt
@@ -44,6 +44,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadMessageRetrieveParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageUpdateParams.kt
index 7582245..5208aee 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageUpdateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadMessageUpdateParams.kt
@@ -97,6 +97,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadMessageUpdateBody]. */
class Builder internal constructor() {
private var metadata: JsonValue = JsonMissing.of()
@@ -164,6 +165,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadMessageUpdateParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRetrieveParams.kt
index e4e053e..5d87c85 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRetrieveParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRetrieveParams.kt
@@ -40,6 +40,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadRetrieveParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCancelParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCancelParams.kt
index 1674a09..009800d 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCancelParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCancelParams.kt
@@ -54,6 +54,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadRunCancelParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCreateParams.kt
index e24a1df..def84db 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCreateParams.kt
@@ -662,6 +662,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadRunCreateBody]. */
class Builder internal constructor() {
private var assistantId: JsonField? = null
@@ -1349,6 +1350,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadRunCreateParams]. */
@NoAutoDetect
class Builder internal constructor() {
@@ -2152,6 +2154,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [AdditionalMessage]. */
class Builder internal constructor() {
private var content: JsonField? = null
@@ -2369,6 +2372,10 @@ private constructor(
Content(arrayOfContentParts = arrayOfContentParts)
}
+ /**
+ * An interface that defines how to map each variant of [Content] to a value of type
+ * [T].
+ */
interface Visitor {
/** The text contents of the message. */
@@ -2381,6 +2388,16 @@ private constructor(
*/
fun visitArrayOfContentParts(arrayOfContentParts: List): T
+ /**
+ * Maps an unknown variant of [Content] to a value of type [T].
+ *
+ * An instance of [Content] can contain an unknown variant if it was deserialized
+ * from data that doesn't match any known variant. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new variants that the
+ * SDK is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Content: $json")
}
@@ -2436,6 +2453,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new members that the
+ * SDK is unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -2447,17 +2472,35 @@ private constructor(
@JvmStatic fun of(value: String) = Role(JsonField.of(value))
}
+ /** An enum containing [Role]'s known values. */
enum class Known {
USER,
ASSISTANT,
}
+ /**
+ * An enum containing [Role]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Role] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
USER,
ASSISTANT,
+ /** An enum member indicating that [Role] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you
+ * want to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
USER -> Value.USER
@@ -2465,6 +2508,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
USER -> Known.USER
@@ -2536,6 +2588,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Attachment]. */
class Builder internal constructor() {
private var fileId: JsonField = JsonMissing.of()
@@ -2702,12 +2755,26 @@ private constructor(
Tool(fileSearch = JsonValue.from(mapOf("type" to "file_search")))
}
+ /**
+ * An interface that defines how to map each variant of [Tool] to a value of type
+ * [T].
+ */
interface Visitor {
fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool): T
fun visitFileSearch(fileSearch: JsonValue): T
+ /**
+ * Maps an unknown variant of [Tool] to a value of type [T].
+ *
+ * An instance of [Tool] can contain an unknown variant if it was deserialized
+ * from data that doesn't match any known variant. For example, if the SDK is on
+ * an older version than the API, then the API may respond with new variants
+ * that the SDK is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Tool: $json")
}
@@ -2874,6 +2941,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [TruncationStrategy]. */
class Builder internal constructor() {
private var type: JsonField? = null
@@ -2970,6 +3038,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new members that the
+ * SDK is unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -2981,17 +3057,35 @@ private constructor(
@JvmStatic fun of(value: String) = Type(JsonField.of(value))
}
+ /** An enum containing [Type]'s known values. */
enum class Known {
AUTO,
LAST_MESSAGES,
}
+ /**
+ * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Type] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
AUTO,
LAST_MESSAGES,
+ /** An enum member indicating that [Type] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you
+ * want to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
AUTO -> Value.AUTO
@@ -2999,6 +3093,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
AUTO -> Known.AUTO
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunListParams.kt
index dc8d1ad..1fe05a6 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunListParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunListParams.kt
@@ -84,6 +84,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadRunListParams]. */
@NoAutoDetect
class Builder internal constructor() {
@@ -291,6 +292,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -302,17 +311,35 @@ private constructor(
@JvmStatic fun of(value: String) = Order(JsonField.of(value))
}
+ /** An enum containing [Order]'s known values. */
enum class Known {
ASC,
DESC,
}
+ /**
+ * An enum containing [Order]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Order] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
ASC,
DESC,
+ /** An enum member indicating that [Order] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
ASC -> Value.ASC
@@ -320,6 +347,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
ASC -> Known.ASC
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunRetrieveParams.kt
index 50f16cd..8be9b30 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunRetrieveParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunRetrieveParams.kt
@@ -44,6 +44,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadRunRetrieveParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunStepListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunStepListParams.kt
index 735b924..38683ae 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunStepListParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunStepListParams.kt
@@ -102,6 +102,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadRunStepListParams]. */
@NoAutoDetect
class Builder internal constructor() {
@@ -354,6 +355,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -365,17 +374,35 @@ private constructor(
@JvmStatic fun of(value: String) = Order(JsonField.of(value))
}
+ /** An enum containing [Order]'s known values. */
enum class Known {
ASC,
DESC,
}
+ /**
+ * An enum containing [Order]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Order] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
ASC,
DESC,
+ /** An enum member indicating that [Order] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
ASC -> Value.ASC
@@ -383,6 +410,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
ASC -> Known.ASC
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunStepRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunStepRetrieveParams.kt
index 1b1b434..f5d4bf4 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunStepRetrieveParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunStepRetrieveParams.kt
@@ -68,6 +68,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadRunStepRetrieveParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunSubmitToolOutputsParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunSubmitToolOutputsParams.kt
index 23a71d0..38e2942 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunSubmitToolOutputsParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunSubmitToolOutputsParams.kt
@@ -104,6 +104,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadRunSubmitToolOutputsBody]. */
class Builder internal constructor() {
private var toolOutputs: JsonField>? = null
@@ -192,6 +193,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadRunSubmitToolOutputsParams]. */
@NoAutoDetect
class Builder internal constructor() {
@@ -414,6 +416,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ToolOutput]. */
class Builder internal constructor() {
private var output: JsonField = JsonMissing.of()
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunUpdateParams.kt
index 38c584e..54d9352 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunUpdateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunUpdateParams.kt
@@ -97,6 +97,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadRunUpdateBody]. */
class Builder internal constructor() {
private var metadata: JsonValue = JsonMissing.of()
@@ -163,6 +164,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadRunUpdateParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadUpdateParams.kt
index b1d1c4f..d09ace2 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadUpdateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaThreadUpdateParams.kt
@@ -132,6 +132,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadUpdateBody]. */
class Builder internal constructor() {
private var metadata: JsonValue = JsonMissing.of()
@@ -232,6 +233,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaThreadUpdateParams]. */
@NoAutoDetect
class Builder internal constructor() {
@@ -468,6 +470,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ToolResources]. */
class Builder internal constructor() {
private var codeInterpreter: JsonField = JsonMissing.of()
@@ -571,6 +574,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [CodeInterpreter]. */
class Builder internal constructor() {
private var fileIds: JsonField>? = null
@@ -715,6 +719,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [FileSearch]. */
class Builder internal constructor() {
private var vectorStoreIds: JsonField>? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreCreateParams.kt
index 7122023..876301d 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreCreateParams.kt
@@ -180,6 +180,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaVectorStoreCreateBody]. */
class Builder internal constructor() {
private var chunkingStrategy: JsonField = JsonMissing.of()
@@ -335,6 +336,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaVectorStoreCreateParams]. */
@NoAutoDetect
class Builder internal constructor() {
@@ -595,6 +597,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ExpiresAfter]. */
class Builder internal constructor() {
private var anchor: JsonValue = JsonValue.from("last_active_at")
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreDeleteParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreDeleteParams.kt
index 2297f21..3288d55 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreDeleteParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreDeleteParams.kt
@@ -50,6 +50,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaVectorStoreDeleteParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchCancelParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchCancelParams.kt
index 2f8c195..f8dd685 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchCancelParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchCancelParams.kt
@@ -57,6 +57,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaVectorStoreFileBatchCancelParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchCreateParams.kt
index bec23d3..a2bb920 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchCreateParams.kt
@@ -137,6 +137,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaVectorStoreFileBatchCreateBody]. */
class Builder internal constructor() {
private var fileIds: JsonField>? = null
@@ -265,6 +266,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaVectorStoreFileBatchCreateParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchListFilesParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchListFilesParams.kt
index 8e37bd1..01857f7 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchListFilesParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchListFilesParams.kt
@@ -93,6 +93,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaVectorStoreFileBatchListFilesParams]. */
@NoAutoDetect
class Builder internal constructor() {
@@ -315,6 +316,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -330,6 +339,7 @@ private constructor(
@JvmStatic fun of(value: String) = Filter(JsonField.of(value))
}
+ /** An enum containing [Filter]'s known values. */
enum class Known {
IN_PROGRESS,
COMPLETED,
@@ -337,14 +347,31 @@ private constructor(
CANCELLED,
}
+ /**
+ * An enum containing [Filter]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Filter] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
IN_PROGRESS,
COMPLETED,
FAILED,
CANCELLED,
+ /** An enum member indicating that [Filter] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
IN_PROGRESS -> Value.IN_PROGRESS
@@ -354,6 +381,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
IN_PROGRESS -> Known.IN_PROGRESS
@@ -388,6 +424,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -399,17 +443,35 @@ private constructor(
@JvmStatic fun of(value: String) = Order(JsonField.of(value))
}
+ /** An enum containing [Order]'s known values. */
enum class Known {
ASC,
DESC,
}
+ /**
+ * An enum containing [Order]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Order] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
ASC,
DESC,
+ /** An enum member indicating that [Order] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
ASC -> Value.ASC
@@ -417,6 +479,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
ASC -> Known.ASC
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchRetrieveParams.kt
index 576c20e..eac542c 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchRetrieveParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileBatchRetrieveParams.kt
@@ -44,6 +44,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaVectorStoreFileBatchRetrieveParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileCreateParams.kt
index 771786b..b3e875a 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileCreateParams.kt
@@ -141,6 +141,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaVectorStoreFileCreateBody]. */
class Builder internal constructor() {
private var fileId: JsonField? = null
@@ -249,6 +250,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaVectorStoreFileCreateParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileDeleteParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileDeleteParams.kt
index edf6df2..c0b44aa 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileDeleteParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileDeleteParams.kt
@@ -58,6 +58,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaVectorStoreFileDeleteParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileListParams.kt
index c047490..f090899 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileListParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileListParams.kt
@@ -89,6 +89,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaVectorStoreFileListParams]. */
@NoAutoDetect
class Builder internal constructor() {
@@ -302,6 +303,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -317,6 +326,7 @@ private constructor(
@JvmStatic fun of(value: String) = Filter(JsonField.of(value))
}
+ /** An enum containing [Filter]'s known values. */
enum class Known {
IN_PROGRESS,
COMPLETED,
@@ -324,14 +334,31 @@ private constructor(
CANCELLED,
}
+ /**
+ * An enum containing [Filter]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Filter] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
IN_PROGRESS,
COMPLETED,
FAILED,
CANCELLED,
+ /** An enum member indicating that [Filter] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
IN_PROGRESS -> Value.IN_PROGRESS
@@ -341,6 +368,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
IN_PROGRESS -> Known.IN_PROGRESS
@@ -375,6 +411,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -386,17 +430,35 @@ private constructor(
@JvmStatic fun of(value: String) = Order(JsonField.of(value))
}
+ /** An enum containing [Order]'s known values. */
enum class Known {
ASC,
DESC,
}
+ /**
+ * An enum containing [Order]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Order] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
ASC,
DESC,
+ /** An enum member indicating that [Order] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
ASC -> Value.ASC
@@ -404,6 +466,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
ASC -> Known.ASC
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileRetrieveParams.kt
index cb48bda..b685ce3 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileRetrieveParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreFileRetrieveParams.kt
@@ -44,6 +44,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaVectorStoreFileRetrieveParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreListParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreListParams.kt
index 3e0c90a..d2f883f 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreListParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreListParams.kt
@@ -73,6 +73,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaVectorStoreListParams]. */
@NoAutoDetect
class Builder internal constructor() {
@@ -275,6 +276,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -286,17 +295,35 @@ private constructor(
@JvmStatic fun of(value: String) = Order(JsonField.of(value))
}
+ /** An enum containing [Order]'s known values. */
enum class Known {
ASC,
DESC,
}
+ /**
+ * An enum containing [Order]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Order] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
ASC,
DESC,
+ /** An enum member indicating that [Order] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
ASC -> Value.ASC
@@ -304,6 +331,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
ASC -> Known.ASC
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreRetrieveParams.kt
index 45bb640..9d42c68 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreRetrieveParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreRetrieveParams.kt
@@ -40,6 +40,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaVectorStoreRetrieveParams]. */
@NoAutoDetect
class Builder internal constructor() {
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreUpdateParams.kt
index 8c56f66..a3d4738 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreUpdateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/BetaVectorStoreUpdateParams.kt
@@ -131,6 +131,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaVectorStoreUpdateBody]. */
class Builder internal constructor() {
private var expiresAfter: JsonField = JsonMissing.of()
@@ -228,6 +229,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [BetaVectorStoreUpdateParams]. */
@NoAutoDetect
class Builder internal constructor() {
@@ -450,6 +452,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ExpiresAfter]. */
class Builder internal constructor() {
private var anchor: JsonValue = JsonValue.from("last_active_at")
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletion.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletion.kt
index 2462334..1afd955 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletion.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletion.kt
@@ -139,6 +139,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletion]. */
class Builder internal constructor() {
private var id: JsonField? = null
@@ -361,6 +362,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Choice]. */
class Builder internal constructor() {
private var finishReason: JsonField? = null
@@ -463,6 +465,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new members that the
+ * SDK is unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -480,6 +490,7 @@ private constructor(
@JvmStatic fun of(value: String) = FinishReason(JsonField.of(value))
}
+ /** An enum containing [FinishReason]'s known values. */
enum class Known {
STOP,
LENGTH,
@@ -488,15 +499,35 @@ private constructor(
FUNCTION_CALL,
}
+ /**
+ * An enum containing [FinishReason]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [FinishReason] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
STOP,
LENGTH,
TOOL_CALLS,
CONTENT_FILTER,
FUNCTION_CALL,
+ /**
+ * An enum member indicating that [FinishReason] was instantiated with an unknown
+ * value.
+ */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you
+ * want to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
STOP -> Value.STOP
@@ -507,6 +538,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
STOP -> Known.STOP
@@ -588,6 +628,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Logprobs]. */
class Builder internal constructor() {
private var content: JsonField>? = null
@@ -728,6 +769,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -739,17 +788,37 @@ private constructor(
@JvmStatic fun of(value: String) = ServiceTier(JsonField.of(value))
}
+ /** An enum containing [ServiceTier]'s known values. */
enum class Known {
SCALE,
DEFAULT,
}
+ /**
+ * An enum containing [ServiceTier]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [ServiceTier] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
SCALE,
DEFAULT,
+ /**
+ * An enum member indicating that [ServiceTier] was instantiated with an unknown value.
+ */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
SCALE -> Value.SCALE
@@ -757,6 +826,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
SCALE -> Known.SCALE
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAssistantMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAssistantMessageParam.kt
index ba8b488..9d574d2 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAssistantMessageParam.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAssistantMessageParam.kt
@@ -155,6 +155,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionAssistantMessageParam]. */
class Builder internal constructor() {
private var role: JsonValue = JsonValue.from("assistant")
@@ -373,6 +374,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Audio]. */
class Builder internal constructor() {
private var id: JsonField? = null
@@ -532,6 +534,9 @@ private constructor(
) = Content(arrayOfContentParts = arrayOfContentParts)
}
+ /**
+ * An interface that defines how to map each variant of [Content] to a value of type [T].
+ */
interface Visitor {
/** The contents of the assistant message. */
@@ -545,6 +550,16 @@ private constructor(
arrayOfContentParts: List
): T
+ /**
+ * Maps an unknown variant of [Content] to a value of type [T].
+ *
+ * An instance of [Content] can contain an unknown variant if it was deserialized from
+ * data that doesn't match any known variant. For example, if the SDK is on an older
+ * version than the API, then the API may respond with new variants that the SDK is
+ * unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Content: $json")
}
@@ -688,6 +703,10 @@ private constructor(
ChatCompletionRequestAssistantMessageContentPart(refusal = refusal)
}
+ /**
+ * An interface that defines how to map each variant of
+ * [ChatCompletionRequestAssistantMessageContentPart] to a value of type [T].
+ */
interface Visitor {
/**
@@ -698,6 +717,17 @@ private constructor(
fun visitRefusal(refusal: ChatCompletionContentPartRefusal): T
+ /**
+ * Maps an unknown variant of [ChatCompletionRequestAssistantMessageContentPart] to
+ * a value of type [T].
+ *
+ * An instance of [ChatCompletionRequestAssistantMessageContentPart] can contain an
+ * unknown variant if it was deserialized from data that doesn't match any known
+ * variant. For example, if the SDK is on an older version than the API, then the
+ * API may respond with new variants that the SDK is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException(
"Unknown ChatCompletionRequestAssistantMessageContentPart: $json"
@@ -836,6 +866,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [FunctionCall]. */
class Builder internal constructor() {
private var arguments: JsonField? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAudio.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAudio.kt
index 2e21aaa..a7bde73 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAudio.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAudio.kt
@@ -94,6 +94,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionAudio]. */
class Builder internal constructor() {
private var id: JsonField? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAudioParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAudioParam.kt
index 6f07fc0..02d8924 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAudioParam.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionAudioParam.kt
@@ -80,6 +80,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionAudioParam]. */
class Builder internal constructor() {
private var format: JsonField? = null
@@ -155,6 +156,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -172,6 +181,7 @@ private constructor(
@JvmStatic fun of(value: String) = Format(JsonField.of(value))
}
+ /** An enum containing [Format]'s known values. */
enum class Known {
WAV,
MP3,
@@ -180,15 +190,32 @@ private constructor(
PCM16,
}
+ /**
+ * An enum containing [Format]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Format] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
WAV,
MP3,
FLAC,
OPUS,
PCM16,
+ /** An enum member indicating that [Format] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
WAV -> Value.WAV
@@ -199,6 +226,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
WAV -> Known.WAV
@@ -235,6 +271,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -258,6 +302,7 @@ private constructor(
@JvmStatic fun of(value: String) = Voice(JsonField.of(value))
}
+ /** An enum containing [Voice]'s known values. */
enum class Known {
ALLOY,
ASH,
@@ -269,6 +314,15 @@ private constructor(
VERSE,
}
+ /**
+ * An enum containing [Voice]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Voice] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
ALLOY,
ASH,
@@ -278,9 +332,17 @@ private constructor(
SAGE,
SHIMMER,
VERSE,
+ /** An enum member indicating that [Voice] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
ALLOY -> Value.ALLOY
@@ -294,6 +356,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
ALLOY -> Known.ALLOY
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionChunk.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionChunk.kt
index 8617e44..2c0a07d 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionChunk.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionChunk.kt
@@ -162,6 +162,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionChunk]. */
class Builder internal constructor() {
private var id: JsonField? = null
@@ -414,6 +415,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Choice]. */
class Builder internal constructor() {
private var delta: JsonField? = null
@@ -604,6 +606,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Delta]. */
class Builder internal constructor() {
private var content: JsonField = JsonMissing.of()
@@ -783,6 +786,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [FunctionCall]. */
class Builder internal constructor() {
private var arguments: JsonField = JsonMissing.of()
@@ -875,6 +879,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that
+ * doesn't match any known member, and you want to know that value. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -890,6 +902,7 @@ private constructor(
@JvmStatic fun of(value: String) = Role(JsonField.of(value))
}
+ /** An enum containing [Role]'s known values. */
enum class Known {
SYSTEM,
USER,
@@ -897,14 +910,33 @@ private constructor(
TOOL,
}
+ /**
+ * An enum containing [Role]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Role] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example,
+ * if the SDK is on an older version than the API, then the API may respond with
+ * new members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
SYSTEM,
USER,
ASSISTANT,
TOOL,
+ /**
+ * An enum member indicating that [Role] was instantiated with an unknown value.
+ */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if
+ * you want to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
SYSTEM -> Value.SYSTEM
@@ -914,6 +946,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a
+ * known member.
+ */
fun known(): Known =
when (this) {
SYSTEM -> Known.SYSTEM
@@ -1006,6 +1047,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ToolCall]. */
class Builder internal constructor() {
private var index: JsonField? = null
@@ -1137,6 +1179,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Function]. */
class Builder internal constructor() {
private var arguments: JsonField = JsonMissing.of()
@@ -1230,6 +1273,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that
+ * doesn't match any known member, and you want to know that value. For example,
+ * if the SDK is on an older version than the API, then the API may respond with
+ * new members that the SDK is unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue
fun _value(): JsonField = value
@@ -1240,21 +1291,51 @@ private constructor(
@JvmStatic fun of(value: String) = Type(JsonField.of(value))
}
+ /** An enum containing [Type]'s known values. */
enum class Known {
FUNCTION,
}
+ /**
+ * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Type] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For
+ * example, if the SDK is on an older version than the API, then the API may
+ * respond with new members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
FUNCTION,
+ /**
+ * An enum member indicating that [Type] was instantiated with an unknown
+ * value.
+ */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or
+ * if you want to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
FUNCTION -> Value.FUNCTION
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known
+ * and don't want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a
+ * known member.
+ */
fun known(): Known =
when (this) {
FUNCTION -> Known.FUNCTION
@@ -1325,6 +1406,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new members that the
+ * SDK is unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -1342,6 +1431,7 @@ private constructor(
@JvmStatic fun of(value: String) = FinishReason(JsonField.of(value))
}
+ /** An enum containing [FinishReason]'s known values. */
enum class Known {
STOP,
LENGTH,
@@ -1350,15 +1440,35 @@ private constructor(
FUNCTION_CALL,
}
+ /**
+ * An enum containing [FinishReason]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [FinishReason] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
STOP,
LENGTH,
TOOL_CALLS,
CONTENT_FILTER,
FUNCTION_CALL,
+ /**
+ * An enum member indicating that [FinishReason] was instantiated with an unknown
+ * value.
+ */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you
+ * want to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
STOP -> Value.STOP
@@ -1369,6 +1479,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
STOP -> Known.STOP
@@ -1450,6 +1569,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Logprobs]. */
class Builder internal constructor() {
private var content: JsonField>? = null
@@ -1590,6 +1710,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -1601,17 +1729,37 @@ private constructor(
@JvmStatic fun of(value: String) = ServiceTier(JsonField.of(value))
}
+ /** An enum containing [ServiceTier]'s known values. */
enum class Known {
SCALE,
DEFAULT,
}
+ /**
+ * An enum containing [ServiceTier]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [ServiceTier] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
SCALE,
DEFAULT,
+ /**
+ * An enum member indicating that [ServiceTier] was instantiated with an unknown value.
+ */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
SCALE -> Value.SCALE
@@ -1619,6 +1767,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
SCALE -> Known.SCALE
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPart.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPart.kt
index 6b9d102..ac540cb 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPart.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPart.kt
@@ -126,6 +126,10 @@ private constructor(
ChatCompletionContentPart(inputAudio = inputAudio)
}
+ /**
+ * An interface that defines how to map each variant of [ChatCompletionContentPart] to a value
+ * of type [T].
+ */
interface Visitor {
/** Learn about [text inputs](https://platform.openai.com/docs/guides/text-generation). */
@@ -137,6 +141,16 @@ private constructor(
/** Learn about [audio inputs](https://platform.openai.com/docs/guides/audio). */
fun visitInputAudio(inputAudio: ChatCompletionContentPartInputAudio): T
+ /**
+ * Maps an unknown variant of [ChatCompletionContentPart] to a value of type [T].
+ *
+ * An instance of [ChatCompletionContentPart] can contain an unknown variant if it was
+ * deserialized from data that doesn't match any known variant. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new variants that the SDK
+ * is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown ChatCompletionContentPart: $json")
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartImage.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartImage.kt
index 897ee92..82d84c8 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartImage.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartImage.kt
@@ -65,6 +65,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionContentPartImage]. */
class Builder internal constructor() {
private var imageUrl: JsonField? = null
@@ -166,6 +167,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ImageUrl]. */
class Builder internal constructor() {
private var url: JsonField? = null
@@ -234,6 +236,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new members that the
+ * SDK is unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -247,19 +257,39 @@ private constructor(
@JvmStatic fun of(value: String) = Detail(JsonField.of(value))
}
+ /** An enum containing [Detail]'s known values. */
enum class Known {
AUTO,
LOW,
HIGH,
}
+ /**
+ * An enum containing [Detail]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Detail] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
AUTO,
LOW,
HIGH,
+ /**
+ * An enum member indicating that [Detail] was instantiated with an unknown value.
+ */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you
+ * want to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
AUTO -> Value.AUTO
@@ -268,6 +298,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
AUTO -> Known.AUTO
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartInputAudio.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartInputAudio.kt
index 543d767..2d953c3 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartInputAudio.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartInputAudio.kt
@@ -66,6 +66,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionContentPartInputAudio]. */
class Builder internal constructor() {
private var inputAudio: JsonField? = null
@@ -165,6 +166,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [InputAudio]. */
class Builder internal constructor() {
private var data: JsonField? = null
@@ -224,6 +226,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new members that the
+ * SDK is unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -235,17 +245,37 @@ private constructor(
@JvmStatic fun of(value: String) = Format(JsonField.of(value))
}
+ /** An enum containing [Format]'s known values. */
enum class Known {
WAV,
MP3,
}
+ /**
+ * An enum containing [Format]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Format] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
WAV,
MP3,
+ /**
+ * An enum member indicating that [Format] was instantiated with an unknown value.
+ */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you
+ * want to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
WAV -> Value.WAV
@@ -253,6 +283,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
WAV -> Known.WAV
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartRefusal.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartRefusal.kt
index 2ce2f1e..6ee691d 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartRefusal.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartRefusal.kt
@@ -64,6 +64,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionContentPartRefusal]. */
class Builder internal constructor() {
private var refusal: JsonField? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartText.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartText.kt
index 3521cfa..c7edced 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartText.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionContentPartText.kt
@@ -63,6 +63,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionContentPartText]. */
class Builder internal constructor() {
private var text: JsonField? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionCreateParams.kt
index 7fe1308..17818fc 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionCreateParams.kt
@@ -1248,6 +1248,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionCreateBody]. */
class Builder internal constructor() {
private var messages: JsonField>? = null
@@ -2436,6 +2437,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionCreateParams]. */
@NoAutoDetect
class Builder internal constructor() {
@@ -3677,6 +3679,10 @@ private constructor(
FunctionCall(functionCallOption = functionCallOption)
}
+ /**
+ * An interface that defines how to map each variant of [FunctionCall] to a value of type
+ * [T].
+ */
interface Visitor {
/**
@@ -3691,6 +3697,16 @@ private constructor(
*/
fun visitFunctionCallOption(functionCallOption: ChatCompletionFunctionCallOption): T
+ /**
+ * Maps an unknown variant of [FunctionCall] to a value of type [T].
+ *
+ * An instance of [FunctionCall] can contain an unknown variant if it was deserialized
+ * from data that doesn't match any known variant. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new variants that the SDK
+ * is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown FunctionCall: $json")
}
@@ -3742,6 +3758,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new members that the
+ * SDK is unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -3753,17 +3777,35 @@ private constructor(
@JvmStatic fun of(value: String) = Auto(JsonField.of(value))
}
+ /** An enum containing [Auto]'s known values. */
enum class Known {
NONE,
AUTO,
}
+ /**
+ * An enum containing [Auto]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Auto] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
NONE,
AUTO,
+ /** An enum member indicating that [Auto] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you
+ * want to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
NONE -> Value.NONE
@@ -3771,6 +3813,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
NONE -> Known.NONE
@@ -3886,6 +3937,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Function]. */
class Builder internal constructor() {
private var name: JsonField? = null
@@ -4033,6 +4085,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [LogitBias]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap = mutableMapOf()
@@ -4114,6 +4167,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap = mutableMapOf()
@@ -4275,6 +4329,10 @@ private constructor(
ResponseFormat(jsonSchema = jsonSchema)
}
+ /**
+ * An interface that defines how to map each variant of [ResponseFormat] to a value of type
+ * [T].
+ */
interface Visitor {
fun visitText(text: ResponseFormatText): T
@@ -4283,6 +4341,16 @@ private constructor(
fun visitJsonSchema(jsonSchema: ResponseFormatJsonSchema): T
+ /**
+ * Maps an unknown variant of [ResponseFormat] to a value of type [T].
+ *
+ * An instance of [ResponseFormat] can contain an unknown variant if it was deserialized
+ * from data that doesn't match any known variant. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new variants that the SDK
+ * is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown ResponseFormat: $json")
}
@@ -4345,6 +4413,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -4356,17 +4432,37 @@ private constructor(
@JvmStatic fun of(value: String) = ServiceTier(JsonField.of(value))
}
+ /** An enum containing [ServiceTier]'s known values. */
enum class Known {
AUTO,
DEFAULT,
}
+ /**
+ * An enum containing [ServiceTier]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [ServiceTier] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
AUTO,
DEFAULT,
+ /**
+ * An enum member indicating that [ServiceTier] was instantiated with an unknown value.
+ */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
AUTO -> Value.AUTO
@@ -4374,6 +4470,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
AUTO -> Known.AUTO
@@ -4470,12 +4575,22 @@ private constructor(
@JvmStatic fun ofStrings(strings: List) = Stop(strings = strings)
}
+ /** An interface that defines how to map each variant of [Stop] to a value of type [T]. */
interface Visitor {
fun visitString(string: String): T
fun visitStrings(strings: List): T
+ /**
+ * Maps an unknown variant of [Stop] to a value of type [T].
+ *
+ * An instance of [Stop] can contain an unknown variant if it was deserialized from data
+ * that doesn't match any known variant. For example, if the SDK is on an older version
+ * than the API, then the API may respond with new variants that the SDK is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Stop: $json")
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionDeveloperMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionDeveloperMessageParam.kt
index 10805c6..1f46451 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionDeveloperMessageParam.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionDeveloperMessageParam.kt
@@ -93,6 +93,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionDeveloperMessageParam]. */
class Builder internal constructor() {
private var content: JsonField? = null
@@ -267,6 +268,9 @@ private constructor(
Content(arrayOfContentParts = arrayOfContentParts)
}
+ /**
+ * An interface that defines how to map each variant of [Content] to a value of type [T].
+ */
interface Visitor {
/** The contents of the developer message. */
@@ -280,6 +284,16 @@ private constructor(
arrayOfContentParts: List
): T
+ /**
+ * Maps an unknown variant of [Content] to a value of type [T].
+ *
+ * An instance of [Content] can contain an unknown variant if it was deserialized from
+ * data that doesn't match any known variant. For example, if the SDK is on an older
+ * version than the API, then the API may respond with new variants that the SDK is
+ * unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Content: $json")
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionFunctionCallOption.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionFunctionCallOption.kt
index 6163f2a..29e9428 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionFunctionCallOption.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionFunctionCallOption.kt
@@ -56,6 +56,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionFunctionCallOption]. */
class Builder internal constructor() {
private var name: JsonField? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionFunctionMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionFunctionMessageParam.kt
index 227a364..16bfec7 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionFunctionMessageParam.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionFunctionMessageParam.kt
@@ -74,6 +74,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionFunctionMessageParam]. */
class Builder internal constructor() {
private var content: JsonField? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessage.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessage.kt
index 4039d8a..1edec00 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessage.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessage.kt
@@ -146,6 +146,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionMessage]. */
class Builder internal constructor() {
private var content: JsonField? = null
@@ -340,6 +341,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [FunctionCall]. */
class Builder internal constructor() {
private var arguments: JsonField? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessageParam.kt
index 4d91c7e..354958e 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessageParam.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessageParam.kt
@@ -205,6 +205,10 @@ private constructor(
ChatCompletionMessageParam(function = function)
}
+ /**
+ * An interface that defines how to map each variant of [ChatCompletionMessageParam] to a value
+ * of type [T].
+ */
interface Visitor {
/**
@@ -230,6 +234,16 @@ private constructor(
@Deprecated("deprecated") fun visitFunction(function: ChatCompletionFunctionMessageParam): T
+ /**
+ * Maps an unknown variant of [ChatCompletionMessageParam] to a value of type [T].
+ *
+ * An instance of [ChatCompletionMessageParam] can contain an unknown variant if it was
+ * deserialized from data that doesn't match any known variant. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new variants that the SDK
+ * is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown ChatCompletionMessageParam: $json")
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessageToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessageToolCall.kt
index 424ab0a..0903ceb 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessageToolCall.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionMessageToolCall.kt
@@ -72,6 +72,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionMessageToolCall]. */
class Builder internal constructor() {
private var id: JsonField? = null
@@ -190,6 +191,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Function]. */
class Builder internal constructor() {
private var arguments: JsonField? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionModality.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionModality.kt
index e4a9730..acc35bd 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionModality.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionModality.kt
@@ -13,6 +13,13 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't match
+ * any known member, and you want to know that value. For example, if the SDK is on an older
+ * version than the API, then the API may respond with new members that the SDK is unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -24,17 +31,38 @@ private constructor(
@JvmStatic fun of(value: String) = ChatCompletionModality(JsonField.of(value))
}
+ /** An enum containing [ChatCompletionModality]'s known values. */
enum class Known {
TEXT,
AUDIO,
}
+ /**
+ * An enum containing [ChatCompletionModality]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [ChatCompletionModality] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the SDK
+ * is on an older version than the API, then the API may respond with new members that the SDK
+ * is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
TEXT,
AUDIO,
+ /**
+ * An enum member indicating that [ChatCompletionModality] was instantiated with an unknown
+ * value.
+ */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if
+ * the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want to
+ * throw for the unknown case.
+ */
fun value(): Value =
when (this) {
TEXT -> Value.TEXT
@@ -42,6 +70,14 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't want
+ * to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known member.
+ */
fun known(): Known =
when (this) {
TEXT -> Known.TEXT
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionNamedToolChoice.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionNamedToolChoice.kt
index 68f9a36..b07dc3e 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionNamedToolChoice.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionNamedToolChoice.kt
@@ -63,6 +63,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionNamedToolChoice]. */
class Builder internal constructor() {
private var function: JsonField? = null
@@ -149,6 +150,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Function]. */
class Builder internal constructor() {
private var name: JsonField? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionPredictionContent.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionPredictionContent.kt
index 5fb5a1f..2547a53 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionPredictionContent.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionPredictionContent.kt
@@ -87,6 +87,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionPredictionContent]. */
class Builder internal constructor() {
private var content: JsonField? = null
@@ -273,6 +274,9 @@ private constructor(
Content(arrayOfContentParts = arrayOfContentParts)
}
+ /**
+ * An interface that defines how to map each variant of [Content] to a value of type [T].
+ */
interface Visitor {
/**
@@ -290,6 +294,16 @@ private constructor(
arrayOfContentParts: List
): T
+ /**
+ * Maps an unknown variant of [Content] to a value of type [T].
+ *
+ * An instance of [Content] can contain an unknown variant if it was deserialized from
+ * data that doesn't match any known variant. For example, if the SDK is on an older
+ * version than the API, then the API may respond with new variants that the SDK is
+ * unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Content: $json")
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionReasoningEffort.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionReasoningEffort.kt
index 6ad438e..d485fda 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionReasoningEffort.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionReasoningEffort.kt
@@ -21,6 +21,13 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't match
+ * any known member, and you want to know that value. For example, if the SDK is on an older
+ * version than the API, then the API may respond with new members that the SDK is unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -34,19 +41,42 @@ private constructor(
@JvmStatic fun of(value: String) = ChatCompletionReasoningEffort(JsonField.of(value))
}
+ /** An enum containing [ChatCompletionReasoningEffort]'s known values. */
enum class Known {
LOW,
MEDIUM,
HIGH,
}
+ /**
+ * An enum containing [ChatCompletionReasoningEffort]'s known values, as well as an [_UNKNOWN]
+ * member.
+ *
+ * An instance of [ChatCompletionReasoningEffort] can contain an unknown value in a couple of
+ * cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the SDK
+ * is on an older version than the API, then the API may respond with new members that the SDK
+ * is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
LOW,
MEDIUM,
HIGH,
+ /**
+ * An enum member indicating that [ChatCompletionReasoningEffort] was instantiated with an
+ * unknown value.
+ */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if
+ * the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want to
+ * throw for the unknown case.
+ */
fun value(): Value =
when (this) {
LOW -> Value.LOW
@@ -55,6 +85,14 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't want
+ * to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known member.
+ */
fun known(): Known =
when (this) {
LOW -> Known.LOW
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionRole.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionRole.kt
index c6e940b..b6be330 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionRole.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionRole.kt
@@ -14,6 +14,13 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't match
+ * any known member, and you want to know that value. For example, if the SDK is on an older
+ * version than the API, then the API may respond with new members that the SDK is unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -31,6 +38,7 @@ private constructor(
@JvmStatic fun of(value: String) = ChatCompletionRole(JsonField.of(value))
}
+ /** An enum containing [ChatCompletionRole]'s known values. */
enum class Known {
SYSTEM,
USER,
@@ -39,15 +47,35 @@ private constructor(
FUNCTION,
}
+ /**
+ * An enum containing [ChatCompletionRole]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [ChatCompletionRole] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the SDK
+ * is on an older version than the API, then the API may respond with new members that the SDK
+ * is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
SYSTEM,
USER,
ASSISTANT,
TOOL,
FUNCTION,
+ /**
+ * An enum member indicating that [ChatCompletionRole] was instantiated with an unknown
+ * value.
+ */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if
+ * the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want to
+ * throw for the unknown case.
+ */
fun value(): Value =
when (this) {
SYSTEM -> Value.SYSTEM
@@ -58,6 +86,14 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't want
+ * to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known member.
+ */
fun known(): Known =
when (this) {
SYSTEM -> Known.SYSTEM
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionStreamOptions.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionStreamOptions.kt
index 03ef344..13d3638 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionStreamOptions.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionStreamOptions.kt
@@ -68,6 +68,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionStreamOptions]. */
class Builder internal constructor() {
private var includeUsage: JsonField = JsonMissing.of()
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionSystemMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionSystemMessageParam.kt
index f5321bb..36012d0 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionSystemMessageParam.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionSystemMessageParam.kt
@@ -93,6 +93,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionSystemMessageParam]. */
class Builder internal constructor() {
private var content: JsonField? = null
@@ -266,6 +267,9 @@ private constructor(
Content(arrayOfContentParts = arrayOfContentParts)
}
+ /**
+ * An interface that defines how to map each variant of [Content] to a value of type [T].
+ */
interface Visitor {
/** The contents of the system message. */
@@ -279,6 +283,16 @@ private constructor(
arrayOfContentParts: List
): T
+ /**
+ * Maps an unknown variant of [Content] to a value of type [T].
+ *
+ * An instance of [Content] can contain an unknown variant if it was deserialized from
+ * data that doesn't match any known variant. For example, if the SDK is on an older
+ * version than the API, then the API may respond with new variants that the SDK is
+ * unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Content: $json")
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionTokenLogprob.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionTokenLogprob.kt
index 8bac1f0..87648b5 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionTokenLogprob.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionTokenLogprob.kt
@@ -107,6 +107,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionTokenLogprob]. */
class Builder internal constructor() {
private var token: JsonField? = null
@@ -322,6 +323,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [TopLogprob]. */
class Builder internal constructor() {
private var token: JsonField? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionTool.kt
index 66ab4fa..cdff8a4 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionTool.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionTool.kt
@@ -64,6 +64,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionTool]. */
class Builder internal constructor() {
private var function: JsonField? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolChoiceOption.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolChoiceOption.kt
index 4e39ea7..19bff6b 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolChoiceOption.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolChoiceOption.kt
@@ -134,6 +134,10 @@ private constructor(
ChatCompletionToolChoiceOption(namedToolChoice = namedToolChoice)
}
+ /**
+ * An interface that defines how to map each variant of [ChatCompletionToolChoiceOption] to a
+ * value of type [T].
+ */
interface Visitor {
/**
@@ -149,6 +153,16 @@ private constructor(
*/
fun visitNamedToolChoice(namedToolChoice: ChatCompletionNamedToolChoice): T
+ /**
+ * Maps an unknown variant of [ChatCompletionToolChoiceOption] to a value of type [T].
+ *
+ * An instance of [ChatCompletionToolChoiceOption] can contain an unknown variant if it was
+ * deserialized from data that doesn't match any known variant. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new variants that the SDK
+ * is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown ChatCompletionToolChoiceOption: $json")
}
@@ -200,6 +214,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -213,19 +235,37 @@ private constructor(
@JvmStatic fun of(value: String) = Auto(JsonField.of(value))
}
+ /** An enum containing [Auto]'s known values. */
enum class Known {
NONE,
AUTO,
REQUIRED,
}
+ /**
+ * An enum containing [Auto]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Auto] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
NONE,
AUTO,
REQUIRED,
+ /** An enum member indicating that [Auto] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
NONE -> Value.NONE
@@ -234,6 +274,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
NONE -> Known.NONE
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolMessageParam.kt
index 72b31f6..ea7a697 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolMessageParam.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionToolMessageParam.kt
@@ -85,6 +85,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionToolMessageParam]. */
class Builder internal constructor() {
private var content: JsonField? = null
@@ -251,6 +252,9 @@ private constructor(
Content(arrayOfContentParts = arrayOfContentParts)
}
+ /**
+ * An interface that defines how to map each variant of [Content] to a value of type [T].
+ */
interface Visitor {
/** The contents of the tool message. */
@@ -264,6 +268,16 @@ private constructor(
arrayOfContentParts: List
): T
+ /**
+ * Maps an unknown variant of [Content] to a value of type [T].
+ *
+ * An instance of [Content] can contain an unknown variant if it was deserialized from
+ * data that doesn't match any known variant. For example, if the SDK is on an older
+ * version than the API, then the API may respond with new variants that the SDK is
+ * unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Content: $json")
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionUserMessageParam.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionUserMessageParam.kt
index 9c51b14..9bb79dd 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionUserMessageParam.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionUserMessageParam.kt
@@ -90,6 +90,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ChatCompletionUserMessageParam]. */
class Builder internal constructor() {
private var content: JsonField? = null
@@ -266,6 +267,9 @@ private constructor(
Content(arrayOfContentParts = arrayOfContentParts)
}
+ /**
+ * An interface that defines how to map each variant of [Content] to a value of type [T].
+ */
interface Visitor {
/** The text contents of the message. */
@@ -278,6 +282,16 @@ private constructor(
*/
fun visitArrayOfContentParts(arrayOfContentParts: List): T
+ /**
+ * Maps an unknown variant of [Content] to a value of type [T].
+ *
+ * An instance of [Content] can contain an unknown variant if it was deserialized from
+ * data that doesn't match any known variant. For example, if the SDK is on an older
+ * version than the API, then the API may respond with new variants that the SDK is
+ * unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Content: $json")
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/ChatModel.kt b/openai-java-core/src/main/kotlin/com/openai/models/ChatModel.kt
index dfd10ca..441ff07 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/ChatModel.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/ChatModel.kt
@@ -13,6 +13,13 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't match
+ * any known member, and you want to know that value. For example, if the SDK is on an older
+ * version than the API, then the API may respond with new members that the SDK is unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -95,6 +102,7 @@ private constructor(
@JvmStatic fun of(value: String) = ChatModel(JsonField.of(value))
}
+ /** An enum containing [ChatModel]'s known values. */
enum class Known {
O1,
O1_2024_12_17,
@@ -135,6 +143,15 @@ private constructor(
GPT_3_5_TURBO_16K_0613,
}
+ /**
+ * An enum containing [ChatModel]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [ChatModel] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the SDK
+ * is on an older version than the API, then the API may respond with new members that the SDK
+ * is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
O1,
O1_2024_12_17,
@@ -173,9 +190,17 @@ private constructor(
GPT_3_5_TURBO_1106,
GPT_3_5_TURBO_0125,
GPT_3_5_TURBO_16K_0613,
+ /** An enum member indicating that [ChatModel] was instantiated with an unknown value. */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if
+ * the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want to
+ * throw for the unknown case.
+ */
fun value(): Value =
when (this) {
O1 -> Value.O1
@@ -218,6 +243,14 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't want
+ * to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known member.
+ */
fun known(): Known =
when (this) {
O1 -> Known.O1
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterLogs.kt b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterLogs.kt
index 44a9ed3..3617a1f 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterLogs.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterLogs.kt
@@ -72,6 +72,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [CodeInterpreterLogs]. */
class Builder internal constructor() {
private var index: JsonField? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterOutputImage.kt b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterOutputImage.kt
index 1e170d8..2a97ae2 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterOutputImage.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterOutputImage.kt
@@ -69,6 +69,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [CodeInterpreterOutputImage]. */
class Builder internal constructor() {
private var index: JsonField? = null
@@ -164,6 +165,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Image]. */
class Builder internal constructor() {
private var fileId: JsonField = JsonMissing.of()
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterTool.kt b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterTool.kt
index 8469231..b02bafc 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterTool.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterTool.kt
@@ -52,6 +52,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [CodeInterpreterTool]. */
class Builder internal constructor() {
private var type: JsonValue = JsonValue.from("code_interpreter")
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCall.kt
index 4cd2cf6..f0a1d30 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCall.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCall.kt
@@ -90,6 +90,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [CodeInterpreterToolCall]. */
class Builder internal constructor() {
private var id: JsonField? = null
@@ -212,6 +213,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [CodeInterpreter]. */
class Builder internal constructor() {
private var input: JsonField? = null
@@ -383,6 +385,9 @@ private constructor(
@JvmStatic fun ofImage(image: ImageOutput) = Output(image = image)
}
+ /**
+ * An interface that defines how to map each variant of [Output] to a value of type [T].
+ */
interface Visitor {
/** Text output from the Code Interpreter tool call as part of a run step. */
@@ -390,6 +395,16 @@ private constructor(
fun visitImage(image: ImageOutput): T
+ /**
+ * Maps an unknown variant of [Output] to a value of type [T].
+ *
+ * An instance of [Output] can contain an unknown variant if it was deserialized
+ * from data that doesn't match any known variant. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new variants that the
+ * SDK is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Output: $json")
}
@@ -487,6 +502,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [LogsOutput]. */
class Builder internal constructor() {
private var logs: JsonField? = null
@@ -605,6 +621,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [ImageOutput]. */
class Builder internal constructor() {
private var image: JsonField? = null
@@ -702,6 +719,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Image]. */
class Builder internal constructor() {
private var fileId: JsonField? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCallDelta.kt b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCallDelta.kt
index d5f77b9..01d874a 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCallDelta.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/CodeInterpreterToolCallDelta.kt
@@ -99,6 +99,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [CodeInterpreterToolCallDelta]. */
class Builder internal constructor() {
private var index: JsonField? = null
@@ -230,6 +231,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [CodeInterpreter]. */
class Builder internal constructor() {
private var input: JsonField = JsonMissing.of()
@@ -401,6 +403,9 @@ private constructor(
@JvmStatic fun ofImage(image: CodeInterpreterOutputImage) = Output(image = image)
}
+ /**
+ * An interface that defines how to map each variant of [Output] to a value of type [T].
+ */
interface Visitor {
/** Text output from the Code Interpreter tool call as part of a run step. */
@@ -408,6 +413,16 @@ private constructor(
fun visitImage(image: CodeInterpreterOutputImage): T
+ /**
+ * Maps an unknown variant of [Output] to a value of type [T].
+ *
+ * An instance of [Output] can contain an unknown variant if it was deserialized
+ * from data that doesn't match any known variant. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new variants that the
+ * SDK is unaware of.
+ *
+ * @throws OpenAIInvalidDataException in the default implementation.
+ */
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Output: $json")
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/Completion.kt b/openai-java-core/src/main/kotlin/com/openai/models/Completion.kt
index a48e098..0e9db01 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/Completion.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/Completion.kt
@@ -130,6 +130,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Completion]. */
class Builder internal constructor() {
private var id: JsonField? = null
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CompletionChoice.kt b/openai-java-core/src/main/kotlin/com/openai/models/CompletionChoice.kt
index 2632440..e2f0ff7 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/CompletionChoice.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/CompletionChoice.kt
@@ -89,6 +89,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [CompletionChoice]. */
class Builder internal constructor() {
private var finishReason: JsonField? = null
@@ -179,6 +180,14 @@ private constructor(
private val value: JsonField,
) : Enum {
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
companion object {
@@ -192,19 +201,39 @@ private constructor(
@JvmStatic fun of(value: String) = FinishReason(JsonField.of(value))
}
+ /** An enum containing [FinishReason]'s known values. */
enum class Known {
STOP,
LENGTH,
CONTENT_FILTER,
}
+ /**
+ * An enum containing [FinishReason]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [FinishReason] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
enum class Value {
STOP,
LENGTH,
CONTENT_FILTER,
+ /**
+ * An enum member indicating that [FinishReason] was instantiated with an unknown value.
+ */
_UNKNOWN,
}
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
fun value(): Value =
when (this) {
STOP -> Value.STOP
@@ -213,6 +242,15 @@ private constructor(
else -> Value._UNKNOWN
}
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws OpenAIInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
fun known(): Known =
when (this) {
STOP -> Known.STOP
@@ -306,6 +344,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [Logprobs]. */
class Builder internal constructor() {
private var textOffset: JsonField>? = null
@@ -458,6 +497,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [TopLogprob]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap = mutableMapOf()
diff --git a/openai-java-core/src/main/kotlin/com/openai/models/CompletionCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/CompletionCreateParams.kt
index 3566752..dea43a8 100644
--- a/openai-java-core/src/main/kotlin/com/openai/models/CompletionCreateParams.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/models/CompletionCreateParams.kt
@@ -741,6 +741,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
+ /** A builder for [CompletionCreateBody]. */
class Builder internal constructor() {
private var model: JsonField