diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index d52d2b974..a26ebfc1e 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.13.0"
+ ".": "0.14.0"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 18b0707b6..88dd14573 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,33 @@
# Changelog
+## 0.14.0 (2025-01-24)
+
+Full Changelog: [v0.13.0...v0.14.0](https://github.com/openai/openai-java/compare/v0.13.0...v0.14.0)
+
+### ⚠ BREAKING CHANGES
+
+* **client:** better union variant method and variable names ([#157](https://github.com/openai/openai-java/issues/157))
+
+### Features
+
+* **client:** better union variant method and variable names ([#157](https://github.com/openai/openai-java/issues/157)) ([da5bce5](https://github.com/openai/openai-java/commit/da5bce5d00af53d7297133af09352a7176c2f83e))
+
+
+### Bug Fixes
+
+* examples ([3473781](https://github.com/openai/openai-java/commit/3473781ca26d25531f368485291f9972e600631b))
+
+
+### Chores
+
+* **internal:** swap `checkNotNull` to `checkRequired` ([#156](https://github.com/openai/openai-java/issues/156)) ([d6f65f7](https://github.com/openai/openai-java/commit/d6f65f7c0e25adbce97b22f7a649f6c3eaeb61ed))
+
+
+### Documentation
+
+* move up requirements section ([#154](https://github.com/openai/openai-java/issues/154)) ([48fc646](https://github.com/openai/openai-java/commit/48fc646957ad4ff69c93b40d59ea9d5e8a22eece))
+* update readme ([#152](https://github.com/openai/openai-java/issues/152)) ([293dc47](https://github.com/openai/openai-java/commit/293dc47b242e204b6c6e419002dbb560cb455169))
+
## 0.13.0 (2025-01-22)
Full Changelog: [v0.12.0...v0.13.0](https://github.com/openai/openai-java/compare/v0.12.0...v0.13.0)
diff --git a/README.md b/README.md
index 0a0be5921..56426634b 100644
--- a/README.md
+++ b/README.md
@@ -9,43 +9,43 @@
-[](https://central.sonatype.com/artifact/com.openai/openai-java/0.13.0)
-[](https://javadoc.io/doc/com.openai/openai-java/0.13.0)
+[](https://central.sonatype.com/artifact/com.openai/openai-java/0.14.0)
+[](https://javadoc.io/doc/com.openai/openai-java/0.14.0)
-The OpenAI Java SDK provides convenient access to the OpenAI REST API from applications written in Java. It includes helper classes with helpful types and documentation for every request and response property.
+The OpenAI Java SDK provides convenient access to the OpenAI REST API from applications written in Java.
-## Documentation
+The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs). Javadocs are also available on [javadoc.io](https://javadoc.io/doc/com.openai/openai-java/0.0.1).
-The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs).
-
----
-
-## Getting started
-
-### Install dependencies
-
-#### Gradle
+## Installation
+### Gradle
+
```kotlin
-implementation("com.openai:openai-java:0.13.0")
+implementation("com.openai:openai-java:0.14.0")
```
-#### Maven
+### Maven
```xml
com.openai
openai-java
- 0.13.0
+ 0.14.0
```
+## Requirements
+
+This library requires Java 8 or later.
+
+## Usage
+
### Configure the client
Use `OpenAIOkHttpClient.builder()` to configure the client. At a minimum you need to set `.apiKey()`:
@@ -418,7 +418,3 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
We are keen for your feedback; please open an [issue](https://www.github.com/openai/openai-java/issues) with questions, bugs, or suggestions.
-
-## Requirements
-
-This library requires Java 8 or later.
diff --git a/build.gradle.kts b/build.gradle.kts
index 787da4cab..49d6ac4ba 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.openai"
- version = "0.13.0" // x-release-please-version
+ version = "0.14.0" // x-release-please-version
}
subprojects {
diff --git a/openai-azure-java-example/src/main/java/com.openai.azure.examples/AzureApiKeyExample.java b/openai-azure-java-example/src/main/java/com.openai.azure.examples/AzureApiKeyExample.java
index 962d69fb6..5ebe02832 100644
--- a/openai-azure-java-example/src/main/java/com.openai.azure.examples/AzureApiKeyExample.java
+++ b/openai-azure-java-example/src/main/java/com.openai.azure.examples/AzureApiKeyExample.java
@@ -31,10 +31,10 @@ public static void main(String[] args) {
OpenAIClient client = clientBuilder.build();
ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
- .addMessage(ChatCompletionMessageParam.ofChatCompletionUserMessageParam(
+ .addMessage(
ChatCompletionUserMessageParam.builder()
- .content(ChatCompletionUserMessageParam.Content.ofTextContent("Who won the world series in 2020?"))
- .build()))
+ .content("Who won the world series in 2020?")
+ .build())
.model("gpt-4o")
.build();
diff --git a/openai-azure-java-example/src/main/java/com.openai.azure.examples/AzureApiKeyExampleAsync.java b/openai-azure-java-example/src/main/java/com.openai.azure.examples/AzureApiKeyExampleAsync.java
index 1ab865906..c567697ef 100644
--- a/openai-azure-java-example/src/main/java/com.openai.azure.examples/AzureApiKeyExampleAsync.java
+++ b/openai-azure-java-example/src/main/java/com.openai.azure.examples/AzureApiKeyExampleAsync.java
@@ -32,10 +32,10 @@ public static void main(String[] args) {
OpenAIClientAsync client = asyncClientBuilder.build();
ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
- .addMessage(ChatCompletionMessageParam.ofChatCompletionUserMessageParam(
+ .addMessage(
ChatCompletionUserMessageParam.builder()
- .content(ChatCompletionUserMessageParam.Content.ofTextContent("Who won the world series in 2020?"))
- .build()))
+ .content("Who won the world series in 2020?")
+ .build())
.model("gpt-4o")
.build();
diff --git a/openai-azure-java-example/src/main/java/com.openai.azure.examples/AzureEntraIDExample.java b/openai-azure-java-example/src/main/java/com.openai.azure.examples/AzureEntraIDExample.java
index e27ecdd46..a7cc2cfad 100644
--- a/openai-azure-java-example/src/main/java/com.openai.azure.examples/AzureEntraIDExample.java
+++ b/openai-azure-java-example/src/main/java/com.openai.azure.examples/AzureEntraIDExample.java
@@ -37,10 +37,10 @@ public static void main(String[] args) {
OpenAIClient client = clientBuilder.build();
ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
- .addMessage(ChatCompletionMessageParam.ofChatCompletionUserMessageParam(
+ .addMessage(
ChatCompletionUserMessageParam.builder()
- .content(ChatCompletionUserMessageParam.Content.ofTextContent("Who won the world series in 2020?"))
- .build()))
+ .content("Who won the world series in 2020?")
+ .build())
.model("gpt-4o")
.build();
diff --git a/openai-azure-java-example/src/main/java/com.openai.azure.examples/AzureEntraIDExampleAsync.java b/openai-azure-java-example/src/main/java/com.openai.azure.examples/AzureEntraIDExampleAsync.java
index e526bdc9c..b557e2337 100644
--- a/openai-azure-java-example/src/main/java/com.openai.azure.examples/AzureEntraIDExampleAsync.java
+++ b/openai-azure-java-example/src/main/java/com.openai.azure.examples/AzureEntraIDExampleAsync.java
@@ -37,10 +37,10 @@ public static void main(String[] args) {
OpenAIClientAsync asyncClient = asyncClientBuilder.build();
ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
- .addMessage(ChatCompletionMessageParam.ofChatCompletionUserMessageParam(
+ .addMessage(
ChatCompletionUserMessageParam.builder()
- .content(ChatCompletionUserMessageParam.Content.ofTextContent("Who won the world series in 2020?"))
- .build()))
+ .content("Who won the world series in 2020?")
+ .build())
.model("gpt-4o")
.build();
diff --git a/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OkHttpClient.kt b/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OkHttpClient.kt
index 8862168e1..01fe5e8a6 100644
--- a/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OkHttpClient.kt
+++ b/openai-java-client-okhttp/src/main/kotlin/com/openai/client/okhttp/OkHttpClient.kt
@@ -1,6 +1,7 @@
package com.openai.client.okhttp
import com.openai.core.RequestOptions
+import com.openai.core.checkRequired
import com.openai.core.http.Headers
import com.openai.core.http.HttpClient
import com.openai.core.http.HttpMethod
@@ -192,7 +193,7 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
.callTimeout(if (timeout.seconds == 0L) timeout else timeout.plusSeconds(30))
.proxy(proxy)
.build(),
- checkNotNull(baseUrl) { "`baseUrl` is required but was not set" },
+ checkRequired("baseUrl", baseUrl),
)
}
}
diff --git a/openai-java-core/src/main/kotlin/com/openai/core/Check.kt b/openai-java-core/src/main/kotlin/com/openai/core/Check.kt
index 6c9f5e18b..1ff8c724b 100644
--- a/openai-java-core/src/main/kotlin/com/openai/core/Check.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/core/Check.kt
@@ -2,8 +2,7 @@
package com.openai.core
-@JvmSynthetic
-internal fun checkRequired(name: String, value: T?): T =
+fun checkRequired(name: String, value: T?): T =
checkNotNull(value) { "`$name` is required, but was not set" }
@JvmSynthetic
diff --git a/openai-java-core/src/main/kotlin/com/openai/core/http/HttpRequest.kt b/openai-java-core/src/main/kotlin/com/openai/core/http/HttpRequest.kt
index f83460af0..2bafe1107 100644
--- a/openai-java-core/src/main/kotlin/com/openai/core/http/HttpRequest.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/core/http/HttpRequest.kt
@@ -1,5 +1,6 @@
package com.openai.core.http
+import com.openai.core.checkRequired
import com.openai.core.toImmutable
class HttpRequest
@@ -134,7 +135,7 @@ private constructor(
fun build(): HttpRequest =
HttpRequest(
- checkNotNull(method) { "`method` is required but was not set" },
+ checkRequired("method", method),
url,
pathSegments.toImmutable(),
headers.build(),
diff --git a/openai-java-core/src/main/kotlin/com/openai/core/http/RetryingHttpClient.kt b/openai-java-core/src/main/kotlin/com/openai/core/http/RetryingHttpClient.kt
index 5402fd52b..a20fd1a56 100644
--- a/openai-java-core/src/main/kotlin/com/openai/core/http/RetryingHttpClient.kt
+++ b/openai-java-core/src/main/kotlin/com/openai/core/http/RetryingHttpClient.kt
@@ -1,6 +1,7 @@
package com.openai.core.http
import com.openai.core.RequestOptions
+import com.openai.core.checkRequired
import com.openai.errors.OpenAIIoException
import java.io.IOException
import java.time.Clock
@@ -259,7 +260,7 @@ private constructor(
fun build(): HttpClient =
RetryingHttpClient(
- checkNotNull(httpClient) { "`httpClient` is required but was not set" },
+ checkRequired("httpClient", httpClient),
clock,
maxRetries,
idempotencyHeader,
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 c88dd472d..ad46efd1f 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
@@ -27,8 +27,8 @@ import kotlin.jvm.optionals.getOrNull
@JsonSerialize(using = Annotation.Serializer::class)
class Annotation
private constructor(
- private val fileCitationAnnotation: FileCitationAnnotation? = null,
- private val filePathAnnotation: FilePathAnnotation? = null,
+ private val fileCitation: FileCitationAnnotation? = null,
+ private val filePath: FilePathAnnotation? = null,
private val _json: JsonValue? = null,
) {
@@ -37,41 +37,37 @@ private constructor(
* with the assistant or the message. Generated when the assistant uses the "file_search" tool
* to search files.
*/
- fun fileCitationAnnotation(): Optional =
- Optional.ofNullable(fileCitationAnnotation)
+ fun fileCitation(): Optional = Optional.ofNullable(fileCitation)
/**
* A URL for the file that's generated when the assistant used the `code_interpreter` tool to
* generate a file.
*/
- fun filePathAnnotation(): Optional = Optional.ofNullable(filePathAnnotation)
+ fun filePath(): Optional = Optional.ofNullable(filePath)
- fun isFileCitationAnnotation(): Boolean = fileCitationAnnotation != null
+ fun isFileCitation(): Boolean = fileCitation != null
- fun isFilePathAnnotation(): Boolean = filePathAnnotation != null
+ fun isFilePath(): Boolean = filePath != null
/**
* A citation within the message that points to a specific quote from a specific File associated
* with the assistant or the message. Generated when the assistant uses the "file_search" tool
* to search files.
*/
- fun asFileCitationAnnotation(): FileCitationAnnotation =
- fileCitationAnnotation.getOrThrow("fileCitationAnnotation")
+ fun asFileCitation(): FileCitationAnnotation = fileCitation.getOrThrow("fileCitation")
/**
* A URL for the file that's generated when the assistant used the `code_interpreter` tool to
* generate a file.
*/
- fun asFilePathAnnotation(): FilePathAnnotation =
- filePathAnnotation.getOrThrow("filePathAnnotation")
+ fun asFilePath(): FilePathAnnotation = filePath.getOrThrow("filePath")
fun _json(): Optional = Optional.ofNullable(_json)
fun accept(visitor: Visitor): T {
return when {
- fileCitationAnnotation != null ->
- visitor.visitFileCitationAnnotation(fileCitationAnnotation)
- filePathAnnotation != null -> visitor.visitFilePathAnnotation(filePathAnnotation)
+ fileCitation != null -> visitor.visitFileCitation(fileCitation)
+ filePath != null -> visitor.visitFilePath(filePath)
else -> visitor.unknown(_json)
}
}
@@ -85,14 +81,12 @@ private constructor(
accept(
object : Visitor {
- override fun visitFileCitationAnnotation(
- fileCitationAnnotation: FileCitationAnnotation
- ) {
- fileCitationAnnotation.validate()
+ override fun visitFileCitation(fileCitation: FileCitationAnnotation) {
+ fileCitation.validate()
}
- override fun visitFilePathAnnotation(filePathAnnotation: FilePathAnnotation) {
- filePathAnnotation.validate()
+ override fun visitFilePath(filePath: FilePathAnnotation) {
+ filePath.validate()
}
}
)
@@ -104,16 +98,15 @@ private constructor(
return true
}
- return /* spotless:off */ other is Annotation && fileCitationAnnotation == other.fileCitationAnnotation && filePathAnnotation == other.filePathAnnotation /* spotless:on */
+ return /* spotless:off */ other is Annotation && fileCitation == other.fileCitation && filePath == other.filePath /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(fileCitationAnnotation, filePathAnnotation) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(fileCitation, filePath) /* spotless:on */
override fun toString(): String =
when {
- fileCitationAnnotation != null ->
- "Annotation{fileCitationAnnotation=$fileCitationAnnotation}"
- filePathAnnotation != null -> "Annotation{filePathAnnotation=$filePathAnnotation}"
+ fileCitation != null -> "Annotation{fileCitation=$fileCitation}"
+ filePath != null -> "Annotation{filePath=$filePath}"
_json != null -> "Annotation{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Annotation")
}
@@ -126,16 +119,14 @@ private constructor(
* "file_search" tool to search files.
*/
@JvmStatic
- fun ofFileCitationAnnotation(fileCitationAnnotation: FileCitationAnnotation) =
- Annotation(fileCitationAnnotation = fileCitationAnnotation)
+ fun ofFileCitation(fileCitation: FileCitationAnnotation) =
+ Annotation(fileCitation = fileCitation)
/**
* A URL for the file that's generated when the assistant used the `code_interpreter` tool
* to generate a file.
*/
- @JvmStatic
- fun ofFilePathAnnotation(filePathAnnotation: FilePathAnnotation) =
- Annotation(filePathAnnotation = filePathAnnotation)
+ @JvmStatic fun ofFilePath(filePath: FilePathAnnotation) = Annotation(filePath = filePath)
}
interface Visitor {
@@ -145,13 +136,13 @@ private constructor(
* associated with the assistant or the message. Generated when the assistant uses the
* "file_search" tool to search files.
*/
- fun visitFileCitationAnnotation(fileCitationAnnotation: FileCitationAnnotation): T
+ fun visitFileCitation(fileCitation: FileCitationAnnotation): T
/**
* A URL for the file that's generated when the assistant used the `code_interpreter` tool
* to generate a file.
*/
- fun visitFilePathAnnotation(filePathAnnotation: FilePathAnnotation): T
+ fun visitFilePath(filePath: FilePathAnnotation): T
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Annotation: $json")
@@ -168,13 +159,13 @@ private constructor(
"file_citation" -> {
tryDeserialize(node, jacksonTypeRef()) { it.validate() }
?.let {
- return Annotation(fileCitationAnnotation = it, _json = json)
+ return Annotation(fileCitation = it, _json = json)
}
}
"file_path" -> {
tryDeserialize(node, jacksonTypeRef()) { it.validate() }
?.let {
- return Annotation(filePathAnnotation = it, _json = json)
+ return Annotation(filePath = it, _json = json)
}
}
}
@@ -191,9 +182,8 @@ private constructor(
provider: SerializerProvider
) {
when {
- value.fileCitationAnnotation != null ->
- generator.writeObject(value.fileCitationAnnotation)
- value.filePathAnnotation != null -> generator.writeObject(value.filePathAnnotation)
+ value.fileCitation != null -> generator.writeObject(value.fileCitation)
+ value.filePath != null -> generator.writeObject(value.filePath)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Annotation")
}
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 76bfbfadd..43367d2ee 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
@@ -27,8 +27,8 @@ import kotlin.jvm.optionals.getOrNull
@JsonSerialize(using = AnnotationDelta.Serializer::class)
class AnnotationDelta
private constructor(
- private val fileCitationDeltaAnnotation: FileCitationDeltaAnnotation? = null,
- private val filePathDeltaAnnotation: FilePathDeltaAnnotation? = null,
+ private val fileCitation: FileCitationDeltaAnnotation? = null,
+ private val filePath: FilePathDeltaAnnotation? = null,
private val _json: JsonValue? = null,
) {
@@ -37,43 +37,37 @@ private constructor(
* with the assistant or the message. Generated when the assistant uses the "file_search" tool
* to search files.
*/
- fun fileCitationDeltaAnnotation(): Optional =
- Optional.ofNullable(fileCitationDeltaAnnotation)
+ fun fileCitation(): Optional = Optional.ofNullable(fileCitation)
/**
* A URL for the file that's generated when the assistant used the `code_interpreter` tool to
* generate a file.
*/
- fun filePathDeltaAnnotation(): Optional =
- Optional.ofNullable(filePathDeltaAnnotation)
+ fun filePath(): Optional = Optional.ofNullable(filePath)
- fun isFileCitationDeltaAnnotation(): Boolean = fileCitationDeltaAnnotation != null
+ fun isFileCitation(): Boolean = fileCitation != null
- fun isFilePathDeltaAnnotation(): Boolean = filePathDeltaAnnotation != null
+ fun isFilePath(): Boolean = filePath != null
/**
* A citation within the message that points to a specific quote from a specific File associated
* with the assistant or the message. Generated when the assistant uses the "file_search" tool
* to search files.
*/
- fun asFileCitationDeltaAnnotation(): FileCitationDeltaAnnotation =
- fileCitationDeltaAnnotation.getOrThrow("fileCitationDeltaAnnotation")
+ fun asFileCitation(): FileCitationDeltaAnnotation = fileCitation.getOrThrow("fileCitation")
/**
* A URL for the file that's generated when the assistant used the `code_interpreter` tool to
* generate a file.
*/
- fun asFilePathDeltaAnnotation(): FilePathDeltaAnnotation =
- filePathDeltaAnnotation.getOrThrow("filePathDeltaAnnotation")
+ fun asFilePath(): FilePathDeltaAnnotation = filePath.getOrThrow("filePath")
fun _json(): Optional = Optional.ofNullable(_json)
fun accept(visitor: Visitor): T {
return when {
- fileCitationDeltaAnnotation != null ->
- visitor.visitFileCitationDeltaAnnotation(fileCitationDeltaAnnotation)
- filePathDeltaAnnotation != null ->
- visitor.visitFilePathDeltaAnnotation(filePathDeltaAnnotation)
+ fileCitation != null -> visitor.visitFileCitation(fileCitation)
+ filePath != null -> visitor.visitFilePath(filePath)
else -> visitor.unknown(_json)
}
}
@@ -87,16 +81,12 @@ private constructor(
accept(
object : Visitor {
- override fun visitFileCitationDeltaAnnotation(
- fileCitationDeltaAnnotation: FileCitationDeltaAnnotation
- ) {
- fileCitationDeltaAnnotation.validate()
+ override fun visitFileCitation(fileCitation: FileCitationDeltaAnnotation) {
+ fileCitation.validate()
}
- override fun visitFilePathDeltaAnnotation(
- filePathDeltaAnnotation: FilePathDeltaAnnotation
- ) {
- filePathDeltaAnnotation.validate()
+ override fun visitFilePath(filePath: FilePathDeltaAnnotation) {
+ filePath.validate()
}
}
)
@@ -108,17 +98,15 @@ private constructor(
return true
}
- return /* spotless:off */ other is AnnotationDelta && fileCitationDeltaAnnotation == other.fileCitationDeltaAnnotation && filePathDeltaAnnotation == other.filePathDeltaAnnotation /* spotless:on */
+ return /* spotless:off */ other is AnnotationDelta && fileCitation == other.fileCitation && filePath == other.filePath /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(fileCitationDeltaAnnotation, filePathDeltaAnnotation) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(fileCitation, filePath) /* spotless:on */
override fun toString(): String =
when {
- fileCitationDeltaAnnotation != null ->
- "AnnotationDelta{fileCitationDeltaAnnotation=$fileCitationDeltaAnnotation}"
- filePathDeltaAnnotation != null ->
- "AnnotationDelta{filePathDeltaAnnotation=$filePathDeltaAnnotation}"
+ fileCitation != null -> "AnnotationDelta{fileCitation=$fileCitation}"
+ filePath != null -> "AnnotationDelta{filePath=$filePath}"
_json != null -> "AnnotationDelta{_unknown=$_json}"
else -> throw IllegalStateException("Invalid AnnotationDelta")
}
@@ -131,17 +119,15 @@ private constructor(
* "file_search" tool to search files.
*/
@JvmStatic
- fun ofFileCitationDeltaAnnotation(
- fileCitationDeltaAnnotation: FileCitationDeltaAnnotation
- ) = AnnotationDelta(fileCitationDeltaAnnotation = fileCitationDeltaAnnotation)
+ fun ofFileCitation(fileCitation: FileCitationDeltaAnnotation) =
+ AnnotationDelta(fileCitation = fileCitation)
/**
* A URL for the file that's generated when the assistant used the `code_interpreter` tool
* to generate a file.
*/
@JvmStatic
- fun ofFilePathDeltaAnnotation(filePathDeltaAnnotation: FilePathDeltaAnnotation) =
- AnnotationDelta(filePathDeltaAnnotation = filePathDeltaAnnotation)
+ fun ofFilePath(filePath: FilePathDeltaAnnotation) = AnnotationDelta(filePath = filePath)
}
interface Visitor {
@@ -151,15 +137,13 @@ private constructor(
* associated with the assistant or the message. Generated when the assistant uses the
* "file_search" tool to search files.
*/
- fun visitFileCitationDeltaAnnotation(
- fileCitationDeltaAnnotation: FileCitationDeltaAnnotation
- ): T
+ fun visitFileCitation(fileCitation: FileCitationDeltaAnnotation): T
/**
* A URL for the file that's generated when the assistant used the `code_interpreter` tool
* to generate a file.
*/
- fun visitFilePathDeltaAnnotation(filePathDeltaAnnotation: FilePathDeltaAnnotation): T
+ fun visitFilePath(filePath: FilePathDeltaAnnotation): T
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown AnnotationDelta: $json")
@@ -178,7 +162,7 @@ private constructor(
it.validate()
}
?.let {
- return AnnotationDelta(fileCitationDeltaAnnotation = it, _json = json)
+ return AnnotationDelta(fileCitation = it, _json = json)
}
}
"file_path" -> {
@@ -186,7 +170,7 @@ private constructor(
it.validate()
}
?.let {
- return AnnotationDelta(filePathDeltaAnnotation = it, _json = json)
+ return AnnotationDelta(filePath = it, _json = json)
}
}
}
@@ -203,10 +187,8 @@ private constructor(
provider: SerializerProvider
) {
when {
- value.fileCitationDeltaAnnotation != null ->
- generator.writeObject(value.fileCitationDeltaAnnotation)
- value.filePathDeltaAnnotation != null ->
- generator.writeObject(value.filePathDeltaAnnotation)
+ value.fileCitation != null -> generator.writeObject(value.fileCitation)
+ value.filePath != null -> generator.writeObject(value.filePath)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid AnnotationDelta")
}
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 86e9b7bef..2107903cc 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
@@ -407,22 +407,20 @@ private constructor(
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
- fun addTool(codeInterpreterTool: CodeInterpreterTool) =
- addTool(AssistantTool.ofCodeInterpreterTool(codeInterpreterTool))
+ fun addTool(codeInterpreter: CodeInterpreterTool) =
+ addTool(AssistantTool.ofCodeInterpreter(codeInterpreter))
/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
- fun addTool(fileSearchTool: FileSearchTool) =
- addTool(AssistantTool.ofFileSearchTool(fileSearchTool))
+ fun addTool(fileSearch: FileSearchTool) = addTool(AssistantTool.ofFileSearch(fileSearch))
/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
- fun addTool(functionTool: FunctionTool) =
- addTool(AssistantTool.ofFunctionTool(functionTool))
+ fun addTool(function: FunctionTool) = addTool(AssistantTool.ofFunction(function))
/**
* Specifies the format that the model must output. Compatible with
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 0a9b6aa7b..ee54f771c 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
@@ -22,39 +22,37 @@ import kotlin.jvm.optionals.getOrNull
@JsonSerialize(using = AssistantTool.Serializer::class)
class AssistantTool
private constructor(
- private val codeInterpreterTool: CodeInterpreterTool? = null,
- private val fileSearchTool: FileSearchTool? = null,
- private val functionTool: FunctionTool? = null,
+ private val codeInterpreter: CodeInterpreterTool? = null,
+ private val fileSearch: FileSearchTool? = null,
+ private val function: FunctionTool? = null,
private val _json: JsonValue? = null,
) {
- fun codeInterpreterTool(): Optional =
- Optional.ofNullable(codeInterpreterTool)
+ fun codeInterpreter(): Optional = Optional.ofNullable(codeInterpreter)
- fun fileSearchTool(): Optional = Optional.ofNullable(fileSearchTool)
+ fun fileSearch(): Optional = Optional.ofNullable(fileSearch)
- fun functionTool(): Optional = Optional.ofNullable(functionTool)
+ fun function(): Optional = Optional.ofNullable(function)
- fun isCodeInterpreterTool(): Boolean = codeInterpreterTool != null
+ fun isCodeInterpreter(): Boolean = codeInterpreter != null
- fun isFileSearchTool(): Boolean = fileSearchTool != null
+ fun isFileSearch(): Boolean = fileSearch != null
- fun isFunctionTool(): Boolean = functionTool != null
+ fun isFunction(): Boolean = function != null
- fun asCodeInterpreterTool(): CodeInterpreterTool =
- codeInterpreterTool.getOrThrow("codeInterpreterTool")
+ fun asCodeInterpreter(): CodeInterpreterTool = codeInterpreter.getOrThrow("codeInterpreter")
- fun asFileSearchTool(): FileSearchTool = fileSearchTool.getOrThrow("fileSearchTool")
+ fun asFileSearch(): FileSearchTool = fileSearch.getOrThrow("fileSearch")
- fun asFunctionTool(): FunctionTool = functionTool.getOrThrow("functionTool")
+ fun asFunction(): FunctionTool = function.getOrThrow("function")
fun _json(): Optional = Optional.ofNullable(_json)
fun accept(visitor: Visitor): T {
return when {
- codeInterpreterTool != null -> visitor.visitCodeInterpreterTool(codeInterpreterTool)
- fileSearchTool != null -> visitor.visitFileSearchTool(fileSearchTool)
- functionTool != null -> visitor.visitFunctionTool(functionTool)
+ codeInterpreter != null -> visitor.visitCodeInterpreter(codeInterpreter)
+ fileSearch != null -> visitor.visitFileSearch(fileSearch)
+ function != null -> visitor.visitFunction(function)
else -> visitor.unknown(_json)
}
}
@@ -68,16 +66,16 @@ private constructor(
accept(
object : Visitor {
- override fun visitCodeInterpreterTool(codeInterpreterTool: CodeInterpreterTool) {
- codeInterpreterTool.validate()
+ override fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool) {
+ codeInterpreter.validate()
}
- override fun visitFileSearchTool(fileSearchTool: FileSearchTool) {
- fileSearchTool.validate()
+ override fun visitFileSearch(fileSearch: FileSearchTool) {
+ fileSearch.validate()
}
- override fun visitFunctionTool(functionTool: FunctionTool) {
- functionTool.validate()
+ override fun visitFunction(function: FunctionTool) {
+ function.validate()
}
}
)
@@ -89,16 +87,16 @@ private constructor(
return true
}
- return /* spotless:off */ other is AssistantTool && codeInterpreterTool == other.codeInterpreterTool && fileSearchTool == other.fileSearchTool && functionTool == other.functionTool /* spotless:on */
+ return /* spotless:off */ other is AssistantTool && codeInterpreter == other.codeInterpreter && fileSearch == other.fileSearch && function == other.function /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(codeInterpreterTool, fileSearchTool, functionTool) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(codeInterpreter, fileSearch, function) /* spotless:on */
override fun toString(): String =
when {
- codeInterpreterTool != null -> "AssistantTool{codeInterpreterTool=$codeInterpreterTool}"
- fileSearchTool != null -> "AssistantTool{fileSearchTool=$fileSearchTool}"
- functionTool != null -> "AssistantTool{functionTool=$functionTool}"
+ codeInterpreter != null -> "AssistantTool{codeInterpreter=$codeInterpreter}"
+ fileSearch != null -> "AssistantTool{fileSearch=$fileSearch}"
+ function != null -> "AssistantTool{function=$function}"
_json != null -> "AssistantTool{_unknown=$_json}"
else -> throw IllegalStateException("Invalid AssistantTool")
}
@@ -106,24 +104,22 @@ private constructor(
companion object {
@JvmStatic
- fun ofCodeInterpreterTool(codeInterpreterTool: CodeInterpreterTool) =
- AssistantTool(codeInterpreterTool = codeInterpreterTool)
+ fun ofCodeInterpreter(codeInterpreter: CodeInterpreterTool) =
+ AssistantTool(codeInterpreter = codeInterpreter)
@JvmStatic
- fun ofFileSearchTool(fileSearchTool: FileSearchTool) =
- AssistantTool(fileSearchTool = fileSearchTool)
+ fun ofFileSearch(fileSearch: FileSearchTool) = AssistantTool(fileSearch = fileSearch)
- @JvmStatic
- fun ofFunctionTool(functionTool: FunctionTool) = AssistantTool(functionTool = functionTool)
+ @JvmStatic fun ofFunction(function: FunctionTool) = AssistantTool(function = function)
}
interface Visitor {
- fun visitCodeInterpreterTool(codeInterpreterTool: CodeInterpreterTool): T
+ fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool): T
- fun visitFileSearchTool(fileSearchTool: FileSearchTool): T
+ fun visitFileSearch(fileSearch: FileSearchTool): T
- fun visitFunctionTool(functionTool: FunctionTool): T
+ fun visitFunction(function: FunctionTool): T
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown AssistantTool: $json")
@@ -140,19 +136,19 @@ private constructor(
"code_interpreter" -> {
tryDeserialize(node, jacksonTypeRef()) { it.validate() }
?.let {
- return AssistantTool(codeInterpreterTool = it, _json = json)
+ return AssistantTool(codeInterpreter = it, _json = json)
}
}
"file_search" -> {
tryDeserialize(node, jacksonTypeRef()) { it.validate() }
?.let {
- return AssistantTool(fileSearchTool = it, _json = json)
+ return AssistantTool(fileSearch = it, _json = json)
}
}
"function" -> {
tryDeserialize(node, jacksonTypeRef()) { it.validate() }
?.let {
- return AssistantTool(functionTool = it, _json = json)
+ return AssistantTool(function = it, _json = json)
}
}
}
@@ -169,10 +165,9 @@ private constructor(
provider: SerializerProvider
) {
when {
- value.codeInterpreterTool != null ->
- generator.writeObject(value.codeInterpreterTool)
- value.fileSearchTool != null -> generator.writeObject(value.fileSearchTool)
- value.functionTool != null -> generator.writeObject(value.functionTool)
+ value.codeInterpreter != null -> generator.writeObject(value.codeInterpreter)
+ value.fileSearch != null -> generator.writeObject(value.fileSearch)
+ value.function != null -> generator.writeObject(value.function)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid AssistantTool")
}
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 858eb36aa..e2a9f60e9 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
@@ -768,22 +768,21 @@ constructor(
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
- fun addTool(codeInterpreterTool: CodeInterpreterTool) =
- addTool(AssistantTool.ofCodeInterpreterTool(codeInterpreterTool))
+ fun addTool(codeInterpreter: CodeInterpreterTool) =
+ addTool(AssistantTool.ofCodeInterpreter(codeInterpreter))
/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
- fun addTool(fileSearchTool: FileSearchTool) =
- addTool(AssistantTool.ofFileSearchTool(fileSearchTool))
+ fun addTool(fileSearch: FileSearchTool) =
+ addTool(AssistantTool.ofFileSearch(fileSearch))
/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
- fun addTool(functionTool: FunctionTool) =
- addTool(AssistantTool.ofFunctionTool(functionTool))
+ fun addTool(function: FunctionTool) = addTool(AssistantTool.ofFunction(function))
/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
@@ -1189,21 +1188,19 @@ constructor(
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
- fun addTool(codeInterpreterTool: CodeInterpreterTool) = apply {
- body.addTool(codeInterpreterTool)
- }
+ fun addTool(codeInterpreter: CodeInterpreterTool) = apply { body.addTool(codeInterpreter) }
/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
- fun addTool(fileSearchTool: FileSearchTool) = apply { body.addTool(fileSearchTool) }
+ fun addTool(fileSearch: FileSearchTool) = apply { body.addTool(fileSearch) }
/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
- fun addTool(functionTool: FunctionTool) = apply { body.addTool(functionTool) }
+ fun addTool(function: FunctionTool) = apply { body.addTool(function) }
/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
@@ -1927,27 +1924,15 @@ constructor(
* The default strategy. This strategy currently uses a `max_chunk_size_tokens`
* of `800` and `chunk_overlap_tokens` of `400`.
*/
- fun chunkingStrategy(
- autoFileChunkingStrategyParam: AutoFileChunkingStrategyParam
- ) =
- chunkingStrategy(
- FileChunkingStrategyParam.ofAutoFileChunkingStrategyParam(
- autoFileChunkingStrategyParam
- )
- )
+ fun chunkingStrategy(auto: AutoFileChunkingStrategyParam) =
+ chunkingStrategy(FileChunkingStrategyParam.ofAuto(auto))
/**
* The chunking strategy used to chunk the file(s). If not set, will use the
* `auto` strategy. Only applicable if `file_ids` is non-empty.
*/
- fun chunkingStrategy(
- staticFileChunkingStrategyObjectParam: StaticFileChunkingStrategyObjectParam
- ) =
- chunkingStrategy(
- FileChunkingStrategyParam.ofStaticFileChunkingStrategyObjectParam(
- staticFileChunkingStrategyObjectParam
- )
- )
+ fun chunkingStrategy(static_: StaticFileChunkingStrategyObjectParam) =
+ chunkingStrategy(FileChunkingStrategyParam.ofStatic(static_))
/**
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
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 d2733429c..3b1f20426 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
@@ -770,22 +770,21 @@ constructor(
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
- fun addTool(codeInterpreterTool: CodeInterpreterTool) =
- addTool(AssistantTool.ofCodeInterpreterTool(codeInterpreterTool))
+ fun addTool(codeInterpreter: CodeInterpreterTool) =
+ addTool(AssistantTool.ofCodeInterpreter(codeInterpreter))
/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
- fun addTool(fileSearchTool: FileSearchTool) =
- addTool(AssistantTool.ofFileSearchTool(fileSearchTool))
+ fun addTool(fileSearch: FileSearchTool) =
+ addTool(AssistantTool.ofFileSearch(fileSearch))
/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
- fun addTool(functionTool: FunctionTool) =
- addTool(AssistantTool.ofFunctionTool(functionTool))
+ fun addTool(function: FunctionTool) = addTool(AssistantTool.ofFunction(function))
/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
@@ -1187,21 +1186,19 @@ constructor(
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
- fun addTool(codeInterpreterTool: CodeInterpreterTool) = apply {
- body.addTool(codeInterpreterTool)
- }
+ fun addTool(codeInterpreter: CodeInterpreterTool) = apply { body.addTool(codeInterpreter) }
/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
- fun addTool(fileSearchTool: FileSearchTool) = apply { body.addTool(fileSearchTool) }
+ fun addTool(fileSearch: FileSearchTool) = apply { body.addTool(fileSearch) }
/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
- fun addTool(functionTool: FunctionTool) = apply { body.addTool(functionTool) }
+ fun addTool(function: FunctionTool) = apply { body.addTool(function) }
/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
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 7d93d8c94..3609b3691 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
@@ -1152,21 +1152,20 @@ constructor(
* Override the tools the assistant can use for this run. This is useful for modifying
* the behavior on a per-run basis.
*/
- fun addTool(codeInterpreterTool: CodeInterpreterTool) =
- addTool(Tool.ofCodeInterpreterTool(codeInterpreterTool))
+ fun addTool(codeInterpreter: CodeInterpreterTool) =
+ addTool(Tool.ofCodeInterpreter(codeInterpreter))
/**
* Override the tools the assistant can use for this run. This is useful for modifying
* the behavior on a per-run basis.
*/
- fun addTool(fileSearchTool: FileSearchTool) =
- addTool(Tool.ofFileSearchTool(fileSearchTool))
+ fun addTool(fileSearch: FileSearchTool) = addTool(Tool.ofFileSearch(fileSearch))
/**
* Override the tools the assistant can use for this run. This is useful for modifying
* the behavior on a per-run basis.
*/
- fun addTool(functionTool: FunctionTool) = addTool(Tool.ofFunctionTool(functionTool))
+ fun addTool(function: FunctionTool) = addTool(Tool.ofFunction(function))
/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
@@ -1753,21 +1752,19 @@ constructor(
* Override the tools the assistant can use for this run. This is useful for modifying the
* behavior on a per-run basis.
*/
- fun addTool(codeInterpreterTool: CodeInterpreterTool) = apply {
- body.addTool(codeInterpreterTool)
- }
+ fun addTool(codeInterpreter: CodeInterpreterTool) = apply { body.addTool(codeInterpreter) }
/**
* Override the tools the assistant can use for this run. This is useful for modifying the
* behavior on a per-run basis.
*/
- fun addTool(fileSearchTool: FileSearchTool) = apply { body.addTool(fileSearchTool) }
+ fun addTool(fileSearch: FileSearchTool) = apply { body.addTool(fileSearch) }
/**
* Override the tools the assistant can use for this run. This is useful for modifying the
* behavior on a per-run basis.
*/
- fun addTool(functionTool: FunctionTool) = apply { body.addTool(functionTool) }
+ fun addTool(function: FunctionTool) = apply { body.addTool(function) }
/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
@@ -2253,7 +2250,7 @@ constructor(
fun content(content: JsonField) = apply { this.content = content }
/** The text contents of the message. */
- fun content(textContent: String) = content(Content.ofTextContent(textContent))
+ fun content(text: String) = content(Content.ofText(text))
/**
* An array of content parts with a defined type, each can be of type `text` or
@@ -2362,13 +2359,13 @@ constructor(
@JsonSerialize(using = Content.Serializer::class)
class Content
private constructor(
- private val textContent: String? = null,
+ private val text: String? = null,
private val arrayOfContentParts: List? = null,
private val _json: JsonValue? = null,
) {
/** The text contents of the message. */
- fun textContent(): Optional = Optional.ofNullable(textContent)
+ fun text(): Optional = Optional.ofNullable(text)
/**
* An array of content parts with a defined type, each can be of type `text` or
@@ -2378,12 +2375,12 @@ constructor(
fun arrayOfContentParts(): Optional> =
Optional.ofNullable(arrayOfContentParts)
- fun isTextContent(): Boolean = textContent != null
+ fun isText(): Boolean = text != null
fun isArrayOfContentParts(): Boolean = arrayOfContentParts != null
/** The text contents of the message. */
- fun asTextContent(): String = textContent.getOrThrow("textContent")
+ fun asText(): String = text.getOrThrow("text")
/**
* An array of content parts with a defined type, each can be of type `text` or
@@ -2397,7 +2394,7 @@ constructor(
fun accept(visitor: Visitor): T {
return when {
- textContent != null -> visitor.visitTextContent(textContent)
+ text != null -> visitor.visitText(text)
arrayOfContentParts != null ->
visitor.visitArrayOfContentParts(arrayOfContentParts)
else -> visitor.unknown(_json)
@@ -2413,7 +2410,7 @@ constructor(
accept(
object : Visitor {
- override fun visitTextContent(textContent: String) {}
+ override fun visitText(text: String) {}
override fun visitArrayOfContentParts(
arrayOfContentParts: List
@@ -2430,14 +2427,14 @@ constructor(
return true
}
- return /* spotless:off */ other is Content && textContent == other.textContent && arrayOfContentParts == other.arrayOfContentParts /* spotless:on */
+ return /* spotless:off */ other is Content && text == other.text && arrayOfContentParts == other.arrayOfContentParts /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(textContent, arrayOfContentParts) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(text, arrayOfContentParts) /* spotless:on */
override fun toString(): String =
when {
- textContent != null -> "Content{textContent=$textContent}"
+ text != null -> "Content{text=$text}"
arrayOfContentParts != null ->
"Content{arrayOfContentParts=$arrayOfContentParts}"
_json != null -> "Content{_unknown=$_json}"
@@ -2447,8 +2444,7 @@ constructor(
companion object {
/** The text contents of the message. */
- @JvmStatic
- fun ofTextContent(textContent: String) = Content(textContent = textContent)
+ @JvmStatic fun ofText(text: String) = Content(text = text)
/**
* An array of content parts with a defined type, each can be of type `text` or
@@ -2464,7 +2460,7 @@ constructor(
interface Visitor {
/** The text contents of the message. */
- fun visitTextContent(textContent: String): T
+ fun visitText(text: String): T
/**
* An array of content parts with a defined type, each can be of type `text` or
@@ -2487,7 +2483,7 @@ constructor(
val json = JsonValue.fromJsonNode(node)
tryDeserialize(node, jacksonTypeRef())?.let {
- return Content(textContent = it, _json = json)
+ return Content(text = it, _json = json)
}
tryDeserialize(node, jacksonTypeRef>()) {
it.forEach { it.validate() }
@@ -2508,7 +2504,7 @@ constructor(
provider: SerializerProvider
) {
when {
- value.textContent != null -> generator.writeObject(value.textContent)
+ value.text != null -> generator.writeObject(value.text)
value.arrayOfContentParts != null ->
generator.writeObject(value.arrayOfContentParts)
value._json != null -> generator.writeObject(value._json)
@@ -2673,8 +2669,8 @@ constructor(
}
/** The tools to add this file to. */
- fun addTool(codeInterpreterTool: CodeInterpreterTool) =
- addTool(Tool.ofCodeInterpreterTool(codeInterpreterTool))
+ fun addTool(codeInterpreter: CodeInterpreterTool) =
+ addTool(Tool.ofCodeInterpreter(codeInterpreter))
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
@@ -2710,22 +2706,22 @@ constructor(
@JsonSerialize(using = Tool.Serializer::class)
class Tool
private constructor(
- private val codeInterpreterTool: CodeInterpreterTool? = null,
+ private val codeInterpreter: CodeInterpreterTool? = null,
private val fileSearch: JsonValue? = null,
private val _json: JsonValue? = null,
) {
- fun codeInterpreterTool(): Optional =
- Optional.ofNullable(codeInterpreterTool)
+ fun codeInterpreter(): Optional =
+ Optional.ofNullable(codeInterpreter)
fun fileSearch(): Optional = Optional.ofNullable(fileSearch)
- fun isCodeInterpreterTool(): Boolean = codeInterpreterTool != null
+ fun isCodeInterpreter(): Boolean = codeInterpreter != null
fun isFileSearch(): Boolean = fileSearch != null
- fun asCodeInterpreterTool(): CodeInterpreterTool =
- codeInterpreterTool.getOrThrow("codeInterpreterTool")
+ fun asCodeInterpreter(): CodeInterpreterTool =
+ codeInterpreter.getOrThrow("codeInterpreter")
fun asFileSearch(): JsonValue = fileSearch.getOrThrow("fileSearch")
@@ -2733,8 +2729,7 @@ constructor(
fun accept(visitor: Visitor): T {
return when {
- codeInterpreterTool != null ->
- visitor.visitCodeInterpreterTool(codeInterpreterTool)
+ codeInterpreter != null -> visitor.visitCodeInterpreter(codeInterpreter)
fileSearch != null -> visitor.visitFileSearch(fileSearch)
else -> visitor.unknown(_json)
}
@@ -2749,10 +2744,10 @@ constructor(
accept(
object : Visitor {
- override fun visitCodeInterpreterTool(
- codeInterpreterTool: CodeInterpreterTool
+ override fun visitCodeInterpreter(
+ codeInterpreter: CodeInterpreterTool
) {
- codeInterpreterTool.validate()
+ codeInterpreter.validate()
}
override fun visitFileSearch(fileSearch: JsonValue) {
@@ -2774,15 +2769,14 @@ constructor(
return true
}
- return /* spotless:off */ other is Tool && codeInterpreterTool == other.codeInterpreterTool && fileSearch == other.fileSearch /* spotless:on */
+ return /* spotless:off */ other is Tool && codeInterpreter == other.codeInterpreter && fileSearch == other.fileSearch /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(codeInterpreterTool, fileSearch) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(codeInterpreter, fileSearch) /* spotless:on */
override fun toString(): String =
when {
- codeInterpreterTool != null ->
- "Tool{codeInterpreterTool=$codeInterpreterTool}"
+ codeInterpreter != null -> "Tool{codeInterpreter=$codeInterpreter}"
fileSearch != null -> "Tool{fileSearch=$fileSearch}"
_json != null -> "Tool{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Tool")
@@ -2791,8 +2785,8 @@ constructor(
companion object {
@JvmStatic
- fun ofCodeInterpreterTool(codeInterpreterTool: CodeInterpreterTool) =
- Tool(codeInterpreterTool = codeInterpreterTool)
+ fun ofCodeInterpreter(codeInterpreter: CodeInterpreterTool) =
+ Tool(codeInterpreter = codeInterpreter)
@JvmStatic
fun ofFileSearch() =
@@ -2801,7 +2795,7 @@ constructor(
interface Visitor {
- fun visitCodeInterpreterTool(codeInterpreterTool: CodeInterpreterTool): T
+ fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool): T
fun visitFileSearch(fileSearch: JsonValue): T
@@ -2823,7 +2817,7 @@ constructor(
it.validate()
}
?.let {
- return Tool(codeInterpreterTool = it, _json = json)
+ return Tool(codeInterpreter = it, _json = json)
}
}
"file_search" -> {
@@ -2859,8 +2853,8 @@ constructor(
provider: SerializerProvider
) {
when {
- value.codeInterpreterTool != null ->
- generator.writeObject(value.codeInterpreterTool)
+ value.codeInterpreter != null ->
+ generator.writeObject(value.codeInterpreter)
value.fileSearch != null -> generator.writeObject(value.fileSearch)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Tool")
@@ -3471,28 +3465,15 @@ constructor(
* The default strategy. This strategy currently uses a
* `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
*/
- fun chunkingStrategy(
- autoFileChunkingStrategyParam: AutoFileChunkingStrategyParam
- ) =
- chunkingStrategy(
- FileChunkingStrategyParam.ofAutoFileChunkingStrategyParam(
- autoFileChunkingStrategyParam
- )
- )
+ fun chunkingStrategy(auto: AutoFileChunkingStrategyParam) =
+ chunkingStrategy(FileChunkingStrategyParam.ofAuto(auto))
/**
* The chunking strategy used to chunk the file(s). If not set, will use the
* `auto` strategy. Only applicable if `file_ids` is non-empty.
*/
- fun chunkingStrategy(
- staticFileChunkingStrategyObjectParam:
- StaticFileChunkingStrategyObjectParam
- ) =
- chunkingStrategy(
- FileChunkingStrategyParam.ofStaticFileChunkingStrategyObjectParam(
- staticFileChunkingStrategyObjectParam
- )
- )
+ fun chunkingStrategy(static_: StaticFileChunkingStrategyObjectParam) =
+ chunkingStrategy(FileChunkingStrategyParam.ofStatic(static_))
/**
* A list of [file](https://platform.openai.com/docs/api-reference/files)
@@ -4060,39 +4041,37 @@ constructor(
@JsonSerialize(using = Tool.Serializer::class)
class Tool
private constructor(
- private val codeInterpreterTool: CodeInterpreterTool? = null,
- private val fileSearchTool: FileSearchTool? = null,
- private val functionTool: FunctionTool? = null,
+ private val codeInterpreter: CodeInterpreterTool? = null,
+ private val fileSearch: FileSearchTool? = null,
+ private val function: FunctionTool? = null,
private val _json: JsonValue? = null,
) {
- fun codeInterpreterTool(): Optional =
- Optional.ofNullable(codeInterpreterTool)
+ fun codeInterpreter(): Optional = Optional.ofNullable(codeInterpreter)
- fun fileSearchTool(): Optional = Optional.ofNullable(fileSearchTool)
+ fun fileSearch(): Optional = Optional.ofNullable(fileSearch)
- fun functionTool(): Optional = Optional.ofNullable(functionTool)
+ fun function(): Optional = Optional.ofNullable(function)
- fun isCodeInterpreterTool(): Boolean = codeInterpreterTool != null
+ fun isCodeInterpreter(): Boolean = codeInterpreter != null
- fun isFileSearchTool(): Boolean = fileSearchTool != null
+ fun isFileSearch(): Boolean = fileSearch != null
- fun isFunctionTool(): Boolean = functionTool != null
+ fun isFunction(): Boolean = function != null
- fun asCodeInterpreterTool(): CodeInterpreterTool =
- codeInterpreterTool.getOrThrow("codeInterpreterTool")
+ fun asCodeInterpreter(): CodeInterpreterTool = codeInterpreter.getOrThrow("codeInterpreter")
- fun asFileSearchTool(): FileSearchTool = fileSearchTool.getOrThrow("fileSearchTool")
+ fun asFileSearch(): FileSearchTool = fileSearch.getOrThrow("fileSearch")
- fun asFunctionTool(): FunctionTool = functionTool.getOrThrow("functionTool")
+ fun asFunction(): FunctionTool = function.getOrThrow("function")
fun _json(): Optional = Optional.ofNullable(_json)
fun accept(visitor: Visitor): T {
return when {
- codeInterpreterTool != null -> visitor.visitCodeInterpreterTool(codeInterpreterTool)
- fileSearchTool != null -> visitor.visitFileSearchTool(fileSearchTool)
- functionTool != null -> visitor.visitFunctionTool(functionTool)
+ codeInterpreter != null -> visitor.visitCodeInterpreter(codeInterpreter)
+ fileSearch != null -> visitor.visitFileSearch(fileSearch)
+ function != null -> visitor.visitFunction(function)
else -> visitor.unknown(_json)
}
}
@@ -4106,18 +4085,16 @@ constructor(
accept(
object : Visitor {
- override fun visitCodeInterpreterTool(
- codeInterpreterTool: CodeInterpreterTool
- ) {
- codeInterpreterTool.validate()
+ override fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool) {
+ codeInterpreter.validate()
}
- override fun visitFileSearchTool(fileSearchTool: FileSearchTool) {
- fileSearchTool.validate()
+ override fun visitFileSearch(fileSearch: FileSearchTool) {
+ fileSearch.validate()
}
- override fun visitFunctionTool(functionTool: FunctionTool) {
- functionTool.validate()
+ override fun visitFunction(function: FunctionTool) {
+ function.validate()
}
}
)
@@ -4129,16 +4106,16 @@ constructor(
return true
}
- return /* spotless:off */ other is Tool && codeInterpreterTool == other.codeInterpreterTool && fileSearchTool == other.fileSearchTool && functionTool == other.functionTool /* spotless:on */
+ return /* spotless:off */ other is Tool && codeInterpreter == other.codeInterpreter && fileSearch == other.fileSearch && function == other.function /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(codeInterpreterTool, fileSearchTool, functionTool) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(codeInterpreter, fileSearch, function) /* spotless:on */
override fun toString(): String =
when {
- codeInterpreterTool != null -> "Tool{codeInterpreterTool=$codeInterpreterTool}"
- fileSearchTool != null -> "Tool{fileSearchTool=$fileSearchTool}"
- functionTool != null -> "Tool{functionTool=$functionTool}"
+ codeInterpreter != null -> "Tool{codeInterpreter=$codeInterpreter}"
+ fileSearch != null -> "Tool{fileSearch=$fileSearch}"
+ function != null -> "Tool{function=$function}"
_json != null -> "Tool{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Tool")
}
@@ -4146,24 +4123,21 @@ constructor(
companion object {
@JvmStatic
- fun ofCodeInterpreterTool(codeInterpreterTool: CodeInterpreterTool) =
- Tool(codeInterpreterTool = codeInterpreterTool)
+ fun ofCodeInterpreter(codeInterpreter: CodeInterpreterTool) =
+ Tool(codeInterpreter = codeInterpreter)
- @JvmStatic
- fun ofFileSearchTool(fileSearchTool: FileSearchTool) =
- Tool(fileSearchTool = fileSearchTool)
+ @JvmStatic fun ofFileSearch(fileSearch: FileSearchTool) = Tool(fileSearch = fileSearch)
- @JvmStatic
- fun ofFunctionTool(functionTool: FunctionTool) = Tool(functionTool = functionTool)
+ @JvmStatic fun ofFunction(function: FunctionTool) = Tool(function = function)
}
interface Visitor {
- fun visitCodeInterpreterTool(codeInterpreterTool: CodeInterpreterTool): T
+ fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool): T
- fun visitFileSearchTool(fileSearchTool: FileSearchTool): T
+ fun visitFileSearch(fileSearch: FileSearchTool): T
- fun visitFunctionTool(functionTool: FunctionTool): T
+ fun visitFunction(function: FunctionTool): T
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown Tool: $json")
@@ -4177,15 +4151,15 @@ constructor(
tryDeserialize(node, jacksonTypeRef()) { it.validate() }
?.let {
- return Tool(codeInterpreterTool = it, _json = json)
+ return Tool(codeInterpreter = it, _json = json)
}
tryDeserialize(node, jacksonTypeRef()) { it.validate() }
?.let {
- return Tool(fileSearchTool = it, _json = json)
+ return Tool(fileSearch = it, _json = json)
}
tryDeserialize(node, jacksonTypeRef()) { it.validate() }
?.let {
- return Tool(functionTool = it, _json = json)
+ return Tool(function = it, _json = json)
}
return Tool(_json = json)
@@ -4200,10 +4174,9 @@ constructor(
provider: SerializerProvider
) {
when {
- value.codeInterpreterTool != null ->
- generator.writeObject(value.codeInterpreterTool)
- value.fileSearchTool != null -> generator.writeObject(value.fileSearchTool)
- value.functionTool != null -> generator.writeObject(value.functionTool)
+ value.codeInterpreter != null -> generator.writeObject(value.codeInterpreter)
+ value.fileSearch != null -> generator.writeObject(value.fileSearch)
+ value.function != null -> generator.writeObject(value.function)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Tool")
}
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 b4e0172a6..8a3c47bb7 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
@@ -599,7 +599,7 @@ constructor(
fun content(content: JsonField) = apply { this.content = content }
/** The text contents of the message. */
- fun content(textContent: String) = content(Content.ofTextContent(textContent))
+ fun content(text: String) = content(Content.ofText(text))
/**
* An array of content parts with a defined type, each can be of type `text` or images
@@ -695,13 +695,13 @@ constructor(
@JsonSerialize(using = Content.Serializer::class)
class Content
private constructor(
- private val textContent: String? = null,
+ private val text: String? = null,
private val arrayOfContentParts: List? = null,
private val _json: JsonValue? = null,
) {
/** The text contents of the message. */
- fun textContent(): Optional = Optional.ofNullable(textContent)
+ fun text(): Optional = Optional.ofNullable(text)
/**
* An array of content parts with a defined type, each can be of type `text` or images
@@ -711,12 +711,12 @@ constructor(
fun arrayOfContentParts(): Optional> =
Optional.ofNullable(arrayOfContentParts)
- fun isTextContent(): Boolean = textContent != null
+ fun isText(): Boolean = text != null
fun isArrayOfContentParts(): Boolean = arrayOfContentParts != null
/** The text contents of the message. */
- fun asTextContent(): String = textContent.getOrThrow("textContent")
+ fun asText(): String = text.getOrThrow("text")
/**
* An array of content parts with a defined type, each can be of type `text` or images
@@ -730,7 +730,7 @@ constructor(
fun accept(visitor: Visitor): T {
return when {
- textContent != null -> visitor.visitTextContent(textContent)
+ text != null -> visitor.visitText(text)
arrayOfContentParts != null ->
visitor.visitArrayOfContentParts(arrayOfContentParts)
else -> visitor.unknown(_json)
@@ -746,7 +746,7 @@ constructor(
accept(
object : Visitor {
- override fun visitTextContent(textContent: String) {}
+ override fun visitText(text: String) {}
override fun visitArrayOfContentParts(
arrayOfContentParts: List
@@ -763,14 +763,14 @@ constructor(
return true
}
- return /* spotless:off */ other is Content && textContent == other.textContent && arrayOfContentParts == other.arrayOfContentParts /* spotless:on */
+ return /* spotless:off */ other is Content && text == other.text && arrayOfContentParts == other.arrayOfContentParts /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(textContent, arrayOfContentParts) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(text, arrayOfContentParts) /* spotless:on */
override fun toString(): String =
when {
- textContent != null -> "Content{textContent=$textContent}"
+ text != null -> "Content{text=$text}"
arrayOfContentParts != null ->
"Content{arrayOfContentParts=$arrayOfContentParts}"
_json != null -> "Content{_unknown=$_json}"
@@ -780,8 +780,7 @@ constructor(
companion object {
/** The text contents of the message. */
- @JvmStatic
- fun ofTextContent(textContent: String) = Content(textContent = textContent)
+ @JvmStatic fun ofText(text: String) = Content(text = text)
/**
* An array of content parts with a defined type, each can be of type `text` or
@@ -796,7 +795,7 @@ constructor(
interface Visitor {
/** The text contents of the message. */
- fun visitTextContent(textContent: String): T
+ fun visitText(text: String): T
/**
* An array of content parts with a defined type, each can be of type `text` or
@@ -816,7 +815,7 @@ constructor(
val json = JsonValue.fromJsonNode(node)
tryDeserialize(node, jacksonTypeRef())?.let {
- return Content(textContent = it, _json = json)
+ return Content(text = it, _json = json)
}
tryDeserialize(node, jacksonTypeRef>()) {
it.forEach { it.validate() }
@@ -837,7 +836,7 @@ constructor(
provider: SerializerProvider
) {
when {
- value.textContent != null -> generator.writeObject(value.textContent)
+ value.text != null -> generator.writeObject(value.text)
value.arrayOfContentParts != null ->
generator.writeObject(value.arrayOfContentParts)
value._json != null -> generator.writeObject(value._json)
@@ -1002,8 +1001,8 @@ constructor(
}
/** The tools to add this file to. */
- fun addTool(codeInterpreterTool: CodeInterpreterTool) =
- addTool(Tool.ofCodeInterpreterTool(codeInterpreterTool))
+ fun addTool(codeInterpreter: CodeInterpreterTool) =
+ addTool(Tool.ofCodeInterpreter(codeInterpreter))
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
@@ -1039,22 +1038,22 @@ constructor(
@JsonSerialize(using = Tool.Serializer::class)
class Tool
private constructor(
- private val codeInterpreterTool: CodeInterpreterTool? = null,
+ private val codeInterpreter: CodeInterpreterTool? = null,
private val fileSearch: JsonValue? = null,
private val _json: JsonValue? = null,
) {
- fun codeInterpreterTool(): Optional =
- Optional.ofNullable(codeInterpreterTool)
+ fun codeInterpreter(): Optional =
+ Optional.ofNullable(codeInterpreter)
fun fileSearch(): Optional = Optional.ofNullable(fileSearch)
- fun isCodeInterpreterTool(): Boolean = codeInterpreterTool != null
+ fun isCodeInterpreter(): Boolean = codeInterpreter != null
fun isFileSearch(): Boolean = fileSearch != null
- fun asCodeInterpreterTool(): CodeInterpreterTool =
- codeInterpreterTool.getOrThrow("codeInterpreterTool")
+ fun asCodeInterpreter(): CodeInterpreterTool =
+ codeInterpreter.getOrThrow("codeInterpreter")
fun asFileSearch(): JsonValue = fileSearch.getOrThrow("fileSearch")
@@ -1062,8 +1061,7 @@ constructor(
fun accept(visitor: Visitor): T {
return when {
- codeInterpreterTool != null ->
- visitor.visitCodeInterpreterTool(codeInterpreterTool)
+ codeInterpreter != null -> visitor.visitCodeInterpreter(codeInterpreter)
fileSearch != null -> visitor.visitFileSearch(fileSearch)
else -> visitor.unknown(_json)
}
@@ -1078,10 +1076,10 @@ constructor(
accept(
object : Visitor {
- override fun visitCodeInterpreterTool(
- codeInterpreterTool: CodeInterpreterTool
+ override fun visitCodeInterpreter(
+ codeInterpreter: CodeInterpreterTool
) {
- codeInterpreterTool.validate()
+ codeInterpreter.validate()
}
override fun visitFileSearch(fileSearch: JsonValue) {
@@ -1103,15 +1101,14 @@ constructor(
return true
}
- return /* spotless:off */ other is Tool && codeInterpreterTool == other.codeInterpreterTool && fileSearch == other.fileSearch /* spotless:on */
+ return /* spotless:off */ other is Tool && codeInterpreter == other.codeInterpreter && fileSearch == other.fileSearch /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(codeInterpreterTool, fileSearch) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(codeInterpreter, fileSearch) /* spotless:on */
override fun toString(): String =
when {
- codeInterpreterTool != null ->
- "Tool{codeInterpreterTool=$codeInterpreterTool}"
+ codeInterpreter != null -> "Tool{codeInterpreter=$codeInterpreter}"
fileSearch != null -> "Tool{fileSearch=$fileSearch}"
_json != null -> "Tool{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Tool")
@@ -1120,8 +1117,8 @@ constructor(
companion object {
@JvmStatic
- fun ofCodeInterpreterTool(codeInterpreterTool: CodeInterpreterTool) =
- Tool(codeInterpreterTool = codeInterpreterTool)
+ fun ofCodeInterpreter(codeInterpreter: CodeInterpreterTool) =
+ Tool(codeInterpreter = codeInterpreter)
@JvmStatic
fun ofFileSearch() =
@@ -1130,7 +1127,7 @@ constructor(
interface Visitor {
- fun visitCodeInterpreterTool(codeInterpreterTool: CodeInterpreterTool): T
+ fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool): T
fun visitFileSearch(fileSearch: JsonValue): T
@@ -1151,7 +1148,7 @@ constructor(
it.validate()
}
?.let {
- return Tool(codeInterpreterTool = it, _json = json)
+ return Tool(codeInterpreter = it, _json = json)
}
}
"file_search" -> {
@@ -1184,8 +1181,8 @@ constructor(
provider: SerializerProvider
) {
when {
- value.codeInterpreterTool != null ->
- generator.writeObject(value.codeInterpreterTool)
+ value.codeInterpreter != null ->
+ generator.writeObject(value.codeInterpreter)
value.fileSearch != null -> generator.writeObject(value.fileSearch)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Tool")
@@ -1790,27 +1787,15 @@ constructor(
* The default strategy. This strategy currently uses a `max_chunk_size_tokens`
* of `800` and `chunk_overlap_tokens` of `400`.
*/
- fun chunkingStrategy(
- autoFileChunkingStrategyParam: AutoFileChunkingStrategyParam
- ) =
- chunkingStrategy(
- FileChunkingStrategyParam.ofAutoFileChunkingStrategyParam(
- autoFileChunkingStrategyParam
- )
- )
+ fun chunkingStrategy(auto: AutoFileChunkingStrategyParam) =
+ chunkingStrategy(FileChunkingStrategyParam.ofAuto(auto))
/**
* The chunking strategy used to chunk the file(s). If not set, will use the
* `auto` strategy. Only applicable if `file_ids` is non-empty.
*/
- fun chunkingStrategy(
- staticFileChunkingStrategyObjectParam: StaticFileChunkingStrategyObjectParam
- ) =
- chunkingStrategy(
- FileChunkingStrategyParam.ofStaticFileChunkingStrategyObjectParam(
- staticFileChunkingStrategyObjectParam
- )
- )
+ fun chunkingStrategy(static_: StaticFileChunkingStrategyObjectParam) =
+ chunkingStrategy(FileChunkingStrategyParam.ofStatic(static_))
/**
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
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 635e468c5..62625645f 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
@@ -206,7 +206,7 @@ constructor(
fun content(content: JsonField) = apply { this.content = content }
/** The text contents of the message. */
- fun content(textContent: String) = content(Content.ofTextContent(textContent))
+ fun content(text: String) = content(Content.ofText(text))
/**
* An array of content parts with a defined type, each can be of type `text` or images
@@ -348,7 +348,7 @@ constructor(
fun content(content: JsonField) = apply { body.content(content) }
/** The text contents of the message. */
- fun content(textContent: String) = apply { body.content(textContent) }
+ fun content(text: String) = apply { body.content(text) }
/**
* An array of content parts with a defined type, each can be of type `text` or images can
@@ -531,13 +531,13 @@ constructor(
@JsonSerialize(using = Content.Serializer::class)
class Content
private constructor(
- private val textContent: String? = null,
+ private val text: String? = null,
private val arrayOfContentParts: List? = null,
private val _json: JsonValue? = null,
) {
/** The text contents of the message. */
- fun textContent(): Optional = Optional.ofNullable(textContent)
+ fun text(): Optional = Optional.ofNullable(text)
/**
* An array of content parts with a defined type, each can be of type `text` or images can
@@ -547,12 +547,12 @@ constructor(
fun arrayOfContentParts(): Optional> =
Optional.ofNullable(arrayOfContentParts)
- fun isTextContent(): Boolean = textContent != null
+ fun isText(): Boolean = text != null
fun isArrayOfContentParts(): Boolean = arrayOfContentParts != null
/** The text contents of the message. */
- fun asTextContent(): String = textContent.getOrThrow("textContent")
+ fun asText(): String = text.getOrThrow("text")
/**
* An array of content parts with a defined type, each can be of type `text` or images can
@@ -566,7 +566,7 @@ constructor(
fun accept(visitor: Visitor): T {
return when {
- textContent != null -> visitor.visitTextContent(textContent)
+ text != null -> visitor.visitText(text)
arrayOfContentParts != null -> visitor.visitArrayOfContentParts(arrayOfContentParts)
else -> visitor.unknown(_json)
}
@@ -581,7 +581,7 @@ constructor(
accept(
object : Visitor {
- override fun visitTextContent(textContent: String) {}
+ override fun visitText(text: String) {}
override fun visitArrayOfContentParts(
arrayOfContentParts: List
@@ -598,14 +598,14 @@ constructor(
return true
}
- return /* spotless:off */ other is Content && textContent == other.textContent && arrayOfContentParts == other.arrayOfContentParts /* spotless:on */
+ return /* spotless:off */ other is Content && text == other.text && arrayOfContentParts == other.arrayOfContentParts /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(textContent, arrayOfContentParts) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(text, arrayOfContentParts) /* spotless:on */
override fun toString(): String =
when {
- textContent != null -> "Content{textContent=$textContent}"
+ text != null -> "Content{text=$text}"
arrayOfContentParts != null -> "Content{arrayOfContentParts=$arrayOfContentParts}"
_json != null -> "Content{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Content")
@@ -614,7 +614,7 @@ constructor(
companion object {
/** The text contents of the message. */
- @JvmStatic fun ofTextContent(textContent: String) = Content(textContent = textContent)
+ @JvmStatic fun ofText(text: String) = Content(text = text)
/**
* An array of content parts with a defined type, each can be of type `text` or images
@@ -629,7 +629,7 @@ constructor(
interface Visitor {
/** The text contents of the message. */
- fun visitTextContent(textContent: String): T
+ fun visitText(text: String): T
/**
* An array of content parts with a defined type, each can be of type `text` or images
@@ -649,7 +649,7 @@ constructor(
val json = JsonValue.fromJsonNode(node)
tryDeserialize(node, jacksonTypeRef())?.let {
- return Content(textContent = it, _json = json)
+ return Content(text = it, _json = json)
}
tryDeserialize(node, jacksonTypeRef>()) {
it.forEach { it.validate() }
@@ -670,7 +670,7 @@ constructor(
provider: SerializerProvider
) {
when {
- value.textContent != null -> generator.writeObject(value.textContent)
+ value.text != null -> generator.writeObject(value.text)
value.arrayOfContentParts != null ->
generator.writeObject(value.arrayOfContentParts)
value._json != null -> generator.writeObject(value._json)
@@ -835,8 +835,8 @@ constructor(
}
/** The tools to add this file to. */
- fun addTool(codeInterpreterTool: CodeInterpreterTool) =
- addTool(Tool.ofCodeInterpreterTool(codeInterpreterTool))
+ fun addTool(codeInterpreter: CodeInterpreterTool) =
+ addTool(Tool.ofCodeInterpreter(codeInterpreter))
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
@@ -869,22 +869,22 @@ constructor(
@JsonSerialize(using = Tool.Serializer::class)
class Tool
private constructor(
- private val codeInterpreterTool: CodeInterpreterTool? = null,
+ private val codeInterpreter: CodeInterpreterTool? = null,
private val fileSearch: JsonValue? = null,
private val _json: JsonValue? = null,
) {
- fun codeInterpreterTool(): Optional =
- Optional.ofNullable(codeInterpreterTool)
+ fun codeInterpreter(): Optional =
+ Optional.ofNullable(codeInterpreter)
fun fileSearch(): Optional = Optional.ofNullable(fileSearch)
- fun isCodeInterpreterTool(): Boolean = codeInterpreterTool != null
+ fun isCodeInterpreter(): Boolean = codeInterpreter != null
fun isFileSearch(): Boolean = fileSearch != null
- fun asCodeInterpreterTool(): CodeInterpreterTool =
- codeInterpreterTool.getOrThrow("codeInterpreterTool")
+ fun asCodeInterpreter(): CodeInterpreterTool =
+ codeInterpreter.getOrThrow("codeInterpreter")
fun asFileSearch(): JsonValue = fileSearch.getOrThrow("fileSearch")
@@ -892,8 +892,7 @@ constructor(
fun accept(visitor: Visitor): T {
return when {
- codeInterpreterTool != null ->
- visitor.visitCodeInterpreterTool(codeInterpreterTool)
+ codeInterpreter != null -> visitor.visitCodeInterpreter(codeInterpreter)
fileSearch != null -> visitor.visitFileSearch(fileSearch)
else -> visitor.unknown(_json)
}
@@ -908,10 +907,8 @@ constructor(
accept(
object : Visitor {
- override fun visitCodeInterpreterTool(
- codeInterpreterTool: CodeInterpreterTool
- ) {
- codeInterpreterTool.validate()
+ override fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool) {
+ codeInterpreter.validate()
}
override fun visitFileSearch(fileSearch: JsonValue) {
@@ -933,14 +930,14 @@ constructor(
return true
}
- return /* spotless:off */ other is Tool && codeInterpreterTool == other.codeInterpreterTool && fileSearch == other.fileSearch /* spotless:on */
+ return /* spotless:off */ other is Tool && codeInterpreter == other.codeInterpreter && fileSearch == other.fileSearch /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(codeInterpreterTool, fileSearch) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(codeInterpreter, fileSearch) /* spotless:on */
override fun toString(): String =
when {
- codeInterpreterTool != null -> "Tool{codeInterpreterTool=$codeInterpreterTool}"
+ codeInterpreter != null -> "Tool{codeInterpreter=$codeInterpreter}"
fileSearch != null -> "Tool{fileSearch=$fileSearch}"
_json != null -> "Tool{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Tool")
@@ -949,8 +946,8 @@ constructor(
companion object {
@JvmStatic
- fun ofCodeInterpreterTool(codeInterpreterTool: CodeInterpreterTool) =
- Tool(codeInterpreterTool = codeInterpreterTool)
+ fun ofCodeInterpreter(codeInterpreter: CodeInterpreterTool) =
+ Tool(codeInterpreter = codeInterpreter)
@JvmStatic
fun ofFileSearch() =
@@ -959,7 +956,7 @@ constructor(
interface Visitor {
- fun visitCodeInterpreterTool(codeInterpreterTool: CodeInterpreterTool): T
+ fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool): T
fun visitFileSearch(fileSearch: JsonValue): T
@@ -980,7 +977,7 @@ constructor(
it.validate()
}
?.let {
- return Tool(codeInterpreterTool = it, _json = json)
+ return Tool(codeInterpreter = it, _json = json)
}
}
"file_search" -> {
@@ -1011,8 +1008,8 @@ constructor(
provider: SerializerProvider
) {
when {
- value.codeInterpreterTool != null ->
- generator.writeObject(value.codeInterpreterTool)
+ value.codeInterpreter != null ->
+ generator.writeObject(value.codeInterpreter)
value.fileSearch != null -> generator.writeObject(value.fileSearch)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Tool")
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 fd3d928df..c413ab9e0 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
@@ -1209,22 +1209,21 @@ constructor(
* Override the tools the assistant can use for this run. This is useful for modifying
* the behavior on a per-run basis.
*/
- fun addTool(codeInterpreterTool: CodeInterpreterTool) =
- addTool(AssistantTool.ofCodeInterpreterTool(codeInterpreterTool))
+ fun addTool(codeInterpreter: CodeInterpreterTool) =
+ addTool(AssistantTool.ofCodeInterpreter(codeInterpreter))
/**
* Override the tools the assistant can use for this run. This is useful for modifying
* the behavior on a per-run basis.
*/
- fun addTool(fileSearchTool: FileSearchTool) =
- addTool(AssistantTool.ofFileSearchTool(fileSearchTool))
+ fun addTool(fileSearch: FileSearchTool) =
+ addTool(AssistantTool.ofFileSearch(fileSearch))
/**
* Override the tools the assistant can use for this run. This is useful for modifying
* the behavior on a per-run basis.
*/
- fun addTool(functionTool: FunctionTool) =
- addTool(AssistantTool.ofFunctionTool(functionTool))
+ fun addTool(function: FunctionTool) = addTool(AssistantTool.ofFunction(function))
/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
@@ -1870,21 +1869,19 @@ constructor(
* Override the tools the assistant can use for this run. This is useful for modifying the
* behavior on a per-run basis.
*/
- fun addTool(codeInterpreterTool: CodeInterpreterTool) = apply {
- body.addTool(codeInterpreterTool)
- }
+ fun addTool(codeInterpreter: CodeInterpreterTool) = apply { body.addTool(codeInterpreter) }
/**
* Override the tools the assistant can use for this run. This is useful for modifying the
* behavior on a per-run basis.
*/
- fun addTool(fileSearchTool: FileSearchTool) = apply { body.addTool(fileSearchTool) }
+ fun addTool(fileSearch: FileSearchTool) = apply { body.addTool(fileSearch) }
/**
* Override the tools the assistant can use for this run. This is useful for modifying the
* behavior on a per-run basis.
*/
- fun addTool(functionTool: FunctionTool) = apply { body.addTool(functionTool) }
+ fun addTool(function: FunctionTool) = apply { body.addTool(function) }
/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
@@ -2179,7 +2176,7 @@ constructor(
fun content(content: JsonField) = apply { this.content = content }
/** The text contents of the message. */
- fun content(textContent: String) = content(Content.ofTextContent(textContent))
+ fun content(text: String) = content(Content.ofText(text))
/**
* An array of content parts with a defined type, each can be of type `text` or images
@@ -2275,13 +2272,13 @@ constructor(
@JsonSerialize(using = Content.Serializer::class)
class Content
private constructor(
- private val textContent: String? = null,
+ private val text: String? = null,
private val arrayOfContentParts: List? = null,
private val _json: JsonValue? = null,
) {
/** The text contents of the message. */
- fun textContent(): Optional = Optional.ofNullable(textContent)
+ fun text(): Optional = Optional.ofNullable(text)
/**
* An array of content parts with a defined type, each can be of type `text` or images
@@ -2291,12 +2288,12 @@ constructor(
fun arrayOfContentParts(): Optional> =
Optional.ofNullable(arrayOfContentParts)
- fun isTextContent(): Boolean = textContent != null
+ fun isText(): Boolean = text != null
fun isArrayOfContentParts(): Boolean = arrayOfContentParts != null
/** The text contents of the message. */
- fun asTextContent(): String = textContent.getOrThrow("textContent")
+ fun asText(): String = text.getOrThrow("text")
/**
* An array of content parts with a defined type, each can be of type `text` or images
@@ -2310,7 +2307,7 @@ constructor(
fun accept(visitor: Visitor): T {
return when {
- textContent != null -> visitor.visitTextContent(textContent)
+ text != null -> visitor.visitText(text)
arrayOfContentParts != null ->
visitor.visitArrayOfContentParts(arrayOfContentParts)
else -> visitor.unknown(_json)
@@ -2326,7 +2323,7 @@ constructor(
accept(
object : Visitor {
- override fun visitTextContent(textContent: String) {}
+ override fun visitText(text: String) {}
override fun visitArrayOfContentParts(
arrayOfContentParts: List
@@ -2343,14 +2340,14 @@ constructor(
return true
}
- return /* spotless:off */ other is Content && textContent == other.textContent && arrayOfContentParts == other.arrayOfContentParts /* spotless:on */
+ return /* spotless:off */ other is Content && text == other.text && arrayOfContentParts == other.arrayOfContentParts /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(textContent, arrayOfContentParts) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(text, arrayOfContentParts) /* spotless:on */
override fun toString(): String =
when {
- textContent != null -> "Content{textContent=$textContent}"
+ text != null -> "Content{text=$text}"
arrayOfContentParts != null ->
"Content{arrayOfContentParts=$arrayOfContentParts}"
_json != null -> "Content{_unknown=$_json}"
@@ -2360,8 +2357,7 @@ constructor(
companion object {
/** The text contents of the message. */
- @JvmStatic
- fun ofTextContent(textContent: String) = Content(textContent = textContent)
+ @JvmStatic fun ofText(text: String) = Content(text = text)
/**
* An array of content parts with a defined type, each can be of type `text` or
@@ -2376,7 +2372,7 @@ constructor(
interface Visitor {
/** The text contents of the message. */
- fun visitTextContent(textContent: String): T
+ fun visitText(text: String): T
/**
* An array of content parts with a defined type, each can be of type `text` or
@@ -2396,7 +2392,7 @@ constructor(
val json = JsonValue.fromJsonNode(node)
tryDeserialize(node, jacksonTypeRef())?.let {
- return Content(textContent = it, _json = json)
+ return Content(text = it, _json = json)
}
tryDeserialize(node, jacksonTypeRef>()) {
it.forEach { it.validate() }
@@ -2417,7 +2413,7 @@ constructor(
provider: SerializerProvider
) {
when {
- value.textContent != null -> generator.writeObject(value.textContent)
+ value.text != null -> generator.writeObject(value.text)
value.arrayOfContentParts != null ->
generator.writeObject(value.arrayOfContentParts)
value._json != null -> generator.writeObject(value._json)
@@ -2582,8 +2578,8 @@ constructor(
}
/** The tools to add this file to. */
- fun addTool(codeInterpreterTool: CodeInterpreterTool) =
- addTool(Tool.ofCodeInterpreterTool(codeInterpreterTool))
+ fun addTool(codeInterpreter: CodeInterpreterTool) =
+ addTool(Tool.ofCodeInterpreter(codeInterpreter))
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
@@ -2619,22 +2615,22 @@ constructor(
@JsonSerialize(using = Tool.Serializer::class)
class Tool
private constructor(
- private val codeInterpreterTool: CodeInterpreterTool? = null,
+ private val codeInterpreter: CodeInterpreterTool? = null,
private val fileSearch: JsonValue? = null,
private val _json: JsonValue? = null,
) {
- fun codeInterpreterTool(): Optional =
- Optional.ofNullable(codeInterpreterTool)
+ fun codeInterpreter(): Optional =
+ Optional.ofNullable(codeInterpreter)
fun fileSearch(): Optional = Optional.ofNullable(fileSearch)
- fun isCodeInterpreterTool(): Boolean = codeInterpreterTool != null
+ fun isCodeInterpreter(): Boolean = codeInterpreter != null
fun isFileSearch(): Boolean = fileSearch != null
- fun asCodeInterpreterTool(): CodeInterpreterTool =
- codeInterpreterTool.getOrThrow("codeInterpreterTool")
+ fun asCodeInterpreter(): CodeInterpreterTool =
+ codeInterpreter.getOrThrow("codeInterpreter")
fun asFileSearch(): JsonValue = fileSearch.getOrThrow("fileSearch")
@@ -2642,8 +2638,7 @@ constructor(
fun accept(visitor: Visitor): T {
return when {
- codeInterpreterTool != null ->
- visitor.visitCodeInterpreterTool(codeInterpreterTool)
+ codeInterpreter != null -> visitor.visitCodeInterpreter(codeInterpreter)
fileSearch != null -> visitor.visitFileSearch(fileSearch)
else -> visitor.unknown(_json)
}
@@ -2658,10 +2653,10 @@ constructor(
accept(
object : Visitor {
- override fun visitCodeInterpreterTool(
- codeInterpreterTool: CodeInterpreterTool
+ override fun visitCodeInterpreter(
+ codeInterpreter: CodeInterpreterTool
) {
- codeInterpreterTool.validate()
+ codeInterpreter.validate()
}
override fun visitFileSearch(fileSearch: JsonValue) {
@@ -2683,15 +2678,14 @@ constructor(
return true
}
- return /* spotless:off */ other is Tool && codeInterpreterTool == other.codeInterpreterTool && fileSearch == other.fileSearch /* spotless:on */
+ return /* spotless:off */ other is Tool && codeInterpreter == other.codeInterpreter && fileSearch == other.fileSearch /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(codeInterpreterTool, fileSearch) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(codeInterpreter, fileSearch) /* spotless:on */
override fun toString(): String =
when {
- codeInterpreterTool != null ->
- "Tool{codeInterpreterTool=$codeInterpreterTool}"
+ codeInterpreter != null -> "Tool{codeInterpreter=$codeInterpreter}"
fileSearch != null -> "Tool{fileSearch=$fileSearch}"
_json != null -> "Tool{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Tool")
@@ -2700,8 +2694,8 @@ constructor(
companion object {
@JvmStatic
- fun ofCodeInterpreterTool(codeInterpreterTool: CodeInterpreterTool) =
- Tool(codeInterpreterTool = codeInterpreterTool)
+ fun ofCodeInterpreter(codeInterpreter: CodeInterpreterTool) =
+ Tool(codeInterpreter = codeInterpreter)
@JvmStatic
fun ofFileSearch() =
@@ -2710,7 +2704,7 @@ constructor(
interface Visitor {
- fun visitCodeInterpreterTool(codeInterpreterTool: CodeInterpreterTool): T
+ fun visitCodeInterpreter(codeInterpreter: CodeInterpreterTool): T
fun visitFileSearch(fileSearch: JsonValue): T
@@ -2731,7 +2725,7 @@ constructor(
it.validate()
}
?.let {
- return Tool(codeInterpreterTool = it, _json = json)
+ return Tool(codeInterpreter = it, _json = json)
}
}
"file_search" -> {
@@ -2764,8 +2758,8 @@ constructor(
provider: SerializerProvider
) {
when {
- value.codeInterpreterTool != null ->
- generator.writeObject(value.codeInterpreterTool)
+ value.codeInterpreter != null ->
+ generator.writeObject(value.codeInterpreter)
value.fileSearch != null -> generator.writeObject(value.fileSearch)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Tool")
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 dea49f1b1..e4017acc2 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
@@ -218,25 +218,15 @@ constructor(
* The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800`
* and `chunk_overlap_tokens` of `400`.
*/
- fun chunkingStrategy(autoFileChunkingStrategyParam: AutoFileChunkingStrategyParam) =
- chunkingStrategy(
- FileChunkingStrategyParam.ofAutoFileChunkingStrategyParam(
- autoFileChunkingStrategyParam
- )
- )
+ fun chunkingStrategy(auto: AutoFileChunkingStrategyParam) =
+ chunkingStrategy(FileChunkingStrategyParam.ofAuto(auto))
/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
- fun chunkingStrategy(
- staticFileChunkingStrategyObjectParam: StaticFileChunkingStrategyObjectParam
- ) =
- chunkingStrategy(
- FileChunkingStrategyParam.ofStaticFileChunkingStrategyObjectParam(
- staticFileChunkingStrategyObjectParam
- )
- )
+ fun chunkingStrategy(static_: StaticFileChunkingStrategyObjectParam) =
+ chunkingStrategy(FileChunkingStrategyParam.ofStatic(static_))
/** The expiration policy for a vector store. */
fun expiresAfter(expiresAfter: ExpiresAfter) = expiresAfter(JsonField.of(expiresAfter))
@@ -379,17 +369,17 @@ constructor(
* The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and
* `chunk_overlap_tokens` of `400`.
*/
- fun chunkingStrategy(autoFileChunkingStrategyParam: AutoFileChunkingStrategyParam) = apply {
- body.chunkingStrategy(autoFileChunkingStrategyParam)
+ fun chunkingStrategy(auto: AutoFileChunkingStrategyParam) = apply {
+ body.chunkingStrategy(auto)
}
/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
- fun chunkingStrategy(
- staticFileChunkingStrategyObjectParam: StaticFileChunkingStrategyObjectParam
- ) = apply { body.chunkingStrategy(staticFileChunkingStrategyObjectParam) }
+ fun chunkingStrategy(static_: StaticFileChunkingStrategyObjectParam) = apply {
+ body.chunkingStrategy(static_)
+ }
/** The expiration policy for a vector store. */
fun expiresAfter(expiresAfter: ExpiresAfter) = apply { body.expiresAfter(expiresAfter) }
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 825805c46..6d17080d9 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
@@ -203,25 +203,15 @@ constructor(
* The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800`
* and `chunk_overlap_tokens` of `400`.
*/
- fun chunkingStrategy(autoFileChunkingStrategyParam: AutoFileChunkingStrategyParam) =
- chunkingStrategy(
- FileChunkingStrategyParam.ofAutoFileChunkingStrategyParam(
- autoFileChunkingStrategyParam
- )
- )
+ fun chunkingStrategy(auto: AutoFileChunkingStrategyParam) =
+ chunkingStrategy(FileChunkingStrategyParam.ofAuto(auto))
/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
- fun chunkingStrategy(
- staticFileChunkingStrategyObjectParam: StaticFileChunkingStrategyObjectParam
- ) =
- chunkingStrategy(
- FileChunkingStrategyParam.ofStaticFileChunkingStrategyObjectParam(
- staticFileChunkingStrategyObjectParam
- )
- )
+ fun chunkingStrategy(static_: StaticFileChunkingStrategyObjectParam) =
+ chunkingStrategy(FileChunkingStrategyParam.ofStatic(static_))
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
@@ -335,17 +325,17 @@ constructor(
* The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and
* `chunk_overlap_tokens` of `400`.
*/
- fun chunkingStrategy(autoFileChunkingStrategyParam: AutoFileChunkingStrategyParam) = apply {
- body.chunkingStrategy(autoFileChunkingStrategyParam)
+ fun chunkingStrategy(auto: AutoFileChunkingStrategyParam) = apply {
+ body.chunkingStrategy(auto)
}
/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
- fun chunkingStrategy(
- staticFileChunkingStrategyObjectParam: StaticFileChunkingStrategyObjectParam
- ) = apply { body.chunkingStrategy(staticFileChunkingStrategyObjectParam) }
+ fun chunkingStrategy(static_: StaticFileChunkingStrategyObjectParam) = apply {
+ body.chunkingStrategy(static_)
+ }
fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
body.additionalProperties(additionalBodyProperties)
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 9aa650cdf..af6143a51 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
@@ -187,25 +187,15 @@ constructor(
* The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800`
* and `chunk_overlap_tokens` of `400`.
*/
- fun chunkingStrategy(autoFileChunkingStrategyParam: AutoFileChunkingStrategyParam) =
- chunkingStrategy(
- FileChunkingStrategyParam.ofAutoFileChunkingStrategyParam(
- autoFileChunkingStrategyParam
- )
- )
+ fun chunkingStrategy(auto: AutoFileChunkingStrategyParam) =
+ chunkingStrategy(FileChunkingStrategyParam.ofAuto(auto))
/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
- fun chunkingStrategy(
- staticFileChunkingStrategyObjectParam: StaticFileChunkingStrategyObjectParam
- ) =
- chunkingStrategy(
- FileChunkingStrategyParam.ofStaticFileChunkingStrategyObjectParam(
- staticFileChunkingStrategyObjectParam
- )
- )
+ fun chunkingStrategy(static_: StaticFileChunkingStrategyObjectParam) =
+ chunkingStrategy(FileChunkingStrategyParam.ofStatic(static_))
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
@@ -312,17 +302,17 @@ constructor(
* The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and
* `chunk_overlap_tokens` of `400`.
*/
- fun chunkingStrategy(autoFileChunkingStrategyParam: AutoFileChunkingStrategyParam) = apply {
- body.chunkingStrategy(autoFileChunkingStrategyParam)
+ fun chunkingStrategy(auto: AutoFileChunkingStrategyParam) = apply {
+ body.chunkingStrategy(auto)
}
/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
- fun chunkingStrategy(
- staticFileChunkingStrategyObjectParam: StaticFileChunkingStrategyObjectParam
- ) = apply { body.chunkingStrategy(staticFileChunkingStrategyObjectParam) }
+ fun chunkingStrategy(static_: StaticFileChunkingStrategyObjectParam) = apply {
+ body.chunkingStrategy(static_)
+ }
fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
body.additionalProperties(additionalBodyProperties)
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 a826a5268..b97162a88 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
@@ -221,7 +221,7 @@ private constructor(
fun content(content: JsonField) = apply { this.content = content }
/** The contents of the assistant message. */
- fun content(textContent: String) = content(Content.ofTextContent(textContent))
+ fun content(text: String) = content(Content.ofText(text))
/**
* An array of content parts with a defined type. Can be one or more of type `text`, or
@@ -437,14 +437,14 @@ private constructor(
@JsonSerialize(using = Content.Serializer::class)
class Content
private constructor(
- private val textContent: String? = null,
+ private val text: String? = null,
private val arrayOfContentParts: List? =
null,
private val _json: JsonValue? = null,
) {
/** The contents of the assistant message. */
- fun textContent(): Optional = Optional.ofNullable(textContent)
+ fun text(): Optional = Optional.ofNullable(text)
/**
* An array of content parts with a defined type. Can be one or more of type `text`, or
@@ -454,12 +454,12 @@ private constructor(
Optional> =
Optional.ofNullable(arrayOfContentParts)
- fun isTextContent(): Boolean = textContent != null
+ fun isText(): Boolean = text != null
fun isArrayOfContentParts(): Boolean = arrayOfContentParts != null
/** The contents of the assistant message. */
- fun asTextContent(): String = textContent.getOrThrow("textContent")
+ fun asText(): String = text.getOrThrow("text")
/**
* An array of content parts with a defined type. Can be one or more of type `text`, or
@@ -472,7 +472,7 @@ private constructor(
fun accept(visitor: Visitor): T {
return when {
- textContent != null -> visitor.visitTextContent(textContent)
+ text != null -> visitor.visitText(text)
arrayOfContentParts != null -> visitor.visitArrayOfContentParts(arrayOfContentParts)
else -> visitor.unknown(_json)
}
@@ -487,7 +487,7 @@ private constructor(
accept(
object : Visitor {
- override fun visitTextContent(textContent: String) {}
+ override fun visitText(text: String) {}
override fun visitArrayOfContentParts(
arrayOfContentParts: List
@@ -504,14 +504,14 @@ private constructor(
return true
}
- return /* spotless:off */ other is Content && textContent == other.textContent && arrayOfContentParts == other.arrayOfContentParts /* spotless:on */
+ return /* spotless:off */ other is Content && text == other.text && arrayOfContentParts == other.arrayOfContentParts /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(textContent, arrayOfContentParts) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(text, arrayOfContentParts) /* spotless:on */
override fun toString(): String =
when {
- textContent != null -> "Content{textContent=$textContent}"
+ text != null -> "Content{text=$text}"
arrayOfContentParts != null -> "Content{arrayOfContentParts=$arrayOfContentParts}"
_json != null -> "Content{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Content")
@@ -520,7 +520,7 @@ private constructor(
companion object {
/** The contents of the assistant message. */
- @JvmStatic fun ofTextContent(textContent: String) = Content(textContent = textContent)
+ @JvmStatic fun ofText(text: String) = Content(text = text)
/**
* An array of content parts with a defined type. Can be one or more of type `text`, or
@@ -535,7 +535,7 @@ private constructor(
interface Visitor {
/** The contents of the assistant message. */
- fun visitTextContent(textContent: String): T
+ fun visitText(text: String): T
/**
* An array of content parts with a defined type. Can be one or more of type `text`, or
@@ -556,7 +556,7 @@ private constructor(
val json = JsonValue.fromJsonNode(node)
tryDeserialize(node, jacksonTypeRef())?.let {
- return Content(textContent = it, _json = json)
+ return Content(text = it, _json = json)
}
tryDeserialize(
node,
@@ -580,7 +580,7 @@ private constructor(
provider: SerializerProvider
) {
when {
- value.textContent != null -> generator.writeObject(value.textContent)
+ value.text != null -> generator.writeObject(value.text)
value.arrayOfContentParts != null ->
generator.writeObject(value.arrayOfContentParts)
value._json != null -> generator.writeObject(value._json)
@@ -596,44 +596,35 @@ private constructor(
@JsonSerialize(using = ChatCompletionRequestAssistantMessageContentPart.Serializer::class)
class ChatCompletionRequestAssistantMessageContentPart
private constructor(
- private val chatCompletionContentPartText: ChatCompletionContentPartText? = null,
- private val chatCompletionContentPartRefusal: ChatCompletionContentPartRefusal? = null,
+ private val text: ChatCompletionContentPartText? = null,
+ private val refusal: ChatCompletionContentPartRefusal? = null,
private val _json: JsonValue? = null,
) {
/**
* Learn about [text inputs](https://platform.openai.com/docs/guides/text-generation).
*/
- fun chatCompletionContentPartText(): Optional =
- Optional.ofNullable(chatCompletionContentPartText)
+ fun text(): Optional = Optional.ofNullable(text)
- fun chatCompletionContentPartRefusal(): Optional =
- Optional.ofNullable(chatCompletionContentPartRefusal)
+ fun refusal(): Optional = Optional.ofNullable(refusal)
- fun isChatCompletionContentPartText(): Boolean = chatCompletionContentPartText != null
+ fun isText(): Boolean = text != null
- fun isChatCompletionContentPartRefusal(): Boolean =
- chatCompletionContentPartRefusal != null
+ fun isRefusal(): Boolean = refusal != null
/**
* Learn about [text inputs](https://platform.openai.com/docs/guides/text-generation).
*/
- fun asChatCompletionContentPartText(): ChatCompletionContentPartText =
- chatCompletionContentPartText.getOrThrow("chatCompletionContentPartText")
+ fun asText(): ChatCompletionContentPartText = text.getOrThrow("text")
- fun asChatCompletionContentPartRefusal(): ChatCompletionContentPartRefusal =
- chatCompletionContentPartRefusal.getOrThrow("chatCompletionContentPartRefusal")
+ fun asRefusal(): ChatCompletionContentPartRefusal = refusal.getOrThrow("refusal")
fun _json(): Optional = Optional.ofNullable(_json)
fun accept(visitor: Visitor): T {
return when {
- chatCompletionContentPartText != null ->
- visitor.visitChatCompletionContentPartText(chatCompletionContentPartText)
- chatCompletionContentPartRefusal != null ->
- visitor.visitChatCompletionContentPartRefusal(
- chatCompletionContentPartRefusal
- )
+ text != null -> visitor.visitText(text)
+ refusal != null -> visitor.visitRefusal(refusal)
else -> visitor.unknown(_json)
}
}
@@ -647,16 +638,12 @@ private constructor(
accept(
object : Visitor {
- override fun visitChatCompletionContentPartText(
- chatCompletionContentPartText: ChatCompletionContentPartText
- ) {
- chatCompletionContentPartText.validate()
+ override fun visitText(text: ChatCompletionContentPartText) {
+ text.validate()
}
- override fun visitChatCompletionContentPartRefusal(
- chatCompletionContentPartRefusal: ChatCompletionContentPartRefusal
- ) {
- chatCompletionContentPartRefusal.validate()
+ override fun visitRefusal(refusal: ChatCompletionContentPartRefusal) {
+ refusal.validate()
}
}
)
@@ -668,17 +655,16 @@ private constructor(
return true
}
- return /* spotless:off */ other is ChatCompletionRequestAssistantMessageContentPart && chatCompletionContentPartText == other.chatCompletionContentPartText && chatCompletionContentPartRefusal == other.chatCompletionContentPartRefusal /* spotless:on */
+ return /* spotless:off */ other is ChatCompletionRequestAssistantMessageContentPart && text == other.text && refusal == other.refusal /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(chatCompletionContentPartText, chatCompletionContentPartRefusal) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(text, refusal) /* spotless:on */
override fun toString(): String =
when {
- chatCompletionContentPartText != null ->
- "ChatCompletionRequestAssistantMessageContentPart{chatCompletionContentPartText=$chatCompletionContentPartText}"
- chatCompletionContentPartRefusal != null ->
- "ChatCompletionRequestAssistantMessageContentPart{chatCompletionContentPartRefusal=$chatCompletionContentPartRefusal}"
+ text != null -> "ChatCompletionRequestAssistantMessageContentPart{text=$text}"
+ refusal != null ->
+ "ChatCompletionRequestAssistantMessageContentPart{refusal=$refusal}"
_json != null ->
"ChatCompletionRequestAssistantMessageContentPart{_unknown=$_json}"
else ->
@@ -694,20 +680,12 @@ private constructor(
* [text inputs](https://platform.openai.com/docs/guides/text-generation).
*/
@JvmStatic
- fun ofChatCompletionContentPartText(
- chatCompletionContentPartText: ChatCompletionContentPartText
- ) =
- ChatCompletionRequestAssistantMessageContentPart(
- chatCompletionContentPartText = chatCompletionContentPartText
- )
+ fun ofText(text: ChatCompletionContentPartText) =
+ ChatCompletionRequestAssistantMessageContentPart(text = text)
@JvmStatic
- fun ofChatCompletionContentPartRefusal(
- chatCompletionContentPartRefusal: ChatCompletionContentPartRefusal
- ) =
- ChatCompletionRequestAssistantMessageContentPart(
- chatCompletionContentPartRefusal = chatCompletionContentPartRefusal
- )
+ fun ofRefusal(refusal: ChatCompletionContentPartRefusal) =
+ ChatCompletionRequestAssistantMessageContentPart(refusal = refusal)
}
interface Visitor {
@@ -716,13 +694,9 @@ private constructor(
* Learn about
* [text inputs](https://platform.openai.com/docs/guides/text-generation).
*/
- fun visitChatCompletionContentPartText(
- chatCompletionContentPartText: ChatCompletionContentPartText
- ): T
+ fun visitText(text: ChatCompletionContentPartText): T
- fun visitChatCompletionContentPartRefusal(
- chatCompletionContentPartRefusal: ChatCompletionContentPartRefusal
- ): T
+ fun visitRefusal(refusal: ChatCompletionContentPartRefusal): T
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException(
@@ -749,7 +723,7 @@ private constructor(
}
?.let {
return ChatCompletionRequestAssistantMessageContentPart(
- chatCompletionContentPartText = it,
+ text = it,
_json = json
)
}
@@ -763,7 +737,7 @@ private constructor(
}
?.let {
return ChatCompletionRequestAssistantMessageContentPart(
- chatCompletionContentPartRefusal = it,
+ refusal = it,
_json = json
)
}
@@ -785,10 +759,8 @@ private constructor(
provider: SerializerProvider
) {
when {
- value.chatCompletionContentPartText != null ->
- generator.writeObject(value.chatCompletionContentPartText)
- value.chatCompletionContentPartRefusal != null ->
- generator.writeObject(value.chatCompletionContentPartRefusal)
+ value.text != null -> generator.writeObject(value.text)
+ value.refusal != null -> generator.writeObject(value.refusal)
value._json != null -> generator.writeObject(value._json)
else ->
throw IllegalStateException(
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 2bcc088a5..5c0e1c488 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
@@ -23,55 +23,44 @@ import kotlin.jvm.optionals.getOrNull
@JsonSerialize(using = ChatCompletionContentPart.Serializer::class)
class ChatCompletionContentPart
private constructor(
- private val chatCompletionContentPartText: ChatCompletionContentPartText? = null,
- private val chatCompletionContentPartImage: ChatCompletionContentPartImage? = null,
- private val chatCompletionContentPartInputAudio: ChatCompletionContentPartInputAudio? = null,
+ private val text: ChatCompletionContentPartText? = null,
+ private val imageUrl: ChatCompletionContentPartImage? = null,
+ private val inputAudio: ChatCompletionContentPartInputAudio? = null,
private val _json: JsonValue? = null,
) {
/** Learn about [text inputs](https://platform.openai.com/docs/guides/text-generation). */
- fun chatCompletionContentPartText(): Optional =
- Optional.ofNullable(chatCompletionContentPartText)
+ fun text(): Optional = Optional.ofNullable(text)
/** Learn about [image inputs](https://platform.openai.com/docs/guides/vision). */
- fun chatCompletionContentPartImage(): Optional =
- Optional.ofNullable(chatCompletionContentPartImage)
+ fun imageUrl(): Optional = Optional.ofNullable(imageUrl)
/** Learn about [audio inputs](https://platform.openai.com/docs/guides/audio). */
- fun chatCompletionContentPartInputAudio(): Optional =
- Optional.ofNullable(chatCompletionContentPartInputAudio)
+ fun inputAudio(): Optional =
+ Optional.ofNullable(inputAudio)
- fun isChatCompletionContentPartText(): Boolean = chatCompletionContentPartText != null
+ fun isText(): Boolean = text != null
- fun isChatCompletionContentPartImage(): Boolean = chatCompletionContentPartImage != null
+ fun isImageUrl(): Boolean = imageUrl != null
- fun isChatCompletionContentPartInputAudio(): Boolean =
- chatCompletionContentPartInputAudio != null
+ fun isInputAudio(): Boolean = inputAudio != null
/** Learn about [text inputs](https://platform.openai.com/docs/guides/text-generation). */
- fun asChatCompletionContentPartText(): ChatCompletionContentPartText =
- chatCompletionContentPartText.getOrThrow("chatCompletionContentPartText")
+ fun asText(): ChatCompletionContentPartText = text.getOrThrow("text")
/** Learn about [image inputs](https://platform.openai.com/docs/guides/vision). */
- fun asChatCompletionContentPartImage(): ChatCompletionContentPartImage =
- chatCompletionContentPartImage.getOrThrow("chatCompletionContentPartImage")
+ fun asImageUrl(): ChatCompletionContentPartImage = imageUrl.getOrThrow("imageUrl")
/** Learn about [audio inputs](https://platform.openai.com/docs/guides/audio). */
- fun asChatCompletionContentPartInputAudio(): ChatCompletionContentPartInputAudio =
- chatCompletionContentPartInputAudio.getOrThrow("chatCompletionContentPartInputAudio")
+ fun asInputAudio(): ChatCompletionContentPartInputAudio = inputAudio.getOrThrow("inputAudio")
fun _json(): Optional = Optional.ofNullable(_json)
fun accept(visitor: Visitor): T {
return when {
- chatCompletionContentPartText != null ->
- visitor.visitChatCompletionContentPartText(chatCompletionContentPartText)
- chatCompletionContentPartImage != null ->
- visitor.visitChatCompletionContentPartImage(chatCompletionContentPartImage)
- chatCompletionContentPartInputAudio != null ->
- visitor.visitChatCompletionContentPartInputAudio(
- chatCompletionContentPartInputAudio
- )
+ text != null -> visitor.visitText(text)
+ imageUrl != null -> visitor.visitImageUrl(imageUrl)
+ inputAudio != null -> visitor.visitInputAudio(inputAudio)
else -> visitor.unknown(_json)
}
}
@@ -85,22 +74,16 @@ private constructor(
accept(
object : Visitor {
- override fun visitChatCompletionContentPartText(
- chatCompletionContentPartText: ChatCompletionContentPartText
- ) {
- chatCompletionContentPartText.validate()
+ override fun visitText(text: ChatCompletionContentPartText) {
+ text.validate()
}
- override fun visitChatCompletionContentPartImage(
- chatCompletionContentPartImage: ChatCompletionContentPartImage
- ) {
- chatCompletionContentPartImage.validate()
+ override fun visitImageUrl(imageUrl: ChatCompletionContentPartImage) {
+ imageUrl.validate()
}
- override fun visitChatCompletionContentPartInputAudio(
- chatCompletionContentPartInputAudio: ChatCompletionContentPartInputAudio
- ) {
- chatCompletionContentPartInputAudio.validate()
+ override fun visitInputAudio(inputAudio: ChatCompletionContentPartInputAudio) {
+ inputAudio.validate()
}
}
)
@@ -112,19 +95,16 @@ private constructor(
return true
}
- return /* spotless:off */ other is ChatCompletionContentPart && chatCompletionContentPartText == other.chatCompletionContentPartText && chatCompletionContentPartImage == other.chatCompletionContentPartImage && chatCompletionContentPartInputAudio == other.chatCompletionContentPartInputAudio /* spotless:on */
+ return /* spotless:off */ other is ChatCompletionContentPart && text == other.text && imageUrl == other.imageUrl && inputAudio == other.inputAudio /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(chatCompletionContentPartText, chatCompletionContentPartImage, chatCompletionContentPartInputAudio) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(text, imageUrl, inputAudio) /* spotless:on */
override fun toString(): String =
when {
- chatCompletionContentPartText != null ->
- "ChatCompletionContentPart{chatCompletionContentPartText=$chatCompletionContentPartText}"
- chatCompletionContentPartImage != null ->
- "ChatCompletionContentPart{chatCompletionContentPartImage=$chatCompletionContentPartImage}"
- chatCompletionContentPartInputAudio != null ->
- "ChatCompletionContentPart{chatCompletionContentPartInputAudio=$chatCompletionContentPartInputAudio}"
+ text != null -> "ChatCompletionContentPart{text=$text}"
+ imageUrl != null -> "ChatCompletionContentPart{imageUrl=$imageUrl}"
+ inputAudio != null -> "ChatCompletionContentPart{inputAudio=$inputAudio}"
_json != null -> "ChatCompletionContentPart{_unknown=$_json}"
else -> throw IllegalStateException("Invalid ChatCompletionContentPart")
}
@@ -133,45 +113,29 @@ private constructor(
/** Learn about [text inputs](https://platform.openai.com/docs/guides/text-generation). */
@JvmStatic
- fun ofChatCompletionContentPartText(
- chatCompletionContentPartText: ChatCompletionContentPartText
- ) = ChatCompletionContentPart(chatCompletionContentPartText = chatCompletionContentPartText)
+ fun ofText(text: ChatCompletionContentPartText) = ChatCompletionContentPart(text = text)
/** Learn about [image inputs](https://platform.openai.com/docs/guides/vision). */
@JvmStatic
- fun ofChatCompletionContentPartImage(
- chatCompletionContentPartImage: ChatCompletionContentPartImage
- ) =
- ChatCompletionContentPart(
- chatCompletionContentPartImage = chatCompletionContentPartImage
- )
+ fun ofImageUrl(imageUrl: ChatCompletionContentPartImage) =
+ ChatCompletionContentPart(imageUrl = imageUrl)
/** Learn about [audio inputs](https://platform.openai.com/docs/guides/audio). */
@JvmStatic
- fun ofChatCompletionContentPartInputAudio(
- chatCompletionContentPartInputAudio: ChatCompletionContentPartInputAudio
- ) =
- ChatCompletionContentPart(
- chatCompletionContentPartInputAudio = chatCompletionContentPartInputAudio
- )
+ fun ofInputAudio(inputAudio: ChatCompletionContentPartInputAudio) =
+ ChatCompletionContentPart(inputAudio = inputAudio)
}
interface Visitor {
/** Learn about [text inputs](https://platform.openai.com/docs/guides/text-generation). */
- fun visitChatCompletionContentPartText(
- chatCompletionContentPartText: ChatCompletionContentPartText
- ): T
+ fun visitText(text: ChatCompletionContentPartText): T
/** Learn about [image inputs](https://platform.openai.com/docs/guides/vision). */
- fun visitChatCompletionContentPartImage(
- chatCompletionContentPartImage: ChatCompletionContentPartImage
- ): T
+ fun visitImageUrl(imageUrl: ChatCompletionContentPartImage): T
/** Learn about [audio inputs](https://platform.openai.com/docs/guides/audio). */
- fun visitChatCompletionContentPartInputAudio(
- chatCompletionContentPartInputAudio: ChatCompletionContentPartInputAudio
- ): T
+ fun visitInputAudio(inputAudio: ChatCompletionContentPartInputAudio): T
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown ChatCompletionContentPart: $json")
@@ -191,10 +155,7 @@ private constructor(
it.validate()
}
?.let {
- return ChatCompletionContentPart(
- chatCompletionContentPartText = it,
- _json = json
- )
+ return ChatCompletionContentPart(text = it, _json = json)
}
}
"image_url" -> {
@@ -202,10 +163,7 @@ private constructor(
it.validate()
}
?.let {
- return ChatCompletionContentPart(
- chatCompletionContentPartImage = it,
- _json = json
- )
+ return ChatCompletionContentPart(imageUrl = it, _json = json)
}
}
"input_audio" -> {
@@ -213,10 +171,7 @@ private constructor(
it.validate()
}
?.let {
- return ChatCompletionContentPart(
- chatCompletionContentPartInputAudio = it,
- _json = json
- )
+ return ChatCompletionContentPart(inputAudio = it, _json = json)
}
}
}
@@ -233,12 +188,9 @@ private constructor(
provider: SerializerProvider
) {
when {
- value.chatCompletionContentPartText != null ->
- generator.writeObject(value.chatCompletionContentPartText)
- value.chatCompletionContentPartImage != null ->
- generator.writeObject(value.chatCompletionContentPartImage)
- value.chatCompletionContentPartInputAudio != null ->
- generator.writeObject(value.chatCompletionContentPartInputAudio)
+ value.text != null -> generator.writeObject(value.text)
+ value.imageUrl != null -> generator.writeObject(value.imageUrl)
+ value.inputAudio != null -> generator.writeObject(value.inputAudio)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid ChatCompletionContentPart")
}
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 d9c5cafb2..33439abf9 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
@@ -1364,50 +1364,29 @@ constructor(
* sent by the user. With o1 models and newer, `developer` messages replace the previous
* `system` messages.
*/
- fun addMessage(
- chatCompletionDeveloperMessageParam: ChatCompletionDeveloperMessageParam
- ) =
- addMessage(
- ChatCompletionMessageParam.ofChatCompletionDeveloperMessageParam(
- chatCompletionDeveloperMessageParam
- )
- )
+ fun addMessage(developer: ChatCompletionDeveloperMessageParam) =
+ addMessage(ChatCompletionMessageParam.ofDeveloper(developer))
/**
* Developer-provided instructions that the model should follow, regardless of messages
* sent by the user. With o1 models and newer, use `developer` messages for this purpose
* instead.
*/
- fun addMessage(chatCompletionSystemMessageParam: ChatCompletionSystemMessageParam) =
- addMessage(
- ChatCompletionMessageParam.ofChatCompletionSystemMessageParam(
- chatCompletionSystemMessageParam
- )
- )
+ fun addMessage(system: ChatCompletionSystemMessageParam) =
+ addMessage(ChatCompletionMessageParam.ofSystem(system))
/**
* Messages sent by an end user, containing prompts or additional context information.
*/
- fun addMessage(chatCompletionUserMessageParam: ChatCompletionUserMessageParam) =
- addMessage(
- ChatCompletionMessageParam.ofChatCompletionUserMessageParam(
- chatCompletionUserMessageParam
- )
- )
+ fun addMessage(user: ChatCompletionUserMessageParam) =
+ addMessage(ChatCompletionMessageParam.ofUser(user))
/** Messages sent by the model in response to user messages. */
- fun addMessage(
- chatCompletionAssistantMessageParam: ChatCompletionAssistantMessageParam
- ) =
- addMessage(
- ChatCompletionMessageParam.ofChatCompletionAssistantMessageParam(
- chatCompletionAssistantMessageParam
- )
- )
+ fun addMessage(assistant: ChatCompletionAssistantMessageParam) =
+ addMessage(ChatCompletionMessageParam.ofAssistant(assistant))
/** Messages sent by the model in response to user messages. */
- fun addMessage(chatCompletionAssistantMessageParam: ChatCompletionMessage) =
- addMessage(chatCompletionAssistantMessageParam.toParam())
+ fun addMessage(assistant: ChatCompletionMessage) = addMessage(assistant.toParam())
/**
* A list of messages comprising the conversation so far. Depending on the
@@ -1417,12 +1396,8 @@ constructor(
* [images](https://platform.openai.com/docs/guides/vision), and
* [audio](https://platform.openai.com/docs/guides/audio).
*/
- fun addMessage(chatCompletionToolMessageParam: ChatCompletionToolMessageParam) =
- addMessage(
- ChatCompletionMessageParam.ofChatCompletionToolMessageParam(
- chatCompletionToolMessageParam
- )
- )
+ fun addMessage(tool: ChatCompletionToolMessageParam) =
+ addMessage(ChatCompletionMessageParam.ofTool(tool))
/**
* A list of messages comprising the conversation so far. Depending on the
@@ -1433,12 +1408,8 @@ constructor(
* [audio](https://platform.openai.com/docs/guides/audio).
*/
@Deprecated("deprecated")
- fun addMessage(chatCompletionFunctionMessageParam: ChatCompletionFunctionMessageParam) =
- addMessage(
- ChatCompletionMessageParam.ofChatCompletionFunctionMessageParam(
- chatCompletionFunctionMessageParam
- )
- )
+ fun addMessage(function: ChatCompletionFunctionMessageParam) =
+ addMessage(ChatCompletionMessageParam.ofFunction(function))
/**
* ID of the model to use. See the
@@ -2019,8 +1990,8 @@ constructor(
* may be partially cut off if `finish_reason="length"`, which indicates the generation
* exceeded `max_tokens` or the conversation exceeded the max context length.
*/
- fun responseFormat(responseFormatText: ResponseFormatText) =
- responseFormat(ResponseFormat.ofResponseFormatText(responseFormatText))
+ fun responseFormat(text: ResponseFormatText) =
+ responseFormat(ResponseFormat.ofText(text))
/**
* An object specifying the format that the model must output.
@@ -2040,8 +2011,8 @@ constructor(
* may be partially cut off if `finish_reason="length"`, which indicates the generation
* exceeded `max_tokens` or the conversation exceeded the max context length.
*/
- fun responseFormat(responseFormatJsonObject: ResponseFormatJsonObject) =
- responseFormat(ResponseFormat.ofResponseFormatJsonObject(responseFormatJsonObject))
+ fun responseFormat(jsonObject: ResponseFormatJsonObject) =
+ responseFormat(ResponseFormat.ofJsonObject(jsonObject))
/**
* An object specifying the format that the model must output.
@@ -2061,8 +2032,8 @@ constructor(
* may be partially cut off if `finish_reason="length"`, which indicates the generation
* exceeded `max_tokens` or the conversation exceeded the max context length.
*/
- fun responseFormat(responseFormatJsonSchema: ResponseFormatJsonSchema) =
- responseFormat(ResponseFormat.ofResponseFormatJsonSchema(responseFormatJsonSchema))
+ fun responseFormat(jsonSchema: ResponseFormatJsonSchema) =
+ responseFormat(ResponseFormat.ofJsonSchema(jsonSchema))
/**
* This feature is in Beta. If specified, our system will make a best effort to sample
@@ -2268,12 +2239,8 @@ constructor(
* Specifies a tool the model should use. Use to force the model to call a specific
* function.
*/
- fun toolChoice(chatCompletionNamedToolChoice: ChatCompletionNamedToolChoice) =
- toolChoice(
- ChatCompletionToolChoiceOption.ofChatCompletionNamedToolChoice(
- chatCompletionNamedToolChoice
- )
- )
+ fun toolChoice(namedToolChoice: ChatCompletionNamedToolChoice) =
+ toolChoice(ChatCompletionToolChoiceOption.ofNamedToolChoice(namedToolChoice))
/**
* A list of tools the model may call. Currently, only functions are supported as a
@@ -2520,34 +2487,26 @@ constructor(
* by the user. With o1 models and newer, `developer` messages replace the previous `system`
* messages.
*/
- fun addMessage(chatCompletionDeveloperMessageParam: ChatCompletionDeveloperMessageParam) =
- apply {
- body.addMessage(chatCompletionDeveloperMessageParam)
- }
+ fun addMessage(developer: ChatCompletionDeveloperMessageParam) = apply {
+ body.addMessage(developer)
+ }
/**
* Developer-provided instructions that the model should follow, regardless of messages sent
* by the user. With o1 models and newer, use `developer` messages for this purpose instead.
*/
- fun addMessage(chatCompletionSystemMessageParam: ChatCompletionSystemMessageParam) = apply {
- body.addMessage(chatCompletionSystemMessageParam)
- }
+ fun addMessage(system: ChatCompletionSystemMessageParam) = apply { body.addMessage(system) }
/** Messages sent by an end user, containing prompts or additional context information. */
- fun addMessage(chatCompletionUserMessageParam: ChatCompletionUserMessageParam) = apply {
- body.addMessage(chatCompletionUserMessageParam)
- }
+ fun addMessage(user: ChatCompletionUserMessageParam) = apply { body.addMessage(user) }
/** Messages sent by the model in response to user messages. */
- fun addMessage(chatCompletionAssistantMessageParam: ChatCompletionAssistantMessageParam) =
- apply {
- body.addMessage(chatCompletionAssistantMessageParam)
- }
+ fun addMessage(assistant: ChatCompletionAssistantMessageParam) = apply {
+ body.addMessage(assistant)
+ }
/** Messages sent by the model in response to user messages. */
- fun addMessage(chatCompletionAssistantMessageParam: ChatCompletionMessage) = apply {
- body.addMessage(chatCompletionAssistantMessageParam)
- }
+ fun addMessage(assistant: ChatCompletionMessage) = apply { body.addMessage(assistant) }
/**
* A list of messages comprising the conversation so far. Depending on the
@@ -2557,9 +2516,7 @@ constructor(
* [images](https://platform.openai.com/docs/guides/vision), and
* [audio](https://platform.openai.com/docs/guides/audio).
*/
- fun addMessage(chatCompletionToolMessageParam: ChatCompletionToolMessageParam) = apply {
- body.addMessage(chatCompletionToolMessageParam)
- }
+ fun addMessage(tool: ChatCompletionToolMessageParam) = apply { body.addMessage(tool) }
/**
* A list of messages comprising the conversation so far. Depending on the
@@ -2570,10 +2527,9 @@ constructor(
* [audio](https://platform.openai.com/docs/guides/audio).
*/
@Deprecated("deprecated")
- fun addMessage(chatCompletionFunctionMessageParam: ChatCompletionFunctionMessageParam) =
- apply {
- body.addMessage(chatCompletionFunctionMessageParam)
- }
+ fun addMessage(function: ChatCompletionFunctionMessageParam) = apply {
+ body.addMessage(function)
+ }
/**
* ID of the model to use. See the
@@ -3124,9 +3080,7 @@ constructor(
* partially cut off if `finish_reason="length"`, which indicates the generation exceeded
* `max_tokens` or the conversation exceeded the max context length.
*/
- fun responseFormat(responseFormatText: ResponseFormatText) = apply {
- body.responseFormat(responseFormatText)
- }
+ fun responseFormat(text: ResponseFormatText) = apply { body.responseFormat(text) }
/**
* An object specifying the format that the model must output.
@@ -3145,8 +3099,8 @@ constructor(
* partially cut off if `finish_reason="length"`, which indicates the generation exceeded
* `max_tokens` or the conversation exceeded the max context length.
*/
- fun responseFormat(responseFormatJsonObject: ResponseFormatJsonObject) = apply {
- body.responseFormat(responseFormatJsonObject)
+ fun responseFormat(jsonObject: ResponseFormatJsonObject) = apply {
+ body.responseFormat(jsonObject)
}
/**
@@ -3166,8 +3120,8 @@ constructor(
* partially cut off if `finish_reason="length"`, which indicates the generation exceeded
* `max_tokens` or the conversation exceeded the max context length.
*/
- fun responseFormat(responseFormatJsonSchema: ResponseFormatJsonSchema) = apply {
- body.responseFormat(responseFormatJsonSchema)
+ fun responseFormat(jsonSchema: ResponseFormatJsonSchema) = apply {
+ body.responseFormat(jsonSchema)
}
/**
@@ -3371,8 +3325,8 @@ constructor(
* Specifies a tool the model should use. Use to force the model to call a specific
* function.
*/
- fun toolChoice(chatCompletionNamedToolChoice: ChatCompletionNamedToolChoice) = apply {
- body.toolChoice(chatCompletionNamedToolChoice)
+ fun toolChoice(namedToolChoice: ChatCompletionNamedToolChoice) = apply {
+ body.toolChoice(namedToolChoice)
}
/**
@@ -4229,45 +4183,37 @@ constructor(
@JsonSerialize(using = ResponseFormat.Serializer::class)
class ResponseFormat
private constructor(
- private val responseFormatText: ResponseFormatText? = null,
- private val responseFormatJsonObject: ResponseFormatJsonObject? = null,
- private val responseFormatJsonSchema: ResponseFormatJsonSchema? = null,
+ private val text: ResponseFormatText? = null,
+ private val jsonObject: ResponseFormatJsonObject? = null,
+ private val jsonSchema: ResponseFormatJsonSchema? = null,
private val _json: JsonValue? = null,
) {
- fun responseFormatText(): Optional =
- Optional.ofNullable(responseFormatText)
+ fun text(): Optional = Optional.ofNullable(text)
- fun responseFormatJsonObject(): Optional =
- Optional.ofNullable(responseFormatJsonObject)
+ fun jsonObject(): Optional = Optional.ofNullable(jsonObject)
- fun responseFormatJsonSchema(): Optional =
- Optional.ofNullable(responseFormatJsonSchema)
+ fun jsonSchema(): Optional = Optional.ofNullable(jsonSchema)
- fun isResponseFormatText(): Boolean = responseFormatText != null
+ fun isText(): Boolean = text != null
- fun isResponseFormatJsonObject(): Boolean = responseFormatJsonObject != null
+ fun isJsonObject(): Boolean = jsonObject != null
- fun isResponseFormatJsonSchema(): Boolean = responseFormatJsonSchema != null
+ fun isJsonSchema(): Boolean = jsonSchema != null
- fun asResponseFormatText(): ResponseFormatText =
- responseFormatText.getOrThrow("responseFormatText")
+ fun asText(): ResponseFormatText = text.getOrThrow("text")
- fun asResponseFormatJsonObject(): ResponseFormatJsonObject =
- responseFormatJsonObject.getOrThrow("responseFormatJsonObject")
+ fun asJsonObject(): ResponseFormatJsonObject = jsonObject.getOrThrow("jsonObject")
- fun asResponseFormatJsonSchema(): ResponseFormatJsonSchema =
- responseFormatJsonSchema.getOrThrow("responseFormatJsonSchema")
+ fun asJsonSchema(): ResponseFormatJsonSchema = jsonSchema.getOrThrow("jsonSchema")
fun _json(): Optional = Optional.ofNullable(_json)
fun accept(visitor: Visitor): T {
return when {
- responseFormatText != null -> visitor.visitResponseFormatText(responseFormatText)
- responseFormatJsonObject != null ->
- visitor.visitResponseFormatJsonObject(responseFormatJsonObject)
- responseFormatJsonSchema != null ->
- visitor.visitResponseFormatJsonSchema(responseFormatJsonSchema)
+ text != null -> visitor.visitText(text)
+ jsonObject != null -> visitor.visitJsonObject(jsonObject)
+ jsonSchema != null -> visitor.visitJsonSchema(jsonSchema)
else -> visitor.unknown(_json)
}
}
@@ -4281,20 +4227,16 @@ constructor(
accept(
object : Visitor {
- override fun visitResponseFormatText(responseFormatText: ResponseFormatText) {
- responseFormatText.validate()
+ override fun visitText(text: ResponseFormatText) {
+ text.validate()
}
- override fun visitResponseFormatJsonObject(
- responseFormatJsonObject: ResponseFormatJsonObject
- ) {
- responseFormatJsonObject.validate()
+ override fun visitJsonObject(jsonObject: ResponseFormatJsonObject) {
+ jsonObject.validate()
}
- override fun visitResponseFormatJsonSchema(
- responseFormatJsonSchema: ResponseFormatJsonSchema
- ) {
- responseFormatJsonSchema.validate()
+ override fun visitJsonSchema(jsonSchema: ResponseFormatJsonSchema) {
+ jsonSchema.validate()
}
}
)
@@ -4306,45 +4248,40 @@ constructor(
return true
}
- return /* spotless:off */ other is ResponseFormat && responseFormatText == other.responseFormatText && responseFormatJsonObject == other.responseFormatJsonObject && responseFormatJsonSchema == other.responseFormatJsonSchema /* spotless:on */
+ return /* spotless:off */ other is ResponseFormat && text == other.text && jsonObject == other.jsonObject && jsonSchema == other.jsonSchema /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(responseFormatText, responseFormatJsonObject, responseFormatJsonSchema) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(text, jsonObject, jsonSchema) /* spotless:on */
override fun toString(): String =
when {
- responseFormatText != null ->
- "ResponseFormat{responseFormatText=$responseFormatText}"
- responseFormatJsonObject != null ->
- "ResponseFormat{responseFormatJsonObject=$responseFormatJsonObject}"
- responseFormatJsonSchema != null ->
- "ResponseFormat{responseFormatJsonSchema=$responseFormatJsonSchema}"
+ text != null -> "ResponseFormat{text=$text}"
+ jsonObject != null -> "ResponseFormat{jsonObject=$jsonObject}"
+ jsonSchema != null -> "ResponseFormat{jsonSchema=$jsonSchema}"
_json != null -> "ResponseFormat{_unknown=$_json}"
else -> throw IllegalStateException("Invalid ResponseFormat")
}
companion object {
- @JvmStatic
- fun ofResponseFormatText(responseFormatText: ResponseFormatText) =
- ResponseFormat(responseFormatText = responseFormatText)
+ @JvmStatic fun ofText(text: ResponseFormatText) = ResponseFormat(text = text)
@JvmStatic
- fun ofResponseFormatJsonObject(responseFormatJsonObject: ResponseFormatJsonObject) =
- ResponseFormat(responseFormatJsonObject = responseFormatJsonObject)
+ fun ofJsonObject(jsonObject: ResponseFormatJsonObject) =
+ ResponseFormat(jsonObject = jsonObject)
@JvmStatic
- fun ofResponseFormatJsonSchema(responseFormatJsonSchema: ResponseFormatJsonSchema) =
- ResponseFormat(responseFormatJsonSchema = responseFormatJsonSchema)
+ fun ofJsonSchema(jsonSchema: ResponseFormatJsonSchema) =
+ ResponseFormat(jsonSchema = jsonSchema)
}
interface Visitor {
- fun visitResponseFormatText(responseFormatText: ResponseFormatText): T
+ fun visitText(text: ResponseFormatText): T
- fun visitResponseFormatJsonObject(responseFormatJsonObject: ResponseFormatJsonObject): T
+ fun visitJsonObject(jsonObject: ResponseFormatJsonObject): T
- fun visitResponseFormatJsonSchema(responseFormatJsonSchema: ResponseFormatJsonSchema): T
+ fun visitJsonSchema(jsonSchema: ResponseFormatJsonSchema): T
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown ResponseFormat: $json")
@@ -4358,15 +4295,15 @@ constructor(
tryDeserialize(node, jacksonTypeRef()) { it.validate() }
?.let {
- return ResponseFormat(responseFormatText = it, _json = json)
+ return ResponseFormat(text = it, _json = json)
}
tryDeserialize(node, jacksonTypeRef()) { it.validate() }
?.let {
- return ResponseFormat(responseFormatJsonObject = it, _json = json)
+ return ResponseFormat(jsonObject = it, _json = json)
}
tryDeserialize(node, jacksonTypeRef()) { it.validate() }
?.let {
- return ResponseFormat(responseFormatJsonSchema = it, _json = json)
+ return ResponseFormat(jsonSchema = it, _json = json)
}
return ResponseFormat(_json = json)
@@ -4381,12 +4318,9 @@ constructor(
provider: SerializerProvider
) {
when {
- value.responseFormatText != null ->
- generator.writeObject(value.responseFormatText)
- value.responseFormatJsonObject != null ->
- generator.writeObject(value.responseFormatJsonObject)
- value.responseFormatJsonSchema != null ->
- generator.writeObject(value.responseFormatJsonSchema)
+ value.text != null -> generator.writeObject(value.text)
+ value.jsonObject != null -> generator.writeObject(value.jsonObject)
+ value.jsonSchema != null -> generator.writeObject(value.jsonSchema)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid ResponseFormat")
}
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 a0615d2a2..a6289520b 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
@@ -118,7 +118,7 @@ private constructor(
fun content(content: JsonField) = apply { this.content = content }
/** The contents of the developer message. */
- fun content(textContent: String) = content(Content.ofTextContent(textContent))
+ fun content(text: String) = content(Content.ofText(text))
/**
* An array of content parts with a defined type. For developer messages, only type `text`
@@ -175,13 +175,13 @@ private constructor(
@JsonSerialize(using = Content.Serializer::class)
class Content
private constructor(
- private val textContent: String? = null,
+ private val text: String? = null,
private val arrayOfContentParts: List? = null,
private val _json: JsonValue? = null,
) {
/** The contents of the developer message. */
- fun textContent(): Optional = Optional.ofNullable(textContent)
+ fun text(): Optional = Optional.ofNullable(text)
/**
* An array of content parts with a defined type. For developer messages, only type `text`
@@ -190,12 +190,12 @@ private constructor(
fun arrayOfContentParts(): Optional> =
Optional.ofNullable(arrayOfContentParts)
- fun isTextContent(): Boolean = textContent != null
+ fun isText(): Boolean = text != null
fun isArrayOfContentParts(): Boolean = arrayOfContentParts != null
/** The contents of the developer message. */
- fun asTextContent(): String = textContent.getOrThrow("textContent")
+ fun asText(): String = text.getOrThrow("text")
/**
* An array of content parts with a defined type. For developer messages, only type `text`
@@ -208,7 +208,7 @@ private constructor(
fun accept(visitor: Visitor): T {
return when {
- textContent != null -> visitor.visitTextContent(textContent)
+ text != null -> visitor.visitText(text)
arrayOfContentParts != null -> visitor.visitArrayOfContentParts(arrayOfContentParts)
else -> visitor.unknown(_json)
}
@@ -223,7 +223,7 @@ private constructor(
accept(
object : Visitor {
- override fun visitTextContent(textContent: String) {}
+ override fun visitText(text: String) {}
override fun visitArrayOfContentParts(
arrayOfContentParts: List
@@ -240,14 +240,14 @@ private constructor(
return true
}
- return /* spotless:off */ other is Content && textContent == other.textContent && arrayOfContentParts == other.arrayOfContentParts /* spotless:on */
+ return /* spotless:off */ other is Content && text == other.text && arrayOfContentParts == other.arrayOfContentParts /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(textContent, arrayOfContentParts) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(text, arrayOfContentParts) /* spotless:on */
override fun toString(): String =
when {
- textContent != null -> "Content{textContent=$textContent}"
+ text != null -> "Content{text=$text}"
arrayOfContentParts != null -> "Content{arrayOfContentParts=$arrayOfContentParts}"
_json != null -> "Content{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Content")
@@ -256,7 +256,7 @@ private constructor(
companion object {
/** The contents of the developer message. */
- @JvmStatic fun ofTextContent(textContent: String) = Content(textContent = textContent)
+ @JvmStatic fun ofText(text: String) = Content(text = text)
/**
* An array of content parts with a defined type. For developer messages, only type
@@ -270,7 +270,7 @@ private constructor(
interface Visitor {
/** The contents of the developer message. */
- fun visitTextContent(textContent: String): T
+ fun visitText(text: String): T
/**
* An array of content parts with a defined type. For developer messages, only type
@@ -291,7 +291,7 @@ private constructor(
val json = JsonValue.fromJsonNode(node)
tryDeserialize(node, jacksonTypeRef())?.let {
- return Content(textContent = it, _json = json)
+ return Content(text = it, _json = json)
}
tryDeserialize(node, jacksonTypeRef>()) {
it.forEach { it.validate() }
@@ -312,7 +312,7 @@ private constructor(
provider: SerializerProvider
) {
when {
- value.textContent != null -> generator.writeObject(value.textContent)
+ value.text != null -> generator.writeObject(value.text)
value.arrayOfContentParts != null ->
generator.writeObject(value.arrayOfContentParts)
value._json != null -> generator.writeObject(value._json)
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 3216cf313..e02911691 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
@@ -106,9 +106,7 @@ private constructor(
ChatCompletionAssistantMessageParam.Audio.builder().id(it._id()).build()
}
)
- .content(
- _content().map { ChatCompletionAssistantMessageParam.Content.ofTextContent(it) }
- )
+ .content(_content().map { ChatCompletionAssistantMessageParam.Content.ofText(it) })
.functionCall(
_functionCall().map {
ChatCompletionAssistantMessageParam.FunctionCall.builder()
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 f737a7cd6..a4dfa45f5 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
@@ -26,12 +26,12 @@ import kotlin.jvm.optionals.getOrNull
@JsonSerialize(using = ChatCompletionMessageParam.Serializer::class)
class ChatCompletionMessageParam
private constructor(
- private val chatCompletionDeveloperMessageParam: ChatCompletionDeveloperMessageParam? = null,
- private val chatCompletionSystemMessageParam: ChatCompletionSystemMessageParam? = null,
- private val chatCompletionUserMessageParam: ChatCompletionUserMessageParam? = null,
- private val chatCompletionAssistantMessageParam: ChatCompletionAssistantMessageParam? = null,
- private val chatCompletionToolMessageParam: ChatCompletionToolMessageParam? = null,
- private val chatCompletionFunctionMessageParam: ChatCompletionFunctionMessageParam? = null,
+ private val developer: ChatCompletionDeveloperMessageParam? = null,
+ private val system: ChatCompletionSystemMessageParam? = null,
+ private val user: ChatCompletionUserMessageParam? = null,
+ private val assistant: ChatCompletionAssistantMessageParam? = null,
+ private val tool: ChatCompletionToolMessageParam? = null,
+ private val function: ChatCompletionFunctionMessageParam? = null,
private val _json: JsonValue? = null,
) {
@@ -40,96 +40,71 @@ private constructor(
* the user. With o1 models and newer, `developer` messages replace the previous `system`
* messages.
*/
- fun chatCompletionDeveloperMessageParam(): Optional =
- Optional.ofNullable(chatCompletionDeveloperMessageParam)
+ fun developer(): Optional = Optional.ofNullable(developer)
/**
* Developer-provided instructions that the model should follow, regardless of messages sent by
* the user. With o1 models and newer, use `developer` messages for this purpose instead.
*/
- fun chatCompletionSystemMessageParam(): Optional =
- Optional.ofNullable(chatCompletionSystemMessageParam)
+ fun system(): Optional = Optional.ofNullable(system)
/** Messages sent by an end user, containing prompts or additional context information. */
- fun chatCompletionUserMessageParam(): Optional =
- Optional.ofNullable(chatCompletionUserMessageParam)
+ fun user(): Optional = Optional.ofNullable(user)
/** Messages sent by the model in response to user messages. */
- fun chatCompletionAssistantMessageParam(): Optional =
- Optional.ofNullable(chatCompletionAssistantMessageParam)
+ fun assistant(): Optional = Optional.ofNullable(assistant)
- fun chatCompletionToolMessageParam(): Optional =
- Optional.ofNullable(chatCompletionToolMessageParam)
+ fun tool(): Optional = Optional.ofNullable(tool)
@Deprecated("deprecated")
- fun chatCompletionFunctionMessageParam(): Optional =
- Optional.ofNullable(chatCompletionFunctionMessageParam)
+ fun function(): Optional = Optional.ofNullable(function)
- fun isChatCompletionDeveloperMessageParam(): Boolean =
- chatCompletionDeveloperMessageParam != null
+ fun isDeveloper(): Boolean = developer != null
- fun isChatCompletionSystemMessageParam(): Boolean = chatCompletionSystemMessageParam != null
+ fun isSystem(): Boolean = system != null
- fun isChatCompletionUserMessageParam(): Boolean = chatCompletionUserMessageParam != null
+ fun isUser(): Boolean = user != null
- fun isChatCompletionAssistantMessageParam(): Boolean =
- chatCompletionAssistantMessageParam != null
+ fun isAssistant(): Boolean = assistant != null
- fun isChatCompletionToolMessageParam(): Boolean = chatCompletionToolMessageParam != null
+ fun isTool(): Boolean = tool != null
- @Deprecated("deprecated")
- fun isChatCompletionFunctionMessageParam(): Boolean = chatCompletionFunctionMessageParam != null
+ @Deprecated("deprecated") fun isFunction(): Boolean = function != null
/**
* Developer-provided instructions that the model should follow, regardless of messages sent by
* the user. With o1 models and newer, `developer` messages replace the previous `system`
* messages.
*/
- fun asChatCompletionDeveloperMessageParam(): ChatCompletionDeveloperMessageParam =
- chatCompletionDeveloperMessageParam.getOrThrow("chatCompletionDeveloperMessageParam")
+ fun asDeveloper(): ChatCompletionDeveloperMessageParam = developer.getOrThrow("developer")
/**
* Developer-provided instructions that the model should follow, regardless of messages sent by
* the user. With o1 models and newer, use `developer` messages for this purpose instead.
*/
- fun asChatCompletionSystemMessageParam(): ChatCompletionSystemMessageParam =
- chatCompletionSystemMessageParam.getOrThrow("chatCompletionSystemMessageParam")
+ fun asSystem(): ChatCompletionSystemMessageParam = system.getOrThrow("system")
/** Messages sent by an end user, containing prompts or additional context information. */
- fun asChatCompletionUserMessageParam(): ChatCompletionUserMessageParam =
- chatCompletionUserMessageParam.getOrThrow("chatCompletionUserMessageParam")
+ fun asUser(): ChatCompletionUserMessageParam = user.getOrThrow("user")
/** Messages sent by the model in response to user messages. */
- fun asChatCompletionAssistantMessageParam(): ChatCompletionAssistantMessageParam =
- chatCompletionAssistantMessageParam.getOrThrow("chatCompletionAssistantMessageParam")
+ fun asAssistant(): ChatCompletionAssistantMessageParam = assistant.getOrThrow("assistant")
- fun asChatCompletionToolMessageParam(): ChatCompletionToolMessageParam =
- chatCompletionToolMessageParam.getOrThrow("chatCompletionToolMessageParam")
+ fun asTool(): ChatCompletionToolMessageParam = tool.getOrThrow("tool")
@Deprecated("deprecated")
- fun asChatCompletionFunctionMessageParam(): ChatCompletionFunctionMessageParam =
- chatCompletionFunctionMessageParam.getOrThrow("chatCompletionFunctionMessageParam")
+ fun asFunction(): ChatCompletionFunctionMessageParam = function.getOrThrow("function")
fun _json(): Optional = Optional.ofNullable(_json)
fun accept(visitor: Visitor): T {
return when {
- chatCompletionDeveloperMessageParam != null ->
- visitor.visitChatCompletionDeveloperMessageParam(
- chatCompletionDeveloperMessageParam
- )
- chatCompletionSystemMessageParam != null ->
- visitor.visitChatCompletionSystemMessageParam(chatCompletionSystemMessageParam)
- chatCompletionUserMessageParam != null ->
- visitor.visitChatCompletionUserMessageParam(chatCompletionUserMessageParam)
- chatCompletionAssistantMessageParam != null ->
- visitor.visitChatCompletionAssistantMessageParam(
- chatCompletionAssistantMessageParam
- )
- chatCompletionToolMessageParam != null ->
- visitor.visitChatCompletionToolMessageParam(chatCompletionToolMessageParam)
- chatCompletionFunctionMessageParam != null ->
- visitor.visitChatCompletionFunctionMessageParam(chatCompletionFunctionMessageParam)
+ developer != null -> visitor.visitDeveloper(developer)
+ system != null -> visitor.visitSystem(system)
+ user != null -> visitor.visitUser(user)
+ assistant != null -> visitor.visitAssistant(assistant)
+ tool != null -> visitor.visitTool(tool)
+ function != null -> visitor.visitFunction(function)
else -> visitor.unknown(_json)
}
}
@@ -143,40 +118,28 @@ private constructor(
accept(
object : Visitor {
- override fun visitChatCompletionDeveloperMessageParam(
- chatCompletionDeveloperMessageParam: ChatCompletionDeveloperMessageParam
- ) {
- chatCompletionDeveloperMessageParam.validate()
+ override fun visitDeveloper(developer: ChatCompletionDeveloperMessageParam) {
+ developer.validate()
}
- override fun visitChatCompletionSystemMessageParam(
- chatCompletionSystemMessageParam: ChatCompletionSystemMessageParam
- ) {
- chatCompletionSystemMessageParam.validate()
+ override fun visitSystem(system: ChatCompletionSystemMessageParam) {
+ system.validate()
}
- override fun visitChatCompletionUserMessageParam(
- chatCompletionUserMessageParam: ChatCompletionUserMessageParam
- ) {
- chatCompletionUserMessageParam.validate()
+ override fun visitUser(user: ChatCompletionUserMessageParam) {
+ user.validate()
}
- override fun visitChatCompletionAssistantMessageParam(
- chatCompletionAssistantMessageParam: ChatCompletionAssistantMessageParam
- ) {
- chatCompletionAssistantMessageParam.validate()
+ override fun visitAssistant(assistant: ChatCompletionAssistantMessageParam) {
+ assistant.validate()
}
- override fun visitChatCompletionToolMessageParam(
- chatCompletionToolMessageParam: ChatCompletionToolMessageParam
- ) {
- chatCompletionToolMessageParam.validate()
+ override fun visitTool(tool: ChatCompletionToolMessageParam) {
+ tool.validate()
}
- override fun visitChatCompletionFunctionMessageParam(
- chatCompletionFunctionMessageParam: ChatCompletionFunctionMessageParam
- ) {
- chatCompletionFunctionMessageParam.validate()
+ override fun visitFunction(function: ChatCompletionFunctionMessageParam) {
+ function.validate()
}
}
)
@@ -188,25 +151,19 @@ private constructor(
return true
}
- return /* spotless:off */ other is ChatCompletionMessageParam && chatCompletionDeveloperMessageParam == other.chatCompletionDeveloperMessageParam && chatCompletionSystemMessageParam == other.chatCompletionSystemMessageParam && chatCompletionUserMessageParam == other.chatCompletionUserMessageParam && chatCompletionAssistantMessageParam == other.chatCompletionAssistantMessageParam && chatCompletionToolMessageParam == other.chatCompletionToolMessageParam && chatCompletionFunctionMessageParam == other.chatCompletionFunctionMessageParam /* spotless:on */
+ return /* spotless:off */ other is ChatCompletionMessageParam && developer == other.developer && system == other.system && user == other.user && assistant == other.assistant && tool == other.tool && function == other.function /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(chatCompletionDeveloperMessageParam, chatCompletionSystemMessageParam, chatCompletionUserMessageParam, chatCompletionAssistantMessageParam, chatCompletionToolMessageParam, chatCompletionFunctionMessageParam) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(developer, system, user, assistant, tool, function) /* spotless:on */
override fun toString(): String =
when {
- chatCompletionDeveloperMessageParam != null ->
- "ChatCompletionMessageParam{chatCompletionDeveloperMessageParam=$chatCompletionDeveloperMessageParam}"
- chatCompletionSystemMessageParam != null ->
- "ChatCompletionMessageParam{chatCompletionSystemMessageParam=$chatCompletionSystemMessageParam}"
- chatCompletionUserMessageParam != null ->
- "ChatCompletionMessageParam{chatCompletionUserMessageParam=$chatCompletionUserMessageParam}"
- chatCompletionAssistantMessageParam != null ->
- "ChatCompletionMessageParam{chatCompletionAssistantMessageParam=$chatCompletionAssistantMessageParam}"
- chatCompletionToolMessageParam != null ->
- "ChatCompletionMessageParam{chatCompletionToolMessageParam=$chatCompletionToolMessageParam}"
- chatCompletionFunctionMessageParam != null ->
- "ChatCompletionMessageParam{chatCompletionFunctionMessageParam=$chatCompletionFunctionMessageParam}"
+ developer != null -> "ChatCompletionMessageParam{developer=$developer}"
+ system != null -> "ChatCompletionMessageParam{system=$system}"
+ user != null -> "ChatCompletionMessageParam{user=$user}"
+ assistant != null -> "ChatCompletionMessageParam{assistant=$assistant}"
+ tool != null -> "ChatCompletionMessageParam{tool=$tool}"
+ function != null -> "ChatCompletionMessageParam{function=$function}"
_json != null -> "ChatCompletionMessageParam{_unknown=$_json}"
else -> throw IllegalStateException("Invalid ChatCompletionMessageParam")
}
@@ -219,59 +176,33 @@ private constructor(
* messages.
*/
@JvmStatic
- fun ofChatCompletionDeveloperMessageParam(
- chatCompletionDeveloperMessageParam: ChatCompletionDeveloperMessageParam
- ) =
- ChatCompletionMessageParam(
- chatCompletionDeveloperMessageParam = chatCompletionDeveloperMessageParam
- )
+ fun ofDeveloper(developer: ChatCompletionDeveloperMessageParam) =
+ ChatCompletionMessageParam(developer = developer)
/**
* Developer-provided instructions that the model should follow, regardless of messages sent
* by the user. With o1 models and newer, use `developer` messages for this purpose instead.
*/
@JvmStatic
- fun ofChatCompletionSystemMessageParam(
- chatCompletionSystemMessageParam: ChatCompletionSystemMessageParam
- ) =
- ChatCompletionMessageParam(
- chatCompletionSystemMessageParam = chatCompletionSystemMessageParam
- )
+ fun ofSystem(system: ChatCompletionSystemMessageParam) =
+ ChatCompletionMessageParam(system = system)
/** Messages sent by an end user, containing prompts or additional context information. */
@JvmStatic
- fun ofChatCompletionUserMessageParam(
- chatCompletionUserMessageParam: ChatCompletionUserMessageParam
- ) =
- ChatCompletionMessageParam(
- chatCompletionUserMessageParam = chatCompletionUserMessageParam
- )
+ fun ofUser(user: ChatCompletionUserMessageParam) = ChatCompletionMessageParam(user = user)
/** Messages sent by the model in response to user messages. */
@JvmStatic
- fun ofChatCompletionAssistantMessageParam(
- chatCompletionAssistantMessageParam: ChatCompletionAssistantMessageParam
- ) =
- ChatCompletionMessageParam(
- chatCompletionAssistantMessageParam = chatCompletionAssistantMessageParam
- )
+ fun ofAssistant(assistant: ChatCompletionAssistantMessageParam) =
+ ChatCompletionMessageParam(assistant = assistant)
@JvmStatic
- fun ofChatCompletionToolMessageParam(
- chatCompletionToolMessageParam: ChatCompletionToolMessageParam
- ) =
- ChatCompletionMessageParam(
- chatCompletionToolMessageParam = chatCompletionToolMessageParam
- )
+ fun ofTool(tool: ChatCompletionToolMessageParam) = ChatCompletionMessageParam(tool = tool)
@Deprecated("deprecated")
@JvmStatic
- fun ofChatCompletionFunctionMessageParam(
- chatCompletionFunctionMessageParam: ChatCompletionFunctionMessageParam
- ) =
- ChatCompletionMessageParam(
- chatCompletionFunctionMessageParam = chatCompletionFunctionMessageParam
- )
+ fun ofFunction(function: ChatCompletionFunctionMessageParam) =
+ ChatCompletionMessageParam(function = function)
}
interface Visitor {
@@ -281,36 +212,23 @@ private constructor(
* by the user. With o1 models and newer, `developer` messages replace the previous `system`
* messages.
*/
- fun visitChatCompletionDeveloperMessageParam(
- chatCompletionDeveloperMessageParam: ChatCompletionDeveloperMessageParam
- ): T
+ fun visitDeveloper(developer: ChatCompletionDeveloperMessageParam): T
/**
* Developer-provided instructions that the model should follow, regardless of messages sent
* by the user. With o1 models and newer, use `developer` messages for this purpose instead.
*/
- fun visitChatCompletionSystemMessageParam(
- chatCompletionSystemMessageParam: ChatCompletionSystemMessageParam
- ): T
+ fun visitSystem(system: ChatCompletionSystemMessageParam): T
/** Messages sent by an end user, containing prompts or additional context information. */
- fun visitChatCompletionUserMessageParam(
- chatCompletionUserMessageParam: ChatCompletionUserMessageParam
- ): T
+ fun visitUser(user: ChatCompletionUserMessageParam): T
/** Messages sent by the model in response to user messages. */
- fun visitChatCompletionAssistantMessageParam(
- chatCompletionAssistantMessageParam: ChatCompletionAssistantMessageParam
- ): T
+ fun visitAssistant(assistant: ChatCompletionAssistantMessageParam): T
- fun visitChatCompletionToolMessageParam(
- chatCompletionToolMessageParam: ChatCompletionToolMessageParam
- ): T
+ fun visitTool(tool: ChatCompletionToolMessageParam): T
- @Deprecated("deprecated")
- fun visitChatCompletionFunctionMessageParam(
- chatCompletionFunctionMessageParam: ChatCompletionFunctionMessageParam
- ): T
+ @Deprecated("deprecated") fun visitFunction(function: ChatCompletionFunctionMessageParam): T
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown ChatCompletionMessageParam: $json")
@@ -330,10 +248,7 @@ private constructor(
it.validate()
}
?.let {
- return ChatCompletionMessageParam(
- chatCompletionDeveloperMessageParam = it,
- _json = json
- )
+ return ChatCompletionMessageParam(developer = it, _json = json)
}
}
"system" -> {
@@ -341,10 +256,7 @@ private constructor(
it.validate()
}
?.let {
- return ChatCompletionMessageParam(
- chatCompletionSystemMessageParam = it,
- _json = json
- )
+ return ChatCompletionMessageParam(system = it, _json = json)
}
}
"user" -> {
@@ -352,10 +264,7 @@ private constructor(
it.validate()
}
?.let {
- return ChatCompletionMessageParam(
- chatCompletionUserMessageParam = it,
- _json = json
- )
+ return ChatCompletionMessageParam(user = it, _json = json)
}
}
"assistant" -> {
@@ -363,10 +272,7 @@ private constructor(
it.validate()
}
?.let {
- return ChatCompletionMessageParam(
- chatCompletionAssistantMessageParam = it,
- _json = json
- )
+ return ChatCompletionMessageParam(assistant = it, _json = json)
}
}
"tool" -> {
@@ -374,10 +280,7 @@ private constructor(
it.validate()
}
?.let {
- return ChatCompletionMessageParam(
- chatCompletionToolMessageParam = it,
- _json = json
- )
+ return ChatCompletionMessageParam(tool = it, _json = json)
}
}
"function" -> {
@@ -385,10 +288,7 @@ private constructor(
it.validate()
}
?.let {
- return ChatCompletionMessageParam(
- chatCompletionFunctionMessageParam = it,
- _json = json
- )
+ return ChatCompletionMessageParam(function = it, _json = json)
}
}
}
@@ -406,18 +306,12 @@ private constructor(
provider: SerializerProvider
) {
when {
- value.chatCompletionDeveloperMessageParam != null ->
- generator.writeObject(value.chatCompletionDeveloperMessageParam)
- value.chatCompletionSystemMessageParam != null ->
- generator.writeObject(value.chatCompletionSystemMessageParam)
- value.chatCompletionUserMessageParam != null ->
- generator.writeObject(value.chatCompletionUserMessageParam)
- value.chatCompletionAssistantMessageParam != null ->
- generator.writeObject(value.chatCompletionAssistantMessageParam)
- value.chatCompletionToolMessageParam != null ->
- generator.writeObject(value.chatCompletionToolMessageParam)
- value.chatCompletionFunctionMessageParam != null ->
- generator.writeObject(value.chatCompletionFunctionMessageParam)
+ value.developer != null -> generator.writeObject(value.developer)
+ value.system != null -> generator.writeObject(value.system)
+ value.user != null -> generator.writeObject(value.user)
+ value.assistant != null -> generator.writeObject(value.assistant)
+ value.tool != null -> generator.writeObject(value.tool)
+ value.function != null -> generator.writeObject(value.function)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid ChatCompletionMessageParam")
}
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 0bce88696..b96e14ce1 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
@@ -118,7 +118,7 @@ private constructor(
* The content used for a Predicted Output. This is often the text of a file you are
* regenerating with minor changes.
*/
- fun content(textContent: String) = content(Content.ofTextContent(textContent))
+ fun content(text: String) = content(Content.ofText(text))
/**
* An array of content parts with a defined type. Supported options differ based on the
@@ -169,7 +169,7 @@ private constructor(
@JsonSerialize(using = Content.Serializer::class)
class Content
private constructor(
- private val textContent: String? = null,
+ private val text: String? = null,
private val arrayOfContentParts: List? = null,
private val _json: JsonValue? = null,
) {
@@ -178,7 +178,7 @@ private constructor(
* The content used for a Predicted Output. This is often the text of a file you are
* regenerating with minor changes.
*/
- fun textContent(): Optional = Optional.ofNullable(textContent)
+ fun text(): Optional = Optional.ofNullable(text)
/**
* An array of content parts with a defined type. Supported options differ based on the
@@ -188,7 +188,7 @@ private constructor(
fun arrayOfContentParts(): Optional> =
Optional.ofNullable(arrayOfContentParts)
- fun isTextContent(): Boolean = textContent != null
+ fun isText(): Boolean = text != null
fun isArrayOfContentParts(): Boolean = arrayOfContentParts != null
@@ -196,7 +196,7 @@ private constructor(
* The content used for a Predicted Output. This is often the text of a file you are
* regenerating with minor changes.
*/
- fun asTextContent(): String = textContent.getOrThrow("textContent")
+ fun asText(): String = text.getOrThrow("text")
/**
* An array of content parts with a defined type. Supported options differ based on the
@@ -210,7 +210,7 @@ private constructor(
fun accept(visitor: Visitor): T {
return when {
- textContent != null -> visitor.visitTextContent(textContent)
+ text != null -> visitor.visitText(text)
arrayOfContentParts != null -> visitor.visitArrayOfContentParts(arrayOfContentParts)
else -> visitor.unknown(_json)
}
@@ -225,7 +225,7 @@ private constructor(
accept(
object : Visitor {
- override fun visitTextContent(textContent: String) {}
+ override fun visitText(text: String) {}
override fun visitArrayOfContentParts(
arrayOfContentParts: List
@@ -242,14 +242,14 @@ private constructor(
return true
}
- return /* spotless:off */ other is Content && textContent == other.textContent && arrayOfContentParts == other.arrayOfContentParts /* spotless:on */
+ return /* spotless:off */ other is Content && text == other.text && arrayOfContentParts == other.arrayOfContentParts /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(textContent, arrayOfContentParts) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(text, arrayOfContentParts) /* spotless:on */
override fun toString(): String =
when {
- textContent != null -> "Content{textContent=$textContent}"
+ text != null -> "Content{text=$text}"
arrayOfContentParts != null -> "Content{arrayOfContentParts=$arrayOfContentParts}"
_json != null -> "Content{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Content")
@@ -261,7 +261,7 @@ private constructor(
* The content used for a Predicted Output. This is often the text of a file you are
* regenerating with minor changes.
*/
- @JvmStatic fun ofTextContent(textContent: String) = Content(textContent = textContent)
+ @JvmStatic fun ofText(text: String) = Content(text = text)
/**
* An array of content parts with a defined type. Supported options differ based on the
@@ -279,7 +279,7 @@ private constructor(
* The content used for a Predicted Output. This is often the text of a file you are
* regenerating with minor changes.
*/
- fun visitTextContent(textContent: String): T
+ fun visitText(text: String): T
/**
* An array of content parts with a defined type. Supported options differ based on the
@@ -301,7 +301,7 @@ private constructor(
val json = JsonValue.fromJsonNode(node)
tryDeserialize(node, jacksonTypeRef())?.let {
- return Content(textContent = it, _json = json)
+ return Content(text = it, _json = json)
}
tryDeserialize(node, jacksonTypeRef>()) {
it.forEach { it.validate() }
@@ -322,7 +322,7 @@ private constructor(
provider: SerializerProvider
) {
when {
- value.textContent != null -> generator.writeObject(value.textContent)
+ value.text != null -> generator.writeObject(value.text)
value.arrayOfContentParts != null ->
generator.writeObject(value.arrayOfContentParts)
value._json != null -> generator.writeObject(value._json)
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 94b5cf3c8..cb7a96ced 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
@@ -117,7 +117,7 @@ private constructor(
fun content(content: JsonField) = apply { this.content = content }
/** The contents of the system message. */
- fun content(textContent: String) = content(Content.ofTextContent(textContent))
+ fun content(text: String) = content(Content.ofText(text))
/**
* An array of content parts with a defined type. For system messages, only type `text` is
@@ -174,13 +174,13 @@ private constructor(
@JsonSerialize(using = Content.Serializer::class)
class Content
private constructor(
- private val textContent: String? = null,
+ private val text: String? = null,
private val arrayOfContentParts: List? = null,
private val _json: JsonValue? = null,
) {
/** The contents of the system message. */
- fun textContent(): Optional = Optional.ofNullable(textContent)
+ fun text(): Optional = Optional.ofNullable(text)
/**
* An array of content parts with a defined type. For system messages, only type `text` is
@@ -189,12 +189,12 @@ private constructor(
fun arrayOfContentParts(): Optional> =
Optional.ofNullable(arrayOfContentParts)
- fun isTextContent(): Boolean = textContent != null
+ fun isText(): Boolean = text != null
fun isArrayOfContentParts(): Boolean = arrayOfContentParts != null
/** The contents of the system message. */
- fun asTextContent(): String = textContent.getOrThrow("textContent")
+ fun asText(): String = text.getOrThrow("text")
/**
* An array of content parts with a defined type. For system messages, only type `text` is
@@ -207,7 +207,7 @@ private constructor(
fun accept(visitor: Visitor): T {
return when {
- textContent != null -> visitor.visitTextContent(textContent)
+ text != null -> visitor.visitText(text)
arrayOfContentParts != null -> visitor.visitArrayOfContentParts(arrayOfContentParts)
else -> visitor.unknown(_json)
}
@@ -222,7 +222,7 @@ private constructor(
accept(
object : Visitor {
- override fun visitTextContent(textContent: String) {}
+ override fun visitText(text: String) {}
override fun visitArrayOfContentParts(
arrayOfContentParts: List
@@ -239,14 +239,14 @@ private constructor(
return true
}
- return /* spotless:off */ other is Content && textContent == other.textContent && arrayOfContentParts == other.arrayOfContentParts /* spotless:on */
+ return /* spotless:off */ other is Content && text == other.text && arrayOfContentParts == other.arrayOfContentParts /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(textContent, arrayOfContentParts) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(text, arrayOfContentParts) /* spotless:on */
override fun toString(): String =
when {
- textContent != null -> "Content{textContent=$textContent}"
+ text != null -> "Content{text=$text}"
arrayOfContentParts != null -> "Content{arrayOfContentParts=$arrayOfContentParts}"
_json != null -> "Content{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Content")
@@ -255,7 +255,7 @@ private constructor(
companion object {
/** The contents of the system message. */
- @JvmStatic fun ofTextContent(textContent: String) = Content(textContent = textContent)
+ @JvmStatic fun ofText(text: String) = Content(text = text)
/**
* An array of content parts with a defined type. For system messages, only type `text`
@@ -269,7 +269,7 @@ private constructor(
interface Visitor {
/** The contents of the system message. */
- fun visitTextContent(textContent: String): T
+ fun visitText(text: String): T
/**
* An array of content parts with a defined type. For system messages, only type `text`
@@ -290,7 +290,7 @@ private constructor(
val json = JsonValue.fromJsonNode(node)
tryDeserialize(node, jacksonTypeRef())?.let {
- return Content(textContent = it, _json = json)
+ return Content(text = it, _json = json)
}
tryDeserialize(node, jacksonTypeRef>()) {
it.forEach { it.validate() }
@@ -311,7 +311,7 @@ private constructor(
provider: SerializerProvider
) {
when {
- value.textContent != null -> generator.writeObject(value.textContent)
+ value.text != null -> generator.writeObject(value.text)
value.arrayOfContentParts != null ->
generator.writeObject(value.arrayOfContentParts)
value._json != null -> generator.writeObject(value._json)
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 dde03bb6e..2a7b47d64 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
@@ -34,7 +34,7 @@ import java.util.Optional
class ChatCompletionToolChoiceOption
private constructor(
private val auto: Auto? = null,
- private val chatCompletionNamedToolChoice: ChatCompletionNamedToolChoice? = null,
+ private val namedToolChoice: ChatCompletionNamedToolChoice? = null,
private val _json: JsonValue? = null,
) {
@@ -48,12 +48,12 @@ private constructor(
/**
* Specifies a tool the model should use. Use to force the model to call a specific function.
*/
- fun chatCompletionNamedToolChoice(): Optional =
- Optional.ofNullable(chatCompletionNamedToolChoice)
+ fun namedToolChoice(): Optional =
+ Optional.ofNullable(namedToolChoice)
fun isAuto(): Boolean = auto != null
- fun isChatCompletionNamedToolChoice(): Boolean = chatCompletionNamedToolChoice != null
+ fun isNamedToolChoice(): Boolean = namedToolChoice != null
/**
* `none` means the model will not call any tool and instead generates a message. `auto` means
@@ -65,16 +65,15 @@ private constructor(
/**
* Specifies a tool the model should use. Use to force the model to call a specific function.
*/
- fun asChatCompletionNamedToolChoice(): ChatCompletionNamedToolChoice =
- chatCompletionNamedToolChoice.getOrThrow("chatCompletionNamedToolChoice")
+ fun asNamedToolChoice(): ChatCompletionNamedToolChoice =
+ namedToolChoice.getOrThrow("namedToolChoice")
fun _json(): Optional = Optional.ofNullable(_json)
fun accept(visitor: Visitor): T {
return when {
auto != null -> visitor.visitAuto(auto)
- chatCompletionNamedToolChoice != null ->
- visitor.visitChatCompletionNamedToolChoice(chatCompletionNamedToolChoice)
+ namedToolChoice != null -> visitor.visitNamedToolChoice(namedToolChoice)
else -> visitor.unknown(_json)
}
}
@@ -90,10 +89,8 @@ private constructor(
object : Visitor {
override fun visitAuto(auto: Auto) {}
- override fun visitChatCompletionNamedToolChoice(
- chatCompletionNamedToolChoice: ChatCompletionNamedToolChoice
- ) {
- chatCompletionNamedToolChoice.validate()
+ override fun visitNamedToolChoice(namedToolChoice: ChatCompletionNamedToolChoice) {
+ namedToolChoice.validate()
}
}
)
@@ -105,16 +102,16 @@ private constructor(
return true
}
- return /* spotless:off */ other is ChatCompletionToolChoiceOption && auto == other.auto && chatCompletionNamedToolChoice == other.chatCompletionNamedToolChoice /* spotless:on */
+ return /* spotless:off */ other is ChatCompletionToolChoiceOption && auto == other.auto && namedToolChoice == other.namedToolChoice /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(auto, chatCompletionNamedToolChoice) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(auto, namedToolChoice) /* spotless:on */
override fun toString(): String =
when {
auto != null -> "ChatCompletionToolChoiceOption{auto=$auto}"
- chatCompletionNamedToolChoice != null ->
- "ChatCompletionToolChoiceOption{chatCompletionNamedToolChoice=$chatCompletionNamedToolChoice}"
+ namedToolChoice != null ->
+ "ChatCompletionToolChoiceOption{namedToolChoice=$namedToolChoice}"
_json != null -> "ChatCompletionToolChoiceOption{_unknown=$_json}"
else -> throw IllegalStateException("Invalid ChatCompletionToolChoiceOption")
}
@@ -133,12 +130,8 @@ private constructor(
* function.
*/
@JvmStatic
- fun ofChatCompletionNamedToolChoice(
- chatCompletionNamedToolChoice: ChatCompletionNamedToolChoice
- ) =
- ChatCompletionToolChoiceOption(
- chatCompletionNamedToolChoice = chatCompletionNamedToolChoice
- )
+ fun ofNamedToolChoice(namedToolChoice: ChatCompletionNamedToolChoice) =
+ ChatCompletionToolChoiceOption(namedToolChoice = namedToolChoice)
}
interface Visitor {
@@ -154,9 +147,7 @@ private constructor(
* Specifies a tool the model should use. Use to force the model to call a specific
* function.
*/
- fun visitChatCompletionNamedToolChoice(
- chatCompletionNamedToolChoice: ChatCompletionNamedToolChoice
- ): T
+ fun visitNamedToolChoice(namedToolChoice: ChatCompletionNamedToolChoice): T
fun unknown(json: JsonValue?): T {
throw OpenAIInvalidDataException("Unknown ChatCompletionToolChoiceOption: $json")
@@ -174,10 +165,7 @@ private constructor(
}
tryDeserialize(node, jacksonTypeRef()) { it.validate() }
?.let {
- return ChatCompletionToolChoiceOption(
- chatCompletionNamedToolChoice = it,
- _json = json
- )
+ return ChatCompletionToolChoiceOption(namedToolChoice = it, _json = json)
}
return ChatCompletionToolChoiceOption(_json = json)
@@ -194,8 +182,7 @@ private constructor(
) {
when {
value.auto != null -> generator.writeObject(value.auto)
- value.chatCompletionNamedToolChoice != null ->
- generator.writeObject(value.chatCompletionNamedToolChoice)
+ value.namedToolChoice != null -> generator.writeObject(value.namedToolChoice)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid ChatCompletionToolChoiceOption")
}
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 0129fba8f..1c4ccffd4 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
@@ -108,7 +108,7 @@ private constructor(
fun content(content: JsonField) = apply { this.content = content }
/** The contents of the tool message. */
- fun content(textContent: String) = content(Content.ofTextContent(textContent))
+ fun content(text: String) = content(Content.ofText(text))
/**
* An array of content parts with a defined type. For tool messages, only type `text` is
@@ -159,13 +159,13 @@ private constructor(
@JsonSerialize(using = Content.Serializer::class)
class Content
private constructor(
- private val textContent: String? = null,
+ private val text: String? = null,
private val arrayOfContentParts: List? = null,
private val _json: JsonValue? = null,
) {
/** The contents of the tool message. */
- fun textContent(): Optional = Optional.ofNullable(textContent)
+ fun text(): Optional = Optional.ofNullable(text)
/**
* An array of content parts with a defined type. For tool messages, only type `text` is
@@ -174,12 +174,12 @@ private constructor(
fun arrayOfContentParts(): Optional> =
Optional.ofNullable(arrayOfContentParts)
- fun isTextContent(): Boolean = textContent != null
+ fun isText(): Boolean = text != null
fun isArrayOfContentParts(): Boolean = arrayOfContentParts != null
/** The contents of the tool message. */
- fun asTextContent(): String = textContent.getOrThrow("textContent")
+ fun asText(): String = text.getOrThrow("text")
/**
* An array of content parts with a defined type. For tool messages, only type `text` is
@@ -192,7 +192,7 @@ private constructor(
fun accept(visitor: Visitor): T {
return when {
- textContent != null -> visitor.visitTextContent(textContent)
+ text != null -> visitor.visitText(text)
arrayOfContentParts != null -> visitor.visitArrayOfContentParts(arrayOfContentParts)
else -> visitor.unknown(_json)
}
@@ -207,7 +207,7 @@ private constructor(
accept(
object : Visitor {
- override fun visitTextContent(textContent: String) {}
+ override fun visitText(text: String) {}
override fun visitArrayOfContentParts(
arrayOfContentParts: List
@@ -224,14 +224,14 @@ private constructor(
return true
}
- return /* spotless:off */ other is Content && textContent == other.textContent && arrayOfContentParts == other.arrayOfContentParts /* spotless:on */
+ return /* spotless:off */ other is Content && text == other.text && arrayOfContentParts == other.arrayOfContentParts /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(textContent, arrayOfContentParts) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(text, arrayOfContentParts) /* spotless:on */
override fun toString(): String =
when {
- textContent != null -> "Content{textContent=$textContent}"
+ text != null -> "Content{text=$text}"
arrayOfContentParts != null -> "Content{arrayOfContentParts=$arrayOfContentParts}"
_json != null -> "Content{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Content")
@@ -240,7 +240,7 @@ private constructor(
companion object {
/** The contents of the tool message. */
- @JvmStatic fun ofTextContent(textContent: String) = Content(textContent = textContent)
+ @JvmStatic fun ofText(text: String) = Content(text = text)
/**
* An array of content parts with a defined type. For tool messages, only type `text` is
@@ -254,7 +254,7 @@ private constructor(
interface Visitor {
/** The contents of the tool message. */
- fun visitTextContent(textContent: String): T
+ fun visitText(text: String): T
/**
* An array of content parts with a defined type. For tool messages, only type `text` is
@@ -275,7 +275,7 @@ private constructor(
val json = JsonValue.fromJsonNode(node)
tryDeserialize(node, jacksonTypeRef())?.let {
- return Content(textContent = it, _json = json)
+ return Content(text = it, _json = json)
}
tryDeserialize(node, jacksonTypeRef>()) {
it.forEach { it.validate() }
@@ -296,7 +296,7 @@ private constructor(
provider: SerializerProvider
) {
when {
- value.textContent != null -> generator.writeObject(value.textContent)
+ value.text != null -> generator.writeObject(value.text)
value.arrayOfContentParts != null ->
generator.writeObject(value.arrayOfContentParts)
value._json != null -> generator.writeObject(value._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 b93553cbb..afd0e9665 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
@@ -113,7 +113,7 @@ private constructor(
fun content(content: JsonField) = apply { this.content = content }
/** The text contents of the message. */
- fun content(textContent: String) = content(Content.ofTextContent(textContent))
+ fun content(text: String) = content(Content.ofText(text))
/**
* An array of content parts with a defined type. Supported options differ based on the
@@ -171,13 +171,13 @@ private constructor(
@JsonSerialize(using = Content.Serializer::class)
class Content
private constructor(
- private val textContent: String? = null,
+ private val text: String? = null,
private val arrayOfContentParts: List? = null,
private val _json: JsonValue? = null,
) {
/** The text contents of the message. */
- fun textContent(): Optional = Optional.ofNullable(textContent)
+ fun text(): Optional